diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,38 +1,39 @@ # Please note that the content of this file is strictly advisory. -# No locks listed here are valid. The only strict review requirements -# are granted by core. These are documented in head/LOCKS and enforced -# by svnadmin/conf/approvers. +# No locks listed here are valid. The only strict review requirements +# are granted by core. These are documented in head/LOCKS and enforced +# by gitadm@. # -# The source tree is a community effort. However, some folks go to the -# trouble of looking after particular areas of the tree. In return for +# The source tree is a community effort. However, some folks go to the +# trouble of looking after particular areas of the tree. In return for # their active caretaking of the code it is polite to coordinate changes # with them. This is a list of people who have expressed an interest in # part of the code or listed their active caretaking role so that other -# committers can easily find somebody who is familiar with it. The notes +# committers can easily find somebody who is familiar with it. The notes # should specify if there is a 3rd party source tree involved or other # things that should be kept in mind. # -# However, this is not a 'big stick', it is an offer to help and a source -# of guidance. It does not override the communal nature of the tree. -# It is not a registry of 'turf' or private property. +# However, this is not a 'big stick', it is an offer to help and a +# source of guidance. It does not override the communal nature of the +# tree. It is not a registry of 'turf' or private property. # # *** -# This list is prone to becoming stale quickly. The best way to find the recent -# maintainer of a sub-system is to check recent logs for that directory or -# sub-system. +# This list is prone to becoming stale quickly. The best way to find the +# recent maintainer of a sub-system is to check recent logs for that +# directory or sub-system. # *** # # *** # Maintainers are encouraged to visit: # https://reviews.freebsd.org/herald # -# and configure Phabricator notifications for parts of the tree which they -# maintain. Notifications can automatically be sent when someone proposes a -# revision or makes a commit to the specified subtree. +# and configure Phabricator notifications for parts of the tree which +# they maintain. Notifications can automatically be sent when someone +# proposes a revision or makes a commit to the specified subtree. # *** /bin/sh @jillest /contrib/atf @ngie-eign +/contrib/blocklist @jlduran /contrib/capsicum-test @ngie-eign /contrib/googletest @ngie-eign /contrib/libcxxrt @DimitryAndric @emaste @@ -40,6 +41,7 @@ /contrib/llvm-project/libunwind @DimitryAndric @emaste @bsdjhb /contrib/llvm-project/lldb @DimitryAndric @emaste /contrib/llvm-project/openmp @DimitryAndric @emaste +/contrib/mandoc @concussious /contrib/netbsd-tests @ngie-eign /contrib/netbsd-tests/crypto/opencrypto/ @jmgurney /contrib/netbsd-tests/kernel/kqueue/ @jmgurney @@ -50,6 +52,9 @@ /crypto/openssl/ @juikim /etc/mail @gshapiro /etc/sendmail @gshapiro +/lib/libblocklist @jlduran +/lib/libc/string/ @fuz +/lib/libc/*/string/ @fuz /lib/libc/sys/kevent.c @jmgurney /lib/libefivar/ @bsdimp /lib/libfetch @dag-erling @@ -57,7 +62,7 @@ /lib/libpam/ @dag-erling /lib/libsecureboot/ @stephane-rochoy-stormshield /lib/libveriexec/ @stephane-rochoy-stormshield -/lib/libvmmapi @bsdjhb @grehan-freebsd +/lib/libvmmapi @bsdjhb @bryanv @markjdb @khng300 @markpeek /libexec/nuageinit/ @bapt /libexec/rc/rc.d/rctl/ @trasz /sbin/ipf @cschuber @@ -65,12 +70,13 @@ /sbin/nvmecontrol @bsdimp /sbin/veriexec/ @stephane-rochoy-stormshield /secure/usr.bin/openssl/ @juikim -/share/mk @bsdimp @bapt @bdrewery @emaste +/share/man/ @concussious +/share/mk @bsdimp @bapt @bdrewery @brooksdavis @emaste /stand @bsdimp /stand/lua @kevans91 /stand/veriexec.mk @stephane-rochoy-stormshield /sys/amd64/pci @bsdimp @bsdjhb -/sys/amd64/vmm/ @bsdjhb @grehan-freebsd +/sys/amd64/vmm/ @bsdjhb @bryanv @markjdb @khng300 @markpeek /sys/arm/allwinner @evadot /sys/arm64/arm64 @zxombie /sys/arm64/include @zxombie @@ -83,6 +89,9 @@ /sys/dev/iscsi/ @trasz /sys/dev/nctgpio/ @stephane-rochoy-stormshield /sys/dev/ncthwm/ @stephane-rochoy-stormshield +/sys/dev/mpi3mr @bsdimp +/sys/dev/mps @bsdimp +/sys/dev/mpr @bsdimp /sys/dev/nvd @bsdimp /sys/dev/nvme @bsdimp /sys/dev/pci @bsdimp @bsdjhb @@ -92,6 +101,7 @@ /sys/fs/fuse/ @asomers /sys/fs/procfs/ @dag-erling /sys/fs/pseudofs/ @dag-erling +/sys/kern/syscalls.master @brooksdavis /sys/kern/vfs_aio.c @asomers /sys/netinet/ip_carp.c @glebius /sys/netpfil/ipfilter @cschuber @@ -99,6 +109,7 @@ /sys/opencrypto/ @jmgurney /sys/security/mac_veriexec/ @stephane-rochoy-stormshield /sys/security/mac_veriexec_parser/ @stephane-rochoy-stormshield +/sys/tools/syscalls/ @brooksdavis /sys/x86/pci @bsdimp @bsdjhb /tests @ngie-eign /tests/sys/aio/ @asomers @@ -113,7 +124,9 @@ /usr.bin/rctl/ @trasz /usr.bin/top @grimreaper /usr.sbin/autofs/ @trasz -/usr.sbin/bhyve @bsdjhb @grehan-freebsd -/usr.sbin/bhyvectl @bsdjhb @grehan-freebsd -/usr.sbin/bhyveload @bsdjhb @grehan-freebsd +/usr.sbin/bhyve @bsdjhb @bryanv @markjdb @khng300 @markpeek +/usr.sbin/bhyvectl @bsdjhb @bryanv @markjdb @khng300 @markpeek +/usr.sbin/bhyveload @bsdjhb @bryanv @markjdb @khng300 @markpeek +/usr.sbin/blocklistctl @jlduran +/usr.sbin/blocklistd @jlduran /usr.sbin/lpr @gbergling diff --git a/.github/path-rules.txt b/.github/path-rules.txt new file mode 100644 --- /dev/null +++ b/.github/path-rules.txt @@ -0,0 +1,10 @@ +# +# Format the similar to CODEOWNERS: Each line has a path, whitespace and a +# message for contributors. +# +sys/contrib/device-tree :caution: No changes should be made here by pull request +# Catch all +contrib :warning: Contributed software usually managed by vendor branch +crypto :warning: Contributed crypto software usually managed by vendor branch +sys/contrib :warning: Contributed software usually managed by vendor branch +sys/crypto/skein :warning: Contributed crypto software usually managed by vendor branch diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml --- a/.github/workflows/checklist.yml +++ b/.github/workflows/checklist.yml @@ -36,11 +36,49 @@ pull_number: context.issue.number }); + /* Get owners */ + + let owners = []; + const { data: ownerData } = await github.rest.repos.getContent({ + owner: context.repo.owner, + repo: context.repo.repo, + path: '.github/CODEOWNERS', + ref: context.payload.pull_request.base.ref // Or a specific branch + }); + const oc = Buffer.from(ownerData.content, 'base64').toString(); + owners = oc.split(/\r?\n/) + .map(line => line.trim()) + // Filter out comments and empty lines + .filter(line => line && !line.startsWith('#')) + .map(line => { + // Split by the first block of whitespace to separate path and message + const [path, ...ownerParts] = line.substring(1).split(/\s+/); + return { path, owner: ownerParts.join(' ') }; + }); + + /* Get rules -- maybe refactor to a function for ownerPath too */ + let rules = []; + const { data: rulesData } = await github.rest.repos.getContent({ + owner: context.repo.owner, + repo: context.repo.repo, + path: '.github/path-rules.txt', + ref: context.payload.pull_request.base.ref // Or a specific branch + }); + const rc = Buffer.from(rulesData.content, 'base64').toString(); + rules = rc.split(/\r?\n/) + .map(line => line.trim()) + // Filter out comments and empty lines + .filter(line => line && !line.startsWith('#')) + .map(line => { + // Split by the first block of whitespace to separate path and message + const [path, ...messageParts] = line.split(/\s+/); + return { path, message: messageParts.join(' ') }; + }); + let checklist = {}; let checklist_len = 0; let comment_id = -1; - const msg_prefix = "Thank you for taking the time to contribute to FreeBSD!\n"; const addToChecklist = (msg, sha) => { if (!checklist[msg]) { checklist[msg] = []; @@ -72,6 +110,43 @@ addToChecklist("Real email address is needed", commit.sha); } + /* Check for different paths that have issues and/or owners */ + const { data: files } = await github.rest.pulls.listFiles({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + }); + + let infolist = {}; + let infolist_len = 0; + const addToInfolist = (msg) => { + if (!infolist[msg]) { + infolist[msg] = []; + infolist_len++; + } + } + + /* Give advice based on what's in the commit */ + for (const file of files) { + for (const owner of owners) { + if (file.filename.startsWith(owner.path)) { + addToInfolist("> [!IMPORTANT]\n> " + owner.owner + " wants to review changes to " + owner.path + "\n"); + } + } + for (const rule of rules) { + // Consider regexp in the future maybe? + if (file.filename.startsWith(rule.path)) { + if (rule.message.startsWith(":caution: ")) { + addToInfolist("> [!CAUTION]\n> " + rule.path + ": " + rule.message.substring(10) + "\n"); + } else if (rule.message.startsWith(":warning: ")) { + addToInfolist("> [!WARNING]\n> " + rule.path + ": " + rule.message.substring(10) + "\n"); + } else { + addToInfolist("> [!IMPORTANT]\n> " + rule.path + ": " + rule.message + "\n"); + } + } + } + } + /* Check if we've commented before. */ for (const comment of comments) { if (comment.user.login == "github-actions[bot]") { @@ -80,17 +155,28 @@ } } - if (checklist_len != 0) { - let msg = msg_prefix + - "There " + (checklist_len > 1 ? "are a few issues that need " : "is an issue that needs ") + - "to be fixed:\n"; + const msg_prefix = "Thank you for taking the time to contribute to FreeBSD!\n\n"; + if (checklist_len != 0 || infolist_len != 0) { + let msg = msg_prefix; let comment_func = comment_id == -1 ? github.rest.issues.createComment : github.rest.issues.updateComment; + if (checklist_len != 0) { + msg += + "There " + (checklist_len > 1 ? "are a few issues that need " : "is an issue that needs ") + + "to be resolved:\n"; - /* Loop for each key in "checklist". */ - for (const c in checklist) - msg += "- " + c + " (" + checklist[c].join(", ") + ")\n"; - msg += "\nPlease review [CONTRIBUTING.md](https://github.com/freebsd/freebsd-src/blob/main/CONTRIBUTING.md), then update and push your branch again.\n" - + /* Loop for each key in "checklist". */ + for (const c in checklist) + msg += "- " + c + " (" + checklist[c].join(", ") + ")\n"; + msg += "\n> [!NOTE]\n> Please review [CONTRIBUTING.md](https://github.com/freebsd/freebsd-src/blob/main/CONTRIBUTING.md), then update and push your branch again.\n\n" + } else { + let msg = "No Issues found.\n\n"; + } + if (infolist_len != 0) { + msg += "Some of files have special handling:\n" + for (const i in infolist) + msg += i + "\n"; + msg += "\n\n"; + } comment_func({ owner: context.repo.owner, repo: context.repo.repo, diff --git a/.mailmap b/.mailmap --- a/.mailmap +++ b/.mailmap @@ -23,3 +23,6 @@ Joyu Liao Joyu Liao +Pouria Mousavizadeh Tehrani +Pouria Mousavizadeh Tehrani +Siva Mahadevan diff --git a/MAINTAINERS b/MAINTAINERS --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1,26 +1,25 @@ - Please note that the content of this file is strictly advisory. -No locks listed here are valid. The only strict review requirements -are granted by core. These are documented in LOCKS and enforced +No locks listed here are valid. The only strict review requirements +are granted by core. These are documented in LOCKS and enforced by gitadm@. -The source tree is a community effort. However, some folks go to the -trouble of looking after particular areas of the tree. In return for +The source tree is a community effort. However, some folks go to the +trouble of looking after particular areas of the tree. In return for their active caretaking of the code it is polite to coordinate changes -with them. This is a list of people who have expressed an interest in +with them. This is a list of people who have expressed an interest in part of the code or listed their active caretaking role so that other -committers can easily find somebody who is familiar with it. The notes +committers can easily find somebody who is familiar with it. The notes should specify if there is a 3rd party source tree involved or other things that should be kept in mind. However, this is not a 'big stick', it is an offer to help and a source -of guidance. It does not override the communal nature of the tree. +of guidance. It does not override the communal nature of the tree. It is not a registry of 'turf' or private property. *** -This list is prone to becoming stale quickly. The best way to find the recent -maintainer of a sub-system is to check recent logs for that directory or -sub-system. +This list is prone to becoming stale quickly. The best way to find the +recent maintainer of a sub-system is to check recent logs for that +directory or sub-system. *** *** @@ -28,8 +27,8 @@ https://reviews.freebsd.org/herald and configure notifications for parts of the tree which they maintain. -Notifications can automatically be sent when someone proposes a revision or -makes a commit to the specified subtree. +Notifications can automatically be sent when someone proposes a revision +or makes a commit to the specified subtree. *** subsystem login notes @@ -48,6 +47,7 @@ contrib/llvm-project/llvm dim Pre-commit review preferred. contrib/llvm-project/openmp dim,emaste Pre-commit review preferred. contrib/netbsd-tests ngie,#test Pre-commit review requested. +contrib/mandoc ziaee Pre-commit review please contrib/pjdfstest asomers,ngie,pjd,#test Pre-commit review requested. *env(3) secteam Due to the problematic security history of this code, please have patches reviewed by secteam. @@ -70,6 +70,9 @@ nanobsd imp Pre-commit phabricator review requested. net80211 adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org nfs freebsd-fs@FreeBSD.org, rmacklem is best for reviews. +mpi3mr(4) imp Pre-commit review requested. +mpr(4) imp Pre-commit review requested. +mps(4) imp Pre-commit review requested. nvd(4) imp Pre-commit review requested. nvme(4) imp Pre-commit review requested. nvmecontrol(8) imp Pre-commit review requested. @@ -90,6 +93,7 @@ sh(1) jilles Pre-commit review requested. This also applies to kill(1), printf(1) and test(1) which are compiled in as builtins. +share/man ziaee Pre-commit review please share/mk imp, bapt, bdrewery, emaste, sjg Make is hard. share/mk/*.test.mk imp,bapt,bdrewery, Pre-commit review requested. emaste,ngie,sjg,#test diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,6 +51,11 @@ # xargs -n1 | sort | uniq -d; # done +# 20260114: remove ncurses html documentation +OLD_FILES+=usr/share/doc/ncurses/hackguide.html +OLD_FILES+=usr/share/doc/ncurses/ncurses-intro.html +OLD_DIRS+=usr/share/doc/ncurses + # 20251215: Remove intrinsic utilities OLD_FILES+=usr/bin/alias OLD_FILES+=usr/bin/bg diff --git a/RELNOTES b/RELNOTES --- a/RELNOTES +++ b/RELNOTES @@ -10,6 +10,53 @@ Changes to this file should not be MFCed. +0fa7b3bee72e, c71f18998e0b, 4162a419a475, f5a77dc8f8df: + LinuxKPI based wireless drivers, especially iwlwifi(4) are now + supported on RISC-V. + +8254b0dec02b3, bd55cbb50c588: + The mac(4) framework has been extended to support jail operations, + allowing a policy to constrain jail creation, modification, removal, and + attachment. Jails have additionally been made a first-class mac(4) + object, and a mac.label jail(8) property has been added to facilitate + administration of their labels. + +c558eca47970: + The smartpqi(4) driver was updated to vendor version 4660.0.2002 + for the SmartArry storage controllers. + +493d26c58e73: + The aq(4) driver was added, imported from the vendor repository. + This provides support for Aquantia / Marvell PCIe 1/2.5/5/10 Gigabit + Ethernet adapters (AQC107, AQC108, AQC109, AQC111, AQC112). + +1a7151f79664: + A new CAM provider was added to dtrace. This enables tracing of I/O + requests through the CAM layer without relying on fragile function + boundary tracing. See dtrace_cam(4) for details. + +b8c99e7d912f: + The tdestroy(3) function was added to libc. The tdestroy() function + destroys a whole search tree, freeing all allocated nodes. + +4bf8ce037dc8: + The rge(4) driver was added, ported from OpenBSD. This provides + support for RealTek RTL8125, RTL8126 and RTL8127 PCIe Ethernet + controllers. + +cbc6f7e941e4: + bhyve(8)'s VNC device can now listen on a unix(4) socket for VNC client + connections. + +39ee24182b92: + An rc(8) service can now be started as a specific user for auditing + purposes by setting the _audit_user rc.conf(5) variable. + +dcb0790bad43: + A setaudit(8) utility was added to the base system. This provides a + simple command-line wrapper for the setaudit(2) and setaudit_addr(2) + system calls. + 8e3fd450cc53, 949cff4dceff, 0e724de9ed6f, 9f49f436a9ec, e35191ccf3b3: Add support for an extension to NFSv4.2 (RFCnnnn) that supports handling of POSIX draft ACLs via getfacl(1)/setfacl(1). diff --git a/bin/sleep/sleep.c b/bin/sleep/sleep.c --- a/bin/sleep/sleep.c +++ b/bin/sleep/sleep.c @@ -59,31 +59,42 @@ parse_interval(const char *arg) { double num; - char unit, extra; - - switch (sscanf(arg, "%lf%c%c", &num, &unit, &extra)) { - case 2: - switch (unit) { - case 'd': - num *= 24; - /* FALLTHROUGH */ - case 'h': - num *= 60; - /* FALLTHROUGH */ - case 'm': - num *= 60; - /* FALLTHROUGH */ - case 's': - if (!isnan(num)) - return (num); - } + char *endptr; + + errno = 0; + num = strtod(arg, &endptr); + + /* No number found or overflow */ + if (endptr == arg || errno != 0 || isnan(num)) { + warnx("invalid time interval: %s", arg); + return (INFINITY); + } + + switch (*endptr) { + case '\0': + case 's': + break; + case 'm': + num *= 60; break; - case 1: - if (!isnan(num)) - return (num); + case 'h': + num *= 60 * 60; + break; + case 'd': + num *= 24 * 60 * 60; + break; + default: + warnx("invalid time interval: %s", arg); + return (INFINITY); } - warnx("invalid time interval: %s", arg); - return (INFINITY); + + /* Reject trailing garbage like 10ms or 10sx */ + if (endptr[1] != '\0') { + warnx("invalid time interval: %s", arg); + return (INFINITY); + } + + return (num); } int @@ -106,7 +117,7 @@ seconds = 0; while (argc--) seconds += parse_interval(*argv++); - if (seconds > INT_MAX) + if (seconds < 0 || seconds > (double)INT_MAX) usage(); if (seconds < 1e-9) exit(0); @@ -118,10 +129,11 @@ while (nanosleep(&time_to_sleep, &time_to_sleep) != 0) { if (errno != EINTR) err(1, "nanosleep"); - if (report_requested) { + if (report_requested) /* Reporting does not bother with nanoseconds. */ - warnx("about %ld second(s) left out of the original %ld", - (long)time_to_sleep.tv_sec, (long)original); + printf("about %ld second(s) left out of the original %ld\n", + (long)time_to_sleep.tv_sec, (long)original); + fflush(stdout); report_requested = 0; } } diff --git a/contrib/ncurses/AUTHORS b/contrib/ncurses/AUTHORS --- a/contrib/ncurses/AUTHORS +++ b/contrib/ncurses/AUTHORS @@ -1,5 +1,5 @@ ------------------------------------------------------------------------------- --- Copyright 2020,2021 Thomas E. Dickey -- +-- Copyright 2020-2024,2025 Thomas E. Dickey -- -- Copyright 2006,2017 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- @@ -26,7 +26,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: AUTHORS,v 1.5 2021/06/17 21:20:30 tom Exp $ +-- $Id: AUTHORS,v 1.8 2025/11/12 01:25:55 tom Exp $ ------------------------------------------------------------------------------- These are the principal authors/contributors of ncurses since 1.9.9e, in decreasing order of their contribution: @@ -36,5 +36,6 @@ ESR Eric S Raymond AVL Alexander V Lukyanov PB Philippe Blain +GBR Branden Robinson SV Sven Verdoolaege -NB Nicolas Boulenguez +NB Nicolas Boulenguez diff --git a/contrib/ncurses/COPYING b/contrib/ncurses/COPYING --- a/contrib/ncurses/COPYING +++ b/contrib/ncurses/COPYING @@ -1,4 +1,4 @@ -Copyright 2018-2023,2024 Thomas E. Dickey +Copyright 2018-2024,2025 Thomas E. Dickey Copyright 1998-2017,2018 Free Software Foundation, Inc. Permission is hereby granted, free of charge, to any person obtaining a @@ -26,4 +26,4 @@ authorization. -- vile:txtmode fc=72 --- $Id: COPYING,v 1.13 2024/01/05 21:13:17 tom Exp $ +-- $Id: COPYING,v 1.14 2025/01/04 10:53:46 tom Exp $ diff --git a/contrib/ncurses/INSTALL b/contrib/ncurses/INSTALL --- a/contrib/ncurses/INSTALL +++ b/contrib/ncurses/INSTALL @@ -1,5 +1,5 @@ ------------------------------------------------------------------------------- --- Copyright 2018-2023,2024 Thomas E. Dickey -- +-- Copyright 2018-2024,2025 Thomas E. Dickey -- -- Copyright 1998-2017,2018 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- @@ -26,7 +26,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: INSTALL,v 1.254 2024/04/27 14:21:05 tom Exp $ +-- $Id: INSTALL,v 1.263 2025/12/30 20:42:25 tom Exp $ --------------------------------------------------------------------- How to install Ncurses/Terminfo on your system --------------------------------------------------------------------- @@ -550,8 +550,8 @@ problem. --enable-bsdpad - Recognize BSD-style prefix padding. Some ancient BSD programs (such as - nethack) call tputs("50") to implement delays. + Recognize BSD-style prefix padding. Some programs written using + the BSD curses API use tputs("50") to implement delays. --enable-check-size Compile-in feature to detect screensize for terminals which do not @@ -587,7 +587,8 @@ as such to the debugger. See also the --disable-macros option. --enable-exp-win32 - When configuring for MinGW, use the experimental Windows 10 driver. + This is an obsolete option used for configuring the Windows 10 driver + for MinGW. --enable-ext-colors Extend the cchar_t structure to allow more than 16 colors to be @@ -650,6 +651,12 @@ may not be accurate, or that your stty settings have disabled the use of tabs. + --enable-install-prefix + Extend the --with-install-prefix feature to replace the prefix value + with $DESTDIR rather than simply prepending $DESTDIR to install + pathnames. This works with any "make" which supports AT&T style + variable substitution. + --enable-interop Compile-in experimental interop bindings. These provide generic types for the form-library. @@ -660,6 +667,10 @@ systems). If you do not specify this option, the configure script checks the current filesystem. + --enable-named-pipes + Compile-in support for named pipes, used to connect to Windows 10 + pseudo-console. + --enable-no-padding Compile-in support for the $NCURSES_NO_PADDING environment variable, which allows you to suppress the effect of non-mandatory padding in @@ -703,7 +714,7 @@ Use rpath option when generating shared libraries, and (with some restrictions) when linking the corresponding programs. This originally (in 1997) applied mainly to systems using the GNU linker (read the - manpage). + man page). More recently it is useful for systems that require special treatment shared libraries in "unusual" locations. The "system" libraries reside @@ -768,9 +779,9 @@ unless you have disabled the extended functions. --enable-term-driver - Enable experimental terminal-driver. This is currently used for the - MinGW port, by providing a way to substitute the low-level terminfo - library with different terminal drivers. + Enable terminal-driver. This is required for the MinGW port, by + providing a way to substitute the low-level terminfo library with + different terminal drivers. --enable-termcap Compile in support for reading terminal descriptions from termcap if no @@ -1097,34 +1108,35 @@ ./configure --enable-static --with-manpage-aliases - Tell the configure script you wish to create entries in the - man-directory for aliases to manpages which list them, e.g., the - functions in the panel manpage. This is the default. You can disable - it if your man program does this. You can also disable - --with-manpage-symlinks to install files containing a ".so" command - rather than symbolic links. + Create files in subdirectories of the installation "man" directory that + alias the man pages documenting them. For example, the "beep" man page + also documents the function "flash". This is the default. You can + disable this procedure if your system's makewhatis(8) or mandb(8) + program indexes the directory to which the pages are installed. If you + disable man page symlinks by specifying "--without-manpage-symlinks", + the alias pages are created as stubs containing ".so" *roff requests. --with-manpage-format=XXX - Tell the configure script how you would like to install man-pages. The - option value must be one of these: gzip, compress, BSDI, normal, - formatted. If you do not give this option, the configure script + Tell the configure script how you would like to install man pages. The + option value must be one of these: "gzip", "compress", "BSDI", "normal", + "formatted". If you do not specify this option, the configure script attempts to determine which is the case. --with-manpage-renames=XXX - Tell the configure script that you wish to rename the manpages while - installing. Currently the only distribution which does this is Debian. + Tell the configure script that you wish to rename the man pages when + installing them. Debian and distributions descended from it do this. The option value specifies the name of a file that lists the renamed - files, e.g., $srcdir/man/man_db.renames + files, e.g., "$srcdir/man/man_db.renames". --with-manpage-symlinks Tell the configure script that you wish to make symbolic links in the - man-directory for aliases to the man-pages. This is the default, but - can be disabled for systems that provide this automatically. Doing - this on systems that do not support symbolic links will result in - copying the man-page for each alias. + man-directory for aliases to the man pages. This is the default, but + can be disabled for systems that provide this service automatically. + Doing this on systems that do not support symbolic links creates a copy + of the target man page for each alias. --with-manpage-tbl - Tell the configure script that you wish to preprocess the manpages + Tell the configure script that you wish to preprocess the man pages by running them through tbl to generate tables understandable by nroff. @@ -1182,11 +1194,11 @@ --with-pkg-config-libdir[=DIR] If pkg-config was found, override the automatic check for its library path. The optional DIR value can be - + "auto", automatically use pkg-config's library directory, or - + "libdir", use a ${libdir}/pkgconfig (based on the configuration), or - + a directory path, i.e., beginning with "/". The configure script allows only a single directory, because @@ -1351,11 +1363,9 @@ several builds, some symbols will be listed in the the ".map" files that do not happen to be present in one configuration or another. - The sample ".map" (and ".sym") files are generated using a set of - scripts which build several configurations for each release version, - checking to see which of the "_nc_" symbols can be made local. In - addition to the ncurses libraries and programs, the symbols used - by the "tack" program before version 1.08 are made global. + The sample ".map" (and ".sym") files were generated using a set of + scripts which built several configurations for each release version, + checking to see which of the "_nc_" symbols can be made local. These sample ".map" files will not cover all possible combinations. In some cases, e.g., when using the --with-weak-symbols option, you @@ -1393,10 +1403,10 @@ --without-curses-h Don't install the ncurses header with the name "curses.h". Rather, - install as "ncurses.h" and modify the installed headers and manpages + install as "ncurses.h" and modify the installed headers and man pages accordingly. - Likewise, do not install an alias "curses" for the ncurses manpage. + Likewise, do not install an alias "curses" for the ncurses man page. --without-cxx XSI curses declares "bool" as part of the interface. C++ also declares @@ -1419,7 +1429,7 @@ Do not use dlsym() to load GPM dynamically. --without-manpages - Tell the configure script to suppress the install of ncurses' manpages. + Tell the configure script to suppress the install of ncurses' man pages. --without-progs Tell the configure script to suppress the build of ncurses' application @@ -1451,7 +1461,32 @@ you may encounter when building a system with different versions of ncurses: - 6.5 (Apt 27, 2024) + 6.6 (Dec 30, 2025) + Interface changes: + + + none + + Added extensions: + + + none + + Added internal functions (other than "_sp" variants): + + + _nc_is_path_found + + Removed internal functions: + + + none + + Modified internal functions: + + + These now pass a const parameter: _nc_has_mouse, + _nc_reset_color_pair, _nc_free_entry, and _nc_timed_wait. + + These now use a NCURSES_BOOL where an int was used: + _nc_setupscreen, _nc_keypad, _nc_unicode_locale, and + _nc_retrace_bool. + + 6.5 (Apr 27, 2024) Interface changes: + the WINDOW structure and some related internal data types declared diff --git a/contrib/ncurses/MANIFEST b/contrib/ncurses/MANIFEST --- a/contrib/ncurses/MANIFEST +++ b/contrib/ncurses/MANIFEST @@ -36,6 +36,8 @@ ./Ada95/mk-pkg.awk ./Ada95/package/AdaCurses-doc.spec ./Ada95/package/AdaCurses.spec +./Ada95/package/debian/adacurses.lintian-overrides +./Ada95/package/debian/adacurses.triggers ./Ada95/package/debian/compat ./Ada95/package/debian/control ./Ada95/package/debian/copyright @@ -556,21 +558,18 @@ ./include/headers ./include/nc_access.h ./include/nc_alloc.h -./include/nc_mingw.h ./include/nc_panel.h ./include/nc_string.h ./include/nc_termios.h ./include/nc_tparm.h -./include/nc_win32.h +./include/nc_win32.h.in ./include/ncurses_cfg.hin ./include/ncurses_defs ./include/ncurses_dll.h.in -./include/ncurses_mingw.h ./include/term_entry.h ./include/termcap.h.in ./include/tic.h ./include/unctrl.h.in -./include/win32_curses.h ./install-sh ./man/MKada_config.in ./man/MKncu_config.in @@ -900,6 +899,7 @@ ./ncurses/llib-ltinfow ./ncurses/modules ./ncurses/new_pair.h +./ncurses/report_ctype.c ./ncurses/report_hashing.c ./ncurses/report_offsets.c ./ncurses/term.priv.h @@ -1007,12 +1007,11 @@ ./ncurses/win32con/gettimeofday.c ./ncurses/win32con/wcwidth.c ./ncurses/win32con/win32_driver.c -./ncurses/win32con/win_driver.c ./package/debian-mingw/changelog ./package/debian-mingw/compat ./package/debian-mingw/control ./package/debian-mingw/copyright -./package/debian-mingw/mingw32-ncurses6.lintian-overrides +./package/debian-mingw/mingw32-ncurses6td.lintian-overrides ./package/debian-mingw/rules ./package/debian-mingw/source/format ./package/debian-mingw/watch @@ -1020,7 +1019,7 @@ ./package/debian-mingw64/compat ./package/debian-mingw64/control ./package/debian-mingw64/copyright -./package/debian-mingw64/mingw64-ncurses6.lintian-overrides +./package/debian-mingw64/mingw64-ncurses6td.lintian-overrides ./package/debian-mingw64/rules ./package/debian-mingw64/source/format ./package/debian-mingw64/watch @@ -1028,10 +1027,10 @@ ./package/debian/compat ./package/debian/control ./package/debian/copyright -./package/debian/ncurses6.lintian-overrides -./package/debian/ncurses6.triggers -./package/debian/ncursest6.lintian-overrides -./package/debian/ncursest6.triggers +./package/debian/ncurses6td.lintian-overrides +./package/debian/ncurses6td.triggers +./package/debian/ncursest6td.lintian-overrides +./package/debian/ncursest6td.triggers ./package/debian/rules ./package/debian/source/format ./package/debian/watch @@ -1190,6 +1189,8 @@ ./test/package/debian/control ./test/package/debian/copyright ./test/package/debian/docs +./test/package/debian/ncurses-examples.lintian-overrides +./test/package/debian/ncursest-examples.lintian-overrides ./test/package/debian/rules ./test/package/debian/source/format ./test/package/debian/watch diff --git a/contrib/ncurses/Makefile.in b/contrib/ncurses/Makefile.in --- a/contrib/ncurses/Makefile.in +++ b/contrib/ncurses/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.46 2022/10/01 22:53:36 tom Exp $ +# $Id: Makefile.in,v 1.51 2025/10/25 18:01:01 tom Exp $ ############################################################################## -# Copyright 2018-2021,2022 Thomas E. Dickey # +# Copyright 2018-2022,2025 Thomas E. Dickey # # Copyright 1998-2014,2015 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -35,11 +35,10 @@ SHELL = @SHELL@ VPATH = @srcdir@ -DESTDIR=@DESTDIR@ -RPATH_LIST=@RPATH_LIST@ -TOP_MFLAGS = @cf_cv_makeflags@ DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)" - @SET_MAKE@ +@SET_DESTDIR@ +RPATH_LIST = @RPATH_LIST@ +TOP_MFLAGS = DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)" NCURSES_MAJOR = @NCURSES_MAJOR@ NCURSES_MINOR = @NCURSES_MINOR@ @@ -93,6 +92,7 @@ @ echo '' @ echo ' extended funcs: '`test @NCURSES_EXT_FUNCS@ != 0 && echo yes || echo no` @ echo ' xterm terminfo: '@WHICH_XTERM@ + @ echo ' ABI suffix: '`if test -n "@ABI_SUFFIX@"; then echo @ABI_SUFFIX@; else echo "(none)"; fi` @ echo '' @ echo ' bin directory: '$(bindir) @ echo ' lib directory: '$(libdir) @@ -114,13 +114,10 @@ distclean \ realclean :: -check : - @ echo The test-programs are interactive - - # Put the common rules here so that we can easily construct the list of # directories to visit. all \ +check \ clean \ distclean \ mostlyclean \ diff --git a/contrib/ncurses/Makefile.os2 b/contrib/ncurses/Makefile.os2 --- a/contrib/ncurses/Makefile.os2 +++ b/contrib/ncurses/Makefile.os2 @@ -1,5 +1,5 @@ ############################################################################## -# Copyright 2020,2021 Thomas E. Dickey # +# Copyright 2020-2021,2025 Thomas E. Dickey # # Copyright 1998-2000,2006 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -26,7 +26,7 @@ # use or other dealings in this Software without prior written # # authorization. # ################################################################################ -# $Id: Makefile.os2,v 1.13 2021/06/17 21:20:30 tom Exp $ +# $Id: Makefile.os2,v 1.15 2025/07/12 10:48:01 tom Exp $ # # Wrapper Makefile for ncurses library under OS/2. # Author: Juan Jose Garcia Ripoll . @@ -247,7 +247,7 @@ os2dist : $(MAKE) -f Makefile.os2 os2clean ./configure --without-debug --with-install-prefix=`pwd|sed -e 's@^.:@@'`/$(OS2NAME) - $(MAKE) -f Makefile.os2 $(CF_MFLAGS) install.os2 + $(MAKE) -f Makefile.os2 install.os2 -rm -f $(OS2NAME).zip echo NCurses-$(NCURSES_MAJOR).$(NCURSES_MINOR)-$(NCURSES_PATCH) for emx > $(OS2NAME)/FILE_ID.DIZ echo Binary release. >> $(OS2NAME)/FILE_ID.DIZ diff --git a/contrib/ncurses/NEWS b/contrib/ncurses/NEWS --- a/contrib/ncurses/NEWS +++ b/contrib/ncurses/NEWS @@ -1,5 +1,5 @@ ------------------------------------------------------------------------------- --- Copyright 2018-2023,2024 Thomas E. Dickey -- +-- Copyright 2018-2024,2025 Thomas E. Dickey -- -- Copyright 1998-2017,2018 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- @@ -26,7 +26,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.4114 2024/04/27 18:00:35 tom Exp $ +-- $Id: NEWS,v 1.4390 2025/12/30 20:31:07 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -46,6 +46,575 @@ Changes through 1.9.9e did not credit all contributions; it is not possible to add this information. +20251230 6.6 release for upload to ftp.gnu.org + + update announcement + + corrected an ifdef needed for mouse support in MinGW/Windows + + eliminate remaining duplicate code between MinGW/Windows drivers + +20251227 + + make win32_curses.h obsolete in favor of nc_win32.h + + modify MinGW32 configuration to account for its use of Windows-style + pathnames in filesystem checks. + + replace --enable-exp-win32 option with --enable-named-pipes + +20251220 + > in-progress work to merge MinGW/Windows port. + + eliminate EXP_WIN32_DRIVER with USE_NAMED_PIPES + + change MS_TERMINAL to DEFAULT_TERM_VAR + +20251213 + + in-progress work to merge MinGW/Windows port. + + add a null-pointer check in tic -c option. + + add a limit-check in infocmp -i option (report/example by Yixuan Cao). + +20251206 + + in-progress work to merge MinGW/Windows port. + +20251129 + + in-progress work to merge MinGW/Windows port. + +20251123 + + revert change using NCURSES_SBOOL in tic.h which interfered with + sign-extension in tigetflag (Debian #1121191, cf: 20251101). + +20251122 + + in-progress work to merge MinGW/Windows port. + + correct expression for TINFO_LIB variable in misc/ncurses-config.in + (Debian #1121208, cf: 20251004). + +20251115 + + check for special case of wcrtomb() converting a single byte code to + a different single byte code, which glibc does for code 160 in the + KOI8-R encoding (report by Yury V Zaytsev). + + improve formatting/style of manpages (patches by Branden Robinson). + + amend recent changes to mouse handling to avoid a case which caused + a loop in wgetch until additional input is provided (htop #1769, + cf: 20250913). + +20251101 + + adjust generated terminfo.5 to omit tbl "x" column modifier if that + is unsupported, i.e., with old nroff/tbl (adapted from patch by + Branden Robinson). + + in-progress work to merge MinGW/Windows port. + +20251025 + + amend locale-portability fix in tty_update.c (MidnightCommander #4799, + cf: 20240203). + + add testing utility report_ctype + + update configure macros, improving check for $host_os + + correct a recent change to curs_termino.3x, along with formatting + fixes for manpages. + + corrected note about box() in curs_border.3x (patch by Jakub Horky, + cf: 20250201). + +20251018 + + add check for build-time utilities, in case cross-compiling is setup + with an invalid $BUILD_CC (prompted by discussion with Stas Sergeev). + + modify configure-script and makefiles to make it easier to override + the "--with-install-prefix" default with environment variable + (report by Stas Sergeev). + +20251010 + + fix stray "\" in curs_extend.3x, regen html manpages. + + regen html manpages with man2html 1.42, fixing a few cases where + headers were not linked (report by Branden Robinson). + +20251004 + + improve formatting/style of manpages (patches by Branden Robinson). + + in-progress work to merge MinGW/Windows port. + + improve configure check for "install". + +20250927 + + in-progress work to merge MinGW/Windows port. + +20250920 + + in-progress work to merge MinGW/Windows port. + + add configure check for , build-fix for flatpacks + (report by Stas Sergeev). + + update config.guess, config.sub + +20250913 + + update ncurses-howto. + + modify MKfallback.sh to eliminate TERMINFO environment variable. + + improve checks in run_tic.sh script, change some variable names to + reduce packager confusion (report by Stas Sergeev). + + disallow configure options which apply only to multiuser systems, to + improve ports to single-user systems such as Haiku (report by Stas + Sergeev). + + update ncurses/wcwidth.c, for MinGW ports, from xterm. + + correct _nc_to_char() for the case when wctob() is not found by + configure script (report/patch by Benno Schulenberg). + > patches by Robin Haberkorn + + modify handle_wheel case 2 to ignore the event as in case 1 for + mouse version 1, since that corresponds to a button 6 or 7 event + which is not supported with ABI 6. + + use separate read/write pointers in the mouse event queue to work + with too-close events for the click-detection to work reliably, + and further improve that in case mouseinterval(0) is used to + suppress click-detection. + +20250830 + + in-progress work to merge MinGW/Windows port. + + build-fix for experimental Windows configuration (report by Kirill + Makurin). + + improve pattern used for configure --with-xterm-kbs option. + +20250823 + + improve style of MKterminfo.sh script (patches by Branden Robinson). + + improve formatting/style of manpages (patches by Branden Robinson). + + remove redundant definition of ConsoleInfo. + + change scope of TTY, GET_TTY and SET_TTY to ncurses-internals + +20250816 + + remove redundant reference to compiler in libtool configuration of + mk-1st.awk (report by Lorinczy Zsigmond). + + build-fixes for --enable-exp-win32 configuration + + improve formatting/style of manpages (patches by Branden Robinson). + +20250809 + + add configure check for Win32 named pipes feature, using that to make + nc_mingw.h obsolete in favor of nc_win32.h + + amend limit used in alloc_pair, by applying an adjustment for default + colors only when the maximum number of color pairs is greater than + the maximum number of colors (report by "Ingvix"). + +20250802 + + fixes for reading Unicode characters in MinGW/Windows port (report by + Axel Reinhold). + +20250726 + + modify configure script cases for $host_os, to accommodate 64-bit + big-endian POWER linux with glibc (patch by Cosima Neidahl). + + add warning to configure script to address conflict between the + --enable-lp64 option and the options for overriding the types used + for chtype and mmask_t. + +20250720 + + further improve readability of header-files + + add a consistency-check for termio(s)/tty headers, to help with + cross-compiles (report by Stas Sergeev). + + remove some unused configure-macros + + add xterm+keypad to pccon+base -TD + + trim trailing blanks from a few files (report by Stas Sergeev). + +20250712 + + improve readability of term.h + + modify recursive make rules to avoid interference with GNU make's + "-j" option (report by Stas Sergeev). + +20250705 + + when installing the terminfo database, check if symbolic links are + supported before attemping to link lib/terminfo from share/terminfo + (report by Kirill Makurin). + + modify configure check for MAKEFLAGS/MFLAGS to ignore existing value + of these environment variables (report by Stas Sergeev). + + reserve -c/-l options in test/*.c for command/logging like vttest. + + add options to test/worm.c for benchmarking (Nibby Nebbulous) + + improve formatting/style of manpages (patches by Branden Robinson). + + improve readability of header-files (patches by Branden Robinson). + +20250628 + + fix a few compiler-warnings. + + simplify include for wchar.h in Windows port by removing the platform + ifdef's (report by Kirill Makurin). + + regen Ada95/configure (report by Sven Joachim). + +20250621 + + revise loop in wins_nwstr, to ensure that non-spacing characters are + combined with the base spacing character (report by Karl Knechtel). + + fixes for port using clang-cl or cl MSVC (report by Kirill Makurin). + + improve test-packages: + + convert debian*/copyright to DEP-5 format. + + modify ".spec" test-files to work around timestamp-clamping in + recent Fedora releases. + +20250614 + + reduce lintian warnings for test-packages. + + clean up some shellcheck warnings + + improve test/configure checks for X libraries, reducing duplicates + + fix some typos/errata in license text, to help with scripted checks + +20250531 + + improve logic in misc/run_tic.in for constructing symbolic link + when $DESTDIR is set. + +20250524 + + correct option-name used in configure script, which resulted in size + change for cchar_t (cf: 20250517). + +20250517 + + initial changes for some ABI 7 features: + + disable wgetch-events + + add feature for extending mouse-buttons + + add feature for extending direct-color support + + use bracketed+paste in nsterm, rlogin-color, screen, terminology -TD + +20250510 + + add rv/xr codes for domterm, mintty, mlterm -TD + + add xr code for putty -TD + + update teraterm to 5.0 -TD + + add rlogin-color -TD + +20250503 + + update/correct some of the rv/xr strings, checked with tack -TD + + use ansi+rca in sclp -TD + + use vt220+pcedit in sclp (Werner Fink) + + move some building blocks from illumos to sun-color, based on + illumos source-history -TD + + improve use-clauses: ansi+cup, ansi+idl1, ansi+rca, ansi+rca2, + ansi+sgrso, ansi+sgrul -TD + + add ecma+standout, ecma+underline -TD + + add rv code for alacritty -TD + + add rv/xr codes for contour, ghostty, iterm2, kitty, konsole, + vscode, vte, wezterm -TD + +20250426 + + expand note on extensions in curs_addch.3x + + add illumos, sun-16color, sun-256color, sun-direct -TD + + add wyse+cvis -TD + +20250419 + + add note on scrolling and lower-right corner to waddch and wadd_wch + manual pages. + +20250412 + + add pangoterm -TD + + add kf1 to kf5 to sclp (report by Werner Fink) + + add vt100+pf1-pf4 -TD + +20250405 + + improve formatting/style of manpages (patches by Branden Robinson). + + improve infocmp -E/-e fallback feature (report by Ville Rissanen): + + prefix names with "ti_" if they begin with a digit, e.g., 9term + + escape backslashes and double-quotes in description fields + + modify infocmp -E/-e fallback feature to reduce stricter compiler + warnings for the extended capability data. + + add sclp -TD + + add op to vt525 -TD + + update contour -TD + +20250329 + + add XM/xm to ms-terminal, to enable mouse with experimental Windows + driver -TD + + add -x option to infocmp in MKfallback.sh + + improve experimental Windows driver by restoring the scroll buffer + and console mode, e.g., when reset_prog_mode or endwin is called + (patch by Daniel Starke). + + add a buffer-limit check in postprocess_termcap (report/testcase by + Yifan Zhang). + +20250322 + + add a null pointer check in mouse-initialization, for the + experimental Windows driver (patch by Daniel Starke). + + improve makefile dependency in Ada95/src + + add note in user_caps.5 addressing a quibble about dates. + +20250315 + + improve formatting/style of manpages (patches by Branden Robinson). + +20250308 + + remove test in wgetch which applied notimeout to the initial read + of a character (patch by Branden Robinson). + + improve formatting/style of manpages (patches by Branden Robinson). + + fix a few compiler-warnings in MinGW port. + +20250301 + + add color to vt525 (Branden Robinson) + + add vt520-w and vt525-w (Branden Robinson) + + improve formatting/style of manpages (patches by Branden Robinson). + + improve configurability of alloca() as used in Windows ports. + + fix some typos in manpages. + + modify configure script checks for stdbool.h to fix build with older + gcc version. + +20250222 + + modify treatment of "n" parameter for waddnstr, waddnwstr, and + wins_nwstr to return OK when "n" is zero, for consistency with other + implementations (report by Benjamin Barenblat, cf: 20231118). + + formatting improvements for terminfo.5 (Debian #1096164). + +20250216 + + add limit-checks in alloc_entry.c and alloc_ttype.c to avoid indexing + errors when using infocmp to compare all capabilities when processing + a malformed terminfo binary which has a valid header (testcase by + "Ekkosun"). + +20250215 + + add gzip option for suppressing filename/timestamp information to an + overlooked case (cf: 20240330). + + correct spelling errors found with codespell. + + fix some typos in manpages (report by Sven Joachim) + + amend change to lib_set_term.c to work with thread configuration + (report by Rajeev Pillai, cf: 20250208). + +20250208 + + change etip.h.in to include either/both of and , + needed for another old BSD. + + update st (report by Alexander Kashpir) -TD + + add note for ghostty 1.1.0 -TD + + fix a few issues found with coverity. + +20250201 + + add to the possible headers declaring the C++ std::bad_alloc + (report by Carl Hansen). + + modify check for stdbool.h to be more conservative in case the + headers are used with a compiler other than that which was used to + configure (Redhat #2342514). + + improve MKlib_gen.sh handling of "bool" type, for building link_test + + improve formatting/style of manpages (patches by Branden Robinson). + +20250125 + + improve error-handling in c++ binding (report by Mingjie Shen). + + strict compiler-warning fixes for upcoming gcc15 + +20250118 + + improve pattern used for configure --with-xterm-kbs option (report by + Mingyu Wang) + + update configure macros, from work on cdk and dialog. + + change a parameter name in curs_sp_funcs.3x, for consistency (patch + by "WHR"). + > patches by Branden Robinson: + + improve formatting/style of manpages + + change winwstr() to a generated function, using the macro definition, + moving its handling of negative length parameter into winnwstr(). + + correct actual-function name in a few trace calls. + +20250111 + + add check for infinite loop in tic's use-resolution. + + increase limit on use-clauses from 32 to 40, warn but allow entries + which exceed the old limit. + + add some null-pointer checks after mallocs in test-programs. + +20250104 + + modify tput to warn about capabilities which expect parameters where + none are given; also repair the feature where multiple capabilities + can be handled on a single line. + + cleanup use-clauses -TD + + add linux+lockeys, xterm+r5+lockeys, xterm+r5+fkeys -TD + + add vt220+ufkeys, vt220+sfkeys + + revert man/manlinks.sed change, which loses aliases (cf: 20241228). + + modify MKlib_gen.c to allow for Solaris's definition of NULL as 0L + +20241228 + + correct conditional-compile for a case when the C compiler does not + have a bool type. + + add ghostty -TD + > patches by Branden Robinson: + + add comments to generated term.h to hint the configure options used + + use same subdir-convention for term.h, in configure script + + improve formatting/style of manpages + +20241221 + + modify ncurses/tinfo/MKfallback.sh to work with MacOS sed, which + lacks BSD-style \< and \> + + trim padding from sgr expression used in trim_sgr0, to avoid copying + the padding into the resulting sgr0 (report by Rajeev Pillai). + + strict compiler-warning fixes for upcoming gcc15 + +20241214 + + avoid redefining bool in curses.h if the platform already supports + that type (cf: 20241123). + + move include from etip.h.in to cursesw.h, to work around + breakage in Apple's port of ncurses. + + strict compiler-warning fixes for upcoming gcc15 + +20241207 + + strict compiler-warning fixes for upcoming gcc15 + +20241130 + + improve configure check for lint program. + + adjust options in test-programs to allow for consistent use of -c/-l + for command/logging. + + modify win_driver.c for MinGW to handle shift-tab and control-tab as + back-tab (report by Axel Reinhold) + +20241123 + + remove dependency on stdbool.h from configure script check for type + of bool when C++ binding is omitted (report by Sam James). + + compiler-warning fixes + +20241109 + + work around musl header ifdef's (report by Urs Jansen, cf: Gentoo + #920266). + + improve error-reporting in write_entry.c (report by Changqing Li). + + remove unused #include from DJGPP configuration (report by Stas + Sergeev). + + workaround/fix issues from clang-analyze + +20241102 + + remove djgpp-specific initialization to binary mode (report/patch by + Stas Sergeev). + + add extended-keys for djgpp 2.05 -TD + +20241026 + + update ms-terminal -TD + + add ms-terminal-direct -TD + + correct dimensions in test/popup_msg.c, fixing an overrun (patch by + Stas Sergeev, cf: 20211219). + +20241019 + + fixes for compiler warnings/cppcheck. + + build-fixes for DJGPP configuration (patches by Stas Sergeev) + +20241006 + + fixes for compiler warnings/cppcheck. + + use xterm+alt+title in wezterm -TD + +20240928 + + improve error-message from infocmp when a terminal entry cannot be + opened (patch by Branden Robinson). + + improve filtering of -L options in misc/gen-pkgconfig.in and in + misc/ncurses-config.in + + add check in wresize() for out-of-range dimensions (report by Peter + Bierma). + +20240922 + + add a few null-pointer checks in ncurses + + improve test-driver in ncurses/link_test.c + + restore background character in manpages as described in X/Open + Curses section 3.3.6, and add option "-c" to test programs to + illustrate a non-blank character in the window background property. + + improve formatting/style of manpages (patches by Branden Robinson). + + modify ncurses*-config to add -I option in --cflag where needed for + --disable-overwrite to match ".pc" files. + + disallow directories and block/character devices in safe-open. + + amend scr_restore() and scr_init() to remove the target window only + after validating the source window which will replace the target + (report by Zixi Liu). + +20240914 + + modify _nc_flush() to also flush stderr to help the flash capability + to work in bash (patch by Harm te Hennepe, cf: 20201128) + + omit -g and -fXXX flags from CFLAGS in misc/ncurses-config.in + + improve formatting/style of manpages (patches by Branden Robinson). + + improve examples in NCURSES-Programming-HOWTO.html + + update comments in terminfo.src -TD + +20240831 + + build-fix for a case in msys2 where gettimeofday() was available but + the fallback was partly configured. + > patch by Rafael Kitover: + + separate the _NC_WINDOWS platform macro into _NC_WINDOWS_NATIVE, + for MinGW and other native Win32 support, and _NC_WINDOWS, to make + some Win32 features available under the Cygwin runtime, in this case + the term-driver. + + make some minor adjustments to allow + ./configure --enable-term-driver + to also work on Cygwin platforms such as Cygwin and MSYS2. + +20240824 + + modify infocmp and tabs to use actual name in usage and header. + + modify test/demo_keyok.c to accept ^Q for quit, for consistency. + +20240817 + + review/update foot for 1.18.1 -TD + + add a note about DomTerm 3.2.0 -TD + + add new glob-expressions variables to list in config.status script + (patch by Werner Fink). + + add --enable-install-prefix to modify behavior of $DESTDIR to merge + or replace the value set by --prefix (adapted from suggestion by + Eli Zaretskii). + +20240810 + + modify misc/Makefile.in and misc/run_tic.in so that $DESTDIR is set + and used only in the makefile. + + modify CF_WITH_PKG_CONFIG_LIBDIR to allow for pkg-config using + DOS/Windows pathname syntax (report by Eli Zaretskii). + + improve glob-expressions in configure script + + remove unused Get_Menu_Screen() macro from menu.priv.h + + update config.guess, config.sub + +20240727 + + improve formatting/style of manpages (patches by Branden Robinson). + + fixes for compiler warnings/cppcheck. + + modify wattron/wattroff calls in form/m_post.c to call wattr_on and + wattr_off to omit cast used in the former for X/Open compatibility + (patch by Bill Gray). + + modify wezterm, omitting its broken left/right margin feature (report + by Thayne McCombs) -TD + +20240720 + + improve formatting/style of manpages (patches by Branden Robinson). + + modify configure script and misc/Makefile to accept glob expressions + that include Windows/DOS drive-letters (report by Eli Zaretskii). + + fix misspelled ifdef and correct return-value of _nc_mingw_tcflush in + win_driver.c (report/patch by Eli Zaretskii). + +20240713 + + modify misc/ncurses-config.in, improved match with pkg-config output. + +20240706 + + update configure script to use macro changes from dialog. + + modify CF_NCURSES_PTHREADS to avoid equating package and library + names. + +20240629 + + build-fix for ncurses-examples with newer PDCurses, which no longer + has stubs for unimplemented features. + + add help-popup for test_instr.c, test_inwstr.c + + modify checks in delwin to avoid checking if the window is a pad + until first checking if it is still on the active window-list + (cf: 20211115). + + improve -t option of test/gdc.c, allowing hours only, or hours and + minutes only. + +20240622 + + improve test/gdc.c (patch by Branden Robinson). + + improve formatting/style of manpages (patches by Branden Robinson). + + adjust naming of mingw *-config scripts to match the pkg-config names + + widen pattern in pc/*-config scripts to disallow more linker options + + add --cflags-only-I and --cflags-only-other options to + misc/ncurses-config.in + + revert change to CF_BUILD_CC macro (report by Vassili Courzakis, + cf: 20240518). + +20240615 + + improve formatting/style of manpages (patches by Branden Robinson). + + review/update modules files. + + improve install-rules in Ada95 makefiles (report by Branden Robinson). + + improve formatting/style of manpages in test-directory. + +20240608 + + change winwstr to return wide character count instead of OK (patch + by Branden Robinson). + + improve formatting/style of manpages (patches by Branden Robinson). + + rename testing dpkg's for ncurses6 to resolve a naming conflict with + Debian's ncurses packages. + +20240601 + + improve formatting/style of manpages (patches by Branden Robinson). + + change Ada95/configure to use --with-screen option rather than + --enable-widec, to provide more choices of underlying curses library + +20240525 + + build-fix for configure option --disable-ext-funcs + + improve formatting/style of manpages (patches by Branden Robinson). + + review/update iTerm2 for 3.5.0 -TD + +20240519 + + update Ada95/configure to match change for -DTRACE + + revert change to include/ncurses_defs, which caused build failure if + tracing was not enabled (report by Branden Robinson). + +20240518 + + improve formatting/style of manpages (patches by Branden Robinson). + + move makefile's -DTRACE into include/ncurses_cfg.h, to simplify use + of CFLAGS/CPPFLAGS. + + improve check for clock_gettime(), from xterm. + + modify configure script to work around broken gnatgcc script found in + gcc-13 builds. + +20240511 + + improve formatting/style of manpages (patches by Branden Robinson). + + limit value from ESCDELAY environment variable to 30 seconds, like + other delay limits. + + limit values from LINES and COLUMNS environment variables to 512 + (report by Miroslav Lichvar). + +20240504 + + update ncurses/wcwidth.c, for MinGW ports, from xterm. + + trim obsolete comment about tack from INSTALL. + 20240427 6.5 release for upload to ftp.gnu.org + update announcement + fixes/corrections for manpages (patches by Branden Robinson). @@ -223,7 +792,7 @@ modem (prompted by discussion with Werner Fink, Michal Suchanek, OpenSUSE #1201384, Debian #60377). + build-fixes for --with-caps variations. - + correct a couple of section-references in INSTALL. + + correct a couple of section references in INSTALL. 20231028 + move xterm focus mode 1004 from xterm+sm+1006 into xterm+focus as @@ -319,7 +888,7 @@ + minor grammatical fix for manpages (Branden Robinson). 20230729 - + improve manpages for wgetnstr() and wget_wnstr(). + + improve manpages for wgetnstr() and wget_nwstr(). + modify MinGW configuration to provide for running in MSYS/MSYS2 shells, assuming ConPTY support (patch by Pavel Fedin). + add assignment in CF_MAN_PAGES to fill in value for TERMINFO_DIRS in @@ -4262,7 +4831,7 @@ 20140621 + change shared-library suffix for AIX 5 and 6 to ".so", avoiding conflict with the static library (report by Ben Lentz). - + document RPATH_LIST in INSTALLATION file, as part of workarounds for + + document RPATH_LIST in INSTALL file, as part of workarounds for upgrading an ncurses library using the "--with-shared" option. + modify test/ncurses.c c/C tests to cycle through subsets of the total number of colors, to better illustrate 8/16/88/256-colors by @@ -10577,7 +11146,7 @@ (adapted from a patch by Ilya Zakharevich). + correct parameter types of vidputs() and vidattr() to agree with header files (report by William P Setzer). - + fix typos in several man-pages (patch by William P Setzer). + + fix typos in several man pages (patch by William P Setzer). + remove unneeded ifdef for __GNUG__ in CF_CPP_VSCAN_FUNC configure macro, which made ncurses C++ binding fail to build with other C++ compilers such as HPUX 11.x (report by Albert Chin-A-Young). @@ -10630,7 +11199,7 @@ wide-character structures (report by ). + ensure that _XOPEN_SOURCE_EXTENDED is defined in curses.priv.h if compiling for wide-character configuration. - + make addwnstr() handle non-spacing characters (patch by Sven + + make addnwstr() handle non-spacing characters (patch by Sven Verdoolaege). 20010630 @@ -11109,7 +11678,7 @@ absolute pathname for the build tree's lib directory (prompted by discussion with Albert Chin-A-Young). + modify "make install.man" and "make uninstall.man" to include tack's - man-page. + man page. + various fixes for install scripts used to support configure --srcdir and --with-install-prefix (reported by Matthew Clarke ). @@ -11336,7 +11905,7 @@ 20000708 5.1 release for upload to ftp.gnu.org + document configure options in INSTALL. - + add man-page for ncurses trace functions. + + add man page for ncurses trace functions. + correct return value shown in curs_touch.3x for is_linetouched() and is_wintouched(), in curs_initscr.3x for isendwin(), and in curs_termattr.3x for has_ic() and has_il(). @@ -12465,7 +13034,7 @@ running screen built with ncurses. + check if tmp_fp is opened in tic.c before closing it (patch by Pavel Roskin ). - + correct several font specification typos in man-pages. + + correct several font specification typos in man pages. 981220 + correct default value for BUILD_CC (reported by Larry Virden). @@ -12814,7 +13383,7 @@ + modify init_pair so that if a color-pair is reinitialized, we will repaint the areas of the screen whose color changes, like SVr4 curses (reported by Christian Maurer ). - + modify getsyx/setsyx macros to comply with SVr4 man-page which + + modify getsyx/setsyx macros to comply with SVr4 man page which says that leaveok() affects their behavior (report by Darryl Miles, patch by Alexander V Lukyanov). @@ -12827,7 +13396,7 @@ + implement tparm dynamic variables (reported by Xiaodan Tang). 980613 - + update man-page for for wattr_set, wattr_get (cf: 980509) + + update man page for wattr_set, wattr_get (cf: 980509) + correct limits in hashtest, which would cause nonprinting characters to be written to large screens. + correct configure script, when --without-cxx was specified: the @@ -13009,12 +13578,12 @@ option (patch by Jesse Thilo). + correct some places in configure script where $enableval was used rather than $withval (patch by Darryl Miles ). - + modify some man-pages so no '.' or '..' falls between TH and SH + + modify some man pages so no '.' or '..' falls between TH and SH macros, to accommodate man_db program (reported by Ian T. Zimmerman ). + terminfo.src 10.2.1 downloaded from ESR's webpage (ESR). > several changes by Juergen Pfeifer: - + add copyright notices (and rcs id's) on remaining man-pages. + + add copyright notices (and rcs id's) on remaining man pages. + corrected prototypes for slk_* functions, using chtype rather than attr_t. + implemented the wcolor_set() and slk_color() functions @@ -13164,7 +13733,7 @@ implemented. + correct _tracef calls in _tracedump(), which did not separate format from parameters. - + correct getopt string for tic "-o" option, and add it to man-page + + correct getopt string for tic "-o" option, and add it to man page synopsis (reported by Darren Hiebert ). + correct typo in panel/Makefile.in, reversed if-statement in scrolling optimization (Alexander V. Lukyanov). @@ -13251,7 +13820,7 @@ + resynchronizes the generated html manpages 971213 - + additional fixes for man-pages section-references + + additional fixes for man pages' section references + add (for debugging) a check for ich/ich1 conflict with smir/rmir to tic, etc. + remove hpa/vpa from rxvt terminal description because they are not @@ -13263,7 +13832,7 @@ + modify protection when installing libraries to (normally) not executable. HP-UX shared libraries are an exception. + add configure check for 'tack'. - + implement script for renaming section-references in man-page install, + + implement script for renaming section references in man page install, for Debian configuration. + add validity-check for SP in trace code in baudrate() (reported by Daniel Weaver). @@ -14398,9 +14967,9 @@ 970104 + workaround defect in autoconf 2.12 (which terminates configuration if no C++ compiler is found) by adding an option --without-cxx. - + modify several man-pages to use tbl, where .nf/.fi was used (reported + + modify several man pages to use tbl, where .nf/.fi was used (reported by Jesse Thilo). - + correct font-codes in some man-pages (patch by Jesse Thilo + + correct font codes in some man pages (patch by Jesse Thilo ) + use configure script's knowledge of existence of g++ library for the c++ Makefile (reported by Paul Jackson). @@ -14666,7 +15235,7 @@ simpler to construct tests (for double-check of _nc_hash_map tests). + correct ifdef's for c++ in curses.h + change default xterm type to xterm-x11r6. - + correct quoting in configure that made man-pages installed with + + correct quoting in configure that made man pages installed with $datadir instead of actual terminfo path. + correct whitespace in include/Caps, which caused kf11, clr_eol and clr_end to be omitted from terminfo.5 @@ -14878,7 +15447,7 @@ 960707 + rollback ESR's #305 change to terminfo.src (it breaks existing applications, e.g., 'less 290'). - + correct path of edit_man.sh, and fix typo that made all man-pages + + correct path of edit_man.sh, and fix typo that made all man pages preformatted. + restore man/menu_requestname.3x omitted in Zeyd's resync (oops). + auto-configure the GCC_PRINTFLIKE/GCC_SCANFLIKE macros (reported by @@ -14890,7 +15459,7 @@ descriptions. + work around autoconf bug, force $INSTALL to absolute path (reported by Zeyd). - + modify man-page install for BSDI to install preformatted .0 files + + modify man page install for BSDI to install preformatted .0 files (reported by David MacKenzie). + add/use gcc __attribute__ for printf and scanf in curses.h + added SGR attributes test-case to ncurses @@ -14991,7 +15560,7 @@ + misc/ncurses-intro.html syntax fix (Kajiyama Tamito). 960601 - snapshot - + auto-configure man-page compression-format and renames for Debian. + + auto-configure man page compression format and renames for Debian. + corrected several typos in curses.h.in (i.e., the mvXXXX macros). + re-order curses.priv.h for lint. + added rules for lintlib, lint diff --git a/contrib/ncurses/VERSION b/contrib/ncurses/VERSION --- a/contrib/ncurses/VERSION +++ b/contrib/ncurses/VERSION @@ -1 +1 @@ -5:0:10 6.5 20240427 +5:0:10 6.6 20251230 diff --git a/contrib/ncurses/aclocal.m4 b/contrib/ncurses/aclocal.m4 --- a/contrib/ncurses/aclocal.m4 +++ b/contrib/ncurses/aclocal.m4 @@ -1,5 +1,5 @@ dnl*************************************************************************** -dnl Copyright 2018-2023,2024 Thomas E. Dickey * +dnl Copyright 2018-2024,2025 Thomas E. Dickey * dnl Copyright 1998-2017,2018 Free Software Foundation, Inc. * dnl * dnl Permission is hereby granted, free of charge, to any person obtaining a * @@ -29,7 +29,7 @@ dnl dnl Author: Thomas E. Dickey 1995-on dnl -dnl $Id: aclocal.m4,v 1.1069 2024/03/30 22:15:45 tom Exp $ +dnl $Id: aclocal.m4,v 1.1148 2025/12/25 23:44:16 tom Exp $ dnl Macros used in NCURSES auto-configuration script. dnl dnl These macros are maintained separately from NCURSES. The copyright on @@ -42,7 +42,7 @@ dnl dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- -dnl AM_LANGINFO_CODESET version: 7 updated: 2023/01/11 04:05:23 +dnl AM_LANGINFO_CODESET version: 8 updated: 2025/12/22 04:16:14 dnl ------------------- dnl Inserted as requested by gettext 0.10.40 dnl File from /usr/share/aclocal @@ -54,10 +54,10 @@ AC_DEFUN([AM_LANGINFO_CODESET], [ AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, - [AC_TRY_LINK([ + [AC_LINK_IFELSE([AC_LANG_PROGRAM([ $ac_includes_default #include ], - [char* cs = nl_langinfo(CODESET); (void)cs], + [char* cs = nl_langinfo(CODESET); (void)cs])], am_cv_langinfo_codeset=yes, am_cv_langinfo_codeset=no) ]) @@ -67,7 +67,7 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ABI_DEFAULTS version: 5 updated: 2023/10/21 08:54:23 +dnl CF_ABI_DEFAULTS version: 6 updated: 2025/05/17 14:54:28 dnl --------------- dnl Provide configure-script defaults for different ncurses ABIs. AC_DEFUN([CF_ABI_DEFAULTS],[ @@ -79,6 +79,7 @@ cf_dft_ext_colors=no cf_dft_ext_const=no cf_dft_ext_mouse=no +cf_dft_ext_mouse2=no cf_dft_ext_putwin=no cf_dft_ext_spfuncs=no cf_dft_filter_syms=no @@ -86,6 +87,7 @@ cf_dft_mmask_t=auto cf_dft_opaque_curses=no cf_dft_ordinate_type=short +cf_dft_rgb_color=no cf_dft_signed_char=no cf_dft_tparm_arg=long cf_dft_widec=no @@ -114,8 +116,10 @@ case x$cf_cv_abi_default in (x[[789]]) cf_dft_ccharw_max=6 + cf_dft_ext_mouse2=yes cf_dft_mmask_t=uint64_t cf_dft_ordinate_type=int + cf_dft_rgb_color=yes cf_dft_signed_char=yes # also: remove the wgetch-events feature in ABI 7 ;; @@ -286,7 +290,7 @@ CFLAGS="$cf_save_CXXFLAGS" ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ADD_INCDIR version: 17 updated: 2021/09/04 06:35:04 +dnl CF_ADD_INCDIR version: 18 updated: 2025/12/22 04:16:14 dnl ------------- dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it is dnl redundant. We don't normally need to add -I/usr/local/include for gcc, @@ -318,8 +322,8 @@ then cf_save_CPPFLAGS=$CPPFLAGS CF_APPEND_TEXT(CPPFLAGS,-I$cf_add_incdir) - AC_TRY_COMPILE([#include ], - [printf("Hello")], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], + [printf("Hello")])], [], [cf_have_incdir=yes]) CPPFLAGS=$cf_save_CPPFLAGS @@ -478,7 +482,7 @@ AC_DEFUN([CF_ARG_ENABLE], [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl dnl --------------------------------------------------------------------------- -dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14 +dnl CF_ARG_OPTION version: 6 updated: 2025/08/05 04:09:09 dnl ------------- dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus dnl values. @@ -487,7 +491,7 @@ dnl $1 = option name dnl $2 = help-string dnl $3 = action to perform if option is not default -dnl $4 = action if perform if option is default +dnl $4 = action to perform if option is default dnl $5 = default option value (either 'yes' or 'no') AC_DEFUN([CF_ARG_OPTION], [AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) @@ -501,7 +505,7 @@ ])dnl ])])dnl dnl --------------------------------------------------------------------------- -dnl CF_AR_FLAGS version: 9 updated: 2021/01/01 13:31:04 +dnl CF_AR_FLAGS version: 10 updated: 2025/12/14 20:07:31 dnl ----------- dnl Check for suitable "ar" (archiver) options for updating an archive. dnl @@ -547,8 +551,8 @@ int testdata[[3]] = { 123, 456, 789 }; EOF if AC_TRY_EVAL(ac_compile) ; then - echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&AC_FD_CC - $AR $ARFLAGS "$cf_ar_flags" conftest.a "conftest.$ac_cv_objext" 2>&AC_FD_CC 1>/dev/null + echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&AS_MESSAGE_LOG_FD + $AR $ARFLAGS "$cf_ar_flags" conftest.a "conftest.$ac_cv_objext" 2>&AS_MESSAGE_LOG_FD 1>/dev/null if test -f conftest.a ; then cf_cv_ar_flags="$cf_ar_flags" break @@ -598,54 +602,25 @@ esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_BOOL_DECL version: 9 updated: 2023/12/03 09:21:34 +dnl CF_BOOL_DECL version: 12 updated: 2025/12/24 12:27:29 dnl ------------ -dnl Test if 'bool' is a builtin type in the configured C++ compiler. Some +dnl Test if 'bool' is a builtin type in the configured C/C++ compiler. Some dnl older compilers (e.g., gcc 2.5.8) don't support 'bool' directly; gcc dnl 2.6.3 does, in anticipation of the ANSI C++ standard. dnl -dnl Treat the configuration-variable specially here, since we're directly -dnl substituting its value (i.e., 1/0). -dnl dnl $1 is the shell variable to store the result in, if not $cv_cv_builtin_bool AC_DEFUN([CF_BOOL_DECL], [ -AC_MSG_CHECKING(if we should include stdbool.h) - -AC_CACHE_VAL(cf_cv_header_stdbool_h,[ - AC_TRY_COMPILE([],[bool foo = false; (void)foo], - [cf_cv_header_stdbool_h=0], - [AC_TRY_COMPILE([ -#ifndef __BEOS__ -#include -#endif -],[bool foo = false; (void)foo], - [cf_cv_header_stdbool_h=1], - [cf_cv_header_stdbool_h=0])])]) - -if test "$cf_cv_header_stdbool_h" = 1 -then AC_MSG_RESULT(yes) -else AC_MSG_RESULT(no) -fi - -AC_MSG_CHECKING([for builtin bool type]) - -AC_CACHE_VAL(ifelse($1,,cf_cv_builtin_bool,[$1]),[ - AC_TRY_COMPILE([ -#include -#include -],[bool x = false; (void)x], - [ifelse($1,,cf_cv_builtin_bool,[$1])=1], - [ifelse($1,,cf_cv_builtin_bool,[$1])=0]) - ]) - -if test "$ifelse($1,,cf_cv_builtin_bool,[$1])" = 1 -then AC_MSG_RESULT(yes) -else AC_MSG_RESULT(no) -fi +AC_REQUIRE([CF_C99_STDBOOL_H]) +AC_CACHE_CHECK(for builtin bool type, ifelse($1,,cf_cv_builtin_bool,[$1]),[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ +$ac_includes_default +],[bool x = false; (void)x])], + [ifelse($1,,cf_cv_builtin_bool,[$1])=yes], + [ifelse($1,,cf_cv_builtin_bool,[$1])=no])]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_BOOL_SIZE version: 20 updated: 2023/02/18 17:41:25 +dnl CF_BOOL_SIZE version: 22 updated: 2025/02/22 20:49:45 dnl ------------ dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type). dnl Don't bother looking for bool.h, since it has been deprecated. @@ -654,6 +629,7 @@ dnl from . AC_DEFUN([CF_BOOL_SIZE], [ +AC_REQUIRE([CF_C99_STDBOOL_H]) AC_CHECK_SIZEOF(bool,,[ $ac_includes_default @@ -669,7 +645,7 @@ #else -#if $cf_cv_header_stdbool_h +#if $USE_STDBOOL_H #include #endif @@ -693,7 +669,7 @@ #else -#if $cf_cv_header_stdbool_h +#if $USE_STDBOOL_H #include #endif @@ -702,7 +678,7 @@ int main(void) { FILE *fp = fopen("cf_test.out", "w"); - if (fp != 0) { + if (fp != NULL) { bool x = true; if ((bool)(-x) >= 0) fputs("unsigned ", fp); @@ -741,7 +717,7 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_BUILD_CC version: 11 updated: 2022/12/04 15:40:08 +dnl CF_BUILD_CC version: 14 updated: 2024/12/14 11:58:01 dnl ----------- dnl If we're cross-compiling, allow the user to override the tools and their dnl options. The configure script is oriented toward identifying the host @@ -819,7 +795,7 @@ AC_TRY_RUN([#include int main(int argc, char *argv[]) { - ${cf_cv_main_return:-return}(argc < 0 || argv == 0 || argv[0] == 0); + ${cf_cv_main_return:-return}(argc < 0 || argv == (void*)0 || argv[0] == (void*)0); } ], cf_ok_build_cc=yes, @@ -858,7 +834,7 @@ AC_SUBST(BUILD_OBJEXT) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_C11_NORETURN version: 4 updated: 2023/02/18 17:41:25 +dnl CF_C11_NORETURN version: 5 updated: 2025/12/14 17:40:20 dnl --------------- AC_DEFUN([CF_C11_NORETURN], [ @@ -871,12 +847,12 @@ if test $enable_stdnoreturn = yes; then AC_CACHE_CHECK([for C11 _Noreturn feature], cf_cv_c11_noreturn, - [AC_TRY_COMPILE([ + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ $ac_includes_default #include static _Noreturn void giveup(void) { exit(0); } ], - [if (feof(stdin)) giveup()], + [if (feof(stdin)) giveup()])], cf_cv_c11_noreturn=yes, cf_cv_c11_noreturn=no) ]) @@ -896,6 +872,27 @@ AC_SUBST(STDC_NORETURN) ])dnl dnl --------------------------------------------------------------------------- +dnl CF_C99_STDBOOL_H version: 2 updated: 2025/12/24 12:27:29 +dnl ---------------- +dnl Check if we can compile using and get a valid "bool" type. +AC_DEFUN([CF_C99_STDBOOL_H], +[ +AC_CACHE_CHECK(if we can include stdbool.h,cf_cv_header_stdbool_h,[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ +$ac_includes_default +#include +],[bool foo = false; (void)foo])], + [cf_cv_header_stdbool_h=yes], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[bool foo = false; (void)foo])], + [cf_cv_header_stdbool_h=no])])]) + +if test "$cf_cv_header_stdbool_h" = yes +then USE_STDBOOL_H=1 +else USE_STDBOOL_H=0 +fi +AC_SUBST(USE_STDBOOL_H) +])dnl +dnl --------------------------------------------------------------------------- dnl CF_CC_ENV_FLAGS version: 11 updated: 2023/02/20 11:15:46 dnl --------------- dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content @@ -960,7 +957,7 @@ esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CFG_DEFAULTS version: 16 updated: 2021/01/04 19:33:05 +dnl CF_CFG_DEFAULTS version: 17 updated: 2025/12/24 12:27:29 dnl --------------- dnl Determine the default configuration into which we'll install ncurses. This dnl can be overridden by the user's command-line options. There's two items to @@ -990,7 +987,7 @@ if test "x$prefix" = "xNONE" ; then AC_MSG_CHECKING(for default include-directory) -test -n "$verbose" && echo 1>&AC_FD_MSG +test -n "$verbose" && echo 1>&AS_MESSAGE_FD for cf_symbol in \ "$includedir" \ "$includedir/ncurses" \ @@ -1005,31 +1002,31 @@ if test -f "$cf_dir/curses.h" ; then if ( ${FGREP-fgrep} NCURSES_VERSION "$cf_dir/curses.h" >/dev/null 2>&1 ) ; then includedir="$cf_symbol" - test -n "$verbose" && echo $ECHO_N " found " 1>&AC_FD_MSG + test -n "$verbose" && echo $ECHO_N " found " 1>&AS_MESSAGE_FD break fi fi - test -n "$verbose" && echo " tested $cf_dir" 1>&AC_FD_MSG + test -n "$verbose" && echo " tested $cf_dir" 1>&AS_MESSAGE_FD done AC_MSG_RESULT($includedir) fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CGETENT version: 7 updated: 2023/02/18 17:41:25 +dnl CF_CGETENT version: 8 updated: 2025/12/24 12:27:29 dnl ---------- dnl Check if the terminal-capability database functions are available. If not, dnl ncurses has a much-reduced version. AC_DEFUN([CF_CGETENT],[ AC_CACHE_CHECK(for terminal-capability database functions,cf_cv_cgetent,[ -AC_TRY_LINK([ +AC_LINK_IFELSE([AC_LANG_PROGRAM([ $ac_includes_default],[ - char temp[128]; + char temp[[128]]; char *buf = temp; char *db_array = temp; cgetent(&buf, &db_array, "vt100"); cgetcap(buf, "tc", '='); cgetmatch(buf, "tc"); - ], + ])], [cf_cv_cgetent=yes], [cf_cv_cgetent=no]) ]) @@ -1038,10 +1035,10 @@ then AC_DEFINE(HAVE_BSD_CGETENT,1,[Define to 1 if we have BSD cgetent]) AC_CACHE_CHECK(if cgetent uses const parameter,cf_cv_cgetent_const,[ -AC_TRY_LINK([ +AC_LINK_IFELSE([AC_LANG_PROGRAM([ #pragma GCC diagnostic error "-Wincompatible-pointer-types-discards-qualifiers" $ac_includes_default],[ - char temp[128]; + char temp[[128]]; char *buf = temp; #ifndef _NETBSD_SOURCE /* given, since April 2004 in stdlib.h */ const char *db_array = temp; @@ -1049,7 +1046,7 @@ #endif cgetcap(buf, "tc", '='); cgetmatch(buf, "tc"); - ], + ])], [cf_cv_cgetent_const=yes], [cf_cv_cgetent_const=no]) ]) @@ -1095,7 +1092,7 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_ENVIRON version: 5 updated: 2023/02/18 17:41:25 +dnl CF_CHECK_ENVIRON version: 6 updated: 2025/12/24 12:27:29 dnl ---------------- dnl Check for data that is usually declared in , e.g., the 'environ' dnl variable. Define a DECL_xxx symbol if we must declare it ourselves. @@ -1105,9 +1102,9 @@ AC_DEFUN([CF_CHECK_ENVIRON], [ AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[ - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ $ac_includes_default], - ifelse([$2],,void*,[$2]) x = (ifelse([$2],,void*,[$2])) $1; (void)x, + [ifelse([$2],,void*,[$2]) x = (ifelse([$2],,void*,[$2])) $1; (void)x])], [cf_cv_dcl_$1=yes], [cf_cv_dcl_$1=no]) ]) @@ -1121,7 +1118,7 @@ CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2])) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_ERRNO version: 14 updated: 2023/02/18 17:41:25 +dnl CF_CHECK_ERRNO version: 15 updated: 2025/12/23 18:53:34 dnl -------------- dnl Check for data that is usually declared in or , e.g., dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it @@ -1132,10 +1129,10 @@ AC_DEFUN([CF_CHECK_ERRNO], [ AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[ - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ $ac_includes_default #include ], - ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1; (void)x, + [ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1; (void)x])], [cf_cv_dcl_$1=yes], [cf_cv_dcl_$1=no]) ]) @@ -1149,7 +1146,7 @@ CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2])) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_EXTERN_DATA version: 5 updated: 2021/09/04 06:35:04 +dnl CF_CHECK_EXTERN_DATA version: 6 updated: 2025/12/23 18:53:34 dnl -------------------- dnl Check for existence of external data in the current set of libraries. If dnl we can modify it, it is real enough. @@ -1158,11 +1155,11 @@ AC_DEFUN([CF_CHECK_EXTERN_DATA], [ AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[ - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ #undef $1 extern $2 $1; ], - [$1 = 2], + [$1 = 2])], [cf_cv_have_$1=yes], [cf_cv_have_$1=no]) ]) @@ -1174,7 +1171,7 @@ ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_FVISIBILITY version: 2 updated: 2020/04/04 16:16:13 +dnl CF_CHECK_FVISIBILITY version: 3 updated: 2025/12/24 12:27:29 dnl -------------------- dnl Check whether the compiler understands -fvisibility=hidden dnl @@ -1185,18 +1182,18 @@ AC_CACHE_CHECK(if $1 -fvisibility=hidden option works,$3,[ cf_save_cflags="[$]$2" $2="[$]$2 -fvisibility=hidden" - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ __attribute__ ((visibility("default"))) int somefunc() {return 42;} ],[ if (somefunc()) return 1; -], +])], [$3=yes], [$3=no]) $2=$cf_save_cflags ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_GETENV version: 4 updated: 2023/12/03 10:18:09 +dnl CF_CHECK_GETENV version: 5 updated: 2024/12/14 16:09:34 dnl --------------- dnl Check if repeated getenv calls return the same pointer, e.g., it does not dnl discard the previous pointer when returning a new one. @@ -1248,7 +1245,7 @@ for (j = 0; environ[j]; ++j) { mynames[j] = str_alloc(environ[j]); equals = strchr(mynames[j], '='); - if (equals != 0) { + if (equals != NULL) { *equals++ = '\\0'; myvalues[j] = str_alloc(equals); } else { @@ -1380,26 +1377,26 @@ fi ])])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_LIBSSP version: 1 updated: 2021/10/30 10:40:19 +dnl CF_CHECK_LIBSSP version: 2 updated: 2025/12/24 12:27:29 dnl --------------- dnl Check if libssp is needed, e.g., to work around misconfigured libraries dnl used in cross-compiling to MinGW. AC_DEFUN([CF_CHECK_LIBSSP],[ AC_CACHE_CHECK(if ssp library is needed,cf_cv_need_libssp,[ -AC_TRY_LINK([ +AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include #include ],[ DIR *dp = opendir("."); -],cf_cv_need_libssp=no,[ +])],cf_cv_need_libssp=no,[ cf_save_LIBS="$LIBS" LIBS="$LIBS -lssp" - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include #include ],[ DIR *dp = opendir("."); - ],cf_cv_need_libssp=yes, + ])],cf_cv_need_libssp=yes, cf_cv_need_libssp=maybe) LIBS="$cf_save_LIBS" ])dnl @@ -1411,7 +1408,7 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_LIBTOOL_VERSION version: 2 updated: 2021/05/01 16:24:34 +dnl CF_CHECK_LIBTOOL_VERSION version: 3 updated: 2024/06/12 04:19:01 dnl ------------------------ dnl Show the version of libtool dnl @@ -1427,6 +1424,7 @@ AC_MSG_CHECKING(version of $LIBTOOL) CF_LIBTOOL_VERSION AC_MSG_RESULT($cf_cv_libtool_version) + ifdef([LT_PACKAGE_VERSION],,[ if test -n "$cf_cv_libtool_version" then cf_check_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' -e 's,[[()]],...,g' -e 's,[[ ]],-,g' -e '2,$d'` @@ -1440,12 +1438,107 @@ else AC_MSG_ERROR(No version found for $LIBTOOL) fi + ]) else AC_MSG_ERROR(GNU libtool has not been found) fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_WCHAR_H version: 5 updated: 2023/12/03 09:21:34 +dnl CF_CHECK_MULTIUSER version: 1 updated: 2025/09/13 11:43:46 +dnl ------------------ +dnl Runtime features which check for root permissions apply only to multiuser +dnl systems. Check for single-user systems by inspecting /etc/passwd. +AC_DEFUN([CF_CHECK_MULTIUSER],[ +AC_CACHE_CHECK(for conventional multiuser system,cf_cv_multiuser,[ + cf_cv_multiuser=no + if test -f /etc/passwd + then + sed \ + -e '/true$/d' \ + -e '/false$/d' \ + -e '/nologin$/d' \ + -e '/^[[^:]]*:[[^:]]*:[[0-9]]:/d' \ + -e '/^[[^:]]*:[[^:]]*:[[0-9]][[0-9]]:/d' \ + -e '/:$/d' < /etc/passwd >conftest.tmp + test -s conftest.tmp && cf_cv_multiuser=yes + rm -f conftest.tmp + fi +]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CHECK_NAMED_PIPES version: 2 updated: 2025/12/24 12:27:29 +dnl -------------------- +dnl Check for existence of Windows named-pipe functions, set cache variable +dnl to reflect the result. +AC_DEFUN([CF_CHECK_NAMED_PIPES],[ +AC_CACHE_CHECK(for named pipe functions,cf_cv_named_pipes,[ + cf_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -DWINVER=0x0600 -DWIN32_LEAN_AND_MEAN" + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [ + HANDLE handle = 0; + ULONG pPid = 0; + if (GetNamedPipeInfo(handle, NULL, NULL, NULL, NULL)) { + if (GetNamedPipeServerProcessId(handle, &pPid)) { + ${cf_cv_main_return:-return} (0); + } + } + ])],[cf_cv_named_pipes=yes],[cf_cv_named_pipes=no]) + CPPFLAGS="$cf_save_CPPFLAGS" +])dnl +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CHECK_TBL_X_OPTION version: 2 updated: 2025/11/11 20:09:36 +dnl --------------------- +AC_DEFUN([CF_CHECK_TBL_X_OPTION],[ +AC_REQUIRE([CF_PROG_TBL]) + +AC_CACHE_CHECK(if $NROFF_TBL supports 'x' column modifier,cf_cv_tbl_x_option_okay,[ + if test "$cross_compiling" = yes ; then + cf_cv_tbl_x_option_okay=unknown + else + cf_cv_tbl_x_option_okay=no + cat > conftest <<-CF_EOF + .TS + L. + table cell + .TE + CF_EOF + if $NROFF_TBL < conftest > /dev/null 2>&1 + then + cat > conftest <<-CF_EOF + .TS + Lx. + table cell + .TE + CF_EOF + if $NROFF_TBL < conftest > /dev/null 2>&1 + then + cf_cv_tbl_x_option_okay=yes + fi + else + AC_MSG_ERROR([$NROFF_TBL not available.]) + fi + rm -f conftest + fi +]) + +TBL_X_OPTION=$cf_cv_tbl_x_option_okay +AC_SUBST(TBL_X_OPTION) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CHECK_TYPE2 version: 3 updated: 2025/08/08 20:44:18 +dnl -------------- +dnl Check if the given type can be declared via the given header. +dnl $1 = the type to check +dnl $2 = the header (i.e., not one of the default includes) +AC_DEFUN([CF_CHECK_TYPE2],[ + AC_CHECK_TYPES($1,,,[ +$ac_includes_default +ifelse($2,,,[#include <$2>])]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CHECK_WCHAR_H version: 6 updated: 2025/12/24 12:27:29 dnl ---------------- dnl Check if wchar.h can be used, i.e., without defining _XOPEN_SOURCE_EXTENDED AC_DEFUN([CF_CHECK_WCHAR_H],[ @@ -1454,7 +1547,7 @@ wctype.h \ ) AC_CACHE_CHECK(if wchar.h can be used as is,cf_cv_wchar_h_okay,[ -AC_TRY_COMPILE( +AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [ $ac_includes_default #ifdef HAVE_WCHAR_H @@ -1465,7 +1558,7 @@ #endif ],[ wint_t foo = 0; - int bar = iswpunct(foo); (void) bar], + int bar = iswpunct(foo); (void) bar])], [cf_cv_wchar_h_okay=yes], [cf_cv_wchar_h_okay=no])]) @@ -1475,7 +1568,7 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_WCWIDTH_GRAPHICS version: 4 updated: 2023/12/03 10:17:07 +dnl CF_CHECK_WCWIDTH_GRAPHICS version: 5 updated: 2024/12/14 16:09:34 dnl ------------------------- dnl Most "modern" terminal emulators are based to some degree on VT100, and dnl should support line-drawing. Even with Unicode. There is a problem. @@ -1594,8 +1687,8 @@ setlocale(LC_ALL, "en_US.UTF-8") || setlocale(LC_ALL, "en_US.utf8") || setlocale(LC_ALL, "en_US.utf-8")) { - if ((fp = fopen("conftest.in", "r")) != 0) { - while (fgets(buffer, MY_LEN, fp) != 0) { + if ((fp = fopen("conftest.in", "r")) != NULL) { + while (fgets(buffer, MY_LEN, fp) != NULL) { if (*buffer == '-') { fprintf(stderr, "\\t%s", buffer); } else if (sscanf(buffer, "%x %s", &value, notes) == 2) { @@ -1619,7 +1712,7 @@ ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CLANG_COMPILER version: 9 updated: 2023/02/18 17:41:25 +dnl CF_CLANG_COMPILER version: 11 updated: 2025/12/14 17:46:02 dnl ----------------- dnl Check if the given compiler is really clang. clang's C driver defines dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does @@ -1638,12 +1731,12 @@ if test "$ifelse([$1],,[$1],GCC)" = yes ; then AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler) cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" - AC_TRY_COMPILE([],[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[ #ifdef __clang__ #else #error __clang__ is not defined #endif -],[ifelse([$2],,CLANG_COMPILER,[$2])=yes +])],[ifelse([$2],,CLANG_COMPILER,[$2])=yes ],[]) ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) @@ -1672,9 +1765,9 @@ AC_MSG_CHECKING(if option $cf_clang_opt works) cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $cf_clang_opt" - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include ],[ - printf("hello!\\n");],[ + printf("hello!\\n");])],[ cf_clang_optok=yes],[ cf_clang_optok=no]) AC_MSG_RESULT($cf_clang_optok) @@ -1687,7 +1780,7 @@ fi ]) dnl --------------------------------------------------------------------------- -dnl CF_CONST_X_STRING version: 8 updated: 2023/12/01 17:22:50 +dnl CF_CONST_X_STRING version: 10 updated: 2025/12/14 17:40:20 dnl ----------------- dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most dnl character-strings. @@ -1712,22 +1805,22 @@ CF_SAVE_XTRA_FLAGS([CF_CONST_X_STRING]) -AC_TRY_COMPILE( +AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [ -#include +$ac_includes_default #include ], -[String foo = malloc(1); free((void*)foo)],[ +[String foo = malloc(1); free((void*)foo)])],[ AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[ - AC_TRY_COMPILE( + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [ #undef _CONST_X_STRING #define _CONST_X_STRING /* X11R7.8 (perhaps) */ #undef XTSTRINGDEFINES /* X11R5 and later */ -#include +$ac_includes_default #include - ],[String foo = malloc(1); *foo = 0],[ + ],[String foo = malloc(1); *foo = 0])],[ cf_cv_const_x_string=no ],[ cf_cv_const_x_string=yes @@ -1748,7 +1841,7 @@ ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CPP_OVERRIDE version: 1 updated: 2022/08/20 16:07:10 +dnl CF_CPP_OVERRIDE version: 2 updated: 2024/11/09 18:07:29 dnl --------------- dnl Check if the C++ compiler accepts the override keyword. This is a C++-11 dnl feature. @@ -1763,7 +1856,7 @@ class base { public: - virtual int foo(float x) = 0; + virtual int foo(float x) = 0; }; @@ -1819,7 +1912,7 @@ test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT,1,[Define to 1 if C++ has parameter initialization]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CPP_STATIC_CAST version: 3 updated: 2013/04/13 18:03:21 +dnl CF_CPP_STATIC_CAST version: 4 updated: 2025/12/24 12:27:29 dnl ------------------ dnl Check if the C++ compiler accepts static_cast in generics. This appears to dnl not be supported in g++ before 3.0 @@ -1831,7 +1924,7 @@ AC_LANG_SAVE AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ class NCursesPanel { public: @@ -1863,7 +1956,7 @@ virtual ~NCursesUserPanel() {}; }; ],[ - const char* p_UserData = static_cast(0)], + const char* p_UserData = static_cast(0)])], [cf_cv_cpp_static_cast=yes], [cf_cv_cpp_static_cast=no]) @@ -1903,19 +1996,19 @@ AC_SUBST(CXX_ARFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CXX_IOSTREAM_NAMESPACE version: 2 updated: 2012/10/06 17:56:13 +dnl CF_CXX_IOSTREAM_NAMESPACE version: 3 updated: 2025/12/24 12:27:29 dnl ------------------------- dnl For c++, check if iostream uses "std::" namespace. AC_DEFUN([CF_CXX_IOSTREAM_NAMESPACE],[ AC_CHECK_HEADERS(iostream) if test x"$ac_cv_header_iostream" = xyes ; then AC_MSG_CHECKING(if iostream uses std-namespace) - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include using std::endl; using std::cerr;],[ cerr << "testing" << endl; -],[cf_iostream_namespace=yes],[cf_iostream_namespace=no]) +])],[cf_iostream_namespace=yes],[cf_iostream_namespace=no]) AC_MSG_RESULT($cf_iostream_namespace) if test "$cf_iostream_namespace" = yes ; then AC_DEFINE(IOSTREAM_NAMESPACE,1,[Define to 1 if C++ has namespace iostream]) @@ -1923,7 +2016,7 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_C_INLINE version: 6 updated: 2019/09/07 13:38:36 +dnl CF_C_INLINE version: 7 updated: 2025/12/24 12:27:29 dnl ----------- dnl Check if the C compiler supports "inline". dnl $1 is the name of a shell variable to set if inline is supported @@ -1945,8 +2038,8 @@ AC_CACHE_CHECK(if $CC supports options to tune inlining,cf_cv_gcc_inline,[ cf_save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS --param max-inline-insns-single=$2" - AC_TRY_COMPILE([inline int foo(void) { return 1; }], - [${cf_cv_main_return:-return} foo()], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([inline int foo(void) { return 1; }], + [${cf_cv_main_return:-return} foo()])], [cf_cv_gcc_inline=yes], [cf_cv_gcc_inline=no]) CFLAGS=$cf_save_CFLAGS @@ -2196,7 +2289,7 @@ AC_MSG_RESULT($cf_cv_enable_rpath) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ENABLE_STRING_HACKS version: 6 updated: 2021/01/05 19:23:48 +dnl CF_ENABLE_STRING_HACKS version: 7 updated: 2025/11/11 20:09:36 dnl ---------------------- dnl On a few platforms, the compiler and/or loader nags with untruthful dnl comments stating that "most" uses of strcat/strcpy/sprintf are incorrect, @@ -2207,10 +2300,10 @@ dnl instances are meaningless compared to the hundreds of millions of lines of dnl existing C code. dnl -dnl strlcat/strlcpy are (as of 2012) non-standard, and are available on some +dnl strlcat/strlcpy are standard as of POSIX.1-2024, and are available on some dnl platforms, in implementations of varying quality. Likewise, snprintf is dnl standard - but evolved through phases, and older implementations are likely -dnl to yield surprising results, as documented in manpages on various systems. +dnl to yield surprising results, as documented in man pages on various systems. AC_DEFUN([CF_ENABLE_STRING_HACKS], [ AC_MSG_CHECKING(if you want to work around bogus compiler/loader warnings) @@ -2274,7 +2367,7 @@ CF_CHECK_ERRNO(errno) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ETIP_DEFINES version: 7 updated: 2023/10/28 11:59:01 +dnl CF_ETIP_DEFINES version: 8 updated: 2025/12/24 12:27:29 dnl --------------- dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between dnl math.h and builtin.h, only for ncurses @@ -2296,9 +2389,9 @@ CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -Iinclude -I${srcdir}/include" test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}" test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}" -AC_TRY_COMPILE([ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include -],[],[ +],[])],[ test -n "$cf_math" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_math}) test -n "$cf_excp" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_excp}) cf_result="$cf_math $cf_excp" @@ -2310,7 +2403,7 @@ CXXFLAGS="$cf_save_CXXFLAGS" ]) dnl --------------------------------------------------------------------------- -dnl CF_FIND_LINKAGE version: 22 updated: 2020/12/31 20:19:42 +dnl CF_FIND_LINKAGE version: 23 updated: 2025/12/22 04:16:14 dnl --------------- dnl Find a library (specifically the linkage used in the code fragment), dnl searching for it if it is not already in the library path. @@ -2333,7 +2426,7 @@ AC_DEFUN([CF_FIND_LINKAGE],[ # If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these -# will be set on completion of the AC_TRY_LINK below. +# will be set on completion of the AC_LINK_IFELSE below. cf_cv_header_path_$3= cf_cv_library_path_$3= @@ -2341,7 +2434,7 @@ cf_save_LIBS="$LIBS" -AC_TRY_LINK([$1],[$2],[ +AC_LINK_IFELSE([AC_LANG_PROGRAM([$1],[$2])],[ cf_cv_find_linkage_$3=yes cf_cv_header_path_$3=/usr/include cf_cv_library_path_$3=/usr/lib @@ -2349,7 +2442,7 @@ LIBS="-l$3 $7 $cf_save_LIBS" -AC_TRY_LINK([$1],[$2],[ +AC_LINK_IFELSE([AC_LANG_PROGRAM([$1],[$2])],[ cf_cv_find_linkage_$3=yes cf_cv_header_path_$3=/usr/include cf_cv_library_path_$3=/usr/lib @@ -2371,7 +2464,7 @@ CF_VERBOSE(... testing $cf_cv_header_path_$3) CPPFLAGS="$cf_save_CPPFLAGS" CF_APPEND_TEXT(CPPFLAGS,-I$cf_cv_header_path_$3) - AC_TRY_COMPILE([$1],[$2],[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1],[$2])],[ CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3) cf_cv_find_linkage_$3=maybe cf_test_CPPFLAGS="$CPPFLAGS" @@ -2391,7 +2484,7 @@ ifelse([$6],,,[ CPPFLAGS="$cf_test_CPPFLAGS" LIBS="-l$3 $7 $cf_save_LIBS" - AC_TRY_LINK([$1],[$2],[ + AC_LINK_IFELSE([AC_LANG_PROGRAM([$1],[$2])],[ CF_VERBOSE(... found $3 library in system) cf_cv_find_linkage_$3=yes]) CPPFLAGS="$cf_save_CPPFLAGS" @@ -2407,7 +2500,7 @@ CPPFLAGS="$cf_test_CPPFLAGS" LIBS="-l$3 $7 $cf_save_LIBS" LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3" - AC_TRY_LINK([$1],[$2],[ + AC_LINK_IFELSE([AC_LANG_PROGRAM([$1],[$2])],[ CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3) cf_cv_find_linkage_$3=yes cf_cv_library_file_$3="-l$3" @@ -2534,7 +2627,7 @@ AC_SUBST(EXTRA_CFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_FOPEN_BIN_R version: 3 updated: 2023/01/05 18:05:46 +dnl CF_FOPEN_BIN_R version: 4 updated: 2024/12/14 16:09:34 dnl -------------- dnl Check if fopen works when the "b" (binary) flag is added to the mode dnl parameter. POSIX ignores the "b", which c89 specified. Some very old @@ -2548,14 +2641,14 @@ { FILE *fp = fopen("conftest.tmp", "wb"); int rc = 0; - if (fp != 0) { + if (fp != NULL) { int p, q; for (p = 0; p < 256; ++p) { fputc(p, fp); } fclose(fp); fp = fopen("conftest.tmp", "rb"); - if (fp != 0) { + if (fp != NULL) { for (p = 0; p < 256; ++p) { q = fgetc(fp); if (q != p) { @@ -2588,7 +2681,7 @@ unset $1 ])dnl dnl --------------------------------------------------------------------------- -dnl CF_FUNC_DLSYM version: 4 updated: 2015/09/12 14:46:44 +dnl CF_FUNC_DLSYM version: 6 updated: 2025/12/24 12:27:29 dnl ------------- dnl Test for dlsym() and related functions, as well as libdl. dnl @@ -2608,13 +2701,16 @@ test "$cf_have_libdl" = yes && { CF_ADD_LIB(dl) } AC_MSG_CHECKING(whether able to link to dl*() functions) - AC_TRY_LINK([#include ],[ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ + #include + #include + ],[ void *obj; - if ((obj = dlopen("filename", 0)) != 0) { + if ((obj = dlopen("filename", 0)) != NULL) { if (dlsym(obj, "symbolname") == 0) { dlclose(obj); } - }],[ + }])],[ AC_DEFINE(HAVE_LIBDL,1,[Define to 1 if we have dl library])],[ AC_MSG_ERROR(Cannot link test program for libdl)]) AC_MSG_RESULT(ok) @@ -2623,19 +2719,36 @@ fi ]) dnl --------------------------------------------------------------------------- -dnl CF_FUNC_GETTIME version: 2 updated: 2023/02/25 08:45:56 +dnl CF_FUNC_GETTIME version: 4 updated: 2025/12/23 18:53:34 dnl --------------- dnl Check for gettimeofday or clock_gettime. In 2023, the former is still more dnl widely supported, but "deprecated" (2008), so we will use the latter if it dnl is available, to reduce compiler warnings. AC_DEFUN([CF_FUNC_GETTIME],[ -AC_CACHE_CHECK(for clock_gettime,cf_cv_func_clock_gettime,[ - AC_TRY_LINK([#include ], +cf_save_libs="$LIBS" +AC_CHECK_FUNC(clock_gettime, + cf_cv_test_clock_gettime=yes, + AC_CHECK_LIB(rt, clock_gettime, + [LIBS="-lrt $LIBS" + cf_cv_test_clock_gettime=yes], + cf_cv_test_clock_gettime=no)) + +if test "$cf_cv_test_clock_gettime" = yes ; then +AC_CACHE_CHECK(if clock_gettime links,cf_cv_func_clock_gettime,[ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ +$ac_includes_default +#include + ], [struct timespec ts; - int rc = clock_gettime(CLOCK_REALTIME, &ts); (void) rc; (void)ts], + int rc = clock_gettime(CLOCK_REALTIME, &ts) + + clock_gettime(CLOCK_MONOTONIC, &ts); + (void) rc; (void)ts])], [cf_cv_func_clock_gettime=yes], [cf_cv_func_clock_gettime=no]) ]) +else + cf_cv_func_clock_gettime=no +fi if test "$cf_cv_func_clock_gettime" = yes then @@ -2650,17 +2763,17 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_FUNC_GETTTYNAM version: 2 updated: 2023/01/05 18:06:28 +dnl CF_FUNC_GETTTYNAM version: 5 updated: 2025/12/24 12:27:29 dnl ----------------- dnl Check if the 4.3BSD function getttyname exists, as well as if dnl defines the _PATH_TTYS symbol. If the corresponding file exists, but the dnl other checks fail, just define HAVE_PATH_TTYS. AC_DEFUN([CF_FUNC_GETTTYNAM],[ AC_CACHE_CHECK(if _PATH_TTYS is defined in ttyent.h,cf_cv_PATH_TTYS,[ -AC_TRY_COMPILE([ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #include ],[ -FILE *fp = fopen(_PATH_TTYS, "r"); (void)fp], +FILE *fp = fopen(_PATH_TTYS, "r"); (void)fp])], [cf_cv_PATH_TTYS=yes], [cf_cv_PATH_TTYS=no])]) @@ -2682,12 +2795,11 @@ AC_CACHE_CHECK(if _PATH_TTYS file exists,cf_cv_have_PATH_TTYS,[ AC_TRY_RUN([ $ac_includes_default - #include int main(void) { FILE *fp = fopen(_PATH_TTYS, "r"); - ${cf_cv_main_return:-return} (fp == 0); + ${cf_cv_main_return:-return} (fp == NULL); }], [cf_cv_have_PATH_TTYS=yes], [cf_cv_have_PATH_TTYS=no], @@ -2699,11 +2811,11 @@ then AC_DEFINE(HAVE_PATH_TTYS,1,[define to 1 if system can map tty name to terminal type]) AC_CACHE_CHECK(for getttynam,cf_cv_func_getttynam,[ - AC_TRY_LINK([#include ], - [struct ttyent *fp = getttynam("/dev/tty"); (void)fp], + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [struct ttyent *fp = getttynam("/dev/tty"); (void)fp])], [cf_cv_func_getttynam=yes], [cf_cv_func_getttynam=no])]) - test "$cf_cv_func_getttynam" = yes && AC_DEFINE(HAVE_GETTTYNAM) + test "$cf_cv_func_getttynam" = yes && AC_DEFINE(HAVE_GETTTYNAM,1,[define to 1 if the system has getttynam()]) fi ])dnl dnl --------------------------------------------------------------------------- @@ -2775,7 +2887,7 @@ test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP,1,[Define to 1 if we have nanosleep()]) ]) dnl --------------------------------------------------------------------------- -dnl CF_FUNC_OPENPTY version: 7 updated: 2023/12/03 09:21:34 +dnl CF_FUNC_OPENPTY version: 8 updated: 2025/12/24 12:27:29 dnl --------------- dnl Check for openpty() function, along with header. It may need the dnl "util" library as well. @@ -2787,13 +2899,13 @@ test "$cf_cv_lib_util" = yes && { CF_ADD_LIB(util) } for cf_header in pty.h libutil.h util.h do - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include <$cf_header> ],[ int x = openpty((int *)0, (int *)0, (char *)0, (struct termios *)0, (struct winsize *)0); (void)x; -],[ +])],[ cf_cv_func_openpty=$cf_header break ],[ @@ -2866,14 +2978,14 @@ test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL,1,[Define to 1 if the poll function seems to work]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_FUNC_TERMIOS version: 3 updated: 2012/10/06 17:56:13 +dnl CF_FUNC_TERMIOS version: 4 updated: 2025/12/24 12:27:29 dnl --------------- dnl Some old/broken variations define tcgetattr() only as a macro in dnl termio(s).h AC_DEFUN([CF_FUNC_TERMIOS],[ AC_REQUIRE([CF_STRUCT_TERMIOS]) AC_CACHE_CHECK(for tcgetattr, cf_cv_have_tcgetattr,[ -AC_TRY_LINK([ +AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include #ifdef HAVE_UNISTD_H #include @@ -2889,13 +3001,13 @@ #endif ],[ TTY foo; -tcgetattr(1, &foo);], +tcgetattr(1, &foo);])], [cf_cv_have_tcgetattr=yes], [cf_cv_have_tcgetattr=no])]) test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR,1,[Define to 1 if we have tcgetattr]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_FUNC_VSSCANF version: 8 updated: 2023/12/03 19:09:59 +dnl CF_FUNC_VSSCANF version: 9 updated: 2025/12/24 12:27:29 dnl --------------- dnl Check for vsscanf() function, which is in c9x but generally not in earlier dnl versions of C. It can often be simulated by other functions on older @@ -2903,7 +3015,7 @@ AC_DEFUN([CF_FUNC_VSSCANF], [ AC_CACHE_CHECK(for vsscanf function or workaround,cf_cv_func_vsscanf,[ -AC_TRY_LINK([ +AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include #include @@ -2917,8 +3029,8 @@ } ],[ myfunc("55", "%d"); -],[cf_cv_func_vsscanf=vsscanf],[ -AC_TRY_LINK([ +])],[cf_cv_func_vsscanf=vsscanf],[ +AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include #include ],[ FILE strbuf; @@ -2928,8 +3040,8 @@ strbuf._ptr = strbuf._base = (unsigned char *) str; strbuf._cnt = strlen(str); strbuf._file = _NFILE; - return (vfscanf(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=vfscanf],[ -AC_TRY_LINK([ + return (vfscanf(&strbuf, "%d", ap))])],[cf_cv_func_vsscanf=vfscanf],[ +AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include #include ],[ FILE strbuf; @@ -2939,7 +3051,7 @@ strbuf._ptr = strbuf._base = (unsigned char *) str; strbuf._cnt = strlen(str); strbuf._file = _NFILE; - return (_doscan(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=_doscan],[ + return (_doscan(&strbuf, "%d", ap))])],[cf_cv_func_vsscanf=_doscan],[ cf_cv_func_vsscanf=no])])])]) case "$cf_cv_func_vsscanf" in @@ -2950,7 +3062,7 @@ ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GCC_ATTRIBUTES version: 24 updated: 2021/03/20 12:00:25 +dnl CF_GCC_ATTRIBUTES version: 28 updated: 2025/12/25 18:43:31 dnl ----------------- dnl Test for availability of useful gcc __attribute__ directives to quiet dnl compiler warnings. Though useful, not all are supported -- and contrary @@ -2977,7 +3089,8 @@ EOF if test "$GCC" = yes then - AC_CHECKING([for $CC __attribute__ directives]) + AC_MSG_CHECKING([for $CC __attribute__ directives]) + test -n "$verbose" && AC_MSG_RESULT() cat > "conftest.$ac_ext" < @@ -3005,7 +3118,7 @@ do CF_UPPER(cf_ATTRIBUTE,$cf_attribute) cf_directive="__attribute__(($cf_attribute))" - echo "checking for $CC $cf_directive" 1>&AC_FD_CC + echo "checking for $CC $cf_directive" 1>&AS_MESSAGE_LOG_FD case "$cf_attribute" in (printf) @@ -3080,7 +3193,7 @@ CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GCC_WARNINGS version: 41 updated: 2021/01/01 16:53:59 +dnl CF_GCC_WARNINGS version: 45 updated: 2025/12/24 09:07:25 dnl --------------- dnl Check if the compiler supports useful warning options. There's a few that dnl we don't use, simply because they're too noisy: @@ -3121,7 +3234,8 @@ # remark #981: operands are evaluated in unspecified order # warning #279: controlling expression is constant - AC_CHECKING([for $CC warning options]) + AC_MSG_CHECKING([for $CC warning options]) + test -n "$verbose" && AC_MSG_RESULT() cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall" for cf_opt in \ @@ -3144,7 +3258,8 @@ CFLAGS="$cf_save_CFLAGS" elif test "$GCC" = yes && test "$GCC_VERSION" != "unknown" then - AC_CHECKING([for $CC warning options]) + AC_MSG_CHECKING([for $CC warning options]) + test -n "$verbose" && AC_MSG_RESULT() cf_save_CFLAGS="$CFLAGS" cf_warn_CONST="" test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" @@ -3194,20 +3309,21 @@ AC_SUBST(EXTRA_CFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GETOPT_HEADER version: 8 updated: 2021/06/19 19:16:16 +dnl CF_GETOPT_HEADER version: 10 updated: 2025/12/14 17:40:20 dnl ---------------- dnl Check for getopt's variables which are commonly defined in stdlib.h, dnl unistd.h or (nonstandard) in getopt.h AC_DEFUN([CF_GETOPT_HEADER], -[ -AC_HAVE_HEADERS(unistd.h getopt.h) +[AC_REQUIRE([AC_HEADER_STDC]) + +AC_CHECK_HEADERS(getopt.h) AC_CACHE_CHECK(for header declaring getopt variables,cf_cv_getopt_header,[ cf_cv_getopt_header=none for cf_header in stdio.h stdlib.h unistd.h getopt.h do -AC_TRY_COMPILE([ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include <$cf_header>], -[int x = optind; char *y = optarg; (void)x; (void)y], +[int x = optind; char *y = optarg; (void)x; (void)y])], [cf_cv_getopt_header=$cf_header break]) done @@ -3220,6 +3336,26 @@ fi ])dnl dnl --------------------------------------------------------------------------- +dnl CF_GLOB_FULLPATH version: 2 updated: 2024/08/03 12:34:02 +dnl ---------------- +dnl Use this in case-statements to check for pathname syntax, i.e., absolute +dnl pathnames. The "x" is assumed since we provide an alternate form for DOS. +AC_DEFUN([CF_GLOB_FULLPATH],[ +AC_REQUIRE([CF_WITH_SYSTYPE])dnl +case "$cf_cv_system_name" in +(cygwin*|msys*|mingw32*|mingw64|os2*) + GLOB_FULLPATH_POSIX='/*' + GLOB_FULLPATH_OTHER='[[a-zA-Z]]:[[\\/]]*' + ;; +(*) + GLOB_FULLPATH_POSIX='/*' + GLOB_FULLPATH_OTHER=$GLOB_FULLPATH_POSIX + ;; +esac +AC_SUBST(GLOB_FULLPATH_POSIX) +AC_SUBST(GLOB_FULLPATH_OTHER) +])dnl +dnl --------------------------------------------------------------------------- dnl CF_GNATPREP_OPT_T version: 1 updated: 2014/08/02 18:37:25 dnl ----------------- AC_DEFUN([CF_GNATPREP_OPT_T],[ @@ -3261,7 +3397,7 @@ AC_SUBST(cf_generic_objects) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GNAT_PROJECTS version: 13 updated: 2021/01/02 17:09:14 +dnl CF_GNAT_PROJECTS version: 14 updated: 2025/12/24 12:27:29 dnl ---------------- dnl GNAT projects are configured with ".gpr" project files. dnl GNAT libraries are a further development, using the project feature. @@ -3322,7 +3458,7 @@ -XLIBRARY_DIR="`cd ../conftest.lib;pwd`" \ -XSOURCE_DIR="`pwd`" \ -XSONAME=libConfTest.so.1 \ - -XLIB_KIND=static 1>&AC_FD_CC 2>&1 ) ; then + -XLIB_KIND=static 1>&AS_MESSAGE_LOG_FD 2>&1 ) ; then cf_gnat_projects=yes fi cd .. @@ -3426,7 +3562,7 @@ AC_SUBST(USE_GNAT_SIGINT) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GNAT_TRY_LINK version: 4 updated: 2021/01/01 13:31:04 +dnl CF_GNAT_TRY_LINK version: 5 updated: 2025/12/24 12:27:29 dnl ---------------- dnl Verify that a test program compiles/links with GNAT. dnl $cf_ada_make is set to the program that compiles/links @@ -3445,7 +3581,7 @@ cat >>conftest.adb <&AC_FD_CC 2>&1 ) ; then +if ( "$cf_ada_make" $ADAFLAGS conftest 1>&AS_MESSAGE_LOG_FD 2>&1 ) ; then ifelse($3,, :,[ $3]) ifelse($4,,,[else $4]) @@ -3453,7 +3589,7 @@ rm -rf ./conftest* ./*~conftest* ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GNAT_TRY_RUN version: 6 updated: 2021/01/01 13:31:04 +dnl CF_GNAT_TRY_RUN version: 7 updated: 2025/12/24 12:27:29 dnl --------------- dnl Verify that a test program compiles and runs with GNAT dnl $cf_ada_make is set to the program that compiles/links @@ -3472,8 +3608,8 @@ cat >>conftest.adb <&AC_FD_CC 2>&1 ) ; then - if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then +if ( "$cf_ada_make" $ADAFLAGS conftest 1>&AS_MESSAGE_LOG_FD 2>&1 ) ; then + if ( ./conftest 1>&AS_MESSAGE_LOG_FD 2>&1 ) ; then ifelse($3,, :,[ $3]) ifelse($4,,,[ else $4]) @@ -3500,7 +3636,7 @@ ifelse($1,,,[eval $1=$cf_cv_gnat_version; unset cf_cv_gnat_version]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GNU_SOURCE version: 10 updated: 2018/12/10 20:09:41 +dnl CF_GNU_SOURCE version: 11 updated: 2025/12/14 17:40:20 dnl ------------- dnl Check if we must define _GNU_SOURCE to get a reasonable value for dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect @@ -3516,14 +3652,14 @@ cf_gnu_xopen_source=ifelse($1,,500,$1) AC_CACHE_CHECK(if this is the GNU C library,cf_cv_gnu_library,[ -AC_TRY_COMPILE([#include ],[ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],[ #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0 return 0; #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0 return 0; #else # error not GNU C library - #endif], + #endif])], [cf_cv_gnu_library=yes], [cf_cv_gnu_library=no]) ]) @@ -3536,14 +3672,14 @@ AC_CACHE_CHECK(if _DEFAULT_SOURCE can be used as a basis,cf_cv_gnu_library_219,[ cf_save="$CPPFLAGS" CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) - AC_TRY_COMPILE([#include ],[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],[ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2) return 0; #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3) return 0; #else # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old - #endif], + #endif])], [cf_cv_gnu_library_219=yes], [cf_cv_gnu_library_219=no]) CPPFLAGS="$cf_save" @@ -3553,7 +3689,7 @@ cf_save="$CPPFLAGS" AC_CACHE_CHECK(if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE,cf_cv_gnu_dftsrc_219,[ CF_ADD_CFLAGS(-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source) - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #include ],[ @@ -3561,7 +3697,7 @@ return 0; #else # error GNU C library is too old - #endif], + #endif])], [cf_cv_gnu_dftsrc_219=yes], [cf_cv_gnu_dftsrc_219=no]) ]) @@ -3573,17 +3709,17 @@ if test "x$cf_cv_gnu_dftsrc_219" != xyes; then AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ - AC_TRY_COMPILE([#include ],[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],[ #ifndef _XOPEN_SOURCE #error expected _XOPEN_SOURCE to be defined - #endif], + #endif])], [cf_cv_gnu_source=no], [cf_save="$CPPFLAGS" CF_ADD_CFLAGS(-D_GNU_SOURCE) - AC_TRY_COMPILE([#include ],[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],[ #ifdef _XOPEN_SOURCE #error expected _XOPEN_SOURCE to be undefined - #endif], + #endif])], [cf_cv_gnu_source=no], [cf_cv_gnu_source=yes]) CPPFLAGS="$cf_save" @@ -3594,10 +3730,10 @@ then AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[ CF_APPEND_TEXT(CPPFLAGS,-D_GNU_SOURCE) - AC_TRY_COMPILE([#include ],[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],[ #ifdef _DEFAULT_SOURCE #error expected _DEFAULT_SOURCE to be undefined - #endif], + #endif])], [cf_cv_default_source=no], [cf_cv_default_source=yes]) ]) @@ -3611,7 +3747,7 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GPP_LIBRARY version: 13 updated: 2021/01/01 13:31:04 +dnl CF_GPP_LIBRARY version: 14 updated: 2025/12/24 12:27:29 dnl -------------- dnl If we're trying to use g++, test if libg++ is installed (a rather common dnl problem :-). If we have the compiler but no library, we'll be able to @@ -3631,10 +3767,10 @@ AC_MSG_CHECKING([for lib$cf_gpp_libname]) cf_save="$LIBS" CF_ADD_LIB($cf_gpp_libname) - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include <$cf_gpp_libname/builtin.h> ], - [two_arg_error_handler_t foo2 = lib_error_handler], + [two_arg_error_handler_t foo2 = lib_error_handler])], [cf_cxx_library=yes CF_ADD_LIB($cf_gpp_libname,CXXLIBS) if test "$cf_gpp_libname" = cpp ; then @@ -3642,10 +3778,10 @@ else AC_DEFINE(HAVE_GXX_BUILTIN_H,1,[Define to 1 if we have g++ builtin.h]) fi], - [AC_TRY_LINK([ + [AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include ], - [two_arg_error_handler_t foo2 = lib_error_handler], + [two_arg_error_handler_t foo2 = lib_error_handler])], [cf_cxx_library=yes CF_ADD_LIB($cf_gpp_libname,CXXLIBS) AC_DEFINE(HAVE_BUILTIN_H,1,[Define to 1 if we have builtin.h])], @@ -3673,7 +3809,7 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GXX_WARNINGS version: 11 updated: 2021/01/08 16:50:55 +dnl CF_GXX_WARNINGS version: 14 updated: 2025/12/24 09:07:25 dnl --------------- dnl Check if the compiler supports useful warning options. dnl @@ -3722,7 +3858,8 @@ # remark #981: operands are evaluated in unspecified order # warning #269: invalid format string conversion - AC_CHECKING([for $CC warning options]) + AC_MSG_CHECKING([for $CC warning options]) + test -n "$verbose" && AC_MSG_RESULT() cf_save_CXXFLAGS="$CXXFLAGS" EXTRA_CXXFLAGS="-Wall" for cf_opt in \ @@ -3747,7 +3884,8 @@ elif test "$GXX" = yes then - AC_CHECKING([for $CXX warning options]) + AC_MSG_CHECKING([for $CXX warning options]) + test -n "$verbose" && AC_MSG_RESULT() cf_save_CXXFLAGS="$CXXFLAGS" EXTRA_CXXFLAGS="-W -Wall" cf_gxx_extra_warnings="" @@ -3836,7 +3974,7 @@ ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_HASHED_DB_LIBS version: 10 updated: 2021/01/02 17:09:14 +dnl CF_HASHED_DB_LIBS version: 12 updated: 2025/12/24 12:27:29 dnl ----------------- dnl Given that we have the header and version for hashed database, find the dnl library information. @@ -3851,14 +3989,14 @@ CF_ADD_LIB($cf_db_libs) fi CF_MSG_LOG(checking for library $cf_db_libs) - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ $ac_includes_default #include ],[ char *path = "/tmp/foo"; #ifdef DB_VERSION_MAJOR #if DB_VERSION_MAJOR >= 4 - DB *result = 0; + DB *result = NULL; db_create(&result, NULL, 0); result->open(result, NULL, @@ -3868,7 +4006,7 @@ DB_CREATE, 0644); #elif DB_VERSION_MAJOR >= 3 - DB *result = 0; + DB *result = NULL; db_create(&result, NULL, 0); result->open(result, path, @@ -3877,7 +4015,7 @@ DB_CREATE, 0644); #elif DB_VERSION_MAJOR >= 2 - DB *result = 0; + DB *result = NULL; db_open(path, DB_HASH, DB_CREATE, @@ -3893,8 +4031,8 @@ DB_HASH, 0); #endif - ${cf_cv_main_return:-return}(result != 0) -],[ + ${cf_cv_main_return:-return}(result != NULL) +])],[ if test -n "$cf_db_libs" ; then cf_cv_hashed_db_libs=$cf_db_libs else @@ -3908,7 +4046,7 @@ ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_HASHED_DB_VERSION version: 5 updated: 2023/02/18 17:41:25 +dnl CF_HASHED_DB_VERSION version: 6 updated: 2025/12/24 12:27:29 dnl -------------------- dnl Given that we have the header file for hashed database, find the version dnl information. @@ -3920,7 +4058,7 @@ for cf_db_version in 1 2 3 4 5 6 do CF_MSG_LOG(checking for db version $cf_db_version) - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ $ac_includes_default #include @@ -3938,7 +4076,7 @@ #error $cf_db_version is not 1 #endif #endif -],[DBT *foo = 0],[ +],[DBT *foo = 0])],[ cf_cv_hashed_db_version=$cf_db_version break ]) @@ -4178,7 +4316,45 @@ AC_SUBST(INSTALL_OPT_S) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_INTEL_COMPILER version: 9 updated: 2023/02/18 17:41:25 +dnl CF_INSTALL_PREFIX version: 2 updated: 2025/10/18 11:14:21 +dnl ----------------- +dnl Special option for use by system-builders: the install-prefix is used to +dnl adjust the location into which the actual install is done, so that an +dnl archive can be built without modifying the host system's configuration. +AC_DEFUN([CF_INSTALL_PREFIX],[ +AC_MSG_CHECKING(for an installation directory prefix) +AC_ARG_WITH(install-prefix, + [ --with-install-prefix=DESTDIR use DESTDIR as installation directory prefix], + [case "x$withval" in + (xyes|xno) + ;; + (*) DESTDIR="$withval" + ;; + esac]) +AC_MSG_RESULT([${DESTDIR:-(none)}]) +AC_SUBST(DESTDIR) + +SET_DESTDIR= +test -n "$DESTDIR" && SET_DESTDIR="DESTDIR=$DESTDIR" +AC_SUBST(SET_DESTDIR) + +AC_MSG_CHECKING(if installation directory prefix should be merged) +CF_ARG_ENABLE(install-prefix, + [ --enable-install-prefix merge DESTDIR with installation prefix], + cf_install_prefix=yes, + cf_install_prefix=no) +AC_MSG_RESULT($cf_install_prefix) + +if test "$cf_install_prefix" = yes ; then + MERGE_PREFIX=':$(prefix)%=%' +else + MERGE_PREFIX='' +fi + +AC_SUBST(MERGE_PREFIX) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_INTEL_COMPILER version: 10 updated: 2025/12/14 17:40:20 dnl ----------------- dnl Check if the given compiler is really the Intel compiler for Linux. It dnl tries to imitate gcc, but does not return an error when it finds a mismatch @@ -4201,12 +4377,12 @@ AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" - AC_TRY_COMPILE([],[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[ #ifdef __INTEL_COMPILER #else #error __INTEL_COMPILER is not defined #endif -],[ifelse([$2],,INTEL_COMPILER,[$2])=yes +])],[ifelse([$2],,INTEL_COMPILER,[$2])=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147" ],[]) ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" @@ -4216,14 +4392,14 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ISASCII version: 5 updated: 2023/12/03 09:21:34 +dnl CF_ISASCII version: 6 updated: 2025/12/24 12:27:29 dnl ---------- dnl Check if we have either a function or macro for 'isascii()'. AC_DEFUN([CF_ISASCII], [ AC_MSG_CHECKING(for isascii) AC_CACHE_VAL(cf_cv_have_isascii,[ - AC_TRY_LINK([#include ],[int x = isascii(' '); (void)x], + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ],[int x = isascii(' '); (void)x])], [cf_cv_have_isascii=yes], [cf_cv_have_isascii=no]) ])dnl @@ -4231,7 +4407,7 @@ test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII,1,[Define to 1 if we have isascii()]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_LARGEFILE version: 13 updated: 2023/12/03 19:09:59 +dnl CF_LARGEFILE version: 14 updated: 2025/12/22 04:16:14 dnl ------------ dnl Add checks for large file support. AC_DEFUN([CF_LARGEFILE],[ @@ -4261,7 +4437,7 @@ fi AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[ - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #pragma GCC diagnostic error "-Wincompatible-pointer-types" #include #include @@ -4276,7 +4452,7 @@ struct dirent *y = readdir(dp); int z = x - y; (void)z; - ], + ])], [cf_cv_struct_dirent64=yes], [cf_cv_struct_dirent64=no]) ]) @@ -4285,7 +4461,7 @@ ]) ]) dnl --------------------------------------------------------------------------- -dnl CF_LDFLAGS_STATIC version: 14 updated: 2021/01/02 17:09:14 +dnl CF_LDFLAGS_STATIC version: 17 updated: 2025/12/24 12:27:29 dnl ----------------- dnl Check for compiler/linker flags used to temporarily force usage of static dnl libraries. This depends on the compiler and platform. Use this to help @@ -4306,21 +4482,21 @@ esac else case "$cf_cv_system_name" in - (aix[[4-7]]*) # from ld manpage + (aix[[4-7]]*) # from ld man page LDFLAGS_STATIC=-bstatic LDFLAGS_SHARED=-bdynamic ;; - (hpux*) # from ld manpage for hpux10.20, hpux11.11 + (hpux*) # from ld man page for hpux10.20, hpux11.11 # We could also use just "archive" and "shared". LDFLAGS_STATIC=-Wl,-a,archive_shared LDFLAGS_SHARED=-Wl,-a,shared_archive ;; - (irix*) # from ld manpage IRIX64 + (irix*) # from ld man page IRIX64 LDFLAGS_STATIC=-Bstatic LDFLAGS_SHARED=-Bdynamic ;; - (osf[[45]]*) # from ld manpage osf4.0d, osf5.1 - # alternative "-oldstyle_liblookup" (not in cc manpage) + (osf[[45]]*) # from ld man page osf4.0d, osf5.1 + # alternative "-oldstyle_liblookup" (not in cc man page) LDFLAGS_STATIC=-noso LDFLAGS_SHARED=-so_archive ;; @@ -4342,21 +4518,21 @@ int cf_ldflags_static(FILE *fp) { return fflush(fp); } EOF if AC_TRY_EVAL(ac_compile) ; then - ( $AR $ARFLAGS libconftest.a conftest.o ) 2>&AC_FD_CC 1>/dev/null - ( eval $RANLIB libconftest.a ) 2>&AC_FD_CC >/dev/null + ( $AR $ARFLAGS libconftest.a conftest.$OBJEXT ) 2>&AS_MESSAGE_LOG_FD 1>/dev/null + ( eval $RANLIB libconftest.a ) 2>&AS_MESSAGE_LOG_FD >/dev/null fi rm -f conftest.* cf_save_LIBS="$LIBS" LIBS="$LDFLAGS_STATIC -L`pwd` -lconftest $LDFLAGS_DYNAMIC $LIBS" - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ #line __oline__ "configure" #include int cf_ldflags_static(FILE *fp); ],[ return cf_ldflags_static(stdin); -],[ +])],[ # some linkers simply ignore the -dynamic case x`file "conftest$ac_exeext" 2>/dev/null` in (*static*) @@ -4387,7 +4563,7 @@ AC_SUBST(LDFLAGS_SHARED) ]) dnl --------------------------------------------------------------------------- -dnl CF_LD_RPATH_OPT version: 9 updated: 2021/01/01 13:31:04 +dnl CF_LD_RPATH_OPT version: 10 updated: 2025/12/15 04:04:20 dnl --------------- dnl For the given system and compiler, find the compiler flags to pass to the dnl loader to use the "rpath" feature. @@ -4435,7 +4611,7 @@ AC_MSG_CHECKING(if we need a space after rpath option) cf_save_LIBS="$LIBS" CF_ADD_LIBS(${LD_RPATH_OPT}$libdir) - AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], cf_rpath_space=no, cf_rpath_space=yes) LIBS="$cf_save_LIBS" AC_MSG_RESULT($cf_rpath_space) test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " @@ -4567,9 +4743,12 @@ $1="$cf_library_path_list [$]$1" ])dnl dnl --------------------------------------------------------------------------- -dnl CF_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09 +dnl CF_LIBTOOL_VERSION version: 2 updated: 2024/06/12 04:19:01 dnl ------------------ AC_DEFUN([CF_LIBTOOL_VERSION],[ +ifdef([LT_PACKAGE_VERSION],[ + cf_cv_libtool_version=LT_PACKAGE_VERSION +],[ if test -n "$LIBTOOL" && test "$LIBTOOL" != none then cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'` @@ -4578,6 +4757,7 @@ fi test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version ])dnl +])dnl dnl --------------------------------------------------------------------------- dnl CF_LIB_PREFIX version: 14 updated: 2021/01/01 13:31:04 dnl ------------- @@ -4603,7 +4783,7 @@ AC_SUBST(LIB_PREFIX) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_LIB_RULES version: 100 updated: 2023/06/03 15:17:30 +dnl CF_LIB_RULES version: 103 updated: 2025/11/11 20:09:36 dnl ------------ dnl Append definitions and rules for the given models to the subdirectory dnl Makefiles, and the recursion rule for the top-level Makefile. If the @@ -4621,6 +4801,7 @@ AC_DEFUN([CF_LIB_RULES], [AC_REQUIRE([AC_PROG_FGREP])dnl AC_REQUIRE([CF_MAKE_PHONY])dnl +AC_REQUIRE([CF_GLOB_FULLPATH])dnl cf_prefix=$LIB_PREFIX AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) @@ -4703,7 +4884,7 @@ if test "$cf_item" = shared ; then if test -n "${LIB_SUFFIX}" then - cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${USE_LIB_SUFFIX}"'//'` + cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${ABI_SUFFIX}"'//'` else cf_shared_suffix="$cf_suffix" fi @@ -4724,16 +4905,16 @@ case "$cf_cv_system_name" in (darwin*) # "w", etc? - cf_suffix="${USE_LIB_SUFFIX}"'.${'$cf_version_name'}'"$cf_shared_suffix" + cf_suffix="${ABI_SUFFIX}"'.${'$cf_version_name'}'"$cf_shared_suffix" ;; (*) cf_suffix="$cf_suffix"'.${'$cf_version_name'}' ;; esac fi - if test -n "${USE_LIB_SUFFIX}" + if test -n "${ABI_SUFFIX}" then - cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${USE_LIB_SUFFIX}"'//'` + cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${ABI_SUFFIX}"'//'` else cf_shared_suffix="$cf_suffix" fi @@ -4785,10 +4966,10 @@ cf_add_lib= case "$cf_l_parts" in (*termlib*) - cf_add_lib=`echo "$cf_liblist" |sed -e s%${LIB_NAME}${USE_LIB_SUFFIX}%${TINFO_LIB_SUFFIX}%g` + cf_add_lib=`echo "$cf_liblist" |sed -e s%${LIB_NAME}${ABI_SUFFIX}%${TINFO_LIB_SUFFIX}%g` ;; (*ticlib*) - cf_add_lib=`echo "$cf_liblist" |sed -e s%${LIB_NAME}${USE_LIB_SUFFIX}%${TICS_LIB_SUFFIX}%g` + cf_add_lib=`echo "$cf_liblist" |sed -e s%${LIB_NAME}${ABI_SUFFIX}%${TICS_LIB_SUFFIX}%g` ;; (*) break @@ -4871,7 +5052,7 @@ if test "$cf_dir" = ncurses ; then case "$cf_subset" in (*base*) - cf_libname=${cf_libname}$USE_LIB_SUFFIX + cf_libname=${cf_libname}$ABI_SUFFIX ;; (*termlib*) cf_libname=$TINFO_LIB_SUFFIX @@ -4882,14 +5063,14 @@ esac elif test "$cf_dir" = c++ ; then CF_MAP_LIB_BASENAME(cf_libname,cxx) - cf_libname=${cf_libname}$USE_LIB_SUFFIX + cf_libname=${cf_libname}$ABI_SUFFIX else CF_MAP_LIB_BASENAME(cf_libname,$cf_dir) - cf_libname=${cf_libname}$USE_LIB_SUFFIX + cf_libname=${cf_libname}$ABI_SUFFIX fi if test -n "${USE_ARG_SUFFIX}" ; then - # undo $USE_LIB_SUFFIX add-on in CF_LIB_SUFFIX - cf_suffix=`echo "$cf_suffix" |sed -e "s%^${USE_LIB_SUFFIX}%%"` + # undo $ABI_SUFFIX add-on in CF_LIB_SUFFIX + cf_suffix=`echo "$cf_suffix" |sed -e "s%^${ABI_SUFFIX}%%"` fi # These dependencies really are for development, not @@ -4910,8 +5091,8 @@ cf_dir_suffix= old_cf_suffix="$cf_suffix" if test "$cf_cv_shlib_version_infix" = yes ; then - if test -n "$USE_LIB_SUFFIX" ; then - case "$USE_LIB_SUFFIX" in + if test -n "$ABI_SUFFIX" ; then + case "$ABI_SUFFIX" in (tw*) cf_libname=`echo "$cf_libname" | sed 's/tw'$EXTRA_SUFFIX'$//'` cf_suffix=`echo "$cf_suffix" | sed 's/^tw'$EXTRA_SUFFIX'//'` @@ -4941,8 +5122,8 @@ traces=$LIB_TRACING \ MODEL=$cf_ITEM \ CXX_MODEL=$CXX_MODEL \ + ABI_SUFFIX=$ABI_SUFFIX \ LIB_SUFFIX=$LIB_SUFFIX \ - USE_LIB_SUFFIX=$USE_LIB_SUFFIX \ make_phony="${cf_cv_make_PHONY:-no}" \ model=$cf_subdir \ prefix=$cf_prefix \ @@ -5127,7 +5308,7 @@ cat >headers.sh <>headers.sh <>headers.sh <>headers.sh <&AC_FD_CC 1>/dev/null + mv conftest.$OBJEXT data.$OBJEXT && \ + ( $AR $ARFLAGS conftest.a data.$OBJEXT ) 2>&AS_MESSAGE_LOG_FD 1>/dev/null fi - rm -f conftest.$ac_ext data.o + rm -f conftest.$ac_ext data.$OBJEXT cat >conftest.$ac_ext <&AC_FD_CC 1>/dev/null + mv conftest.$OBJEXT func.$OBJEXT && \ + ( $AR $ARFLAGS conftest.a func.$OBJEXT ) 2>&AS_MESSAGE_LOG_FD 1>/dev/null fi - rm -f conftest.$ac_ext func.o - ( eval $RANLIB conftest.a ) 2>&AC_FD_CC >/dev/null + rm -f conftest.$ac_ext func.$OBJEXT + ( eval $RANLIB conftest.a ) 2>&AS_MESSAGE_LOG_FD >/dev/null cf_saveLIBS="$LIBS" LIBS="conftest.a $LIBS" AC_TRY_RUN([ @@ -5451,7 +5632,7 @@ ])dnl dnl --------------------------------------------------------------------------- -dnl CF_LINK_FUNCS version: 13 updated: 2023/12/03 09:24:04 +dnl CF_LINK_FUNCS version: 14 updated: 2024/12/14 16:09:34 dnl ------------- dnl Most Unix systems have both link and symlink, a few don't have symlink. dnl A few non-Unix systems implement symlink, but not link. @@ -5486,7 +5667,7 @@ char dst[] = "conftest.chk"; struct stat src_sb, dst_sb; FILE *fp = fopen(src, "w"); - if (fp == 0) { fail = 3; } else { + if (fp == NULL) { fail = 3; } else { fclose(fp); stat(src, &src_sb); if ($cf_func(src, dst) < 0) { fail = 1; @@ -5518,50 +5699,7 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MAKEFLAGS version: 21 updated: 2021/09/04 06:47:34 -dnl ------------ -dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make' -dnl options to lower-levels. It is very useful for "make -n" -- if we have it. -dnl (GNU 'make' does both, something POSIX 'make', which happens to make the -dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-) -AC_DEFUN([CF_MAKEFLAGS], -[AC_REQUIRE([AC_PROG_FGREP])dnl - -AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[ - cf_cv_makeflags='' - for cf_option in '-${MAKEFLAGS}' '${MFLAGS}' - do - cat >cf_makeflags.tmp </dev/null | ${FGREP-fgrep} -v "ing directory" | sed -e 's,[[ ]]*$,,'` - case "$cf_result" in - (.*k|.*kw) - cf_result="`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`" - case "$cf_result" in - (.*CC=*) cf_cv_makeflags= - ;; - (*) cf_cv_makeflags=$cf_option - ;; - esac - break - ;; - (.-) - ;; - (*) - CF_MSG_LOG(given option \"$cf_option\", no match \"$cf_result\") - ;; - esac - done - rm -f cf_makeflags.tmp -]) - -AC_SUBST(cf_cv_makeflags) -])dnl -dnl --------------------------------------------------------------------------- -dnl CF_MAKE_PHONY version: 3 updated: 2021/01/08 16:08:21 +dnl CF_MAKE_PHONY version: 4 updated: 2025/12/24 12:27:29 dnl ------------- dnl Check if the make-program handles a ".PHONY" target, e.g,. a target which dnl acts as a placeholder. @@ -5632,7 +5770,7 @@ fi break done - ) >&AC_FD_CC 2>&1 + ) >&AS_MESSAGE_LOG_FD 2>&1 cf_cv_make_PHONY="`cat conftest.tmp`" rm -rf conftest* ]) @@ -5681,9 +5819,9 @@ AC_SUBST(MAKE_LOWER_TAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MANPAGE_FORMAT version: 19 updated: 2024/03/30 08:27:40 +dnl CF_MANPAGE_FORMAT version: 20 updated: 2025/11/11 20:09:36 dnl ----------------- -dnl Option to allow user to override automatic configuration of manpage format. +dnl Option to allow user to override automatic configuration of man page format. dnl There are several special cases: dnl dnl compress - man checks for, can display compressed files @@ -5696,15 +5834,15 @@ dnl catonly - installer should only format, e.g., for a turnkey system. dnl dnl There are other configurations which this macro does not test, e.g., HPUX's -dnl compressed manpages (but uncompressed manpages are fine, and HPUX's naming +dnl compressed man pages (but uncompressed man pages are fine, and HPUX's naming dnl convention would not match our use). AC_DEFUN([CF_MANPAGE_FORMAT], [ AC_REQUIRE([CF_PATHSEP]) -AC_MSG_CHECKING(format of man-pages) +AC_MSG_CHECKING(format of man pages) AC_ARG_WITH(manpage-format, - [ --with-manpage-format specify manpage-format: gzip/compress/bzip2/xz, + [ --with-manpage-format specify man page format: gzip/compress/bzip2/xz, BSDI/normal and optionally formatted/catonly, e.g., gzip,formatted], [MANPAGE_FORMAT=$withval], @@ -5721,7 +5859,7 @@ MANPATH="/usr/man:/usr/share/man" fi - # look for the 'date' man-page (it is most likely to be installed!) + # look for the 'date' man page (it is most likely to be installed!) MANPAGE_FORMAT= cf_preform="no" cf_catonly="yes" @@ -5768,7 +5906,7 @@ test "$cf_found" = yes && break fi done - # only check the first directory in $MANPATH where we find manpages + # only check the first directory in $MANPATH where we find man pages if test -n "$MANPAGE_FORMAT" ; then break fi @@ -5792,7 +5930,7 @@ AC_MSG_RESULT($MANPAGE_FORMAT) if test -n "$cf_unknown" ; then - AC_MSG_WARN(Unexpected manpage-format $cf_unknown) + AC_MSG_WARN(Unexpected man page format $cf_unknown) fi cf_manpage_format=no @@ -5840,17 +5978,17 @@ ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MANPAGE_RENAMES version: 17 updated: 2022/10/23 07:46:29 +dnl CF_MANPAGE_RENAMES version: 18 updated: 2025/11/11 20:09:36 dnl ------------------ -dnl The Debian people have their own naming convention for manpages. This +dnl The Debian people have their own naming convention for man pages. This dnl option lets us override the name of the file containing renaming, or dnl disable it altogether. AC_DEFUN([CF_MANPAGE_RENAMES], [ -AC_MSG_CHECKING(for manpage renaming) +AC_MSG_CHECKING(for man page renaming) AC_ARG_WITH(manpage-renames, - [ --with-manpage-renames specify manpage-renaming], + [ --with-manpage-renames specify man page renaming], [MANPAGE_RENAMES=$withval], [MANPAGE_RENAMES=yes]) @@ -5879,17 +6017,17 @@ AC_SUBST(MANPAGE_RENAMES) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MANPAGE_SYMLINKS version: 7 updated: 2023/01/21 16:37:17 +dnl CF_MANPAGE_SYMLINKS version: 8 updated: 2025/11/11 20:09:36 dnl ------------------- -dnl Some people expect each tool to make all aliases for manpages in the +dnl Some people expect each tool to make all aliases for man pages in the dnl man-directory. This accommodates the older, less-capable implementations dnl of 'man', and is optional. AC_DEFUN([CF_MANPAGE_SYMLINKS], [ -AC_MSG_CHECKING(if manpage aliases will be installed) +AC_MSG_CHECKING(if man page aliases will be installed) AC_ARG_WITH(manpage-aliases, - [ --with-manpage-aliases specify manpage-aliases using .so], + [ --with-manpage-aliases specify man page aliases using .so], [MANPAGE_ALIASES=$withval], [MANPAGE_ALIASES=yes]) @@ -5906,10 +6044,10 @@ MANPAGE_SYMLINKS=no if test "$MANPAGE_ALIASES" = yes ; then -AC_MSG_CHECKING(if manpage symlinks should be used) +AC_MSG_CHECKING(if man page symlinks should be used) AC_ARG_WITH(manpage-symlinks, - [ --with-manpage-symlinks specify manpage-aliases using symlinks], + [ --with-manpage-symlinks specify man page aliases using symlinks], [MANPAGE_SYMLINKS=$withval], [MANPAGE_SYMLINKS=$cf_use_symlinks]) @@ -5925,54 +6063,30 @@ ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MANPAGE_TBL version: 3 updated: 2002/01/19 22:51:32 +dnl CF_MANPAGE_TBL version: 4 updated: 2025/11/11 20:09:36 dnl -------------- -dnl This option causes manpages to be run through tbl(1) to generate tables +dnl This option causes man pages to be run through tbl(1) to generate tables dnl correctly. AC_DEFUN([CF_MANPAGE_TBL], [ -AC_MSG_CHECKING(for manpage tbl) +AC_MSG_CHECKING(for man page tbl) AC_ARG_WITH(manpage-tbl, - [ --with-manpage-tbl specify manpage processing with tbl], + [ --with-manpage-tbl specify man page processing with tbl], [MANPAGE_TBL=$withval], [MANPAGE_TBL=no]) AC_MSG_RESULT($MANPAGE_TBL) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MB_LEN_MAX version: 1 updated: 2024/03/02 15:45:10 -dnl ------------- -dnl Check if defines a usable MB_LEN_MAX. That may be because it is -dnl not defined, or it may be a bogus value. -AC_DEFUN([CF_MB_LEN_MAX],[ -AC_CACHE_CHECK(if MB_LEN_MAX is usable,cf_cv_mb_len_max,[ -AC_TRY_COMPILE([ -$ac_includes_default -#include ], -[ -#if defined(MB_LEN_MAX) && MB_LEN_MAX >= 6 - ${cf_cv_main_return:-return}(0); -#else -#error MB_LEN_MAX is not usable -#endif -], [cf_cv_mb_len_max=yes], - [cf_cv_mb_len_max=no])]) -if test "$cf_cv_mb_len_max" = yes -then - AC_DEFINE(HAVE_CONSISTENT_MB_LEN_MAX,1,[Define to 1 if MB_LEN_MAX is usable]) -else - AC_MSG_WARN(MB_LEN_MAX is missing/inconsistent in system headers) -fi -])dnl -dnl --------------------------------------------------------------------------- -dnl CF_MAN_PAGES version: 59 updated: 2024/03/30 08:27:40 +dnl CF_MAN_PAGES version: 64 updated: 2025/11/11 20:09:36 dnl ------------ -dnl Try to determine if the man-pages on the system are compressed, and if +dnl Try to determine if the man pages on the system are compressed, and if dnl so, what format is used. Use this information to construct a script that -dnl will install man-pages. +dnl will install man pages. AC_DEFUN([CF_MAN_PAGES], [ +AC_REQUIRE([CF_CHECK_TBL_X_OPTION]) CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:) CF_MANPAGE_FORMAT CF_MANPAGE_RENAMES @@ -5991,8 +6105,8 @@ cf_man_alias=`pwd`/man_alias.sed cat >$cf_edit_man <>$cf_edit_man <\$TMP.unx + mv \$TMP.unx \$TMP +fi +CF_EOF + cat >>$cf_edit_man <\$TMP.out @@ -6143,14 +6266,21 @@ if test "$with_overwrite" != yes ; then cat >>$cf_edit_man <\$TMP.out + sed -e "/\\#[ ]*include/s,\$TMP.out mv \$TMP.out \$TMP CF_EOF fi if test "$with_curses_h" != yes ; then cat >>$cf_edit_man <\$TMP.out + sed -e "/\\#[ ]*include/s,curses.h,ncurses.h," \ + < \$TMP >\$TMP.out mv \$TMP.out \$TMP CF_EOF fi @@ -6165,7 +6295,7 @@ if test -n "$cf_manpage_compress" ; then cat >>$cf_edit_man < #include #include ], - [double x = rand(); printf("result = %g\\n", ]ifelse([$2],,sin(x),$2)[)], + [double x = rand(); printf("result = %g\\n", ]ifelse([$2],,sin(x),$2)[)])], [cf_cv_need_libm=no], [cf_cv_need_libm=yes])]) @@ -6329,12 +6459,12 @@ LIBS="$LIBS -lm" AC_CACHE_CHECK(if -lm is available for math functions, cf_cv_have_libm,[ - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include #include #include ], - [double x = rand(); printf("result = %g\\n", ]ifelse([$2],,sin(x),$2)[)], + [double x = rand(); printf("result = %g\\n", ]ifelse([$2],,sin(x),$2)[)])], [cf_cv_have_libm=yes], [cf_cv_have_libm=no])]) LIBS="$cf_save_LIBS" @@ -6353,6 +6483,31 @@ fi ]) dnl --------------------------------------------------------------------------- +dnl CF_MB_LEN_MAX version: 2 updated: 2025/12/24 12:27:29 +dnl ------------- +dnl Check if defines a usable MB_LEN_MAX. That may be because it is +dnl not defined, or it may be a bogus value. +AC_DEFUN([CF_MB_LEN_MAX],[ +AC_CACHE_CHECK(if MB_LEN_MAX is usable,cf_cv_mb_len_max,[ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ +$ac_includes_default +#include ], +[ +#if defined(MB_LEN_MAX) && MB_LEN_MAX >= 6 + ${cf_cv_main_return:-return}(0); +#else +#error MB_LEN_MAX is not usable +#endif +])], [cf_cv_mb_len_max=yes], + [cf_cv_mb_len_max=no])]) +if test "$cf_cv_mb_len_max" = yes +then + AC_DEFINE(HAVE_CONSISTENT_MB_LEN_MAX,1,[Define to 1 if MB_LEN_MAX is usable]) +else + AC_MSG_WARN(MB_LEN_MAX is missing/inconsistent in system headers) +fi +])dnl +dnl --------------------------------------------------------------------------- dnl CF_MIXEDCASE_FILENAMES version: 9 updated: 2021/01/01 16:53:59 dnl ---------------------- dnl Check if the file-system supports mixed-case filenames. If we're able to @@ -6383,7 +6538,7 @@ test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MKSTEMP version: 13 updated: 2023/12/01 17:22:50 +dnl CF_MKSTEMP version: 14 updated: 2025/12/14 18:08:20 dnl ---------- dnl Check for a working mkstemp. This creates two files, checks that they are dnl successfully created and distinct (AmigaOS apparently fails on the last). @@ -6393,7 +6548,7 @@ ) AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[ rm -rf ./conftest* -AC_TRY_RUN([ +AC_RUN_IFELSE([AC_LANG_SOURCE([[ $ac_includes_default int main(void) @@ -6423,7 +6578,7 @@ result = 1; ${cf_cv_main_return:-return}(result); } -],[cf_cv_func_mkstemp=yes +]])],[cf_cv_func_mkstemp=yes ],[cf_cv_func_mkstemp=no ],[cf_cv_func_mkstemp=maybe]) ]) @@ -6435,12 +6590,12 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 +dnl CF_MSG_LOG version: 6 updated: 2025/12/14 17:51:46 dnl ---------- dnl Write a debug message to config.log, along with the line number in the dnl configure script. AC_DEFUN([CF_MSG_LOG],[ -echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC +echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AS_MESSAGE_LOG_FD ])dnl dnl --------------------------------------------------------------------------- dnl CF_NCURSES_ABI_6 version: 5 updated: 2023/01/07 16:32:06 @@ -6558,7 +6713,7 @@ esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_OUTPUT_MANPAGE_RENAMES version: 2 updated: 2022/10/22 19:12:31 +dnl CF_OUTPUT_MANPAGE_RENAMES version: 3 updated: 2025/11/11 20:09:36 dnl ------------------------- dnl This runs in the output step to config.status, after man_db.renames has dnl been generated. @@ -6566,7 +6721,7 @@ [ AC_REQUIRE([CF_MANPAGE_RENAMES]) if test "$MANPAGE_RENAMES" != no ; then - # Construct a sed-script to perform renaming within man-pages + # Construct a sed script to perform renaming within man pages test -n "$verbose" && echo "creating edit_man.sed" test ! -d man && mkdir man FGREP="${FGREP-grep -F}" $SHELL "$srcdir/man/make_sed.sh" "$MANPAGE_RENAMES" >./edit_man.sed @@ -6634,39 +6789,39 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PATH_SYNTAX version: 18 updated: 2020/12/31 18:40:20 +dnl CF_PATH_SYNTAX version: 20 updated: 2025/12/16 04:09:03 dnl -------------- dnl Check the argument to see that it looks like a pathname. Rewrite it if it dnl begins with one of the prefix/exec_prefix variables, and then again if the dnl result begins with 'NONE'. This is necessary to work around autoconf's dnl delayed evaluation of those symbols. AC_DEFUN([CF_PATH_SYNTAX],[ +AC_REQUIRE([CF_GLOB_FULLPATH])dnl + if test "x$prefix" != xNONE; then cf_path_syntax="$prefix" else cf_path_syntax="$ac_default_prefix" fi -case ".[$]$1" in -(.\[$]\(*\)*|.\'*\'*) - ;; -(..|./*|.\\*) +case "x[$]$1" in +(x\[$]\(*\)*|x\'*\'*) ;; -(.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX +(x.|x$GLOB_FULLPATH_POSIX|x$GLOB_FULLPATH_OTHER) ;; -(.\[$]\{*prefix\}*|.\[$]\{*dir\}*) +(x\[$]\{*prefix\}*|x\[$]\{*dir\}*) eval $1="[$]$1" - case ".[$]$1" in - (.NONE/*) + case "x[$]$1" in + (xNONE/*) $1=`echo "[$]$1" | sed -e s%NONE%$cf_path_syntax%` ;; esac ;; -(.no|.NONE/*) +(xno|xNONE/*) $1=`echo "[$]$1" | sed -e s%NONE%$cf_path_syntax%` ;; (*) - ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) + ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not "[$]$1"])],$2) ;; esac ])dnl @@ -6709,7 +6864,7 @@ AC_SUBST(PKG_CONFIG) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_POSIX_C_SOURCE version: 12 updated: 2023/02/18 17:41:25 +dnl CF_POSIX_C_SOURCE version: 13 updated: 2025/12/14 17:40:20 dnl ----------------- dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. dnl @@ -6738,10 +6893,10 @@ AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ CF_MSG_LOG(if the symbol is already defined go no further) - AC_TRY_COMPILE([#include ],[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],[ #ifndef _POSIX_C_SOURCE #error _POSIX_C_SOURCE is not defined -#endif], +#endif])], [cf_cv_posix_c_source=no], [cf_want_posix_source=no case .$cf_POSIX_C_SOURCE in @@ -6757,10 +6912,10 @@ ;; esac if test "$cf_want_posix_source" = yes ; then - AC_TRY_COMPILE([#include ],[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],[ #ifdef _POSIX_SOURCE #error _POSIX_SOURCE is defined -#endif],[], +#endif])],[], cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") fi CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) @@ -6768,10 +6923,10 @@ CPPFLAGS="$cf_trim_CPPFLAGS" CF_APPEND_TEXT(CPPFLAGS,$cf_cv_posix_c_source) CF_MSG_LOG(if the second compile does not leave our definition intact error) - AC_TRY_COMPILE([#include ],[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],[ #ifndef _POSIX_C_SOURCE #error _POSIX_C_SOURCE is not defined -#endif],, +#endif])],, [cf_cv_posix_c_source=no]) CFLAGS="$cf_save_CFLAGS" CPPFLAGS="$cf_save_CPPFLAGS" @@ -6788,7 +6943,7 @@ ])dnl dnl --------------------------------------------------------------------------- -dnl CF_POSIX_VISIBLE version: 1 updated: 2018/12/31 20:46:17 +dnl CF_POSIX_VISIBLE version: 2 updated: 2025/12/14 17:40:20 dnl ---------------- dnl POSIX documents test-macros which an application may set before any system dnl headers are included to make features available. @@ -6804,18 +6959,18 @@ AC_DEFUN([CF_POSIX_VISIBLE], [ AC_CACHE_CHECK(if the POSIX test-macros are already defined,cf_cv_posix_visible,[ -AC_TRY_COMPILE([#include ],[ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],[ #if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \ && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \ && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \ && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0) #error conflicting symbols found #endif -],[cf_cv_posix_visible=no],[cf_cv_posix_visible=yes]) +])],[cf_cv_posix_visible=no],[cf_cv_posix_visible=yes]) ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PREDEFINE version: 3 updated: 2023/02/18 17:41:25 +dnl CF_PREDEFINE version: 4 updated: 2025/12/24 12:27:29 dnl ------------ dnl Add definitions to CPPFLAGS to ensure they're predefined for all compiles. dnl @@ -6824,22 +6979,22 @@ AC_DEFUN([CF_PREDEFINE], [ AC_MSG_CHECKING(if we must define $1) -AC_TRY_COMPILE([#include +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],[ #ifndef $1 #error $1 is not defined -#endif],[cf_result=no],[cf_result=yes]) +#endif])],[cf_result=no],[cf_result=yes]) AC_MSG_RESULT($cf_result) if test "$cf_result" = yes ; then CPPFLAGS="$CPPFLAGS ifelse([$2],,-D$1,[-D$1=$2])" elif test "x$2" != "x" ; then AC_MSG_CHECKING(checking for compatible value versus $2) - AC_TRY_COMPILE([#include + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],[ #if $1-$2 < 0 #error $1-$2 is negative -#endif],[cf_result=yes],[cf_result=no]) +#endif])],[cf_result=yes],[cf_result=no]) AC_MSG_RESULT($cf_result) if test "$cf_result" = no ; then # perhaps we can override it - try... @@ -6905,7 +7060,7 @@ CF_CC_ENV_FLAGS ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PROG_CC_C_O version: 6 updated: 2021/01/01 13:31:04 +dnl CF_PROG_CC_C_O version: 7 updated: 2025/12/24 12:27:29 dnl -------------- dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that dnl the output file can be renamed, and allows for a shell variable that can @@ -6929,7 +7084,7 @@ CF_EOF # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. -ac_try='[$]$1 $2 -c conftest.$ac_ext -o conftest2.$ac_objext >&AC_FD_CC' +ac_try='[$]$1 $2 -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD' if AC_TRY_EVAL(ac_try) && test -f conftest2.$ac_objext && AC_TRY_EVAL(ac_try); then @@ -6946,7 +7101,7 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PROG_GNAT version: 12 updated: 2021/01/02 17:09:14 +dnl CF_PROG_GNAT version: 13 updated: 2025/12/24 12:27:29 dnl ------------ dnl Check for gnat/gnatmake/etc, ensure that the toolset is complete. AC_DEFUN([CF_PROG_GNAT],[ @@ -6995,12 +7150,12 @@ "$cf_gprconfig,,,,GCC" \ "$cf_gprconfig" do - cf_gprconfig_value=`echo s| gprconfig --config=$cf_gprconfig_param 2>&AC_FD_CC | ${AWK:-awk} '/^\*/{print [$]3;}' | head -n 1` + cf_gprconfig_value=`echo s| gprconfig --config=$cf_gprconfig_param 2>&AS_MESSAGE_LOG_FD | ${AWK:-awk} '/^\*/{print [$]3;}' | head -n 1` test -n "$cf_gprconfig_value" && break done else cf_gprconfig_param=$cf_gprconfig - cf_gprconfig_value=`echo s| gprconfig --config=$cf_gprconfig_param 2>&AC_FD_CC | ${AWK:-awk} '/^\*/{print [$]3;}' | head -n 1` + cf_gprconfig_value=`echo s| gprconfig --config=$cf_gprconfig_param 2>&AS_MESSAGE_LOG_FD | ${AWK:-awk} '/^\*/{print [$]3;}' | head -n 1` fi if test -n "$cf_gprconfig_value" then @@ -7051,15 +7206,25 @@ AC_SUBST(cf_ada_config_C) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PROG_INSTALL version: 10 updated: 2021/01/04 19:33:05 +dnl CF_PROG_INSTALL version: 13 updated: 2025/10/21 16:28:49 dnl --------------- dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the dnl misc/tabset install won't work properly. Usually this happens only when dnl using the fallback mkinstalldirs script AC_DEFUN([CF_PROG_INSTALL], [AC_PROG_INSTALL -case $INSTALL in -(/*) +AC_REQUIRE([CF_GLOB_FULLPATH])dnl +if test "x$INSTALL" = "x./install-sh -c"; then + if test -f /usr/sbin/install ; then + case "$host_os" in + (linux*gnu*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin|msys|mingw*|linux*uclibc) + INSTALL=/usr/sbin/install + ;; + esac + fi +fi +case x$INSTALL in +(x$GLOB_FULLPATH_POSIX|x$GLOB_FULLPATH_OTHER) ;; (*) CF_DIRNAME(cf_dir,$INSTALL) @@ -7089,14 +7254,17 @@ AC_SUBST(LDCONFIG) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PROG_LINT version: 5 updated: 2022/08/20 15:44:13 +dnl CF_PROG_LINT version: 7 updated: 2024/11/30 14:37:45 dnl ------------ AC_DEFUN([CF_PROG_LINT], [ AC_CHECK_PROGS(LINT, lint cppcheck splint) case "x$LINT" in +(xlint|x*/lint) # NetBSD 10 + test -z "$LINT_OPTS" && LINT_OPTS="-chapbrxzgFS -v -Ac11" + ;; (xcppcheck|x*/cppcheck) - test -z "$LINT_OPTS" && LINT_OPTS="--enable=all" + test -z "$LINT_OPTS" && LINT_OPTS="--enable=all -D__CPPCHECK__" ;; esac AC_SUBST(LINT_OPTS) @@ -7125,7 +7293,15 @@ test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f" ])dnl dnl --------------------------------------------------------------------------- -dnl CF_REGEX version: 18 updated: 2021/01/01 16:53:59 +dnl CF_PROG_TBL version: 1 updated: 2025/11/01 18:43:38 +dnl ----------- +dnl Allow the "tbl" program to be configured. +dnl "TBL" is too short, and likely to conflict. +AC_DEFUN([CF_PROG_TBL],[ +AC_PATH_PROG(NROFF_TBL,tbl) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_REGEX version: 20 updated: 2025/12/24 12:27:29 dnl -------- dnl Attempt to determine if we've got one of the flavors of regular-expression dnl code that we can support. @@ -7181,12 +7357,12 @@ (compile) for cf_regex_hdr in regexp.h regexpr.h do - AC_TRY_LINK([#include <$cf_regex_hdr>],[ + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <$cf_regex_hdr>],[ char *p = compile("", "", "", 0); int x = step("", ""); (void)p; (void)x; - ],[ + ])],[ cf_cv_regex_hdrs=$cf_regex_hdr break ]) @@ -7195,15 +7371,16 @@ (*) for cf_regex_hdr in regex.h do - AC_TRY_LINK([#include + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include +#include #include <$cf_regex_hdr>],[ - regex_t *p = 0; + regex_t *p = NULL; int x = regcomp(p, "", 0); int y = regexec(p, "", 0, 0, 0); (void)x; (void)y; regfree(p); - ],[ + ])],[ cf_cv_regex_hdrs=$cf_regex_hdr break ]) @@ -7269,6 +7446,30 @@ $1=`echo "$2" | sed -e 's/-l$3[[ ]]//g' -e 's/-l$3[$]//'` ])dnl dnl --------------------------------------------------------------------------- +dnl CF_REQUIRE_PKG version: 1 updated: 2025/01/10 19:55:54 +dnl -------------- +dnl Update $REQUIRE_PKG, which lists the known required packages for this +dnl program. +dnl +dnl $1 = package(s) to require, e.g., in the generated ".pc" file +define([CF_REQUIRE_PKG], +[ +for cf_required in $1 +do + # check for duplicates + for cf_require_pkg in $REQUIRE_PKG + do + if test "$cf_required" = "$cf_require_pkg" + then + cf_required= + break + fi + done + test -n "$cf_required" && REQUIRE_PKG="$REQUIRE_PKG $cf_required" +done +AC_SUBST(REQUIRE_PKG) +])dnl +dnl --------------------------------------------------------------------------- dnl CF_RESTORE_XTRA_FLAGS version: 1 updated: 2020/01/11 16:47:45 dnl --------------------- dnl Restore flags saved in CF_SAVE_XTRA_FLAGS @@ -7280,7 +7481,7 @@ CPPFLAGS="$cf_save_CPPFLAGS_$1" ])dnl dnl --------------------------------------------------------------------------- -dnl CF_RPATH_HACK version: 13 updated: 2021/01/03 18:30:50 +dnl CF_RPATH_HACK version: 14 updated: 2025/12/15 04:04:20 dnl ------------- AC_DEFUN([CF_RPATH_HACK], [AC_REQUIRE([AC_PROG_FGREP])dnl @@ -7296,8 +7497,8 @@ then cf_rpath_oops= -AC_TRY_LINK([#include ], - [printf("Hello");], +AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [printf("Hello");])], [cf_rpath_oops=`"$cf_ldd_prog" "conftest$ac_exeext" | ${FGREP-fgrep} ' not found' | sed -e 's% =>.*$%%' |sort | uniq` cf_rpath_list=`"$cf_ldd_prog" "conftest$ac_exeext" | ${FGREP-fgrep} / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort | uniq`]) @@ -7423,7 +7624,7 @@ done ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SHARED_OPTS version: 111 updated: 2024/03/29 20:08:49 +dnl CF_SHARED_OPTS version: 114 updated: 2025/12/15 04:04:20 dnl -------------- dnl -------------- dnl Attempt to determine the appropriate CC/LD options for creating a shared @@ -7513,7 +7714,7 @@ for CC_SHARED_OPTS in -fPIC -fpic '' do CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS" - AC_TRY_COMPILE([#include ],[int x = 1; (void)x],[break],[]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],[int x = 1; (void)x])],[break],[]) done AC_MSG_RESULT($CC_SHARED_OPTS) CFLAGS="$cf_save_CFLAGS" @@ -7588,7 +7789,7 @@ AC_CACHE_CHECK([if ld -search_paths_first works], cf_cv_ldflags_search_paths_first, [ cf_save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-search_paths_first" - AC_TRY_LINK(, [int i;], cf_cv_ldflags_search_paths_first=yes, cf_cv_ldflags_search_paths_first=no) + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [int i;])], cf_cv_ldflags_search_paths_first=yes, cf_cv_ldflags_search_paths_first=no) LDFLAGS=$cf_save_LDFLAGS]) if test "$cf_cv_ldflags_search_paths_first" = yes; then LDFLAGS="$LDFLAGS -Wl,-search_paths_first" @@ -7718,7 +7919,7 @@ -L*) ldopts+=("\`echo \"\[$]1\" | sed \"s/^-L/-LIBPATH:/\"\`") ;; - *.obj | *.o) + *.obj | *.$OBJEXT) ldopts+=("\[$]1") ;; -Wl,*) @@ -7895,7 +8096,7 @@ for cf_shared_opts in -xcode=pic32 -xcode=pic13 -KPIC -Kpic -O do CFLAGS="$cf_shared_opts $cf_save_CFLAGS" - AC_TRY_COMPILE([#include ],[printf("Hello\\n");],[break]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],[printf("Hello\\n");])],[break]) done CFLAGS="$cf_save_CFLAGS" CC_SHARED_OPTS=$cf_shared_opts @@ -7939,7 +8140,7 @@ int main(int argc, char *argv[[]]) { printf("hello\\n"); - return (argv[[argc-1]] == 0) ; + return (argv[[argc-1]] == NULL) ; } EOF cf_save_CFLAGS="$CFLAGS" @@ -8002,7 +8203,7 @@ fi ]) dnl --------------------------------------------------------------------------- -dnl CF_SIGWINCH version: 7 updated: 2023/02/18 17:41:25 +dnl CF_SIGWINCH version: 8 updated: 2025/12/23 18:53:34 dnl ----------- dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all dnl programs need this test). @@ -8014,18 +8215,18 @@ AC_DEFUN([CF_SIGWINCH], [ AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[ - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #include -],[int x = SIGWINCH; (void)x], +],[int x = SIGWINCH; (void)x])], [cf_cv_define_sigwinch=yes], - [AC_TRY_COMPILE([ + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #undef _XOPEN_SOURCE #undef _POSIX_SOURCE #undef _POSIX_C_SOURCE #include #include -],[int x = SIGWINCH; (void)x], +],[int x = SIGWINCH; (void)x])], [cf_cv_define_sigwinch=maybe], [cf_cv_define_sigwinch=no]) ]) @@ -8037,7 +8238,7 @@ cf_sigwinch=32 while test "$cf_sigwinch" != 1 do - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #undef _XOPEN_SOURCE #undef _POSIX_SOURCE #undef _POSIX_C_SOURCE @@ -8047,7 +8248,7 @@ #if SIGWINCH != $cf_sigwinch #error SIGWINCH is not $cf_sigwinch #endif -int x = SIGWINCH; (void)x], +int x = SIGWINCH; (void)x])], [cf_cv_fixup_sigwinch=$cf_sigwinch break]) @@ -8061,7 +8262,7 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SIG_ATOMIC_T version: 5 updated: 2020/03/10 18:53:47 +dnl CF_SIG_ATOMIC_T version: 6 updated: 2025/12/24 12:27:29 dnl --------------- dnl signal handler, but there are some gcc dependencies in that recommendation. dnl Try anyway. @@ -8074,7 +8275,7 @@ "sig_atomic_t" \ "int" do - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #include #include @@ -8087,7 +8288,7 @@ x = 5; }], [signal(SIGINT, handler); - x = 1], + x = 1])], [cf_cv_sig_atomic_t=$cf_type], [cf_cv_sig_atomic_t=no]) test "$cf_cv_sig_atomic_t" != no && break @@ -8097,7 +8298,7 @@ test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t,[Define to signal global datatype]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SIZECHANGE version: 18 updated: 2021/09/04 06:35:04 +dnl CF_SIZECHANGE version: 19 updated: 2025/12/22 04:16:14 dnl ------------- dnl Check for definitions & structures needed for window size-changing dnl @@ -8117,7 +8318,7 @@ then CF_APPEND_TEXT(CPPFLAGS,-D$cf_opts) fi - AC_TRY_COMPILE([#include + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include #ifdef HAVE_TERMIOS_H #include #else @@ -8155,13 +8356,13 @@ no TIOCGSIZE or TIOCGWINSZ #endif /* TIOCGWINSZ */ #endif /* TIOCGSIZE */ - ], + ])], [cf_cv_sizechange=yes], [cf_cv_sizechange=no]) CPPFLAGS="$cf_save_CPPFLAGS" if test "$cf_cv_sizechange" = yes ; then - echo "size-change succeeded ($cf_opts)" >&AC_FD_CC + echo "size-change succeeded ($cf_opts)" >&AS_MESSAGE_LOG_FD test -n "$cf_opts" && cf_cv_sizechange="$cf_opts" break fi @@ -8294,7 +8495,7 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_STDCPP_LIBRARY version: 12 updated: 2021/01/01 13:31:04 +dnl CF_STDCPP_LIBRARY version: 13 updated: 2025/12/24 12:27:29 dnl ----------------- dnl Check for -lstdc++, which is GNU's standard C++ library. dnl If $CXXLIBS is set, add that to the libraries used for test-linking. @@ -8307,9 +8508,9 @@ cf_save="$LIBS" LIBS="$LIBS $CXXLIBS" AC_MSG_CHECKING(if we already have C++ library) - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include ],[ - std::cout << "Hello World!" << std::endl;], + std::cout << "Hello World!" << std::endl;])], [cf_have_libstdcpp=yes], [cf_have_libstdcpp=no]) AC_MSG_RESULT($cf_have_libstdcpp) @@ -8334,9 +8535,9 @@ cf_save="$LIBS" LIBS="$LIBS $CXXLIBS" CF_ADD_LIB($cf_stdcpp_libname) - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include ],[ - std::cout << "Hello World!" << std::endl;], + std::cout << "Hello World!" << std::endl;])], [cf_cv_libstdcpp=yes], [cf_cv_libstdcpp=no]) LIBS="$cf_save" @@ -8352,7 +8553,7 @@ AC_DEFUN([CF_STRIP_G_OPT], [$1=`echo "${$1}" | CF__SED_TRIMBLANKS(-e 's%-g %%' -e 's%-g$%%')`])dnl dnl --------------------------------------------------------------------------- -dnl CF_STRUCT_SIGACTION version: 6 updated: 2023/12/03 09:21:34 +dnl CF_STRUCT_SIGACTION version: 7 updated: 2025/12/24 12:27:29 dnl ------------------- dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only dnl do this if we've found the sigaction function. @@ -8361,17 +8562,17 @@ if test "$ac_cv_func_sigaction" = yes; then AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE) -AC_TRY_COMPILE([ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #include ], - [struct sigaction act; (void)act], + [struct sigaction act; (void)act])], [sigact_bad=no], [ -AC_TRY_COMPILE([ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #define _POSIX_SOURCE #include #include ], - [struct sigaction act; (void)act], + [struct sigaction act; (void)act])], [sigact_bad=yes AC_DEFINE(_POSIX_SOURCE,1,[Define to 1 if we must define _POSIX_SOURCE])], [sigact_bad=unknown])]) @@ -8379,13 +8580,13 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_STRUCT_TERMIOS version: 13 updated: 2023/12/03 19:38:54 +dnl CF_STRUCT_TERMIOS version: 15 updated: 2025/12/22 04:16:14 dnl ----------------- dnl Some machines require _POSIX_SOURCE to completely define struct termios. AC_DEFUN([CF_STRUCT_TERMIOS],[ AC_REQUIRE([CF_XOPEN_SOURCE]) -AC_CHECK_HEADERS( \ +AC_CHECK_HEADERS( sgtty.h \ termio.h \ termios.h \ unistd.h \ @@ -8401,13 +8602,13 @@ esac if test "$termios_bad" = maybe ; then AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE) - AC_TRY_COMPILE([#include ], - [struct termios foo; int x = (int)(foo.c_iflag = 1); (void)x], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], + [struct termios foo; int x = (int)(foo.c_iflag = 1); (void)x])], termios_bad=no, [ - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #define _POSIX_SOURCE #include ], - [struct termios foo; int x = (int)(foo.c_iflag = 2); (void)x], + [struct termios foo; int x = (int)(foo.c_iflag = 2); (void)x])], termios_bad=unknown, termios_bad=yes AC_DEFINE(_POSIX_SOURCE,1,[Define to 1 if we must define _POSIX_SOURCE])) ]) @@ -8487,7 +8688,7 @@ AC_SUBST(cf_cv_type_of_bool)dnl ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SYS_TIME_SELECT version: 6 updated: 2015/04/18 08:56:57 +dnl CF_SYS_TIME_SELECT version: 7 updated: 2025/12/24 12:27:29 dnl ------------------ dnl Check if we can include with ; this breaks on dnl older SCO configurations. @@ -8495,7 +8696,7 @@ [ AC_MSG_CHECKING(if sys/time.h works with sys/select.h) AC_CACHE_VAL(cf_cv_sys_time_select,[ -AC_TRY_COMPILE([ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #ifdef HAVE_SYS_TIME_H #include @@ -8503,7 +8704,7 @@ #ifdef HAVE_SYS_SELECT_H #include #endif -],[],[cf_cv_sys_time_select=yes], +],[])],[cf_cv_sys_time_select=yes], [cf_cv_sys_time_select=no]) ]) AC_MSG_RESULT($cf_cv_sys_time_select) @@ -8519,7 +8720,7 @@ AC_SUBST(top_builddir) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_TRY_PKG_CONFIG version: 6 updated: 2020/12/31 10:54:15 +dnl CF_TRY_PKG_CONFIG version: 7 updated: 2025/01/10 19:55:54 dnl ----------------- dnl This is a simple wrapper to use for pkg-config, for libraries which may be dnl available in that form. @@ -8536,6 +8737,7 @@ cf_pkgconfig_libs="`$PKG_CONFIG --libs "$1" 2>/dev/null`" CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs) CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs) + CF_REQUIRE_PKG($1) CF_ADD_CFLAGS($cf_pkgconfig_incs) CF_ADD_LIBS($cf_pkgconfig_libs) ifelse([$2],,:,[$2]) @@ -8546,17 +8748,17 @@ fi ]) dnl --------------------------------------------------------------------------- -dnl CF_TRY_XOPEN_SOURCE version: 4 updated: 2022/09/10 15:16:16 +dnl CF_TRY_XOPEN_SOURCE version: 5 updated: 2025/12/14 17:40:20 dnl ------------------- dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we dnl can define it successfully. AC_DEFUN([CF_TRY_XOPEN_SOURCE],[ AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ - AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY, + AC_COMPILE_IFELSE([AC_LANG_PROGRAM(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY)], [cf_cv_xopen_source=no], [cf_save="$CPPFLAGS" CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE) - AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY, + AC_COMPILE_IFELSE([AC_LANG_PROGRAM(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY)], [cf_cv_xopen_source=no], [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) CPPFLAGS="$cf_save" @@ -8571,7 +8773,7 @@ fi ]) dnl --------------------------------------------------------------------------- -dnl CF_TYPEOF_CHTYPE version: 11 updated: 2023/01/05 17:57:59 +dnl CF_TYPEOF_CHTYPE version: 12 updated: 2024/12/14 16:09:34 dnl ---------------- dnl Determine the type we should use for chtype (and attr_t, which is treated dnl as the same thing). We want around 32 bits, so on most machines want a @@ -8587,7 +8789,7 @@ int main(void) { FILE *fp = fopen("cf_test.out", "w"); - if (fp != 0) { + if (fp != NULL) { char *result = "long"; if (sizeof(unsigned long) > sizeof(unsigned int)) { int n; @@ -8623,23 +8825,23 @@ AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype,[Define to actual type if needed for chtype]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_TYPE_SIGACTION version: 5 updated: 2023/12/03 09:21:34 +dnl CF_TYPE_SIGACTION version: 6 updated: 2025/12/24 12:27:29 dnl ----------------- dnl AC_DEFUN([CF_TYPE_SIGACTION], [ AC_MSG_CHECKING([for type sigaction_t]) AC_CACHE_VAL(cf_cv_type_sigaction,[ - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include ], - [sigaction_t x; (void)x], + [sigaction_t x; (void)x])], [cf_cv_type_sigaction=yes], [cf_cv_type_sigaction=no])]) AC_MSG_RESULT($cf_cv_type_sigaction) test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION,1,[Define to 1 if we have the sigaction_t type]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_UNSIGNED_LITERALS version: 3 updated: 2023/12/03 10:02:17 +dnl CF_UNSIGNED_LITERALS version: 4 updated: 2025/12/24 12:27:29 dnl -------------------- dnl Test if the compiler supports 'U' and 'L' suffixes. Only old compilers dnl won't, but they're still there. @@ -8647,7 +8849,7 @@ [ AC_MSG_CHECKING([if unsigned literals are legal]) AC_CACHE_VAL(cf_cv_unsigned_literals,[ - AC_TRY_COMPILE([],[long x = 1L + 1UL + 1U + 1; (void)x], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[long x = 1L + 1UL + 1U + 1; (void)x])], [cf_cv_unsigned_literals=yes], [cf_cv_unsigned_literals=no]) ]) @@ -8663,20 +8865,20 @@ $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` ])dnl dnl --------------------------------------------------------------------------- -dnl CF_UTF8_LIB version: 10 updated: 2023/01/11 04:05:23 +dnl CF_UTF8_LIB version: 12 updated: 2025/12/22 04:16:14 dnl ----------- dnl Check for multibyte support, and if not found, utf8 compatibility library AC_DEFUN([CF_UTF8_LIB], [ -AC_HAVE_HEADERS(wchar.h) +AC_CHECK_HEADERS(wchar.h) AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[ cf_save_LIBS="$LIBS" - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ $ac_includes_default #ifdef HAVE_WCHAR_H #include #endif -],[putwc(0,0);], +],[putwc(0,0);])], [cf_cv_utf8_lib=yes], [CF_FIND_LINKAGE([ #include ],[putwc(0,0);],utf8, @@ -8694,19 +8896,19 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_VA_COPY version: 6 updated: 2018/12/04 18:14:25 +dnl CF_VA_COPY version: 7 updated: 2025/12/24 12:27:29 dnl ---------- dnl check for va_copy, part of stdarg.h starting with ISO C 1999. dnl Also, workaround for glibc's __va_copy, by checking for both. dnl Finally, try to accommodate pre-ISO C 1999 headers. AC_DEFUN([CF_VA_COPY],[ AC_CACHE_CHECK(for va_copy, cf_cv_have_va_copy,[ -AC_TRY_LINK([ +AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include ],[ static va_list dst; static va_list src; - va_copy(dst, src)], + va_copy(dst, src)])], cf_cv_have_va_copy=yes, cf_cv_have_va_copy=no)]) @@ -8716,12 +8918,12 @@ else # !cf_cv_have_va_copy AC_CACHE_CHECK(for __va_copy, cf_cv_have___va_copy,[ -AC_TRY_LINK([ +AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include ],[ static va_list dst; static va_list src; - __va_copy(dst, src)], + __va_copy(dst, src)])], cf_cv_have___va_copy=yes, cf_cv_have___va_copy=no)]) @@ -8731,12 +8933,12 @@ else # !cf_cv_have___va_copy AC_CACHE_CHECK(for __builtin_va_copy, cf_cv_have___builtin_va_copy,[ -AC_TRY_LINK([ +AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include ],[ static va_list dst; static va_list src; - __builtin_va_copy(dst, src)], + __builtin_va_copy(dst, src)])], cf_cv_have___builtin_va_copy=yes, cf_cv_have___builtin_va_copy=no)]) @@ -8753,24 +8955,24 @@ (*) AC_CACHE_CHECK(if we can simply copy va_list, cf_cv_pointer_va_list,[ -AC_TRY_LINK([ +AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include ],[ va_list dst; va_list src; - dst = src], + dst = src])], cf_cv_pointer_va_list=yes, cf_cv_pointer_va_list=no)]) if test "$cf_cv_pointer_va_list" = no then AC_CACHE_CHECK(if we can copy va_list indirectly, cf_cv_array_va_list,[ -AC_TRY_LINK([ +AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include ],[ va_list dst; va_list src; - *dst = *src], + *dst = *src])], cf_cv_array_va_list=yes, cf_cv_array_va_list=no)]) test "$cf_cv_array_va_list" = yes && AC_DEFINE(ARRAY_VA_LIST,1,[Define to 1 if we can copy va_list indirectly]) @@ -8779,15 +8981,15 @@ esac ]) dnl --------------------------------------------------------------------------- -dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 +dnl CF_VERBOSE version: 4 updated: 2025/12/14 17:51:46 dnl ---------- dnl Use AC_VERBOSE w/o the warnings AC_DEFUN([CF_VERBOSE], -[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG +[test -n "$verbose" && echo " $1" 1>&AS_MESSAGE_FD CF_MSG_LOG([$1]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_VERSION_INFO version: 8 updated: 2021/01/01 13:31:04 +dnl CF_VERSION_INFO version: 11 updated: 2025/09/20 13:27:11 dnl --------------- dnl Define several useful symbols derived from the VERSION file. A separate dnl file is preferred to embedding the version numbers in various scripts. @@ -8865,17 +9067,19 @@ dnl if a package name is given, define its corresponding version info. We dnl need the package name to ensure that the defined symbols are unique. ifelse($1,,,[ - cf_PACKAGE=$1 + PROGRAM=$1 PACKAGE=ifelse($2,,$1,$2) AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE",[Define to the package-name]) + AC_SUBST(PROGRAM) AC_SUBST(PACKAGE) - CF_UPPER(cf_PACKAGE,$cf_PACKAGE) - AC_DEFINE_UNQUOTED(${cf_PACKAGE}_VERSION,"${VERSION_MAJOR}.${VERSION_MINOR}") - AC_DEFINE_UNQUOTED(${cf_PACKAGE}_PATCHDATE,${VERSION_PATCH}) + AH_TEMPLATE([AS_TR_CPP($1[_VERSION])],[version of package]) + AC_DEFINE_UNQUOTED(AS_TR_CPP($1[_VERSION]),"${VERSION_MAJOR}.${VERSION_MINOR}",[define to version of $1]) + AH_TEMPLATE([AS_TR_CPP($1[_PATCHDATE])],[patchdate of package]) + AC_DEFINE_UNQUOTED(AS_TR_CPP($1[_PATCHDATE]),${VERSION_PATCH},[define to patchdate of $1]) ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WCHAR_TYPE version: 5 updated: 2023/12/03 09:21:34 +dnl CF_WCHAR_TYPE version: 6 updated: 2025/12/24 12:27:29 dnl ------------- dnl Check if type wide-character type $1 is declared, and if so, which header dnl file is needed. The second parameter is used to set a shell variable when @@ -8885,16 +9089,16 @@ [ # This is needed on Tru64 5.0 to declare $1 AC_CACHE_CHECK(if we must include wchar.h to declare $1,cf_cv_$1,[ -AC_TRY_COMPILE([ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #include #include #ifdef HAVE_LIBUTF8_H #include #endif], - [$1 state; (void)state], + [$1 state; (void)state])], [cf_cv_$1=no], - [AC_TRY_COMPILE([ + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #include #include @@ -8902,7 +9106,7 @@ #ifdef HAVE_LIBUTF8_H #include #endif], - [$1 value; (void) value], + [$1 value; (void) value])], [cf_cv_$1=yes], [cf_cv_$1=unknown])])]) @@ -8925,14 +9129,14 @@ ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WEAK_SYMBOLS version: 1 updated: 2008/08/16 19:18:06 +dnl CF_WEAK_SYMBOLS version: 2 updated: 2025/12/24 12:27:29 dnl --------------- dnl Check for compiler-support for weak symbols. dnl This works with "recent" gcc. AC_DEFUN([CF_WEAK_SYMBOLS],[ AC_CACHE_CHECK(if $CC supports weak symbols,cf_cv_weak_symbols,[ -AC_TRY_COMPILE([ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include ], [ #if defined(__GNUC__) @@ -8947,7 +9151,7 @@ #endif weak_symbol(fopen); -],[cf_cv_weak_symbols=yes],[cf_cv_weak_symbols=no]) +])],[cf_cv_weak_symbols=yes],[cf_cv_weak_symbols=no]) ]) ])dnl dnl --------------------------------------------------------------------------- @@ -9001,6 +9205,56 @@ cf_cv_abi_default=$cf_cv_abi_version ])dnl dnl --------------------------------------------------------------------------- +dnl CF_WITH_ADA version: 2 updated: 2024/11/09 18:07:29 +dnl ----------- +dnl Check for the Ada compiler (unless requested to not do this), which causes +dnl a further check for a C compiler which can work with the Ada compiler. +AC_DEFUN([CF_WITH_ADA],[ +AC_ARG_WITH(ada, + [ --without-ada suppress check for Ada compiler], + [cf_with_ada=$withval], + [cf_with_ada=yes]) + +cf_prog_cc="gcc cc" +if test "x$cf_with_ada" = xyes +then + CF_PROG_GNAT + if test "x$cf_cv_prog_gnat_correct" = xyes; then + # gcc's developers chose to deprecate gnatgcc before making gprconfig + # work. They replaced gnatgcc in gcc 13 with a script which spits out + # a warning offering advice which could never work. + # + # Here is a workaround. + AC_PATH_PROG(cf_cv_path_gnatgcc,gnatgcc,no) + if test "$cf_cv_path_gnatgcc" != no + then + AC_MSG_CHECKING(for improvement) + cf_file_gnatgcc=`file -L "$cf_cv_path_gnatgcc" 2>/dev/null` + case "x$cf_file_gnatgcc" in + (*script*) + cf_cv_path_gnatgcc=`sh -x "$cf_cv_path_gnatgcc" --version 2>&1 | grep -w exec | sed -e 's/^[[ ]]*+[[ ]]*//' -e 's/exec[[ ]]//' -e 's/ .*//'` + ;; + (*) + cf_cv_path_gnatgcc=no + ;; + esac + AC_MSG_RESULT($cf_cv_path_gnatgcc) + test "$cf_cv_path_gnatgcc" = no && cf_cv_path_gnatgcc=gnatgcc + cf_prog_cc="$cf_cv_path_gnatgcc $cf_prog_cc" + fi + fi +fi +case "$cf_prog_cc" in +(*/*) + CC="$cf_prog_cc" + AC_SUBST(CC) + ;; +(*) + CF_PROG_CC($cf_prog_cc) + ;; +esac +])dnl +dnl --------------------------------------------------------------------------- dnl CF_WITH_ADA_COMPILER version: 3 updated: 2023/10/28 11:59:01 dnl -------------------- dnl Command-line option to specify the Ada95 compiler. @@ -9201,7 +9455,7 @@ fi ]) dnl --------------------------------------------------------------------------- -dnl CF_WITH_LIBTOOL version: 36 updated: 2021/01/01 13:31:04 +dnl CF_WITH_LIBTOOL version: 38 updated: 2025/10/01 18:05:23 dnl --------------- dnl Provide a configure option to incorporate libtool. Define several useful dnl symbols for the makefile rules. @@ -9285,7 +9539,7 @@ fi ])dnl LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${libdir} ${LIBTOOL_VERSION} `cut -f1 ${top_srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} $(LIBS) -o' - LIB_OBJECT='${OBJECTS:.o=.lo}' + LIB_OBJECT='${OBJECTS:.${OBJEXT}=.lo}' LIB_SUFFIX=.la LIB_CLEAN='${LIBTOOL} --mode=clean' LIB_COMPILE='${LIBTOOL} --mode=compile' @@ -9565,7 +9819,7 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_PKG_CONFIG_LIBDIR version: 23 updated: 2023/11/22 20:48:30 +dnl CF_WITH_PKG_CONFIG_LIBDIR version: 25 updated: 2024/08/03 13:34:29 dnl ------------------------- dnl Allow the choice of the pkg-config library directory to be overridden. dnl @@ -9579,6 +9833,7 @@ dnl optionally ignores $PKG_CONFIG_LIBDIR. Very old versions of pkg-config, dnl e.g., Solaris 10 also do not recognize $PKG_CONFIG_LIBDIR. AC_DEFUN([CF_WITH_PKG_CONFIG_LIBDIR],[ +AC_REQUIRE([CF_GLOB_FULLPATH])dnl case "$PKG_CONFIG" in (no|none|yes) @@ -9612,10 +9867,10 @@ ;; (x) ;; -(x/*\ *) +(x$GLOB_FULLPATH_POSIX\ *|x$GLOB_FULLPATH_OTHER\ *) PKG_CONFIG_LIBDIR= ;; -(x/*) +(x$GLOB_FULLPATH_POSIX|x$GLOB_FULLPATH_OTHER) PKG_CONFIG_LIBDIR="$cf_search_path" AC_MSG_RESULT($PKG_CONFIG_LIBDIR) cf_search_path= @@ -9634,7 +9889,15 @@ pkg-config \ pkgconf do - cf_search_path=`"$PKG_CONFIG" --variable=pc_path "$cf_pkg_program" 2>/dev/null | tr : ' '` + cf_raw_search_path=`"$PKG_CONFIG" --variable=pc_path "$cf_pkg_program" 2>/dev/null` + case "$cf_raw_search_path" in + (*\\*) + cf_search_path=`echo "$cf_raw_search_path" | tr ';' ' ' | tr '\' '/'` + ;; + (*/*) + cf_search_path=`echo "$cf_raw_search_path" | tr : ' '` + ;; + esac test -n "$cf_search_path" && break done @@ -9707,7 +9970,7 @@ AC_SUBST(PKG_CONFIG_LIBDIR) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_PTHREAD version: 7 updated: 2015/04/18 08:56:57 +dnl CF_WITH_PTHREAD version: 8 updated: 2025/12/24 12:27:29 dnl --------------- dnl Check for POSIX thread library. AC_DEFUN([CF_WITH_PTHREAD], @@ -9728,12 +9991,12 @@ AC_MSG_CHECKING(if we can link with the $cf_lib_pthread library) cf_save_LIBS="$LIBS" CF_ADD_LIB($cf_lib_pthread) - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include ],[ int rc = pthread_create(0,0,0,0); int r2 = pthread_mutexattr_settype(0, 0); -],[with_pthread=yes],[with_pthread=no]) +])],[with_pthread=yes],[with_pthread=no]) LIBS="$cf_save_LIBS" AC_MSG_RESULT($with_pthread) test "$with_pthread" = yes && break @@ -9775,7 +10038,7 @@ ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_SYSMOUSE version: 3 updated: 2012/10/06 17:56:13 +dnl CF_WITH_SYSMOUSE version: 4 updated: 2025/12/24 12:27:29 dnl ---------------- dnl If we can compile with sysmouse, make it available unless it is not wanted. AC_DEFUN([CF_WITH_SYSMOUSE],[ @@ -9787,7 +10050,7 @@ [cf_with_sysmouse=$withval], [cf_with_sysmouse=maybe]) if test "$cf_with_sysmouse" != no ; then - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #if (__FreeBSD_version >= 400017) #include @@ -9798,14 +10061,14 @@ ],[ struct mouse_info the_mouse; ioctl(0, CONS_MOUSECTL, &the_mouse); -],[cf_with_sysmouse=yes],[cf_with_sysmouse=no]) +])],[cf_with_sysmouse=yes],[cf_with_sysmouse=no]) fi AC_MSG_RESULT($cf_with_sysmouse) test "$cf_with_sysmouse" = yes && AC_DEFINE(USE_SYSMOUSE,1,[Define to 1 if we can/should use the sysmouse interface]) fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_SYSTYPE version: 1 updated: 2013/01/26 16:26:12 +dnl CF_WITH_SYSTYPE version: 2 updated: 2025/12/14 18:08:20 dnl --------------- dnl For testing, override the derived host system-type which is used to decide dnl things such as the linker commands used to build shared libraries. This is @@ -9816,7 +10079,7 @@ dnl of the configure script which would not be reachable with --host since that dnl relies on the build environment being real, rather than mocked up. AC_DEFUN([CF_WITH_SYSTYPE],[ -CF_CHECK_CACHE([AC_CANONICAL_SYSTEM]) +CF_CHECK_CACHE([AC_CANONICAL_TARGET]) AC_ARG_WITH(system-type, [ --with-system-type=XXX test: override derived host system-type], [AC_MSG_WARN(overriding system type to $withval) @@ -9854,7 +10117,7 @@ [USE_VALGRIND]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_VERSIONED_SYMS version: 13 updated: 2023/12/03 09:24:04 +dnl CF_WITH_VERSIONED_SYMS version: 17 updated: 2025/12/16 04:01:46 dnl ---------------------- dnl Use this when building shared library with ELF, to markup symbols with the dnl version identifier from the given input file. Generally that identifier is @@ -9864,7 +10127,11 @@ AC_DEFUN([CF_WITH_VERSIONED_SYMS], [AC_REQUIRE([AC_PROG_FGREP])dnl AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([CF_GLOB_FULLPATH])dnl +if test "$with_libtool" = "yes" ; then + : +elif test "$with_shared" = "yes" ; then AC_MSG_CHECKING(if versioned-symbols file should be used) AC_ARG_WITH(versioned-syms, [[ --with-versioned-syms[=MAP-FILE] version ELF shared library symbols per MAP-FILE]], @@ -9877,7 +10144,7 @@ ;; (xno) ;; -(x/*) +(x$GLOB_FULLPATH_POSIX|x$GLOB_FULLPATH_OTHER) test -f "$with_versioned_syms" || AC_MSG_ERROR(expected a filename: $with_versioned_syms) ;; (*) @@ -9899,11 +10166,13 @@ VERSIONED_SYMS="-Wl,--version-script,\${RESULTING_SYMS}" MK_SHARED_LIB=`echo "$MK_SHARED_LIB" | sed -e "s%-Wl,%\\[$]{VERSIONED_SYMS} -Wl,%"` CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB) + LIB_CREATE="[$]MK_SHARED_LIB" ;; (*-dy\ *) VERSIONED_SYMS="-Wl,-M,\${RESULTING_SYMS}" MK_SHARED_LIB=`echo "$MK_SHARED_LIB" | sed -e "s%-dy%\\[$]{VERSIONED_SYMS} -dy%"` CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB) + LIB_CREATE="[$]MK_SHARED_LIB" ;; (*) AC_MSG_WARN(this system does not support versioned-symbols) @@ -9978,16 +10247,18 @@ EOF # compile source, make library - if make -f conftest.mk 2>&AC_FD_CC >/dev/null + if make -f conftest.mk 2>&AS_MESSAGE_LOG_FD >/dev/null then # test for missing symbol in either Data or Text section - cf_missing="`nm -P conftest.so 2>&AC_FD_CC |${FGREP-fgrep} _ismissing | ${EGREP-egrep} '[[ ]][[DT]][[ ]]'`" + cf_missing="`nm -P conftest.so 2>&AS_MESSAGE_LOG_FD |${FGREP-fgrep} _ismissing | ${EGREP-egrep} '[[ ]][[DT]][[ ]]'`" test -n "$cf_missing" && WILDCARD_SYMS=yes fi AC_MSG_RESULT($WILDCARD_SYMS) rm -f conftest.* fi fi + +fi AC_SUBST(RESULTING_SYMS) AC_SUBST(VERSIONED_SYMS) AC_SUBST(WILDCARD_SYMS) @@ -10079,7 +10350,59 @@ AC_SUBST(no_x11_rgb) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_SOURCE version: 67 updated: 2023/09/06 18:55:27 +dnl CF_WITH_XTERM_KBS version: 3 updated: 2025/10/21 03:55:54 +dnl ----------------- +dnl Configure-option with platform-defaults for the "xterm+kbs" building block +dnl in the terminfo file. +dnl +dnl The terminfo "kbs" value corresponds to "stty erase", and is conventionally +dnl assigned to the key which has +dnl +dnl a "Backspace" label and/or +dnl a backarrow symbol. +dnl +dnl See XTerm FAQ "Why doesn't my delete key work?" +dnl https://invisible-island.net/xterm/xterm.faq.html#xterm_erase +AC_DEFUN([CF_WITH_XTERM_KBS],[ +case $host_os in +(linux*gnu*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin|msys|mingw*|linux*uclibc|linux*musl|openbsd*|darwin*) + want_xterm_kbs=DEL + ;; +(*) + want_xterm_kbs=BS + ;; +esac + +AC_MSG_CHECKING(if xterm backspace-key sends BS or DEL) +AC_ARG_WITH(xterm-kbs, + [[ --with-xterm-kbs[=XXX] specify if xterm backspace-key sends BS or DEL]], + [with_xterm_kbs=$withval], + [with_xterm_kbs=auto]) +case x$with_xterm_kbs in +(xyes|xno|xBS|xbs|x8) + with_xterm_kbs=BS + ;; +(xDEL|xdel|x127) + with_xterm_kbs=DEL + ;; +(xauto) + with_xterm_kbs=$want_xterm_kbs + ;; +(*) + with_xterm_kbs=$withval + ;; +esac +AC_MSG_RESULT($with_xterm_kbs) +XTERM_KBS=$with_xterm_kbs +AC_SUBST(XTERM_KBS) + +if test "x$with_xterm_kbs" != "x$want_xterm_kbs" +then + AC_MSG_WARN([expected --with-xterm-kbs=$want_xterm_kbs for $host_os, have $with_xterm_kbs]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_XOPEN_SOURCE version: 71 updated: 2025/12/14 17:40:20 dnl --------------- dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, dnl or adapt to the vendor's definitions to get equivalent functionality, @@ -10139,9 +10462,12 @@ cf_xopen_source="-D_SGI_SOURCE" cf_XOPEN_SOURCE= ;; -(linux*gnu|linux*gnuabi64|linux*gnuabin32|linux*gnueabi|linux*gnueabihf|linux*gnux32|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin|msys|mingw*|linux*uclibc) +(linux*gnu*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin|msys|mingw*|linux*uclibc) CF_GNU_SOURCE($cf_XOPEN_SOURCE) ;; +linux*musl) + cf_xopen_source="-D_BSD_SOURCE" + ;; (minix*) cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... ;; @@ -10193,7 +10519,7 @@ # Some of these niche implementations use copy/paste, double-check... if test "$cf_cv_xopen_source" = no ; then CF_VERBOSE(checking if _POSIX_C_SOURCE interferes with _XOPEN_SOURCE) - AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY,,[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY)],,[ AC_MSG_WARN(_POSIX_C_SOURCE definition is not usable) CPPFLAGS="$cf_save_xopen_cppflags"]) fi @@ -10209,19 +10535,19 @@ dnl _XOPEN_SOURCE would yield. if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) - AC_TRY_COMPILE([#include ],[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],[ #ifndef _XOPEN_SOURCE #error _XOPEN_SOURCE is not defined -#endif], +#endif])], [cf_XOPEN_SOURCE_set=yes], [cf_XOPEN_SOURCE_set=no]) AC_MSG_RESULT($cf_XOPEN_SOURCE_set) if test "$cf_XOPEN_SOURCE_set" = yes then - AC_TRY_COMPILE([#include ],[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],[ #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE #error (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE -#endif], +#endif])], [cf_XOPEN_SOURCE_set_ok=yes], [cf_XOPEN_SOURCE_set_ok=no]) if test "$cf_XOPEN_SOURCE_set_ok" = no diff --git a/contrib/ncurses/announce.html.in b/contrib/ncurses/announce.html.in --- a/contrib/ncurses/announce.html.in +++ b/contrib/ncurses/announce.html.in @@ -1,7 +1,7 @@ - - - - - A Hacker's Guide to Ncurses Internals - - - - -

A Hacker's Guide to NCURSES

- -

A Hacker's Guide to NCURSES

- - - -

Abstract

- -

This document is a hacker's tour of the - ncurses library and utilities. It discusses - design philosophy, implementation methods, and the conventions - used for coding and documentation. It is recommended reading for - anyone who is interested in porting, extending or improving the - package.

- -

Objective of the - Package

- -

The objective of the ncurses package is to - provide a free software API for character-cell terminals and - terminal emulators with the following characteristics:

- -
    -
  • Source-compatible with historical curses implementations - (including the original BSD curses and System V curses.
  • - -
  • Conformant with the XSI Curses standard issued as part of - XPG4 by X/Open.
  • - -
  • High-quality — stable and reliable code, wide - portability, good packaging, superior documentation.
  • - -
  • Featureful — should eliminate as much of the drudgery - of C interface programming as possible, freeing programmers to - think at a higher level of design.
  • -
- -

These objectives are in priority order. So, for example, - source compatibility with older version must trump featurefulness - — we cannot add features if it means breaking the portion - of the API corresponding to historical curses versions.

- -

Why System V Curses?

- -

We used System V curses as a model, reverse-engineering their - API, in order to fulfill the first two objectives.

- -

System V curses implementations can support BSD curses - programs with just a recompilation, so by capturing the System V - API we also capture BSD's.

- -

More importantly for the future, the XSI Curses standard - issued by X/Open is explicitly and closely modeled on System V. - So conformance with System V took us most of the way to - base-level XSI conformance.

- -

How to Design - Extensions

- -

The third objective (standards conformance) requires that it - be easy to condition source code using ncurses - so that the absence of nonstandard extensions does not break the - code.

- -

Accordingly, we have a policy of associating with each - nonstandard extension a feature macro, so that ncurses client - code can use this macro to condition in or out the code that - requires the ncurses extension.

- -

For example, there is a macro - NCURSES_MOUSE_VERSION which XSI Curses does not - define, but which is defined in the ncurses - library header. You can use this to condition the calls to the - mouse API calls.

- -

Portability and - Configuration

- -

Code written for ncurses may assume an - ANSI-standard C compiler and POSIX-compatible OS interface. It - may also assume the presence of a System-V-compatible - select(2) call.

- -

We encourage (but do not require) developers to make the code - friendly to less-capable UNIX environments wherever possible.

- -

We encourage developers to support OS-specific optimizations - and methods not available under POSIX/ANSI, provided only - that:

- -
    -
  • All such code is properly conditioned so the build process - does not attempt to compile it under a plain ANSI/POSIX - environment.
  • - -
  • Adding such implementation methods does not introduce - incompatibilities in the ncurses API between - platforms.
  • -
- -

We use GNU autoconf(1) as a tool to deal with - portability issues. The right way to leverage an OS-specific - feature is to modify the autoconf specification files - (configure.in and aclocal.m4) to set up a new feature macro, - which you then use to condition your code.

- -

Documentation - Conventions

- -

There are three kinds of documentation associated with this - package. Each has a different preferred format:

- -
    -
  • Package-internal files (README, INSTALL, TO-DO etc.)
  • - -
  • Manual pages.
  • - -
  • Everything else (i.e., narrative documentation).
  • -
- -

Our conventions are simple:

- -
    -
  1. Maintain package-internal files in plain - text. The expected viewer for them is more(1) or - an editor window; there is no point in elaborate mark-up.
  2. - -
  3. Mark up manual pages in the man macros. - These have to be viewable through traditional man(1) - programs.
  4. - -
  5. Write everything else in HTML. -
  6. -
- -

When in doubt, HTMLize a master and use lynx(1) to - generate plain ASCII (as we do for the announcement - document).

- -

The reason for choosing HTML is that it is (a) well-adapted - for on-line browsing through viewers that are everywhere; (b) - more easily readable as plain text than most other mark-ups, if - you do not have a viewer; and (c) carries enough information that - you can generate a nice-looking printed version from it. Also, of - course, it make exporting things like the announcement document - to WWW pretty trivial.

- -

How to Report Bugs

- -

The reporting address for - bugs is bug-ncurses@gnu.org. This is a - majordomo list; to join, write to - bug-ncurses-request@gnu.org with a message - containing the line:

- -
-             subscribe <name>@<host.domain>
-
-

The ncurses code is maintained by a small group - of volunteers. While we try our best to fix bugs promptly, we - simply do not have a lot of hours to spend on elementary - hand-holding. We rely on intelligent cooperation from our users. - If you think you have found a bug in ncurses, there - are some steps you can take before contacting us that will help - get the bug fixed quickly.

- -

In order to use our bug-fixing time efficiently, we put people - who show us they have taken these steps at the head of our queue. - This means that if you do not, you will probably end up at the - tail end and have to wait a while.

- -
    -
  1. Develop a recipe to reproduce the bug. -

    Bugs we can reproduce are likely to be fixed very quickly, - often within days. The most effective single thing you can do - to get a quick fix is develop a way we can duplicate the bad - behavior — ideally, by giving us source for a small, - portable test program that breaks the library. (Even better - is a keystroke recipe using one of the test programs provided - with the distribution.)

    -
  2. - -
  3. Try to reproduce the bug on a different terminal type. -

    In our experience, most of the behaviors people report as - library bugs are actually due to subtle problems in terminal - descriptions. This is especially likely to be true if you are - using a traditional asynchronous terminal or PC-based - terminal emulator, rather than xterm or a UNIX console - entry.

    - -

    It is therefore extremely helpful if you can tell us - whether or not your problem reproduces on other terminal - types. Usually you will have both a console type and xterm - available; please tell us whether or not your bug reproduces - on both.

    - -

    If you have xterm available, it is also good to collect - xterm reports for different window sizes. This is especially - true if you normally use an unusual xterm window size — - a surprising number of the bugs we have seen are either - triggered or masked by these.

    -
  4. - -
  5. Generate and examine a trace file for the broken behavior. -

    Recompile your program with the debugging versions of the - libraries. Insert a trace() call with the - argument set to TRACE_UPDATE. (See "Writing Programs with - NCURSES" for details on trace levels.) Reproduce your - bug, then look at the trace file to see what the library was - actually doing.

    - -

    Another frequent cause of apparent bugs is application - coding errors that cause the wrong things to be put on the - virtual screen. Looking at the virtual-screen dumps in the - trace file will tell you immediately if this is happening, - and save you from the possible embarrassment of being told - that the bug is in your code and is your problem rather than - ours.

    - -

    If the virtual-screen dumps look correct but the bug - persists, it is possible to crank up the trace level to give - more and more information about the library's update actions - and the control sequences it issues to perform them. The test - directory of the distribution contains a tool for digesting - these logs to make them less tedious to wade through.

    - -

    Often you will find terminfo problems at this stage by - noticing that the escape sequences put out for various - capabilities are wrong. If not, you are likely to learn - enough to be able to characterize any bug in the - screen-update logic quite exactly.

    -
  6. - -
  7. Report details and symptoms, not just interpretations. -

    If you do the preceding two steps, it is very likely that - you will discover the nature of the problem yourself and be - able to send us a fix. This will create happy feelings all - around and earn you good karma for the first time you run - into a bug you really cannot characterize and fix - yourself.

    - -

    If you are still stuck, at least you will know what to - tell us. Remember, we need details. If you guess about what - is safe to leave out, you are too likely to be wrong.

    - -

    If your bug produces a bad update, include a trace file. - Try to make the trace at the least voluminous level - that pins down the bug. Logs that have been through - tracemunch are OK, it does not throw away any information - (actually they are better than un-munched ones because they - are easier to read).

    - -

    If your bug produces a core-dump, please include a - symbolic stack trace generated by gdb(1) or your local - equivalent.

    - -

    Tell us about every terminal on which you have reproduced - the bug — and every terminal on which you cannot. - Ideally, send us terminfo sources for all of these (yours - might differ from ours).

    - -

    Include your ncurses version and your OS/machine type, of - course! You can find your ncurses version in the - curses.h file.

    -
  8. -
- -

If your problem smells like a logic error or in cursor - movement or scrolling or a bad capability, there are a couple of - tiny test frames for the library algorithms in the progs - directory that may help you isolate it. These are not part of the - normal build, but do have their own make productions.

- -

The most important of these is mvcur, a test - frame for the cursor-movement optimization code. With this - program, you can see directly what control sequences will be - emitted for any given cursor movement or scroll/insert/delete - operations. If you think you have got a bad capability - identified, you can disable it and test again. The program is - command-driven and has on-line help.

- -

If you think the vertical-scroll optimization is broken, or - just want to understand how it works better, build - hashmap and read the header comments of - hardscroll.c and hashmap.c; then try it - out. You can also test the hardware-scrolling optimization - separately with hardscroll.

- -

A Tour of the Ncurses - Library

- -

Library Overview

- -

Most of the library is superstructure — fairly trivial - convenience interfaces to a small set of basic functions and data - structures used to manipulate the virtual screen (in particular, - none of this code does any I/O except through calls to more - fundamental modules described below). The files

- -
- lib_addch.c lib_bkgd.c lib_box.c lib_chgat.c lib_clear.c - lib_clearok.c lib_clrbot.c lib_clreol.c lib_colorset.c - lib_data.c lib_delch.c lib_delwin.c lib_echo.c lib_erase.c - lib_gen.c lib_getstr.c lib_hline.c lib_immedok.c lib_inchstr.c - lib_insch.c lib_insdel.c lib_insstr.c lib_instr.c - lib_isendwin.c lib_keyname.c lib_leaveok.c lib_move.c - lib_mvwin.c lib_overlay.c lib_pad.c lib_printw.c lib_redrawln.c - lib_scanw.c lib_screen.c lib_scroll.c lib_scrollok.c - lib_scrreg.c lib_set_term.c lib_slk.c lib_slkatr_set.c - lib_slkatrof.c lib_slkatron.c lib_slkatrset.c lib_slkattr.c - lib_slkclear.c lib_slkcolor.c lib_slkinit.c lib_slklab.c - lib_slkrefr.c lib_slkset.c lib_slktouch.c lib_touch.c - lib_unctrl.c lib_vline.c lib_wattroff.c lib_wattron.c - lib_window.c -
- -

are all in this category. They are very unlikely to need - change, barring bugs or some fundamental reorganization in the - underlying data structures.

- -

These files are used only for debugging support:

- -
- lib_trace.c lib_traceatr.c lib_tracebits.c lib_tracechr.c - lib_tracedmp.c lib_tracemse.c trace_buf.c -
- -

It is rather unlikely you will ever need to change these, - unless you want to introduce a new debug trace level for some - reason.

- -

There is another group of files that do direct I/O via - tputs(), computations on the terminal capabilities, or - queries to the OS environment, but nevertheless have only fairly - low complexity. These include:

- -
- lib_acs.c lib_beep.c lib_color.c lib_endwin.c - lib_initscr.c lib_longname.c lib_newterm.c lib_options.c - lib_termcap.c lib_ti.c lib_tparm.c lib_tputs.c lib_vidattr.c - read_entry.c. -
- -

They are likely to need revision only if ncurses is being - ported to an environment without an underlying terminfo - capability representation.

- -

These files have serious hooks into the tty driver and signal - facilities:

- -
- lib_kernel.c lib_baudrate.c lib_raw.c lib_tstp.c - lib_twait.c -
- -

If you run into porting snafus moving the package to another - UNIX, the problem is likely to be in one of these files. The file - lib_print.c uses sleep(2) and also falls in this - category.

- -

Almost all of the real work is done in the files

- -
- hardscroll.c hashmap.c lib_addch.c lib_doupdate.c - lib_getch.c lib_mouse.c lib_mvcur.c lib_refresh.c lib_setup.c - lib_vidattr.c -
- -

Most of the algorithmic complexity in the library lives in - these files. If there is a real bug in ncurses - itself, it is probably here. We will tour some of these files in - detail below (see The Engine Room).

- -

Finally, there is a group of files that is actually most of - the terminfo compiler. The reason this code lives in the - ncurses library is to support fallback to - /etc/termcap. These files include

- -
- alloc_entry.c captoinfo.c comp_captab.c comp_error.c - comp_hash.c comp_parse.c comp_scan.c parse_entry.c - read_termcap.c write_entry.c -
- -

We will discuss these in the compiler tour.

- -

The Engine Room

- -

Keyboard Input

- -

All ncurses input funnels through the function - wgetch(), defined in lib_getch.c. This - function is tricky; it has to poll for keyboard and mouse events - and do a running match of incoming input against the set of - defined special keys.

- -

The central data structure in this module is a FIFO queue, - used to match multiple-character input sequences against - special-key capabilities; also to implement pushback via - ungetch().

- -

The wgetch() code distinguishes between function - key sequences and the same sequences typed manually by doing a - timed wait after each input character that could lead a function - key sequence. If the entire sequence takes less than 1 second, it - is assumed to have been generated by a function key press.

- -

Hackers bruised by previous encounters with variant - select(2) calls may find the code in - lib_twait.c interesting. It deals with the problem - that some BSD selects do not return a reliable time-left value. - The function timed_wait() effectively simulates a - System V select.

- -

Mouse Events

- -

If the mouse interface is active, wgetch() polls - for mouse events each call, before it goes to the keyboard for - input. It is up to lib_mouse.c how the polling is - accomplished; it may vary for different devices.

- -

Under xterm, however, mouse event notifications come in via - the keyboard input stream. They are recognized by having the - kmous capability as a prefix. This is kind of - klugey, but trying to wire in recognition of a mouse key prefix - without going through the function-key machinery would be just - too painful, and this turns out to imply having the prefix - somewhere in the function-key capabilities at terminal-type - initialization.

- -

This kluge only works because kmous is not - actually used by any historic terminal type or curses - implementation we know of. Best guess is it is a relic of some - forgotten experiment in-house at Bell Labs that did not leave any - traces in the publicly-distributed System V terminfo files. If - System V or XPG4 ever gets serious about using it again, this - kluge may have to change.

- -

Here are some more details about mouse event handling:

- -

The lib_mouse() code is logically split into a - lower level that accepts event reports in a device-dependent - format and an upper level that parses mouse gestures and filters - events. The mediating data structure is a circular queue of event - structures.

- -

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 events) into a gesture (a high-level or - composite event).

- -

Output and Screen Updating

- -

With the single exception of character echoes during a - wgetnstr() call (which simulates cooked-mode line - editing in an ncurses window), the library normally does all its - output at refresh time.

- -

The main job is to go from the current state of the screen (as - represented in the curscr window structure) to the - desired new state (as represented in the newscr - window structure), while doing as little I/O as possible.

- -

The brains of this operation are the modules - hashmap.c, hardscroll.c and - lib_doupdate.c; the latter two use - lib_mvcur.c. Essentially, what happens looks like - this:

- -
    -
  • -

    The hashmap.c module tries to detect vertical - motion changes between the real and virtual screens. This - information is represented by the oldindex members in the - newscr structure. These are modified by vertical-motion and - clear operations, and both are re-initialized after each - update. To this change-journalling information, the hashmap - code adds deductions made using a modified Heckel algorithm - on hash values generated from the line contents.

    -
  • - -
  • -

    The hardscroll.c module computes an optimum - set of scroll, insertion, and deletion operations to make the - indices match. It calls _nc_mvcur_scrolln() in - lib_mvcur.c to do those motions.

    -
  • - -
  • -

    Then lib_doupdate.c goes to work. Its job is - to do line-by-line transformations of curscr - lines to newscr lines. Its main tool is the - routine mvcur() in lib_mvcur.c. - This routine does cursor-movement optimization, attempting to - get from given screen location A to given location B in the - fewest output characters possible.

    -
  • -
- -

If you want to work on screen optimizations, you should use - the fact that (in the trace-enabled version of the library) - enabling the TRACE_TIMES trace level causes a report - to be emitted after each screen update giving the elapsed time - and a count of characters emitted during the update. You can use - this to tell when an update optimization improves efficiency.

- -

In the trace-enabled version of the library, it is also - possible to disable and re-enable various optimizations at - runtime by tweaking the variable - _nc_optimize_enable. See the file - include/curses.h.in for mask values, near the - end.

- -

The Forms and Menu Libraries

- -

The forms and menu libraries should work reliably in any - environment you can port ncurses to. The only portability issue - anywhere in them is what flavor of regular expressions the - built-in form field type TYPE_REGEXP will recognize.

- -

The configuration code prefers the POSIX regex facility, - modeled on System V's, but will settle for BSD regexps if the - former is not available.

- -

Historical note: the panels code was written primarily to - assist in porting u386mon 2.0 (comp.sources.misc v14i001-4) to - systems lacking panels support; u386mon 2.10 and beyond use it. - This version has been slightly cleaned up for - ncurses.

- -

A Tour of the Terminfo Compiler

- -

The ncurses implementation of - tic is rather complex internally; it has to do a - trying combination of missions. This starts with the fact that, - in addition to its normal duty of compiling terminfo sources into - loadable terminfo binaries, it has to be able to handle termcap - syntax and compile that too into terminfo entries.

- -

The implementation therefore starts with a table-driven, - dual-mode lexical analyzer (in comp_scan.c). The - lexer chooses its mode (termcap or terminfo) based on the first - “,” or “:” it finds in each entry. The - lexer does all the work of recognizing capability names and - values; the grammar above it is trivial, just "parse entries till - you run out of file".

- -

Translation of - Non-use Capabilities

- -

Translation of most things besides use - capabilities is pretty straightforward. The lexical analyzer's - tokenizer hands each capability name to a hash function, which - drives a table lookup. The table entry yields an index which is - used to look up the token type in another table, and controls - interpretation of the value.

- -

One possibly interesting aspect of the implementation is the - way the compiler tables are initialized. All the tables are - generated by various awk/sed/sh scripts from a master table - include/Caps; these scripts actually write C - initializers which are linked to the compiler. Furthermore, the - hash table is generated in the same way, so it doesn't have to be - generated at compiler startup time (another benefit of this - organization is that the hash table can be in shareable text - space).

- -

Thus, adding a new capability is usually pretty trivial, just - a matter of adding one line to the include/Caps - file. We will have more to say about this in the section on - Source-Form Translation.

- -

Use Capability Resolution

- -

The background problem that makes tic tricky - is not the capability translation itself, it is the resolution of - use capabilities. Older versions would not - handle forward use references for this reason - (that is, a using terminal always had to follow its use target in - the source file). By doing this, they got away with a simple - implementation tactic; compile everything as it blows by, then - resolve uses from compiled entries.

- -

This will not do for ncurses. The problem is - that that the whole compilation process has to be embeddable in - the ncurses library so that it can be called by - the startup code to translate termcap entries on the fly. The - embedded version cannot go promiscuously writing everything it - translates out to disk — for one thing, it will typically - be running with non-root permissions.

- -

So our tic is designed to parse an entire - terminfo file into a doubly-linked circular list of entry - structures in-core, and then do use resolution - in-memory before writing everything out. This design has other - advantages: it makes forward and back use-references equally easy - (so we get the latter for free), and it makes checking for name - collisions before they are written out easy to do.

- -

And this is exactly how the embedded version works. But the - stand-alone user-accessible version of tic - partly reverts to the historical strategy; it writes to disk (not - keeping in core) any entry with no use - references.

- -

This is strictly a core-economy kluge, implemented because the - terminfo master file is large enough that some core-poor systems - swap like crazy when you compile it all in memory...there have - been reports of this process taking three hours, - rather than the twenty seconds or less typical on the author's - development box.

- -

So. The executable tic passes the - entry-parser a hook that immediately writes out the - referenced entry if it has no use capabilities. The compiler main - loop refrains from adding the entry to the in-core list when this - hook fires. If some other entry later needs to reference an entry - that got written immediately, that is OK; the resolution code - will fetch it off disk when it cannot find it in core.

- -

Name collisions will still be detected, just not as cleanly. - The write_entry() code complains before overwriting - an entry that postdates the time of tic's first - call to write_entry(), Thus it will complain about - overwriting entries newly made during the tic - run, but not about overwriting ones that predate it.

- -

Source-Form - Translation

- -

Another use of tic is to do source - translation between various termcap and terminfo formats. There - are more variants out there than you might think; the ones we - know about are described in the captoinfo(1) - manual page.

- -

The translation output code (dump_entry() in - ncurses/dump_entry.c) is shared with the - infocmp(1) utility. It takes the same internal - representation used to generate the binary form and dumps it to - standard output in a specified format.

- -

The include/Caps file has a header comment - describing ways you can specify source translations for - nonstandard capabilities just by altering the master table. It is - possible to set up capability aliasing or tell the compiler to - plain ignore a given capability without writing any C code at - all.

- -

For circumstances where you need to do algorithmic - translation, there are functions in parse_entry.c - called after the parse of each entry that are specifically - intended to encapsulate such translations. This, for example, is - where the AIX box1 capability get translated to - an acsc string.

- -

Other Utilities

- -

The infocmp utility is just a wrapper around - the same entry-dumping code used by tic for - source translation. Perhaps the one interesting aspect of the - code is the use of a predicate function passed in to - dump_entry() to control which capabilities are - dumped. This is necessary in order to handle both the ordinary - De-compilation case and entry difference reporting.

- -

The tput and clear utilities - just do an entry load followed by a tputs() of a - selected capability.

- -

Style Tips for Developers

- -

See the TO-DO file in the top-level directory of the source - distribution for additions that would be particularly useful.

- -

The prefix _nc_ should be used on library public - functions that are not part of the curses API in order to prevent - pollution of the application namespace. If you have to add to or - modify the function prototypes in curses.h.in, read - ncurses/MKlib_gen.sh first so you can avoid breaking XSI - conformance. Please join the ncurses mailing list. See the - INSTALL file in the top level of the distribution for details on - the list.

- -

Look for the string FIXME in source files to tag - minor bugs and potential problems that could use fixing.

- -

Do not try to auto-detect OS features in the main body of the - C code. That is the job of the configuration system.

- -

To hold down complexity, do make your code data-driven. - Especially, if you can drive logic from a table filtered out of - include/Caps, do it. If you find you need to augment - the data in that file in order to generate the proper table, that - is still preferable to ad-hoc code — that is why the fifth - field (flags) is there.

- -

Have fun!

- -

Porting Hints

- -

The following notes are intended to be a first step towards - DOS and Macintosh ports of the ncurses libraries.

- -

The following library modules are “pure curses”; - they operate only on the curses internal structures, do all - output through other curses calls (not including - tputs() and putp()) and do not call any - other UNIX routines such as signal(2) or the stdio library. Thus, - they should not need to be modified for single-terminal - ports.

- -
- lib_addch.c lib_addstr.c lib_bkgd.c lib_box.c lib_clear.c - lib_clrbot.c lib_clreol.c lib_delch.c lib_delwin.c lib_erase.c - lib_inchstr.c lib_insch.c lib_insdel.c lib_insstr.c - lib_keyname.c lib_move.c lib_mvwin.c lib_newwin.c lib_overlay.c - lib_pad.c lib_printw.c lib_refresh.c lib_scanw.c lib_scroll.c - lib_scrreg.c lib_set_term.c lib_touch.c lib_tparm.c lib_tputs.c - lib_unctrl.c lib_window.c panel.c -
- -

This module is pure curses, but calls outstr():

- -
- lib_getstr.c -
- -

These modules are pure curses, except that they use - tputs() and putp():

- -
- lib_beep.c lib_color.c lib_endwin.c lib_options.c - lib_slk.c lib_vidattr.c -
- -

This modules assist in POSIX emulation on non-POSIX - systems:

- -
-
sigaction.c
- -
signal calls
-
- -

The following source files will not be needed for a - single-terminal-type port.

- -
- alloc_entry.c captoinfo.c clear.c comp_captab.c - comp_error.c comp_hash.c comp_main.c comp_parse.c comp_scan.c - dump_entry.c infocmp.c parse_entry.c read_entry.c tput.c - write_entry.c -
- -

The following modules will use - open()/read()/write()/close()/lseek() on files, but no other OS - calls.

- -
-
lib_screen.c
- -
used to read/write screen dumps
- -
lib_trace.c
- -
used to write trace data to the logfile
-
- -

Modules that would have to be modified for a port start - here:

- -

The following modules are “pure curses” but - contain assumptions inappropriate for a memory-mapped port.

- -
-
lib_longname.c
- -
assumes there may be multiple terminals
- -
lib_acs.c
- -
assumes acs_map as a double indirection
- -
lib_mvcur.c
- -
assumes cursor moves have variable cost
- -
lib_termcap.c
- -
assumes there may be multiple terminals
- -
lib_ti.c
- -
assumes there may be multiple terminals
-
- -

The following modules use UNIX-specific calls:

- -
-
lib_doupdate.c
- -
input checking
- -
lib_getch.c
- -
read()
- -
lib_initscr.c
- -
getenv()
- -
lib_newterm.c
- -
lib_baudrate.c
- -
lib_kernel.c
- -
various tty-manipulation and system calls
- -
lib_raw.c
- -
various tty-manipulation calls
- -
lib_setup.c
- -
various tty-manipulation calls
- -
lib_restart.c
- -
various tty-manipulation calls
- -
lib_tstp.c
- -
signal-manipulation calls
- -
lib_twait.c
- -
gettimeofday(), select().
-
- -
- -
- Eric S. Raymond <esr@snark.thyrsus.com> -
- (Note: This is not the bug - address!) - - diff --git a/contrib/ncurses/doc/html/ncurses-intro.html b/contrib/ncurses/doc/html/ncurses-intro.html deleted file mode 100644 --- a/contrib/ncurses/doc/html/ncurses-intro.html +++ /dev/null @@ -1,3390 +0,0 @@ - - - - - - Writing Programs with NCURSES - - - - -

Writing Programs with NCURSES

- -

Writing Programs with NCURSES

- -
- by Eric S. Raymond and Zeyd M. Ben-Halim
- updates since release 1.9.9e by Thomas Dickey -
- - - -
- -

Introduction

- -

This document is an introduction to programming with - curses. It is not an exhaustive reference for the - curses Application Programming Interface (API); that role is - filled by the curses manual pages. Rather, it is - intended to help C programmers ease into using the package.

- -

This document is aimed at C applications programmers not yet - specifically familiar with ncurses. If you are already an - experienced curses programmer, you should - nevertheless read the sections on Mouse - Interfacing, Debugging, Compatibility with Older Versions, and Hints, Tips, and Tricks. These will bring you up to - speed on the special features and quirks of the - ncurses implementation. If you are not so - experienced, keep reading.

- -

The curses package is a subroutine library for - terminal-independent screen-painting and input-event handling - which presents a high level screen model to the programmer, - hiding differences between terminal types and doing automatic - optimization of output to change one screen full of text into - another. Curses uses terminfo, which is a database - format that can describe the capabilities of thousands of - different terminals.

- -

The curses API may seem something of an archaism - on UNIX desktops increasingly dominated by X, Motif, and Tcl/Tk. - Nevertheless, UNIX still supports tty lines and X supports - xterm(1); the curses API has the advantage - of (a) back-portability to character-cell terminals, and (b) - simplicity. For an application that does not require bit-mapped - graphics and multiple fonts, an interface implementation using - curses will typically be a great deal simpler and - less expensive than one using an X toolkit.

- -

A Brief History of Curses

- -

Historically, the first ancestor of curses was - the routines written to provide screen-handling for the - vi editor; these used the termcap - database facility (both released in 3BSD) for describing terminal - capabilities. These routines were abstracted into a documented - library and first released with the early BSD UNIX versions. All - of this work was done by students at the University of California - (Berkeley campus). The curses library was first published in - 4.0BSD, a year after 3BSD (i.e., late 1980).

- -

After graduation, one of those students went to work at - AT&T Bell Labs, and made an improved termcap - library called terminfo (i.e., - “libterm”), and adapted the curses library to use - this. That was subsequently released in System V Release 2 (early - 1984). Thereafter, other developers added to the curses and - terminfo libraries. For instance, a student at Cornell University - wrote an improved terminfo library as well as a tool - (tic) to compile the terminal descriptions. As a - general rule, AT&T did not identify the developers in the - source-code or documentation; the tic and - infocmp programs are the exceptions.

- -

System V Release 3 (System III UNIX) from Bell Labs featured a - rewritten and much-improved curses library, along - with the tic program (late 1986).

- -

To recap, terminfo is based on Berkeley's termcap database, - but contains a number of improvements and extensions. - Parameterized capabilities strings were introduced, making it - possible to describe multiple video attributes, and colors and to - handle far more unusual terminals than possible with termcap. In - the later AT&T System V releases, curses evolved - to use more facilities and offer more capabilities, going far - beyond BSD curses in power and flexibility.

- -

Scope of This Document

- -

This document describes ncurses, a free - implementation of the System V curses API with some - clearly marked extensions. It includes the following System V - curses features:

- -
    -
  • Support for multiple screen highlights (BSD curses could - only handle one “standout” highlight, usually - reverse-video).
  • - -
  • Support for line- and box-drawing using forms - characters.
  • - -
  • Recognition of function keys on input.
  • - -
  • Color support.
  • - -
  • Support for pads (windows of larger than screen size on - which the screen or a subwindow defines a viewport).
  • -
- -

Also, this package makes use of the insert and delete line and - character features of terminals so equipped, and determines how - to optimally use these features with no help from the programmer. - It allows arbitrary combinations of video attributes to be - displayed, even on terminals that leave “magic - cookies” on the screen to mark changes in attributes.

- -

The ncurses package can also capture and use - event reports from a mouse in some environments (notably, xterm - under the X window system). This document includes tips for using - the mouse.

- -

The ncurses package was originated by Pavel - Curtis. The original maintainer of this package is Zeyd Ben-Halim - <zmbenhal@netcom.com>. Eric S. Raymond - <esr@snark.thyrsus.com> wrote many of the new features in - versions after 1.8.1 and wrote most of this introduction. - Jürgen Pfeifer wrote all of the menu and forms code as well - as the Ada95 binding. - Ongoing work is being done by Thomas Dickey - (maintainer). Contact the current maintainers at bug-ncurses@gnu.org.

- -

This document also describes the panels - extension library, similarly modeled on the SVr4 panels facility. - This library allows you to associate backing store with each of a - stack or deck of overlapping windows, and provides operations for - moving windows around in the stack that change their visibility - in the natural way (handling window overlaps).

- -

Finally, this document describes in detail the menus and forms extension - libraries, also cloned from System V, which support easy - construction and sequences of menus and fill-in forms.

- -

Terminology

- -

In this document, the following terminology is used with - reasonable consistency:

- -
-
window
- -
A data structure describing a sub-rectangle of the screen - (possibly the entire screen). You can write to a window as - though it were a miniature screen, scrolling independently of - other windows on the physical screen.
- -
screens
- -
A subset of windows which are as large as the terminal - screen, i.e., they start at the upper left hand corner and - encompass the lower right hand corner. One of these, - stdscr, is automatically provided for the - programmer.
- -
terminal screen
- -
The package's idea of what the terminal display currently - looks like, i.e., what the user sees now. This is a special - screen.
-
- -

The Curses Library

- -

An Overview of Curses

- -

Compiling Programs using - Curses

- -

In order to use the library, it is necessary to have certain - types and variables defined. Therefore, the programmer must have - a line:

- -
-          #include <curses.h>
-
-

at the top of the program source. The screen package uses the - Standard I/O library, so <curses.h> includes - <stdio.h>. <curses.h> also - includes <termios.h>, - <termio.h>, or <sgtty.h> - depending on your system. It is redundant (but harmless) for the - programmer to do these includes, too. In linking with - curses you need to have -lncurses in - your LDFLAGS or on the command line. There is no need for any - other libraries.

- -

Updating the Screen

- -

In order to update the screen optimally, it is necessary for - the routines to know what the screen currently looks like and - what the programmer wants it to look like next. For this purpose, - a data type (structure) named WINDOW is defined which describes a - window image to the routines, including its starting position on - the screen (the (y, x) coordinates of the upper left hand corner) - and its size. One of these (called curscr, for - current screen) is a screen image of what the terminal currently - looks like. Another screen (called stdscr, for - standard screen) is provided by default to make changes on.

- -

A window is a purely internal representation. It is used to - build and store a potential image of a portion of the terminal. - It does not bear any necessary relation to what is really on the - terminal screen; it is more like a scratchpad or write - buffer.

- -

To make the section of physical screen corresponding to a - window reflect the contents of the window structure, the routine - refresh() (or wrefresh() if the window - is not stdscr) is called.

- -

A given physical screen section may be within the scope of any - number of overlapping windows. Also, changes can be made to - windows in any order, without regard to motion efficiency. Then, - at will, the programmer can effectively say “make it look - like this,” and let the package implementation determine - the most efficient way to repaint the screen.

- -

Standard Windows and Function - Naming Conventions

- -

As hinted above, the routines can use several windows, but two - are automatically given: curscr, which knows what - the terminal looks like, and stdscr, which is what - the programmer wants the terminal to look like next. The user - should never actually access curscr directly. - Changes should be made to through the API, and then the routine - refresh() (or wrefresh()) called.

- -

Many functions are defined to use stdscr as a - default screen. For example, to add a character to - stdscr, one calls addch() with the - desired character as argument. To write to a different window. - use the routine waddch() (for - window-specific addch()) is provided. This - convention of prepending function names with a “w” - when they are to be applied to specific windows is consistent. - The only routines which do not follow it are those for which a - window must always be specified.

- -

In order to move the current (y, x) coordinates from one point - to another, the routines move() and - wmove() are provided. However, it is often desirable - to first move and then perform some I/O operation. In order to - avoid clumsiness, most I/O routines can be preceded by the prefix - “mv” and the desired (y, x) coordinates prepended to - the arguments to the function. For example, the calls

- -
-          move(y, x);
-          addch(ch);
-
-

can be replaced by

- -
-          mvaddch(y, x, ch);
-
-

and

- -
-          wmove(win, y, x);
-          waddch(win, ch);
-
-

can be replaced by

- -
-          mvwaddch(win, y, x, ch);
-
-

Note that the window description pointer (win) comes before - the added (y, x) coordinates. If a function requires a window - pointer, it is always the first parameter passed.

- -

Variables

- -

The curses library sets some variables describing - the terminal capabilities.

- -
-      type   name      description
-      ------------------------------------------------------------------
-      int    LINES     number of lines on the terminal
-      int    COLS      number of columns on the terminal
-
-

The curses.h also introduces some - #define constants and types of general - usefulness:

- -
-
bool -
- -
boolean type, actually a “char” (e.g., - bool doneit;)
- -
TRUE -
- -
boolean “true” flag (1).
- -
FALSE -
- -
boolean “false” flag (0).
- -
ERR -
- -
error flag returned by routines on a failure (-1).
- -
OK -
- -
error flag returned by routines when things go right.
-
- -

Using the Library

- -

Now we describe how to actually use the screen package. In it, - we assume all updating, reading, etc. is applied to - stdscr. These instructions will work on any window, - providing you change the function names and parameters as - mentioned above.

- -

Here is a sample program to motivate the discussion:

- -
-#include <stdlib.h>
-#include <curses.h>
-#include <signal.h>
-
-static void finish(int sig);
-
-int
-main(int argc, char *argv[])
-{
-    int num = 0;
-
-    /* initialize your non-curses data structures here */
-
-    (void) signal(SIGINT, finish);      /* arrange interrupts to terminate */
-
-    (void) initscr();      /* initialize the curses library */
-    keypad(stdscr, TRUE);  /* enable keyboard mapping */
-    (void) nonl();         /* tell curses not to do NL->CR/NL on output */
-    (void) cbreak();       /* take input chars one at a time, no wait for \n */
-    (void) echo();         /* echo input - in color */
-
-    if (has_colors())
-    {
-        start_color();
-
-        /*
-         * Simple color assignment, often all we need.  Color pair 0 cannot
-         * be redefined.  This example uses the same value for the color
-         * pair as for the foreground color, though of course that is not
-         * necessary:
-         */
-        init_pair(1, COLOR_RED,     COLOR_BLACK);
-        init_pair(2, COLOR_GREEN,   COLOR_BLACK);
-        init_pair(3, COLOR_YELLOW,  COLOR_BLACK);
-        init_pair(4, COLOR_BLUE,    COLOR_BLACK);
-        init_pair(5, COLOR_CYAN,    COLOR_BLACK);
-        init_pair(6, COLOR_MAGENTA, COLOR_BLACK);
-        init_pair(7, COLOR_WHITE,   COLOR_BLACK);
-    }
-
-    for (;;)
-    {
-        int c = getch();     /* refresh, accept single keystroke of input */
-        attrset(COLOR_PAIR(num % 8));
-        num++;
-
-        /* process the command keystroke */
-    }
-
-    finish(0);               /* we are done */
-}
-
-static void finish(int sig)
-{
-    endwin();
-
-    /* do your non-curses wrapup here */
-
-    exit(0);
-}
-
-

Starting up

- -

In order to use the screen package, the routines must know - about terminal characteristics, and the space for - curscr and stdscr must be allocated. - These function initscr() does both these things. - Since it must allocate space for the windows, it can overflow - memory when attempting to do so. On the rare occasions this - happens, initscr() will terminate the program with - an error message. initscr() must always be called - before any of the routines which affect windows are used. If it - is not, the program will core dump as soon as either - curscr or stdscr are referenced. - However, it is usually best to wait to call it until after you - are sure you will need it, like after checking for startup - errors. Terminal status changing routines like nl() - and cbreak() should be called after - initscr().

- -

Once the screen windows have been allocated, you can set them - up for your program. If you want to, say, allow a screen to - scroll, use scrollok(). If you want the cursor to be - left in place after the last change, use leaveok(). - If this is not done, refresh() will move the cursor - to the window's current (y, x) coordinates after updating it.

- -

You can create new windows of your own using the functions - newwin(), derwin(), and - subwin(). The routine delwin() will - allow you to get rid of old windows. All the options described - above can be applied to any window.

- -

Output

- -

Now that we have set things up, we will want to actually - update the terminal. The basic functions used to change what will - go on a window are addch() and move(). - addch() adds a character at the current (y, x) - coordinates. move() changes the current (y, x) - coordinates to whatever you want them to be. It returns - ERR if you try to move off the window. As mentioned - above, you can combine the two into mvaddch() to do - both things at once.

- -

The other output functions, such as addstr() and - printw(), all call addch() to add - characters to the window.

- -

After you have put on the window what you want there, when you - want the portion of the terminal covered by the window to be made - to look like it, you must call refresh(). In order - to optimize finding changes, refresh() assumes that - any part of the window not changed since the last - refresh() of that window has not been changed on the - terminal, i.e., that you have not refreshed a portion of the - terminal with an overlapping window. If this is not the case, the - routine touchwin() is provided to make it look like - the entire window has been changed, thus making - refresh() check the whole subsection of the terminal - for changes.

- -

If you call wrefresh() with curscr - as its argument, it will make the screen look like - curscr thinks it looks like. This is useful for - implementing a command which would redraw the screen in case it - get messed up.

- -

Input

- -

The complementary function to addch() is - getch() which, if echo is set, will call - addch() to echo the character. Since the screen - package needs to know what is on the terminal at all times, if - characters are to be echoed, the tty must be in raw or cbreak - mode. Since initially the terminal has echoing enabled and is in - ordinary “cooked” mode, one or the other has to - changed before calling getch(); otherwise, the - program's output will be unpredictable.

- -

When you need to accept line-oriented input in a window, the - functions wgetstr() and friends are available. There - is even a wscanw() function that can do - scanf()(3)-style multi-field parsing on window - input. These pseudo-line-oriented functions turn on echoing while - they execute.

- -

The example code above uses the call keypad(stdscr, - TRUE) to enable support for function-key mapping. With - this feature, the getch() code watches the input - stream for character sequences that correspond to arrow and - function keys. These sequences are returned as pseudo-character - values. The #define values returned are listed in - the curses.h The mapping from sequences to - #define values is determined by key_ - capabilities in the terminal's terminfo entry.

- -

Using Forms - Characters

- -

The addch() function (and some others, including - box() and border()) can accept some - pseudo-character arguments which are specially defined by - ncurses. These are #define values set - up in the curses.h header; see there for a complete - list (look for the prefix ACS_).

- -

The most useful of the ACS defines are the forms-drawing - characters. You can use these to draw boxes and simple graphs on - the screen. If the terminal does not have such characters, - curses.h will map them to a recognizable (though - ugly) set of ASCII defaults.

- -

Character Attributes and - Color

- -

The ncurses package supports screen highlights - including standout, reverse-video, underline, and blink. It also - supports color, which is treated as another kind of - highlight.

- -

Highlights are encoded, internally, as high bits of the - pseudo-character type (chtype) that - curses.h uses to represent the contents of a screen - cell. See the curses.h header file for a complete - list of highlight mask values (look for the prefix - A_).

- -

There are two ways to make highlights. One is to logical-or - the value of the highlights you want into the character argument - of an addch() call, or any other output call that - takes a chtype argument.

- -

The other is to set the current-highlight value. This is - logical-ORed with any highlight you specify the first - way. You do this with the functions attron(), - attroff(), and attrset(); see the - manual pages for details. Color is a special kind of highlight. - The package actually thinks in terms of color pairs, combinations - of foreground and background colors. The sample code above sets - up eight color pairs, all of the guaranteed-available colors on - black. Note that each color pair is, in effect, given the name of - its foreground color. Any other range of eight non-conflicting - values could have been used as the first arguments of the - init_pair() values.

- -

Once you have done an init_pair() that creates - color-pair N, you can use COLOR_PAIR(N) as a - highlight that invokes that particular color combination. Note - that COLOR_PAIR(N), for constant N, is itself a - compile-time constant and can be used in initializers.

- -

Mouse Interfacing

- -

The ncurses library also provides a mouse - interface.

- -
- NOTE: this facility is specific to - ncurses, it is not part of either the XSI Curses - standard, nor of System V Release 4, nor BSD curses. System V - Release 4 curses contains code with similar interface - definitions, however it is not documented. Other than by - disassembling the library, we have no way to determine exactly - how that mouse code works. Thus, we recommend that you wrap - mouse-related code in an #ifdef using the feature macro - NCURSES_MOUSE_VERSION so it will not be compiled and linked on - non-ncurses systems. -
- -

Presently, mouse event reporting works in the following - environments:

- -
    -
  • xterm and similar programs such as rxvt.
  • - -
  • Linux console, when configured with gpm(1), - Alessandro Rubini's mouse server.
  • - -
  • FreeBSD sysmouse (console)
  • - -
  • OS/2 EMX
  • -
- -

The mouse interface is very simple. To activate it, you use - the function mousemask(), passing it as first - argument a bit-mask that specifies what kinds of events you want - your program to be able to see. It will return the bit-mask of - events that actually become visible, which may differ from the - argument if the mouse device is not capable of reporting some of - the event types you specify.

- -

Once the mouse is active, your application's command loop - should watch for a return value of KEY_MOUSE from - wgetch(). When you see this, a mouse event report - has been queued. To pick it off the queue, use the function - getmouse() (you must do this before the next - wgetch(), otherwise another mouse event might come - in and make the first one inaccessible).

- -

Each call to getmouse() fills a structure (the - address of which you will pass it) with mouse event data. The - event data includes zero-origin, screen-relative character-cell - coordinates of the mouse pointer. It also includes an event mask. - Bits in this mask will be set, corresponding to the event type - being reported.

- -

The mouse structure contains two additional fields which may - be significant in the future as ncurses interfaces to new kinds - of pointing device. In addition to x and y coordinates, there is - a slot for a z coordinate; this might be useful with - touch-screens that can return a pressure or duration parameter. - There is also a device ID field, which could be used to - distinguish between multiple pointing devices.

- -

The class of visible events may be changed at any time via - mousemask(). Events that can be reported include - presses, releases, single-, double- and triple-clicks (you can - set the maximum button-down time for clicks). If you do not make - clicks visible, they will be reported as press-release pairs. In - some environments, the event mask may include bits reporting the - state of shift, alt, and ctrl keys on the keyboard during the - event.

- -

A function to check whether a mouse event fell within a given - window is also supplied. You can use this to see whether a given - window should consider a mouse event relevant to it.

- -

Because mouse event reporting will not be available in all - environments, it would be unwise to build ncurses - applications that require the use of a mouse. Rather, - you should use the mouse as a shortcut for point-and-shoot - commands your application would normally accept from the - keyboard. Two of the test games in the ncurses - distribution (bs and knight) contain - code that illustrates how this can be done.

- -

See the manual page curs_mouse(3X) for full - details of the mouse-interface functions.

- -

Finishing Up

- -

In order to clean up after the ncurses routines, - the routine endwin() is provided. It restores tty - modes to what they were when initscr() was first - called, and moves the cursor down to the lower-left corner. Thus, - anytime after the call to initscr, endwin() should - be called before exiting.

- -

Function Descriptions

- -

We describe the detailed behavior of some important curses - functions here, as a supplement to the manual page - descriptions.

- -

Initialization and Wrapup

- -
-
initscr() -
- -
The first function called should almost always be - initscr(). This will determine the terminal type - and initialize curses data structures. initscr() - also arranges that the first call to refresh() - will clear the screen. If an error occurs a message is written - to standard error and the program exits. Otherwise it returns a - pointer to stdscr. A few functions may be called before initscr - (slk_init(), filter(), - ripoffline(), use_env(), and, if you - are using multiple terminals, newterm().)
- -
endwin() -
- -
Your program should always call endwin() - before exiting or shelling out of the program. This function - will restore tty modes, move the cursor to the lower left - corner of the screen, reset the terminal into the proper - non-visual mode. Calling refresh() or - doupdate() after a temporary escape from the - program will restore the ncurses screen from before the - escape.
- -
newterm(type, ofp, ifp) -
- -
A program which outputs to more than one terminal should - use newterm() instead of initscr(). - newterm() should be called once for each terminal. - It returns a variable of type SCREEN * which - should be saved as a reference to that terminal. (NOTE: a - SCREEN variable is not a screen in the sense we are - describing in this introduction, but a collection of parameters - used to assist in optimizing the display.) The arguments are - the type of the terminal (a string) and FILE - pointers for the output and input of the terminal. If type is - NULL then the environment variable $TERM is used. - endwin() should called once at wrapup time for - each terminal opened using this function.
- -
set_term(new) -
- -
This function is used to switch to a different terminal - previously opened by newterm(). The screen - reference for the new terminal is passed as the parameter. The - previous terminal is returned by the function. All other calls - affect only the current terminal.
- -
delscreen(sp) -
- -
The inverse of newterm(); deallocates the data - structures associated with a given SCREEN - reference.
-
- -

Causing Output to the Terminal

- -
-
refresh() and wrefresh(win)
- -
These functions must be called to actually get any output - on the terminal, as other routines merely manipulate data - structures. wrefresh() copies the named window to - the physical terminal screen, taking into account what is - already there in order to do optimizations. - refresh() does a refresh of stdscr. - Unless leaveok() has been enabled, the physical - cursor of the terminal is left at the location of the window's - cursor.
- -
doupdate() and - wnoutrefresh(win)
- -
These two functions allow multiple updates with more - efficiency than wrefresh. To use them, it is important to - understand how curses works. In addition to all the window - structures, curses keeps two data structures representing the - terminal screen: a physical screen, describing what is actually - on the screen, and a virtual screen, describing what the - programmer wants to have on the screen. wrefresh works by first - copying the named window to the virtual screen - (wnoutrefresh()), and then calling the routine to - update the screen (doupdate()). If the programmer - wishes to output several windows at once, a series of calls to - wrefresh will result in alternating calls to - wnoutrefresh() and doupdate(), - causing several bursts of output to the screen. By calling - wnoutrefresh() for each window, it is then - possible to call doupdate() once, resulting in - only one burst of output, with fewer total characters - transmitted (this also avoids a visually annoying flicker at - each update).
-
- -

Low-Level Capability - Access

- -
-
setupterm(term, filenum, errret) -
- -
- This routine is called to initialize a terminal's - description, without setting up the curses screen structures - or changing the tty-driver mode bits. term is - the character string representing the name of the terminal - being used. filenum is the UNIX file descriptor - of the terminal to be used for output. errret is - a pointer to an integer, in which a success or failure - indication is returned. The values returned can be 1 (all is - well), 0 (no such terminal), or -1 (some problem locating the - terminfo database). -

The value of term can be given as NULL, which - will cause the value of TERM in the environment - to be used. The errret pointer can also be given - as NULL, meaning no error code is wanted. If - errret is defaulted, and something goes wrong, - setupterm() will print an appropriate error - message and exit, rather than returning. Thus, a simple - program can call setupterm(0, 1, 0) and not worry about - initialization errors.

- -

After the call to setupterm(), the global - variable cur_term is set to point to the current - structure of terminal capabilities. By calling - setupterm() for each terminal, and saving and - restoring cur_term, it is possible for a program - to use two or more terminals at once. - Setupterm() also stores the names section of the - terminal description in the global character array - ttytype[]. Subsequent calls to - setupterm() will overwrite this array, so you - will have to save it yourself if need be.

-
-
- -

Debugging

- -
- NOTE: These functions are not part of the - standard curses API! -
- -
-
trace() -
- -
This function can be used to explicitly set a trace level. - If the trace level is nonzero, execution of your program will - generate a file called “trace” in the current - working directory containing a report on the library's actions. - Higher trace levels enable more detailed (and verbose) - reporting -- see comments attached to TRACE_ - defines in the curses.h file for details. (It is - also possible to set a trace level by assigning a trace level - value to the environment variable - NCURSES_TRACE).
- -
_tracef() -
- -
This function can be used to output your own debugging - information. It is only available only if you link with - -lncurses_g. It can be used the same way as - printf(), only it outputs a newline after the end - of arguments. The output goes to a file called - trace in the current directory.
-
- -

Trace logs can be difficult to interpret due to the sheer - volume of data dumped in them. There is a script called - tracemunch included with the - ncurses distribution that can alleviate this problem - somewhat; it compacts long sequences of similar operations into - more succinct single-line pseudo-operations. These pseudo-ops can - be distinguished by the fact that they are named in capital - letters.

- -

Hints, Tips, and Tricks

- -

The ncurses manual pages are a complete reference - for this library. In the remainder of this document, we discuss - various useful methods that may not be obvious from the manual - page descriptions.

- -

Some Notes of Caution

- -

If you find yourself thinking you need to use - noraw() or nocbreak(), think again and - move carefully. It is probably better design to use - getstr() or one of its relatives to simulate cooked - mode. The noraw() and nocbreak() - functions try to restore cooked mode, but they may end up - clobbering some control bits set before you started your - application. Also, they have always been poorly documented, and - are likely to hurt your application's usability with other curses - libraries.

- -

Bear in mind that refresh() is a synonym for - wrefresh(stdscr). Do not try to mix use of - stdscr with use of windows declared by - newwin(); a refresh() call will blow - them off the screen. The right way to handle this is to use - subwin(), or not touch stdscr at all - and tile your screen with declared windows which you then - wnoutrefresh() somewhere in your program event loop, - with a single doupdate() call to trigger actual - repainting.

- -

You are much less likely to run into problems if you design - your screen layouts to use tiled rather than overlapping windows. - Historically, curses support for overlapping windows has been - weak, fragile, and poorly documented. The ncurses - library is not yet an exception to this rule.

- -

There is a panels library included in the ncurses - distribution that does a pretty good job of strengthening the - overlapping-windows facilities.

- -

Try to avoid using the global variables LINES and COLS. Use - getmaxyx() on the stdscr context - instead. Reason: your code may be ported to run in an environment - with window resizes, in which case several screens could be open - with different sizes.

- -

Temporarily Leaving NCURSES - Mode

- -

Sometimes you will want to write a program that spends most of - its time in screen mode, but occasionally returns to ordinary - “cooked” mode. A common reason for this is to support - shell-out. This behavior is simple to arrange in - ncurses.

- -

To leave ncurses mode, call endwin() - as you would if you were intending to terminate the program. This - will take the screen back to cooked mode; you can do your - shell-out. When you want to return to ncurses mode, - simply call refresh() or doupdate(). - This will repaint the screen.

- -

There is a boolean function, isendwin(), which - code can use to test whether ncurses screen mode is - active. It returns TRUE in the interval between an - endwin() call and the following - refresh(), FALSE otherwise.

- -

Here is some sample code for shellout:

- -
-    addstr("Shelling out...");
-    def_prog_mode();           /* save current tty modes */
-    endwin();                  /* restore original tty modes */
-    system("sh");              /* run shell */
-    addstr("returned.\n");     /* prepare return message */
-    refresh();                 /* restore save modes, repaint screen */
-
-

Using NCURSES under XTERM

- -

A resize operation in X sends SIGWINCH to the - application running under xterm. The easiest way to handle - SIGWINCH is to do an endwin, followed - by an refresh and a screen repaint you code - yourself. The refresh will pick up the new screen - size from the xterm's environment.

- -

That is the standard way, of course (it even works with some - vendor's curses implementations). Its drawback is that it clears - the screen to reinitialize the display, and does not resize - subwindows which must be shrunk. Ncurses provides an - extension which works better, the resizeterm - function. That function ensures that all windows are limited to - the new screen dimensions, and pads stdscr with - blanks if the screen is larger.

- -

The ncurses library provides a SIGWINCH signal - handler, which pushes a KEY_RESIZE via the wgetch() - calls. When ncurses returns that code, it calls - resizeterm to update the size of the standard - screen's window, repainting that (filling with blanks or - truncating as needed). It also resizes other windows, but its - effect may be less satisfactory because it cannot know how you - want the screen re-painted. You will usually have to write - special-purpose code to handle KEY_RESIZE - yourself.

- -

Handling Multiple Terminal - Screens

- -

The initscr() function actually calls a function - named newterm() to do most of its work. If you are - writing a program that opens multiple terminals, use - newterm() directly.

- -

For each call, you will have to specify a terminal type and a - pair of file pointers; each call will return a screen reference, - and stdscr will be set to the last one allocated. - You will switch between screens with the set_term - call. Note that you will also have to call - def_shell_mode and def_prog_mode on - each tty yourself.

- -

Testing for Terminal - Capabilities

- -

Sometimes you may want to write programs that test for the - presence of various capabilities before deciding whether to go - into ncurses mode. An easy way to do this is to call - setupterm(), then use the functions - tigetflag(), tigetnum(), and - tigetstr() to do your testing.

- -

A particularly useful case of this often comes up when you - want to test whether a given terminal type should be treated as - “smart” (cursor-addressable) or “stupid”. - The right way to test this is to see if the return value of - tigetstr("cup") is non-NULL. Alternatively, you can - include the term.h file and test the value of the - macro cursor_address.

- -

Tuning for Speed

- -

Use the addchstr() family of functions for fast - screen-painting of text when you know the text does not contain - any control characters. Try to make attribute changes infrequent - on your screens. Do not use the immedok() - option!

- -

Special Features of - NCURSES

- -

The wresize() function allows you to resize a - window in place. The associated resizeterm() - function simplifies the construction of SIGWINCH handlers, for resizing all windows.

- -

The define_key() function allows you to define at - runtime function-key control sequences which are not in the - terminal description. The keyok() function allows - you to temporarily enable or disable interpretation of any - function-key control sequence.

- -

The use_default_colors() function allows you to - construct applications which can use the terminal's default - foreground and background colors as an additional "default" - color. Several terminal emulators support this feature, which is - based on ISO 6429.

- -

Ncurses supports up 16 colors, unlike SVr4 curses which - defines only 8. While most terminals which provide color allow - only 8 colors, about a quarter (including XFree86 xterm) support - 16 colors.

- -

Compatibility with Older - Versions

- -

Despite our best efforts, there are some differences between - ncurses and the (undocumented!) behavior of older - curses implementations. These arise from ambiguities or omissions - in the documentation of the API.

- -

Refresh of Overlapping - Windows

- -

If you define two windows A and B that overlap, and then - alternately scribble on and refresh them, the changes made to the - overlapping region under historic curses versions - were often not documented precisely.

- -

To understand why this is a problem, remember that screen - updates are calculated between two representations of the - entire display. The documentation says that when you - refresh a window, it is first copied to the virtual screen, and - then changes are calculated to update the physical screen (and - applied to the terminal). But "copied to" is not very specific, - and subtle differences in how copying works can produce different - behaviors in the case where two overlapping windows are each - being refreshed at unpredictable intervals.

- -

What happens to the overlapping region depends on what - wnoutrefresh() does with its argument -- what - portions of the argument window it copies to the virtual screen. - Some implementations do "change copy", copying down only - locations in the window that have changed (or been marked changed - with wtouchln() and friends). Some implementations - do "entire copy", copying all window locations to the - virtual screen whether or not they have changed.

- -

The ncurses library itself has not always been - consistent on this score. Due to a bug, versions 1.8.7 to 1.9.8a - did entire copy. Versions 1.8.6 and older, and versions 1.9.9 and - newer, do change copy.

- -

For most commercial curses implementations, it is not - documented and not known for sure (at least not to the - ncurses maintainers) whether they do change copy or - entire copy. We know that System V release 3 curses has logic in - it that looks like an attempt to do change copy, but the - surrounding logic and data representations are sufficiently - complex, and our knowledge sufficiently indirect, that it is hard - to know whether this is reliable. It is not clear what the SVr4 - documentation and XSI standard intend. The XSI Curses standard - barely mentions wnoutrefresh(); the SVr4 documents seem to be - describing entire-copy, but it is possible with some effort and - straining to read them the other way.

- -

It might therefore be unwise to rely on either behavior in - programs that might have to be linked with other curses - implementations. Instead, you can do an explicit - touchwin() before the wnoutrefresh() - call to guarantee an entire-contents copy anywhere.

- -

The really clean way to handle this is to use the panels - library. If, when you want a screen update, you do - update_panels(), it will do all the necessary - wnoutrefresh() calls for whatever panel stacking - order you have defined. Then you can do one - doupdate() and there will be a single burst - of physical I/O that will do all your updates.

- -

Background Erase

- -

If you have been using a very old versions of - ncurses (1.8.7 or older) you may be surprised by the - behavior of the erase functions. In older versions, erased areas - of a window were filled with a blank modified by the window's - current attribute (as set by wattrset(), - wattron(), wattroff() and - friends).

- -

In newer versions, this is not so. Instead, the attribute of - erased blanks is normal unless and until it is modified by the - functions bkgdset() or wbkgdset().

- -

This change in behavior conforms ncurses to - System V Release 4 and the XSI Curses standard.

- -

XSI Curses Conformance

- -

The ncurses library is intended to be base-level - conformant with the XSI Curses standard from X/Open. Many - extended-level features (in fact, almost all features not - directly concerned with wide characters and internationalization) - are also supported.

- -

One effect of XSI conformance is the change in behavior - described under "Background Erase -- - Compatibility with Old Versions".

- -

Also, ncurses meets the XSI requirement that - every macro entry point have a corresponding function which may - be linked (and will be prototype-checked) if the macro definition - is disabled with #undef.

- -

The Panels Library

- -

The ncurses library by itself provides good - support for screen displays in which the windows are tiled - (non-overlapping). In the more general case that windows may - overlap, you have to use a series of wnoutrefresh() - calls followed by a doupdate(), and be careful about - the order you do the window refreshes in. It has to be - bottom-upwards, otherwise parts of windows that should be - obscured will show through.

- -

When your interface design is such that windows may dive - deeper into the visibility stack or pop to the top at runtime, - the resulting book-keeping can be tedious and difficult to get - right. Hence the panels library.

- -

The panel library first appeared in AT&T - System V. The version documented here is the panel - code distributed with ncurses.

- -

Compiling With the Panels - Library

- -

Your panels-using modules must import the panels library - declarations with

- -
-          #include <panel.h>
-
-

and must be linked explicitly with the panels library using an - -lpanel argument. Note that they must also link the - ncurses library with -lncurses. Many - linkers are two-pass and will accept either order, but it is - still good practice to put -lpanel first and - -lncurses second.

- -

Overview of Panels

- -

A panel object is a window that is implicitly treated as part - of a deck including all other panel objects. The deck - has an implicit bottom-to-top visibility order. The panels - library includes an update function (analogous to - refresh()) that displays all panels in the deck in - the proper order to resolve overlaps. The standard window, - stdscr, is considered below all panels.

- -

Details on the panels functions are available in the man - pages. We will just hit the highlights here.

- -

You create a panel from a window by calling - new_panel() on a window pointer. It then becomes the - top of the deck. The panel's window is available as the value of - panel_window() called with the panel pointer as - argument.

- -

You can delete a panel (removing it from the deck) with - del_panel. This will not deallocate the associated - window; you have to do that yourself. You can replace a panel's - window with a different window by calling - replace_window. The new window may be of different - size; the panel code will re-compute all overlaps. This operation - does not change the panel's position in the deck.

- -

To move a panel's window, use move_panel(). The - mvwin() function on the panel's window is not - sufficient because it does not update the panels library's - representation of where the windows are. This operation leaves - the panel's depth, contents, and size unchanged.

- -

Two functions (top_panel(), - bottom_panel()) are provided for rearranging the - deck. The first pops its argument window to the top of the deck; - the second sends it to the bottom. Either operation leaves the - panel's screen location, contents, and size unchanged.

- -

The function update_panels() does all the - wnoutrefresh() calls needed to prepare for - doupdate() (which you must call yourself, - afterwards).

- -

Typically, you will want to call update_panels() - and doupdate() just before accepting command input, - once in each cycle of interaction with the user. If you call - update_panels() after each and every panel write, - you will generate a lot of unnecessary refresh activity and - screen flicker.

- -

Panels, Input, and the - Standard Screen

- -

You should not mix wnoutrefresh() or - wrefresh() operations with panels code; this will - work only if the argument window is either in the top panel or - unobscured by any other panels.

- -

The stsdcr window is a special case. It is - considered below all panels. Because changes to panels may - obscure parts of stdscr, though, you should call - update_panels() before doupdate() even - when you only change stdscr.

- -

Note that wgetch automatically calls - wrefresh. Therefore, before requesting input from a - panel window, you need to be sure that the panel is totally - unobscured.

- -

There is presently no way to display changes to one obscured - panel without repainting all panels.

- -

Hiding Panels

- -

It is possible to remove a panel from the deck temporarily; - use hide_panel for this. Use - show_panel() to render it visible again. The - predicate function panel_hidden tests whether or not - a panel is hidden.

- -

The panel_update code ignores hidden panels. You - cannot do top_panel() or bottom_panel - on a hidden panel(). Other panels operations are applicable.

- -

Miscellaneous Other Facilities

- -

It is possible to navigate the deck using the functions - panel_above() and panel_below. Handed a - panel pointer, they return the panel above or below that panel. - Handed NULL, they return the bottom-most or top-most - panel.

- -

Every panel has an associated user pointer, not used by the - panel code, to which you can attach application data. See the man - page documentation of set_panel_userptr() and - panel_userptr for details.

- -

The Menu Library

- -

A menu is a screen display that assists the user to choose - some subset of a given set of items. The menu - library is a curses extension that supports easy programming of - menu hierarchies with a uniform but flexible interface.

- -

The menu library first appeared in AT&T - System V. The version documented here is the menu - code distributed with ncurses.

- -

Compiling With the menu - Library

- -

Your menu-using modules must import the menu library - declarations with

- -
-          #include <menu.h>
-
-

and must be linked explicitly with the menus library using an - -lmenu argument. Note that they must also link the - ncurses library with -lncurses. Many - linkers are two-pass and will accept either order, but it is - still good practice to put -lmenu first and - -lncurses second.

- -

Overview of Menus

- -

The menus created by this library consist of collections of - items including a name string part and a description - string part. To make menus, you create groups of these items and - connect them with menu frame objects.

- -

The menu can then by posted, that is written to an - associated window. Actually, each menu has two associated - windows; a containing window in which the programmer can scribble - titles or borders, and a subwindow in which the menu items proper - are displayed. If this subwindow is too small to display all the - items, it will be a scrollable viewport on the collection of - items.

- -

A menu may also be unposted (that is, undisplayed), - and finally freed to make the storage associated with it and its - items available for re-use.

- -

The general flow of control of a menu program looks like - this:

- -
    -
  1. Initialize curses.
  2. - -
  3. Create the menu items, using new_item().
  4. - -
  5. Create the menu using new_menu().
  6. - -
  7. Post the menu using post_menu().
  8. - -
  9. Refresh the screen.
  10. - -
  11. Process user requests via an input loop.
  12. - -
  13. Unpost the menu using unpost_menu().
  14. - -
  15. Free the menu, using free_menu().
  16. - -
  17. Free the items using free_item().
  18. - -
  19. Terminate curses.
  20. -
- -

Selecting items

- -

Menus may be multi-valued or (the default) single-valued (see - the manual page menu_opts(3x) to see how to change - the default). Both types always have a current - item.

- -

From a single-valued menu you can read the selected value - simply by looking at the current item. From a multi-valued menu, - you get the selected set by looping through the items applying - the item_value() predicate function. Your - menu-processing code can use the function - set_item_value() to flag the items in the select - set.

- -

Menu items can be made unselectable using - set_item_opts() or item_opts_off() with - the O_SELECTABLE argument. This is the only option - so far defined for menus, but it is good practice to code as - though other option bits might be on.

- -

Menu Display

- -

The menu library calculates a minimum display size for your - window, based on the following variables:

- -
    -
  • The number and maximum length of the menu items
  • - -
  • Whether the O_ROWMAJOR option is enabled
  • - -
  • Whether display of descriptions is enabled
  • - -
  • Whatever menu format may have been set by the - programmer
  • - -
  • The length of the menu mark string used for highlighting - selected items
  • -
- -

The function set_menu_format() allows you to set - the maximum size of the viewport or menu page that - will be used to display menu items. You can retrieve any format - associated with a menu with menu_format(). The - default format is rows=16, columns=1.

- -

The actual menu page may be smaller than the format size. This - depends on the item number and size and whether O_ROWMAJOR is on. - This option (on by default) causes menu items to be displayed in - a “raster-scan” pattern, so that if more than one - item will fit horizontally the first couple of items are - side-by-side in the top row. The alternative is column-major - display, which tries to put the first several items in the first - column.

- -

As mentioned above, a menu format not large enough to allow - all items to fit on-screen will result in a menu display that is - vertically scrollable.

- -

You can scroll it with requests to the menu driver, which will - be described in the section on menu input - handling.

- -

Each menu has a mark string used to visually tag - selected items; see the menu_mark(3x) manual page - for details. The mark string length also influences the menu page - size.

- -

The function scale_menu() returns the minimum - display size that the menu code computes from all these factors. - There are other menu display attributes including a select - attribute, an attribute for selectable items, an attribute for - unselectable items, and a pad character used to separate item - name text from description text. These have reasonable defaults - which the library allows you to change (see the - menu_attribs(3x) manual page.

- -

Menu Windows

- -

Each menu has, as mentioned previously, a pair of associated - windows. Both these windows are painted when the menu is posted - and erased when the menu is unposted.

- -

The outer or frame window is not otherwise touched by the menu - routines. It exists so the programmer can associate a title, a - border, or perhaps help text with the menu and have it properly - refreshed or erased at post/unpost time. The inner window or - subwindow is where the current menu page is - displayed.

- -

By default, both windows are stdscr. You can set - them with the functions in menu_win(3x).

- -

When you call post_menu(), you write the menu to - its subwindow. When you call unpost_menu(), you - erase the subwindow, However, neither of these actually modifies - the screen. To do that, call wrefresh() or some - equivalent.

- -

Processing Menu Input

- -

The main loop of your menu-processing code should call - menu_driver() repeatedly. The first argument of this - routine is a menu pointer; the second is a menu command code. You - should write an input-fetching routine that maps input characters - to menu command codes, and pass its output to - menu_driver(). The menu command codes are fully - documented in menu_driver(3x).

- -

The simplest group of command codes is - REQ_NEXT_ITEM, REQ_PREV_ITEM, - REQ_FIRST_ITEM, REQ_LAST_ITEM, - REQ_UP_ITEM, REQ_DOWN_ITEM, - REQ_LEFT_ITEM, REQ_RIGHT_ITEM. These - change the currently selected item. These requests may cause - scrolling of the menu page if it only partially displayed.

- -

There are explicit requests for scrolling which also change - the current item (because the select location does not change, - but the item there does). These are REQ_SCR_DLINE, - REQ_SCR_ULINE, REQ_SCR_DPAGE, and - REQ_SCR_UPAGE.

- -

The REQ_TOGGLE_ITEM selects or deselects the - current item. It is for use in multi-valued menus; if you use it - with O_ONEVALUE on, you will get an error return - (E_REQUEST_DENIED).

- -

Each menu has an associated pattern buffer. The - menu_driver() logic tries to accumulate printable - ASCII characters passed in in that buffer; when it matches a - prefix of an item name, that item (or the next matching item) is - selected. If appending a character yields no new match, that - character is deleted from the pattern buffer, and - menu_driver() returns E_NO_MATCH.

- -

Some requests change the pattern buffer directly: - REQ_CLEAR_PATTERN, REQ_BACK_PATTERN, - REQ_NEXT_MATCH, REQ_PREV_MATCH. The - latter two are useful when pattern buffer input matches more than - one item in a multi-valued menu.

- -

Each successful scroll or item navigation request clears the - pattern buffer. It is also possible to set the pattern buffer - explicitly with set_menu_pattern().

- -

Finally, menu driver requests above the constant - MAX_COMMAND are considered application-specific - commands. The menu_driver() code ignores them and - returns E_UNKNOWN_COMMAND.

- -

Miscellaneous Other Features

- -

Various menu options can affect the processing and visual - appearance and input processing of menus. See menu_opts(3x) - for details.

- -

It is possible to change the current item from application - code; this is useful if you want to write your own navigation - requests. It is also possible to explicitly set the top row of - the menu display. See mitem_current(3x). If your - application needs to change the menu subwindow cursor for any - reason, pos_menu_cursor() will restore it to the - correct location for continuing menu driver processing.

- -

It is possible to set hooks to be called at menu - initialization and wrapup time, and whenever the selected item - changes. See menu_hook(3x).

- -

Each item, and each menu, has an associated user pointer on - which you can hang application data. See - mitem_userptr(3x) and - menu_userptr(3x).

- -

The Forms Library

- -

The form library is a curses extension that - supports easy programming of on-screen forms for data entry and - program control.

- -

The form library first appeared in AT&T - System V. The version documented here is the form - code distributed with ncurses.

- -

Compiling With the form - Library

- -

Your form-using modules must import the form library - declarations with

- -
-          #include <form.h>
-
-

and must be linked explicitly with the forms library using an - -lform argument. Note that they must also link the - ncurses library with -lncurses. Many - linkers are two-pass and will accept either order, but it is - still good practice to put -lform first and - -lncurses second.

- -

Overview of Forms

- -

A form is a collection of fields; each field may be either a - label (explanatory text) or a data-entry location. Long forms may - be segmented into pages; each entry to a new page clears the - screen.

- -

To make forms, you create groups of fields and connect them - with form frame objects; the form library makes this relatively - simple.

- -

Once defined, a form can be posted, that is written - to an associated window. Actually, each form has two associated - windows; a containing window in which the programmer can scribble - titles or borders, and a subwindow in which the form fields - proper are displayed.

- -

As the form user fills out the posted form, navigation and - editing keys support movement between fields, editing keys - support modifying field, and plain text adds to or changes data - in a current field. The form library allows you (the forms - designer) to bind each navigation and editing key to any - keystroke accepted by curses Fields may have - validation conditions on them, so that they check input data for - type and value. The form library supplies a rich set of - pre-defined field types, and makes it relatively easy to define - new ones.

- -

Once its transaction is completed (or aborted), a form may be - unposted (that is, undisplayed), and finally freed to - make the storage associated with it and its items available for - re-use.

- -

The general flow of control of a form program looks like - this:

- -
    -
  1. Initialize curses.
  2. - -
  3. Create the form fields, using - new_field().
  4. - -
  5. Create the form using new_form().
  6. - -
  7. Post the form using post_form().
  8. - -
  9. Refresh the screen.
  10. - -
  11. Process user requests via an input loop.
  12. - -
  13. Unpost the form using unpost_form().
  14. - -
  15. Free the form, using free_form().
  16. - -
  17. Free the fields using free_field().
  18. - -
  19. Terminate curses.
  20. -
- -

Note that this looks much like a menu program; the form - library handles tasks which are in many ways similar, and its - interface was obviously designed to resemble that of the menu library wherever possible.

- -

In forms programs, however, the “process user - requests” is somewhat more complicated than for menus. - Besides menu-like navigation operations, the menu driver loop has - to support field editing and data validation.

- -

Creating and Freeing Fields - and Forms

- -

The basic function for creating fields is - new_field():

- -
-FIELD *new_field(int height, int width,   /* new field size */
-                 int top, int left,       /* upper left corner */
-                 int offscreen,           /* number of offscreen rows */
-                 int nbuf);               /* number of working buffers */
-
-

Menu items always occupy a single row, but forms fields may - have multiple rows. So new_field() requires you to - specify a width and height (the first two arguments, which mist - both be greater than zero).

- -

You must also specify the location of the field's upper left - corner on the screen (the third and fourth arguments, which must - be zero or greater). Note that these coordinates are relative to - the form subwindow, which will coincide with stdscr - by default but need not be stdscr if you have done - an explicit set_form_win() call.

- -

The fifth argument allows you to specify a number of - off-screen rows. If this is zero, the entire field will always be - displayed. If it is nonzero, the form will be scrollable, with - only one screen-full (initially the top part) displayed at any - given time. If you make a field dynamic and grow it so it will no - longer fit on the screen, the form will become scrollable even if - the offscreen argument was initially zero.

- -

The forms library allocates one working buffer per field; the - size of each buffer is ((height + offscreen)*width + - 1, one character for each position in the field plus a NUL - terminator. The sixth argument is the number of additional data - buffers to allocate for the field; your application can use them - for its own purposes.

- -
-FIELD *dup_field(FIELD *field,            /* field to copy */
-                 int top, int left);      /* location of new copy */
-
-

The function dup_field() duplicates an existing - field at a new location. Size and buffering information are - copied; some attribute flags and status bits are not (see the - form_field_new(3X) for details).

- -
-FIELD *link_field(FIELD *field,           /* field to copy */
-                  int top, int left);     /* location of new copy */
-
-

The function link_field() also duplicates an - existing field at a new location. The difference from - dup_field() is that it arranges for the new field's - buffer to be shared with the old one.

- -

Besides the obvious use in making a field editable from two - different form pages, linked fields give you a way to hack in - dynamic labels. If you declare several fields linked to an - original, and then make them inactive, changes from the original - will still be propagated to the linked fields.

- -

As with duplicated fields, linked fields have attribute bits - separate from the original.

- -

As you might guess, all these field-allocations return - NULL if the field allocation is not possible due to - an out-of-memory error or out-of-bounds arguments.

- -

To connect fields to a form, use

- -
-FORM *new_form(FIELD **fields);
-
-

This function expects to see a NULL-terminated array of field - pointers. Said fields are connected to a newly-allocated form - object; its address is returned (or else NULL if the allocation - fails).

- -

Note that new_field() does not copy the - pointer array into private storage; if you modify the contents of - the pointer array during forms processing, all manner of bizarre - things might happen. Also note that any given field may only be - connected to one form.

- -

The functions free_field() and - free_form are available to free field and form - objects. It is an error to attempt to free a field connected to a - form, but not vice-versa; thus, you will generally free your form - objects first.

- -

Fetching and Changing - Field Attributes

- -

Each form field has a number of location and size attributes - associated with it. There are other field attributes used to - control display and editing of the field. Some (for example, the - O_STATIC bit) involve sufficient complications to be - covered in sections of their own later on. We cover the functions - used to get and set several basic attributes here.

- -

When a field is created, the attributes not specified by the - new_field function are copied from an invisible - system default field. In attribute-setting and -fetching - functions, the argument NULL is taken to mean this field. Changes - to it persist as defaults until your forms application - terminates.

- -

Fetching Size and Location - Data

- -

You can retrieve field sizes and locations through:

- -
-int field_info(FIELD *field,              /* field from which to fetch */
-               int *height, *int width,   /* field size */
-               int *top, int *left,       /* upper left corner */
-               int *offscreen,            /* number of offscreen rows */
-               int *nbuf);                /* number of working buffers */
-
-

This function is a sort of inverse of - new_field(); instead of setting size and location - attributes of a new field, it fetches them from an existing - one.

- -

Changing the Field - Location

- -

It is possible to move a field's location on the screen:

- -
-int move_field(FIELD *field,              /* field to alter */
-               int top, int left);        /* new upper-left corner */
-
-

You can, of course. query the current location through - field_info().

- -

The Justification Attribute

- -

One-line fields may be unjustified, justified right, justified - left, or centered. Here is how you manipulate this attribute:

- -
-int set_field_just(FIELD *field,          /* field to alter */
-                   int justmode);         /* mode to set */
-
-int field_just(FIELD *field);             /* fetch mode of field */
-
-

The mode values accepted and returned by this functions are - preprocessor macros NO_JUSTIFICATION, - JUSTIFY_RIGHT, JUSTIFY_LEFT, or - JUSTIFY_CENTER.

- -

Field Display - Attributes

- -

For each field, you can set a foreground attribute for entered - characters, a background attribute for the entire field, and a - pad character for the unfilled portion of the field. You can also - control pagination of the form.

- -

This group of four field attributes controls the visual - appearance of the field on the screen, without affecting in any - way the data in the field buffer.

- -
-int set_field_fore(FIELD *field,          /* field to alter */
-                   chtype attr);          /* attribute to set */
-
-chtype field_fore(FIELD *field);          /* field to query */
-
-int set_field_back(FIELD *field,          /* field to alter */
-                   chtype attr);          /* attribute to set */
-
-chtype field_back(FIELD *field);          /* field to query */
-
-int set_field_pad(FIELD *field,           /* field to alter */
-                 int pad);                /* pad character to set */
-
-chtype field_pad(FIELD *field);
-
-int set_new_page(FIELD *field,            /* field to alter */
-                 int flag);               /* TRUE to force new page */
-
-chtype new_page(FIELD *field);            /* field to query */
-
-

The attributes set and returned by the first four functions - are normal curses(3x) display attribute values - (A_STANDOUT, A_BOLD, - A_REVERSE etc). The page bit of a field controls - whether it is displayed at the start of a new form screen.

- -

Field Option Bits

- -

There is also a large collection of field option bits you can - set to control various aspects of forms processing. You can - manipulate them with these functions:

- -
-int set_field_opts(FIELD *field,          /* field to alter */
-                   int attr);             /* attribute to set */
-
-int field_opts_on(FIELD *field,           /* field to alter */
-                  int attr);              /* attributes to turn on */
-
-int field_opts_off(FIELD *field,          /* field to alter */
-                   int attr);             /* attributes to turn off */
-
-int field_opts(FIELD *field);             /* field to query */
-
-

By default, all options are on. Here are the available option - bits:

- -
-
O_VISIBLE
- -
Controls whether the field is visible on the screen. Can be - used during form processing to hide or pop up fields depending - on the value of parent fields.
- -
O_ACTIVE
- -
Controls whether the field is active during forms - processing (i.e. visited by form navigation keys). Can be used - to make labels or derived fields with buffer values alterable - by the forms application, not the user.
- -
O_PUBLIC
- -
Controls whether data is displayed during field entry. If - this option is turned off on a field, the library will accept - and edit data in that field, but it will not be displayed and - the visible field cursor will not move. You can turn off the - O_PUBLIC bit to define password fields.
- -
O_EDIT
- -
Controls whether the field's data can be modified. When - this option is off, all editing requests except - REQ_PREV_CHOICE and REQ_NEXT_CHOICE - will fail. Such read-only fields may be useful for help - messages.
- -
O_WRAP
- -
Controls word-wrapping in multi-line fields. Normally, when - any character of a (blank-separated) word reaches the end of - the current line, the entire word is wrapped to the next line - (assuming there is one). When this option is off, the word will - be split across the line break.
- -
O_BLANK
- -
Controls field blanking. When this option is on, entering a - character at the first field position erases the entire field - (except for the just-entered character).
- -
O_AUTOSKIP
- -
Controls automatic skip to next field when this one fills. - Normally, when the forms user tries to type more data into a - field than will fit, the editing location jumps to next field. - When this option is off, the user's cursor will hang at the end - of the field. This option is ignored in dynamic fields that - have not reached their size limit.
- -
O_NULLOK
- -
Controls whether validation is - applied to blank fields. Normally, it is not; the user can - leave a field blank without invoking the usual validation check - on exit. If this option is off on a field, exit from it will - invoke a validation check.
- -
O_PASSOK
- -
Controls whether validation occurs on every exit, or only - after the field is modified. Normally the latter is true. - Setting O_PASSOK may be useful if your field's validation - function may change during forms processing.
- -
O_STATIC
- -
Controls whether the field is fixed to its initial - dimensions. If you turn this off, the field becomes dynamic and will stretch to fit entered - data.
-
- -

A field's options cannot be changed while the field is - currently selected. However, options may be changed on posted - fields that are not current.

- -

The option values are bit-masks and can be composed with - logical-or in the obvious way.

- -

Field Status

- -

Every field has a status flag, which is set to FALSE when the - field is created and TRUE when the value in field buffer 0 - changes. This flag can be queried and set directly:

- -
-int set_field_status(FIELD *field,      /* field to alter */
-                   int status);         /* mode to set */
-
-int field_status(FIELD *field);         /* fetch mode of field */
-
-

Setting this flag under program control can be useful if you - use the same form repeatedly, looking for modified fields each - time.

- -

Calling field_status() on a field not currently - selected for input will return a correct value. Calling - field_status() on a field that is currently selected - for input may not necessarily give a correct field status value, - because entered data is not necessarily copied to buffer zero - before the exit validation check. To guarantee that the returned - status value reflects reality, call field_status() - either (1) in the field's exit validation check routine, (2) from - the field's or form's initialization or termination hooks, or (3) - just after a REQ_VALIDATION request has been - processed by the forms driver.

- -

Field User Pointer

- -

Each field structure contains one character pointer slot that - is not used by the forms library. It is intended to be used by - applications to store private per-field data. You can manipulate - it with:

- -
-int set_field_userptr(FIELD *field,       /* field to alter */
-                   char *userptr);        /* mode to set */
-
-char *field_userptr(FIELD *field);        /* fetch mode of field */
-
(Properly, this user pointer field ought to have (void -*) type. The (char *) type is retained for -System V compatibility.) -

It is valid to set the user pointer of the default field (with - a set_field_userptr() call passed a NULL field - pointer.) When a new field is created, the default-field user - pointer is copied to initialize the new field's user pointer.

- -

Variable-Sized Fields

- -

Normally, a field is fixed at the size specified for it at - creation time. If, however, you turn off its O_STATIC bit, it - becomes dynamic and will automatically resize itself - to accommodate data as it is entered. If the field has extra - buffers associated with it, they will grow right along with the - main input buffer.

- -

A one-line dynamic field will have a fixed height (1) but - variable width, scrolling horizontally to display data within the - field area as originally dimensioned and located. A multi-line - dynamic field will have a fixed width, but variable height - (number of rows), scrolling vertically to display data within the - field area as originally dimensioned and located.

- -

Normally, a dynamic field is allowed to grow without limit. - But it is possible to set an upper limit on the size of a dynamic - field. You do it with this function:

- -
-int set_max_field(FIELD *field,     /* field to alter (may not be NULL) */
-                   int max_size);   /* upper limit on field size */
-
-

If the field is one-line, max_size is taken to be - a column size limit; if it is multi-line, it is taken to be a - line size limit. To disable any limit, use an argument of zero. - The growth limit can be changed whether or not the O_STATIC bit - is on, but has no effect until it is.

- -

The following properties of a field change when it becomes - dynamic:

- -
    -
  • If there is no growth limit, there is no final position of - the field; therefore O_AUTOSKIP and - O_NL_OVERLOAD are ignored.
  • - -
  • Field justification will be ignored (though whatever - justification is set up will be retained internally and can be - queried).
  • - -
  • The dup_field() and link_field() - calls copy dynamic-buffer sizes. If the O_STATIC - option is set on one of a collection of links, buffer resizing - will occur only when the field is edited through that - link.
  • - -
  • The call field_info() will retrieve the - original static size of the field; use - dynamic_field_info() to get the actual dynamic - size.
  • -
- -

Field Validation

- -

By default, a field will accept any data that will fit in its - input buffer. However, it is possible to attach a validation type - to a field. If you do this, any attempt to leave the field while - it contains data that does not match the validation type will - fail. Some validation types also have a character-validity check - for each time a character is entered in the field.

- -

A field's validation check (if any) is not called when - set_field_buffer() modifies the input buffer, nor - when that buffer is changed through a linked field.

- -

The form library provides a rich set of - pre-defined validation types, and gives you the capability to - define custom ones of your own. You can examine and change field - validation attributes with the following functions:

- -
-int set_field_type(FIELD *field,          /* field to alter */
-                   FIELDTYPE *ftype,      /* type to associate */
-                   ...);                  /* additional arguments*/
-
-FIELDTYPE *field_type(FIELD *field);      /* field to query */
-
-

The validation type of a field is considered an attribute of - the field. As with other field attributes, Also, doing - set_field_type() with a NULL field - default will change the system default for validation of - newly-created fields.

- -

Here are the pre-defined validation types:

- -

TYPE_ALPHA

- -

This field type accepts alphabetic data; no blanks, no digits, - no special characters (this is checked at character-entry time). - It is set up with:

- -
-int set_field_type(FIELD *field,          /* field to alter */
-                   TYPE_ALPHA,            /* type to associate */
-                   int width);            /* maximum width of field */
-
-

The width argument sets a minimum width of data. - Typically you will want to set this to the field width; if it is - greater than the field width, the validation check will always - fail. A minimum width of zero makes field completion - optional.

- -

TYPE_ALNUM

- -

This field type accepts alphabetic data and digits; no blanks, - no special characters (this is checked at character-entry time). - It is set up with:

- -
-int set_field_type(FIELD *field,          /* field to alter */
-                   TYPE_ALNUM,            /* type to associate */
-                   int width);            /* maximum width of field */
-
-

The width argument sets a minimum width of data. - As with TYPE_ALPHA, typically you will want to set this to the - field width; if it is greater than the field width, the - validation check will always fail. A minimum width of zero makes - field completion optional.

- -

TYPE_ENUM

- -

This type allows you to restrict a field's values to be among - a specified set of string values (for example, the two-letter - postal codes for U.S. states). It is set up with:

- -
-int set_field_type(FIELD *field,          /* field to alter */
-                   TYPE_ENUM,             /* type to associate */
-                   char **valuelist;      /* list of possible values */
-                   int checkcase;         /* case-sensitive? */
-                   int checkunique);      /* must specify uniquely? */
-
-

The valuelist parameter must point at a - NULL-terminated list of valid strings. The checkcase - argument, if true, makes comparison with the string - case-sensitive.

- -

When the user exits a TYPE_ENUM field, the validation - procedure tries to complete the data in the buffer to a valid - entry. If a complete choice string has been entered, it is of - course valid. But it is also possible to enter a prefix of a - valid string and have it completed for you.

- -

By default, if you enter such a prefix and it matches more - than one value in the string list, the prefix will be completed - to the first matching value. But the checkunique - argument, if true, requires prefix matches to be unique in order - to be valid.

- -

The REQ_NEXT_CHOICE and - REQ_PREV_CHOICE input requests can be particularly - useful with these fields.

- -

TYPE_INTEGER

- -

This field type accepts an integer. It is set up as - follows:

- -
-int set_field_type(FIELD *field,          /* field to alter */
-                   TYPE_INTEGER,          /* type to associate */
-                   int padding,           /* # places to zero-pad to */
-                   int vmin, int vmax);   /* valid range */
-
-

Valid characters consist of an optional leading minus and - digits. The range check is performed on exit. If the range - maximum is less than or equal to the minimum, the range is - ignored.

- -

If the value passes its range check, it is padded with as many - leading zero digits as necessary to meet the padding - argument.

- -

A TYPE_INTEGER value buffer can conveniently be - interpreted with the C library function atoi(3).

- -

TYPE_NUMERIC

- -

This field type accepts a decimal number. It is set up as - follows:

- -
-int set_field_type(FIELD *field,              /* field to alter */
-                   TYPE_NUMERIC,              /* type to associate */
-                   int padding,               /* # places of precision */
-                   double vmin, double vmax); /* valid range */
-
-

Valid characters consist of an optional leading minus and - digits. possibly including a decimal point. If your system - supports locale's, the decimal point character used must be the - one defined by your locale. The range check is performed on exit. - If the range maximum is less than or equal to the minimum, the - range is ignored.

- -

If the value passes its range check, it is padded with as many - trailing zero digits as necessary to meet the padding - argument.

- -

A TYPE_NUMERIC value buffer can conveniently be - interpreted with the C library function atof(3).

- -

TYPE_REGEXP

- -

This field type accepts data matching a regular expression. It - is set up as follows:

- -
-int set_field_type(FIELD *field,          /* field to alter */
-                   TYPE_REGEXP,           /* type to associate */
-                   char *regexp);         /* expression to match */
-
-

The syntax for regular expressions is that of - regcomp(3). The check for regular-expression match - is performed on exit.

- -

Direct Field Buffer - Manipulation

- -

The chief attribute of a field is its buffer contents. When a - form has been completed, your application usually needs to know - the state of each field buffer. You can find this out with:

- -
-char *field_buffer(FIELD *field,          /* field to query */
-                   int bufindex);         /* number of buffer to query */
-
-

Normally, the state of the zero-numbered buffer for each field - is set by the user's editing actions on that field. It is - sometimes useful to be able to set the value of the zero-numbered - (or some other) buffer from your application:

- -
-int set_field_buffer(FIELD *field,        /* field to alter */
-                   int bufindex,          /* number of buffer to alter */
-                   char *value);          /* string value to set */
-
-

If the field is not large enough and cannot be resized to a - sufficiently large size to contain the specified value, the value - will be truncated to fit.

- -

Calling field_buffer() with a null field pointer - will raise an error. Calling field_buffer() on a - field not currently selected for input will return a correct - value. Calling field_buffer() on a field that is - currently selected for input may not necessarily give a correct - field buffer value, because entered data is not necessarily - copied to buffer zero before the exit validation check. To - guarantee that the returned buffer value reflects on-screen - reality, call field_buffer() either (1) in the - field's exit validation check routine, (2) from the field's or - form's initialization or termination hooks, or (3) just after a - REQ_VALIDATION request has been processed by the - forms driver.

- -

Attributes of Forms

- -

As with field attributes, form attributes inherit a default - from a system default form structure. These defaults can be - queried or set by of these functions using a form-pointer - argument of NULL.

- -

The principal attribute of a form is its field list. You can - query and change this list with:

- -
-int set_form_fields(FORM *form,           /* form to alter */
-                    FIELD **fields);      /* fields to connect */
-
-char *form_fields(FORM *form);            /* fetch fields of form */
-
-int field_count(FORM *form);              /* count connect fields */
-
-

The second argument of set_form_fields() may be a - NULL-terminated field pointer array like the one required by - new_form(). In that case, the old fields of the form - are disconnected but not freed (and eligible to be connected to - other forms), then the new fields are connected.

- -

It may also be null, in which case the old fields are - disconnected (and not freed) but no new ones are connected.

- -

The field_count() function simply counts the - number of fields connected to a given from. It returns -1 if the - form-pointer argument is NULL.

- -

Control of Form Display

- -

In the overview section, you saw that to display a form you - normally start by defining its size (and fields), posting it, and - refreshing the screen. There is an hidden step before posting, - which is the association of the form with a frame window - (actually, a pair of windows) within which it will be displayed. - By default, the forms library associates every form with the - full-screen window stdscr.

- -

By making this step explicit, you can associate a form with a - declared frame window on your screen display. This can be useful - if you want to adapt the form display to different screen sizes, - dynamically tile forms on the screen, or use a form as part of an - interface layout managed by panels.

- -

The two windows associated with each form have the same - functions as their analogues in the menu - library. Both these windows are painted when the form is - posted and erased when the form is unposted.

- -

The outer or frame window is not otherwise touched by the form - routines. It exists so the programmer can associate a title, a - border, or perhaps help text with the form and have it properly - refreshed or erased at post/unpost time. The inner window or - subwindow is where the current form page is actually - displayed.

- -

In order to declare your own frame window for a form, you will - need to know the size of the form's bounding rectangle. You can - get this information with:

- -
-int scale_form(FORM *form,                /* form to query */
-               int *rows,                 /* form rows */
-               int *cols);                /* form cols */
-
-

The form dimensions are passed back in the locations pointed - to by the arguments. Once you have this information, you can use - it to declare of windows, then use one of these functions:

- -
-int set_form_win(FORM *form,              /* form to alter */
-                 WINDOW *win);            /* frame window to connect */
-
-WINDOW *form_win(FORM *form);             /* fetch frame window of form */
-
-int set_form_sub(FORM *form,              /* form to alter */
-                 WINDOW *win);            /* form subwindow to connect */
-
-WINDOW *form_sub(FORM *form);             /* fetch form subwindow of form */
-
-

Note that curses operations, including refresh(), - on the form, should be done on the frame window, not the form - subwindow.

- -

It is possible to check from your application whether all of a - scrollable field is actually displayed within the menu subwindow. - Use these functions:

- -
-int data_ahead(FORM *form);               /* form to be queried */
-
-int data_behind(FORM *form);              /* form to be queried */
-
-

The function data_ahead() returns TRUE if (a) the - current field is one-line and has undisplayed data off to the - right, (b) the current field is multi-line and there is data - off-screen below it.

- -

The function data_behind() returns TRUE if the - first (upper left hand) character position is off-screen (not - being displayed).

- -

Finally, there is a function to restore the form window's - cursor to the value expected by the forms driver:

- -
-int pos_form_cursor(FORM *)               /* form to be queried */
-
-

If your application changes the form window cursor, call this - function before handing control back to the forms driver in order - to re-synchronize it.

- -

Input Processing in the Forms - Driver

- -

The function form_driver() handles virtualized - input requests for form navigation, editing, and validation - requests, just as menu_driver does for menus (see - the section on menu input handling).

- -
-int form_driver(FORM *form,               /* form to pass input to */
-                int request);             /* form request code */
-
-

Your input virtualization function needs to take input and - then convert it to either an alphanumeric character (which is - treated as data to be entered in the currently-selected field), - or a forms processing request.

- -

The forms driver provides hooks (through input-validation and - field-termination functions) with which your application code can - check that the input taken by the driver matched what was - expected.

- -

Page Navigation Requests

- -

These requests cause page-level moves through the form, - triggering display of a new form screen.

- -
-
REQ_NEXT_PAGE -
- -
Move to the next form page.
- -
REQ_PREV_PAGE -
- -
Move to the previous form page.
- -
REQ_FIRST_PAGE -
- -
Move to the first form page.
- -
REQ_LAST_PAGE -
- -
Move to the last form page.
-
- -

These requests treat the list as cyclic; that is, - REQ_NEXT_PAGE from the last page goes to the first, - and REQ_PREV_PAGE from the first page goes to the - last.

- -

Inter-Field Navigation - Requests

- -

These requests handle navigation between fields on the same - page.

- -
-
REQ_NEXT_FIELD -
- -
Move to next field.
- -
REQ_PREV_FIELD -
- -
Move to previous field.
- -
REQ_FIRST_FIELD -
- -
Move to the first field.
- -
REQ_LAST_FIELD -
- -
Move to the last field.
- -
REQ_SNEXT_FIELD -
- -
Move to sorted next field.
- -
REQ_SPREV_FIELD -
- -
Move to sorted previous field.
- -
REQ_SFIRST_FIELD -
- -
Move to the sorted first field.
- -
REQ_SLAST_FIELD -
- -
Move to the sorted last field.
- -
REQ_LEFT_FIELD -
- -
Move left to field.
- -
REQ_RIGHT_FIELD -
- -
Move right to field.
- -
REQ_UP_FIELD -
- -
Move up to field.
- -
REQ_DOWN_FIELD -
- -
Move down to field.
-
- -

These requests treat the list of fields on a page as cyclic; - that is, REQ_NEXT_FIELD from the last field goes to - the first, and REQ_PREV_FIELD from the first field - goes to the last. The order of the fields for these (and the - REQ_FIRST_FIELD and REQ_LAST_FIELD - requests) is simply the order of the field pointers in the form - array (as set up by new_form() or - set_form_fields()

- -

It is also possible to traverse the fields as if they had been - sorted in screen-position order, so the sequence goes - left-to-right and top-to-bottom. To do this, use the second group - of four sorted-movement requests.

- -

Finally, it is possible to move between fields using visual - directions up, down, right, and left. To accomplish this, use the - third group of four requests. Note, however, that the position of - a form for purposes of these requests is its upper-left - corner.

- -

For example, suppose you have a multi-line field B, and two - single-line fields A and C on the same line with B, with A to the - left of B and C to the right of B. A REQ_MOVE_RIGHT - from A will go to B only if A, B, and C all share the - same first line; otherwise it will skip over B to C.

- -

Intra-Field Navigation - Requests

- -

These requests drive movement of the edit cursor within the - currently selected field.

- -
-
REQ_NEXT_CHAR -
- -
Move to next character.
- -
REQ_PREV_CHAR -
- -
Move to previous character.
- -
REQ_NEXT_LINE -
- -
Move to next line.
- -
REQ_PREV_LINE -
- -
Move to previous line.
- -
REQ_NEXT_WORD -
- -
Move to next word.
- -
REQ_PREV_WORD -
- -
Move to previous word.
- -
REQ_BEG_FIELD -
- -
Move to beginning of field.
- -
REQ_END_FIELD -
- -
Move to end of field.
- -
REQ_BEG_LINE -
- -
Move to beginning of line.
- -
REQ_END_LINE -
- -
Move to end of line.
- -
REQ_LEFT_CHAR -
- -
Move left in field.
- -
REQ_RIGHT_CHAR -
- -
Move right in field.
- -
REQ_UP_CHAR -
- -
Move up in field.
- -
REQ_DOWN_CHAR -
- -
Move down in field.
-
- -

Each word is separated from the previous and next - characters by whitespace. The commands to move to beginning and - end of line or field look for the first or last non-pad character - in their ranges.

- -

Scrolling Requests

- -

Fields that are dynamic and have grown and fields explicitly - created with offscreen rows are scrollable. One-line fields - scroll horizontally; multi-line fields scroll vertically. Most - scrolling is triggered by editing and intra-field movement (the - library scrolls the field to keep the cursor visible). It is - possible to explicitly request scrolling with the following - requests:

- -
-
REQ_SCR_FLINE -
- -
Scroll vertically forward a line.
- -
REQ_SCR_BLINE -
- -
Scroll vertically backward a line.
- -
REQ_SCR_FPAGE -
- -
Scroll vertically forward a page.
- -
REQ_SCR_BPAGE -
- -
Scroll vertically backward a page.
- -
REQ_SCR_FHPAGE -
- -
Scroll vertically forward half a page.
- -
REQ_SCR_BHPAGE -
- -
Scroll vertically backward half a page.
- -
REQ_SCR_FCHAR -
- -
Scroll horizontally forward a character.
- -
REQ_SCR_BCHAR -
- -
Scroll horizontally backward a character.
- -
REQ_SCR_HFLINE -
- -
Scroll horizontally one field width forward.
- -
REQ_SCR_HBLINE -
- -
Scroll horizontally one field width backward.
- -
REQ_SCR_HFHALF -
- -
Scroll horizontally one half field width forward.
- -
REQ_SCR_HBHALF -
- -
Scroll horizontally one half field width backward.
-
- -

For scrolling purposes, a page of a field is the - height of its visible part.

- -

Editing Requests

- -

When you pass the forms driver an ASCII character, it is - treated as a request to add the character to the field's data - buffer. Whether this is an insertion or a replacement depends on - the field's edit mode (insertion is the default.

- -

The following requests support editing the field and changing - the edit mode:

- -
-
REQ_INS_MODE -
- -
Set insertion mode.
- -
REQ_OVL_MODE -
- -
Set overlay mode.
- -
REQ_NEW_LINE -
- -
New line request (see below for explanation).
- -
REQ_INS_CHAR -
- -
Insert space at character location.
- -
REQ_INS_LINE -
- -
Insert blank line at character location.
- -
REQ_DEL_CHAR -
- -
Delete character at cursor.
- -
REQ_DEL_PREV -
- -
Delete previous word at cursor.
- -
REQ_DEL_LINE -
- -
Delete line at cursor.
- -
REQ_DEL_WORD -
- -
Delete word at cursor.
- -
REQ_CLR_EOL -
- -
Clear to end of line.
- -
REQ_CLR_EOF -
- -
Clear to end of field.
- -
REQ_CLEAR_FIELD -
- -
Clear entire field.
-
- -

The behavior of the REQ_NEW_LINE and - REQ_DEL_PREV requests is complicated and partly - controlled by a pair of forms options. The special cases are - triggered when the cursor is at the beginning of a field, or on - the last line of the field.

- -

First, we consider REQ_NEW_LINE:

- -

The normal behavior of REQ_NEW_LINE in insert - mode is to break the current line at the position of the edit - cursor, inserting the portion of the current line after the - cursor as a new line following the current and moving the cursor - to the beginning of that new line (you may think of this as - inserting a newline in the field buffer).

- -

The normal behavior of REQ_NEW_LINE in overlay - mode is to clear the current line from the position of the edit - cursor to end of line. The cursor is then moved to the beginning - of the next line.

- -

However, REQ_NEW_LINE at the beginning of a - field, or on the last line of a field, instead does a - REQ_NEXT_FIELD. O_NL_OVERLOAD option is - off, this special action is disabled.

- -

Now, let us consider REQ_DEL_PREV:

- -

The normal behavior of REQ_DEL_PREV is to delete - the previous character. If insert mode is on, and the cursor is - at the start of a line, and the text on that line will fit on the - previous one, it instead appends the contents of the current line - to the previous one and deletes the current line (you may think - of this as deleting a newline from the field buffer).

- -

However, REQ_DEL_PREV at the beginning of a field - is instead treated as a REQ_PREV_FIELD.

- -

If the O_BS_OVERLOAD option is off, this special - action is disabled and the forms driver just returns - E_REQUEST_DENIED.

- -

See Form Options for discussion of - how to set and clear the overload options.

- -

Order Requests

- -

If the type of your field is ordered, and has associated - functions for getting the next and previous values of the type - from a given value, there are requests that can fetch that value - into the field buffer:

- -
-
REQ_NEXT_CHOICE -
- -
Place the successor value of the current value in the - buffer.
- -
REQ_PREV_CHOICE -
- -
Place the predecessor value of the current value in the - buffer.
-
- -

Of the built-in field types, only TYPE_ENUM has - built-in successor and predecessor functions. When you define a - field type of your own (see Custom Validation - Types), you can associate our own ordering functions.

- -

Application Commands

- -

Form requests are represented as integers above the - curses value greater than KEY_MAX and - less than or equal to the constant MAX_COMMAND. If - your input-virtualization routine returns a value above - MAX_COMMAND, the forms driver will ignore it.

- -

Field Change Hooks

- -

It is possible to set function hooks to be executed whenever - the current field or form changes. Here are the functions that - support this:

- -
-typedef void    (*HOOK)();       /* pointer to function returning void */
-
-int set_form_init(FORM *form,    /* form to alter */
-                  HOOK hook);    /* initialization hook */
-
-HOOK form_init(FORM *form);      /* form to query */
-
-int set_form_term(FORM *form,    /* form to alter */
-                  HOOK hook);    /* termination hook */
-
-HOOK form_term(FORM *form);      /* form to query */
-
-int set_field_init(FORM *form,   /* form to alter */
-                  HOOK hook);    /* initialization hook */
-
-HOOK field_init(FORM *form);     /* form to query */
-
-int set_field_term(FORM *form,   /* form to alter */
-                  HOOK hook);    /* termination hook */
-
-HOOK field_term(FORM *form);     /* form to query */
-
-

These functions allow you to either set or query four - different hooks. In each of the set functions, the second - argument should be the address of a hook function. These - functions differ only in the timing of the hook call.

- -
-
form_init
- -
This hook is called when the form is posted; also, just - after each page change operation.
- -
field_init
- -
This hook is called when the form is posted; also, just - after each field change
- -
field_term
- -
This hook is called just after field validation; that is, - just before the field is altered. It is also called when the - form is unposted.
- -
form_term
- -
This hook is called when the form is unposted; also, just - before each page change operation.
-
- -

Calls to these hooks may be triggered

- -
    -
  1. When user editing requests are processed by the forms - driver
  2. - -
  3. When the current page is changed by - set_current_field() call
  4. - -
  5. When the current field is changed by a - set_form_page() call
  6. -
- -

See Field Change Commands for - discussion of the latter two cases.

- -

You can set a default hook for all fields by passing one of - the set functions a NULL first argument.

- -

You can disable any of these hooks by (re)setting them to - NULL, the default value.

- -

Field Change Commands

- -

Normally, navigation through the form will be driven by the - user's input requests. But sometimes it is useful to be able to - move the focus for editing and viewing under control of your - application, or ask which field it currently is in. The following - functions help you accomplish this:

- -
-int set_current_field(FORM *form,         /* form to alter */
-                      FIELD *field);      /* field to shift to */
-
-FIELD *current_field(FORM *form);         /* form to query */
-
-int field_index(FORM *form,               /* form to query */
-                FIELD *field);            /* field to get index of */
-
-

The function field_index() returns the index of - the given field in the given form's field array (the array passed - to new_form() or - set_form_fields()).

- -

The initial current field of a form is the first active field - on the first page. The function set_form_fields() - resets this.

- -

It is also possible to move around by pages.

- -
-int set_form_page(FORM *form,             /* form to alter */
-                  int page);              /* page to go to (0-origin) */
-
-int form_page(FORM *form);                /* return form's current page */
-
-

The initial page of a newly-created form is 0. The function - set_form_fields() resets this.

- -

Form Options

- -

Like fields, forms may have control option bits. They can be - changed or queried with these functions:

- -
-int set_form_opts(FORM *form,             /* form to alter */
-                  int attr);              /* attribute to set */
-
-int form_opts_on(FORM *form,              /* form to alter */
-                 int attr);               /* attributes to turn on */
-
-int form_opts_off(FORM *form,             /* form to alter */
-                  int attr);              /* attributes to turn off */
-
-int form_opts(FORM *form);                /* form to query */
-
-

By default, all options are on. Here are the available option - bits:

- -
-
O_NL_OVERLOAD
- -
Enable overloading of REQ_NEW_LINE as - described in Editing Requests. The value - of this option is ignored on dynamic fields that have not - reached their size limit; these have no last line, so the - circumstances for triggering a REQ_NEXT_FIELD - never arise.
- -
O_BS_OVERLOAD
- -
Enable overloading of REQ_DEL_PREV as - described in Editing Requests.
-
- -

The option values are bit-masks and can be composed with - logical-or in the obvious way.

- -

Custom Validation Types

- -

The form library gives you the capability to - define custom validation types of your own. Further, the optional - additional arguments of set_field_type effectively - allow you to parameterize validation types. Most of the - complications in the validation-type interface have to do with - the handling of the additional arguments within custom validation - functions.

- -

Union Types

- -

The simplest way to create a custom data type is to compose it - from two preexisting ones:

- -
-FIELD *link_fieldtype(FIELDTYPE *type1,
-                      FIELDTYPE *type2);
-
-

This function creates a field type that will accept any of the - values legal for either of its argument field types (which may be - either predefined or programmer-defined). If a - set_field_type() call later requires arguments, the - new composite type expects all arguments for the first type, than - all arguments for the second. Order functions (see Order Requests) associated with the component types - will work on the composite; what it does is check the validation - function for the first type, then for the second, to figure what - type the buffer contents should be treated as.

- -

New Field Types

- -

To create a field type from scratch, you need to specify one - or both of the following things:

- -
    -
  • A character-validation function, to check each character as - it is entered.
  • - -
  • A field-validation function to be applied on exit from the - field.
  • -
- -

Here is how you do that:

- -
-typedef int     (*HOOK)();       /* pointer to function returning int */
-
-FIELDTYPE *new_fieldtype(HOOK f_validate, /* field validator */
-                         HOOK c_validate) /* character validator */
-
-int free_fieldtype(FIELDTYPE *ftype);     /* type to free */
-
-

At least one of the arguments of new_fieldtype() - must be non-NULL. The forms driver will automatically call the - new type's validation functions at appropriate points in - processing a field of the new type.

- -

The function free_fieldtype() deallocates the - argument fieldtype, freeing all storage associated with it.

- -

Normally, a field validator is called when the user attempts - to leave the field. Its first argument is a field pointer, from - which it can get to field buffer 0 and test it. If the function - returns TRUE, the operation succeeds; if it returns FALSE, the - edit cursor stays in the field.

- -

A character validator gets the character passed in as a first - argument. It too should return TRUE if the character is valid, - FALSE otherwise.

- -

Validation Function - Arguments

- -

Your field- and character- validation functions will be passed - a second argument as well. This second argument is the address of - a structure (which we will call a pile) built from any - of the field-type-specific arguments passed to - set_field_type(). If no such arguments are defined - for the field type, this pile pointer argument will be NULL.

- -

In order to arrange for such arguments to be passed to your - validation functions, you must associate a small set of - storage-management functions with the type. The forms driver will - use these to synthesize a pile from the trailing arguments of - each set_field_type() argument, and a pointer to the - pile will be passed to the validation functions.

- -

Here is how you make the association:

- -
-typedef char    *(*PTRHOOK)();    /* pointer to function returning (char *) */
-typedef void    (*VOIDHOOK)();    /* pointer to function returning void */
-
-int set_fieldtype_arg(FIELDTYPE *type,    /* type to alter */
-                      PTRHOOK make_str,   /* make structure from args */
-                      PTRHOOK copy_str,   /* make copy of structure */
-                      VOIDHOOK free_str); /* free structure storage */
-
-

Here is how the storage-management hooks are used:

- -
-
make_str -
- -
This function is called by set_field_type(). - It gets one argument, a va_list of the - type-specific arguments passed to - set_field_type(). It is expected to return a pile - pointer to a data structure that encapsulates those - arguments.
- -
copy_str -
- -
This function is called by form library functions that - allocate new field instances. It is expected to take a pile - pointer, copy the pile to allocated storage, and return the - address of the pile copy.
- -
free_str -
- -
This function is called by field- and type-deallocation - routines in the library. It takes a pile pointer argument, and - is expected to free the storage of that pile.
-
- -

The make_str and copy_str functions - may return NULL to signal allocation failure. The library - routines will that call them will return error indication when - this happens. Thus, your validation functions should never see a - NULL file pointer and need not check specially for it.

- -

Order Functions For - Custom Types

- -

Some custom field types are simply ordered in the same - well-defined way that TYPE_ENUM is. For such types, - it is possible to define successor and predecessor functions to - support the REQ_NEXT_CHOICE and - REQ_PREV_CHOICE requests. Here is how:

- -
-typedef int     (*INTHOOK)();     /* pointer to function returning int */
-
-int set_fieldtype_arg(FIELDTYPE *type,    /* type to alter */
-                      INTHOOK succ,       /* get successor value */
-                      INTHOOK pred);      /* get predecessor value */
-
-

The successor and predecessor arguments will each be passed - two arguments; a field pointer, and a pile pointer (as for the - validation functions). They are expected to use the function - field_buffer() to read the current value, and - set_field_buffer() on buffer 0 to set the next or - previous value. Either hook may return TRUE to indicate success - (a legal next or previous value was set) or FALSE to indicate - failure.

- -

Avoiding Problems

- -

The interface for defining custom types is complicated and - tricky. Rather than attempting to create a custom type entirely - from scratch, you should start by studying the library source - code for whichever of the pre-defined types seems to be closest - to what you want.

- -

Use that code as a model, and evolve it towards what you - really want. You will avoid many problems and annoyances that - way. The code in the ncurses library has been - specifically exempted from the package copyright to support - this.

- -

If your custom type defines order functions, have do something - intuitive with a blank field. A useful convention is to make the - successor of a blank field the types minimum value, and its - predecessor the maximum.

- - diff --git a/contrib/ncurses/doc/ncurses-intro.doc b/contrib/ncurses/doc/ncurses-intro.doc --- a/contrib/ncurses/doc/ncurses-intro.doc +++ b/contrib/ncurses/doc/ncurses-intro.doc @@ -153,9 +153,8 @@ source-code or documentation; the tic and infocmp programs are the exceptions. - System V Release 3 (System III UNIX) from Bell Labs featured a - rewritten and much-improved curses library, along with the tic program - (late 1986). + System V Release 3 from Bell Labs featured a rewritten and + much-improved curses library, along with the tic program (late 1986). To recap, terminfo is based on Berkeley's termcap database, but contains a number of improvements and extensions. Parameterized diff --git a/contrib/ncurses/form/Makefile.in b/contrib/ncurses/form/Makefile.in --- a/contrib/ncurses/form/Makefile.in +++ b/contrib/ncurses/form/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.72 2021/07/03 15:45:33 tom Exp $ +# $Id: Makefile.in,v 1.78 2025/10/25 17:58:52 tom Exp $ ############################################################################## -# Copyright 2020,2021 Thomas E. Dickey # +# Copyright 2020-2024,2025 Thomas E. Dickey # # Copyright 1998-2015,2018 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -47,11 +47,14 @@ VPATH = @srcdir@ THIS = Makefile +@SET_MAKE@ +@SET_DESTDIR@ +TOP_MFLAGS = DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)" + x = @EXEEXT@ o = .@OBJEXT@ MODEL = @DFT_LWR_MODEL@ -DESTDIR = @DESTDIR@ top_srcdir = @top_srcdir@ srcdir = @srcdir@ prefix = @prefix@ @@ -61,7 +64,9 @@ includedir = @includedir@ includesubdir = @includesubdir@ -INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) +INCLUDEDIR = $(DESTDIR)$(includedir@MERGE_PREFIX@)$(includesubdir) +BINDIR = $(DESTDIR)$(bindir@MERGE_PREFIX@) +LIBDIR = $(DESTDIR)$(libdir@MERGE_PREFIX@) PACKAGE = @PACKAGE@ @@ -110,7 +115,7 @@ LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@ SHLIB_DIRS = -L../lib -SHLIB_LIST = $(SHLIB_DIRS) -lncurses@USE_LIB_SUFFIX@ @SHLIB_LIST@ +SHLIB_LIST = $(SHLIB_DIRS) -lncurses@ABI_SUFFIX@ @SHLIB_LIST@ RPATH_LIST = @RPATH_LIST@ RESULTING_SYMS = @RESULTING_SYMS@ @@ -151,10 +156,13 @@ libs \ install :: $(AUTO_SRC) $(LIBRARIES) +check :: + @echo "no unit-test implemented" + sources : $(AUTO_SRC) -$(DESTDIR)$(bindir) \ -$(DESTDIR)$(libdir) : +$(BINDIR) \ +$(LIBDIR) : mkdir -p $@ # make copies to simplify include-paths while still keeping form's include @@ -201,6 +209,12 @@ realclean :: distclean +# These rules are used to allow "make -n" to work on a clean directory-tree +../include/curses.h \ +../include/ncurses_def.h \ +../include/term.h : + ( cd ../include && $(MAKE) $(TOP_MFLAGS) ) + ../include/mf_common.h \ ../include/eti.h : ( cd ../menu && $(MAKE) $@ ) diff --git a/contrib/ncurses/form/fld_arg.c b/contrib/ncurses/form/fld_arg.c --- a/contrib/ncurses/form/fld_arg.c +++ b/contrib/ncurses/form/fld_arg.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2018-2020,2024 Thomas E. Dickey * * Copyright 1998-2012,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_arg.c,v 1.18 2020/12/11 22:05:24 tom Exp $") +MODULE_ID("$Id: fld_arg.c,v 1.19 2024/12/07 23:00:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -75,7 +75,7 @@ TR_FUNC_ARG(1, copy_arg), TR_FUNC_ARG(2, free_arg))); - if (typ != 0 && make_arg != (void *)0) + if (typ != NULL && make_arg != NULL) { SetStatus(typ, _HAS_ARGS); typ->makearg = make_arg; diff --git a/contrib/ncurses/form/fld_attr.c b/contrib/ncurses/form/fld_attr.c --- a/contrib/ncurses/form/fld_attr.c +++ b/contrib/ncurses/form/fld_attr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2010,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_attr.c,v 1.15 2020/12/11 22:05:24 tom Exp $") +MODULE_ID("$Id: fld_attr.c,v 1.16 2024/12/07 23:01:42 tom Exp $") /*---------------------------------------------------------------------------- Field-Attribute manipulation routines @@ -47,7 +47,7 @@ if ( attr==A_NORMAL || ((attr & A_ATTRIBUTES)==attr) )\ {\ Normalize_Field( field );\ - if (field != 0) \ + if (field != NULL) \ { \ if ((field -> name) != attr)\ {\ diff --git a/contrib/ncurses/form/fld_current.c b/contrib/ncurses/form/fld_current.c --- a/contrib/ncurses/form/fld_current.c +++ b/contrib/ncurses/form/fld_current.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2010,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_current.c,v 1.16 2020/05/24 01:40:20 anonymous.maarten Exp $") +MODULE_ID("$Id: fld_current.c,v 1.17 2024/12/07 23:01:42 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -54,7 +54,7 @@ int err = E_OK; T((T_CALLED("set_current_field(%p,%p)"), (void *)form, (void *)field)); - if (form == 0 || field == 0) + if (form == NULL || field == NULL) { RETURN(E_BAD_ARGUMENT); } @@ -117,11 +117,11 @@ unfocus_current_field(FORM *const form) { T((T_CALLED("unfocus_current_field(%p)"), (const void *)form)); - if (form == 0) + if (form == NULL) { RETURN(E_BAD_ARGUMENT); } - else if (form->current == 0) + else if (form->current == NULL) { RETURN(E_REQUEST_DENIED); } @@ -158,7 +158,7 @@ field_index(const FIELD *field) { T((T_CALLED("field_index(%p)"), (const void *)field)); - returnCode((field != 0 && field->form != 0) ? (int)field->index : -1); + returnCode((field != NULL && field->form != NULL) ? (int)field->index : -1); } /* fld_current.c ends here */ diff --git a/contrib/ncurses/form/fld_def.c b/contrib/ncurses/form/fld_def.c --- a/contrib/ncurses/form/fld_def.c +++ b/contrib/ncurses/form/fld_def.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2012,2014 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_def.c,v 1.44 2021/03/27 23:49:53 tom Exp $") +MODULE_ID("$Id: fld_def.c,v 1.46 2024/12/07 21:56:21 tom Exp $") /* this can't be readonly */ static FIELD default_field = @@ -87,14 +87,14 @@ { TypeArgument *res = (TypeArgument *)0; - if (typ != 0 && (typ->status & _HAS_ARGS) != 0) + if (typ != NULL && (typ->status & _HAS_ARGS) != 0) { assert(err != 0 && ap != (va_list *)0); if ((typ->status & _LINKED_TYPE) != 0) { TypeArgument *p = typeMalloc(TypeArgument, 1); - if (p != 0) + if (p != NULL) { p->left = _nc_Make_Argument(typ->left, ap, err); p->right = _nc_Make_Argument(typ->right, ap, err); @@ -134,14 +134,14 @@ { TypeArgument *res = (TypeArgument *)0; - if (typ != 0 && (typ->status & _HAS_ARGS) != 0) + if (typ != NULL && (typ->status & _HAS_ARGS) != 0) { assert(err != 0 && argp != 0); if ((typ->status & _LINKED_TYPE) != 0) { TypeArgument *p = typeMalloc(TypeArgument, 1); - if (p != 0) + if (p != NULL) { p->left = _nc_Copy_Argument(typ, argp->left, err); p->right = _nc_Copy_Argument(typ, argp->right, err); @@ -180,11 +180,11 @@ FORM_EXPORT(void) _nc_Free_Argument(const FIELDTYPE *typ, TypeArgument *argp) { - if (typ != 0 && (typ->status & _HAS_ARGS) != 0) + if (typ != NULL && (typ->status & _HAS_ARGS) != 0) { if ((typ->status & _LINKED_TYPE) != 0) { - if (argp != 0) + if (argp != NULL) { _nc_Free_Argument(typ->left, argp->left); _nc_Free_Argument(typ->right, argp->right); @@ -229,7 +229,7 @@ } else { - if (dst->type != 0) + if (dst->type != NULL) { dst->type->ref++; } @@ -249,7 +249,7 @@ _nc_Free_Type(FIELD *field) { assert(field != 0); - if (field->type != 0) + if (field->type != NULL) { field->type->ref--; _nc_Free_Argument(field->type, (TypeArgument *)(field->arg)); @@ -289,7 +289,7 @@ nrow >= 0 && nbuf >= 0 && ((err = E_SYSTEM_ERROR) != 0) && /* trick: this resets the default error */ - (New_Field = typeMalloc(FIELD, 1)) != 0) + (New_Field = typeMalloc(FIELD, 1)) != NULL) { T((T_CREATE("field %p"), (void *)New_Field)); *New_Field = default_field; @@ -313,7 +313,7 @@ size_t len; len = Total_Buffer_Size(New_Field); - if ((New_Field->buf = (FIELD_CELL *)malloc(len))) + if ((New_Field->buf = (FIELD_CELL *)malloc(len)) != NULL) { /* Prefill buffers with blanks and insert terminating zeroes between buffers */ @@ -360,13 +360,13 @@ { RETURN(E_BAD_ARGUMENT); } - else if (field->form != 0) + else if (field->form != NULL) { RETURN(E_CONNECTED); } else if (field == field->link) { - if (field->buf != 0) + if (field->buf != NULL) free(field->buf); } else @@ -380,7 +380,7 @@ } _nc_Free_Type(field); #if USE_WIDEC_SUPPORT - if (field->expanded != 0) + if (field->expanded != NULL) { int n; diff --git a/contrib/ncurses/form/fld_dup.c b/contrib/ncurses/form/fld_dup.c --- a/contrib/ncurses/form/fld_dup.c +++ b/contrib/ncurses/form/fld_dup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2010,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_dup.c,v 1.18 2020/05/24 01:40:20 anonymous.maarten Exp $") +MODULE_ID("$Id: fld_dup.c,v 1.19 2024/11/30 21:40:55 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -83,7 +83,7 @@ size_t len; len = Total_Buffer_Size(New_Field); - if ((New_Field->buf = (FIELD_CELL *)malloc(len * 20))) + if ((New_Field->buf = (FIELD_CELL *)malloc(len * 20)) != NULL) { memcpy(New_Field->buf, field->buf, len); returnField(New_Field); diff --git a/contrib/ncurses/form/form.priv.h b/contrib/ncurses/form/form.priv.h --- a/contrib/ncurses/form/form.priv.h +++ b/contrib/ncurses/form/form.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2021,2024 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: form.priv.h,v 0.49 2024/02/24 12:17:31 tom Exp $ */ +/* $Id: form.priv.h,v 0.52 2025/11/01 20:16:03 tom Exp $ */ #ifndef FORM_PRIV_H #define FORM_PRIV_H 1 @@ -93,11 +93,11 @@ /* If form is NULL replace form argument by default-form */ #define Normalize_Form(form) \ - ((form) = (form != 0) ? (form) : _nc_Default_Form) + ((form) = (form != NULL) ? (form) : _nc_Default_Form) /* If field is NULL replace field argument by default-field */ #define Normalize_Field(field) \ - ((field) = (field != 0) ? (field) : _nc_Default_Field) + ((field) = (field != NULL) ? (field) : _nc_Default_Field) #if NCURSES_SP_FUNCS #define Get_Form_Screen(form) \ @@ -172,6 +172,9 @@ #define C_ZEROS '\0' +#define MAX_DIGITS 64 +#define MaxDigits(n) ((n) > MAX_DIGITS ? MAX_DIGITS : ((n) > 0 ? (n) : 0)) + extern FORM_EXPORT(TypeArgument *) _nc_Make_Argument (const FIELDTYPE*, va_list*, int*); extern FORM_EXPORT(TypeArgument *) _nc_Copy_Argument (const FIELDTYPE*, const TypeArgument*, int*); extern FORM_EXPORT(void) _nc_Free_Argument (const FIELDTYPE*, TypeArgument*); @@ -260,7 +263,7 @@ int len; \ int n; \ wchar_t *list = _nc_Widen_String((char *)buffer, &len); \ - if (list != 0) \ + if (list != NULL) \ { \ result = TRUE; \ for (n = 0; n < len; ++n) \ @@ -278,7 +281,7 @@ blank = TRUE; \ result = (n + 1 >= width); \ } \ - else if (!ccheck(list[n], NULL)) \ + else if (!ccheck((int) list[n], NULL)) \ { \ result = FALSE; \ break; \ diff --git a/contrib/ncurses/form/frm_data.c b/contrib/ncurses/form/frm_data.c --- a/contrib/ncurses/form/frm_data.c +++ b/contrib/ncurses/form/frm_data.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2010,2013 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_data.c,v 1.21 2021/06/17 21:11:08 tom Exp $") +MODULE_ID("$Id: frm_data.c,v 1.22 2024/07/27 18:35:02 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -54,7 +54,7 @@ if (form && (form->status & _POSTED) && form->current) { - FIELD *field; + const FIELD *field; field = form->current; if (!Single_Line_Field(field)) @@ -141,7 +141,7 @@ if (form && (form->status & _POSTED) && form->current) { - FIELD *field; + const FIELD *field; bool cursor_moved = FALSE; int pos; diff --git a/contrib/ncurses/form/frm_driver.c b/contrib/ncurses/form/frm_driver.c --- a/contrib/ncurses/form/frm_driver.c +++ b/contrib/ncurses/form/frm_driver.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2021,2024 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_driver.c,v 1.135 2021/09/01 23:34:01 tom Exp $") +MODULE_ID("$Id: frm_driver.c,v 1.137 2024/12/07 21:57:21 tom Exp $") /*---------------------------------------------------------------------------- This is the core module of the form library. It contains the majority @@ -313,7 +313,7 @@ while (LEGALYX(win, y, x)) { - cchar_t *data = &(win->_line[y].text[x]); + const cchar_t *data = &(win->_line[y].text[x]); if (isWidecBase(CHDEREF(data)) || !isWidecExt(CHDEREF(data))) { @@ -387,7 +387,7 @@ Get_Start_Of_Data(FIELD_CELL *buf, int blen) { FIELD_CELL *p = buf; - FIELD_CELL *end = &buf[blen]; + const FIELD_CELL *end = &buf[blen]; assert(buf && blen >= 0); while ((p < end) && ISBLANK(*p)) @@ -429,7 +429,7 @@ Get_First_Whitespace_Character(FIELD_CELL *buf, int blen) { FIELD_CELL *p = buf; - FIELD_CELL *end = &p[blen]; + const FIELD_CELL *end = &p[blen]; assert(buf && blen >= 0); while ((p < end) && !ISBLANK(*p)) @@ -479,7 +479,7 @@ NCURSES_INLINE static void Adjust_Cursor_Position(FORM *form, const FIELD_CELL *pos) { - FIELD *field; + const FIELD *field; int idx; field = form->current; @@ -716,7 +716,7 @@ for (i = 0; i <= field->nbuf; i++) { FIELD_CELL *new_bp = Address_Of_Nth_Buffer(field, i); - FIELD_CELL *old_bp = oldbuf + i * (1 + old_buflen); + const FIELD_CELL *old_bp = oldbuf + i * (1 + old_buflen); for (j = 0; j < old_buflen; ++j) new_bp[j] = old_bp[j]; @@ -734,7 +734,7 @@ { WINDOW *new_window = newpad(field->drows, field->dcols); - if (new_window != 0) + if (new_window != NULL) { assert(form != (FORM *)0); if (form->w) @@ -802,7 +802,7 @@ Field_encloses(FIELD *field, int ry, int rx) { T((T_CALLED("Field_encloses(%p)"), (void *)field)); - if (field != 0 + if (field != NULL && field->frow <= ry && (field->frow + field->rows) > ry && field->fcol <= rx @@ -830,7 +830,7 @@ FORM_EXPORT(int) _nc_Position_Form_Cursor(FORM *form) { - FIELD *field; + const FIELD *field; WINDOW *formwin; if (!form) @@ -1005,7 +1005,7 @@ static void Perform_Justification(FIELD *field, WINDOW *win) { - FIELD_CELL *bp; + const FIELD_CELL *bp; int len; bp = (Field_Has_Option(field, O_NO_LEFT_STRIP) @@ -1053,7 +1053,7 @@ static void Undo_Justification(FIELD *field, WINDOW *win) { - FIELD_CELL *bp; + const FIELD_CELL *bp; int y, x; int len; @@ -1251,7 +1251,7 @@ return (E_SYSTEM_ERROR); for (linked_field = field->link; - (linked_field != field) && (linked_field != 0); + (linked_field != field) && (linked_field != NULL); linked_field = linked_field->link) { int syncres; @@ -1458,7 +1458,7 @@ werase(form->w); Perform_Justification(field, form->w); if (Field_Has_Option(field, O_DYNAMIC_JUSTIFY) && - (form->w->_parent == 0)) + (form->w->_parent == NULL)) { copywin(form->w, Get_Form_Window(form), @@ -1480,7 +1480,7 @@ } delwin(form->w); form->w = (WINDOW *)0; - form->current = 0; + form->current = NULL; } /*--------------------------------------------------------------------------- @@ -1702,10 +1702,10 @@ static int IFN_Next_Word(FORM *form) { - FIELD *field = form->current; + const FIELD *field = form->current; FIELD_CELL *bp = Address_Of_Current_Position_In_Buffer(form); FIELD_CELL *s; - FIELD_CELL *t; + const FIELD_CELL *t; T((T_CALLED("IFN_Next_Word(%p)"), (void *)form)); @@ -1745,9 +1745,9 @@ IFN_Previous_Word(FORM *form) { FIELD *field = form->current; - FIELD_CELL *bp = Address_Of_Current_Position_In_Buffer(form); - FIELD_CELL *s; - FIELD_CELL *t; + const FIELD_CELL *bp = Address_Of_Current_Position_In_Buffer(form); + const FIELD_CELL *s; + const FIELD_CELL *t; bool again = FALSE; T((T_CALLED("IFN_Previous_Word(%p)"), (void *)form)); @@ -1845,7 +1845,7 @@ static int IFN_Beginning_Of_Line(FORM *form) { - FIELD *field = form->current; + const FIELD *field = form->current; T((T_CALLED("IFN_Beginning_Of_Line(%p)"), (void *)form)); Synchronize_Buffer(form); @@ -1869,7 +1869,7 @@ static int IFN_End_Of_Line(FORM *form) { - FIELD *field = form->current; + const FIELD *field = form->current; FIELD_CELL *pos; FIELD_CELL *bp; @@ -2009,7 +2009,7 @@ static int VSC_Generic(FORM *form, int nlines) { - FIELD *field = form->current; + const FIELD *field = form->current; int res = E_REQUEST_DENIED; int rows_to_go = (nlines > 0 ? nlines : -nlines); @@ -2189,7 +2189,7 @@ static int HSC_Generic(FORM *form, int ncolumns) { - FIELD *field = form->current; + const FIELD *field = form->current; int res = E_REQUEST_DENIED; int cols_to_go = (ncolumns > 0 ? ncolumns : -ncolumns); @@ -2365,7 +2365,8 @@ Is_There_Room_For_A_Line(FORM *form) { FIELD *field = form->current; - FIELD_CELL *begin_of_last_line, *s; + FIELD_CELL *begin_of_last_line; + const FIELD_CELL *s; Synchronize_Buffer(form); begin_of_last_line = Address_Of_Row_In_Buffer(field, (field->drows - 1)); @@ -2419,7 +2420,7 @@ | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ static int -Insert_String(FORM *form, int row, FIELD_CELL *txt, int len) +Insert_String(FORM *form, int row, const FIELD_CELL *txt, int len) { FIELD *field = form->current; FIELD_CELL *bp = Address_Of_Row_In_Buffer(field, row); @@ -2450,7 +2451,7 @@ if (row < (field->drows - 1)) { - FIELD_CELL *split; + const FIELD_CELL *split; split = After_Last_Whitespace_Character(bp, @@ -2507,7 +2508,7 @@ (!Last_Row || Growable(field))) /* there are more lines */ { FIELD_CELL *bp; - FIELD_CELL *split; + const FIELD_CELL *split; int chars_to_be_wrapped; int chars_to_remain_on_line; @@ -2633,7 +2634,7 @@ FE_New_Line(FORM *form) { FIELD *field = form->current; - FIELD_CELL *bp, *t; + FIELD_CELL *bp; bool Last_Row = ((field->drows - 1) == form->currow); T((T_CALLED("FE_New_Line(%p)"), (void *)form)); @@ -2682,6 +2683,7 @@ } else { + const FIELD_CELL *t; bool May_Do_It = !Last_Row && Is_There_Room_For_A_Line(form); if (!(May_Do_It || Growable(field))) @@ -2810,7 +2812,7 @@ static int FE_Delete_Previous(FORM *form) { - FIELD *field = form->current; + const FIELD *field = form->current; T((T_CALLED("FE_Delete_Previous(%p)"), (void *)form)); if (First_Position_In_Current_Field(form)) @@ -2818,7 +2820,8 @@ if ((--(form->curcol)) < 0) { - FIELD_CELL *this_line, *prev_line, *prev_end, *this_end; + FIELD_CELL *this_line, *prev_line; + const FIELD_CELL *prev_end, *this_end; int this_row = form->currow; form->curcol++; @@ -2898,9 +2901,9 @@ static int FE_Delete_Word(FORM *form) { - FIELD *field = form->current; + const FIELD *field = form->current; FIELD_CELL *bp = Address_Of_Current_Row_In_Buffer(form); - FIELD_CELL *ep = bp + field->dcols; + const FIELD_CELL *ep = bp + field->dcols; FIELD_CELL *cp = bp + form->curcol; FIELD_CELL *s; @@ -4440,7 +4443,7 @@ { MEVENT event; WINDOW *win = form->win ? form->win : StdScreen(Get_Form_Screen(form)); - WINDOW *sub = form->sub ? form->sub : win; + const WINDOW *sub = form->sub ? form->sub : win; getmouse(&event); if ((event.bstate & (BUTTON1_CLICKED | @@ -4641,7 +4644,7 @@ { MEVENT event; WINDOW *win = form->win ? form->win : StdScreen(Get_Form_Screen(form)); - WINDOW *sub = form->sub ? form->sub : win; + const WINDOW *sub = form->sub ? form->sub : win; getmouse(&event); if ((event.bstate & (BUTTON1_CLICKED | @@ -4755,7 +4758,7 @@ int len; #if USE_WIDEC_SUPPORT - FIELD_CELL *widevalue = 0; + FIELD_CELL *widevalue = NULL; #endif T((T_CALLED("set_field_buffer(%p,%d,%s)"), (void *)field, buffer, _nc_visbuf(value))); @@ -4804,7 +4807,7 @@ wclear(field->working); (void)mvwaddstr(field->working, 0, 0, value); - if ((widevalue = typeCalloc(FIELD_CELL, len + 1)) == 0) + if ((widevalue = typeCalloc(FIELD_CELL, len + 1)) == NULL) { RETURN(E_SYSTEM_ERROR); } @@ -4866,7 +4869,7 @@ FORM_EXPORT(char *) field_buffer(const FIELD *field, int buffer) { - char *result = 0; + char *result = NULL; T((T_CALLED("field_buffer(%p,%d)"), (const void *)field, buffer)); @@ -4887,14 +4890,14 @@ size_t next; init_mb(state); - next = _nc_wcrtomb(0, data[n].chars[0], &state); + next = _nc_wcrtomb(NULL, data[n].chars[0], &state); if (next > 0) need += next; } } /* allocate a place to store the expanded string */ - if (field->expanded[buffer] != 0) + if (field->expanded[buffer] != NULL) free(field->expanded[buffer]); field->expanded[buffer] = typeMalloc(char, need + 1); @@ -4906,7 +4909,7 @@ * contain embedded wide-character extensions). Change the null-padding * to blanks as needed. */ - if ((result = field->expanded[buffer]) != 0) + if ((result = field->expanded[buffer]) != NULL) { wclear(field->working); wmove(field->working, 0, 0); @@ -4934,8 +4937,8 @@ FORM_EXPORT(wchar_t *) _nc_Widen_String(char *source, int *lengthp) { - wchar_t *result = 0; - wchar_t wch; + wchar_t *result = NULL; + wchar_t wch = 0; size_t given = strlen(source); size_t tries; int pass; @@ -4996,7 +4999,7 @@ result = typeCalloc(wchar_t, need); *lengthp = (int)need; - if (result == 0) + if (result == NULL) break; } } diff --git a/contrib/ncurses/form/frm_post.c b/contrib/ncurses/form/frm_post.c --- a/contrib/ncurses/form/frm_post.c +++ b/contrib/ncurses/form/frm_post.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2010,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_post.c,v 1.14 2020/05/24 01:40:20 anonymous.maarten Exp $") +MODULE_ID("$Id: frm_post.c,v 1.15 2024/07/27 18:35:02 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -51,7 +51,7 @@ FORM_EXPORT(int) post_form(FORM *form) { - WINDOW *formwin; + const WINDOW *formwin; int err; int page; diff --git a/contrib/ncurses/form/frm_req_name.c b/contrib/ncurses/form/frm_req_name.c --- a/contrib/ncurses/form/frm_req_name.c +++ b/contrib/ncurses/form/frm_req_name.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2012,2015 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,7 +38,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_req_name.c,v 1.23 2021/06/17 21:11:08 tom Exp $") +MODULE_ID("$Id: frm_req_name.c,v 1.24 2024/12/07 23:00:37 tom Exp $") #define DATA(s) { s } @@ -153,7 +153,7 @@ T((T_CALLED("form_request_by_name(%s)"), _nc_visbuf(str))); - if (str != 0 && (i = strlen(str)) != 0) + if (str != NULL && (i = strlen(str)) != 0) { char buf[16]; /* longest name is 10 chars */ diff --git a/contrib/ncurses/form/frm_sub.c b/contrib/ncurses/form/frm_sub.c --- a/contrib/ncurses/form/frm_sub.c +++ b/contrib/ncurses/form/frm_sub.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_sub.c,v 1.15 2021/06/17 21:20:30 tom Exp $") +MODULE_ID("$Id: frm_sub.c,v 1.16 2024/07/27 18:35:02 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -54,9 +54,8 @@ else { #if NCURSES_SP_FUNCS - FORM *f = Normalize_Form(form); - - f->sub = win ? win : StdScreen(Get_Form_Screen(f)); + (void) Normalize_Form(form); + form->sub = win ? win : StdScreen(Get_Form_Screen(form)); RETURN(E_OK); #else Normalize_Form(form)->sub = win; @@ -76,12 +75,10 @@ FORM_EXPORT(WINDOW *) form_sub(const FORM *form) { - const FORM *f; - T((T_CALLED("form_sub(%p)"), (const void *)form)); - f = Normalize_Form(form); - returnWin(Get_Form_Window(f)); + (void) Normalize_Form(form); + returnWin(Get_Form_Window(form)); } /* frm_sub.c ends here */ diff --git a/contrib/ncurses/form/frm_win.c b/contrib/ncurses/form/frm_win.c --- a/contrib/ncurses/form/frm_win.c +++ b/contrib/ncurses/form/frm_win.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_win.c,v 1.19 2021/06/17 21:20:30 tom Exp $") +MODULE_ID("$Id: frm_win.c,v 1.20 2024/07/27 18:35:02 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -54,9 +54,8 @@ else { #if NCURSES_SP_FUNCS - FORM *f = Normalize_Form(form); - - f->win = win ? win : StdScreen(Get_Form_Screen(f)); + (void) Normalize_Form(form); + form->win = win ? win : StdScreen(Get_Form_Screen(form)); RETURN(E_OK); #else Normalize_Form(form)->win = win; @@ -77,15 +76,14 @@ form_win(const FORM *form) { WINDOW *result; - const FORM *f; T((T_CALLED("form_win(%p)"), (const void *)form)); - f = Normalize_Form(form); + (void) Normalize_Form(form); #if NCURSES_SP_FUNCS - result = (f->win ? f->win : StdScreen(Get_Form_Screen(f))); + result = (form->win ? form->win : StdScreen(Get_Form_Screen(form))); #else - result = (f->win ? f->win : stdscr); + result = (form->win ? form->win : stdscr); #endif returnWin(result); } diff --git a/contrib/ncurses/form/fty_enum.c b/contrib/ncurses/form/fty_enum.c --- a/contrib/ncurses/form/fty_enum.c +++ b/contrib/ncurses/form/fty_enum.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -35,7 +35,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_enum.c,v 1.33 2021/06/17 21:11:08 tom Exp $") +MODULE_ID("$Id: fty_enum.c,v 1.36 2025/11/15 18:12:38 tom Exp $") typedef struct { @@ -104,7 +104,7 @@ argp->kwds = typeMalloc(char *, cnt + 1); kp = kwds; - if ((kptarget = argp->kwds) != 0) + if ((kptarget = argp->kwds) != NULL) { while (kp && (*kp)) { @@ -168,7 +168,7 @@ char **kp = ap->kwds; result->kwds = typeMalloc(char *, 1 + ap->count); - if ((kptarget = result->kwds) != 0) + if ((kptarget = result->kwds) != NULL) { while (kp && (*kp)) { @@ -209,6 +209,7 @@ } assert(cnt == ap->count); free(ap->kwds); + (void) cnt; } free(argp); } @@ -291,21 +292,21 @@ char **kwds = ((const enumARG *)argp)->kwds; bool ccase = ((const enumARG *)argp)->checkcase; bool unique = ((const enumARG *)argp)->checkunique; - unsigned char *bp = (unsigned char *)field_buffer(field, 0); - char *s, *t, *p; + const unsigned char *bp = (unsigned char *)field_buffer(field, 0); + const char *s, *t, *p; while (kwds && (s = (*kwds++))) { int res; - if ((res = Compare((unsigned char *)s, bp, ccase)) != NOMATCH) + if ((res = Compare((const unsigned char *)s, bp, ccase)) != NOMATCH) { p = t = s; /* t is at least a partial match */ if ((unique && res != EXACT)) { while (kwds && (p = *kwds++)) { - if ((res = Compare((unsigned char *)p, bp, ccase)) != NOMATCH) + if ((res = Compare((const unsigned char *)p, bp, ccase)) != NOMATCH) { if (res == EXACT) { @@ -313,7 +314,7 @@ break; } else - t = (char *)0; + t = NULL; } } } @@ -347,12 +348,13 @@ { const enumARG *args = (const enumARG *)argp; char **kwds = args->kwds; - bool ccase = args->checkcase; - int cnt = args->count; - unsigned char *bp = (unsigned char *)field_buffer(field, 0); + const unsigned char *bp = (const unsigned char *)field_buffer(field, 0); if (kwds) { + int cnt = args->count; + bool ccase = args->checkcase; + while (cnt--) { if (Compare((unsigned char *)(*kwds++), bp, ccase) == EXACT) @@ -386,26 +388,25 @@ const enumARG *args = (const enumARG *)argp; int cnt = args->count; char **kwds = &args->kwds[cnt - 1]; + const unsigned char *bp = (const unsigned char *)field_buffer(field, 0); + bool ccase = args->checkcase; - unsigned char *bp = (unsigned char *)field_buffer(field, 0); - if (kwds) + while (cnt--) { - while (cnt--) - { - if (Compare((unsigned char *)(*kwds--), bp, ccase) == EXACT) - break; - } + if (Compare((unsigned char *)(*kwds--), bp, ccase) == EXACT) + break; + } - if (cnt <= 0) - kwds = &args->kwds[args->count - 1]; + if (cnt <= 0) + kwds = &args->kwds[args->count - 1]; - if ((cnt >= 0) || (Compare((const unsigned char *)dummy, bp, ccase) == EXACT)) - { - set_field_buffer(field, 0, *kwds); - return TRUE; - } + if ((cnt >= 0) || (Compare((const unsigned char *)dummy, bp, ccase) == EXACT)) + { + set_field_buffer(field, 0, *kwds); + return TRUE; } + return FALSE; } diff --git a/contrib/ncurses/form/fty_generic.c b/contrib/ncurses/form/fty_generic.c --- a/contrib/ncurses/form/fty_generic.c +++ b/contrib/ncurses/form/fty_generic.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2021,2024 Thomas E. Dickey * * Copyright 2008-2012,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -35,7 +35,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_generic.c,v 1.15 2021/03/27 23:49:53 tom Exp $") +MODULE_ID("$Id: fty_generic.c,v 1.17 2024/12/07 23:12:11 tom Exp $") /* * This is not a full implementation of a field type, but adds some @@ -170,7 +170,10 @@ { TypeArgument *res = (TypeArgument *)0; - if (typ != 0 && (typ->status & _HAS_ARGS) != 0 && err != 0 && argiterator != 0) + if (typ != NULL + && (typ->status & _HAS_ARGS) != 0 + && err != NULL + && argiterator != NULL) { if (typ->status & _LINKED_TYPE) { @@ -189,14 +192,14 @@ else { assert(typ->genericarg != (void *)0); - if (typ->genericarg == 0) + if (typ->genericarg == NULL) *err += 1; else { void *argp; int valid = argiterator(&argp); - if (valid == 0 || argp == 0 || + if (valid == 0 || argp == NULL || !(res = (TypeArgument *)typ->genericarg(argp))) { *err += 1; @@ -231,7 +234,7 @@ if (field) { - if (field && field->type) + if (field->type) _nc_Free_Type(field); field->type = ftyp; @@ -282,7 +285,7 @@ int code = E_SYSTEM_ERROR; WINDOW *res = (WINDOW *)0; - if (form != 0 && pRow != 0 && pCol != 0) + if (form != NULL && pRow != NULL && pCol != NULL) { *pRow = form->currow; *pCol = form->curcol; diff --git a/contrib/ncurses/form/fty_int.c b/contrib/ncurses/form/fty_int.c --- a/contrib/ncurses/form/fty_int.c +++ b/contrib/ncurses/form/fty_int.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020,2021,2024 Thomas E. Dickey * * Copyright 1998-2010,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -35,7 +35,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_int.c,v 1.33 2021/06/17 21:11:08 tom Exp $") +MODULE_ID("$Id: fty_int.c,v 1.36 2024/12/21 17:14:36 tom Exp $") #if USE_WIDEC_SUPPORT #define isDigit(c) (iswdigit((wint_t)(c)) || isdigit(UChar(c))) @@ -73,7 +73,7 @@ Generic_This_Type(void *arg) { thisARG *argp = (thisARG *)0; - thisARG *param = (thisARG *)arg; + const thisARG *param = (thisARG *)arg; if (param) { @@ -169,7 +169,7 @@ long high = argi->high; int prec = argi->precision; unsigned char *bp = (unsigned char *)field_buffer(field, 0); - char *s = (char *)bp; + const char *s = (char *)bp; bool result = FALSE; while (*bp == ' ') @@ -184,7 +184,7 @@ int len; wchar_t *list = _nc_Widen_String((char *)bp, &len); - if (list != 0) + if (list != NULL) { bool blank = FALSE; int n; @@ -235,10 +235,10 @@ } if (result) { - char buf[100]; + char buf[MAX_DIGITS + 3]; _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) - "%.*ld", (prec > 0 ? prec : 0), val); + "%.*ld", MaxDigits(prec), val); set_field_buffer(field, 0, buf); } } diff --git a/contrib/ncurses/form/fty_num.c b/contrib/ncurses/form/fty_num.c --- a/contrib/ncurses/form/fty_num.c +++ b/contrib/ncurses/form/fty_num.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2020,2021 Thomas E. Dickey * + * Copyright 2019-2021,2024 Thomas E. Dickey * * Copyright 1998-2010,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -35,7 +35,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_num.c,v 1.37 2021/03/27 23:49:58 tom Exp $") +MODULE_ID("$Id: fty_num.c,v 1.40 2024/12/21 17:16:09 tom Exp $") #if HAVE_LOCALE_H #include @@ -84,7 +84,7 @@ Generic_This_Type(void *arg) { thisARG *argn = (thisARG *)0; - thisPARM *args = (thisPARM *)arg; + const thisPARM *args = (thisPARM *)arg; if (args) { @@ -187,8 +187,8 @@ double high = argn->high; int prec = argn->precision; unsigned char *bp = (unsigned char *)field_buffer(field, 0); - char *s = (char *)bp; - struct lconv *L = argn->L; + const char *s = (char *)bp; + const struct lconv *L = argn->L; bool result = FALSE; while (*bp == ' ') @@ -203,7 +203,7 @@ int len; wchar_t *list = _nc_Widen_String((char *)bp, &len); - if (list != 0) + if (list != NULL) { bool blank = FALSE; int state = 0; @@ -273,10 +273,10 @@ } if (result) { - char buf[64]; + char buf[MAX_DIGITS * 6]; _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) - "%.*f", (prec > 0 ? prec : 0), val); + "%.*f", MaxDigits(prec), val); set_field_buffer(field, 0, buf); } } diff --git a/contrib/ncurses/form/fty_regex.c b/contrib/ncurses/form/fty_regex.c --- a/contrib/ncurses/form/fty_regex.c +++ b/contrib/ncurses/form/fty_regex.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2021,2024 Thomas E. Dickey * * Copyright 1998-2012,2015 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -35,7 +35,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_regex.c,v 1.33 2021/08/14 15:01:52 tom Exp $") +MODULE_ID("$Id: fty_regex.c,v 1.34 2024/12/07 23:02:27 tom Exp $") #if HAVE_REGEX_H_FUNCS || HAVE_LIB_PCRE2 /* We prefer POSIX regex */ @@ -157,12 +157,12 @@ if (preg) { T((T_CREATE("RegExp_Arg %p"), (void *)preg)); - if (((preg->pRegExp = typeMalloc(regex_t, 1)) != 0) + if (((preg->pRegExp = typeMalloc(regex_t, 1)) != NULL) && !regcomp(preg->pRegExp, rx, (REG_EXTENDED | REG_NOSUB | REG_NEWLINE))) { T((T_CREATE("regex_t %p"), (void *)preg->pRegExp)); - if ((preg->refCount = typeMalloc(unsigned long, 1)) != 0) + if ((preg->refCount = typeMalloc(unsigned long, 1)) != NULL) *(preg->refCount) = 1; } else diff --git a/contrib/ncurses/include/Caps b/contrib/ncurses/include/Caps --- a/contrib/ncurses/include/Caps +++ b/contrib/ncurses/include/Caps @@ -1,5 +1,5 @@ ############################################################################## -# Copyright 2019-2023,2024 Thomas E. Dickey # +# Copyright 2019-2024,2025 Thomas E. Dickey # # Copyright 1998-2015,2016 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -30,7 +30,7 @@ # Author: Zeyd M. Ben-Halim 1992,1995 # and: Eric S. Raymond # -# $Id: Caps,v 1.56 2024/04/20 21:05:02 tom Exp $ +# $Id: Caps,v 1.62 2025/11/12 01:06:36 Branden.Robinson Exp $ # # This is the master termcap/terminfo capability table. # @@ -167,8 +167,10 @@ # The tables are a tight fit on traditional man(7) implementations that # use a line length of 65n, and the "Description" column has little room # within which the formatter can make breaking or adjustment decisions. -# Words like "micro_..._address" and "parm_..._micro" don't break. -# Reducing the inter-column gaps to 2 ens gives them enough room. --GBR +# (MKterminfo.sh causes such columns to be formatted in tbl(1) text +# blocks.) Words like "micro_..._address" and "parm_..._micro" don't +# break. Reducing the inter-column gaps to 2 ens gives them enough +# room. --GBR # ############################################################################# # @@ -241,12 +243,15 @@ #%behavior, #%for instance if the string contains percent signs. #%. +#%.br +#%.if n .ne 4v +#%.if t .ne 3v #%.PP #%.TS #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%Boolean Capability Name TI TC Description #%_ @@ -294,7 +299,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%Numeric Capability Name TI TC Description #%_ @@ -311,7 +316,10 @@ label_width lw num lw - - ----- columns in each label max_attributes ma num ma - - YBC-- maximum combined attributes terminal can handle maximum_windows wnum num MW - - ----- maximum number of definable windows -# These came in with SVr4's color support +# The following were introduced by SVr3.2's color support. +# https://github.com/ryanwoodsmall/oldsysv/blob/\ +# e68293af91e2dc39f5f29c20d7e429f9e0cabc75/\ +# sysvr3/32/usr/src/lib/libcurses/screen/caps#L64 max_colors colors num Co - - ----- maximum number of colors on screen max_pairs pairs num pa - - ----- maximum number of color-pairs on the screen no_color_video ncv num NC - - ----- video attributes that cannot be used with colors @@ -327,7 +335,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%Numeric Capability Name TI TC Description #%_ @@ -355,7 +363,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%String Capability Name TI TC Description #%_ @@ -424,7 +432,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. key_eic krmir str kM KEY_EIC 0514 -B-G-* sent by rmir or smir in insert mode key_eol kel str kE KEY_EOL 0517 -B-G-* clear-to-end-of-line key key_eos ked str kS KEY_EOS 0516 -B-G-* clear-to-end-of-screen key @@ -451,8 +459,8 @@ key_sr kri str kR KEY_SR 0521 -B-G-* scroll-backward key key_stab khts str kT KEY_STAB 0524 -B-G-* set-tab key key_up kcuu1 str ku KEY_UP 0403 YBCGE up-arrow key -keypad_local rmkx str ke - - YBCGE leave keyboard transmit mode -keypad_xmit smkx str ks - - YBCGE enter keyboard transmit mode +keypad_local rmkx str ke - - YBCGE leave keypad transmit mode +keypad_xmit smkx str ks - - YBCGE enter keypad transmit mode lab_f0 lf0 str l0 - - -B-G-* label on function key f0 if not f0 lab_f1 lf1 str l1 - - -B-G-* label on function key f1 if not f1 lab_f10 lf10 str la - - ----- label on function key f10 if not f10 @@ -490,7 +498,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. reset_3string rs3 str r3 - - -B--- reset string reset_file rf str rf - - -B--- name of reset file restore_cursor rc str rc - - YBCG- restore cursor to position of last save_cursor @@ -560,7 +568,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. key_sbeg kBEG str &9 KEY_SBEG 0572 ----- shifted begin key key_scancel kCAN str &0 KEY_SCANCEL 0573 ----- shifted cancel key key_scommand kCMD str *1 KEY_SCOMMAND 0574 ----- shifted command key @@ -626,7 +634,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. key_f43 kf43 str FX KEY_F(43) - ----E F43 function key key_f44 kf44 str FY KEY_F(44) - ----E F44 function key key_f45 kf45 str FZ KEY_F(45) - ----E F45 function key @@ -698,7 +706,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. enter_draft_quality sdrfq str ZG - - ----- Enter draft-quality mode enter_italics_mode sitm str ZH - - ----- Enter italic mode enter_leftward_mode slm str ZI - - ----- Start leftward carriage motion @@ -754,7 +762,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%String Capability Name TI TC Description #%_ @@ -810,7 +818,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%String Capability Name TI TC Description #%_ diff --git a/contrib/ncurses/include/Caps.hpux11 b/contrib/ncurses/include/Caps.hpux11 --- a/contrib/ncurses/include/Caps.hpux11 +++ b/contrib/ncurses/include/Caps.hpux11 @@ -1,5 +1,5 @@ ############################################################################## -# Copyright 2019-2023,2024 Thomas E. Dickey # +# Copyright 2019-2024,2025 Thomas E. Dickey # # Copyright 2002-2015,2016 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -29,7 +29,7 @@ # # Author: Thomas Dickey # -# $Id: Caps.hpux11,v 1.26 2024/04/20 21:05:02 tom Exp $ +# $Id: Caps.hpux11,v 1.28 2025/11/12 01:27:41 tom Exp $ # # This is an adaptation of ncurses' termcap/terminfo capability table, which # is designed to align with HPUX 11.x's terminfo. @@ -246,7 +246,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%Boolean Capability Name TI TC Description #%_ @@ -295,7 +295,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%Numeric Capability Name TI TC Description #%_ @@ -329,7 +329,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%Numeric Capability Name TI TC Description #%_ @@ -357,7 +357,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%String Capability Name TI TC Description #%_ @@ -426,7 +426,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. key_eic krmir str kM KEY_EIC 0514 -B-G-* sent by rmir or smir in insert mode key_eol kel str kE KEY_EOL 0517 -B-G-* clear-to-end-of-line key key_eos ked str kS KEY_EOS 0516 -B-G-* clear-to-end-of-screen key @@ -492,7 +492,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. reset_3string rs3 str r3 - - -B--- reset string reset_file rf str rf - - -B--- name of reset file restore_cursor rc str rc - - YBCG- restore cursor to position of last save_cursor @@ -561,7 +561,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. key_f43 kf43 str FX KEY_F(43) - ----E F43 function key key_f44 kf44 str FY KEY_F(44) - ----E F44 function key key_f45 kf45 str FZ KEY_F(45) - ----E F45 function key @@ -625,7 +625,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. key_sbeg kBEG str &9 KEY_SBEG 0572 ----- shifted begin key key_scancel kCAN str &0 KEY_SCANCEL 0573 ----- shifted cancel key key_scommand kCMD str *1 KEY_SCOMMAND 0574 ----- shifted command key @@ -706,7 +706,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. enter_draft_quality sdrfq str ZG - - ----- Enter draft-quality mode enter_italics_mode sitm str ZH - - ----- Enter italic mode enter_leftward_mode slm str ZI - - ----- Start leftward carriage motion @@ -762,7 +762,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%String Capability Name TI TC Description #%_ @@ -820,7 +820,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%String Capability Name TI TC Description #%_ diff --git a/contrib/ncurses/include/Caps.aix4 b/contrib/ncurses/include/Caps.aix4 --- a/contrib/ncurses/include/Caps.aix4 +++ b/contrib/ncurses/include/Caps.aix4 @@ -1,5 +1,5 @@ ############################################################################## -# Copyright 2019-2023,2024 Thomas E. Dickey # +# Copyright 2019-2024,2025 Thomas E. Dickey # # Copyright 2001-2015,2016 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -29,7 +29,7 @@ # # Author: Thomas Dickey # -# $Id: Caps.aix4,v 1.28 2024/04/20 21:05:02 tom Exp $ +# $Id: Caps.aix4,v 1.30 2025/11/12 01:27:41 tom Exp $ # # This is an adaptation of ncurses' termcap/terminfo capability table, which # is designed to align with AIX 4.x's terminfo. @@ -246,7 +246,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%Boolean Capability Name TI TC Description #%_ @@ -294,7 +294,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%Numeric Capability Name TI TC Description #%_ @@ -327,7 +327,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%Numeric Capability Name TI TC Description #%_ @@ -355,7 +355,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%String Capability Name TI TC Description #%_ @@ -424,7 +424,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. key_eic krmir str kM KEY_EIC 0514 -B-G-* sent by rmir or smir in insert mode key_eol kel str kE KEY_EOL 0517 -B-G-* clear-to-end-of-line key key_eos ked str kS KEY_EOS 0516 -B-G-* clear-to-end-of-screen key @@ -490,7 +490,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. reset_3string rs3 str r3 - - -B--- reset string reset_file rf str rf - - -B--- name of reset file restore_cursor rc str rc - - YBCG- restore cursor to position of last save_cursor @@ -642,7 +642,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. key_f43 kf43 str FX KEY_F(43) - ----E F43 function key key_f44 kf44 str FY KEY_F(44) - ----E F44 function key key_f45 kf45 str FZ KEY_F(45) - ----E F45 function key @@ -719,7 +719,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. key_sbeg kBEG str &9 KEY_SBEG 0572 ----- shifted begin key key_scancel kCAN str &0 KEY_SCANCEL 0573 ----- shifted cancel key key_scommand kCMD str *1 KEY_SCOMMAND 0574 ----- shifted command key @@ -800,7 +800,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. enter_draft_quality sdrfq str ZG - - ----- Enter draft-quality mode enter_italics_mode sitm str ZH - - ----- Enter italic mode enter_leftward_mode slm str ZI - - ----- Start leftward carriage motion @@ -856,7 +856,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%String Capability Name TI TC Description #%_ @@ -912,7 +912,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%String Capability Name TI TC Description #%_ diff --git a/contrib/ncurses/include/Caps.keys b/contrib/ncurses/include/Caps.keys --- a/contrib/ncurses/include/Caps.keys +++ b/contrib/ncurses/include/Caps.keys @@ -1,5 +1,5 @@ ############################################################################## -# Copyright 2019-2023,2024 Thomas E. Dickey # +# Copyright 2019-2024,2025 Thomas E. Dickey # # Copyright 2001-2015,2016 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -30,7 +30,7 @@ # Author: Thomas Dickey # and: Ilya Zakharevich # -# $Id: Caps.keys,v 1.25 2024/04/20 21:05:02 tom Exp $ +# $Id: Caps.keys,v 1.27 2025/11/12 01:27:41 tom Exp $ # # This is an adaptation of ncurses' termcap/terminfo capability table, which # is illustrates an experimental extension to describe alt-, shift- and @@ -249,7 +249,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%Boolean Capability Name TI TC Description #%_ @@ -297,7 +297,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%Numeric Capability Name TI TC Description #%_ @@ -330,7 +330,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%Numeric Capability Name TI TC Description #%_ @@ -358,7 +358,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%String Capability Name TI TC Description #%_ @@ -427,7 +427,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. key_eic krmir str kM KEY_EIC 0514 -B-G-* sent by rmir or smir in insert mode key_eol kel str kE KEY_EOL 0517 -B-G-* clear-to-end-of-line key key_eos ked str kS KEY_EOS 0516 -B-G-* clear-to-end-of-screen key @@ -493,7 +493,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. reset_3string rs3 str r3 - - -B--- reset string reset_file rf str rf - - -B--- name of reset file restore_cursor rc str rc - - YBCG- restore cursor to position of last save_cursor @@ -563,7 +563,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. key_sbeg kBEG str &9 KEY_SBEG 0572 ----- shifted begin key key_scancel kCAN str &0 KEY_SCANCEL 0573 ----- shifted cancel key key_scommand kCMD str *1 KEY_SCOMMAND 0574 ----- shifted command key @@ -629,7 +629,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. key_f43 kf43 str FX KEY_F(43) - ----E F43 function key key_f44 kf44 str FY KEY_F(44) - ----E F44 function key key_f45 kf45 str FZ KEY_F(45) - ----E F45 function key @@ -789,7 +789,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. enter_draft_quality sdrfq str ZG - - ----- Enter draft-quality mode enter_italics_mode sitm str ZH - - ----- Enter italic mode enter_leftward_mode slm str ZI - - ----- Start leftward carriage motion @@ -845,7 +845,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%String Capability Name TI TC Description #%_ @@ -901,7 +901,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%String Capability Name TI TC Description #%_ diff --git a/contrib/ncurses/include/Caps.osf1r5 b/contrib/ncurses/include/Caps.osf1r5 --- a/contrib/ncurses/include/Caps.osf1r5 +++ b/contrib/ncurses/include/Caps.osf1r5 @@ -1,5 +1,5 @@ ############################################################################## -# Copyright 2019-2023,2024 Thomas E. Dickey # +# Copyright 2019-2024,2025 Thomas E. Dickey # # Copyright 2002-2015,2016 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -29,7 +29,7 @@ # # Author: Thomas Dickey # -# $Id: Caps.osf1r5,v 1.24 2024/04/20 21:05:02 tom Exp $ +# $Id: Caps.osf1r5,v 1.26 2025/11/12 01:27:41 tom Exp $ # # This is an adaptation of ncurses' termcap/terminfo capability table, which # is designed to align with OSF/1 version 5 (Tru64) terminfo. @@ -246,7 +246,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%Boolean Capability Name TI TC Description #%_ @@ -294,7 +294,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%Numeric Capability Name TI TC Description #%_ @@ -338,7 +338,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. #%\& Code \& #%String Capability Name TI TC Description #%_ @@ -407,7 +407,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. key_eic krmir str kM KEY_EIC 0514 -B-G-* sent by rmir or smir in insert mode key_eol kel str kE KEY_EOL 0517 -B-G-* clear-to-end-of-line key key_eos ked str kS KEY_EOS 0516 -B-G-* clear-to-end-of-screen key @@ -473,7 +473,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. reset_3string rs3 str r3 - - -B--- reset string reset_file rf str rf - - -B--- name of reset file restore_cursor rc str rc - - YBCG- restore cursor to position of last save_cursor @@ -632,7 +632,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. enter_draft_quality sdrfq str ZG - - ----- Enter draft-quality mode enter_italics_mode sitm str ZH - - ----- Enter italic mode enter_leftward_mode slm str ZI - - ----- Start leftward carriage motion @@ -682,7 +682,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. key_f43 kf43 str FX KEY_F(43) - ----E F43 function key key_f44 kf44 str FY KEY_F(44) - ----E F44 function key key_f45 kf45 str FZ KEY_F(45) - ----E F45 function key @@ -724,7 +724,7 @@ #%.TE #%.TS #%center; -#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx. +#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x. key_sbeg kBEG str &9 KEY_SBEG 0572 ----- shifted begin key key_scancel kCAN str &0 KEY_SCANCEL 0573 ----- shifted cancel key key_scommand kCMD str *1 KEY_SCOMMAND 0574 ----- shifted command key diff --git a/contrib/ncurses/include/Caps.uwin b/contrib/ncurses/include/Caps.uwin --- a/contrib/ncurses/include/Caps.uwin +++ b/contrib/ncurses/include/Caps.uwin @@ -1,5 +1,5 @@ ############################################################################## -# Copyright 2019-2023,2024 Thomas E. Dickey # +# Copyright 2019-2024,2025 Thomas E. Dickey # # Copyright 2001-2015,2016 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -29,7 +29,7 @@ # # Author: Thomas Dickey # -# $Id: Caps.uwin,v 1.23 2024/04/20 21:05:02 tom Exp $ +# $Id: Caps.uwin,v 1.25 2025/11/12 01:06:36 Branden.Robinson Exp $ # # This is an adaptation of ncurses' termcap/terminfo capability table, which # is designed to align with U/Win's terminfo. @@ -246,7 +246,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(24n)2 Lbw(7n)2 Lb2 Lx. +#%Lbw(24n)2 Lbw(7n)2 Lb2 Lw(17n)x. #%\& Code \& #%Boolean Capability Name TI TC Description #%_ @@ -287,7 +287,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(24n)2 Lbw(7n)2 Lb2 Lx. +#%Lbw(24n)2 Lbw(7n)2 Lb2 Lw(17n)x. #%\& Code \& #%Numeric Capability Name TI TC Description #%_ @@ -304,7 +304,7 @@ label_width lw num lw - - ----- columns in each label buttons btns num BT - - ----- number of buttons on mouse #max_attributes ma num ma - - YBC-- maximum combined attributes terminal can handle -#maximum_windows wnum num MW - - ----- maximum number of defineable windows +#maximum_windows wnum num MW - - ----- maximum number of definable windows # These came in with SVr4's color support max_colors colors num Co - - ----- maximum number of colors on screen max_pairs pairs num pa - - ----- maximum number of color-pairs on the screen @@ -316,7 +316,7 @@ #%center; #%Lb Cb S Lb #%Lb Lb Lb Lb -#%Lbw(24n)2 Lbw(7n)2 Lb2 Lx. +#%Lbw(24n)2 Lbw(7n)2 Lb2 Lw(17n)x. #%\& Code \& #%String Capability Name TI TC Description #%_ @@ -385,7 +385,7 @@ #%.TE #%.TS #%center; -#%Lbw(24n)2 Lbw(7n)2 Lb2 Lx. +#%Lbw(24n)2 Lbw(7n)2 Lb2 Lw(17n)x. key_eic krmir str kM KEY_EIC 0514 -B-G-* sent by rmir or smir in insert mode key_eol kel str kE KEY_EOL 0517 -B-G-* clear-to-end-of-line key key_eos ked str kS KEY_EOS 0516 -B-G-* clear-to-end-of-screen key @@ -451,7 +451,7 @@ #%.TE #%.TS #%center; -#%Lbw(24n)2 Lbw(7n)2 Lb2 Lx. +#%Lbw(24n)2 Lbw(7n)2 Lb2 Lw(17n)x. reset_3string rs3 str r3 - - -B--- reset string reset_file rf str rf - - -B--- name of reset file restore_cursor rc str rc - - YBCG- restore cursor to position of last save_cursor @@ -521,7 +521,7 @@ #%.TE #%.TS #%center; -#%Lbw(24n)2 Lbw(7n)2 Lb2 Lx. +#%Lbw(24n)2 Lbw(7n)2 Lb2 Lw(17n)x. key_sbeg kBEG str &9 KEY_SBEG 0572 ----- shifted begin key key_scancel kCAN str &0 KEY_SCANCEL 0573 ----- shifted cancel key key_scommand kCMD str *1 KEY_SCOMMAND 0574 ----- shifted command key @@ -587,7 +587,7 @@ #%.TE #%.TS #%center; -#%Lbw(24n)2 Lbw(7n)2 Lb2 Lx. +#%Lbw(24n)2 Lbw(7n)2 Lb2 Lw(17n)x. key_f43 kf43 str FX KEY_F(43) - ----E F43 function key key_f44 kf44 str FY KEY_F(44) - ----E F44 function key key_f45 kf45 str FZ KEY_F(45) - ----E F45 function key diff --git a/contrib/ncurses/include/MKkey_defs.sh b/contrib/ncurses/include/MKkey_defs.sh --- a/contrib/ncurses/include/MKkey_defs.sh +++ b/contrib/ncurses/include/MKkey_defs.sh @@ -1,7 +1,7 @@ #! /bin/sh -# $Id: MKkey_defs.sh,v 1.24 2024/01/19 12:26:17 tom Exp $ +# $Id: MKkey_defs.sh,v 1.25 2025/06/14 14:44:56 tom Exp $ ############################################################################## -# Copyright 2019-2022,2024 Thomas E. Dickey # +# Copyright 2019-2024,2025 Thomas E. Dickey # # Copyright 2001-2013,2017 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -110,8 +110,8 @@ } BEGIN { - maxkey='$maxkey'; - pass='$pass'; + maxkey='"$maxkey"'; + pass='"$pass"'; key_max=1; bits=1; while (key_max < maxkey) { diff --git a/contrib/ncurses/include/MKterm.h.awk.in b/contrib/ncurses/include/MKterm.h.awk.in --- a/contrib/ncurses/include/MKterm.h.awk.in +++ b/contrib/ncurses/include/MKterm.h.awk.in @@ -26,7 +26,7 @@ lcurl = "{"; rcurl = "}"; print "/****************************************************************************" - print " * Copyright 2018-2021,2023 Thomas E. Dickey *" + print " * Copyright 2018-2024,2025 Thomas E. Dickey *" print " * Copyright 1998-2013,2017 Free Software Foundation, Inc. *" print " * *" print " * Permission is hereby granted, free of charge, to any person obtaining a *" @@ -60,7 +60,7 @@ print "/* and: Thomas E. Dickey 1995-on */" print "/****************************************************************************/" print "" - print "/* $Id: MKterm.h.awk.in,v 1.85 2023/04/23 19:15:36 tom Exp $ */" + print "/* $Id: MKterm.h.awk.in,v 1.94 2025/12/26 23:33:14 tom Exp $ */" print "" print "/*" print "** term.h -- Definition of struct term" @@ -86,6 +86,7 @@ print "" print "typedef struct screen SCREEN;" print "" + print "/* configured with --enable-sp-funcs? */" print "#if @NCURSES_SP_FUNCS@" print "#undef NCURSES_SP_FUNCS" print "#define NCURSES_SP_FUNCS @NCURSES_PATCH@" @@ -115,65 +116,62 @@ print "#undef NCURSES_XNAMES" print "#define NCURSES_XNAMES @NCURSES_XNAMES@" print "" - print "/* We will use these symbols to hide differences between" + print "/* TTY, SET_TTY and GET_TTY are used internally */" + print "#ifdef NCURSES_INTERNALS" + print "" + print "/* We use these symbols to hide differences between" print " * termios/termio/sgttyb interfaces." print " */" print "#undef TTY" print "#undef SET_TTY" print "#undef GET_TTY" print "" - print "/* Assume POSIX termio if we have the header and function */" - print "/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */" - print "#if @HAVE_TERMIOS_H@ && @HAVE_TCGETATTR@" + print "#if @HAVE_TERMIOS_H@ && @HAVE_TCGETATTR@ /* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */" print "" print "#undef TERMIOS" print "#define TERMIOS 1" - print "" print "#include " print "#define TTY struct termios" print "" - print "#else /* !HAVE_TERMIOS_H */" - print "" - print "/* #if HAVE_TERMIO_H */" - print "#if @HAVE_TERMIO_H@" + print "#elif @HAVE_TERMIO_H@ /* HAVE_TERMIO_H */" print "" print "#undef TERMIOS" print "#define TERMIOS 1" - print "" print "#include " print "#define TTY struct termio" print "" - print "#else /* !HAVE_TERMIO_H */" + print "#elif (defined(_WIN32) || defined(_WIN64) || defined(__MINGW32__) || defined(__MINGW64__))" + print "" + print "#include " + print "#define TTY ConsoleMode" + print "" + print "#elif @HAVE_SGTTY_H@ /* HAVE_SGTTY_H */" print "" - print "#if (defined(_WIN32) || defined(_WIN64))" - print "#if @EXP_WIN32_DRIVER@" - print "#include " - print "#define TTY struct winconmode" - print "#else" - print "#include " - print "#define TTY struct termios" - print "#endif" - print "#else" print "#undef TERMIOS" print "#include " print "#include " print "#define TTY struct sgttyb" - print "#endif /* MINGW32 */" - print "#endif /* HAVE_TERMIO_H */" + print "" + print "#else" + print "" + print "#error no termio/termios/sgtty found" print "" print "#endif /* HAVE_TERMIOS_H */" print "" print "#ifdef TERMIOS" print "#define GET_TTY(fd, buf) tcgetattr(fd, buf)" print "#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)" - print "#elif @EXP_WIN32_DRIVER@ && (defined(_WIN32) || defined(_WIN64))" + print "/* configured with --enable-exp-win32? */" + print "#elif defined(_WIN32) || defined(_WIN64)" print "#define GET_TTY(fd, buf) _nc_console_getmode(_nc_console_fd2handle(fd),buf)" print "#define SET_TTY(fd, buf) _nc_console_setmode(_nc_console_fd2handle(fd),buf)" - print "#else" + print "#elif @HAVE_SGTTY_H@ /* HAVE_SGTTY_H */" print "#define GET_TTY(fd, buf) gtty(fd, buf)" print "#define SET_TTY(fd, buf) stty(fd, buf)" print "#endif" print "" + print "#endif /* NCURSES_INTERNALS */" + print "" print "#ifndef GCC_NORETURN" print "#define GCC_NORETURN /* nothing */" print "#endif" @@ -255,6 +253,7 @@ print "TERMINAL;" print "" if (@NCURSES_EXT_COLORS@) { + print "/* configured with --enable-ext-colors */" declare_termtype("int","2"); } else { print "#undef TERMTYPE2" @@ -268,9 +267,10 @@ print "" print "#endif /* NCURSES_INTERNALS */" print "" - print "" + print "/* configured with --enable-broken_linker and reentrancy disabled */" print "#if @BROKEN_LINKER@ && !@cf_cv_enable_reentrant@" print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;" + print "/* reentrancy enabled */" print "#elif @cf_cv_enable_reentrant@" print "NCURSES_WRAPPED_VAR(TERMINAL *, cur_term);" print "#define cur_term NCURSES_PUBLIC_VAR(cur_term())" @@ -278,6 +278,7 @@ print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;" print "#endif" print "" + print "/* configured with --enable-broken_linker or reentrancy enabled */" print "#if @BROKEN_LINKER@ || @cf_cv_enable_reentrant@" print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames);" print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes);" @@ -348,6 +349,7 @@ print "extern NCURSES_EXPORT(int) tigetflag (const char *);" print "extern NCURSES_EXPORT(int) tigetnum (const char *);" print "" + print "/* configured without --disable-tparm-varargs? */" print "#if @NCURSES_TPARM_VARARGS@ /* NCURSES_TPARM_VARARGS */" print "extern NCURSES_EXPORT(char *) tparm (const char *, ...); /* special */" print "#else" @@ -380,6 +382,7 @@ print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetflag) (SCREEN*, const char *);" print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetnum) (SCREEN*, const char *);" print "" + print "/* configured without --disable-tparm-varargs? */" print "#if @NCURSES_TPARM_VARARGS@ /* NCURSES_TPARM_VARARGS */" print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, const char *, ...); /* special */" print "#else" diff --git a/contrib/ncurses/include/Makefile.in b/contrib/ncurses/include/Makefile.in --- a/contrib/ncurses/include/Makefile.in +++ b/contrib/ncurses/include/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.53 2021/07/03 18:56:51 tom Exp $ +# $Id: Makefile.in,v 1.56 2025/10/18 13:33:46 tom Exp $ ############################################################################## -# Copyright 2019-2020,2021 Thomas E. Dickey # +# Copyright 2019-2024,2025 Thomas E. Dickey # # Copyright 1998-2013,2015 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -44,14 +44,14 @@ VPATH = @srcdir@ THIS = Makefile -DESTDIR = @DESTDIR@ +@SET_DESTDIR@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ includedir = @includedir@ includesubdir = @includesubdir@ -INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) +INCLUDEDIR = $(DESTDIR)$(includedir@MERGE_PREFIX@)$(includesubdir) INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -78,6 +78,7 @@ CONFIG_SRC = \ MKterm.h.awk \ curses.head \ + nc_win32.h \ ncurses_dll.h \ termcap.h \ unctrl.h diff --git a/contrib/ncurses/include/capdefaults.c b/contrib/ncurses/include/capdefaults.c --- a/contrib/ncurses/include/capdefaults.c +++ b/contrib/ncurses/include/capdefaults.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2000,2008 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ * and: Thomas E. Dickey 1996-on * ****************************************************************************/ -/* $Id: capdefaults.c,v 1.16 2021/09/04 10:52:55 tom Exp $ */ +/* $Id: capdefaults.c,v 1.17 2024/07/27 19:19:23 tom Exp $ */ /* * Compute obsolete capabilities. The reason this is an include file is @@ -45,7 +45,7 @@ * postprocess_termcap(). */ { - char *strp; + const char *strp; short capval; #define EXTRACT_DELAY(str) \ diff --git a/contrib/ncurses/include/curses.h.in b/contrib/ncurses/include/curses.h.in --- a/contrib/ncurses/include/curses.h.in +++ b/contrib/ncurses/include/curses.h.in @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2023,2024 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ * and: Thomas E. Dickey 1996-on * ****************************************************************************/ -/* $Id: curses.h.in,v 1.282 2024/01/19 11:50:07 tom Exp $ */ +/* $Id: curses.h.in,v 1.299 2025/08/08 23:19:21 tom Exp $ */ #ifndef __NCURSES_H #define __NCURSES_H @@ -109,7 +109,7 @@ * User-definable tweak to disable the include of . */ #ifndef NCURSES_ENABLE_STDBOOL_H -#define NCURSES_ENABLE_STDBOOL_H @cf_cv_header_stdbool_h@ +#define NCURSES_ENABLE_STDBOOL_H @USE_STDBOOL_H@ #endif /* @@ -125,10 +125,10 @@ * doing so makes it incompatible with other implementations of X/Open Curses. */ #undef NCURSES_CONST -#define NCURSES_CONST @NCURSES_CONST@ +#define NCURSES_CONST @NCURSES_CONST@ /* for old compilers */ #undef NCURSES_INLINE -#define NCURSES_INLINE @NCURSES_INLINE@ +#define NCURSES_INLINE @NCURSES_INLINE@ /* for old compilers */ /* * The standard type used for color values, and for color-pairs. The latter @@ -175,14 +175,14 @@ * KEY_RESIZE is an extended feature that relies upon the SIGWINCH handler * in ncurses. */ -#if @NCURSES_EXT_FUNCS@ +#if @NCURSES_EXT_FUNCS@ /* NCURSES_EXT_FUNCS */ #ifndef NCURSES_SIGWINCH #define NCURSES_SIGWINCH @cf_cv_enable_sigwinch@ #endif #else #undef NCURSES_SIGWINCH #define NCURSES_SIGWINCH 0 -#endif +#endif /* NCURSES_EXT_FUNCS */ /* * In certain environments, we must work around linker problems for data @@ -232,12 +232,12 @@ #undef NCURSES_CH_T #define NCURSES_CH_T @NCURSES_CH_T@ -#if @cf_cv_enable_lp64@ && defined(_LP64) +#if @cf_cv_enable_lp64@ /* cf_cv_enable_lp64 */ && defined(_LP64) typedef unsigned chtype; typedef unsigned mmask_t; #else -typedef @cf_cv_typeof_chtype@ chtype; -typedef @cf_cv_typeof_mmask_t@ mmask_t; +typedef @cf_cv_typeof_chtype@ chtype; /* cf_cv_typeof_chtype */ +typedef @cf_cv_typeof_mmask_t@ mmask_t; /* cf_cv_typeof_mmask_t */ #endif /* @@ -296,7 +296,7 @@ #include /* use whatever the C compiler decides bool really is */ #define NCURSES_BOOL bool -#else +#elif !defined(__cplusplus) && !@USE_BUILTIN_BOOL@ /* USE_BUILTIN_BOOL */ /* there is no predefined bool - use our own */ #undef bool #define bool NCURSES_BOOL @@ -311,7 +311,7 @@ #define NCURSES_CAST(type,value) (type)(value) #endif -#define NCURSES_OK_ADDR(p) (0 != NCURSES_CAST(const void *, (p))) +#define NCURSES_OK_ADDR(p) (NULL != NCURSES_CAST(const void *, (p))) /* * X/Open attributes. In the ncurses implementation, they are identical to the @@ -335,7 +335,7 @@ #define WA_TOP A_TOP #define WA_VERTICAL A_VERTICAL -#if @NCURSES_EXT_FUNCS@ +#if @NCURSES_EXT_FUNCS@ /* NCURSES_EXT_FUNCS */ #define WA_ITALIC A_ITALIC /* ncurses extension */ #endif @@ -351,7 +351,7 @@ /* line graphics */ -#if @BROKEN_LINKER@ || NCURSES_REENTRANT +#if @BROKEN_LINKER@ /* BROKEN_LINKER */ || NCURSES_REENTRANT NCURSES_WRAPPED_VAR(chtype*, acs_map); #define acs_map NCURSES_PUBLIC_VAR(acs_map()) #else @@ -459,22 +459,22 @@ #if NCURSES_WIDECHAR -#if @NCURSES_LIBUTF8@ +#if @NCURSES_LIBUTF8@ /* NCURSES_LIBUTF8 */ #ifdef mblen /* libutf8.h defines it w/o undefining first */ #undef mblen #endif #include #endif -#if @NEED_WCHAR_H@ +#if @NEED_WCHAR_H@ /* NEED_WCHAR_H */ #include /* ...to get mbstate_t, etc. */ #endif -#if @NCURSES_WCHAR_T@ +#if @NCURSES_WCHAR_T@ /* NCURSES_WCHAR_T */ typedef unsigned short wchar_t@NCURSES_OK_WCHAR_T@; #endif -#if @NCURSES_WINT_T@ +#if @NCURSES_WINT_T@ /* NCURSES_WINT_T */ typedef unsigned int wint_t@NCURSES_OK_WCHAR_T@; #endif @@ -484,16 +484,19 @@ * (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 @NCURSES_CCHARW_MAX@ +#define CCHARW_MAX @NCURSES_CCHARW_MAX@ /* NCURSES_CCHARW_MAX */ typedef struct { attr_t attr; wchar_t chars[CCHARW_MAX]; -#if @NCURSES_EXT_COLORS@ +#if @NCURSES_EXT_COLORS@ /* NCURSES_EXT_COLORS */ #undef NCURSES_EXT_COLORS -#define NCURSES_EXT_COLORS @NCURSES_PATCH@ +#define NCURSES_EXT_COLORS @NCURSES_PATCH@ /* NCURSES_PATCH */ int ext_color; /* color pair, must be more than 16-bits */ +#if @NCURSES_RGB_COLORS@ /* NCURSES_RGB_COLORS */ + int rgb_color; /* extra data for direct-color (rgb) */ #endif +#endif /* NCURSES_EXT_COLORS */ } cchar_t; @@ -549,9 +552,9 @@ NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ -#if NCURSES_WIDECHAR +#if NCURSES_WIDECHAR /* NCURSES_WIDECHAR */ cchar_t _bkgrnd; /* current background char/attribute pair */ -#if @NCURSES_EXT_COLORS@ +#if @NCURSES_EXT_COLORS@ /* NCURSES_EXT_COLORS */ int _color; /* current color-pair for non-space character */ #endif #endif @@ -833,7 +836,7 @@ 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); + 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 */ @@ -936,9 +939,9 @@ /* * These functions are extensions - not in X/Open Curses. */ -#if @NCURSES_EXT_FUNCS@ +#if @NCURSES_EXT_FUNCS@ /* NCURSES_EXT_FUNCS */ #undef NCURSES_EXT_FUNCS -#define NCURSES_EXT_FUNCS @NCURSES_PATCH@ +#define NCURSES_EXT_FUNCS @NCURSES_PATCH@ /* NCURSES_PATCH */ typedef int (*NCURSES_WINDOW_CB)(WINDOW *, void *); typedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *); extern NCURSES_EXPORT(int) alloc_pair (int, int); @@ -973,9 +976,9 @@ extern NCURSES_EXPORT(int) use_window (WINDOW *, NCURSES_WINDOW_CB, void *); extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int); -#if @NCURSES_XNAMES@ +#if @NCURSES_XNAMES@ /* NCURSES_XNAMES */ #undef NCURSES_XNAMES -#define NCURSES_XNAMES @NCURSES_XNAMES@ +#define NCURSES_XNAMES @NCURSES_XNAMES@ /* NCURSES_XNAMES */ extern NCURSES_EXPORT(int) use_extended_names (bool); #endif @@ -999,17 +1002,17 @@ extern NCURSES_EXPORT(int) wgetdelay (const WINDOW *); /* @GENERATED_EXT_FUNCS@ */ extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* @GENERATED_EXT_FUNCS@ */ -#else +#else /* !NCURSES_EXT_FUNCS */ #define curses_version() NCURSES_VERSION -#endif +#endif /* NCURSES_EXT_FUNCS */ /* * Extra extension-functions, which pass a SCREEN pointer rather than using * a global variable SP. */ -#if @NCURSES_SP_FUNCS@ +#if @NCURSES_SP_FUNCS@ /* NCURSES_SP_FUNCS */ #undef NCURSES_SP_FUNCS -#define NCURSES_SP_FUNCS @NCURSES_PATCH@ +#define NCURSES_SP_FUNCS @NCURSES_PATCH@ /* NCURSES_PATCH */ #define NCURSES_SP_NAME(name) name##_sp /* Define the sp-funcs helper function */ @@ -1091,7 +1094,7 @@ 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 @NCURSES_EXT_FUNCS@ +#if @NCURSES_EXT_FUNCS@ /* NCURSES_EXT_FUNCS */ 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 */ @@ -1119,13 +1122,13 @@ 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 +#endif /* NCURSES_EXT_FUNCS */ +#else /* !NCURSES_SP_FUNCS */ #undef NCURSES_SP_FUNCS #define NCURSES_SP_FUNCS 0 #define NCURSES_SP_NAME(name) name #define NCURSES_SP_OUTC NCURSES_OUTC -#endif +#endif /* NCURSES_SP_FUNCS */ /* attributes */ @@ -1143,8 +1146,12 @@ #define A_DIM NCURSES_BITS(@cf_cv_1UL@,12) #define A_BOLD NCURSES_BITS(@cf_cv_1UL@,13) #define A_ALTCHARSET NCURSES_BITS(@cf_cv_1UL@,14) + +/* SVr4 curses marks these as "subject to change" */ #define A_INVIS NCURSES_BITS(@cf_cv_1UL@,15) #define A_PROTECT NCURSES_BITS(@cf_cv_1UL@,16) + +/* X/Open features not found in SVr4 curses */ #define A_HORIZONTAL NCURSES_BITS(@cf_cv_1UL@,17) #define A_LEFT NCURSES_BITS(@cf_cv_1UL@,18) #define A_LOW NCURSES_BITS(@cf_cv_1UL@,19) @@ -1152,9 +1159,14 @@ #define A_TOP NCURSES_BITS(@cf_cv_1UL@,21) #define A_VERTICAL NCURSES_BITS(@cf_cv_1UL@,22) -#if @NCURSES_EXT_FUNCS@ +#if @NCURSES_EXT_FUNCS@ /* NCURSES_EXT_FUNCS */ #define A_ITALIC NCURSES_BITS(@cf_cv_1UL@,23) /* ncurses extension */ -#endif +#if @NCURSES_RGB_COLORS@ /* NCURSES_RGB_COLORS */ +#define A_FOREGROUND NCURSES_BITS(@cf_cv_1UL@,17) /* ncurses extension */ +#define A_BACKGROUND NCURSES_BITS(@cf_cv_1UL@,18) /* ncurses extension */ +#define A_DIRECT (A_FOREGROUND|A_BACKGROUND) +#endif /* NCURSES_RGB_COLORS */ +#endif /* NCURSES_EXT_FUNCS */ /* * Most of the pseudo functions are macros that either provide compatibility @@ -1228,7 +1240,7 @@ #if !NCURSES_OPAQUE #if NCURSES_WATTR_MACROS -#if NCURSES_WIDECHAR && @NCURSES_EXT_COLORS@ +#if NCURSES_WIDECHAR && @NCURSES_EXT_COLORS@ /* NCURSES_EXT_COLORS */ #define wattrset(win,at) \ (NCURSES_OK_ADDR(win) \ ? ((win)->_color = NCURSES_CAST(int, PAIR_NUMBER(at)), \ @@ -1380,7 +1392,7 @@ #if !NCURSES_OPAQUE #if NCURSES_WATTR_MACROS -#if NCURSES_WIDECHAR && @NCURSES_EXT_COLORS@ +#if NCURSES_WIDECHAR && @NCURSES_EXT_COLORS@ /* NCURSES_EXT_COLORS */ #define wattr_set(win,a,p,opts) \ (NCURSES_OK_ADDR(win) \ ? ((void)((win)->_attrs = ((a) & ~A_COLOR), \ @@ -1400,7 +1412,7 @@ : OK), \ OK) \ : ERR) -#else /* !(NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +#else /* !(NCURSES_WIDECHAR && NCURSES_EXT_COLORS) */ #define wattr_set(win,a,p,opts) \ (NCURSES_OK_ADDR(win) \ ? ((void)((win)->_attrs = (((a) & ~A_COLOR) | \ @@ -1417,7 +1429,7 @@ : OK), \ OK) \ : ERR) -#endif /* (NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */ +#endif /* (NCURSES_WIDECHAR && NCURSES_EXT_COLORS) */ #endif /* NCURSES_WATTR_MACROS */ #endif /* NCURSES_OPAQUE */ @@ -1433,15 +1445,15 @@ /* * Export fallback function for use in C++ binding. */ -#if !@HAVE_VSSCANF@ +#if !@HAVE_VSSCANF@ /* HAVE_VSSCANF */ #define vsscanf(a,b,c) _nc_vsscanf(a,b,c) -NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list); +extern NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list); #endif /* * These macros are extensions - not in X/Open Curses. */ -#if @NCURSES_EXT_FUNCS@ +#if @NCURSES_EXT_FUNCS@ /* NCURSES_EXT_FUNCS */ #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) @@ -1459,7 +1471,7 @@ #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 +#endif /* NCURSES_EXT_FUNCS */ /* * X/Open says this returns a bool; SVr4 also checked for out-of-range line. diff --git a/contrib/ncurses/include/curses.tail b/contrib/ncurses/include/curses.tail --- a/contrib/ncurses/include/curses.tail +++ b/contrib/ncurses/include/curses.tail @@ -1,4 +1,4 @@ -/* $Id: curses.tail,v 1.27 2023/08/05 19:43:46 tom Exp $ */ +/* $Id: curses.tail,v 1.29 2025/07/26 15:32:01 tom Exp $ */ /* * vile:cmode: * This file is part of ncurses, designed to be appended after curses.h.in @@ -8,9 +8,9 @@ /* mouse interface */ #if NCURSES_MOUSE_VERSION > 1 -#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 5)) +#define NCURSES_MOUSE_MASK(b,m) ((mmask_t)(m) << (((b) - 1) * 5)) #else -#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 6)) +#define NCURSES_MOUSE_MASK(b,m) ((mmask_t)(m) << (((b) - 1) * 6)) #endif #define NCURSES_BUTTON_RELEASED 001UL @@ -62,7 +62,51 @@ #define BUTTON_ALT NCURSES_MOUSE_MASK(6, 0004L) #define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(6, 0010L) -#else +/* + * If mmask_T is 64-bits, we can define another 6 button stanzas, for a total + * of 11, which happens to be the maximum number supported in the X11 protocol. + */ +#if NCURSES_MOUSE_VERSION > 2 + +#define BUTTON6_RELEASED NCURSES_MOUSE_MASK(6, NCURSES_BUTTON_RELEASED) +#define BUTTON6_PRESSED NCURSES_MOUSE_MASK(6, NCURSES_BUTTON_PRESSED) +#define BUTTON6_CLICKED NCURSES_MOUSE_MASK(6, NCURSES_BUTTON_CLICKED) +#define BUTTON6_DOUBLE_CLICKED NCURSES_MOUSE_MASK(6, NCURSES_DOUBLE_CLICKED) +#define BUTTON6_TRIPLE_CLICKED NCURSES_MOUSE_MASK(6, NCURSES_TRIPLE_CLICKED) + +#define BUTTON7_RELEASED NCURSES_MOUSE_MASK(7, NCURSES_BUTTON_RELEASED) +#define BUTTON7_PRESSED NCURSES_MOUSE_MASK(7, NCURSES_BUTTON_PRESSED) +#define BUTTON7_CLICKED NCURSES_MOUSE_MASK(7, NCURSES_BUTTON_CLICKED) +#define BUTTON7_DOUBLE_CLICKED NCURSES_MOUSE_MASK(7, NCURSES_DOUBLE_CLICKED) +#define BUTTON7_TRIPLE_CLICKED NCURSES_MOUSE_MASK(7, NCURSES_TRIPLE_CLICKED) + +#define BUTTON8_RELEASED NCURSES_MOUSE_MASK(8, NCURSES_BUTTON_RELEASED) +#define BUTTON8_PRESSED NCURSES_MOUSE_MASK(8, NCURSES_BUTTON_PRESSED) +#define BUTTON8_CLICKED NCURSES_MOUSE_MASK(8, NCURSES_BUTTON_CLICKED) +#define BUTTON8_DOUBLE_CLICKED NCURSES_MOUSE_MASK(8, NCURSES_DOUBLE_CLICKED) +#define BUTTON8_TRIPLE_CLICKED NCURSES_MOUSE_MASK(8, NCURSES_TRIPLE_CLICKED) + +#define BUTTON9_RELEASED NCURSES_MOUSE_MASK(9, NCURSES_BUTTON_RELEASED) +#define BUTTON9_PRESSED NCURSES_MOUSE_MASK(9, NCURSES_BUTTON_PRESSED) +#define BUTTON9_CLICKED NCURSES_MOUSE_MASK(9, NCURSES_BUTTON_CLICKED) +#define BUTTON9_DOUBLE_CLICKED NCURSES_MOUSE_MASK(9, NCURSES_DOUBLE_CLICKED) +#define BUTTON9_TRIPLE_CLICKED NCURSES_MOUSE_MASK(9, NCURSES_TRIPLE_CLICKED) + +#define BUTTON10_RELEASED NCURSES_MOUSE_MASK(10, NCURSES_BUTTON_RELEASED) +#define BUTTON10_PRESSED NCURSES_MOUSE_MASK(10, NCURSES_BUTTON_PRESSED) +#define BUTTON10_CLICKED NCURSES_MOUSE_MASK(10, NCURSES_BUTTON_CLICKED) +#define BUTTON10_DOUBLE_CLICKED NCURSES_MOUSE_MASK(10, NCURSES_DOUBLE_CLICKED) +#define BUTTON10_TRIPLE_CLICKED NCURSES_MOUSE_MASK(10, NCURSES_TRIPLE_CLICKED) + +#define BUTTON11_RELEASED NCURSES_MOUSE_MASK(11, NCURSES_BUTTON_RELEASED) +#define BUTTON11_PRESSED NCURSES_MOUSE_MASK(11, NCURSES_BUTTON_PRESSED) +#define BUTTON11_CLICKED NCURSES_MOUSE_MASK(11, NCURSES_BUTTON_CLICKED) +#define BUTTON11_DOUBLE_CLICKED NCURSES_MOUSE_MASK(11, NCURSES_DOUBLE_CLICKED) +#define BUTTON11_TRIPLE_CLICKED NCURSES_MOUSE_MASK(11, NCURSES_TRIPLE_CLICKED) + +#endif + +#else /* NCURSES_MOUSE_VERSION == 1 */ #define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT) #define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT) @@ -74,7 +118,7 @@ #define BUTTON_ALT NCURSES_MOUSE_MASK(5, 0004L) #define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(5, 0010L) -#endif +#endif /* NCURSES_MOUSE_VERSION >= 1 */ #define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1) diff --git a/contrib/ncurses/include/curses.wide b/contrib/ncurses/include/curses.wide --- a/contrib/ncurses/include/curses.wide +++ b/contrib/ncurses/include/curses.wide @@ -1,4 +1,4 @@ -/* $Id: curses.wide,v 1.51 2021/05/22 20:28:29 tom Exp $ */ +/* $Id: curses.wide,v 1.53 2025/01/18 21:08:32 Branden.Robinson Exp $ */ /* * vile:cmode: * This file is part of ncurses, designed to be appended after curses.h.in @@ -213,7 +213,7 @@ 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(int) winwstr (WINDOW *, wchar_t *); /* generated:WIDEC */ extern NCURSES_EXPORT(wchar_t*) wunctrl (cchar_t *); /* implemented */ extern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int); /* implemented */ @@ -240,7 +240,7 @@ #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 box_set(w,v,h) wborder_set((w),(v),(v),(h),(h),NULL,NULL,NULL,NULL) #define echo_wchar(c) wecho_wchar(stdscr,(c)) #define get_wch(c) wget_wch(stdscr,(c)) #define get_wstr(t) wget_wstr(stdscr,(t)) @@ -261,6 +261,7 @@ #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) +#define winwstr(w,c) winnwstr((w),(c),-1) #if !NCURSES_OPAQUE #define wgetbkgrnd(win,wch) (NCURSES_OK_ADDR(wch) ? ((win) ? (*(wch) = (win)->_bkgrnd) : *(wch), OK) : ERR) diff --git a/contrib/ncurses/include/headers b/contrib/ncurses/include/headers --- a/contrib/ncurses/include/headers +++ b/contrib/ncurses/include/headers @@ -1,6 +1,6 @@ -# $Id: headers,v 1.16 2023/04/22 12:09:09 tom Exp $ +# $Id: headers,v 1.22 2025/12/26 23:33:03 tom Exp $ ############################################################################## -# Copyright 2020,2023 Thomas E. Dickey # +# Copyright 2020-2023,2025 Thomas E. Dickey # # Copyright 1998-2012,2013 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -45,9 +45,8 @@ # Porting @ port_win32con -$(srcdir)/ncurses_mingw.h -$(srcdir)/nc_mingw.h +nc_win32.h @ port_win32 -$(srcdir)/win32_curses.h +nc_win32.h # vile:makemode diff --git a/contrib/ncurses/include/nc_alloc.h b/contrib/ncurses/include/nc_alloc.h --- a/contrib/ncurses/include/nc_alloc.h +++ b/contrib/ncurses/include/nc_alloc.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2020,2021 Thomas E. Dickey * + * Copyright 2019-2021,2025 Thomas E. Dickey * * Copyright 1998-2013,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -30,7 +30,7 @@ /**************************************************************************** * Author: Thomas E. Dickey 1996-on * ****************************************************************************/ -/* $Id: nc_alloc.h,v 1.30 2021/11/20 23:33:38 tom Exp $ */ +/* $Id: nc_alloc.h,v 1.36 2025/03/01 15:02:06 tom Exp $ */ #ifndef NC_ALLOC_included #define NC_ALLOC_included 1 @@ -118,6 +118,27 @@ #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)) +/* provide for using VLAs if supported, otherwise assume alloca() */ + +#ifndef __STDC_VERSION__ +#define __STDC_VERSION__ 0 +#endif + +#ifndef __STDC_NO_VLA__ +#define __STDC_NO_VLA__ 1 +#endif + +#if __STDC_VERSION__ >= 19901L && (__STDC_VERSION__ < 201000L || !__STDC_NO_VLA__) +#define MakeArray(name,type,count) type name[count] +#else +#if HAVE_ALLOCA_H +#include +#elif HAVE_MALLOC_H +#include +#endif +#define MakeArray(name,type,count) type *name = (type*) alloca(sizeof(type) * (size_t) (count)) +#endif + #ifdef __cplusplus } #endif diff --git a/contrib/ncurses/include/nc_mingw.h b/contrib/ncurses/include/nc_mingw.h deleted file mode 100644 --- a/contrib/ncurses/include/nc_mingw.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** - * Copyright 2018-2020,2023 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.10 2023/02/25 19:59:24 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) - -#if HAVE_SYS_TIME_H -#include /* for struct timeval */ -#endif - -#ifdef _MSC_VER -#include /* for struct timeval */ -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#if !HAVE_CLOCK_GETTIME && !HAVE_GETTIMEOFDAY -NCURSES_EXPORT(int) _nc_gettimeofday(struct timeval *, void *); -#undef HAVE_GETTIMEOFDAY -#define HAVE_GETTIMEOFDAY 2 -#define gettimeofday(tv,tz) _nc_gettimeofday(tv,tz) -#endif - -#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/contrib/ncurses/include/nc_termios.h b/contrib/ncurses/include/nc_termios.h --- a/contrib/ncurses/include/nc_termios.h +++ b/contrib/ncurses/include/nc_termios.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2018-2020,2025 Thomas E. Dickey * * Copyright 2011-2014,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -31,7 +31,7 @@ * Author: Thomas E. Dickey 2011 * ****************************************************************************/ -/* $Id: nc_termios.h,v 1.8 2020/08/29 20:53:19 tom Exp $ */ +/* $Id: nc_termios.h,v 1.10 2025/10/18 17:53:13 tom Exp $ */ #ifndef NC_TERMIOS_included #define NC_TERMIOS_included 1 @@ -70,97 +70,14 @@ #define tcflush(fd, arg) ioctl(fd, TCFLSH, arg) #endif -#if defined(EXP_WIN32_DRIVER) +#if defined(_WIN32) #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 +#undef TERMIOS -#endif /* _WIN32 */ #endif /* HAVE_TERMIO_H */ #endif /* HAVE_TERMIOS_H */ diff --git a/contrib/ncurses/include/nc_tparm.h b/contrib/ncurses/include/nc_tparm.h --- a/contrib/ncurses/include/nc_tparm.h +++ b/contrib/ncurses/include/nc_tparm.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2023 Thomas E. Dickey * + * Copyright 2018-2023,2025 Thomas E. Dickey * * Copyright 2006-2012,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -31,7 +31,7 @@ * Author: Thomas E. Dickey 2006 * ****************************************************************************/ -/* $Id: nc_tparm.h,v 1.12 2023/04/16 17:57:28 tom Exp $ */ +/* $Id: nc_tparm.h,v 1.13 2025/01/04 23:42:30 tom Exp $ */ #ifndef NC_TPARM_included #define NC_TPARM_included 1 @@ -88,6 +88,7 @@ #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) +#define TIPARM_N(N,s,a,b,c,d,e,f,g,h,i) _nc_tiparm(N,s,a,b,c,d,e,f,g,h,i) #endif #endif /* NC_TPARM_included */ diff --git a/contrib/ncurses/include/nc_win32.h b/contrib/ncurses/include/nc_win32.h.in rename from contrib/ncurses/include/nc_win32.h rename to contrib/ncurses/include/nc_win32.h.in --- a/contrib/ncurses/include/nc_win32.h +++ b/contrib/ncurses/include/nc_win32.h.in @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 2008-2010,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -31,23 +31,27 @@ * Author: Thomas Dickey, 2008-on * ****************************************************************************/ -/* $Id: nc_win32.h,v 1.10 2023/02/25 20:09:23 tom Exp $ */ +/* $Id: nc_win32.h.in,v 1.19 2025/12/26 23:32:43 tom Exp $ */ #ifndef NC_WIN32_H #define NC_WIN32_H 1 -#if defined(_WIN32) || defined(_WIN64) +#include -#ifndef _NC_WINDOWS -#define _NC_WINDOWS +#if defined(_WIN32) || defined(_WIN64) || defined(USE_WIN32CON_DRIVER) + +#if @USE_NAMED_PIPES@ /* USE_NAMED_PIPES */ + +#ifndef _NC_WINDOWS_NATIVE +#define _NC_WINDOWS_NATIVE #endif #ifdef TERMIOS #error TERMIOS must not be defined on Windows #endif -/* We no longer support WindowsXP. - Minimum requirement is Windows Vista or Server2008, +/* + Minimum requirement for named pipes is Windows Vista or Server2008, aka Windows NT 6.0 */ #ifdef WINVER @@ -65,59 +69,46 @@ #include +#else /* !USE_NAMED_PIPES */ + +#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) + +#endif /* USE_NAMED_PIPES */ + #if HAVE_SYS_TIME_H #include /* for struct timeval */ #endif -#ifdef _NC_MSC +#ifdef _MSC_VER #include /* for struct timeval */ #endif -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#if !HAVE_CLOCK_GETTIME && !HAVE_GETTIMEOFDAY -#undef HAVE_GETTIMEOFDAY -#define HAVE_GETTIMEOFDAY 2 -extern NCURSES_EXPORT(int) _nc_gettimeofday(struct timeval *, void *); -#endif +#include /* for uint32_t */ -#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); +/* + * Allow for build-override, e.g., MinGW used "cygwin". + */ +#ifndef DEFAULT_TERM_ENV +#define DEFAULT_TERM_ENV "ms-terminal" #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 \ + ? DEFAULT_TERM_ENV \ : no_terminal)), \ NonEmpty(term_env)) @@ -137,11 +128,35 @@ #define CONMODE_NORAW (ENABLE_PROCESSED_INPUT|ENABLE_LINE_INPUT) #define CONMODE_NOCBREAK (ENABLE_LINE_INPUT) +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(CURSES_PRIV_H) || defined(TEST_PRIV_H) -#if defined(USE_TERM_DRIVER) && defined(USE_WIN32CON_DRIVER) -extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_WIN_DRIVER; +#if !HAVE_CLOCK_GETTIME && !HAVE_GETTIMEOFDAY +extern NCURSES_EXPORT(int) _nc_gettimeofday(struct timeval *, void *); +#undef HAVE_GETTIMEOFDAY +#define HAVE_GETTIMEOFDAY 2 +#define gettimeofday(tv,tz) _nc_gettimeofday(tv,tz) #endif +#endif /* defined(CURSES_PRIV_H) || defined(TEST_PRIV_H) */ + +#if !HAVE_WCWIDTH +#undef wcwidth +#define wcwidth(ucs) _nc_wcwidth((wchar_t)(ucs)) +extern NCURSES_EXPORT(int) _nc_wcwidth(uint32_t); +#endif + +typedef struct +{ + DWORD dwFlagIn; + DWORD dwFlagOut; +} ConsoleMode; + #define CON_NUMPAIRS 64 typedef struct { BOOL initialized; @@ -166,20 +181,32 @@ CONSOLE_SCREEN_BUFFER_INFO SBI; CONSOLE_SCREEN_BUFFER_INFO save_SBI; CONSOLE_CURSOR_INFO save_CI; - TTY originalMode; + ConsoleMode 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 +#ifdef CURSES_PRIV_H /* test.priv.h just needs the preceding */ +#include +#endif + +#if USE_DOS_PATHS +NCURSES_EXPORT(const char *) _nc_to_dospath(const char *, char *); +#define FixupPathname(path) \ + char fixed_pathname[PATH_MAX]; \ + path = _nc_to_dospath(path, fixed_pathname) +#define FixupPathname2(path,buffer) \ + path = _nc_to_dospath(path, buffer) +#endif + +#undef ttyname +#define ttyname(fd) NULL + #endif /* _WIN32 || _WIN64 */ #endif /* NC_WIN32_H */ diff --git a/contrib/ncurses/include/ncurses_cfg.hin b/contrib/ncurses/include/ncurses_cfg.hin --- a/contrib/ncurses/include/ncurses_cfg.hin +++ b/contrib/ncurses/include/ncurses_cfg.hin @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -31,7 +31,7 @@ * Author: Thomas E. Dickey 1997-on * ****************************************************************************/ /* - * $Id: ncurses_cfg.hin,v 1.13 2020/03/08 12:37:59 tom Exp $ + * $Id: ncurses_cfg.hin,v 1.15 2024/06/08 14:04:14 tom Exp $ * * Both ncurses_cfg.h and ncurses_def.h are internal header-files used when * building ncurses. @@ -44,7 +44,7 @@ * * See: * https://invisible-island.net/autoconf/ - * ftp://ftp.invisible-island.net/autoconf/ + * https://invisible-island.net/archives/autoconf/ */ #ifndef NC_CONFIG_H #define NC_CONFIG_H diff --git a/contrib/ncurses/include/ncurses_defs b/contrib/ncurses/include/ncurses_defs --- a/contrib/ncurses/include/ncurses_defs +++ b/contrib/ncurses/include/ncurses_defs @@ -1,6 +1,6 @@ -# $Id: ncurses_defs,v 1.110 2024/03/02 20:38:23 tom Exp $ +# $Id: ncurses_defs,v 1.123 2025/12/27 12:45:14 tom Exp $ ############################################################################## -# Copyright 2018-2023,2024 Thomas E. Dickey # +# Copyright 2018-2024,2025 Thomas E. Dickey # # Copyright 2000-2016,2017 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -42,6 +42,7 @@ ETIP_NEEDS_MATH_H GCC_NORETURN /* nothing */ GCC_UNUSED /* nothing */ +HAVE_ALLOCA_H HAVE_ALLOC_PAIR HAVE_ASSUME_DEFAULT_COLORS HAVE_BIG_CORE @@ -50,6 +51,7 @@ HAVE_BSD_STRING_H HAVE_BTOWC HAVE_BUILTIN_H +HAVE_CC_T HAVE_CHGAT 1 HAVE_CLOCK_GETTIME HAVE_COLOR_CONTENT 1 @@ -111,6 +113,7 @@ HAVE_LOCALECONV HAVE_LOCALE_H HAVE_LONG_FILE_NAMES +HAVE_MALLOC_H HAVE_MATH_FUNCS HAVE_MATH_H HAVE_MBLEN @@ -158,11 +161,13 @@ HAVE_SETVBUF HAVE_SGTTY_H HAVE_SIGACTION +HAVE_SIGSET_T HAVE_SIGVEC HAVE_SIZECHANGE HAVE_SLK_COLOR HAVE_SLK_INIT 1 HAVE_SNPRINTF +HAVE_SPEED_T HAVE_STDINT_H HAVE_STRDUP HAVE_STRLCAT @@ -170,8 +175,9 @@ HAVE_STRSTR HAVE_SYMLINK HAVE_SYSCONF -HAVE_SYS_BSDTYPES_H HAVE_SYS_AUXV_H +HAVE_SYS_BSDTYPES_H +HAVE_SYS_FSUID_H HAVE_SYS_IOCTL_H HAVE_SYS_PARAM_H HAVE_SYS_POLL_H @@ -180,6 +186,7 @@ HAVE_SYS_TIMES_H HAVE_SYS_TIME_H HAVE_SYS_TIME_SELECT +HAVE_TCFLAG_T HAVE_TCGETATTR HAVE_TCGETPGRP HAVE_TELL @@ -193,10 +200,10 @@ HAVE_TGETENT 1 HAVE_TIGETNUM 1 HAVE_TIGETSTR 1 +HAVE_TIMES HAVE_TIPARM 1 HAVE_TIPARM_S 1 HAVE_TISCAN_S 1 -HAVE_TIMES HAVE_TPUTS_SP HAVE_TSEARCH HAVE_TYPEAHEAD 1 @@ -224,6 +231,7 @@ HAVE_WCTOB HAVE_WCTOMB HAVE_WCTYPE_H +HAVE_WCWIDTH HAVE_WINSDELLN 1 HAVE_WINSSTR 1 HAVE_WMEMCHR @@ -231,8 +239,8 @@ HAVE_WRESIZE HAVE_WSYNCDOWN 1 HAVE__DOSCAN -HAVE__TRACEF HAVE__NC_TPARM_ANALYZE 1 +HAVE__TRACEF MIXEDCASE_FILENAMES NCURSES_CHAR_EQ NCURSES_EXPANDED @@ -242,6 +250,7 @@ NCURSES_NO_PADDING NCURSES_OSPEED_COMPAT NCURSES_PATHSEP ':' +NCURSES_RGB_COLORS NCURSES_WIDECHAR NEED_PTEM_H NO_LEAKS @@ -255,6 +264,7 @@ TIME_WITH_SYS_TIME TYPEOF_CHTYPE USE_COLORFGBG +USE_DOS_PATHS USE_FOPEN_BIN_R USE_GETCAP USE_GETCAP_CACHE @@ -264,6 +274,7 @@ USE_HOME_TERMINFO USE_LINKS USE_MY_MEMMOVE +USE_NAMED_PIPES USE_OK_BCOPY USE_PTHREADS_EINTR USE_RCS_IDS @@ -271,9 +282,11 @@ USE_SAFE_SPRINTF USE_SCROLL_HINTS USE_SIGWINCH +USE_STDBOOL_H USE_STRING_HACKS USE_SYMLINKS USE_SYSMOUSE +USE_TERM_DRIVER USE_WEAK_SYMBOLS USE_WIDEC_SUPPORT USE_XMC_SUPPORT diff --git a/contrib/ncurses/include/ncurses_mingw.h b/contrib/ncurses/include/ncurses_mingw.h deleted file mode 100644 --- a/contrib/ncurses/include/ncurses_mingw.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** - * 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/contrib/ncurses/include/term_entry.h b/contrib/ncurses/include/term_entry.h --- a/contrib/ncurses/include/term_entry.h +++ b/contrib/ncurses/include/term_entry.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2023,2025 Thomas E. Dickey * * Copyright 1998-2015,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ * and: Thomas E. Dickey 1998-on * ****************************************************************************/ -/* $Id: term_entry.h,v 1.64 2023/04/22 13:37:14 tom Exp $ */ +/* $Id: term_entry.h,v 1.65 2025/01/11 20:37:28 tom Exp $ */ /* * term_entry.h -- interface to entry-manipulation code @@ -108,7 +108,8 @@ dbdLAST } DBDIRS; -#define MAX_USES 32 +#define WARN_MAX_USES 32 +#define HARD_MAX_USES 40 #define MAX_CROSSLINKS 16 typedef struct entry ENTRY; @@ -122,7 +123,7 @@ struct entry { TERMTYPE2 tterm; unsigned nuses; - ENTRY_USES uses[MAX_USES]; + ENTRY_USES uses[HARD_MAX_USES]; int ncrosslinks; ENTRY *crosslinks[MAX_CROSSLINKS]; long cstart; diff --git a/contrib/ncurses/include/tic.h b/contrib/ncurses/include/tic.h --- a/contrib/ncurses/include/tic.h +++ b/contrib/ncurses/include/tic.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2023,2025 Thomas E. Dickey * * Copyright 1998-2012,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -34,7 +34,7 @@ ****************************************************************************/ /* - * $Id: tic.h,v 1.87 2023/04/22 13:37:21 tom Exp $ + * $Id: tic.h,v 1.91 2025/12/25 21:23:29 tom Exp $ * tic.h - Global variables and structures for the terminfo compiler. */ @@ -47,6 +47,7 @@ #include +#include #include /* for the _tracef() prototype, ERR/OK, bool defs */ /* @@ -270,6 +271,7 @@ 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(bool) _nc_is_path_found (const char *, struct stat *); extern NCURSES_EXPORT(char *) _nc_basename (char *); extern NCURSES_EXPORT(char *) _nc_rootname (char *); @@ -313,8 +315,8 @@ 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); +extern NCURSES_EXPORT(const struct user_table_entry *) _nc_get_userdefs_table (void); +extern 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); diff --git a/contrib/ncurses/include/unctrl.h.in b/contrib/ncurses/include/unctrl.h.in --- a/contrib/ncurses/include/unctrl.h.in +++ b/contrib/ncurses/include/unctrl.h.in @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2025 Thomas E. Dickey * * Copyright 1998-2001,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,7 +40,7 @@ * as ^?. Printable characters are displayed as is. */ -/* $Id: unctrl.h.in,v 1.12 2020/02/02 23:34:34 tom Exp $ */ +/* $Id: unctrl.h.in,v 1.14 2025/08/08 23:19:21 tom Exp $ */ #ifndef NCURSES_UNCTRL_H_incl #define NCURSES_UNCTRL_H_incl 1 @@ -55,10 +55,10 @@ #include #undef unctrl -NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype); +extern NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype); -#if @NCURSES_SP_FUNCS@ -NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, chtype); +#if @NCURSES_SP_FUNCS@ /* NCURSES_SP_FUNCS */ +extern NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, chtype); #endif #ifdef __cplusplus diff --git a/contrib/ncurses/include/win32_curses.h b/contrib/ncurses/include/win32_curses.h deleted file mode 100644 --- a/contrib/ncurses/include/win32_curses.h +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** - * 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/contrib/ncurses/install-sh b/contrib/ncurses/install-sh --- a/contrib/ncurses/install-sh +++ b/contrib/ncurses/install-sh @@ -3,10 +3,18 @@ scriptversion=2020-11-14.01; # UTC +# https://lists.gnu.org/archive/html/automake/2018-09/msg00002.html +# +# Originally X11R4 util/scripts/install.sh, the following comments, copyright +# and license were added by an autoconf developer in 1998 (about nine years +# later). I have made a minor change to the wording, i.e., "copyright holders" +# vs "X Consortium", for reusability -TD +# +# ----------------------------------------------------------------------------- # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. -# +# ----------------------------------------------------------------------------- # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy @@ -22,16 +30,15 @@ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# +# ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. # +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the sale, +# use or other dealings in this Software without prior written authorization. +# ----------------------------------------------------------------------------- # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent diff --git a/contrib/ncurses/man/MKada_config.in b/contrib/ncurses/man/MKada_config.in --- a/contrib/ncurses/man/MKada_config.in +++ b/contrib/ncurses/man/MKada_config.in @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-2024,2025 Thomas E. Dickey * .\" Copyright 2010-2014,2016 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: MKada_config.in,v 1.35 2024/04/20 21:13:27 tom Exp $ -.TH adacurses@USE_CFG_SUFFIX@\-config 1 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" +.\" $Id: MKada_config.in,v 1.37 2025/04/05 22:26:08 tom Exp $ +.TH adacurses@USE_CFG_SUFFIX@\-config 1 2025-04-05 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" .ds C adacurses@USE_CFG_SUFFIX@\-config .ie \n(.g \{\ .ds `` \(lq @@ -97,6 +97,7 @@ .PP .if \n(LL>67n .RS 4 .EX +.nf with Terminal_Interface.Curses; use Terminal_Interface.Curses; procedure Hello is @@ -127,6 +128,7 @@ End_Windows; end Hello; +.fi .EE .if \n(LL>67n .RE .ne 2 diff --git a/contrib/ncurses/man/MKncu_config.in b/contrib/ncurses/man/MKncu_config.in --- a/contrib/ncurses/man/MKncu_config.in +++ b/contrib/ncurses/man/MKncu_config.in @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: MKncu_config.in,v 1.24 2024/04/20 21:13:38 tom Exp $ -.TH @LIB_NAME@@DFT_ARG_SUFFIX@@cf_cv_abi_version@-config 1 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" +.\" $Id: MKncu_config.in,v 1.25 2024/05/11 20:39:53 tom Exp $ +.TH @LIB_NAME@@DFT_ARG_SUFFIX@@cf_cv_abi_version@\-config 1 2024-05-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" .SH NAME \fB\%@LIB_NAME@@DFT_ARG_SUFFIX@@cf_cv_abi_version@-config\fP \- configuration helper for \fI\%ncurses\fP libraries diff --git a/contrib/ncurses/man/MKterminfo.sh b/contrib/ncurses/man/MKterminfo.sh --- a/contrib/ncurses/man/MKterminfo.sh +++ b/contrib/ncurses/man/MKterminfo.sh @@ -1,10 +1,10 @@ #!/bin/sh -# $Id: MKterminfo.sh,v 1.20 2024/01/13 20:37:40 tom Exp $ +# $Id: MKterminfo.sh,v 1.28 2025/11/12 01:07:10 Branden.Robinson Exp $ # # MKterminfo.sh -- generate terminfo.5 from Caps tabular data # #*************************************************************************** -# Copyright 2018-2020,2022 Thomas E. Dickey * +# Copyright 2018-2024,2025 Thomas E. Dickey * # Copyright 1998-2003,2017 Free Software Foundation, Inc. * # * # Permission is hereby granted, free of charge, to any person obtaining a * @@ -49,33 +49,50 @@ if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi if test "${LC_COLLATE+set}" = set; then LC_COLLATE=C; export LC_COLLATE; fi -# +# collect the command-line parameters of the script head="$1" -shift 1 +shift caps= +capstext= while test $# -gt 1 do caps="$caps $1" - shift 1 + capstext="$capstext, $1" + shift done tail="$1" + +MYTEMP=`mktemp -d 2>/dev/null` +if [ -z "$MYTEMP" ] +then + MYTEMP=${TMPDIR:-/tmp}/ncurses$$ +fi +mkdir -p "$MYTEMP" || failed "cannot mkdir $MYTEMP" +trap "rm -rf $MYTEMP; exit 1" HUP INT QUIT TERM +trap "rm -rf $MYTEMP" EXIT + +temp=$MYTEMP/temp +pass1=$MYTEMP/pass1 +pass2=$MYTEMP/pass2 +pass3=$MYTEMP/pass3 +sorted=$MYTEMP/sorted +unsorted=$MYTEMP/unsorted + cat <$pass1 <$unsorted +EOF + +echo 's/^$/../' > $pass2 + +sed -n -f $pass1 $caps | sed -f $pass2 | tr "\134" "\006" >$unsorted rm -f $sorted rm -f $temp @@ -116,8 +137,11 @@ done <$unsorted test $saved = yes && sort $temp >>$sorted -sed -e 's/^\.\.$//' $sorted | tr "\005\006" "\012\134" +sed -e 's/^\.\.$//' $sorted | tr "\005\006" "\012\134" | sed -e '/^$/d' + +cat > $pass3 << "EOF" +/^center expand;/s, expand,, +/^\.TS/,/^\\/s, lw[1-9][0-9]*\., l., +EOF -sed -e '/^center expand;/s, expand,,' \ - -e '/^\.TS/,/^\\/s, lw[1-9][0-9]*\., l.,' \ - "$tail" +sed -f $pass3 "$tail" diff --git a/contrib/ncurses/man/Makefile.in b/contrib/ncurses/man/Makefile.in --- a/contrib/ncurses/man/Makefile.in +++ b/contrib/ncurses/man/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.54 2022/10/22 16:36:40 tom Exp $ +# $Id: Makefile.in,v 1.60 2025/11/02 01:23:25 tom Exp $ ############################################################################## -# Copyright 2019-2021,2022 Thomas E. Dickey # +# Copyright 2019-2024,2025 Thomas E. Dickey # # Copyright 1998-2013,2015 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -38,7 +38,7 @@ SHELL = @SHELL@ VPATH = @srcdir@ -DESTDIR = @DESTDIR@ +@SET_DESTDIR@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -47,7 +47,8 @@ mandir = @mandir@ includesubdir = @includesubdir@ -INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) +INCLUDEDIR = $(DESTDIR)$(includedir@MERGE_PREFIX@)$(includesubdir) +MANDIR = $(DESTDIR)$(mandir@MERGE_PREFIX@) INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -72,12 +73,15 @@ depend : tags : -$(DESTDIR)$(mandir) : +check :: + @echo "no unit-test implemented" + +$(MANDIR) : mkdir -p $@ -EDITARGS = $(DESTDIR)$(mandir) $(srcdir) terminfo.5 *-config.1 $(srcdir)/*.[0-9]* +EDITARGS = $(MANDIR) $(srcdir) terminfo.5 *-config.1 $(srcdir)/*.[0-9]* -install install.man : terminfo.5 $(DESTDIR)$(mandir) +install install.man : terminfo.5 $(MANDIR) $(SHELL) ../edit_man.sh normal installing $(EDITARGS) uninstall uninstall.man : @@ -90,8 +94,8 @@ terminfo.5: $(srcdir)/terminfo.head \ $(CAPLIST) \ $(srcdir)/terminfo.tail \ - Makefile $(srcdir)/MKterminfo.sh - $(SHELL) $(srcdir)/MKterminfo.sh $(srcdir)/terminfo.head $(CAPLIST) $(srcdir)/terminfo.tail >terminfo.5 + Makefile MKterminfo.tmp + $(SHELL) MKterminfo.tmp $(srcdir)/terminfo.head $(CAPLIST) $(srcdir)/terminfo.tail >terminfo.5 mostlyclean : -rm -f core tags TAGS *~ *.bak *.ln *.atac trace @@ -103,4 +107,4 @@ $(SHELL) $(srcdir)/make_sed.sh @MANPAGE_RENAMES@ >../edit_man.sed distclean realclean: clean - -rm -f Makefile *-config.1 ../edit_man.* ../man_alias.* man_db.renames + -rm -f Makefile *-config.1 ../edit_man.* ../man_alias.* man_db.renames MKterminfo.tmp diff --git a/contrib/ncurses/man/captoinfo.1m b/contrib/ncurses/man/captoinfo.1m --- a/contrib/ncurses/man/captoinfo.1m +++ b/contrib/ncurses/man/captoinfo.1m @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2016 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: captoinfo.1m,v 1.63 2024/03/23 20:37:25 tom Exp $ -.TH @CAPTOINFO@ 1M 2024-03-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" +.\" $Id: captoinfo.1m,v 1.77 2025/11/12 01:03:56 tom Exp $ +.TH @CAPTOINFO@ 1M 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -51,52 +51,79 @@ .P .B "@CAPTOINFO@ \-V" .SH DESCRIPTION -\fB\%@CAPTOINFO@\fP translates terminal descriptions. -It looks in each given text \fIfile\fP for \fI\%termcap\fP entries and, +.B \%@CAPTOINFO@ +translates terminal descriptions. +It looks in each given text +.I file +for +.I termcap +entries and, for each one found, -writes an equivalent \fI\%\%term\%info\fP description to the standard -output stream. -\fI\%termcap\fP \fBtc\fP capabilities translate to \fI\%\%term\%info\fP -\*(``\fBuse\fP\*('' capabilities. +writes an equivalent +.I term\%info +description to the standard output stream. +.I termcap +.B tc +capabilities translate to +.I term\%info +.RB \*(`` use \*('' +capabilities. .PP -If no \fIfile\fPs are specified, -\fB\%@CAPTOINFO@\fP interprets the content of the environment variable -\fI\%TERMCAP\fP as a file name, -and extracts only the entry for the terminal named in the environment -variable \fITERM\fP from it. -If the environment variable \fI\%TERMCAP\fP is not set, -\fB\%@CAPTOINFO@\fP reads -.IR \%/etc/termcap . +If no +.IR file s +are specified, +.B \%@CAPTOINFO@ +interprets the content of the environment variable +.I \%TERMCAP +as a file name, +and extracts only the entry for the terminal type named +in the environment variable +.I TERM +from it. +If the environment variable +.I \%TERMCAP +is not set, +.B \%@CAPTOINFO@ +reads +.IR \%/etc/termcap "." .PP This utility is implemented as a link to \fB\%@TIC@\fP(1M), with the latter's .B \-I option implied. -You can use other \fB\%@TIC@\fP options such as +You can use other +.B \%@TIC@ +options such as .BR \-1 , .BR \-f , .BR \-v , .BR \-w , and .BR \-x . -The \fB\-V\fP option reports the version of \fI\%ncurses\fP associated -with this program and exits with a successful status. +The +.B \-V +option reports the version of +.I \%ncurses +associated with this program and exits with a successful status. .SS "Translations from Nonstandard Capabilities" -\fB\%@CAPTOINFO@\fP translates some obsolete, +.B \%@CAPTOINFO@ +translates some obsolete, nonstandard capabilities into standard -(SVr4/XSI Curses) -\fI\%\%term\%info\fP capabilities. +.I term\%info +capabilities. It issues a diagnostic to the standard error stream for each, inviting the user to check that it has not mistakenly translated an unknown or mistyped capability name. .PP -.\" DWB 3.3 tbl requires the two junk "L" specifiers in the first row. +.\" DWB 3.3 and Plan 9 tbl require the two junk "L" specifiers in the +.\" first row description. System V, GNU, and Heirloom Doctools tbl do +.\" not; they "rectangularize" the table geometry. .TS center; Cb S L L Cb Cb Cb Cb Cb Cb C Lb. -Name +\f(BItermcap\fP Code Obsolete Standard Origin \f(BIterminfo\fP capability _ BO mr AT&T enter_reverse_mode @@ -129,16 +156,18 @@ HS mh IRIX enter_dim_mode .TE .PP -XENIX \fI\%termcap\fP had a set of extension capabilities, +XENIX +.I termcap +had a set of extension capabilities, corresponding to box drawing characters of CCSID (\*(``code page\*('') 437, as follows. .PP .TS center; -cb cb -cb l . -\f(BItermcap\fP Name Graphic +Cb Cb +Cb L . +\f(BItermcap\fP Code Graphic _ G2 upper left corner G3 lower left corner @@ -170,21 +199,30 @@ GG ACS magic cookie count .TE .PP -\fB\%@CAPTOINFO@\fP composes single-line capabilities into an \fBacsc\fP -string, -and discards \fBGG\fP and double-line capabilities with a warning +.B \%@CAPTOINFO@ +composes single-line box-drawing capabilities into a +.I term\%info +.B \%acs_chars +.RB \%( acsc ) +string capability, +and discards +.B GG +and double-line capabilities with a warning diagnostic. .PP -IBM's AIX has a \fI\%\%term\%info\fP facility descended from SVr1 -\fI\%\%term\%info\fP, +AIX has a +.I term\%info +facility descended from SVr2 +.IR term\%info "," but which is incompatible with the SVr4 format. -\fB\%@CAPTOINFO@\fP translates the following AIX extensions. +.B \%@CAPTOINFO@ +translates the following AIX extensions. .PP .TS center; -cb cb -l l . -IBM XSI +Cb Cb +L L . +IBM X/Open _ ksel kslt kbtab kcbt @@ -194,25 +232,44 @@ font3 s3ds .TE .PP -Additionally, -this program translates the AIX \fBbox1\fP capability to an \fBacsc\fP -string. +It furthermore translates the AIX +.B box1 +capability to an +.B \%acs_chars +.RB \%( acsc ) +string capability. .PP -The HP-UX \fI\%\%term\%info\fP library supports two nonstandard -\fI\%\%term\%info\fP capabilities, -\fBmeml\fP (memory lock) and \fBmemu\fP (memory unlock). -\fB\%@CAPTOINFO@\fP discards these with a warning message. +The HP-UX +.I \%term\%info +library supports two nonstandard +.I \%term\%info +capabilities: +.B \%memory_lock +.RB ( meml ) +and +.B \%memory_unlock +.RB ( memu ). +.B \%@CAPTOINFO@ +discards these with a warning message. .SH FILES .TP .I /etc/termcap -default \fI\%termcap\fP terminal capability database +default +.I termcap +terminal capability database +.SH EXTENSIONS +This command is an SVr4 +.I curses +and +.I \%ncurses +extension. .SH PORTABILITY -X/Open Curses, -Issue 7 (2009) describes \fBtic\fP briefly, -but omits this program. +X/Open Curses Issue\ 7 (2009) does not specify this command. .PP -SVr4 systems provide \fB\%captoinfo\fP as a separate application from -\fBtic\fP. +SVr4 systems provide +.I \%captoinfo +as a separate application from +.IR \%tic "." Its .B \-v option does not accept a trace level argument diff --git a/contrib/ncurses/man/clear.1 b/contrib/ncurses/man/clear.1 --- a/contrib/ncurses/man/clear.1 +++ b/contrib/ncurses/man/clear.1 @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: clear.1,v 1.48 2024/03/16 15:35:01 tom Exp $ -.TH @CLEAR@ 1 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" +.\" $Id: clear.1,v 1.53 2025/04/05 21:56:26 tom Exp $ +.TH @CLEAR@ 1 2025-04-05 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -91,8 +91,8 @@ .B \-x prevents \fB\%@CLEAR@\fP from attempting to clear the scrollback buffer. .SH PORTABILITY -Neither IEEE Std 1003.1/The Open Group Base Specifications Issue 7 -(POSIX.1-2008) nor X/Open Curses Issue 7 documents \fB\%@CLEAR@\fP. +Neither IEEE Std 1003.1/The Open Group Base Specifications Issue\ 7 +(POSIX.1-2008) nor X/Open Curses Issue\ 7 documents \fB\%@CLEAR@\fP. .PP The latter documents \fBtput\fP, which could be used to replace this utility either via a shell script or @@ -113,8 +113,10 @@ .PP .RS 4 .EX +.nf /usr/bin/tput ${1:+\-T$1} clear 2> /dev/null exit +.fi .EE .RE .PP diff --git a/contrib/ncurses/man/curs_add_wch.3x b/contrib/ncurses/man/curs_add_wch.3x --- a/contrib/ncurses/man/curs_add_wch.3x +++ b/contrib/ncurses/man/curs_add_wch.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-2024,2025 Thomas E. Dickey * .\" Copyright 2001-2015,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_add_wch.3x,v 1.62 2024/04/20 21:20:07 tom Exp $ -.TH curs_add_wch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_add_wch.3x,v 1.125 2025/11/12 01:06:36 tom Exp $ +.TH curs_add_wch 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -52,230 +52,442 @@ \fB\%mvwadd_wch\fP, \fB\%echo_wchar\fP, \fB\%wecho_wchar\fP \- -add a \fIcurses\fR complex character to a window and advance the cursor +add a \fIcurses\fR complex character to a window, possibly advancing the cursor .SH SYNOPSIS .nf \fB#include .PP -\fBint add_wch(const cchar_t *\fIwch\fP); -\fBint wadd_wch(WINDOW *\fIwin\fP, const cchar_t *\fIwch\fP); -\fBint mvadd_wch(int \fIy\fP, int \fIx\fP, const cchar_t *\fIwch\fP); -\fBint mvwadd_wch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const cchar_t *\fIwch\fP); +\fBint add_wch(const cchar_t * \fIwch\fP); +\fBint wadd_wch(WINDOW * \fIwin\fP, const cchar_t * \fIwch\fP); +\fBint mvadd_wch(int \fIy\fP, int \fIx\fP, const cchar_t * \fIwch\fP); +\fBint mvwadd_wch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, const cchar_t * \fIwch\fP); .PP -\fBint echo_wchar(const cchar_t *\fIwch\fP); -\fBint wecho_wchar(WINDOW *\fIwin\fP, const cchar_t *\fIwch\fP); +\fBint echo_wchar(const cchar_t * \fIwch\fP); +\fBint wecho_wchar(WINDOW * \fIwin\fP, const cchar_t *\fIwch\fP); +.PP +\fI/* (integer) constants */\fP +/*\fI .\|.\|. */ \fBWACS_BLOCK;\fR +/*\fI .\|.\|. */ \fBWACS_BOARD;\fR +/*\fI .\|.\|. */ \fBWACS_BTEE;\fR +/*\fI .\|.\|. */ \fBWACS_BULLET;\fR +/*\fI .\|.\|. */ \fBWACS_CKBOARD;\fR +/*\fI .\|.\|. */ \fBWACS_DARROW;\fR +/*\fI .\|.\|. */ \fBWACS_DEGREE;\fR +/*\fI .\|.\|. */ \fBWACS_DIAMOND;\fR +/*\fI .\|.\|. */ \fBWACS_HLINE;\fR +/*\fI .\|.\|. */ \fBWACS_LANTERN;\fR +/*\fI .\|.\|. */ \fBWACS_LARROW;\fR +/*\fI .\|.\|. */ \fBWACS_LLCORNER;\fR +/*\fI .\|.\|. */ \fBWACS_LRCORNER;\fR +/*\fI .\|.\|. */ \fBWACS_LTEE;\fR +/*\fI .\|.\|. */ \fBWACS_PLMINUS;\fR +/*\fI .\|.\|. */ \fBWACS_PLUS;\fR +/*\fI .\|.\|. */ \fBWACS_RARROW;\fR +/*\fI .\|.\|. */ \fBWACS_RTEE;\fR +/*\fI .\|.\|. */ \fBWACS_S1;\fR +/*\fI .\|.\|. */ \fBWACS_S9;\fR +/*\fI .\|.\|. */ \fBWACS_TTEE;\fR +/*\fI .\|.\|. */ \fBWACS_UARROW;\fR +/*\fI .\|.\|. */ \fBWACS_ULCORNER;\fR +/*\fI .\|.\|. */ \fBWACS_URCORNER;\fR +/*\fI .\|.\|. */ \fBWACS_VLINE;\fR +\fI/* extensions */\fP +/*\fI .\|.\|. */ \fBWACS_GEQUAL;\fR +/*\fI .\|.\|. */ \fBWACS_LEQUAL;\fR +/*\fI .\|.\|. */ \fBWACS_NEQUAL;\fR +/*\fI .\|.\|. */ \fBWACS_PI;\fR +/*\fI .\|.\|. */ \fBWACS_S3;\fR +/*\fI .\|.\|. */ \fBWACS_S7;\fR +/*\fI .\|.\|. */ \fBWACS_STERLING;\fR +\fI/* extensions for thick lines */\fP +/*\fI .\|.\|. */ \fBWACS_T_BTEE;\fR +/*\fI .\|.\|. */ \fBWACS_T_HLINE;\fR +/*\fI .\|.\|. */ \fBWACS_T_LLCORNER;\fR +/*\fI .\|.\|. */ \fBWACS_T_LRCORNER;\fR +/*\fI .\|.\|. */ \fBWACS_T_LTEE;\fR +/*\fI .\|.\|. */ \fBWACS_T_PLUS;\fR +/*\fI .\|.\|. */ \fBWACS_T_RTEE;\fR +/*\fI .\|.\|. */ \fBWACS_T_TTEE;\fR +/*\fI .\|.\|. */ \fBWACS_T_ULCORNER;\fR +/*\fI .\|.\|. */ \fBWACS_T_URCORNER;\fR +/*\fI .\|.\|. */ \fBWACS_T_VLINE;\fR +\fI/* extensions for double lines */\fP +/*\fI .\|.\|. */ \fBWACS_D_BTEE;\fR +/*\fI .\|.\|. */ \fBWACS_D_HLINE;\fR +/*\fI .\|.\|. */ \fBWACS_D_LLCORNER;\fR +/*\fI .\|.\|. */ \fBWACS_D_LRCORNER;\fR +/*\fI .\|.\|. */ \fBWACS_D_LTEE;\fR +/*\fI .\|.\|. */ \fBWACS_D_PLUS;\fR +/*\fI .\|.\|. */ \fBWACS_D_RTEE;\fR +/*\fI .\|.\|. */ \fBWACS_D_TTEE;\fR +/*\fI .\|.\|. */ \fBWACS_D_ULCORNER;\fR +/*\fI .\|.\|. */ \fBWACS_D_URCORNER;\fR +/*\fI .\|.\|. */ \fBWACS_D_VLINE;\fR .fi .SH DESCRIPTION -.SS add_wch -The -\fBadd_wch\fP, -\fBwadd_wch\fP, -\fBmvadd_wch\fP, and -\fBmvwadd_wch\fP -functions put the complex character \fIwch\fP into the given -window at its current position, -which is then advanced. -These functions perform -wrapping and special-character processing as follows: +.SS wadd_wch +.B \%wadd_wch +writes the +.I curses +complex character +.I wch +to the window +.IR win "," +then may advance the cursor position, +analogously to the standard C library's \fI\%putwchar\fP(3). +\fB\%ncurses\fP(3X) describes the variants of this function. +.PP +Construct a +.I curses +complex character +from a +.I wchar_t +with \fB\%setcchar\fP(3X). +A +.I \%cchar_t +can be copied from place to place using \fB\%win_wch\fP(3X) and +.BR \%wadd_wch "." +.I curses +defines constants to aid the manipulation of character attributes; +see \fB\%curs_attr\fP(3X). +A complex character whose only character component is a wide space, +and whose only attribute is +.BR \%WA_NORMAL , +is a +.IR "blank character" "," +and therefore combines with the window's background character; +see \fB\%curs_bkgrnd\fP(3X). +.PP +Much behavior depends on whether the wide characters in +.I wch +are spacing or non-spacing; +see subsection \*(``Complex Characters\*('' below. .bP -If \fIwch\fP refers to a spacing character, -then any previous character at that location is removed. -A new character specified by \fIwch\fP is -placed at that location with rendition specified by \fIwch\fP. -The cursor then advances after this spacing character, -to prepare for writing the next character on the screen. -.IP -The newly added spacing character is the base of the active complex character. -Subsequent non-spacing characters can be combined with this base -until another spacing character is written to the screen, -or the cursor is moved, e.g., using \fBwmove\fP. +If +.I wch +contains a spacing character, +then any character at the cursor is first removed. +The complex character +.IR wch "," +with its attributes and color pair identifier, +becomes the +.I base +of the +.IR "active complex character" "." +.bP +If +.I wch +contains only non-spacing characters, +.\" XXX: see wadd_wch_literal (the beginning of the array may be +.\" nonspacing) +they are combined with the active complex character. +.I curses +ignores its attributes and color pair identifier, +and does not advance the cursor. +.PP +Further non-spacing characters added with +.B \%wadd_wch +are not written at the new cursor position but combine with the active +complex character until another spacing character is written to the +window or the cursor is moved. +.PP +If +.I wch +is a +backspace, +carriage return, +line feed, +or +tab, +the cursor moves appropriately within the window. +.bP +Backspace moves the cursor one character left; +at the left margin of a window, +it does nothing. +.bP +Carriage return moves the cursor to the left margin on the same line of +the window. +.bP +Line feed does a \fB\%clrtoeol\fP(3X), +then advances as if from the right margin. .bP -If \fIwch\fP refers to a non-spacing character, -it is appended to the active complex character, -retaining the previous characters at that location. -The rendition specified by \fIwch\fP is ignored. +Tab advances the cursor to the next tab stop +(possibly on the next line); +these are placed at every eighth column by default. .IP -The cursor is not advanced after adding a non-spacing character. -Subsequent calls to add non-spacing characters will update the same position. +Alter the tab interval with the +.B \%TABSIZE +extension; +see \fB\%curs_variables\fP(3X). +.PP +If +.I wch +is any other nonprintable character, +.I curses +draws it in printable form using the same convention as +\fB\%wunctrl\fP(3X). +Calling \fB\%win_wch\fP(3X) on the location of a nonprintable character +does not retrieve the character itself, +but its \fB\%wunctrl\fP(3X) representation. +.PP +Adding spacing characters with \fB\%wadd_wch\fP +causes it to wrap at the right margin of the window: +.bP +If the cursor is not at the bottom of the scrolling region +and advancement occurs at the right margin, +the cursor automatically wraps to the beginning of the next line. +.bP +If the cursor is at the bottom of the scrolling region +when advancement occurs at the right margin, +and \fB\%scrollok\fP(3X) is enabled for +.IR win , +the scrolling region scrolls up one line +and the cursor wraps as above. +Otherwise, +advancement and scrolling do not occur, +and +.B \%wadd_wch +returns +.BR ERR "." +.PP +A window's margins may coincide with the screen boundaries. +This may be a problem when +.I \%ncurses +updates the screen to match the curses window. +When their right and bottom margins coincide, +.I \%ncurses +uses different strategies to handle the variations of scrolling and wrapping +at the lower-right corner +by depending on the terminal capabilities: +.bP +If the terminal does not automatically wrap as characters +are added at the right margin +(i.e., auto right margins), +.I \%ncurses +writes the character directly. .bP -If the character part of \fIwch\fP is -a tab, newline, backspace or other control character, -the window is updated and the cursor moves as if \fBaddch\fP were called. -.SS echo_wchar -The \fBecho_wchar\fP -function is functionally equivalent to a call to -\fBadd_wch\fP -followed by a call to -\fB\%refresh\fP(3X). -Similarly, the -\fBwecho_wchar\fP -is functionally equivalent to a call to -\fBwadd_wch\fP -followed by a call to -\fBwrefresh\fP. -The knowledge -that only a single character is being output is taken into consideration and, -for non-control characters, a considerable performance gain might be seen -by using the *\fBecho\fP* functions instead of their equivalents. -.SS "Line Graphics" -Like \fB\%addch\fP(3X), -\fBaddch_wch\fP accepts symbols which make it simple to draw lines and other -frequently used special characters. -These symbols correspond to the same VT100 line-drawing set as -\fB\%addch\fP(3X). +If the terminal has auto right margins, +but also has capabilities for turning auto margins off and on, +.I \%ncurses +turns the auto margin feature off temporarily +when writing to the lower-right corner. +.bP +If the terminal has an insertion mode which can be turned off and on, +.I \%ncurses +writes the character just before the lower-right corner, +and then inserts a character to push the update into the corner. +.SS wecho_wchar +.B \%echo_wchar +and +.B \%wecho_wchar +are equivalent to calling +.RB \%( w ) add_wch +followed by +.RB \%( w ) refresh +on +.B \%stdscr +or the specified window. +.I curses +interprets these functions as a hint that only a single (complex) +character is being output; +for non-control characters, +a considerable performance gain may be enjoyed by employing them. +.\" TODO: Combine the following with the "Line Drawing" subsection of +.\" terminfo(5) and replace this with a cross reference there. +.SS "Forms-Drawing Characters" +.I curses +defines macros starting with +.B \%WACS_ +that can be used with +.B \%wadd_wch +to write line-drawing and other symbols to the screen. +.I \%ncurses +terms these +.I "forms-drawing characters." +.I curses +uses the ACS default listed below if the terminal type lacks the +.B \%acs_chars +.RB \%( acsc ) +capability; +that capability does not define a replacement for the character; +or if the terminal type and locale configuration +require Unicode to access these characters, +but the library is unable to use Unicode. +The \*(``acsc char\*('' column corresponds to how the characters are +specified in the +.B \%acs_chars +.RB \%( acsc ) +string capability, +and the characters in it may appear on the screen if the terminal type's +database entry incorrectly advertises ACS support. +The name \*(``ACS\*('' originates in the Alternate Character Set feature +of the DEC VT100 terminal. .PP +.ie t .ne 4v +.el .ne 5v .TS Lb Lb Lb Lb Lb Lb Lb Lb Lb Lb -Lb L L L Lx. -\& Unicode ASCII acsc \& -ACS Name Default Default Char Glyph Name +Lb L L L Lw(15n)x. +\& Unicode ACS acsc \& +Symbol Default Default char Glyph Name _ -WACS_BLOCK 0x25ae # 0 T{ +WACS_BLOCK U+25ae # 0 T{ solid square block T} -WACS_BOARD 0x2592 # h board of squares -WACS_BTEE 0x2534 + v bottom tee -WACS_BULLET 0x00b7 o ~ bullet -WACS_CKBOARD 0x2592 : a T{ +WACS_BOARD U+2592 # h board of squares +WACS_BTEE U+2534 + v bottom tee +WACS_BULLET U+00b7 o ~ bullet +WACS_CKBOARD U+2592 : a T{ checker board (stipple) T} -WACS_DARROW 0x2193 v . T{ +WACS_DARROW U+2193 v . T{ arrow pointing down T} -WACS_DEGREE 0x00b0 ' f degree symbol -WACS_DIAMOND 0x25c6 + \(ga diamond -WACS_GEQUAL 0x2265 > > T{ +WACS_DEGREE U+00b0 ' f degree symbol +WACS_DIAMOND U+25c6 + \(ga diamond +WACS_GEQUAL U+2265 > > T{ +.if n .na \" avoid adjustment warning from groff greater-than-or-equal-to T} -WACS_HLINE 0x2500 \- q horizontal line -WACS_LANTERN 0x2603 # i lantern symbol -WACS_LARROW 0x2190 < , T{ +WACS_HLINE U+2500 \- q horizontal line +WACS_LANTERN U+2603 # i lantern symbol +WACS_LARROW U+2190 < , T{ arrow pointing left T} -WACS_LEQUAL 0x2264 < y T{ +WACS_LEQUAL U+2264 < y T{ +.if n .na \" avoid adjustment warning from groff less-than-or-equal-to T} -WACS_LLCORNER 0x2514 + m T{ +WACS_LLCORNER U+2514 + m T{ lower left-hand corner T} -WACS_LRCORNER 0x2518 + j T{ +WACS_LRCORNER U+2518 + j T{ lower right-hand corner T} -WACS_LTEE 0x2524 + t left tee -WACS_NEQUAL 0x2260 ! | not-equal -WACS_PI 0x03c0 * { greek pi -WACS_PLMINUS 0x00b1 # g plus/minus -WACS_PLUS 0x253c + n plus -WACS_RARROW 0x2192 > + T{ +WACS_LTEE U+2524 + t left tee +WACS_NEQUAL U+2260 ! | not-equal +WACS_PI U+03c0 * { greek pi +WACS_PLMINUS U+00b1 # g plus/minus +WACS_PLUS U+253c + n plus +WACS_RARROW U+2192 > + T{ arrow pointing right T} -WACS_RTEE 0x251c + u right tee -WACS_S1 0x23ba \- o scan line 1 -WACS_S3 0x23bb \- p scan line 3 -WACS_S7 0x23bc \- r scan line 7 -WACS_S9 0x23bd \&_ s scan line 9 -WACS_STERLING 0x00a3 f } T{ +WACS_RTEE U+251c + u right tee +WACS_S1 U+23ba \- o scan line 1 +WACS_S3 U+23bb \- p scan line 3 +WACS_S7 U+23bc \- r scan line 7 +WACS_S9 U+23bd \&_ s scan line 9 +WACS_STERLING U+00a3 f } T{ +.if n .na \" avoid adjustment warning from groff pound-sterling symbol T} -WACS_TTEE 0x252c + w top tee -WACS_UARROW 0x2191 ^ \- T{ +WACS_TTEE U+252c + w top tee +WACS_UARROW U+2191 ^ \- T{ arrow pointing up T} -WACS_ULCORNER 0x250c + l T{ +WACS_ULCORNER U+250c + l T{ upper left-hand corner T} -WACS_URCORNER 0x2510 + k T{ +WACS_URCORNER U+2510 + k T{ upper right-hand corner T} -WACS_VLINE 0x2502 | x vertical line +WACS_VLINE U+2502 | x vertical line .TE .PP -The wide-character configuration of \fI\%ncurses\fP also defines symbols -for thick lines (\fBacsc\fP \*(``J\*('' to \*(``V\*(''): +The +.I \%ncurses +wide API also defines symbols for thick lines +.RB \%( acsc +\*(``J\*('' through \*(``N\*('', +\*(``T\*('' through \*(``X\*('', +and \*(``Q\*(''): .PP .TS Lb Lb Lb Lb Lb Lb Lb Lb Lb Lb -Lb L L L Lx. +Lb L L L Lw(14n)x. \& Unicode ASCII acsc \& ACS Name Default Default Char Glyph Name _ -WACS_T_BTEE 0x253b + V T{ +WACS_T_BTEE U+253b + V T{ thick tee pointing up T} -WACS_T_HLINE 0x2501 - Q T{ +WACS_T_HLINE U+2501 - Q T{ thick horizontal line T} -WACS_T_LLCORNER 0x2517 + M T{ +WACS_T_LLCORNER U+2517 + M T{ thick lower left corner T} -WACS_T_LRCORNER 0x251b + J T{ +WACS_T_LRCORNER U+251b + J T{ thick lower right corner T} -WACS_T_LTEE 0x252b + T T{ +WACS_T_LTEE U+252b + T T{ thick tee pointing right T} -WACS_T_PLUS 0x254b + N T{ +WACS_T_PLUS U+254b + N T{ thick large plus T} -WACS_T_RTEE 0x2523 + U T{ +WACS_T_RTEE U+2523 + U T{ thick tee pointing left T} -WACS_T_TTEE 0x2533 + W T{ +WACS_T_TTEE U+2533 + W T{ thick tee pointing down T} -WACS_T_ULCORNER 0x250f + L T{ +WACS_T_ULCORNER U+250f + L T{ thick upper left corner T} -WACS_T_URCORNER 0x2513 + K T{ +WACS_T_URCORNER U+2513 + K T{ thick upper right corner T} -WACS_T_VLINE 0x2503 | X T{ +WACS_T_VLINE U+2503 | X T{ thick vertical line T} .TE .PP -and for double-lines (\fBacsc\fP \*(``A\*('' to \*(``I\*(''): +and for double lines +.RB \%( acsc +\*(``A\*('' through \*(``I\*('', +plus \*(``R\*('' and \*(``Y\*(''): .PP .TS Lb Lb Lb Lb Lb Lb Lb Lb Lb Lb -Lb L L L Lx. +Lb L L L Lw(14n)x. \& Unicode ASCII acsc \& ACS Name Default Default Char Glyph Name _ -WACS_D_BTEE 0x2569 + H T{ +WACS_D_BTEE U+2569 + H T{ double tee pointing up T} -WACS_D_HLINE 0x2550 - R T{ +WACS_D_HLINE U+2550 - R T{ double horizontal line T} -WACS_D_LLCORNER 0x255a + D T{ +WACS_D_LLCORNER U+255a + D T{ double lower left corner T} -WACS_D_LRCORNER 0x255d + A T{ +WACS_D_LRCORNER U+255d + A T{ double lower right corner T} -WACS_D_LTEE 0x2560 + F T{ +WACS_D_LTEE U+2560 + F T{ double tee pointing right T} -WACS_D_PLUS 0x256c + E T{ +WACS_D_PLUS U+256c + E T{ double large plus T} -WACS_D_RTEE 0x2563 + G T{ +WACS_D_RTEE U+2563 + G T{ double tee pointing left T} -WACS_D_TTEE 0x2566 + I T{ +WACS_D_TTEE U+2566 + I T{ double tee pointing down T} -WACS_D_ULCORNER 0x2554 + C T{ +WACS_D_ULCORNER U+2554 + C T{ double upper left corner T} -WACS_D_URCORNER 0x2557 + B T{ +WACS_D_URCORNER U+2557 + B T{ double upper right corner T} -WACS_D_VLINE 0x2551 | Y T{ +WACS_D_VLINE U+2551 | Y T{ double vertical line T} .TE @@ -291,26 +503,36 @@ .bP U+2550 BOX DRAWINGS DOUBLE HORIZONTAL .SH RETURN VALUE -All routines return the integer \fBERR\fP upon failure and \fBOK\fP on success. +These functions return +.B OK +on success and +.B ERR +on failure. .PP -X/Open Curses does not specify any error conditions. -This implementation returns an error +In +.IR \%ncurses , +these functions fail if .bP -if the window pointer is null or +the +.I curses +screen has not been initialized, .bP -if it is not possible to add a complete character in the window. -.PP -The latter may be due to different causes: +(for functions taking a +.I \%WINDOW +pointer argument) +.I win +is a null pointer, .bP -If \fB\%scrollok\fP(3X) is not enabled, -writing a character at the lower right margin succeeds. -However, -an error is returned because it is not possible to wrap to a new line. +wrapping to a new line is impossible because \fB\%scrollok\fP(3X) has +not been called on +.I win +(or +.BR \%stdscr "," +as applicable) +when writing to its bottom right location is attempted, +or .bP -If an error is detected when converting a multibyte character to a sequence -of bytes, -or if it is not possible to add all of the resulting bytes in the window, -an error is returned. +it is not possible to add a complete character at the cursor position. .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -318,78 +540,155 @@ .IR x ) is outside the window boundaries. .SH NOTES -Note that -\fBadd_wch\fP, -\fBmvadd_wch\fP, -\fBmvwadd_wch\fP, and -\fBecho_wchar\fP -may be macros. +.BR add_wch "," +.BR mvadd_wch "," +.BR mvwadd_wch "," +and +.B echo_wchar +may be implemented as macros. +.SH EXTENSIONS +The symbols +.IR \%WACS_S3 "," +.IR \%WACS_S7 "," +.IR \%WACS_LEQUAL "," +.IR \%WACS_GEQUAL "," +.IR \%WACS_PI "," +.IR \%WACS_NEQUAL "," +and +.I \%WACS_STERLING +are not standard. +However, +many publicly available +.I \%term\%info +entries include +.B \%acs_chars +.RB \%( acsc ) +capabilities in which their key characters +.RB ( pryz{|} ) +are embedded, +and a second-hand list of their character descriptions has come to +light. +The +.I \%ncurses +developers invented WACS-prefixed names for them. +.\" in v5_2_20020209 .SH PORTABILITY -These functions are described in X/Open Curses, Issue 4. -The defaults specified for line-drawing characters apply in the POSIX locale. -.SS "WACS Symbols" +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. +.PP +These functions are described in X/Open Curses Issue\ 4. +It specifies no error conditions for them. +.PP +The defaults specified for forms-drawing characters apply in the POSIX +locale. X/Open Curses makes it clear that the WACS_ symbols should be defined as -a pointer to \fBcchar_t\fP data, e.g., in the discussion of \fBborder_set\fP. +a pointer to +.I \%cchar_t +data, e.g., in the discussion of +.IR \%border_set "." A few implementations are problematic: .bP -NetBSD curses defines the symbols as a \fBwchar_t\fP within a \fBcchar_t\fP. +NetBSD +.I curses +defines the symbols as a +.I \%wchar_t +within a +.IR \%cchar_t "." .bP -HP-UX curses equates some of the \fBACS_\fP symbols -to the analogous \fBWACS_\fP symbols as if the \fBACS_\fP symbols were +HP-UX +.I curses +equates some of the +.I \%ACS_ +symbols to the analogous +.I \%WACS_ +symbols as if the +.I \%ACS_ +symbols were wide characters. The misdefined symbols are the arrows and other symbols which are not used for line-drawing. .PP X/Open Curses does not specify symbols for thick- or double-lines. -SVr4 curses implementations defined their line-drawing symbols in -terms of intermediate symbols. -This implementation extends those symbols, providing new definitions -which are not in the SVr4 implementations. +SVr4 +.I curses +implementations defined their line-drawing symbols +in terms of intermediate symbols. +.I \%ncurses +extends those symbols, +providing new definitions not found in SVr4 implementations. .PP Not all Unicode-capable terminals provide support for VT100-style -alternate character sets (i.e., the \fBacsc\fP capability), +alternate character sets (i.e., the +.I \%acsc_chars +.RB ( acsc ) +capability), with their corresponding line-drawing characters. X/Open Curses did not address the aspect of integrating Unicode with line-drawing characters. -Existing implementations of Unix curses (AIX, HP-UX, Solaris) -use only the \fBacsc\fP character-mapping to provide this feature. -As a result, those implementations can only use single-byte line-drawing -characters. -\fI\%ncurses\fP 5.3 (2002) provided a table of Unicode values to solve +Existing implementations of System\ V +.I curses +(AIX, HP-UX, Solaris) +use only the +.I \%acsc_chars +.RB ( acsc ) +character-mapping to provide this feature. +As a result, +those implementations can use only single-byte line-drawing characters. +.I \%ncurses +5.3 (2002) provided a table of Unicode values to solve these problems. -NetBSD curses incorporated that table in 2010. +NetBSD +.I curses +incorporated that table in 2010. .PP -In this implementation, the Unicode values are used instead of the -terminal description's \fBacsc\fP mapping as discussed in +.I \%ncurses +uses the Unicode values instead of the terminal type description's +.I \%acsc_chars +.RB ( acsc ) +mapping as discussed in \fB\%ncurses\fP(3X) for the environment variable -\fINCURSES_NO_UTF8_ACS\fP. +.IR \%NCURSES_NO_UTF8_ACS "." In contrast, for the same cases, the line-drawing characters described in \fB\%addch\fP(3X) will use only the ASCII default values. .PP Having Unicode available does not solve all of the problems with -line-drawing for curses: +line-drawing for +.IR curses ":" .bP The closest Unicode equivalents to the -VT100 graphics \fIS1\fP, \fIS3\fP, \fIS7\fP and \fIS9\fP +VT100 graphics +.IR S1 "," +.IR S3 "," +.IR S7 "," +and +.I S9 frequently are not displayed at the regular intervals which the terminal used. .bP -The \fIlantern\fP is a special case. +The +.I lantern +is a special case. It originated with the AT&T 4410 terminal in the early 1980s. There is no accessible documentation depicting the lantern symbol on the AT&T terminal. .IP -Lacking documentation, most readers assume that a \fIstorm lantern\fP +Lacking documentation, most readers assume that a +.I "storm lantern" was intended. But there are several possibilities, all with problems. .IP Unicode 6.0 (2010) does provide two lantern symbols: U+1F383 and U+1F3EE. -Those were not available in 2002, and are irrelevant since -they lie outside the BMP and as a result are not generally available -in terminals. +Those were not available in 2002, +and are irrelevant since they lie outside the Basic Multilingual Plane +and as a result are unavailable on many terminals. They are not storm lanterns, in any case. .IP -Most \fIstorm lanterns\fP have a tapering glass chimney +Most +.I "storm lanterns" +have a tapering glass chimney (to guard against tipping); some have a wire grid protecting the chimney. .IP @@ -406,32 +705,77 @@ \[u256C] U+256C (forms double vertical and horizontal), and \[u2612] U+2612 (ballot box with x). .SS "Complex Characters" -The complex character type \fBcchar_t\fR -can store more than one wide character (\fBwchar_t\fR). -The X/Open Curses description does not mention this possibility, -describing only the cases where \fIwch\fP is a spacing character -or a non-spacing character. +The complex character type +.I \%cchar_t +can store more than one wide character +.RI \%( wchar_t ). +X/Open Curses does not mention this possibility, +specifying behavior only where +.I wch +is a single character, +either spacing or non-spacing. .PP -This implementation assumes that \fIwch\fP is constructed using -\fB\%setcchar\fP(3X), and in turn that the result +.I \%ncurses +assumes that +.I wch +is constructed using \fB\%setcchar\fP(3X), +and in turn that the result .bP -contains at most one spacing character in the beginning of its list of wide -characters, -and zero or more non-spacing characters +contains at most one spacing character at the beginning of its list of +wide characters, +and zero or more non-spacing characters, or .bP -may hold one non-spacing character. +holds one non-spacing character. .PP In the latter case, -\fI\%ncurses\fP adds the non-spacing character to the active -(base) spacing character. -.SS TABSIZE -The -.B TABSIZE -variable is implemented in SVr4 and other versions of -.IR curses , -but is not specified by X/Open Curses -(see \fBcurs_variables\fP(3X)). +.I \%ncurses +adds the non-spacing character to the active complex character. +.SH HISTORY +X/Open Curses Issue\ 4 (1995) initially specified these functions. +The System\ V Interface Definition (SVID) Version\ 4 +of the same year +specified functions named +.I \%waddwch +(and the usual variants), +.IR \%echowchar "," +and +.IR \%wechowchar "." +.\" SVID 4, vol 3., p. 475 +These were later additions to +.RI SVr4. x , +not appearing in the first SVr4 (1989). +They differed from X/Open's later +.I \%wadd_wch +and +.I \%wecho_wchar +in that they each took an argument of type +.I \%wchar_t +instead of +.IR \%cchar_t "." +SVID defined no +.I \% WACS_ +symbols. +.PP +X/Open Curses Issue\ 4 also defined many of the +.I WACS_ +constants, +excepting +.IR \%WACS_GEQUAL "," +.IR \%WACS_LEQUAL "," +.IR \%WACS_NEQUAL "," +.IR \%WACS_PI "," +.IR \%WACS_S3 "," +.IR \%WACS_S7 "," +and +.IR \%WACS_STERLING ";" +and those for drawing thick and double lines. +.PP +.I \%ncurses +5.3 (2002) +furnished the remaining +.I WACS_ +constants. .SH SEE ALSO \fB\%curs_addch\fP(3X) describes comparable functions of the .I \%ncurses @@ -441,6 +785,7 @@ \fB\%curs_addwstr\fP(3X), \fB\%curs_add_wchstr\fP(3X), \fB\%curs_attr\fP(3X), +\fB\%curs_bkgrnd\fP(3X), \fB\%curs_clear\fP(3X), \fB\%curs_getcchar\fP(3X), \fB\%curs_outopts\fP(3X), diff --git a/contrib/ncurses/man/curs_add_wchstr.3x b/contrib/ncurses/man/curs_add_wchstr.3x --- a/contrib/ncurses/man/curs_add_wchstr.3x +++ b/contrib/ncurses/man/curs_add_wchstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-2024,2025 Thomas E. Dickey * .\" Copyright 2002-2012,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_add_wchstr.3x,v 1.39 2024/04/20 21:20:07 tom Exp $ -.TH curs_add_wchstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_add_wchstr.3x,v 1.61 2025/10/21 00:06:34 tom Exp $ +.TH curs_add_wchstr 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -46,68 +46,91 @@ .. .SH NAME \fB\%add_wchstr\fP, -\fB\%add_wchnstr\fP, \fB\%wadd_wchstr\fP, -\fB\%wadd_wchnstr\fP, \fB\%mvadd_wchstr\fP, -\fB\%mvadd_wchnstr\fP, \fB\%mvwadd_wchstr\fP, +\fB\%add_wchnstr\fP, +\fB\%wadd_wchnstr\fP, +\fB\%mvadd_wchnstr\fP, \fB\%mvwadd_wchnstr\fP \- add a \fIcurses\fR complex character string to a window .SH SYNOPSIS .nf \fB#include .PP -\fBint add_wchstr(const cchar_t *\fIwchstr\fP); -\fBint wadd_wchstr(WINDOW * \fIwin\fP, const cchar_t *\fIwchstr\fP); -\fBint mvadd_wchstr(int \fIy\fP, int \fIx\fP, const cchar_t *\fIwchstr\fP); -\fBint mvwadd_wchstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const cchar_t *\fIwchstr\fP); +\fBint add_wchstr(const cchar_t * \fIwchstr\fP); +\fBint wadd_wchstr(WINDOW * \fIwin\fP, const cchar_t * \fIwchstr\fP); +\fBint mvadd_wchstr(int \fIy\fP, int \fIx\fP, const cchar_t * \fIwchstr\fP); +\fBint mvwadd_wchstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, const cchar_t * \fIwchstr\fP); .PP -\fBint add_wchnstr(const cchar_t *\fIwchstr\fP, int \fIn\fP); -\fBint wadd_wchnstr(WINDOW * \fIwin\fP, const cchar_t *\fIwchstr\fP, int \fIn\fP); -\fBint mvadd_wchnstr(int \fIy\fP, int \fIx\fP, const cchar_t *\fIwchstr\fP, int \fIn\fP); -\fBint mvwadd_wchnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const cchar_t *\fIwchstr\fP, int \fIn\fP); +\fBint add_wchnstr(const cchar_t * \fIwchstr\fP, int \fIn\fP); +\fBint wadd_wchnstr(WINDOW * \fIwin\fP, const cchar_t * \fIwchstr\fP, int \fIn\fP); +\fBint mvadd_wchnstr(int \fIy\fP, int \fIx\fP, const cchar_t * \fIwchstr\fP, int \fIn\fP); +\fBint mvwadd_wchnstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, + const cchar_t * \fIwchstr\fP, int \fIn\fP); .fi .SH DESCRIPTION -These functions copy the (null-terminated) -array of complex characters \fIwchstr\fP -into the window image structure -starting at the current cursor position. -.PP -The four functions with \fIn\fP as the last -argument copy at most \fIn\fP elements, -but no more than will fit on the line. -If \fBn\fP=\fB\-1\fP then the whole array is copied, -to the maximum number of characters that will fit on the line. +.B \%wadd_wchstr +copies the string of complex characters +.I \%wchstr +to the window +.IR win "." +A null complex character terminates the string. +If a complex character does not completely fit at the end of the line, +.I curses +fills its remaining cells with the window's background character; +see \fB\%bkgrnd\fP(3X). +.B \%wadd_wchnstr +does the same, +but copies at most +.I n +characters, +or as many as possible if +.I n +is +.BR \-1 "." +\fB\%ncurses\fP(3X) describes the variants of these functions. .PP -The window cursor is \fInot\fP advanced. -These functions are faster than \fBwaddnstr\fP. -On the other hand: +Because these functions do not call \fB\%wadd_wch\fP(3X) internally, +they are faster than \fB\%waddwstr\fP(3X) and \fB\%waddnwstr\fP(3X). +On the other hand, +they .bP -they do not perform checking -(such as for the newline, backspace, or carriage return characters), +do not treat the backspace, +carriage return, +or line feed characters specially; .bP -they do not advance the current cursor position, +do not represent unprintable characters with \fB\%wunctrl\fP(3X); .bP -they do not expand other control characters to ^-escapes, and +do not update the cursor position to follow the last character written; +and .bP -they truncate the string if it crosses the right margin, -rather than wrapping it around to the new line. -.PP -These functions end successfully -on encountering a null \fBcchar_t\fP, or -when they have filled the current line. -If a complex character cannot completely fit at the end of the current line, -the remaining columns are filled with the background character and rendition. +truncate the string at the window's right margin, +rather than wrapping it to the next line and potentially scrolling. .SH RETURN VALUE -All functions return the integer \fBERR\fP upon failure and \fBOK\fP on success. +These functions return +.B OK +on success and +.B ERR +on failure. .PP -X/Open Curses does not specify any error conditions. -This implementation returns an error +In +.IR \%ncurses "," +these functions fail if +.bP +the +.I curses +screen has not been initialized, .bP -if the \fIwin\fP parameter is null or +.I wchstr +is a null pointer, +or .bP -if the \fIwchstr\fP parameter is null. +(for functions taking a +.I \%WINDOW +pointer argument) +.I win +is a null pointer. .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -115,9 +138,33 @@ .IR x ) is outside the window boundaries. .SH NOTES -All functions except \fBwadd_wchnstr\fP may be macros. +All of these functions except +.B \%wadd_wchnstr +may be implemented as macros. .SH PORTABILITY -These functions are described in X/Open Curses, Issue 4. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.SH HISTORY +X/Open Curses Issue\ 4 (1995) initially specified these functions. +The System\ V Interface Definition Version\ 4 +of the same year +specified functions named +.I \%waddwchstr +and +.I \%waddwchnstr +(and the usual variants). +.\" SVID 4, vol 3., p. 477 +These were later additions to +.RI SVr4. x , +not appearing in the first SVr4 (1989). +They differed from X/Open's later +.I \%wadd_wchstr +and +.I \%wadd_wchnstr +in that they each took an argument of type +.I \%wchar_t +instead of +.IR \%cchar_t "." .SH SEE ALSO \fB\%curs_addchstr\fP(3X) describes comparable functions of the .I \%ncurses diff --git a/contrib/ncurses/man/curs_addch.3x b/contrib/ncurses/man/curs_addch.3x --- a/contrib/ncurses/man/curs_addch.3x +++ b/contrib/ncurses/man/curs_addch.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2015,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_addch.3x,v 1.85 2024/04/20 19:03:47 tom Exp $ -.TH curs_addch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_addch.3x,v 1.144 2025/11/12 01:04:12 tom Exp $ +.TH curs_addch 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -64,33 +64,91 @@ \fB#include .PP \fBint addch(const chtype \fIch\fP); -\fBint waddch(WINDOW *\fIwin\fP, const chtype \fIch\fP); +\fBint waddch(WINDOW * \fIwin\fP, const chtype \fIch\fP); \fBint mvaddch(int \fIy\fP, int \fIx\fP, const chtype \fIch\fP); -\fBint mvwaddch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const chtype \fIch\fP); +\fBint mvwaddch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, const chtype \fIch\fP); .PP \fBint echochar(const chtype \fIch\fP); -\fBint wechochar(WINDOW *\fIwin\fP, const chtype \fIch\fP); +\fBint wechochar(WINDOW * \fIwin\fP, const chtype \fIch\fP); +.PP +\fI/* (integer) constants */\fP +/*\fI .\|.\|. */ \fBACS_BLOCK;\fR +/*\fI .\|.\|. */ \fBACS_BOARD;\fR +/*\fI .\|.\|. */ \fBACS_BTEE;\fR +/*\fI .\|.\|. */ \fBACS_BULLET;\fR +/*\fI .\|.\|. */ \fBACS_CKBOARD;\fR +/*\fI .\|.\|. */ \fBACS_DARROW;\fR +/*\fI .\|.\|. */ \fBACS_DEGREE;\fR +/*\fI .\|.\|. */ \fBACS_DIAMOND;\fR +/*\fI .\|.\|. */ \fBACS_HLINE;\fR +/*\fI .\|.\|. */ \fBACS_LANTERN;\fR +/*\fI .\|.\|. */ \fBACS_LARROW;\fR +/*\fI .\|.\|. */ \fBACS_LLCORNER;\fR +/*\fI .\|.\|. */ \fBACS_LRCORNER;\fR +/*\fI .\|.\|. */ \fBACS_LTEE;\fR +/*\fI .\|.\|. */ \fBACS_PLMINUS;\fR +/*\fI .\|.\|. */ \fBACS_PLUS;\fR +/*\fI .\|.\|. */ \fBACS_RARROW;\fR +/*\fI .\|.\|. */ \fBACS_RTEE;\fR +/*\fI .\|.\|. */ \fBACS_S1;\fR +/*\fI .\|.\|. */ \fBACS_S9;\fR +/*\fI .\|.\|. */ \fBACS_TTEE;\fR +/*\fI .\|.\|. */ \fBACS_UARROW;\fR +/*\fI .\|.\|. */ \fBACS_ULCORNER;\fR +/*\fI .\|.\|. */ \fBACS_URCORNER;\fR +/*\fI .\|.\|. */ \fBACS_VLINE;\fR +\fI/* extensions */\fP +/*\fI .\|.\|. */ \fBACS_GEQUAL;\fR +/*\fI .\|.\|. */ \fBACS_LEQUAL;\fR +/*\fI .\|.\|. */ \fBACS_NEQUAL;\fR +/*\fI .\|.\|. */ \fBACS_PI;\fR +/*\fI .\|.\|. */ \fBACS_S3;\fR +/*\fI .\|.\|. */ \fBACS_S7;\fR +/*\fI .\|.\|. */ \fBACS_STERLING;\fR .fi .SH DESCRIPTION -.SS "Adding Characters" +.SS waddch .B \%waddch -puts the character +writes the +.I curses +character .I ch -at the cursor position of window -.IR win , +to the window +.IR win "," then advances the cursor position, analogously to the standard C library's \fI\%putchar\fP(3). \fB\%ncurses\fP(3X) describes the variants of this function. .PP -If advancement occurs at the right margin, -.bP -the cursor automatically wraps to the beginning of the next line; -and -.bP -at the bottom of the current scrolling region, -and if \fB\%scrollok\fP(3X) is enabled for -.IR win , -the scrolling region scrolls up one line. +Construct a +.I curses +character +from a +.I char +by assignment or typecast. +Subsection \*(``Video Attributes\*('' of \fB\%attron\fP(3X) describes +how to manipulate its attributes and color pair. +(A color pair selection is not honored unless initialized; +see \fB\%start_color\fP(3X).) +.PP +The object or expression +.I ch +may contain attributes and/or a color pair identifier. +(A +.I \%chtype +can be copied from place to place using \fB\%winch\fP(3X) and +.BR \%waddch .) +.I curses +defines constants to aid the manipulation of character attributes; +see \fB\%curs_attr\fP(3X). +A +.I ch +whose character component is a space, +and whose only attribute is +.BR \%A_NORMAL , +is a +.IR "blank character" "," +and therefore combines with the window's background character; +see \fB\%curs_bkgd\fP(3X). .PP If .I ch @@ -106,18 +164,16 @@ at the left margin of a window, it does nothing. .bP -Carriage return moves the cursor to the left margin on the current line -of the window. +Carriage return moves the cursor to the left margin on the same line of +the window. .bP Line feed does a \fB\%clrtoeol\fP(3X), -then moves the cursor to the left margin on the next line of the window, -and if \fB\%scrollok\fP(3X) is enabled for -.IR win , -scrolls the window if the cursor was already on the last line. +then advances as if from the right margin. .bP Tab advances the cursor to the next tab stop (possibly on the next line); these are placed at every eighth column by default. +.IP Alter the tab interval with the .B \%TABSIZE extension; @@ -126,33 +182,74 @@ If .I ch is any other nonprintable character, -it is drawn in printable form, -using the same convention as \fB\%unctrl\fP(3X). -.PP +.I curses +draws it in printable form using the same convention as +\fB\%unctrl\fP(3X). Calling \fB\%winch\fP(3X) on the location of a nonprintable character does not return the character itself, but its \fB\%unctrl\fP(3X) representation. .PP -.I ch -may contain rendering and/or color attributes, -and others can be combined with the parameter -by logically \*(``or\*(''ing with it. -(A character with its attributes can be copied from place to place -using \fB\%winch\fP(3X) and -.BR \%waddch .) -See \fB\%curs_attr\fP(3X) for values of predefined video attribute -constants that can be usefully \*(``or\*(''ed with characters. -.SS "Echoing Characters" +Adding printable characters with \fB\%waddch\fP +causes it to wrap at the right margin of the window: +.bP +If the cursor is not at the bottom of the scrolling region +and advancement occurs at the right margin, +the cursor automatically wraps to the beginning of the next line. +.bP +If the cursor is at the bottom of the scrolling region +when advancement occurs at the right margin, +and \fB\%scrollok\fP(3X) is enabled for +.IR win , +the scrolling region scrolls up one line +and the cursor wraps as above. +Otherwise, +advancement and scrolling do not occur, +and +.B \%waddch +returns +.BR ERR "." +.PP +A window's margins may coincide with the screen boundaries. +This may be a problem when +.I \%ncurses +updates the screen to match the curses window. +When their right and bottom margins coincide, +.I \%ncurses +uses different strategies to handle the variations of scrolling and wrapping +at the lower-right corner +by depending on the terminal capabilities: +.bP +If the terminal does not automatically wrap as characters +are added at the right margin +(i.e., auto right margins), +.I \%ncurses +writes the character directly. +.bP +If the terminal has auto right margins, +but also has capabilities for turning auto margins off and on, +.I \%ncurses +turns the auto margin feature off temporarily +when writing to the lower-right corner. +.bP +If the terminal has an insertion mode which can be turned off and on, +.I \%ncurses +writes the character just before the lower-right corner, +and then inserts a character to push the update into the corner. +.SS wechochar .B \%echochar and .B \%wechochar are equivalent to calling .RB \%( w ) addch followed by -.RB \%( w ) refresh . +.RB \%( w ) refresh +on +.B \%stdscr +or the specified window. .I curses -interprets these functions as a hint that only a single character is -being output; +interprets these functions as a hint to its optimizer +that only a single character cell in the window +is being altered between refreshes; for non-control characters, a considerable performance gain may be enjoyed by employing them. .\" TODO: Combine the following with the "Line Drawing" subsection of @@ -163,26 +260,31 @@ .B \%ACS_ that can be used with .B \%waddch -to write line-drawing and other special characters to the screen. +to write line-drawing and other symbols to the screen. .I \%ncurses terms these .I "forms-drawing characters." -The ACS default listed below is used if the +.I curses +uses the ACS default listed below if the terminal type lacks the .B \%acs_chars -.RB ( \%acsc ) -.I \%term\%info -capability does not define a terminal-specific replacement for it, -or if the terminal and locale configuration requires Unicode to access -these characters but the library is unable to use Unicode. +.RB \%( acsc ) +capability; +that capability does not define a replacement for the character; +or if the terminal type and locale configuration +require Unicode to access these characters, +but the library is unable to use Unicode. The \*(``acsc char\*('' column corresponds to how the characters are specified in the .B \%acs_chars +.RB \%( acsc ) string capability, -and the characters in it may appear on the screen if the terminal's +and the characters in it may appear on the screen if the terminal type's database entry incorrectly advertises ACS support. The name \*(``ACS\*('' originates in the Alternate Character Set feature of the DEC VT100 terminal. .PP +.ie t .ne 4v +.el .ne 5v .TS Lb Lb Lb Lb Lb Lb Lb Lb @@ -232,26 +334,40 @@ .PP In .IR \%ncurses , -.B \%waddch -returns -.B ERR -if it is not possible to add a complete character at the cursor -position, -as when conversion of a multibyte character to a byte sequence fails, -or at least one of the resulting bytes cannot be added to the window. -See section \*(``PORTABILITY\*('' below regarding the use of -.B \%waddch -with multibyte characters. +these functions fail if +.bP +the +.I curses +screen has not been initialized, +.bP +(for functions taking a +.I \%WINDOW +pointer argument) +.I win +is a null pointer, +.bP +wrapping to a new line is impossible because \fB\%scrollok\fP(3X) has +not been called on +.I win +(or +.BR \%stdscr "," +as applicable) +when a write to its bottom right location is attempted, +or +.bP +it is not possible to add a complete character at the cursor position. .PP +The last may be due to different causes: +.bP +conversion of a wide character to a multibyte character sequence can +fail, +or +.bP +at least one of the bytes resulting from wide character conversion to a +multibyte character sequence cannot be added to the window. +See section \*(``PORTABILITY\*('' below regarding the use of .B \%waddch -can successfully write a character at the bottom right location of the -window. -However, -.I \%ncurses -returns -.B ERR -if \fB\%scrollok\fP(3X) is not enabled in that event, -because it is not possible to wrap to a new line. +with wide characters. .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -259,69 +375,163 @@ .IR x ) is outside the window boundaries. .SH NOTES -.BR \%addch , -.BR \%mvaddch , -.BR \%mvwaddch , +.BR \%addch "," +.BR \%mvaddch "," +.BR \%mvwaddch "," and .B \%echochar may be implemented as macros. +.SH EXTENSIONS +The symbols +.IR \%ACS_S3 "," +.IR \%ACS_S7 "," +.IR \%ACS_LEQUAL "," +.IR \%ACS_GEQUAL "," +.IR \%ACS_PI "," +.IR \%ACS_NEQUAL "," +and +.I \%ACS_STERLING +were not documented in any publicly released System\ V +.\" And did not exist yet as late as SVr4. +.\" https://github.com/ryanwoodsmall/oldsysv/blob/master/\ +.\" sysvr4/svr4/lib/xlibcurses/screen/curses.ed +and are not standard. +However, +many publicly available +.I \%term\%info +entries include +.B \%acs_chars +.RB \%( acsc ) +capabilities in which their key characters +.RB ( pryz{|} ) +are embedded, +and a second-hand list of their character descriptions has come to light, +which identifies them as VT100 special characters. +.PP +The DEC Special Character and Line Drawing Set (VT100) is indexed by +an ASCII character in the range 96 (`) to 126 (~). +That index character is part of the definition for the curses +.B \%ACS_ +symbols. +The VT100 special characters can be categorized in three groups: +.bP +useful graphic symbols with a standard +.B \%ACS_ +symbol, +(e.g., the line-drawing symbols), +.bP +possibly useful characters (these non-standard symbols), +.bP +representations of control characters (e.g., newline and vertical tabulation). +.PP +A few +.B \%ACS_ +symbols do not fit into DEC's VT100 scheme. +The AT&T Teletype 5410v1 arrow symbols and +.B \%ACS_BLOCK +use indices outside the range 96 to 126. +Two of the Teletype symbols use indices in that range, +with different meaning versus the VT100: +.bP +.B \%ACS_BOARD +corresponds to the VT100 symbol for newline +.bP +.B \%ACS_LANTERN +corresponds to the VT100 symbol for vertical tabulation +.PP +AT&T defined +.B \%ACS_ +names for the most useful graphic symbols, +as well as for its own. +Its header file commented: +.PP +.EX +.nf +.\" Fill at 65 columns in your editor. +/* + * Standard alternate character set. The current ACS world is + * evolving, so we support only a widely available subset: the + * line drawing characters from the VT100, plus a few from the + * Teletype 5410v1. Eventually there may be support of more + * sophisticated ACS line drawing, such as that in the Teletype + * 5410, the HP line drawing set, and the like. There may be + * support for some non line oriented characters as well. + * + * 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. + */ +.fi +.EE +.PP +Although these less-useful graphic symbols were not given names, +they were used in +.I \%terminfo +entries. +The +.I \%ncurses +developers invented ACS-prefixed names for them. +.\" in v1_9_5_950928_e227 .SH PORTABILITY -X/Open Curses, -Issue 4 describes these functions. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. +.PP +X/Open Curses Issue\ 4 describes these functions. It specifies no error conditions for them. .PP -SVr4 -.I curses -describes a successful return value only as +SVr4 describes a successful return value only as \*(``an integer value other than -.BR ERR \*(''. +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 472 .PP The defaults specified for forms-drawing characters apply in the POSIX locale. .SS "ACS Symbols" X/Open Curses states that the -.B \%ACS_ +.I \%ACS_ definitions are .I char constants. -.PP Some implementations are problematic. .bP Solaris .IR curses , for example, -define the ACS symbols as constants; +defines the ACS symbols as constants; others define them as elements of an array. .IP -This implementation uses an array, -.BR \%acs_map , -as did SVr4 -.IR curses . -NetBSD also uses an array, +SVr4 used an array, +.IR \%acs_map , +as does +.IR \%ncurses "." +NetBSD +.I curses +also uses an array, actually named -.BR \%_acs_char , -with a -.B \%#define -for compatibility. +.IR \%_acs_char , +with a \%\*(``#define\*('' for compatibility. .bP HP-UX .I curses equates some of the -.B \%ACS_ +.I \%ACS_ symbols to the analogous -.B \%WACS_ +.I \%WACS_ symbols as if the -.B \%ACS_ +.I \%ACS_ symbols were wide characters (see \fB\%curs_add_wch\fP(3X)). The misdefined symbols are the arrows and others that are not used for line drawing. .bP X/Open Curses -(Issues 2 through 7) +(Issues\ 2 through 7) has a typographical error for the -.B \%ACS_LANTERN +.I \%ACS_LANTERN symbol, equating its \*(``VT100+ Character\*('' to \*(``I\*('' (capital I), while the header files for SVr4 @@ -341,39 +551,16 @@ (AT&T PC6300 with EMOTS Terminal Emulator) description uses lowercase i. .PP -Some ACS symbols -.RB ( \%ACS_S3 , -.BR \%ACS_S7 , -.BR \%ACS_LEQUAL , -.BR \%ACS_GEQUAL , -.BR \%ACS_PI , -.BR \%ACS_NEQUAL , -and -.BR \%ACS_STERLING ) -were not documented in any publicly released System\ V. -However, -many publicly available -.I \%term\%info -entries include -.B \%acsc -strings in which their key characters -.BR ( pryz{|} ) -are embedded, -and a second-hand list of their character descriptions has come to -light. -The -.I \%ncurses -developers invented ACS-prefixed names for them. -.PP The .I displayed values of -.B \%ACS_ +.I \%ACS_ constants depend on .bP the .I \%ncurses -ABI\(emfor example, +ABI \(em +for example, wide-character versus non-wide-character configurations (the former is capable of displaying Unicode while the latter is not), and @@ -386,89 +573,111 @@ by using UTF-8; see the discussion of the .I \%NCURSES_NO_UTF8_ACS -environment variable in \fB\%ncurses\fP(3X)). +environment variable in \fB\%ncurses\fP(3X). .SS "Character Set" X/Open Curses assumes that the parameter passed to -.B \%waddch +.I \%waddch contains a single character. -As discussed in \fB\%curs_attr\fP(3X), -that character may have been more than eight bits wide in an SVr3 or +That character may have been more than eight bits wide in an SVr3 or SVr4 implementation, -but in the X/Open Curses model, -the details are not given. -The important distinction between SVr4 -.I curses -and X/Open Curses is that the latter separates non-character information -(attributes and color) -from the character code, -which SVr4 packs into a +but X/Open Curses leaves the width of a non-wide character code +unspecified. +The standard further does not specify the internal structure of a +.IR chtype "," +though the use of bitwise operators to combine the character code with +attributes and a color pair identifier into a .I \%chtype for passage to -.BR \%waddch . +.I \%waddch +is common. +A portable application uses only the macros discussed in +\fB\%curs_attr\fP(3X) to manipulate a +.IR \%chtype "." .PP In .IR \%ncurses , .I \%chtype -holds an eight-bit character. -But the library allows a multibyte character to be passed in a +holds an eight-bit character, +but the library allows a multibyte character sequence to be passed via a succession of calls to -.BR \%waddch . +.IR \%waddch "." Other implementations do not; a -.B \%waddch +.I \%waddch call transmits exactly one character, which may be rendered in one or more screen locations depending on -whether it is printable. -.PP -Depending on the locale settings, +whether it is printable +(see \fB\%unctrl\fP(3X)). +Depending on the locale, .I \%ncurses inspects the byte passed in each -.B \%waddch -call, -and checks whether the latest call continues a multibyte sequence. +.I \%waddch +call and checks whether the latest call continues a multibyte character. When a character is -.IR complete , +.IR complete "," .I \%ncurses displays the character and advances the cursor. -.PP If the calling application interrupts the succession of bytes in -a multibyte character sequence by changing the current location\(emfor -example, -with \fB\%wmove\fP(3X)\(em\c +a multibyte character sequence by changing the current location \(em +for example, +with \fB\%wmove\fP(3X) \(em .I \%ncurses discards the incomplete character. .PP For portability to other implementations, -do not rely upon this behavior. +do not rely upon the foregoing behavior. Check whether a character can be represented as a single byte in the current locale. .bP If it can, call either -.B \%waddch -or \fB\%wadd_wch\fP(3X). +.I \%waddch +or +.IR \%wadd_wch "." .bP If it cannot, use only -\fB\%wadd_wch\fP(3X). -.SS TABSIZE -SVr4 and other versions of -.I curses -implement the -.B \%TABSIZE -variable, -but X/Open Curses does not specify it -(see \fB\%curs_variables\fP(3X)). +.IR \%wadd_wch "." +.SH HISTORY +4BSD (1980) +introduced +.I \%waddch +and its variants. +.PP +SVr3 (1987) +added the +.I \%echochar +and +.I \%wechochar +functions and most of the +.I ACS_ +constants, +except for +.IR \%ACS_GEQUAL "," +.IR \%ACS_LEQUAL "," +.IR \%ACS_NEQUAL "," +.IR \%ACS_PI "," +.IR \%ACS_S3 "," +.IR \%ACS_S7 "," +and +.IR \%ACS_STERLING "." +.PP +.I \%ncurses +1.9.6 (1995) +furnished the remaining +.I ACS_ +constants. .SH SEE ALSO \fB\%curs_add_wch\fP(3X) describes comparable functions of the .I \%ncurses library in its wide-character configuration -.RI ( \%ncursesw ). +.RI \%( ncursesw ). .PP \fB\%curses\fP(3X), \fB\%curs_addchstr\fP(3X), \fB\%curs_addstr\fP(3X), \fB\%curs_attr\fP(3X), +\fB\%curs_bkgd\fP(3X), \fB\%curs_clear\fP(3X), \fB\%curs_inch\fP(3X), \fB\%curs_outopts\fP(3X), diff --git a/contrib/ncurses/man/curs_addchstr.3x b/contrib/ncurses/man/curs_addchstr.3x --- a/contrib/ncurses/man/curs_addchstr.3x +++ b/contrib/ncurses/man/curs_addchstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2012,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_addchstr.3x,v 1.45 2024/04/20 21:20:07 tom Exp $ -.TH curs_addchstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_addchstr.3x,v 1.64 2025/08/16 19:56:13 tom Exp $ +.TH curs_addchstr 3X 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -46,62 +46,92 @@ .. .SH NAME \fB\%addchstr\fP, -\fB\%addchnstr\fP, \fB\%waddchstr\fP, -\fB\%waddchnstr\fP, \fB\%mvaddchstr\fP, -\fB\%mvaddchnstr\fP, \fB\%mvwaddchstr\fP, +\fB\%addchnstr\fP, +\fB\%waddchnstr\fP, +\fB\%mvaddchnstr\fP, \fB\%mvwaddchnstr\fP \- add a \fIcurses\fR character string to a window .SH SYNOPSIS .nf \fB#include .PP -\fBint addchstr(const chtype *\fIchstr\fP); -\fBint waddchstr(WINDOW *\fIwin\fP, const chtype *\fIchstr\fP); -\fBint mvaddchstr(int \fIy\fP, int \fIx\fP, const chtype *\fIchstr\fP); -\fBint mvwaddchstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const chtype *\fIchstr\fP); +\fBint addchstr(const chtype * \fIchstr\fP); +\fBint waddchstr(WINDOW * \fIwin\fP, const chtype * \fIchstr\fP); +\fBint mvaddchstr(int \fIy\fP, int \fIx\fP, const chtype * \fIchstr\fP); +\fBint mvwaddchstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, + const chtype * \fIchstr\fP); .PP -\fBint addchnstr(const chtype *\fIchstr\fP, int \fIn\fP); -\fBint waddchnstr(WINDOW *\fIwin\fP, const chtype *\fIchstr\fP, int \fIn\fP); -\fBint mvaddchnstr(int \fIy\fP, int \fIx\fP, const chtype *\fIchstr\fP, int \fIn\fP); -\fBint mvwaddchnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const chtype *\fIchstr\fP, int \fIn\fP); +\fBint addchnstr(const chtype * \fIchstr\fP, int \fIn\fP); +\fBint waddchnstr(WINDOW * \fIwin\fP, const chtype * \fIchstr\fP, int \fIn\fP); +\fBint mvaddchnstr(int \fIy\fP, int \fIx\fP, const chtype * \fIchstr\fP, int \fIn\fP); +\fBint mvwaddchnstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, + const chtype * \fIchstr\fP, int \fIn\fP); .fi .SH DESCRIPTION -These functions copy the (null-terminated) -\fIchstr\fP array -into the window image structure -starting at the current cursor position. -.PP -The four functions with \fIn\fP as the last -argument copy at most \fIn\fP elements, -but no more than will fit on the line. -If \fBn\fP=\fB\-1\fP then the whole array is copied, -to the maximum number of characters that will fit on the line. +.B \%waddchstr +copies the string of +.I curses +characters +.I \%chstr +to the window +.IR win "." +A null +.I curses +character terminates the string. +.B \%waddchnstr +does the same, +but copies at most +.I n +characters, +or as many as possible if +.I n +is +.BR \-1 "." +\fB\%ncurses\fP(3X) describes the variants of these functions. .PP -The window cursor is \fInot\fP advanced. -These functions are faster than \fBwaddnstr\fP. -On the other hand: +Because these functions do not call \fB\%waddch\fP(3X) internally, +they are faster than \fB\%waddstr\fP(3X) and \fB\%waddnstr\fP(3X). +On the other hand, +they .bP -they do not perform checking -(such as for the newline, backspace, or carriage return characters), +do not treat the backspace, +carriage return, +or line feed characters specially; .bP -they do not advance the current cursor position, +do not represent unprintable characters with \fB\%unctrl\fP(3X); .bP -they do not expand other control characters to ^-escapes, and +do not update the cursor position to follow the last character written; +and .bP -they truncate the string if it crosses the right margin, -rather than wrapping it around to the new line. +truncate the string at the window's right margin, +rather than wrapping it to the next line and potentially scrolling. .SH RETURN VALUE -All functions return the integer \fBERR\fP upon failure and \fBOK\fP on success. +These functions return +.B OK +on success and +.B ERR +on failure. .PP -X/Open Curses does not specify any error conditions. -This implementation returns an error +In +.IR \%ncurses "," +these functions fail if .bP -if the \fIwin\fP parameter is null or +the +.I curses +screen has not been initialized, .bP -if the \fIwchstr\fP parameter is null. +.I chstr +is a null pointer, +or +.bP +(for functions taking a +.I \%WINDOW +pointer argument) +.I win +is a null pointer. .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -109,14 +139,24 @@ .IR x ) is outside the window boundaries. .SH NOTES -All functions except \fBwaddchnstr\fP may be macros. +All of these functions except +.B \%waddchnstr +may be implemented as macros. .SH PORTABILITY -These functions are described in X/Open Curses, Issue 4. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.PP +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 473 +.SH HISTORY +SVr3.1 (1987) +introduced these functions. .SH SEE ALSO \fB\%curs_add_wchstr\fP(3X) describes comparable functions of the .I \%ncurses library in its wide-character configuration -.RI ( \%ncursesw ). +.RI \%( ncursesw ). .PP \fB\%curses\fP(3X), \fB\%curs_addch\fP(3X), diff --git a/contrib/ncurses/man/curs_addstr.3x b/contrib/ncurses/man/curs_addstr.3x --- a/contrib/ncurses/man/curs_addstr.3x +++ b/contrib/ncurses/man/curs_addstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2012,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_addstr.3x,v 1.45 2024/04/20 19:18:18 tom Exp $ -.TH curs_addstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_addstr.3x,v 1.71 2025/10/21 00:09:34 tom Exp $ +.TH curs_addstr 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -46,53 +46,48 @@ .. .SH NAME \fB\%addstr\fP, -\fB\%addnstr\fP, \fB\%waddstr\fP, -\fB\%waddnstr\fP, \fB\%mvaddstr\fP, -\fB\%mvaddnstr\fP, \fB\%mvwaddstr\fP, +\fB\%addnstr\fP, +\fB\%waddnstr\fP, +\fB\%mvaddnstr\fP, \fB\%mvwaddnstr\fP \- add a string to a \fIcurses\fR window and advance the cursor .SH SYNOPSIS .nf \fB#include .PP -\fBint addstr(const char *\fIstr\fP); -\fBint mvaddstr(int \fIy\fP, int \fIx\fP, const char *\fIstr\fP); -\fBint mvwaddstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const char *\fIstr\fP); -\fBint waddstr(WINDOW *\fIwin\fP, const char *\fIstr\fP); +\fBint addstr(const char * \fIstr\fP); +\fBint waddstr(WINDOW * \fIwin\fP, const char * \fIstr\fP); +\fBint mvaddstr(int \fIy\fP, int \fIx\fP, const char * \fIstr\fP); +\fBint mvwaddstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, const char * \fIstr\fP); .PP -\fBint addnstr(const char *\fIstr\fP, int \fIn\fP); -\fBint mvaddnstr(int \fIy\fP, int \fIx\fP, const char *\fIstr\fP, int \fIn\fP); -\fBint mvwaddnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const char *\fIstr\fP, int \fIn\fP); -\fBint waddnstr(WINDOW *\fIwin\fP, const char *\fIstr\fP, int \fIn\fP); +\fBint addnstr(const char * \fIstr\fP, int \fIn\fP); +\fBint waddnstr(WINDOW * \fIwin\fP, const char * \fIstr\fP, int \fIn\fP); +\fBint mvaddnstr(int \fIy\fP, int \fIx\fP, const char * \fIstr\fP, int \fIn\fP); +\fBint mvwaddnstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, const char * \fIstr\fP, int \fIn\fP); .fi .SH DESCRIPTION -.B waddstr +.B \%waddstr writes the characters of the (null-terminated) string .I str to the window -.IR win . -Its process is similar to calling \fB\%waddch\fP(3X) for each +.IR win , +as if by calling \fB\%waddch\fP(3X) for each .I char in .IR str . -Control characters are processed as in \fB\%waddch\fP(3X). -.PP -.B waddnstr -writes at most +.B \%waddnstr +is similar, +but writes at most .I n -characters, -or until a terminating null character occurs in -.IR str . +characters. If .I n is \-1, -.B -.B waddnstr +.B \%waddnstr writes the entire string. -.PP \fB\%ncurses\fP(3X) describes the variants of these functions. .SH RETURN VALUE These functions return @@ -101,18 +96,26 @@ .B ERR on failure. .PP -X/Open Curses does not specify any error conditions. -.I \%ncurses -returns an error +In +.IR \%ncurses "," +these functions fail if .bP -if the window pointer is -.BR NULL , +the +.I curses +screen has not been initialized, .bP -if the string pointer is -.BR NULL , +.I str +is a null pointer, +.bP +(for functions taking a +.I \%WINDOW +pointer argument) +.I win +is a null pointer, or .bP -if an internal \fB\%waddch\fP(3X) call returns an error. +an internal \fB\%waddch\fP(3X) call returns +.BR ERR "." .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -120,15 +123,35 @@ .IR x ) is outside the window boundaries. .SH NOTES -All of these functions except \fBwaddnstr\fP may be macros. +All of these functions except +.B \%waddnstr +may be implemented as macros. .SH PORTABILITY -X/Open Curses, -Issue 4 describes these functions. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.PP +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 474 +.SH HISTORY +4BSD (1980) +introduced +.I \%waddstr +along with its variants, +the latter defined as macros. +.PP +SVr3.1 (1987) +added +.I \%waddnstr +(and its variants) +redefining +.I \%waddstr +as a macro wrapping it. .SH SEE ALSO \fB\%curs_addwstr\fP(3X) describes comparable functions of the .I \%ncurses library in its wide-character configuration -.RI ( \%ncursesw ). +.RI \%( ncursesw ). .PP \fB\%curses\fP(3X), \fB\%curs_addch\fP(3X), diff --git a/contrib/ncurses/man/curs_addwstr.3x b/contrib/ncurses/man/curs_addwstr.3x --- a/contrib/ncurses/man/curs_addwstr.3x +++ b/contrib/ncurses/man/curs_addwstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-2024,2025 Thomas E. Dickey * .\" Copyright 2002-2012,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_addwstr.3x,v 1.37 2024/04/20 19:18:18 tom Exp $ -.TH curs_addwstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_addwstr.3x,v 1.60 2025/03/15 20:41:04 tom Exp $ +.TH curs_addwstr 3X 2025-03-15 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -46,36 +46,39 @@ .. .SH NAME \fB\%addwstr\fP, -\fB\%addnwstr\fP, \fB\%waddwstr\fP, -\fB\%waddnwstr\fP, \fB\%mvaddwstr\fP, -\fB\%mvaddnwstr\fP, \fB\%mvwaddwstr\fP, +\fB\%addnwstr\fP, +\fB\%waddnwstr\fP, +\fB\%mvaddnwstr\fP, \fB\%mvwaddnwstr\fP \- add a wide-character string to a \fIcurses\fR window and advance the cursor .SH SYNOPSIS .nf \fB#include .PP -\fBint addwstr(const wchar_t *\fIwstr\fP); -\fBint mvaddwstr(int \fIy\fP, int \fIx\fP, const wchar_t *\fIwstr\fP); -\fBint mvwaddwstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const wchar_t *\fIwstr\fP); -\fBint waddwstr(WINDOW *\fIwin\fP, const wchar_t *\fIwstr\fP); +\fBint addwstr(const wchar_t * \fIwstr\fP); +\fBint waddwstr(WINDOW * \fIwin\fP, const wchar_t * \fIwstr\fP); +\fBint mvaddwstr(int \fIy\fP, int \fIx\fP, const wchar_t * \fIwstr\fP); +\fBint mvwaddwstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, + const wchar_t * \fIwstr\fP); .PP -\fBint addnwstr(const wchar_t *\fIwstr\fP, int \fIn\fP); -\fBint mvaddnwstr(int \fIy\fP, int \fIx\fP, const wchar_t *\fIwstr\fP, int \fIn\fP); -\fBint mvwaddnwstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const wchar_t *\fIwstr\fP, int \fIn\fP); -\fBint waddnwstr(WINDOW *\fIwin\fP, const wchar_t *\fIwstr\fP, int \fIn\fP); +\fBint addnwstr(const wchar_t * \fIwstr\fP, int \fIn\fP); +\fBint waddnwstr(WINDOW * \fIwin\fP, const wchar_t * \fIwstr\fP, int \fIn\fP); +\fBint mvaddnwstr(int \fIy\fP, int \fIx\fP, const wchar_t * \fIwstr\fP, int \fIn\fP); +\fBint mvwaddnwstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, + const wchar_t * \fIwstr\fP, int \fIn\fP); .fi .SH DESCRIPTION -.B waddwstr +.B \%waddwstr writes the characters of the (wide-null-terminated) wide-character string .I wstr to the window -.IR win . -Its process is similar to constructing a +.IR win , +as if by +constructing a .I cchar_t for each .I wchar_t @@ -83,26 +86,20 @@ .IR wstr , then calling \fB\%wadd_wch\fP(3X) with the resulting .IR cchar_t . -.bP -Spacing and non-spacing characters in the string -are processed one at a time, -and -.bP -control characters are processed as in \fB\%wadd_wch\fP(3X). -.PP -.B waddnwstr -writes at most +.I curses +processes spacing and non-spacing characters in +.I wstr +one at a time. +.B \%waddnwstr +is similar, +but writes at most .I n -wide characters, -or until a terminating wide null character occurs in -.IR wstr . +wide characters. If .I n is \-1, -.B -.B waddnwstr +.B \%waddnwstr writes the entire wide string. -.PP \fB\%ncurses\fP(3X) describes the variants of these functions. .SH RETURN VALUE These functions return @@ -111,18 +108,26 @@ .B ERR on failure. .PP -X/Open Curses does not specify any error conditions. -.I \%ncurses -returns an error +In +.IR \%ncurses "," +these functions fail if .bP -if the window pointer is -.BR NULL , +the +.I curses +screen has not been initialized, .bP -if the string pointer is -.BR NULL , +.I wstr +is a null pointer, +.bP +(for functions taking a +.I \%WINDOW +pointer argument) +.I win +is a null pointer, or .bP -if an internal \fB\%wadd_wch\fP(3X) call returns an error. +an internal \fB\%wadd_wch\fP(3X) call returns +.BR ERR "." .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -131,11 +136,27 @@ is outside the window boundaries. .SH NOTES All of these functions except -.B waddnwstr +.B \%waddnwstr may be implemented as macros. .SH PORTABILITY -X/Open Curses, -Issue 4 describes these functions. +X/Open Curses Issue\ 4 describes these functions. +.PP +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 478 +.SH HISTORY +X/Open Curses Issue\ 4 (1995) initially specified these functions. +The System\ V Interface Definition Version\ 4 +of the same year +specified functions named +.I \%waddwstr +and +.I \%waddnwstr +(and the usual variants). +.\" SVID 4, vol 3., p. 478 +These were later additions to +.RI SVr4. x , +not appearing in the first SVr4 (1989). .SH SEE ALSO \fB\%curs_addstr\fP(3X) describes comparable functions of the .I \%ncurses diff --git a/contrib/ncurses/man/curs_attr.3x b/contrib/ncurses/man/curs_attr.3x --- a/contrib/ncurses/man/curs_attr.3x +++ b/contrib/ncurses/man/curs_attr.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_attr.3x,v 1.105 2024/04/27 17:54:42 tom Exp $ -.TH curs_attr 3X 2024-04-27 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_attr.3x,v 1.142 2025/11/12 01:05:49 tom Exp $ +.TH curs_attr 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -142,68 +142,88 @@ Use \fBwattr_get\fP to retrieve attributes for the given window. .PP Use \fBattr_on\fP and \fBwattr_on\fP to turn on window attributes, i.e., -values OR'd together in \fIattr\fP, +values logically \*(``or\*(''-ed together in \fIattr\fP, without affecting other attributes. Use \fBattr_off\fP and \fBwattr_off\fP to turn off window attributes, -again values OR'd together in \fIattr\fP, +again values logically \*(``or\*(''-ed together in \fIattr\fP, without affecting other attributes. .\" --------------------------------------------------------------------------- .SS "Legacy Window Attributes" The X/Open window attribute routines which \fIset\fP or \fIget\fP, turn \fIon\fP or \fIoff\fP are extensions of older routines -which assume that color pairs are OR'd into the attribute parameter. +which assume that color pairs are logically \*(``or\*(''-ed +into the attribute parameter. These newer routines use similar names, because X/Open simply added an underscore (\fB_\fP) for the newer names. .PP -The \fBint\fP datatype used in the legacy routines is treated as if -it is the same size as \fBchtype\fP (used by \fBaddch\fP(3X)). +The +.I int +datatype used in the legacy routines is treated as if +it is the same size as +.I \%chtype +(used by \fBaddch\fP(3X)). It holds the common video attributes (such as bold, reverse), as well as a few bits for color. Those bits correspond to the \fBA_COLOR\fP symbol. -The \fBCOLOR_PAIR\fP macro provides a value which can be OR'd into -the attribute parameter. +The \fBCOLOR_PAIR\fP macro provides a value which can be +logically \*(``or\*(''-ed into the attribute parameter. For example, as long as that value fits into the \fBA_COLOR\fP mask, then these calls produce similar results: .PP .RS 4 .EX +.nf attrset(A_BOLD | COLOR_PAIR(\fIpair\fP)); attr_set(A_BOLD, \fIpair\fP, NULL); +.fi .EE .RE .PP However, if the value does not fit, then the \fBCOLOR_PAIR\fP macro uses only the bits that fit. For example, -because in \fI\%ncurses\fP \fBA_COLOR\fP has eight (8) bits, +because in +.I \%ncurses +\fBA_COLOR\fP has eight (8) bits, then \fBCOLOR_PAIR(\fI259\fB)\fR is 4 (i.e., 259 is 4 more than the limit 255). .PP -The \fBPAIR_NUMBER\fP macro extracts a pair number from an \fBint\fP -(or \fBchtype\fP). +The \fBPAIR_NUMBER\fP macro extracts a pair number from an +.I int +(or +.IR \%chtype ")." For example, the \fIinput\fP and \fIoutput\fP values in these statements would be the same: .PP .RS 4 .EX +.nf int value = A_BOLD | COLOR_PAIR(\fIinput\fP); int \fIoutput\fP = PAIR_NUMBER(value); +.fi .EE .RE .PP -The \fBattrset\fP routine is a legacy feature predating SVr4 curses -but kept in X/Open Curses for the same reason that SVr4 curses kept it: +The \fBattrset\fP routine is a legacy feature predating SVr4 +.I curses +but kept in X/Open Curses for the same reason that SVr4 +.I curses +kept it: compatibility. .PP The remaining \fBattr\fP* functions operate exactly like the corresponding -\fBattr_\fP* functions, except that they take arguments of type \fBint\fP -rather than \fBattr_t\fP. +\fBattr_\fP* functions, except that they take arguments of type +.I int +rather than +.IR \%attr_t "." .PP There is no corresponding \fB\%attrget\fP function as such in X/Open Curses, -although \fI\%ncurses\fP provides \fB\%getattrs\fP +although +.I \%ncurses +provides \fB\%getattrs\fP (see \fB\%curs_legacy\fP(3X)). .\" --------------------------------------------------------------------------- .SS "Change Character Rendition" @@ -240,11 +260,18 @@ might be combined with a color pair. .\" --------------------------------------------------------------------------- .SS "Video Attributes" -The following video attributes, defined in \fB\fP, can be passed to -the routines \fBattron\fP, \fBattroff\fP, and \fBattrset\fP, or OR'd with the -characters passed to \fBaddch\fP (see \fBcurs_addch\fP(3X)). -.PP -.ne 15 +The following video attributes, +defined in +.IR \%curses.h "," +can be passed to +.BR \%attron "," +.BR \%attroff "," +.BR \%attrset "," +and +logically \*(``or\*(''-ed with characters passed to \fBaddch\fP(3X). +.PP +.if t .ne 15 +.if n .ne 16 .RS .TS Lb Lb @@ -252,9 +279,7 @@ Name Description _ A_NORMAL Normal display (no highlight) -A_STANDOUT T{ -Best highlighting mode of the terminal -T} +A_STANDOUT Best highlighting mode available A_UNDERLINE Underlining A_REVERSE Reverse video A_BLINK Blinking @@ -264,16 +289,20 @@ A_INVIS Invisible or blank mode A_ALTCHARSET Alternate character set A_ITALIC Italics (non-X/Open extension) -A_CHARTEXT Bit-mask to extract a character -A_COLOR T{ -Bit-mask to extract a color (legacy routines) -T} +A_ATTRIBUTES Mask to extract character code +A_CHARTEXT Mask to extract attributes +A_COLOR Mask to extract color pair identifier .TE .RE .PP -These video attributes are supported by \fBattr_on\fP and related functions -(which also support the attributes recognized by \fBattron\fP, etc.): +.BR \%attr_on "," +.BR \%attr_off "," +and +.B \%attr_set +support the foregoing as well as the following additional attributes. .PP +.if t .ne 7 +.if n .ne 8 .RS .TS Lb Lb @@ -288,25 +317,40 @@ WA_VERTICAL Vertical highlight .TE .RE -.PP -The return values of many of these routines are not meaningful (they are -implemented as macro-expanded assignments and simply return their argument). -The SVr4 manual page claims (falsely) that these routines always return \fB1\fP. .\" --------------------------------------------------------------------------- .SH RETURN VALUE -All routines return the integer \fBOK\fP on success, or \fBERR\fP on failure. -.PP -X/Open Curses does not specify any error conditions. -.PP -This implementation -.bP -returns an error if the window pointer is null. -.bP -returns an error if the color pair parameter -for \fBwcolor_set\fP is outside the range 0..COLOR_PAIRS\-1. -.bP -does not return an error if either of the parameters of \fBwattr_get\fP -used for retrieving attribute or color pair values is \fBNULL\fP. +These functions return +.B OK +on success and +.B ERR +on failure. +.PP +In +.IR \%ncurses "," +they return +.B ERR +if +.I win +is +.IR NULL "." +.PP +.B \%wcolor_set +returns +.B ERR +if +.I pair +is outside the range +.BR 0 .\|. COLOR_PAIRS\-1 . +.PP +.B \%wattr_get +does +.I not +fail if its +.I \%attrs +or +.I \%pair +parameter is +.IR NULL "." .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -315,20 +359,43 @@ is outside the window boundaries. .\" --------------------------------------------------------------------------- .SH NOTES -These functions may be macros: -.sp -.RS -\fBattroff\fP, \fBwattroff\fP, \fBattron\fP, \fBwattron\fP, -\fBattrset\fP, \fBwattrset\fP, \fBstandend\fP and \fBstandout\fP. -.RE -.PP -Color pair values can only be OR'd with attributes if the pair -number is less than 256. +.BR \%attr_on "," +.BR \%attr_off "," +.BR \%attr_set "," +.BR \%wattr_set "," +.BR \%chgat "," +.BR \%mvchgat "," +.BR \%mvwchgat "," +.BR \%wchgat "," +and +.B \%color_set +are part of +.IR \%ncurses "'s" +wide-character API, +and are not available in its non-wide-character configuration. +.PP +.BR \%attron "," +.BR \%wattron "," +.BR \%attroff "," +.BR \%wattroff "," +.BR \%attrset "," +.BR \%wattrset "," +.BR \%standout "," +and +.B \%standend +may be implemented as macros. +.PP +Color pair values may be logically \*(``or\*(''-ed with attributes +if the pair number is less than 256. The alternate functions such as \fBcolor_set\fP can pass a color pair value directly. -However, \fI\%ncurses\fP ABI 4 and 5 simply OR this value +However, +.I \%ncurses +ABI 4 and 5 simply logically \*(``or\*('' this value within the alternate functions. -You must use \fI\%ncurses\fP ABI 6 to support more than 256 color pairs. +You must use +.I \%ncurses +ABI 6 to support more than 256 color pairs. .\" --------------------------------------------------------------------------- .SH EXTENSIONS This implementation provides the \fBA_ITALIC\fP attribute for terminals @@ -342,32 +409,55 @@ .PP Each of the functions added by XSI Curses has a parameter \fIopts\fP, which X/Open Curses still (after more than twenty years) documents -as reserved for future use, saying that it should be \fBNULL\fP. +as reserved for future use, saying that it should be +.IR NULL "." This implementation uses that parameter in ABI 6 for the functions which have a color pair parameter to support \fIextended color pairs\fP: .bP For functions which modify the color, e.g., \fBwattr_set\fP and \fBwattr_on\fP, -if \fIopts\fP is set it is treated as a pointer to \fBint\fP, -and used to set the color pair instead of the \fBshort\fP \fIpair\fP parameter. +if \fIopts\fP is set it is treated as a pointer to +.IR int "," +and used to set the color pair instead of the +.I short +.I pair +parameter. .bP For functions which retrieve the color, e.g., \fBwattr_get\fP, -if \fIopts\fP is set it is treated as a pointer to \fBint\fP, -and used to retrieve the color pair as an \fBint\fP value, +if \fIopts\fP is set it is treated as a pointer to +.IR int "," +and used to retrieve the color pair as an +.I int +value, in addition to -retrieving it via the standard pointer to \fBshort\fP parameter. +retrieving it via the standard pointer to +.I short +parameter. .bP For functions which turn attributes off, e.g., \fBwattr_off\fP, -the \fIopts\fP parameter is ignored except -except to check that it is \fBNULL\fP. +the \fIopts\fP parameter is ignored except to check that it is +.IR NULL "." .\" --------------------------------------------------------------------------- .SH PORTABILITY -These functions are described in X/Open Curses, Issue 4. +These functions are described in X/Open Curses Issue\ 4. +It specifies no error conditions for them. +.PP The standard defined the dedicated type for highlights, -\fBattr_t\fP, which was not defined in SVr4 curses. -The functions taking \fBattr_t\fP arguments were not supported under SVr4. +.IR \%attr_t "," +which was not defined in SVr4 +.IR curses "." +The functions taking +.I \%attr_t +arguments were not supported under SVr4. +.PP +SVr4 describes the functions not taking +.I \%attr_t +or +.I pair +arguments as always returning +.BR 1 "." \" Courier roman in source; SVID 4, vol. 3, p. 480 .PP Very old versions of this library did not force an update of the screen when changing the attributes. @@ -378,7 +468,9 @@ \fBA_BLINK\fP, \fBA_BOLD\fP, \fBA_DIM\fP, \fBA_REVERSE\fP, \fBA_STANDOUT\fP, or \fBA_UNDERLINE\fP is \*(``unspecified\*(''. Under this implementation as well as -SVr4 curses, these functions correctly manipulate all other highlights +SVr4 +.IR curses "," +these functions correctly manipulate all other highlights (specifically, \fBA_ALTCHARSET\fP, \fBA_PROTECT\fP, and \fBA_INVIS\fP). .PP X/Open Curses added these entry points: @@ -397,13 +489,11 @@ .ne 9 .TS Lb Lb -Lb Lx. +Lb L . Name Description _ WA_NORMAL Normal display (no highlight) -WA_STANDOUT T{ -Best highlighting mode of the terminal -T} +WA_STANDOUT Best highlighting mode available WA_UNDERLINE Underlining WA_REVERSE Reverse video WA_BLINK Blinking @@ -423,18 +513,29 @@ .bP However, in some implementations, those symbols have unrelated values. .IP -For example, the Solaris \fIxpg4\fP (X/Open) curses declares -\fBattr_t\fP to be an unsigned short integer (16-bits), -while \fBchtype\fP is a unsigned integer (32-bits). +For example, the Solaris \fIxpg4\fP (X/Open) +.I curses +declares +.I \%attr_t +to be an unsigned short integer (16-bits), +while +.I \%chtype +is a unsigned integer (32-bits). The \fBWA_\fP symbols in this case are different from the \fBA_\fP symbols because they are used for a smaller datatype which does not represent \fBA_CHARTEXT\fP or \fBA_COLOR\fP. .IP In this implementation (as in many others), the values happen to be the same because it simplifies copying information between -\fBchtype\fP and \fBcchar_t\fP variables. +.I \%chtype +and +.I \%cchar_t +variables. .bP -Because \fI\%ncurses\fP's \fBattr_t\fP can hold a color pair +Because +.IR \%ncurses 's +.I \%attr_t +can hold a color pair (in the \fBA_COLOR\fP field), a call to \fBwattr_on\fP, @@ -444,7 +545,8 @@ If the color pair information in the attribute parameter is zero, no change is made to the window's color. .IP -This is consistent with SVr4 curses; +This is consistent with SVr4 +.IR curses ";" X/Open Curses does not specify this. .PP The X/Open Curses extended conformance level adds new highlights @@ -455,62 +557,123 @@ (i.e., via the \fBsgr1\fP capability). .\" --------------------------------------------------------------------------- .SH HISTORY -X/Open Curses is largely based on SVr4 curses, -adding support for \*(``wide-characters\*('' (not specific to Unicode). -Some of the X/Open differences from SVr4 curses address the way -video attributes can be applied to wide-characters. -But aside from that, \fBattrset\fP and \fBattr_set\fP are similar. -SVr4 curses provided the basic features for manipulating video attributes. -However, earlier versions of curses provided a part of these features. -.PP -As seen in 2.8BSD, curses assumed 7-bit characters, -using the eighth bit of a byte to represent the \fIstandout\fP -feature (often implemented as bold and/or reverse video). -The BSD curses library provided functions \fBstandout\fP and \fBstandend\fP -which were carried along into X/Open Curses due to their pervasive use -in legacy applications. -.PP -Some terminals in the 1980s could support a variety of video attributes, -although the BSD curses library could do nothing with those. -System V (1983) provided an improved curses library. -It defined the \fBA_\fP symbols for use by applications to manipulate the -other attributes. -There are few useful references for the chronology. -.PP -Goodheart's book -\fIUNIX Curses Explained\fP (1991) describes SVr3 (1987), -commenting on several functions: -.bP -the \fBattron\fP, \fBattroff\fP, \fBattrset\fP functions -(and most of the functions found in SVr4 but not in BSD curses) were -introduced by System V, -.bP -the alternate character set feature with \fBA_ALTCHARSET\fP was -added in SVr2 and improved in SVr3 (by adding \fBacs_map[]\fP), -.bP -\fBstart_color\fP and related color-functions were introduced by System V.3.2, -.bP -pads, soft-keys were added in SVr3, and -.PP -Goodheart did not mention the background character or the \fBcchar_t\fP type. -Those are respectively SVr4 and X/Open features. -He did mention the \fBA_\fP constants, but did not indicate their values. -Those were not the same in different systems, -even for those marked as System V. -.PP -Different Unix systems used different sizes for the bit-fields in \fBchtype\fP -for \fIcharacters\fP and \fIcolors\fP, and took into account the different -integer sizes (32-bit versus 64-bit). -.PP -This table showing the number of bits for \fBA_COLOR\fP -and \fBA_CHARTEXT\fP -was gleaned from the curses header files for -various operating systems and architectures. -The inferred architecture and notes reflect -the format and size of the defined constants +4BSD (1980) +used a +.I char +to represent each cell of the terminal screen. +It assumed 7-bit character codes, +employing the eighth bit of a byte to represent a +.I \%standout +attribute +(often implemented as bold and/or reverse video). +It introduced +.IR \%standout "," +.IR \%standend "," +.IR \%wstandout "," +and +.I \%wstandend +functions to manipulate this bit. +Despite their inflexibility, +they carried over into System\ V +.I curses +and ultimately X/Open Curses +due to their pervasive use in legacy applications. +While some 1980s terminals supported a variety of video attributes, +BSD +.I curses +could do nothing with them. +.PP +SVr2 (1984) +provided an improved +.I curses +library, +introducing +.I \%chtype +to create the abstract notion of a +.I curses +character; +this was by default an +.IR "unsigned short" "," +with a provision for compile-time redefinition to other integral types +(a freedom not necessarily available to users of shared libraries, +and in any event a source license was necessary to exercise it). +It added the functions +.IR \%attron "," +.IR \%attroff "," +.IR \%attrset "," +.IR \%wattron "," +.IR \%wattroff "," +and +.IR \%wattrset "," +and defined the +.I A_ +macros listed above +(except for +.I \%A_ITALIC +and +.IR \%A_COLOR ")" +for use by applications to manipulate other attributes. +The values of these macros +were not necessarily the same in different systems, +even among those certified as System\ V. +.PP +SVr3.2 (1988) +added the +.I \%A_COLOR +macro along with a color system; +see \fBcurs_color\fP(3X). +.PP +X/Open Curses Issue\ 4 (1995) is largely based on SVr4 +.IR curses "," +but recognized that the +.I \%wchar_t +type of ISO C95 was intended to house only a single character code, +not a sequence of codes combining with a base character, +let alone could it reliably offer room for a color pair identifier +and a set of attribute bits with a potential for further growth \(em +thus the standard invented the +.I curses +complex character type +.I \%cchar_t +and a separate type +.I \%attr_t +for storage of attribute bits. +The new types brought along several new functions to manipulate them, +some corresponding to existing +.IR chtype -based +functions +.RI \%( attr_on , +.IR \%attr_off "," +.IR \%attr_set "," +.IR \%wattr_on "," +.IR \%wattr_off "," +and +.IR \%wattr_set ")," +and some new +.RI \%( chgat +and its variants, +.IR \%color_set "," +and +.IR \%wcolor_set ")." +.PP +Different Unix systems used differently sized bit fields in +.I \%chtype +for the character code and the color pair identifier, +and took into account platforms' different integer sizes +(32- versus 64-bit). +.PP +The following table showing the number of bits for +.I \%A_COLOR +and +.I \%A_CHARTEXT +was gleaned from the +.I curses +header files for various operating systems and architectures. +The inferred architecture and notes +reflect the format and size of the defined constants as well as clues such as the alternate character set implementation. A 32-bit library can be used on a 64-bit system, -but not necessarily the reverse. +but not necessarily the converse. .PP .TS Lb Lb Lb Cb S Lb @@ -529,7 +692,7 @@ 1996 AIX 4.2 32 7 16 X/Open \fIcurses\fP 1996 OSF/1 r4 32 6 16 X/Open \fIcurses\fP 1997 HP-UX 11.00 32 6 8 X/Open \fIcurses\fP -2000 U/Win 32/64 7/31 16 uses \fIchtype\fP +2000 UWIN 32/64 7/31 16 uses \fIchtype\fP .TE .PP Notes: @@ -540,54 +703,85 @@ HP-UX 10.20 (1996) added support for 64-bit PA-RISC processors in 1996. .bP HP-UX 10.30 (1997) marked \*(``curses_colr\*('' obsolete. -That version of curses was dropped with HP-UX 11.30 in 2006. +That version of +.I curses +was dropped with HP-UX 11.30 in 2006. .PP Regarding OSF/1 (and Tru64), .bP These used 64-bit hardware. -Like \fI\%ncurses\fP, -the OSF/1 curses interface is not customized for 32-bit and 64-bit +Like +.IR \%ncurses "," +the OSF/1 +.I curses +interface is not customized for 32-bit and 64-bit versions. .bP Unlike other systems which evolved from AT&T code, -OSF/1 provided a new implementation for X/Open curses. +OSF/1 provided a new implementation for X/Open Curses. .PP Regarding Solaris, .bP The initial release of Solaris was in 1992. .bP -The \fIxpg4\fP (X/Open) curses was developed by MKS from 1990 to 1995. +Its XPG4 +(X/Open Curses-conforming) +.I xcurses +library was developed by Mortice Kern Systems from 1990 to 1995. Sun's copyright began in 1996. .bP -Sun updated the X/Open curses interface +Sun updated the X/Open Curses interface after 64-bit support was introduced in 1997, -but did not modify the SVr4 curses interface. +but did not modify the SVr4 +.I curses +interface. .PP -Regarding U/Win, +Regarding UWIN, .bP -Development of the curses library began in 1991, stopped in 2000. +Development of the +.I curses +library began in 1991, stopped in 2000. .bP Color support was added in 1998. .bP -The library uses only \fBchtype\fP (no \fBcchar_t\fP). +The library uses only +.I \%chtype +(not +.IR \%cchar_t ")." .RE .PP -Once X/Open curses was adopted in the mid-1990s, the constraint of -a 32-bit interface with many colors and wide-characters for \fBchtype\fP +Once X/Open Curses was adopted in the mid-1990s, the constraint of +a 32-bit interface with many colors and wide-characters for +.I \%chtype became a moot point. -The \fBcchar_t\fP structure (whose size and -members are not specified in X/Open Curses) could be extended as needed. +The +.I \%cchar_t +structure +(whose size and members are not specified in X/Open Curses) +could be extended as needed. .PP -Other interfaces are rarely used now: +Other interfaces are rarely used now. .bP -BSD curses was improved slightly in 1993/1994 using Keith Bostic's -modification to make the library 8-bit clean for \fBnvi\fP(1). -He moved \fIstandout\fP attribute to a structure member. -.IP -The resulting 4.4BSD curses was replaced by \fI\%ncurses\fP over the -next ten years. +BSD +.I curses +was improved slightly in 1993/1994 using Keith Bostic's +modification to make the library 8-bit clean for \fInvi\fP(1). +He moved the +.I \%standout +attribute to a structure member. +The resulting 4.4BSD +.I curses +was replaced by +.I \%ncurses +over the next ten years. .bP -U/Win is rarely used now. +UWIN has been defunct since 2012. +.PP +.I \%ncurses +6.0 (2015) +added the +.I A_ITALIC +macro. .\" --------------------------------------------------------------------------- .SH SEE ALSO \fB\%curses\fP(3X), diff --git a/contrib/ncurses/man/curs_beep.3x b/contrib/ncurses/man/curs_beep.3x --- a/contrib/ncurses/man/curs_beep.3x +++ b/contrib/ncurses/man/curs_beep.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2005,2010 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_beep.3x,v 1.29 2024/04/20 21:20:07 tom Exp $ -.TH curs_beep 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_beep.3x,v 1.42 2025/02/01 23:46:11 tom Exp $ +.TH curs_beep 3X 2025-02-01 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fB\%beep\fP, \fB\%flash\fP \- @@ -41,23 +41,70 @@ \fBint flash(void); .fi .SH DESCRIPTION -The \fBbeep\fP and \fBflash\fP routines are used to alert the terminal user. -The routine \fBbeep\fP sounds an audible alarm on the terminal, if possible; -otherwise it flashes the screen (visible bell). -The routine \fBflash\fP -flashes the screen, and if that is not possible, sounds the alert. -If neither -alert is possible, nothing happens. -Nearly all terminals have an audible alert -(bell or beep), but only some can flash the screen. +.B beep +and +.B flash +alert the terminal user: +the former by sounding the terminal's audible alarm, +and the latter by visibly attracting attention. +Commonly, +a terminal implements a visual bell by momentarily reversing the +character foreground and background colors on the entire display; +even a monochrome device can do this. +These functions each attempt the other alert type if the one requested +is unavailable. +If neither is available, +.I curses +performs no action. +Nearly all terminals have an audible alert mechanism such as a bell or +piezoelectric buzzer, +but only some can flash the screen. .SH RETURN VALUE -These routines return \fBOK\fP if they succeed in beeping or flashing, -\fBERR\fP otherwise. +These functions return +.B OK +on success and +.B ERR +on failure. +.PP +In +.IR \%ncurses "," +.B beep +and +.B flash +return +.B OK +if the terminal type supports the corresponding capability: +.B bell +.RB ( bel ) +for +.B beep +and +.B \%flash_screen +.RB ( flash ) +for +.BR flash "." +Otherwise they return +.BR ERR "." .SH EXTENSIONS -SVr4's beep and flash routines always returned \fBOK\fP, so it was not -possible to tell when the beep or flash failed. +In +.IR \%ncurses "," +these functions can return +.BR ERR "." .SH PORTABILITY -These functions are described in X/Open Curses, Issue 4. -Like SVr4, it specifies that they always return \fBOK\fP. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.PP +On SVr4 +.IR curses "," +they always return +.IR OK "," +and X/Open Curses specifies them as doing so. +.SH HISTORY +SVr2 (1984) +introduced +.I beep +and +.IR flash "." .SH SEE ALSO -\fB\%curses\fP(3X) +\fB\%curses\fP(3X), +\fB\%terminfo\fP(5) diff --git a/contrib/ncurses/man/curs_bkgd.3x b/contrib/ncurses/man/curs_bkgd.3x --- a/contrib/ncurses/man/curs_bkgd.3x +++ b/contrib/ncurses/man/curs_bkgd.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2015,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_bkgd.3x,v 1.61 2024/04/20 18:54:36 tom Exp $ -.TH curs_bkgd 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_bkgd.3x,v 1.76 2025/08/23 22:39:20 tom Exp $ +.TH curs_bkgd 3X 2025-08-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -64,37 +64,55 @@ \fBchtype getbkgd(WINDOW *\fIwin\fP); .fi .SH DESCRIPTION -The -.I background -of a +Every .I curses -window -(in the library's non-\*(``wide\*('' configuration) -is a -.I \%chtype -combining a set of attributes -(see \fB\%curs_attr\fP(3X)) -with a character called the -.I "blank character." -.PP -The blank character is a spacing character that populates a window's -character cells when their contents are erased without replacement. -The background's attributes are combined with all non-blank characters -written to the window, -as with the \fB\%waddch\fP(3X) and \fB\%winsch\fP(3X) families of -functions. +window has a +.I "background character" +property: +in the library's non-wide-character configuration, +it is a +.I curses +character +.RI \%( chtype ) +that combines a set of attributes +(and, +if colors are enabled, +a color pair identifier) +with a character code. +When erasing +(parts of) +a window, +.I curses +replaces the erased cells with the background character. .PP -The blank character and attributes of the background combine with -characters written to the window as described below. -The background becomes a property of the character and moves with it -through any scrolling and insert/delete line/character operations. +.I curses +also uses the background character when writing characters to a +populated window. +.bP +The attribute part of the background character combines with all +non-blank character cells in the window, +as populated by the \fB\%waddch\fP(3X) and \fB\%winsch\fP(3X) +families of functions +(and those that call them). +.bP +Both the character code and attributes of the background character +combine with blank character cells in the window. .PP -To the extent possible on a given terminal, -the attribute part of the background is displayed as the graphic -rendition of the character put on the screen. +The background character's set of attributes becomes a property +of the character cell +and move with it through any scrolling +and insert/delete line/character operations. +To the extent possible on the terminal type, +.I curses +displays the attributes of the background character +as the graphic rendition of a character cell on the display. .SS "bkgd, wbkgd" -\fB\%bkgd\fP and \fB\%wbkgd\fP set the background property of -\fB\%stdscr\fP or the specified window and then apply this setting to +.B \%bkgd +and +.B \%wbkgd +set the background property of +.B \%stdscr +or the specified window and then apply this setting to every character cell in that window. .bP The rendition of every character in the window changes to the new @@ -106,19 +124,19 @@ .I \%ncurses updates the rendition of each character cell by comparing the character, non-color attributes, -and colors. -The library applies to following procedure to each cell in the window, +and color pair selection. +The library applies the following procedure to each cell in the window, whether or not it is blank. .bP .I \%ncurses -first compares the cell's character to the previously specified blank -character; +first compares the cell's character to the previously specified +background character; if they match, .I \%ncurses -writes the new blank character to the cell. +writes the new background character to the cell. .bP .I \%ncurses -then checks if the cell uses color, +then checks whether the cell uses color; that is, its color pair value is nonzero. If not, @@ -141,85 +159,146 @@ first removing those that may have come from the current background, and then adding attributes from the new background. .PP +If the new background's character is non-spacing +(for example, +if it is a control character), .I \%ncurses -treats a background character value of zero (0) as a blank character. +retains the existing background character, +except for one special case: +.I \%ncurses +treats a background character code of zero (0) as a space. .PP If the terminal does not support color, or if color has not been initialized with \fB\%start_color\fP(3X), .I \%ncurses -ignores the new background character's color attribute. +ignores the new background character's color pair selection. .SS "bkgdset, wbkgdset" -\fB\%bkgdset\fP and \fB\%wbkgdset\fP manipulate the background of -the applicable window, -without updating the character cells as \fB\%bkgd\fP and -\fB\%wbkgd\fP do; +.B \%bkgdset +and +.B \%wbkgdset +manipulate the background of the applicable window, +without updating the character cells as +.B \%bkgd +and +.B \%wbkgd +do; only future writes reflect the updated background. .SS getbkgd -\fB\%getbkgd\fP obtains the given window's background character and -attribute combination. +.B \%getbkgd +returns the given window's background character, +attributes, +and color pair as a +.IR \%chtype "." .SH RETURN VALUE -Functions returning an \fIint\fP return \fBOK\fP on success. -\fB\%bkgd\fP returns \fBERR\fP if the library has not been initialized. -\fB\%wbkgd\fP and \fB\%getbkgd\fP return \fBERR\fP if a \fI\%WINDOW\fP -pointer argument is null. +.B \%bkgdset +and +.B \%wbkgdset +do not return a value. .PP -\fB\%bkgdset\fP and \fBwbkgdset\fP do not return a value. +Functions returning an +.I int +return +.B ERR +upon failure and +.B OK +upon success. +In +.IR \%ncurses "," +failure occurs if +.bP +the +.I curses +screen has not been initialized, +or +.bP +.I win +is +.IR NULL "." .PP -\fB\%getbkgd\fP returns a window's background character and attribute -combination. +.BR \%getbkgd 's +return value is as described above. .SH NOTES Unusually, -there is no \fB\%wgetbkgd\fP function; -\fB\%getbkgd\fP behaves as one would expect \fB\%wgetbkgd\fP to, -accepting a \fI\%WINDOW\fP pointer argument. +there is no +.B \%wgetbkgd +function; +.B \%getbkgd +behaves as one would expect +.B \%wgetbkgd +to, +accepting a +.I \%WINDOW +pointer argument. .PP -\fB\%bkgd\fP and -\fB\%bkgdset\fP +.B \%bkgd +and +.B \%bkgdset may be implemented as macros. .PP X/Open Curses mentions that the character part of the background must be a single-byte value. -\fI\%ncurses\fP, -like SVr4 \fIcurses\fP, -checks to ensure that, -and will reuse the old background character if the check fails. +.IR \%ncurses "," +like SVr4 +.IR curses "," +checks to ensure that it is, +and retains the existing background character if the check fails. .SH PORTABILITY -X/Open Curses, -Issue 4 describes these functions. -It specifies that -\fB\%bkgd\fP, -\fB\%wbkgd\fP, +X/Open Curses Issue\ 4 describes these functions. +It indicates that +.IR bkgd "," +.IR wbkgd "," and -\fB\%getbkgd\fP -return \fBERR\fP on failure +.I getbkgd +return +.I ERR +on failure (in the case of the last, this value is cast to .IR \%chtype ), -but describes no failure conditions. +but specifies no error conditions for them. .PP -The SVr4.0 manual says that \fB\%bkgd\fP and \fB\%wbkgd\fP may return -\fBOK\fP -\*(``or a non-negative integer if \fB\%immedok\fP is set\*('', -which refers to the return value from \fB\%wrefresh\fP(3X), -used to implement the immediate repainting. -SVr4 \fIcurses\fP's \fB\%wrefresh\fP returns the number of characters -written to the screen during the refresh. -\fI\%ncurses\fP does not do that. +SVr4 documentation +.\" SVID 4, vol. 3, p. 482 +says that +.I \%bkgd +and +.I \%wbkgd +return +.I OK +\*(``or a non-negative integer if +.I \%immedok() \" Courier roman in source +is set\*('', +referring to the return value from +.IR \%wrefresh "," +which in SVr4 returns a count of characters +written to the window if its +.I \%immedok +property is set; +.\" ...though its wrefresh() man page says nothing about immedok()... +in +.IR \%ncurses "," +it does not. .PP Neither X/Open Curses nor the SVr4 manual pages detail how the rendition -of characters on the screen updates when \fB\%bkgd\fP or \fB\%wbkgd\fP +of characters in the window updates when +.I \%bkgd +or +.I \%wbkgd changes the background character. -.IR \%ncurses , +.IR \%ncurses "," like SVr4 -.IR curses , +.IR curses "," does not -(in its non-\*(``wide\*('' configuration) +(in its non-wide-character configuration) store the background and window attribute contributions to each character cell separately. +.SH HISTORY +SVr3.1 (1987) +introduced these functions. .SH SEE ALSO \fB\%curs_bkgrnd\fP(3X) describes the corresponding functions in the -\*(``wide\*('' configuration of -.IR \%ncurses . +wide configuration of +.IR \%ncurses "." .PP \fB\%curses\fP(3X), \fB\%curs_addch\fP(3X), diff --git a/contrib/ncurses/man/curs_bkgrnd.3x b/contrib/ncurses/man/curs_bkgrnd.3x --- a/contrib/ncurses/man/curs_bkgrnd.3x +++ b/contrib/ncurses/man/curs_bkgrnd.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2002-2015,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,19 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_bkgrnd.3x,v 1.42 2024/04/20 18:54:36 tom Exp $ -.TH curs_bkgrnd 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" -.ie \n(.g \{\ -.ds `` \(lq -.ds '' \(rq -.\} -.el \{\ -.ie t .ds `` `` -.el .ds `` "" -.ie t .ds '' '' -.el .ds '' "" -.\} -. +.\" $Id: curs_bkgrnd.3x,v 1.60 2025/08/23 22:39:20 tom Exp $ +.TH curs_bkgrnd 3X 2025-08-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 @@ -66,37 +55,55 @@ \fBint wgetbkgrnd(WINDOW *\fIwin\fP, cchar_t *\fIwch\fP); .fi .SH DESCRIPTION -The -.I background -of a +Every .I curses -window -(in the library's \*(``wide\*('' configuration) -is a -.I \%cchar_t -combining a set of attributes -(see \fB\%curs_attr\fP(3X)) -with a complex character called the -.I "blank character." -.PP -The blank character is a spacing character that populates a window's -character cells when their contents are erased without replacement. -The background's attributes are combined with all non-blank characters -written to the window, -as with the \fB\%wadd_wch\fP(3X) and \fB\%wins_wch\fP(3X) families of -functions. +window has a +.I "background character" +property: +in the library's wide configuration, +it is a +.I curses +complex character +.RI \%( cchar_t ) +that combines a set of attributes +(and, +if colors are enabled, +a color pair identifier) +with a character code. +When erasing +(parts of) +a window, +.I curses +replaces the erased cells with the background character. .PP -The blank character and attributes of the background combine with -characters written to the window as described below. -The background becomes a property of the character and moves with it -through any scrolling and insert/delete line/character operations. +.I curses +also uses the background character when writing characters to a +populated window. +.bP +The attribute part of the background character combines with all +non-blank character cells in the window, +as populated by the \fB\%wadd_wch\fP(3X) and \fB\%wins_wch\fP(3X) +families of functions +(and those that call them). +.bP +Both the character code and attributes of the background character +combine with blank character cells in the window. .PP -To the extent possible on a given terminal, -the attribute part of the background is displayed as the graphic -rendition of the character put on the screen. +The background character's set of attributes becomes a property +of the character cell +and move with it through any scrolling +and insert/delete line/character operations. +To the extent possible on the terminal type, +.I curses +displays the attributes of the background character +as the graphic rendition of a character cell on the display. .SS "bkgrnd, wbkgrnd" -\fB\%bkgrnd\fP and \fB\%wbkgrnd\fP set the background property of -\fB\%stdscr\fP or the specified window and then apply this setting to +.B \%bkgrnd +and +.B \%wbkgrnd +set the background property of +.B \%stdscr +or the specified window and then apply this setting to every character cell in that window. .bP The rendition of every character in the window changes to the new @@ -108,19 +115,19 @@ .I \%ncurses updates the rendition of each character cell by comparing the character, non-color attributes, -and colors. +and color pair selection. The library applies to following procedure to each cell in the window, whether or not it is blank. .bP .I \%ncurses -first compares the cell's character to the previously specified blank -character; +first compares the cell's character to the previously specified +background character; if they match, .I \%ncurses -writes the new blank character to the cell. +writes the new background character to the cell. .bP .I \%ncurses -then checks if the cell uses color, +then checks whether the cell uses color; that is, its color pair value is nonzero. If not, @@ -143,73 +150,100 @@ first removing those that may have come from the current background, and then adding attributes from the new background. .PP +If the new background's character is non-spacing, +.I \%ncurses +reuses the old background character, +except for one special case: .I \%ncurses -treats a background character value of zero (0) as a blank character. +treats a background character code of zero (0) as a space. .PP If the terminal does not support color, or if color has not been initialized with \fB\%start_color\fP(3X), .I \%ncurses -ignores the new background character's color attribute. +ignores the new background character's color pair selection. .SS "bkgrndset, wbkgrndset" -\fB\%bkgrndset\fP and \fB\%wbkgrndset\fP manipulate the background of -the applicable window, -without updating the character cells as \fB\%bkgrnd\fP and -\fB\%wbkgrnd\fP do; +.B \%bkgrndset +and +.B \%wbkgrndset +manipulate the background of the applicable window, +without updating the character cells as +.B \%bkgrnd +and +.B \%wbkgrnd +do; only future writes reflect the updated background. .SS "getbkgrnd, wgetbkgrnd" -The \fB\%getbkgrnd\fP and \fB\%wgetbkgrnd\fP functions obtain the -background character and attribute pair of \fB\%stdscr\fP or the -specified window and store it via the +.B \%getbkgrnd +and +.B \%wgetbkgrnd +respectively obtain +.BR \%stdscr 's +or the given window's background character, +attributes, +and color pair, +and store it in their .I wch -pointer. +argument. .SH RETURN VALUE -\fBbkgrndset\fP and \fBwbkgrndset\fP do not return a value. +.B \%bkgrndset +and +.B \%wbkgrndset +do not return a value. .PP -The other functions return +Functions returning an +.I int +return .B ERR upon failure and .B OK upon success. In -.IR \%ncurses , +.IR \%ncurses "," failure occurs if .bP -a -.I \%WINDOW -pointer +the +.I curses +screen has not been initialized, +.bP .I win -is null, or +is +.IR NULL "," +or .bP -a -.I \%cchar_t -pointer .I wch -is null. +is +.IR NULL "." .SH NOTES -\fB\%bkgrnd\fP, -\fB\%bkgrndset\fP, and -\fB\%getbkgrnd\fP +.BR \%bkgrnd "," +.BR \%bkgrndset "," +and +.B \%getbkgrnd may be implemented as macros. .PP -Unlike their counterparts in the non-\*(``wide\*('' configuration of -.IR \%ncurses , -\fB\%getbkgrnd\fP and \fB\%wgetbkgrnd\fP supply the background character -and attribute in a modifiable +Unlike their counterparts in the non-wide-character configuration of +.IR \%ncurses "," +.B \%getbkgrnd +and +.B \%wgetbkgrnd +store the background character in a modifiable .I \%cchar_t parameter, -not as the return value. +rather than supplying it as the return value. .SH PORTABILITY -X/Open Curses, -Issue 4 describes these functions. +X/Open Curses Issue\ 4 describes these functions. It specifies no error conditions for them. .PP X/Open Curses does not provide details of how the rendition is updated. -This implementation follows the approach used in SVr4 -.IR curses . +.I \%ncurses +follows the approach used in SVr4 +.IR curses 's +non-wide functions for manipulating the window background. +.SH HISTORY +X/Open Curses Issue\ 4 (1995) initially specified these functions. .SH SEE ALSO \fB\%curs_bkgd\fP(3X) describes the corresponding functions in the -non-\*(``wide\*('' configuration of -.IR \%ncurses . +non-wide-character configuration of +.IR \%ncurses "." .PP \fB\%curses\fP(3X), \fB\%curs_add_wch\fP(3X), diff --git a/contrib/ncurses/man/curs_border.3x b/contrib/ncurses/man/curs_border.3x --- a/contrib/ncurses/man/curs_border.3x +++ b/contrib/ncurses/man/curs_border.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2007,2010 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_border.3x,v 1.49 2024/04/20 21:20:07 tom Exp $ -.TH curs_border 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_border.3x,v 1.65 2025/10/20 23:42:24 tom Exp $ +.TH curs_border 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -39,6 +39,11 @@ .ie t .ds '' '' .el .ds '' "" .\} +. +.de bP +.ie n .IP \(bu 4 +.el .IP \(bu 2 +.. .SH NAME \fB\%border\fP, \fB\%wborder\fP, @@ -57,93 +62,131 @@ \fB#include .PP \fBint border(chtype \fIls\fP, chtype \fIrs\fP, chtype \fIts\fP, chtype \fIbs\fP, - \fBchtype \fItl\fB, chtype \fItr\fB, chtype \fIbl\fB, chtype \fIbr\fB);\fR + \fBchtype \fItl\fB, chtype \fItr\fB, chtype \fIbl\fB, chtype \fIbr\fB);\fR \fBint wborder(WINDOW *\fIwin\fB, chtype \fIls\fB, chtype \fIrs\fB,\fR - \fBchtype \fIts\fB, chtype \fIbs\fB, chtype \fItl\fB, chtype \fItr\fB,\fR - \fBchtype \fIbl\fB, chtype \fIbr\fB);\fR + \fBchtype \fIts\fB, chtype \fIbs\fB, chtype \fItl\fB, chtype \fItr\fB,\fR + \fBchtype \fIbl\fB, chtype \fIbr\fB);\fR .PP \fBint box(WINDOW *\fIwin\fB, chtype \fIverch\fB, chtype \fIhorch\fB);\fR .PP \fBint hline(chtype \fIch\fB, int \fIn\fB);\fR \fBint whline(WINDOW *\fIwin\fB, chtype \fIch\fB, int \fIn\fB);\fR -\fBint vline(chtype \fIch\fB, int \fIn\fB);\fR -\fBint wvline(WINDOW *\fIwin\fB, chtype \fIch\fB, int \fIn\fB);\fR -.PP \fBint mvhline(int \fIy\fB, int \fIx\fB, chtype \fIch\fB, int \fIn\fB);\fR \fBint mvwhline(WINDOW *\fIwin\fB, int \fIy\fB, int \fIx\fB, chtype \fIch\fB, int \fIn\fB);\fR +.PP +\fBint vline(chtype \fIch\fB, int \fIn\fB);\fR +\fBint wvline(WINDOW *\fIwin\fB, chtype \fIch\fB, int \fIn\fB);\fR \fBint mvvline(int \fIy\fB, int \fIx\fB, chtype \fIch\fB, int \fIn\fB);\fR \fBint mvwvline(WINDOW *\fIwin\fB, int \fIy\fB, int \fIx\fB, chtype \fIch\fB, int \fIn\fB);\fR .fi .SH DESCRIPTION -The \fBborder\fP, \fBwborder\fP and \fBbox\fP routines -draw a box around the edges of a window. -Other than the window, each argument is a character with attributes: -.sp +.B \%wborder +and +.B \%border +draw a box at the edges of the specified window or +.BR \%stdscr "," +respectively. +Each +.I \%chtype +argument corresponds to a geometric component of the border as follows: .RS -\fIls\fP \- left side, +.I ls +\- left side, .br -\fIrs\fP \- right side, +.I rs +\- right side, .br -\fIts\fP \- top side, +.I ts +\- top side, .br -\fIbs\fP \- bottom side, +.I bs +\- bottom side, .br -\fItl\fP \- top left-hand corner, +.I tl +\- top left-hand corner, .br -\fItr\fP \- top right-hand corner, +.I tr +\- top right-hand corner, .br -\fIbl\fP \- bottom left-hand corner, and +.I bl +\- bottom left-hand corner, and .br -\fIbr\fP \- bottom right-hand corner. +.I br +\- bottom right-hand corner. .RE .PP -If any of these arguments is zero, then the corresponding -default values (defined in \fBcurses.h\fP) are used instead: -.sp +If any +.I \%chtype +argument is +.BR 0 "," +then +.I curses +uses forms-drawing characters +(see \fBaddch\fP(3X)) +in the following correspondence: .RS -\fBACS_VLINE\fP, +.BR \%ACS_VLINE "," .br -\fBACS_VLINE\fP, +.BR \%ACS_VLINE "," .br -\fBACS_HLINE\fP, +.BR \%ACS_HLINE "," .br -\fBACS_HLINE\fP, +.BR \%ACS_HLINE "," .br -\fBACS_ULCORNER\fP, +.BR \%ACS_ULCORNER "," .br -\fBACS_URCORNER\fP, +.BR \%ACS_URCORNER "," .br -\fBACS_LLCORNER\fP, +.BR \%ACS_LLCORNER "," +and .br -\fBACS_LRCORNER\fP. +.BR \%ACS_LRCORNER "." .RE .PP -\fBbox(\fIwin\fB, \fIverch\fB, \fIhorch\fB)\fR is a shorthand -for the following call: \fBwborder(\fIwin\fB,\fR \fIverch\fB,\fR -\fIverch\fB,\fR \fIhorch\fB,\fR \fIhorch\fB, 0, 0, 0, 0)\fR. +.BI \%box( win "," +.IB verch , +.IB horch ) +is shorthand for +.RB \%\*(`` wborder(\c +.IB win , +.IB verch , +.IB verch , +.IB horch , +.IB horch , +.BR "0, 0, 0, 0)" "\*(''." .PP -The \fBhline\fP and \fBwhline\fP functions draw a horizontal (left to right) -line using \fIch\fP starting at the current cursor position in the window. -The -current cursor position is not changed. -The line is at most \fIn\fP characters -long, or as many as fit into the window. -.PP -The \fBvline\fP and \fBwvline\fP functions draw a vertical (top to bottom) line -using \fIch\fP starting at the current cursor position in the window. -The -current cursor position is not changed. -The line is at most \fIn\fP characters -long, or as many as fit into the window. +.B \%whline +draws a horizontal line of +.I ch +from left to right, +and +.B \%wvline +a vertical one from top to bottom, +stopping once +.I n +characters have been drawn or upon reaching the boundary of +.IR win "." +These functions do not update the cursor position +(beyond any motion directed by their \*(``mv\*('' variants). +\fB\%ncurses\fP(3X) describes the variants of these functions. .SH RETURN VALUE -All routines return the integer \fBOK\fP. -The SVr4.0 manual says -\*(``or a non-negative integer if \fB\%immedok\fP is set\*('', -but this appears to be an error. +These functions return +.B OK +on success and +.B ERR +on failure. .PP -X/Open Curses does not specify any error conditions. -This implementation returns an error -if the window pointer is null. +In +.IR \%ncurses "," +.bP +these functions fail if the screen is not initialized; +and +.bP +functions taking a +.I \%WINDOW +pointer argument fail if +.I win +is a null pointer. .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -151,12 +194,90 @@ .IR x ) is outside the window boundaries. .SH NOTES -The borders generated by these functions are \fIinside\fP borders (this -is also true of SVr4 curses, though the fact is not documented). +Unusually, +there is no +.B \%wbox +function; +.B \%box +behaves as one would expect +.B \%wbox +to, +accepting a +.I \%WINDOW +pointer argument. +.PP +.BR \%border "," +.BR \%box "," +.BR \%hline "," +.BR \%mvhline "," +.BR \%mvwhline "," +.BR \%vline "," +.BR \%mvvline "," +and +.B \%mvwvline +may be implemented as macros. .PP -Note that \fBborder\fP and \fBbox\fP may be macros. +Borders drawn by these functions are +.I interior +borders. +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/libcurses/box.c .SH PORTABILITY -These functions are described in X/Open Curses, Issue 4. +These functions are described in X/Open Curses Issue\ 4. +It specifies no error conditions for them. +.PP +SVr4 documentation +.\" SVID 4, vol. 3, p. 483 +says that these functions return +.I OK +\*(``or a non-negative integer if +.I \%immedok() \" Courier roman in source +is set\*('', +referring to the return value from +.IR \%wrefresh "," +which in SVr4 returns a count of characters +written to the window if its +.I \%immedok +property is set; +.\" ...though its wrefresh() man page says nothing about immedok()... +in +.IR \%ncurses "," +it does not. +.PP +BSD +.I curses +drew boxes with +.I horch +in +.I every +character cell of the top and bottom lines of the window, +whereas SVr3.1 and later +.IR curses "," +because its +.I box +wrapped +.IR wborder "," +used the default corner characters. +.\" https://github.com/ryanwoodsmall/oldsysv/blob/master/sysvr3/31/\ +.\" usr/src/lib/libcurses/screen/curses.ed#L454 +.SH HISTORY +4BSD (1980) +introduced +.IR box "," +defining it as a function. +.PP +SVr3.1 (1987) +added +.I \%whline +and +.I \%wvline +and their variants, +as well as +.I \%border +and +.IR \%wborder "," +redefining +.I \%box +as a macro wrapping the latter. .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_outopts\fP(3X) diff --git a/contrib/ncurses/man/curs_border_set.3x b/contrib/ncurses/man/curs_border_set.3x --- a/contrib/ncurses/man/curs_border_set.3x +++ b/contrib/ncurses/man/curs_border_set.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-2024,2025 Thomas E. Dickey * .\" Copyright 2002-2011,2012 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_border_set.3x,v 1.36 2024/04/20 21:20:07 tom Exp $ -.TH curs_border_set 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_border_set.3x,v 1.50 2025/10/21 00:10:56 tom Exp $ +.TH curs_border_set 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -56,46 +56,31 @@ .nf \fB#include .PP -\fBint border_set( - \fBconst cchar_t *\fIls\fB, const cchar_t *\fIrs\fP, - \fBconst cchar_t *\fIts\fB, const cchar_t *\fIbs\fP, - \fBconst cchar_t *\fItl\fB, const cchar_t *\fItr\fP, - \fBconst cchar_t *\fIbl\fB, const cchar_t *\fIbr\fB);\fR +\fBint border_set(const cchar_t *\fIls\fB, const cchar_t *\fIrs\fP, + \fBconst cchar_t *\fIts\fB, const cchar_t *\fIbs\fP, + \fBconst cchar_t *\fItl\fB, const cchar_t *\fItr\fP, + \fBconst cchar_t *\fIbl\fB, const cchar_t *\fIbr\fB);\fR .br -\fBint wborder_set(\fP - \fBWINDOW *\fIwin\fP, - \fBconst cchar_t *\fIls\fB, const cchar_t *\fIrs\fP, - \fBconst cchar_t *\fIts\fB, const cchar_t *\fIbs\fP, - \fBconst cchar_t *\fItl\fB, const cchar_t *\fItr\fP, - \fBconst cchar_t *\fIbl\fB, const cchar_t *\fIbr\fB);\fR -\fBint box_set(\fP - \fBWINDOW *\fIwin\fP, - \fBconst cchar_t *\fIverch\fP, - \fBconst cchar_t *\fIhorch\fB);\fR -\fBint hline_set(\fP - \fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR -\fBint whline_set(\fP - \fBWINDOW *\fIwin\fP, - \fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR -\fBint mvhline_set(\fP - \fBint \fIy\fB, int \fIx\fP, - \fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR -\fBint mvwhline_set(\fP - \fBWINDOW *\fIwin\fP, - \fBint \fIy\fB, int \fIx\fP, - \fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR -\fBint vline_set(\fP - \fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR -\fBint wvline_set(\fP - \fBWINDOW *\fIwin\fP, - \fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR -\fBint mvvline_set(\fP - \fBint \fIy\fB, int \fIx\fP, - \fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR -\fBint mvwvline_set(\fP - \fBWINDOW *\fIwin\fP, - \fBint \fIy\fB, int \fIx\fP, - \fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR +\fBint wborder_set(\fBWINDOW *\fIwin\fP, + \fBconst cchar_t *\fIls\fB, const cchar_t *\fIrs\fP, + \fBconst cchar_t *\fIts\fB, const cchar_t *\fIbs\fP, + \fBconst cchar_t *\fItl\fB, const cchar_t *\fItr\fP, + \fBconst cchar_t *\fIbl\fB, const cchar_t *\fIbr\fB);\fR +.PP +\fBint box_set(\fBWINDOW *\fIwin\fP, \fBconst cchar_t *\fIverch\fP, + \fBconst cchar_t *\fIhorch\fB);\fR +.PP +\fBint hline_set(const cchar_t *\fIwch\fB, int \fIn\fB);\fR +\fBint whline_set(WINDOW *\fIwin\fP, \fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR +\fBint mvhline_set(int \fIy\fB, int \fIx\fP, \fBconst cchar_t *\fIwch\fB,\fR \fBint \fIn\fB);\fR +\fBint mvwhline_set(WINDOW *\fIwin\fP, \fBint \fIy\fB, int \fIx\fP, + \fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR +.PP +\fBint vline_set(const cchar_t *\fIwch\fB, int \fIn\fB);\fR +\fBint wvline_set(WINDOW *\fIwin\fP, \fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR +\fBint mvvline_set(int \fIy\fB, int \fIx\fP, \fBconst cchar_t *\fIwch\fB,\fR \fBint \fIn\fB);\fR +\fBint mvwvline_set(WINDOW *\fIwin\fP, \fBint \fIy\fB, int \fIx\fP, + \fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR .fi .SH DESCRIPTION The @@ -177,7 +162,9 @@ Otherwise, they return \fBERR\fP. .PP -Functions using a window parameter return an error if it is null. +Functions using a window parameter return +.B ERR +if it is null. .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -185,17 +172,20 @@ .IR x ) is outside the window boundaries. .SH NOTES -Note that -\fBborder_set\fP, -\fBhline_set\fP, -\fBmvhline_set\fP, -\fBmvvline_set\fP, -\fBmvwhline_set\fP, -\fBmvwvline_set\fP, and -\fBvline_set\fP -may be macros. +.BR \%border_set "," +.BR \%hline_set "," +.BR \%mvhline_set "," +.BR \%mvvline_set "," +.BR \%mvwhline_set "," +.BR \%mvwvline_set "," +and +.B \%vline_set +may be implemented as macros. .SH PORTABILITY -These functions are described in X/Open Curses, Issue 4. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.SH HISTORY +X/Open Curses Issue\ 4 (1995) initially specified these functions. .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_add_wch\fP(3X), diff --git a/contrib/ncurses/man/curs_clear.3x b/contrib/ncurses/man/curs_clear.3x --- a/contrib/ncurses/man/curs_clear.3x +++ b/contrib/ncurses/man/curs_clear.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2016 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_clear.3x,v 1.48 2024/04/20 21:20:07 tom Exp $ -.TH curs_clear 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_clear.3x,v 1.58 2025/01/19 00:49:39 tom Exp $ +.TH curs_clear 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -93,24 +93,44 @@ .SH RETURN VALUE All routines return the integer \fBOK\fP on success and \fBERR\fP on failure. .PP -X/Open defines no error conditions. In this implementation, .bP -functions using a window pointer parameter return an error if it is null +functions using a window pointer parameter return +.B ERR +if it is null .bP \fBwclrtoeol\fP returns an error if the cursor position is about to wrap. .SH NOTES -Note that \fBerase\fP, \fBwerase\fP, \fBclear\fP, \fBwclear\fP, -\fBclrtobot\fP, and \fBclrtoeol\fP may be macros. +.BR \%erase "," +.BR \%werase "," +.BR \%clear "," +.BR \%wclear "," +.BR \%clrtobot "," +and +.B \%clrtoeol +may be implemented as macros. .SH PORTABILITY -These functions are described in X/Open Curses, Issue 4. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. .PP -The SVr4.0 manual says that these functions could return -\*(``or a non-negative integer if \fB\%immedok\fP is set\*('', -referring to the return-value of \fBwrefresh\fP. -In that implementation, \fBwrefresh\fP would return a count of -the number of characters written to the terminal. +SVr4 documentation +.\" SVID 4, vol. 3, p. 485 +says that these functions return +.I OK +\*(``or a non-negative integer if +.I \%immedok() \" Courier roman in source +is set\*('', +referring to the return value from +.IR \%wrefresh "," +which in SVr4 returns a count of characters +written to the window if its +.I \%immedok +property is set; +.\" ...though its wrefresh() man page says nothing about immedok()... +in +.IR \%ncurses "," +it does not. .PP Some historic curses implementations had, as an undocumented feature, the ability to do the equivalent of \fBclearok(..., 1)\fP by saying diff --git a/contrib/ncurses/man/curs_color.3x b/contrib/ncurses/man/curs_color.3x --- a/contrib/ncurses/man/curs_color.3x +++ b/contrib/ncurses/man/curs_color.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_color.3x,v 1.100 2024/04/20 21:24:19 tom Exp $ -.TH curs_color 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_color.3x,v 1.126 2025/08/23 22:39:20 tom Exp $ +.TH curs_color 3X 2025-08-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -69,7 +69,8 @@ \fB\%COLOR_BLUE\fP, \fB\%COLOR_MAGENTA\fP, \fB\%COLOR_CYAN\fP, -\fB\%COLOR_WHITE\fP \- +\fB\%COLOR_WHITE\fP, +\fB\%A_COLOR\fP \- manipulate terminal colors with \fIcurses\fR .SH SYNOPSIS .nf @@ -99,8 +100,18 @@ \fI/* extension */ \fBvoid reset_color_pairs(void); .PP +\fI/* macros */ \fBint COLOR_PAIR(int \fIn\fP); \fBPAIR_NUMBER(int \fIattr\fP); +\fBCOLOR_BLACK +\fBCOLOR_RED +\fBCOLOR_GREEN +\fBCOLOR_YELLOW +\fBCOLOR_BLUE +\fBCOLOR_MAGENTA +\fBCOLOR_CYAN +\fBCOLOR_WHITE +\fBA_COLOR .fi .SH DESCRIPTION .SS Overview @@ -160,9 +171,8 @@ .bP If the parameter passed to \fB\%waddch\fP is \fIblank\fP, and it uses the special color pair 0, -.RS -.bP \fIcurses\fP next checks the window attribute. +.RS .bP If the window attribute does not use color pair 0, \fIcurses\fP uses the color pair from the window attribute. @@ -182,24 +192,36 @@ Consequently those calls use only the window attribute or the background character. .SH CONSTANTS -In \fB\%\fP the following macros are defined. -These are the standard colors (ISO-6429). -\fIcurses\fP also assumes that \fB\%COLOR_BLACK\fP is the default -background color for all terminals. -.PP -.nf - \fBCOLOR_BLACK\fP - \fBCOLOR_RED\fP - \fBCOLOR_GREEN\fP - \fBCOLOR_YELLOW\fP - \fBCOLOR_BLUE\fP - \fBCOLOR_MAGENTA\fP - \fBCOLOR_CYAN\fP - \fBCOLOR_WHITE\fP -.fi -.PP -Some terminals support more than the eight (8) \*(``ANSI\*('' colors. -There are no standard names for those additional colors. +ISO\ 6429 and ECMA-48 +define eight standard colors +(also known as \*(``ANSI\*('' colors). +.I curses\.h +defines object-like macros +.BR \%COLOR_BLACK "," +.BR \%COLOR_RED "," +.BR \%COLOR_GREEN "," +.BR \%COLOR_YELLOW "," +.BR \%COLOR_BLUE "," +.BR \%COLOR_MAGENTA "," +.BR \%COLOR_CYAN "," +and +.B \%COLOR_WHITE +accordingly. +.I curses +assumes that +.B \%COLOR_BLACK +is the default background color for all terminals. +.I \%ncurses +offers an extension to override that assumption; +see \fB\%assume_default_colors\fP(3X). +Some terminals support additional colors that lack standard names. +.PP +.B \%A_COLOR +is a bit mask that, +when bitwise \*(``and\*(''-ed with a +.IR \%chtype "," +.\" XXX: and right-shifted by...? +extracts its color pair identifier. .SH VARIABLES .SS COLORS is initialized by \fB\%start_color\fP to the maximum number of colors @@ -291,12 +313,48 @@ but is actually whatever the terminal implements before color is initialized. It cannot be modified by the application. .SS has_colors -The \fB\%has_colors\fP routine requires no arguments. -It returns \fBTRUE\fP if -the terminal can manipulate colors; otherwise, it returns \fBFALSE\fP. -This routine facilitates writing terminal-independent programs. -For example, a programmer can use it to decide -whether to use color or some other video attribute. +.B \%has_colors +returns +.B TRUE +if the terminal supports colors and +.B FALSE +if it does not. +\fB\%initscr\fP(3X) or \fB\%newterm\fP(3X) must be called first, +but +.B \%start_color +need not be. +An application might call +.B \%has_colors +to decide whether to use color +or a video attribute like +.B \%A_BOLD +to render text. +.PP +Color support in +.I curses +requires that the terminal type description +support the capabilities +.B \%max_colors +.RB \%( colors ), +.B \%max_pairs +.RB \%( pairs ), +and any of +.bP +.B \%set_foreground +.RB ( setf ) +and +.B \%set_background +.RB ( setb ); +.bP +.B \%set_a_foreground +.RB ( setaf ) +and +.B \%set_a_background +.RB ( setab ); +or +.bP +.B \%set_color_pair +.RB ( scp ). .SS can_change_color The \fB\%can_change_color\fP routine requires no arguments. It returns \fBTRUE\fP if the terminal supports colors @@ -418,87 +476,173 @@ \fIattr\fP parameter and returns it as a color pair number; it is the inverse operation of \fB\%COLOR_PAIR\fP. .SH RETURN VALUE -The routines \fB\%can_change_color\fP and \fB\%has_colors\fP return \fBTRUE\fP -or \fBFALSE\fP. -.PP -All other routines return the integer \fBERR\fP upon failure and an \fBOK\fP -(SVr4 specifies only \*(``an integer value -other than \fBERR\fP\*('') upon successful completion. -.PP -X/Open defines no error conditions. -SVr4 does document some error conditions which apply in general: +.B \%can_change_color +and +.B \%has_colors +return +.B TRUE +or +.BR FALSE "." +The other functions return +.B OK +on success and +.B ERR +on failure. +.PP +In +.IR \%ncurses "," +functions returning an +.I int +recognize several error conditions. +.bP +All return +.B ERR +if the screen has not been initialized; +see \fBinitscr\fP(3X) or \fBnewterm\fP(3X). +.bP +All except +.B \%start_color +return +.B ERR +if +.B \%start_color +has not been called, +or itself returned +.BR ERR "." +.bP +.B \%start_color +returns +.B ERR +if it cannot allocate memory for its color pair table. +.bP +.B \%init_color +returns +.B ERR +if the terminal type does not support assignable color values; +that is, +if the +.B \%initialize_color +.RB ( initc ) +capability is absent from its description. +.bP +.B \%init_color +returns +.B ERR +if any of its +.IR r "," +.IR g "," +.I b +arguments is outside the range 0-1000 inclusive. +.bP +.BR \%init_pair "," +.BR \%init_color "," +.BR \%init_extended_pair "," +.BR \%init_extended_color "," +.BR \%color_content "," +.BR \%pair_content "," +.BR \%extended_color_content "," +and +.B \%extended_pair_content +return +.B ERR +on attempts to use +.RS .bP -This implementation will return \fBERR\fP on attempts to -use color values outside the range \fB0\fP to \fB\%COLORS\fP\-1 -(except for the default colors extension), -or use color pairs outside the range \fB0\fP to \fB\%COLOR_PAIRS\-1\fP. -.IP -Color values used in \fB\%init_color\fP must be -in the range \fB0\fP to \fB1000\fP. -.IP -An error is returned from all functions -if the terminal has not been initialized. -.IP -An error is returned from secondary functions such as \fB\%init_pair\fP -if \fB\%start_color\fP was not called. +color identifiers outside the range +.RB \%0- COLORS \-1 +inclusive, +the default colors extension notwithstanding, +or .bP -SVr4 does much the same, except that -it returns \fBERR\fP from \fB\%pair_content\fP if the pair was not initialized -using \fB\%init_pairs\fP -and -it returns \fBERR\fP from \fB\%color_content\fP -if the terminal does not support changing colors. -.IP -This implementation does not return \fBERR\fP for either case. -.PP -Specific functions make additional checks: -.RS 3 -.TP 5 -\fB\%init_color\fP -returns an error if the terminal does not support -this feature, e.g., if the \fB\%initialize_color\fP capability is absent -from the terminal description. -.TP 5 -\fB\%start_color\fP -returns an error if the color table cannot be allocated. +color pair identifiers outside the range +.RB \%0- COLOR_PAIRS \-1 +inclusive. .RE .SH NOTES -In the \fI\%ncurses\fP implementation, -there is a separate color activation flag, -color palette, color pairs table, -and associated \fB\%COLORS\fP and \fB\%COLOR_PAIRS\fP counts -for each screen; the \fB\%start_color\fP function only affects the current -screen. -The SVr4/XSI interface is not really designed with this in mind, and +In +.IR \%ncurses "," +.B \%init_pair +accepts negative foreground and background color arguments +to support its \fB\%use_default_colors\fP(3X) extension, +but only after the latter function has been called. +.PP +The assumption that +.B \%COLOR_BLACK +is the terminal's default background color can be overridden using +.IR \%ncurses 's +\fB\%assume_default_colors\fP(3X) extension. +.PP +In +.IR \%ncurses "," +each pointer passed to +.B \%color_content +and +.B \%pair_content +can be null, +in which case the library ignores it, +permitting the application to disregard unnecessary information. +.PP +In +.IR \%ncurses "," +each screen has a +color activation flag, +color palette, +color pair table, +and associated +.B \%COLORS +and +.B \%COLOR_PAIRS +values; +.B \%start_color +affects only the current screen. +The SVr4 and X/Open Curses interface was not really designed +with this in mind; historical implementations may use a single shared color palette. .PP Setting an implicit background color via a color pair affects only character cells that a character write operation explicitly touches. -To change -the background color used when parts of a window are blanked by erasing or -scrolling operations, see \fB\%curs_bkgd\fP(3X). -.PP -Several caveats apply on older x86 machines -(e.g., i386, i486) with VGA-compatible graphics: -.bP -COLOR_YELLOW is actually brown. -To get yellow, use COLOR_YELLOW combined with the \fBA_BOLD\fP attribute. -.bP -The A_BLINK attribute should in theory cause the background to go bright. -This often fails to work, and even some cards for which it mostly works -(such as the -Paradise and compatibles) do the wrong thing when you try to set a bright -\*(``yellow\*('' background (you get a blinking yellow foreground instead). +To change the background color used +when parts of a window are blanked by erasing or scrolling operations, +see \fB\%curs_bkgd\fP(3X). +.PP +Several caveats apply to IBM PC-compatible machines +of the 80486 era and earlier +with CGA/EGA/VGA video. +.bP +.B \%COLOR_YELLOW +was frequently converted, +in the analog domain, +to a shade of brown if the intensity bit was not set. +.\" https://nerdlypleasures.blogspot.com/2023/03/the-saga-of-color-brown-in-early-years.html +To get yellow on such devices, +one would combine +.B \%COLOR_YELLOW +with the +.B \%A_BOLD +attribute. .bP -Color RGB values are not settable. +The +.B \%A_BLINK +attribute should in theory make the background bright. +This often fails to work, +and even VGA controllers for which it mostly works, +such as those from Paradise and compatibles, +do the wrong thing +when you try to set a bright \*(``yellow\*('' background \(em +you get a blinking yellow foreground instead. +.bP +Color RGB values are not configurable on these devices +(in text mode). .SH EXTENSIONS -The functions marked as extensions were designed for -\fB\%ncurses\fP(3X), +The functions marked as extensions originated in +.IR \%ncurses "," and are not found in SVr4 .IR curses , 4.4BSD .IR curses , -or any other previous curses implementation. +or any other previous +.I curses +implementation. .SH PORTABILITY Applications employing .I \%ncurses @@ -506,81 +650,149 @@ .B \%NCURSES_VERSION preprocessor macro. .PP -This implementation satisfies X/Open Curses's minimum maximums -for \fB\%COLORS\fP and \fB\%COLOR_PAIRS\fP. -.PP -The \fB\%init_pair\fP routine accepts negative values of foreground -and background color to support the \fB\%use_default_colors\fP(3X) extension, -but only if that routine has been first invoked. -.PP -The assumption that \fB\%COLOR_BLACK\fP is the default -background color for all terminals can be modified using the -\fB\%assume_default_colors\fP(3X) extension. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. .PP -This implementation checks the pointers, -e.g., for the values returned by -\fB\%color_content\fP and \fB\%pair_content\fP, -and will treat those as optional parameters when null. +.I \%ncurses +satisfies X/Open Curses's minimum maximums for +.I \%COLORS +and +.IR \%COLOR_PAIRS "." .PP X/Open Curses does not specify a limit for the number of colors and color pairs which a terminal can support. -However, in its use of \fBshort\fP for the parameters, +However, +in its use of +.I short +for the parameters, it carries over SVr4's implementation detail for the compiled -terminfo database, which uses signed 16-bit numbers. -This implementation provides extended versions of those functions -which use \fBshort\fP parameters, -allowing applications to use larger color- and pair-numbers. +.I \%term\%info +database, +which uses signed 16-bit numbers. +.I \%ncurses +provides extended versions of the functions using +.I short +parameters, +allowing applications to use larger color and pair identifiers. .PP -The \fB\%reset_color_pairs\fP function is an extension of -\fI\%ncurses\fP. +SVr4 +.I curses +returns +.I ERR +from +.I \%pair_content +if its +.I pair +argument +was not initialized using +.IR \%init_pairs , +and from +.I \%color_content +if the terminal does not support changing colors. +.I \%ncurses +does neither. .SH HISTORY -SVr3.2 introduced color support to curses in 1987. -.PP -SVr4 made internal changes, -e.g., moving the storage for the color state -from \fBSP\fP (the \fISCREEN\fP structure) -to \fB\%cur_term\fP (the \fI\%TERMINAL\fP structure), -but provided the same set of library functions. -.PP -SVr4 curses limits the number of color pairs to 64, -reserving color pair zero (0) as the terminal's initial uncolored state. -This limit arises because the color pair information is a bitfield -in the \fB\%chtype\fP data type (denoted by \fB\%A_COLOR\fP). -.PP -Other implementations of curses had different limits: +SVr3.2 (1987) introduced color support to +.I curses +with all of the symbols +in the synopsis above except those marked as extensions. +It reserved color pair 0 as the terminal's initial, +\*(``uncolored\*('' state, +.\" "we assume that color 0 is always a default background.", SVr3.2 +.\" usr/src/lib/libcurses/screen/start_col.c +and limited the number of possible color pairs to 64, +because the color pair datum was encoded in six bits of a +.IR \%chtype "." +.PP +SVr4 made only internal changes, +such as moving the storage of color state +from the +.I SCREEN +structure +(pointed to by +.IR SP ) +to the +.I \%TERMINAL +structure +(pointed to by +.IR \%cur_term ")." +.PP +Other +.I curses +implementations impose different limits on the number of colors and +color pairs. .bP -PCCurses (1987-1990) provided for only eight (8) colors. +.I \%PCCurses +(1987-1990) provided for only 8 colors +(and therefore required at most 8\(mu8 = 64 color pairs). .bP -PDCurses (1992-present) inherited the 8-color limitation from PCCurses, +.I \%PDCurses +(1992-present) inherited the 8-color limitation from +.IR \%PCCurses , but changed this to 256 in version 2.5 (2001), -along with changing \fB\%chtype\fP from 16-bits to 32-bits. +and widened its +.I \%chtype +from 16 to 32 bits. .bP X/Open Curses (1992-present) -added a new structure \fB\%cchar_t\fP to store the character, -attributes and color pair values, allowing increased range of color pairs. -Both color pairs and color-values used a signed \fBshort\fP, -limiting values to 15 bits. +specified a new structure type, +.IR \%cchar_t "," +to store the character code, +attribute flags, +and color pair identifier, +allowing an increased range of color pairs. +It specifies a +.I short +as storing identifiers for colors and color pairs, +limiting portable values to 15 bits; +negative values are invalid in System\ V. .bP -\fI\%ncurses\fP (1992-present) uses eight bits -for \fB\%A_COLOR\fP in \fB\%chtype\fP values. +.I \%ncurses +(1992-present), +in its non-wide-character configuration, +uses 8 bits of +.I \%chtype +for the color pair identifier. .IP -Version 5.3 provided a wide-character interface (2002), -but left color pairs as part of the attributes-field. +Version 5.3 (2002) offered a wide-character interface, +but encoded the color pair identifier with attributes +in the character type. .IP Since version 6 (2015), -ncurses uses a separate \fBint\fP for color pairs in the \fB\%cchar_t\fP values. -When those color pair values fit in 8 bits, -ncurses allows color pairs to be manipulated -via the functions using \fB\%chtype\fP values. -.bP -NetBSD curses used 6 bits from -2000 (when colors were first supported) until 2004. -At that point, NetBSD changed to use 10 bits. -As of 2021, that size is unchanged. -Like \fI\%ncurses\fP before version 6, -the NetBSD color pair information is stored in -the attributes field of \fB\%cchar_t\fP, limiting the number of color pairs -by the size of the bitfield. +.I \%ncurses +uses a separate +.I int +for the color pair identifier in a +.IR \%cchar_t "," +introducing extension functions to manage the wider type. +When a color pair value fits in 8 bits, +.I \%ncurses +permits color pair data to be manipulated +via the functions taking +.I \%chtype +arguments, +even when a +.I curses +window uses wide-character cells. +.bP +NetBSD +.I curses +used 6 bits for the color pair identifier from 2000 +(when it first added color support) +until 2004. +At that point, +NetBSD widened the color pair identifier to use 9 bits. +As of 2025, +that size is unchanged. +.\" http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libcurses/curses.h?rev=1.133 +.\" indicates a mask of 0x03fe0000. +Like +.I \%ncurses +before version 6, +the NetBSD color pair datum is stored in +the attributes field of +.IR \%cchar_t "," +limiting the number of color pairs. .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_attr\fP(3X), diff --git a/contrib/ncurses/man/curs_delch.3x b/contrib/ncurses/man/curs_delch.3x --- a/contrib/ncurses/man/curs_delch.3x +++ b/contrib/ncurses/man/curs_delch.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2006,2010 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_delch.3x,v 1.34 2024/04/20 19:24:14 tom Exp $ -.TH curs_delch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_delch.3x,v 1.49 2025/04/05 21:59:53 tom Exp $ +.TH curs_delch 3X 2025-04-05 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -39,6 +39,11 @@ .ie t .ds '' '' .el .ds '' "" .\} +. +.de bP +.ie n .IP \(bu 4 +.el .IP \(bu 2 +.. .SH NAME \fB\%delch\fP, \fB\%wdelch\fP, @@ -50,27 +55,25 @@ \fB#include .PP \fBint delch(void); -\fBint wdelch(WINDOW *\fIwin\fP); +\fBint wdelch(WINDOW * \fIwin\fP); \fBint mvdelch(int \fIy\fP, int \fIx\fP); -\fBint mvwdelch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP); +\fBint mvwdelch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP); .fi .SH DESCRIPTION .B \%wdelch deletes the character at the cursor position in .IR win . -\fB\%ncurses\fP(3X) describes the variants of this function. -.PP -.B \%wdelch -moves all characters to the right of the cursor on the same line to the -left one position and replaces the contents of the rightmost position on -the line with the window's blank character; +It moves all characters to the right of the cursor on the same line to +the left one position and replaces the contents of the rightmost +position on the line with the window's background character; see \fB\%bkgd\fP(3X) -(wide-character API users may consult \fB\%bkgrnd\fP(3X) instead). +(wide-character API users: \fB\%bkgrnd\fP(3X)). The cursor position does not change (after moving to .RI ( y , .IR x ), if specified). +\fB\%ncurses\fP(3X) describes the variants of this function. .SH RETURN VALUE These functions return .B OK @@ -78,10 +81,20 @@ .B ERR on failure. .PP -Functions taking a +In +.IR \%ncurses , +these functions fail if +.bP +the +.I curses +screen has not been initialized, +or +.bP +(for functions taking a .I \%WINDOW -pointer argument fail if the pointer is -.BR NULL . +pointer argument) +.I win +is a null pointer. .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -101,13 +114,14 @@ capability is not necessarily employed. .SH PORTABILITY -X/Open Curses, -Issue 4 describes these functions. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. .PP -SVr4 -.I curses -describes a successful return value only as +SVr4 describes a successful return value only as \*(``an integer value other than -.BR ERR \*(''. +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 489 +.SH HISTORY +SVr2 (1984) introduced +.IR \%wdelch "." .SH SEE ALSO \fB\%curses\fP(3X) diff --git a/contrib/ncurses/man/curs_deleteln.3x b/contrib/ncurses/man/curs_deleteln.3x --- a/contrib/ncurses/man/curs_deleteln.3x +++ b/contrib/ncurses/man/curs_deleteln.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2007,2010 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_deleteln.3x,v 1.38 2024/04/20 21:20:07 tom Exp $ -.TH curs_deleteln 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_deleteln.3x,v 1.55 2025/07/05 12:46:36 tom Exp $ +.TH curs_deleteln 3X 2025-07-05 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -43,62 +43,106 @@ .SH NAME \fB\%deleteln\fP, \fB\%wdeleteln\fP, -\fB\%insdelln\fP, -\fB\%winsdelln\fP, \fB\%insertln\fP, -\fB\%winsertln\fP \- +\fB\%winsertln\fP, +\fB\%insdelln\fP, +\fB\%winsdelln\fP \- delete or insert lines in a \fIcurses\fR window .SH SYNOPSIS .nf \fB#include .PP \fBint deleteln(void); -\fBint wdeleteln(WINDOW *\fIwin\fP); -.PP -\fBint insdelln(int \fIn\fP); -\fBint winsdelln(WINDOW *\fIwin\fP, int \fIn\fP); +\fBint wdeleteln(WINDOW * \fIwin\fP); .PP \fBint insertln(void); -\fBint winsertln(WINDOW *\fIwin\fP); +\fBint winsertln(WINDOW * \fIwin\fP); +.PP +\fBint insdelln(int \fIn\fP); +\fBint winsdelln(WINDOW * \fIwin\fP, int \fIn\fP); .fi .SH DESCRIPTION -The \fBdeleteln\fP and \fBwdeleteln\fP routines delete the line under the -cursor in the window; all lines below the current line are moved up one line. -The bottom line of the window is cleared. +.B \%wdeleteln +deletes the line at the cursor in +.IR win ; +all lines below it move up one line. +.I curses +then fills the bottom line of +.I win +with the background character +configured by \fB\%wbkgdset\fP(3X) +(wide-character API users: \fB\%wbkgrndset\fP(3X)). The cursor position does not change. .PP -The \fBinsdelln\fP and \fBwinsdelln\fP routines, for positive \fIn\fP, insert -\fIn\fP lines into the specified window above the current line. -The \fIn\fP -bottom lines are lost. -For negative \fIn\fP, delete \fIn\fP lines (starting -with the one under the cursor), and move the remaining lines up. -The bottom -\fIn\fP lines are cleared. -The current cursor position remains the same. +.B \%winsertln +inserts a new, empty line of characters above the line at the cursor in +.IR win , +shifting the existing lines down by one. +The content of the window's bottom line is lost; +.I curses +fills the new line with the background character. +The cursor position does not change. .PP -The \fBinsertln\fP and \fBwinsertln\fP routines insert a blank line above the -current line and the bottom line is lost. +.B \%winsdelln +inserts or deletes +.IR n\ lines +in +.I win +as +.I n +is positive or negative, +respectively, +as if by repeatedly calling +.B \%winsertln +or +.BR \%wdeleteln "." +.BR \%winsdelln( ".\|.\|." ", 0)" +performs no operation. .SH RETURN VALUE -These routines return the integer \fBERR\fP upon failure and an \fBOK\fP -(SVr4 specifies only -\*(``an integer value other than \fBERR\fP\*('') -upon successful completion. +These functions return +.B OK +on success and +.B ERR +on failure. .PP -X/Open defines no error conditions. -In this implementation, -if the window parameter is null, an error is returned. +In +.IR \%ncurses "," +they fail if +.I win +is +.IR NULL "." .SH NOTES -Note that all but \fBwinsdelln\fP may be macros. +All of these functions except +.B \%winsdelln +may be implemented as macros. .PP -These routines do not require a hardware line delete or insert feature in the -terminal. -In fact, they will not use hardware line delete/insert unless -\fBidlok(..., TRUE)\fP has been set on the current window. +These functions do not require the terminal +to possess hardware line deletion or insertion capabilities. +Even if available, +by default +.I curses +does not use them; +see \fB\%idlok\fP(3X). .SH PORTABILITY -These functions are described in X/Open Curses, Issue 4. -The -standard specifies that they return \fBERR\fP on failure, but specifies no -error conditions. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.PP +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 490 +.SH HISTORY +4BSD (1980) +introduced +.IR \%deleteln "," +.IR \%wdeleteln "," +.IR \%insertln "," +and +.IR \%winsertln "." +.PP +SVr3.1 (1987) +added +.I \%insdelln +and +.IR \%winsdelln "." .SH SEE ALSO \fB\%curses\fP(3X) diff --git a/contrib/ncurses/man/curs_extend.3x b/contrib/ncurses/man/curs_extend.3x --- a/contrib/ncurses/man/curs_extend.3x +++ b/contrib/ncurses/man/curs_extend.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1999-2010,2016 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -29,8 +29,8 @@ .\" .\" Author: Thomas E. Dickey 1999-on .\" -.\" $Id: curs_extend.3x,v 1.46 2024/03/16 15:35:01 tom Exp $ -.TH curs_extend 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_extend.3x,v 1.67 2025/11/12 00:46:51 tom Exp $ +.TH curs_extend 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -44,59 +44,89 @@ .SH NAME \fB\%curses_version\fP, \fB\%use_extended_names\fP \- -miscellaneous \fIcurses\fR extensions +miscellaneous \fIncurses\fR extensions .SH SYNOPSIS .nf \fB#include .PP \fBconst char * curses_version(void); -\fBint use_extended_names(bool \fIenable\fP); +\fBint use_extended_names(bool \fIbf\fP); .fi .SH DESCRIPTION -These functions are extensions to the curses library -which do not fit easily into other categories. +These +.I \%ncurses +extensions to the +.I curses +library do not fit easily into other functional categories. .SS curses_version -Use \fBcurses_version\fP -to get the version number, including patch level of the library, -prefixed by \*(``ncurses\*('', e.g., -.RS -.sp -.B ncurses 5.0.19991023 -.RE +.B \%curses_version +returns a pointer to a string containing the library's name +and version number, +including its patch level, +for example +\*(``ncurses 6.5.20240720\*(''. .SS use_extended_names -The \fBuse_extended_names\fP -function controls whether the calling application -is able to use user-defined or nonstandard names -which may be compiled into the terminfo -description, i.e., via the terminfo or termcap interfaces. -Normally these names are available for use, since the essential decision -is made by using the \fB\-x\fP option of \fB@TIC@\fP to compile -extended terminal definitions. -However you can disable this feature -to ensure compatibility with other implementations of curses. +.B \%use_extended_names +configures whether the library recognizes +user-defined or nonstandard +.I \%term\%info +capability names that may be compiled into terminal type descriptions +via the \fB\%curs_terminfo\fP(3X) or \fB\%curs_termcap\fP(3X) interfaces. +Normally these names are available for use, +since the essential decision +is made through use of \fB\%@TIC@\fP(1)'s +.B \-x +option to include such extensions in terminal type descriptions. +.B \%use_extended_names(FALSE) +prevents +.I \%ncurses +from recognizing these capabilities +to ensure compatibility with other implementations of +.IR curses . .SH RETURN VALUE -\fBcurses_version\fP returns a pointer to static memory; you should not free -this in your application. +.B \%curses_version +returns a constant string. .PP -\fBuse_extended_names\fP returns the previous state, allowing you to -save this and restore it. +.B \%use_extended_names +returns the previous state of extended capability name recognition, +allowing you to save this property and restore it. +.SH NOTES +The pointer returned by +.B \%curses_version +corresponds to statically allocated memory; +do not attempt to \fIfree\fP(3) it. .SH EXTENSIONS -These functions are \fB\%ncurses\fP(3X) extensions, +These functions are +.I \%ncurses +extensions, and are not found in SVr4 .IR curses , 4.4BSD .IR curses , -or any other previous curses implementation. +or any other previous +.I curses +implementation. .SH PORTABILITY Applications employing .I \%ncurses extensions should condition their use on the visibility of the .B \%NCURSES_VERSION preprocessor macro. +.PP +NetBSD 9 added a +.I \%curses_version +function +that intentionally returns a string devoid of version information. +.\" See https://mail-index.netbsd.org/tech-userlevel/2019/08/27/\ +.\" msg012068.html and follow-up messages. .SH AUTHORS -Thomas Dickey. +Thomas Dickey .SH SEE ALSO +.I \%ncurses +offers several other extensions to the X/Open Curses API. +.PP \fB\%curs_getch\fP(3X), +\fB\%curs_inopts\fP(3X), \fB\%curs_mouse\fP(3X), \fB\%curs_print\fP(3X), \fB\%curs_util\fP(3X), @@ -104,5 +134,6 @@ \fB\%define_key\fP(3X), \fB\%keybound\fP(3X), \fB\%keyok\fP(3X), +\fB\%new_pair\fP(3X), \fB\%resizeterm\fP(3X), \fB\%wresize\fP(3X) diff --git a/contrib/ncurses/man/curs_get_wch.3x b/contrib/ncurses/man/curs_get_wch.3x --- a/contrib/ncurses/man/curs_get_wch.3x +++ b/contrib/ncurses/man/curs_get_wch.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2002-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_get_wch.3x,v 1.40 2024/04/20 19:23:03 tom Exp $ -.TH curs_get_wch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_get_wch.3x,v 1.71 2025/08/16 19:11:47 tom Exp $ +.TH curs_get_wch 3X 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -50,27 +50,25 @@ \fB\%mvget_wch\fP, \fB\%mvwget_wch\fP, \fB\%unget_wch\fP \- -get (or push back) a wide character from \fIcurses\fR terminal keyboard +get (or push back) a wide character from \fIcurses\fR terminal keyboard buffer .SH SYNOPSIS .nf \fB#include .PP -\fBint get_wch(wint_t *\fIwch\fP); -\fBint wget_wch(WINDOW *\fIwin\fP, wint_t *\fIwch\fP); -\fBint mvget_wch(int \fIy\fP, int \fIx\fP, wint_t *\fIwch\fP); -\fBint mvwget_wch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, wint_t *\fIwch\fP); +\fBint get_wch(wint_t * \fIwch\fP); +\fBint wget_wch(WINDOW * \fIwin\fP, wint_t * \fIwch\fP); +\fBint mvget_wch(int \fIy\fP, int \fIx\fP, wint_t * \fIwch\fP); +\fBint mvwget_wch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, wint_t * \fIwch\fP); .PP \fBint unget_wch(const wchar_t \fIwc\fP); .fi .SH DESCRIPTION .SS "Reading Characters" .B \%wget_wch -gathers a key stroke -.I wch -from the terminal keyboard associated with a +gathers a key event from the terminal keyboard associated with a .I curses window -.IR win , +.IR win "," returning .B OK if a wide character is read, @@ -84,48 +82,55 @@ When input is pending, .B \%wget_wch stores an integer -identifying the key stroke in -.IR wch ; +identifying the key event in +.IR wch ";" for alphanumeric and punctuation keys, this value corresponds to the character encoding used by the terminal. -Use of the control key as a modifier often results in a distinct code. +Use of the control key as a modifier, +by holding it down while pressing and releasing another key, +often results in a distinct code. The behavior of other keys depends on whether .I win is in keypad mode; -see subsections \*(``Keypad Mode\*('' and \*(``Predefined Key Codes\*('' +see subsections \*(``Keypad Mode\*('' and \*(``Key Codes\*('' in \fB\%getch\fP(3X). .PP If no input is pending, then if the no-delay flag is set in the window (see \fB\%nodelay\fP(3X)), the function returns -.BR ERR ; +.BR ERR ";" otherwise, .I curses waits until the terminal has input. -If \fB\%cbreak\fP(3X) +If \fB\%cbreak\fP(3X) or \fB\%raw\fP(3X) has been called, this happens after one character is read. -If \fB\%nocbreak\fP(3X) +If \fB\%nocbreak\fP(3X) or \fB\%noraw\fP(3X) has been called, it occurs when the next newline is read. +(Because the terminal's canonical or \*(``cooked\*('' mode +is line-buffered, +multiple +.B \%wget_wch +calls may then be necessary to empty the input queue.) If \fB\%halfdelay\fP(3X) has been called, .I curses -waits until a character is typed or the specified delay elapses. +waits until input is available or the specified delay elapses. .PP If \fB\%echo\fP(3X) has been called, and the window is not a pad, .I curses -writes -.I wch +writes the wide character +from the input queue to the window (at the cursor position) per the following rules. .bP -If -.I wch -matches the terminal's erase character, +If the wide character +matches the terminal's erase character +(see \fB\%erasewchar\fP(3X)), the cursor moves leftward one position and the new position is erased as if \fB\%wmove\fP(3X) and then \fB\%wdelch\fP(3X) were called. @@ -138,62 +143,73 @@ .bP .I curses writes any other -.I wch +wide character to the window, as with \fB\%wecho_wchar\fP(3X). .bP -If the window has been moved or modified since the last call to +If the window +.I win +has been moved or modified since the last call to \fB\%wrefresh\fP(3X), .I curses calls -.BR \%wrefresh . +.B \%wrefresh +on it. .PP -If -.I wch +If the wide character is a carriage return and \fBnl\fP(3X) has been called, -.B \%wgetch -stores the the character code for newline -(line feed) -in +.B \%wget_wch +stores the wide character code for line feed in .I wch instead. .SS "Ungetting Characters" .B \%unget_wch places -.I wch -into the input queue to be returned by the next call to -.BR \%wget_wch . -A single input queue serves all windows. +.I wc +into the input queue to be retrieved by the next call to +.BR \%wget_wch "." +A single input queue serves all windows associated with the screen. .SH RETURN VALUE .B \%wget_wch returns .B OK -when it reads a wide character and +when it reads a wide character, .B \%KEY_CODE_YES -when it reads a function key code. -It returns +when it reads a function key code, +and .B ERR -if +on failure. +.B \%wget_wch +fails if +its timeout expires without any data arriving, +which cannot happen if \fB\%nodelay\fP(3X) is in effect on the window. +.PP +In +.IR \%ncurses , +.B \%wget_wch +also fails if .bP the -.I \%WINDOW -pointer is -.BR NULL , -or +.I curses +screen has not been initialized, .bP -its timeout expires without any data arriving, +(for functions taking a +.I \%WINDOW +pointer argument) +.I win +is a null pointer, or .bP execution was interrupted by a signal, in which case -.B \%errno +.I \%errno is set to -.BR \%EINTR . +.IR \%EINTR "." .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position .RI ( y , -.IR x ) +.IR x ")" is outside the window boundaries. .PP .B \%unget_wch @@ -201,7 +217,18 @@ .B OK on success and .B ERR -if there is no more room in the input queue. +on failure. +In +.IR \%ncurses , +.B \%unget_wch +fails if +.bP +the +.I curses +screen has not been initialized, +or +.bP +there is no more room in the input queue. .SH NOTES See the \*(``NOTES\*('' section of \fB\%wgetch\fP(3X). .PP @@ -213,23 +240,21 @@ .PP Unlike \fB\%wgetch\fP(3X), .B \%wget_wch -and its variants store the value of the input character in an additional +stores the value of the input character in an additional .I wch parameter instead of the return value. .PP Unlike -.BR \%ungetch , +.BR \%ungetch "," .B \%unget_wch -cannot distinguish function key codes -.B \%wget_wch -from conventional character codes. +cannot distinguish function key codes from conventional character codes. An application can overcome this limitation by pushing function key codes with .B \%ungetch and subsequently checking the return value of .B \%wget_wch for a match with -.BR \%KEY_CODE_YES . +.BR \%KEY_CODE_YES "." .SH EXTENSIONS See the \*(``EXTENSIONS\*('' section of \fB\%wgetch\fP(3X). .SH PORTABILITY @@ -239,14 +264,44 @@ .B \%NCURSES_VERSION preprocessor macro. .PP -X/Open Curses, -Issue 4 describes these functions. +X/Open Curses Issue\ 4 describes these functions. It specifies no error conditions for them. .PP See the \*(``PORTABILITY\*('' section of \fB\%wgetch\fP(3X) regarding the interaction of -.B \%wget_wch +.I \%wget_wch with signal handlers. +.SH HISTORY +X/Open Curses Issue\ 4 (1995) initially specified these functions. +The System\ V Interface Definition Version\ 4 +of the same year +specified functions named +.I \%wgetwch +(with its variants) +.IR \%ungetwch "." +.\" SVID 4, vol 3., pp. 496-499 +These were later additions to +.RI SVr4. x , +not appearing in the first SVr4 (1989). +They differ from X/Open's later +.I \%wget_wch +and +.I \%unget_wch +in that +.I \%wgetwch +takes no +.I wch +argument, +but returns the (wide) key code as an +.I int +(with no provision for distinguishing a character code +from a function key code); +and +.I \%ungetwch +takes a +.RI non- const +.I int +argument. .SH SEE ALSO \fB\%curs_getch\fP(3X) describes comparable functions of the .I \%ncurses diff --git a/contrib/ncurses/man/curs_get_wstr.3x b/contrib/ncurses/man/curs_get_wstr.3x --- a/contrib/ncurses/man/curs_get_wstr.3x +++ b/contrib/ncurses/man/curs_get_wstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2002-2012,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,17 +27,19 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_get_wstr.3x,v 1.48 2024/04/20 19:18:18 tom Exp $ -.TH curs_get_wstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_get_wstr.3x,v 1.79 2025/10/21 00:08:50 tom Exp $ +.TH curs_get_wstr 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq +.ds ^ \(ha .\} .el \{\ .ie t .ds `` `` .el .ds `` "" .ie t .ds '' '' .el .ds '' "" +.ds ^ ^ .\} . .de bP @@ -53,99 +55,136 @@ \fB\%mvgetn_wstr\fP, \fB\%mvwget_wstr\fP, \fB\%mvwgetn_wstr\fP \- -get a wide-character string from a \fIcurses\fR terminal keyboard +read a wide-character string from a \fIcurses\fR terminal keyboard .SH SYNOPSIS .nf \fB#include .PP -\fBint get_wstr(wint_t *\fIwstr\fP); -\fBint getn_wstr(wint_t *\fIwstr\fP, int \fIn\fP); -\fBint wget_wstr(WINDOW *\fIwin\fP, wint_t *\fIwstr\fP); -\fBint wgetn_wstr(WINDOW *\fIwin\fP, wint_t *\fIwstr\fP, int \fIn\fP); +\fBint get_wstr(wint_t * \fIwstr\fP); +\fBint wget_wstr(WINDOW * \fIwin\fP, wint_t * \fIwstr\fP); +\fBint mvget_wstr(int \fIy\fP, int \fIx\fP, wint_t * \fIwstr\fP); +\fBint mvwget_wstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, wint_t * \fIwstr\fP); .PP -\fBint mvget_wstr(int \fIy\fP, int \fIx\fP, wint_t *\fIwstr\fP); -\fBint mvgetn_wstr(int \fIy\fP, int \fIx\fP, wint_t *\fIwstr\fP, int \fIn\fP); -\fBint mvwget_wstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, wint_t *\fIwstr\fP); -\fBint mvwgetn_wstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, wint_t *\fIwstr\fP, int \fIn\fP); +\fBint getn_wstr(wint_t * \fIwstr\fP, int \fIn\fP); +\fBint wgetn_wstr(WINDOW * \fIwin\fP, wint_t * \fIwstr\fP, int \fIn\fP); +\fBint mvgetn_wstr(int \fIy\fP, int \fIx\fP, wint_t * \fIwstr\fP, int \fIn\fP); +\fBint mvwgetn_wstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, wint_t * \fIwstr\fP, int \fIn\fP); .fi .SH DESCRIPTION +.B \%wget_wstr +populates a user-supplied wide-character string buffer +.I wstr +by repeatedly calling \fBwget_wch\fP(3X) +with the +.I win +argument +until a line feed or carriage return character is input. The function -\fBwgetn_wstr\fP -is equivalent to a series of calls to -\fBwget_wch\fP(3X) -until a newline or carriage return terminates the series: .bP -The terminating character is not included in the returned string. +does not copy the terminating character to +.IR wstr ";" .bP -An end-of-file condition is represented by \fBWEOF\fP, -as defined in \fB\fP. +populates +.I wstr +with +.I WEOF +(as defined in +.IR \%wchar.h ) +if an end-of-file condition occurs on the input; .bP -In all instances, the end of the string is terminated -by a null \fBwchar_t\fP. +always terminates the string with a null wide character +(after any +.IR WEOF ); .bP -The function stores the result in the area pointed to -by the \fIwstr\fP parameter. +interprets the screen's wide erase and wide kill characters +(see \fB\%erasewchar\fP(3X) and \fB\%killwchar\fP(3X)); .bP -The function reads at most \fIn\fP characters, -thus preventing a possible overflow of the input buffer. -.IP -Any attempt to enter more characters -(other than the terminating newline or carriage return) -causes a beep. -.IP -Function keys also cause a beep and are ignored. +recognizes function keys only if the screen's keypad option is enabled +(see \fB\%keypad\fP(3X)); +.bP +treats the function keys +.B \%KEY_LEFT +and +.B \%KEY_BACKSPACE +the same as the wide erase character; +and +.bP +discards function key inputs other than those +treated as the wide erase or wide kill characters, +calling \fBbeep\fP(3X). .PP -The user's \fIerase\fP and \fIkill\fP characters are interpreted: +The wide erase character replaces the character at the end of the buffer +with a null wide character, +while the wide kill character does the same for the entire buffer. +.PP +If the screen's echo option is enabled +(see \fBecho\fP(3X)), +.B \%wget_wstr +updates +.I win +with \fB\%wadd_wch\fP(3X). +Further, .bP -The \fIerase\fP character (e.g., \fB^H\fP) erases the character -at the end of the buffer, moving the cursor to the left. -.IP -If \fIkeypad\fP mode is on for the window, -\fBKEY_LEFT\fP and \fBKEY_BACKSPACE\fP -are both considered equivalent to the user's \fIerase\fP character. -.bP -The \fIkill\fP character (e.g., \fB^U\fP) erases the entire buffer, -leaving the cursor at the beginning of the buffer. -.PP -Characters input are echoed only if \fBecho\fP is currently on. -In that case, -backspace is echoed as deletion of the previous character -(typically a left motion). -.PP -The -\fBgetn_wstr\fP, -\fBmvgetn_wstr\fP, -\fBmvwgetn_wstr\fP, and -\fBwgetn_wstr\fP -functions are identical -to the -\fBget_wstr\fP, -\fBmvget_wstr\fP, -\fBmvwget_wstr\fP, and -\fBwget_wstr\fP -functions, respectively, -except that the -\fB*n_*\fP -versions read at most -\fIn\fP -characters, letting the application prevent overflow of the -input buffer. -.SH RETURN VALUE -All of these functions return the integer \fBOK\fP upon successful completion. -If unsuccessful, they return \fBERR\fP. +the wide erase character +and its function key synonyms +move the cursor to the left, +and +.bP +the wide kill character returns the cursor to where it was located when +.B \%wget_wstr +was called. +.PP +.B \%wgetn_wstr +is similar, +but reads at most +.I n +wide characters, +aiding the application to avoid overrunning the buffer to which +.I wstr +points. +.I curses +ignores an attempt to input more than +.I n +wide characters +(other than the terminating line feed or carriage return), +calling \fBbeep\fP(3X). +If +.I n +is negative, +.B \%wgetn_wstr +reads up to +.I LINE_MAX +wide characters +(see +.IR sysconf (3)). .PP -X/Open defines no error conditions. +\fB\%ncurses\fP(3X) describes the variants of these functions. +.SH RETURN VALUE +These functions return +.B OK +on success and +.B ERR +on failure. .PP -In this implementation, -these functions return an error +In +.IR \%ncurses "," +these functions fail if .bP -if the window pointer is null, +the +.I curses +screen has not been initialized, .bP -if its timeout expires without having any data, or +(for functions taking a +.I \%WINDOW +pointer argument) +.I win +is a null pointer, .bP -if the associated call to -\fBwget_wch\fP -failed. +.I wstr +is a null pointer, +or +.bP +an internal \fB\%wget_wch\fP(3X) call fails. .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -153,70 +192,206 @@ .IR x ) is outside the window boundaries. .SH NOTES -Any of these functions other than -\fBwgetn_wstr\fP -may be macros. -.PP -Using -\fBget_wstr\fP, -\fBmvget_wstr\fP, -\fBmvwget_wstr\fP, or -\fBwget_wstr\fP -to read a line that -overflows the array pointed to by -\fBwstr\fP -causes undefined -results. -The use of -\fBgetn_wstr\fP, -\fBmvgetn_wstr\fP, -\fBmvwgetn_wstr\fP, or -\fBwgetn_wstr\fP, -respectively, is recommended. -.PP -These functions cannot return \fBKEY_\fP values because there -is no way to distinguish a \fBKEY_\fP value from a valid \fBwchar_t\fP value. +All of these functions except +.B \%wgetn_wstr +may be implemented as macros. +.PP +Reading input that overruns the buffer pointed to by +.I wstr +causes undefined results. +Use the +.BR n -infixed +functions, +and allocate sufficient storage for +.I wstr +\(em at least +.IR n +1 +times +.BR sizeof(wchar_t) "." +.PP +These functions cannot store a +.B KEY_ +value in +.I wstr +because there is no way to distinguish it +from a valid +.I \%wchar_t +value. +.PP +While these functions conceptually implement +a series of calls to +.BR \%wget_wch "," +they also temporarily change properties of the +.I curses +screen to permit simple editing of the input buffer. +Each function saves the screen's state, +calls \fBnl\fP(3X), +and, +if the screen was in canonical (\*(``cooked\*('') mode, +\fB\%cbreak\fP(3X). +Before returning, +it restores the saved screen state. +Other implementations differ in detail, +affecting which control characters they can accept in the buffer; +see section \*(``PORTABILITY\*('' below. +.PP +Unlike \fBgetstr\fP(3X) and related functions of +.IR \%ncurses 's +non-wide API, +these functions do not return +.B \%KEY_RESIZE +if a +.I \%SIGWINCH +event interrupts the function. +.SH EXTENSIONS +.BR \%getn_wstr "," +.BR \%wgetn_wstr "," +.BR \%mvgetn_wstr "," +and +.BR \%mvwgetn_wstr "'s" +handing of negative +.I n +values is an +.I \%ncurses +extension. .SH PORTABILITY -These functions are described in The Single Unix Specification, Version 2. -No error conditions are defined. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. .PP -This implementation returns \fBERR\fP if the window pointer is null, -or if the lower-level \fBwget_wch\fP call returns an \fBERR\fP. -In the latter case, -an \fBERR\fP return without other data is treated as an end-of-file condition, -and the returned array contains a \fBWEOF\fP followed by a null \fBwchar_t\fP. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. .PP -X/Open curses documented these functions to pass an array of \fBwchar_t\fP -in 1997, but that was an error because of this part of the description: +Issue\ 4 documented these functions as passing an array of +.IR wchar_t "," +but that was an error, +conflicting with the following language in the standard. .RS .PP -The effect of \fBget_wstr\fP is as though a series of calls to -\fBget_wch\fP were made, until a newline character, end-of-line character, or -end-of-file character is processed. +The effect of +.IR \%get_wstr "()" +is as though a series of calls to +.IR \%get_wch "()" +were made, +until a newline character, +end-of-line character, +or end-of-file character is processed. +.\" X/Open Curses Issue 4, Version 2, p. 96. .RE .PP -The latter function \fIget_wch\fP can return a negative value, -while \fBwchar_t\fP is a unsigned type. -All of the vendors implement this using \fBwint_t\fP, following the standard. +.I \%get_wch +can return a negative value +.RI ( WEOF ), +but +.I \%wchar_t +is a unsigned type. +All of the vendors implement these functions using +.IR \%wint_t "," +following the Issue\ 7 standard. .PP -X/Open Curses, Issue 7 (2009) is unclear regarding whether -the terminating \fInull \fBwchar_t\fR -value is counted in the length parameter \fIn\fP. -X/Open Curses, Issue 7 revised the corresponding description -of \fBwgetnstr\fP to address this issue. -The unrevised description of \fBwget_nwstr\fP can be interpreted either way. -This implementation counts the terminator in the length. +X/Open Curses Issue\ 7 is unclear whether the terminating null wide character +counts toward the length parameter +.IR n "." +A similar issue affected +.I \%wgetnstr +in Issue\ 4, +Version\ 2; +Issue\ 7 revised that function's description to address the issue, +but not that of +.IR \%wget_nwstr "," +leaving it ambiguous. +.I \%ncurses +counts the terminator in the length. .PP -X/Open Curses does not specify what happens if the length \fIn\fP is negative. +X/Open Curses does not specify what happens if the length +.I n +is negative. .bP -For analogy with \fBwgetnstr\fP, -\fI\%ncurses\fP 6.2 uses a limit (based on \fBLINE_MAX\fP). +For consistency with +.IR \%wgetnstr "," +.I \%ncurses +6.2 uses a limit based on +.IR LINE_MAX "." .bP -Some other implementations (such as Solaris xcurses) do the same, -while others (PDCurses) do not allow this. +Some other implementations +(such as Solaris +.IR xcurses ) +do the same, +while others +.RI \%( PDCurses ) +do not permit a negative +.IR n "." .bP -NetBSD 7 curses imitates \fI\%ncurses\fP 6.1 in this regard, -treating a \fB\-1\fP as an indefinite number of characters. +NetBSD\ 7 +.I curses +imitates +.I \%ncurses +6.1 and earlier, +treating a negative +.I n +as an unbounded count of wide characters. +.PP +Implementations vary in their handling of input control characters. +.bP +While they may enable the screen's echo option, +some do not take it out of raw mode, +and may take cbreak mode into account +when deciding whether to handle echoing within +.I \%wgetn_wstr +or to rely on it as a side effect of calling +.IR \%wget_wch "." +.IP +Since 1995, +.I \%ncurses +has provided handlers for +.I SIGINTR +and +.I SIGQUIT +events, +which are typically generated at the keyboard with +.B \*^C +and +.B \*^\e +respectively. +In cbreak mode, +those handlers catch a signal and stop the program, +whereas other implementations write those characters into the buffer. +.bP +Starting with +.I \%ncurses +6.3 (2021), +.I \%wgetn_wstr +preserves raw mode if the screen was already in that state, +allowing one to enter the characters the terminal interprets +as interrupt and quit events +into the buffer, +for consistency with SVr4 +.IR curses 's +.IR \%wgetnstr . +.SH HISTORY +X/Open Curses Issue\ 4 (1995) initially specified these functions. +The System\ V Interface Definition Version\ 4 +of the same year +specified functions named +.I \%wgetwstr +and +.I \%wgetnwstr +(and the usual variants). +.\" SVID 4, vol 3., p. 500 +These were later additions to +.RI SVr4. x , +not appearing in the first SVr4 (1989). +Except in name, +their declarations did not differ from X/Open's later +.I \%wget_wstr +and +.I \%wgetn_wstr +until +X/Open Curses Issue 7 (2009) +eventually changed the type of the buffer argument to a pointer to +.IR \%wint_t "." .SH SEE ALSO \fB\%curs_getstr\fP(3X) describes comparable functions of the .I \%ncurses diff --git a/contrib/ncurses/man/curs_getcchar.3x b/contrib/ncurses/man/curs_getcchar.3x --- a/contrib/ncurses/man/curs_getcchar.3x +++ b/contrib/ncurses/man/curs_getcchar.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-2024,2025 Thomas E. Dickey * .\" Copyright 2001-2015,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,16 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_getcchar.3x,v 1.49 2024/04/20 18:55:09 tom Exp $ -.TH curs_getcchar 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_getcchar.3x,v 1.57 2025/02/23 13:48:31 tom Exp $ +.TH curs_getcchar 3X 2025-02-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.ie \n(.g \{\ +.ds ' \(aq +.\} +.el \{\ +.ie t .ds ' \(aq +.el .ds ' ' +.\} +. .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 @@ -41,146 +49,302 @@ .nf \fB#include .PP -\fBint getcchar( -.B " const cchar_t *\fIwch\fP," -.B " wchar_t *\fIwc\fP," -.B " attr_t *\fIattrs\fP," -.B " short *\fIcolor_pair\fP," -.B " void *\fIopts\fP );" -.PP -.B "int setcchar(" -.B " cchar_t *\fIwch\fP," -.B " const wchar_t *\fIwc\fP," -.B " const attr_t \fIattrs\fP," -.B " short \fIcolor_pair\fP," -.B " const void *\fIopts\fP );" +\fBint getcchar(const cchar_t * \fIwch\fP, wchar_t * \fIwc\fP, + attr_t * \fIattrs\fP, short * \fIpair\fP, void * \fIopts\fP); +\fBint setcchar(cchar_t * \fIwch\fP, const wchar_t * \fIwc\fP, + const attr_t \fIattrs\fP, short \fIpair\fP, const void * \fIopts\fP); .fi .SH DESCRIPTION +The +.I curses +complex character data type +.I \%cchar_t +is a structure type comprising +a wide-character string, +a set of attributes, +and +a color pair identifier. +The +.I \%cchar_t +structure is opaque; +do not attempt to access its members directly. +The library provides functions to manipulate this type. .SS getcchar -The \fBgetcchar\fP function gets a wide-character string -and rendition from a \fBcchar_t\fP argument. -When \fIwc\fP is not a null pointer, -the \fBgetcchar\fP function does the following: -.bP -Extracts information from a \fBcchar_t\fP value \fIwch\fP +.B \%getcchar +destructures a +.I \%cchar_t +into its components. +.PP +If +.I wc +is not a null pointer, +.BR \%getcchar : .bP -Stores the character attributes in the location pointed to by \fIattrs\fP +stores the wide-character string in the +.I curses +complex character +.I wch +into +.IR wc ; .bP -Stores the color pair in the location pointed to by \fIcolor_pair\fP +stores the attributes in +.IR attrs ; +and .bP -Stores the wide-character string, -characters referenced by \fIwch\fP, into the array pointed to by \fIwc\fP. +stores the color pair identifier in +.IR pair . .PP -When -\fIwc\fP -is a null pointer, the -\fBgetcchar\fP -function does the following: -.bP -Obtains the number of wide characters pointed to by \fIwch\fP -.bP -Does not change the data referenced by -\fIattrs\fP -or -\fIcolor_pair\fP +If +.I wc +is a null pointer, +.B \%getcchar +counts the +.I \%wchar_t +wide characters in +.IR wch , +returns that value, +and leaves +.I attrs +and +.I pair +unchanged. .SS setcchar -The \fBsetcchar\fP function initializes the location pointed to by \fIwch\fP -by using: -.bP -The character attributes in -\fIattrs\fP -.bP -The color pair in -\fIcolor_pair\fP -.bP -The wide-character string pointed to by \fIwc\fP. -The string must be L'\e0' terminated, -contain at most one spacing character, -which must be the first. -.IP -Up to \fBCCHARW_MAX\fP\-1 non-spacing characters may follow. -Additional non-spacing characters are ignored. -.IP +.B \%setcchar +constructs a +.I curses +complex character +.I wch +from the components +.IR wc , +.IR attrs , +and +.IR pair . +The wide-character string +.I wch +must be terminated with a null wide character +.B L\*'\e0\*' +and must contain at most one spacing character, +which, +if present, +must be the first wide character in the string. +.PP +Up to +.BR \%CCHARW_MAX\ \-\ 1 +non-spacing characters may follow +(see \fB\%curs_variables\fP(3X)). +.I \%ncurses +ignores any additional non-spacing characters. +.PP The string may contain a single control character instead. -In that case, no non-spacing characters are allowed. +In that case, +no non-spacing characters are allowed. .SH RETURN VALUE -When \fIwc\fP is a null pointer, -\fBgetcchar\fP returns the number of wide characters referenced by -\fIwch\fP, -including one for a trailing null. +If +.B \%getcchar +is passed a null pointer as its +.I wc +argument, +it returns the number of wide characters for a given +.I wch +that it would store in +.IR wc "," +counting a trailing null wide character. +If +.B \%getcchar +is not passed a null pointer as its +.I wc +argument, +it returns +.B OK +on success and +.B ERR +on failure. +.PP +In +.IR \%ncurses , +.B \%getcchar +returns +.B ERR +if either +.I attrs +or +.I pair +is a null pointer and +.I wc +is not. .PP -When \fIwc\fP is not a null pointer, -\fBgetcchar\fP returns \fBOK\fP upon successful completion, -and \fBERR\fP otherwise. +.B \%setcchar +returns +.B OK +on success and +.B ERR +on failure. .PP -Upon successful completion, \fBsetcchar\fP returns \fBOK\fP. -Otherwise, it returns \fBERR\fP. +In +.IR \%ncurses , +.B \%setcchar +returns +.B ERR +if +.bP +.I wch +is a null pointer, +.bP +.I wc +starts with a (wide) control character +and contains any other wide characters, +or +.bP +.I pair +has a negative value. .SH NOTES -The \fIwch\fP argument may be a value generated by a call to -\fBsetcchar\fP or by a function that has a \fBcchar_t\fP output argument. -If \fIwch\fP is constructed by any other means, the effect is unspecified. +.I wch +may be a value stored by +.B \%setcchar +or another +.I curses +function with a writable +.I \%cchar_t +argument. +If +.I wch +is constructed by any other means, +the library's behavior is unspecified. .SH EXTENSIONS -X/Open Curses documents the \fIopts\fP argument as reserved for future use, -saying that it must be null. -This implementation -uses that parameter in ABI 6 for the functions which have a color pair -parameter to support extended color pairs: +X/Open Curses documents the +.I opts +argument as reserved for future use, +saying that it must be a null pointer. +The +.IR \%ncurses \ 6 +ABI uses it with functions that have a color pair parameter +to support extended color pairs. .bP -For functions which modify the color, e.g., \fBsetcchar\fP, -if \fIopts\fP is set it is treated as a pointer to \fBint\fP, -and used to set the color pair instead of the \fBshort\fP pair parameter. +In functions that assign colors, +such as +.BR \%setcchar "," +if +.I opts +is not a null pointer, +.I \%ncurses +treats it as a pointer to +.IR int "," +and interprets it instead of the +.I short +.I pair +parameter as a color pair identifier. .bP -For functions which retrieve the color, e.g., \fBgetcchar\fP, -if \fIopts\fP is set it is treated as a pointer to \fBint\fP, -and used to retrieve the color pair as an \fBint\fP value, -in addition retrieving it via the standard pointer to \fBshort\fP parameter. +In functions that retrieve colors, +such as +.BR \%getcchar "," +if +.I opts +is not a null pointer, +.I \%ncurses +treats it as a pointer to +.IR int "," +and stores the retrieved color pair identifier there +as well as in the +.I short +.I pair +parameter +(which may therefore undergo a narrowing conversion). .SH PORTABILITY -The \fBCCHARW_MAX\fP symbol is specific to \fI\%ncurses\fP. -X/Open Curses does not provide details for the layout of the \fBcchar_t\fP -structure. -It tells what data are stored in it: +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. +.PP +These functions are described in X/Open Curses Issue\ 4. +It specifies no error conditions for them. +.PP +X/Open Curses does not detail the layout of the +.I \%cchar_t +structure, +describing only its minimal required contents: .bP -a spacing character (\fBwchar_t\fP, i.e., 32-bits). +a spacing wide character +.RI \%( wchar_t ), .bP -non-spacing characters (again, \fBwchar_t\fP's). +at least five non-spacing wide characters +.RI \%( wchar_t ; +see below), .bP -attributes (at least 16 bits, inferred from the various ACS- and WACS-flags). +attributes +(at least 15 bits' worth, +inferred from the count of specified +.I WA_ +constants), +.\" See X/Open Curses Issue 7, p. 307. .bP -color pair (at least 16 bits, inferred from the \fBunsigned short\fP type). +a color pair identifier +(at least 16 bits, +inferred from the +.I short +type used to encode it). .PP -The non-spacing characters are optional, -in the sense that zero or more may be stored in a \fBcchar_t\fP. +Non-spacing characters are optional, +in the sense that zero or more may be stored in a +.IR \%cchar_t "." XOpen/Curses specifies a limit: .RS 4 .PP -Implementations may limit the number of non-spacing characters that can be -associated with a spacing character, provided any limit is at least 5. +Implementations may limit the number of non-spacing characters that can +be associated with a spacing character, +provided any limit is at least 5. .RE .PP -The Unix implementations at the time follow that limit: +Then-contemporary Unix implementations adhered to that limit. .bP -AIX\ 4 and OSF1\ 4 use the same declaration with an array of 5 non-spacing -characters \fIz\fP and a single spacing character \fIc\fP. +AIX\ 4 and OSF/1\ 4 used the same declaration with +a single spacing wide character +.I c +and an array of 5 non-spacing wide characters +.IR z "." .bP -HP-UX\ 10 uses an opaque structure with 28 bytes, -which is large enough for the 6 \fBwchar_t\fP values. +HP-UX\ 10 used an opaque structure of 28 bytes, +large enough for 6 +.I \%wchar_t +values. .bP -Solaris \fIxpg4\fP curses uses a single array of 6 \fBwchar_t\fP values. +Solaris +.I xcurses +uses a single array of 6 +.I \%wchar_t +values. .PP -This implementation's \fBcchar_t\fP was defined in 1995 -using \fB5\fP for the total of spacing and non-spacing characters -(\fBCCHARW_MAX\fP). +.I \%ncurses +defined its +.I \%cchar_t +in 1995 using 5 as the +.I total +of spacing and non-spacing characters +.RB \%( CCHARW_MAX ). That was probably due to a misreading of the AIX\ 4 header files, -because the X/Open Curses document was not generally available at that time. -Later (in 2002), this detail was overlooked when beginning to implement -the functions using the structure. +because the X/Open Curses document +was not generally available at that time. +Later (in 2002), +this detail was overlooked when work began to implement the functions +using the structure. .PP -In practice, even four non-spacing characters may seem enough. -X/Open Curses documents possible uses for non-spacing characters, -including using them for ligatures between characters -(a feature apparently not supported by any curses implementation). -Unicode does not limit the (analogous) number of combining characters, -so some applications may be affected. +In practice, +a mere four non-spacing characters may seem adequate. +X/Open Curses documents possible applications of non-spacing characters, +including their use as ligatures +(a feature apparently not supported by any +.I curses +implementation). +Unicode does not limit the (analogous) number of combining characters +in a grapheme cluster; +some applications may be affected. +.I \%ncurses +can be compiled with a different +.B CCHARW_MAX +value; +doing so alters the library's ABI. +.SH HISTORY +X/Open Curses Issue\ 4 (1995) initially specified these functions. .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_attr\fP(3X), diff --git a/contrib/ncurses/man/curs_getch.3x b/contrib/ncurses/man/curs_getch.3x --- a/contrib/ncurses/man/curs_getch.3x +++ b/contrib/ncurses/man/curs_getch.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_getch.3x,v 1.87 2024/04/20 19:18:18 tom Exp $ -.TH curs_getch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_getch.3x,v 1.134 2025/11/12 01:06:36 tom Exp $ +.TH curs_getch 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -57,15 +57,15 @@ \fB\%mvwgetch\fP, \fB\%ungetch\fP, \fB\%has_key\fP \- -get (or push back) characters from \fIcurses\fR terminal keyboard +get (or push back) characters from \fIcurses\fR terminal keyboard buffer .SH SYNOPSIS .nf .B #include .PP .B int getch(void); -.B int wgetch(WINDOW *\fIwin\fP); +.B int wgetch(WINDOW * \fIwin\fP); .B int mvgetch(int \fIy\fP, int \fIx\fP); -.B int mvwgetch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP); +.B int mvwgetch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP); .PP .B int ungetch(int \fIc\fP); .PP @@ -76,18 +76,25 @@ .SH DESCRIPTION .SS "Reading Characters" .B \%wgetch -gathers a key stroke from the terminal keyboard associated with a +gathers a key event from the terminal keyboard associated with a .I curses window -.IR win . +.IR win "." \fB\%ncurses\fP(3X) describes the variants of this function. .PP When input is pending, .B \%wgetch -returns an integer identifying the key stroke; +returns an integer identifying the key event; for alphanumeric and punctuation keys, +the space bar, +and (usually) the Backspace, +Tab, +Return, +and Escape keys, this value corresponds to the character encoding used by the terminal. -Use of the control key as a modifier often results in a distinct code. +Use of the control key as a modifier, +by holding it down while pressing and releasing another key, +often results in a distinct code. The behavior of other keys depends on whether .I win is in keypad mode; @@ -97,20 +104,29 @@ then if the no-delay flag is set in the window (see \fB\%nodelay\fP(3X)), the function returns -.BR ERR ; +.BR ERR ";" otherwise, .I curses waits until the terminal has input. -If \fB\%cbreak\fP(3X) +If \fB\%cbreak\fP(3X) or \fB\%raw\fP(3X) has been called, -this happens after one character is read. -If \fB\%nocbreak\fP(3X) +this happens after +.I curses +reads one key event. +If \fB\%nocbreak\fP(3X) or \fB\%noraw\fP(3X) has been called, -it occurs when the next newline is read. +it occurs when +.I curses +reads a newline. \" "newline" because canonical mode normalizes NL/CR +(Because the terminal's canonical or \*(``cooked\*('' mode +is line-buffered, +multiple +.B \%wgetch +calls may then be necessary to empty the input queue.) If \fB\%halfdelay\fP(3X) has been called, .I curses -waits until a character is typed or the specified delay elapses. +waits until input is available or the specified delay elapses. .PP If \fB\%echo\fP(3X) has been called, and the window is not a pad, @@ -123,7 +139,9 @@ .bP If .I c -matches the terminal's erase character, +matches the terminal's erase character +(see \fB\%erasechar\fP(3X)), +and the cursor is not at the window's leftmost column, the cursor moves leftward one position and the new position is erased as if \fB\%wmove\fP(3X) and then \fB\%wdelch\fP(3X) were called. @@ -140,11 +158,14 @@ to the window, as with \fB\%wechochar\fP(3X). .bP -If the window has been moved or modified since the last call to +If the window +.I win +has been moved or modified since the last call to \fB\%wrefresh\fP(3X), .I curses calls -.BR \%wrefresh . +.B \%wrefresh +on it. .PP If .I c @@ -152,48 +173,52 @@ .B \%wgetch returns the character code for line feed instead. .SS "Keypad Mode" -To -.IR curses , -key strokes not from the alphabetic section of the keyboard -(those corresponding to the ECMA-6 character set\(emsee -\fIascii\fP(7)\(emoptionally modified by either the control or shift -keys) -are treated as +Call \fB\%keypad\fP(3X) on a window to configure keypad mode +when reading input from it. +In +.IR "keypad mode" "," +.I curses +treats key strokes not from the alphabetic section of the keyboard +(those corresponding to the ECMA-6 character set \(em +see \fI\%ascii\fP(7) \(em +optionally modified by either the control or shift keys) +as .I function keys. (In -.IR curses , +.IR curses "," the term \*(``function key\*('' includes but is not limited to keycaps engraved with \*(``F1\*('', \*(``PF1\*('', and so on.) -If the window is in keypad mode, -these produce a numeric code corresponding to the +If a window is in keypad mode, +.B \%wgetch +translates these key strokes to a numeric code corresponding to the .B KEY_ -symbols listed in subsection \*(``Predefined Key Codes\*('' below; -otherwise, -they transmit a sequence of codes typically starting with the escape -character, -and which must be collected with multiple +symbols listed in subsection \*(``Key Codes\*('' below. +If the window is not in keypad mode, +the input queue populates with +the characters of the function key's escape sequence, +which the application must collect individually with multiple .B \%wgetch calls. .bP The .I \%curses.h header file declares many -.I "predefined function keys" +.I "function keys" whose names begin with -.BR KEY_ ; -these object-like macros have values outside the range of eight-bit -character codes. +.BR KEY_ ";" +these object-like macros +have integer values outside the range of eight-bit character codes. .bP In -.IR \%ncurses , +.IR \%ncurses "," .I "user-defined function keys" are configured with \fB\%define_key\fP(3X); they have no names, -but are also expected to have values outside the range of eight-bit -codes. +but are also expected to +have integer values outside the range of eight-bit character codes. .PP A variable intended to hold a function key code must thus be of type .I short @@ -204,55 +229,78 @@ escape character ESC. This fact implies that .I curses -cannot know whether the terminal has sent an ESC key stroke or the -beginning of a function key's character sequence without waiting to see -if, +cannot distinguish a user's press of the escape key +(assuming it sends ESC) +from the beginning of a function key's character sequence without +waiting to see if, and how soon, further input arrives. -When -.I curses -reads such an ambiguous character, -it sets a timer. -If the remainder of the sequence does not arrive within the designated -time, +.bP +If the escape sequence +matches a string capability defining a function key +for the terminal type +(such as +.B \%key_home +.RB \%( khome ) +or +.B \%key_up +.RB \%( kuu1 )), .B \%wgetch -returns the prefix character; -otherwise, -it returns the function key code corresponding to the unique sequence +returns the function key code corresponding to the unique sequence defined by the terminal. +.bP +If the escape sequence matches no function keys +defined for the terminal type, +call +.B \%wgetch +repeatedly to obtain +the codes of the individual characters of the sequence, +in the order they occurred in the input. +.bP +If +.B \%wgetch +cannot decide the validity of the input as a function key +because it has not read enough characters to disambiguate it, +the function waits until it has this information or the +.I "escape delay" +elapses. +Configure the escape delay +with the global variable +.BR \%ESCDELAY "," +an extension +(see section \*(``EXTENSIONS\*('' below), +or the environment variable of the same name +(see section \*(``ENVIRONMENT\*('' of \fB\%ncurses\fP(3X)), +also an extension. +.PP Consequently, a user of a .I curses -application may experience a delay after pressing ESC while +application that employs keypad mode +may experience a pause or \*(``hang\*('' +after pressing the escape key while .I curses -disambiguates the input; -see section \*(``EXTENSIONS\*('' below. +collects sufficient characters to disambiguate the input. If the window is in \*(``no time-out\*('' mode, -the timer does not expire; -it is an infinite -(or very large) -value. -See \fB\%notimeout\fP(3X). -Because function key sequences usually begin with an escape character, -the terminal may appear to hang in no time-out mode after the user has -pressed ESC. -Generally, +the escape delay is effectively infinite; +see \fB\%notimeout\fP(3X). +In the event of such a pause, further typing \*(``awakens\*('' -.IR curses . +.IR curses "." .SS "Ungetting Characters" .B \%ungetch places .I c into the input queue to be returned by the next call to -.BR \%wgetch . -A single input queue serves all windows. -.SS "Predefined Key Codes" +.BR \%wgetch "." +A single input queue serves all windows associated with the screen. +.SS "Key Codes" The header file .I \%curses.h defines the following function key codes. .bP Except for the special case of -.BR \%KEY_RESIZE , +.BR \%KEY_RESIZE "," a window's keypad mode must be enabled for .B \%wgetch to read these codes from it. @@ -273,10 +321,11 @@ .\" get_wch(3X) or having that page cross reference this one? .TS Lb Lb -Lb Lx. +Lb Lw(36n)x. Symbol Key name = KEY_BREAK Break key +.ne 4 KEY_DOWN Arrow keys KEY_UP \^ KEY_LEFT \^ @@ -394,13 +443,15 @@ .bP .B \%wgetch returns -.BR \%KEY_RESIZE , +.BR \%KEY_RESIZE "," even if the window's keypad mode is disabled, -when +if .I \%ncurses -handles a -.B \%SIGWINCH -signal; +has handled a +.I \%SIGWINCH +signal since +.B \%wgetch +was called; see \fB\%initscr\fP(3X) and \fB\%resizeterm\fP(3X). .bP .B \%wgetch @@ -410,59 +461,92 @@ see \fB\%curs_mouse\fP(3X). Receipt of this code requires a window's keypad mode to be enabled, because to interpret mouse input -(as with with \fI\%xterm\fP(1)'s mouse prototocol), +(as with \fI\%xterm\fP(1)'s mouse protocol), .I \%ncurses must read an escape sequence, as with a function key. .SS "Testing Key Codes" In -.IR \%ncurses , +.IR \%ncurses "," .B \%has_key returns a Boolean value indicating whether the terminal type recognizes its parameter as a key code value. See also \fB\%define_key\fP(3X) and \fB\%key_defined\fP(3X). .SH RETURN VALUE -Except for -.BR \%has_key , -these functions return -.B OK -on success and +.B \%wgetch +returns a key code identifying the key event as described above, +which may include +.B \%KEY_RESIZE +or +.B \%KEY_MOUSE +indicating non-key events, +or .B ERR on failure. +.B \%wgetch +fails if +its timeout expires without any data arriving, +which cannot happen if \fB\%nodelay\fP(3X) is in effect on the window. .PP -Functions taking a +In +.IR \%ncurses , +.B \%wgetch +also fails if +.bP +the +.I curses +screen has not been initialized, +.bP +(for functions taking a .I \%WINDOW -pointer argument fail if the pointer is -.BR NULL . +pointer argument) +.I win +is a null pointer, +or +.bP +execution was interrupted by a signal, +in which case the library sets +.I \%errno +to +.IR \%EINTR "." .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position .RI ( y , -.IR x ) +.IR x ")" is outside the window boundaries. .PP -.B \%wgetch -also fails if +.B \%ungetch +returns +.B OK +on success and +.B ERR +on failure. +In +.IR \%ncurses , +.B \%ungetch +fails if .bP -its timeout expires without any data arriving, +the +.I curses +screen has not been initialized, or .bP -execution was interrupted by a signal, -in which case -.B \%errno -is set to -.BR \%EINTR . -.PP -.B \%ungetch -fails if there is no more room in the input queue. +there is no more room in the input queue. .PP .B \%has_key returns .B TRUE or -.BR FALSE . +.BR FALSE "." .SH NOTES +.BR \%getch "," +.BR \%mvgetch "," +and +.B \%mvwgetch +may be implemented as macros. +.PP .I curses discourages assignment of the ESC key to a discrete function by the programmer because the library requires a delay while it awaits the @@ -472,7 +556,7 @@ for example, .B \%KEY_ENTER may be the same as -.BR \*^M , +.BR \*^M "," .\" as with att630 or pccon+keys and .B \%KEY_BACKSPACE @@ -480,17 +564,17 @@ .B \*^H .\" as with att505 or vt52-basic or -.BR \*^? . +.BR \*^? "." .\" as with pccon+keys or vt320 -Consult the terminal's +Consult the .I \%term\%info -entry to determine whether this is the case; +entry for the terminal type to determine whether this is the case; see \fB\%infocmp\fP(1). Some .I curses implementations, including -.IR \%ncurses , +.IR \%ncurses "," honor the .I \%term\%info key definitions; @@ -502,7 +586,7 @@ .B \%KEY_ENTER refers to the key on the numeric keypad and, like other function keys, -and is reliably recognized only if the window's keypad mode is enabled. +is reliably recognized only if the window's keypad mode is enabled. .bP The .I \%term\%info @@ -529,7 +613,7 @@ (raw, cbreak, or -\*(``cooked\*(''), +canonical), and whether \fB\%nl\fP(3X) or \fB\%nonl\fP(3X) has been called, .B \%wgetch may return either a carriage return or line feed upon an Enter or Return @@ -541,22 +625,22 @@ is not well-defined. .PP Historically, -the list of key code macros above was influenced by the -function-key-rich keyboard of the AT&T 7300 +the list of key code macros above was influenced by the keyboard of the +AT&T 7300 (also known variously as the \*(``3B1\*('', \*(``Safari 4\*('', and \*(``UNIX PC\*(''), -a 1985 machine. -Today's computer keyboards are based that of the IBM PC/AT and tend to -have fewer. +a 1985 machine rich in function keys. +Today's computer keyboards are based on that of the IBM PC/AT +and tend to have fewer. A .I curses application can expect such a keyboard to transmit key codes -.BR \%KEY_UP , -.BR \%KEY_DOWN , -.BR \%KEY_LEFT , -.BR \%KEY_RIGHT , -.BR \%KEY_HOME , -.BR \%KEY_END , +.BR \%KEY_UP "," +.BR \%KEY_DOWN "," +.BR \%KEY_LEFT "," +.BR \%KEY_RIGHT "," +.BR \%KEY_HOME "," +.BR \%KEY_END "," .B \%KEY_PPAGE (Page Up), .B \%KEY_NPAGE @@ -565,20 +649,23 @@ (Insert), .B \%KEY_DC (Delete), +.BR \%KEY_A1 "," +.BR \%KEY_A3 "," +.BR \%KEY_B2 "," +.BR \%KEY_C1 "," +.BR \%KEY_C3 "," and .BI \%KEY_F( n ) for 1 \(<= .I n \(<= 12. -.PP -.BR \%getch , -.BR \%mvgetch , -and -.B \%mvwgetch -may be implemented as macros. +.\" Other numeric keypad keys from the DEC VT220 (specifically, the +.\" LK201 commonly used with it) and IBM PC/AT keyboards -- the comma +.\" (DEC); plus, star, and slash (PC); and zero, dot, and minus (both) +.\" have no standard key capability codes. .SH EXTENSIONS In -.IR \%ncurses , +.IR \%ncurses "," when a window's \*(``no time-out\*('' mode is .I not set, @@ -590,12 +677,17 @@ see \fB\%curs_variables\fP(3X). .PP -\fB\%has_key\fP was designed for \fB\%ncurses\fP(3X), +.B \%has_key +is an +.I \%ncurses +extension, and is not found in SVr4 -.IR curses , +.IR curses "," 4.4BSD -.IR curses , -or any other previous curses implementation. +.IR curses "," +or any other previous +.I curses +implementation. .SH PORTABILITY Applications employing .I \%ncurses @@ -603,51 +695,51 @@ .B \%NCURSES_VERSION preprocessor macro. .PP -X/Open Curses, -Issue 4 describes -\fB\%getch\fP, -\fB\%wgetch\fP, -\fB\%mvgetch\fP, -\fB\%mvwgetch\fP, -and -\fB\%ungetch\fP. +Except as noted in section \*(``EXTENSIONS\*('' above, +X/Open Curses Issue\ 4 describes these functions. It specifies no error conditions for them. .PP -.B \%wgetch +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 494 +.PP +.I \%wgetch reads only single-byte characters. .PP The echo behavior of these functions on input of -.B KEY_ -or backspace characters was not specified in the SVr4 documentation. -This description is adapted from X/Open Curses. +.I KEY_ +or backspace characters is not documented in SVr4 +.IR curses "." .PP The behavior of -.B \%wgetch -in the presence of signal handlers is unspecified in the SVr4 -documentation and X/Open Curses. +.I \%wgetch +in the presence of signal handlers is not documented in SVr4 +.I curses +and is unspecified by X/Open Curses. In historical .I curses implementations, it varied depending on whether the operating system's dispatch of a -signal to a handler interrupting a \fIread\fP(2) call in progress, +signal to a handler interrupted a \fIread\fP(2) call in progress, and also (in some implementations) -whether an input timeout or non-blocking mode has been set. -Programmers concerned about portability should be prepared for either of -two cases: +whether an input timeout or non-blocking mode had been set. +A portable +.I curses +application prepares for two cases: (a) signal receipt does not interrupt -.BR \%wgetch ; -or +.IR \%wgetch ";" +and (b) signal receipt interrupts -.B \%wgetch +.I \%wgetch and causes it to return -.B ERR +.I ERR with -.B \%errno +.I \%errno set to -.BR \%EINTR . +.IR \%EINTR "." .PP -.B \%KEY_MOUSE +.I \%KEY_MOUSE is mentioned in X/Open Curses, along with a few related .I \%term\%info @@ -657,11 +749,11 @@ .I \%ncurses is an extension. .PP -.B \%KEY_RESIZE +.I \%KEY_RESIZE and -.B \%has_key +.I \%has_key are extensions first implemented for -.IR \%ncurses . +.IR \%ncurses "." By 2022, .I \%PDCurses .\" https://web.archive.org/web/20220117232009/https://pdcurses.org/docs/MANUAL.html @@ -670,12 +762,35 @@ .I curses .\" https://web.archive.org/web/20200923185647/https://man.netbsd.org/curses_input.3 had added them along with -.BR \%KEY_MOUSE . +.IR \%KEY_MOUSE "." +.SH HISTORY +4BSD (1980) +introduced +.I \%wgetch +and its variants. +.PP +SVr3 (1987) +added +.IR \%ungetch "." +.PP +.I \%ncurses +1.9.9g (1996) +furnished the +.I \%has_key +extension. .SH SEE ALSO +ECMA-6 \*(``7-bit coded Character Set\*('' +\% +.PP +ECMA-48 \*(``Control Functions for Coded Character Sets\*('' +\% +.PP \fB\%curs_get_wch\fP(3X) describes comparable functions of the .I \%ncurses library in its wide-character configuration -.RI ( \%ncursesw ). +.RI \%( ncursesw ). .PP \fB\%curses\fP(3X), \fB\%curs_addch\fP(3X), @@ -687,11 +802,3 @@ \fB\%curs_variables\fP(3X), \fB\%resizeterm\fP(3X), \fB\%ascii\fP(7) -.PP -ECMA-6 \*(``7-bit coded Character Set\*('' -\% -.PP -ECMA-48 \*(``Control Functions for Coded Character Sets\*('' -\% diff --git a/contrib/ncurses/man/curs_getstr.3x b/contrib/ncurses/man/curs_getstr.3x --- a/contrib/ncurses/man/curs_getstr.3x +++ b/contrib/ncurses/man/curs_getstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,17 +27,19 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_getstr.3x,v 1.58 2024/04/20 19:18:18 tom Exp $ -.TH curs_getstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_getstr.3x,v 1.94 2025/10/21 00:09:04 tom Exp $ +.TH curs_getstr 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq +.ds ^ \(ha .\} .el \{\ .ie t .ds `` `` .el .ds `` "" .ie t .ds '' '' .el .ds '' "" +.ds ^ ^ .\} . .de bP @@ -53,101 +55,146 @@ \fB\%mvgetnstr\fP, \fB\%mvwgetstr\fP, \fB\%mvwgetnstr\fP \- -accept character strings from \fIcurses\fR terminal keyboard +read a character string from \fIcurses\fR terminal keyboard .SH SYNOPSIS .nf \fB#include .PP -\fBint getstr(char *\fIstr\fP); -\fBint getnstr(char *\fIstr\fP, int \fIn\fP); -\fBint wgetstr(WINDOW *\fIwin\fP, char *\fIstr\fP); -\fBint wgetnstr(WINDOW *\fIwin\fP, char *\fIstr\fP, int \fIn\fP); +\fBint getstr(char * \fIstr\fP); +\fBint wgetstr(WINDOW * \fIwin\fP, char * \fIstr\fP); +\fBint mvgetstr(int \fIy\fP, int \fIx\fP, char * \fIstr\fP); +\fBint mvwgetstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, char * \fIstr\fP); .PP -\fBint mvgetstr(int \fIy\fP, int \fIx\fP, char *\fIstr\fP); -\fBint mvwgetstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, char *\fIstr\fP); -\fBint mvgetnstr(int \fIy\fP, int \fIx\fP, char *\fIstr\fP, int \fIn\fP); -\fBint mvwgetnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, char *\fIstr\fP, int \fIn\fP); +\fBint getnstr(char * \fIstr\fP, int \fIn\fP); +\fBint wgetnstr(WINDOW * \fIwin\fP, char * \fIstr\fP, int \fIn\fP); +\fBint mvgetnstr(int \fIy\fP, int \fIx\fP, char * \fIstr\fP, int \fIn\fP); +\fBint mvwgetnstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, char * \fIstr\fP, int \fIn\fP); .fi .SH DESCRIPTION +.B \%wgetstr +populates a user-supplied string buffer +.I str +by repeatedly calling \fBwgetch\fP(3X) +with the +.I win +argument +until a line feed or carriage return character is input. +.\" Of the two, because wgetnstr() calls nl(), only a line feed (\n) +.\" will ever be returned by wgetch(). The function -\fBwgetnstr\fP -is equivalent to a series of calls to -\fBwgetch\fP(3X), -until a newline or carriage return terminates the series: .bP -The terminating character is not included in the returned string. +does not copy the terminating character to +.IR str ";" .bP -In all instances, the end of the string is terminated -by a NUL. +always terminates +.I str +with a null character; .bP -The function stores the result in the area pointed to -by the \fIstr\fP parameter. +interprets the screen's erase and kill characters +(see \fB\%erasechar\fP(3X) and \fB\%killchar\fP(3X)); .bP -The function reads at most \fIn\fP characters, -thus preventing a possible overflow of the input buffer. -.IP -Any attempt to enter more characters -(other than the terminating newline or carriage return) -causes a beep. -.IP -Function keys also cause a beep and are ignored. +recognizes function keys only if the screen's keypad option is enabled +(see \fB\%keypad\fP(3X)); +.bP +treats the function keys +.B \%KEY_LEFT +and +.B \%KEY_BACKSPACE +the same as the erase character; +and +.bP +discards function key inputs other than those +treated as the erase or kill characters, +calling \fBbeep\fP(3X). .PP -The user's \fIerase\fP and \fIkill\fP characters are interpreted: +If any characters have been written to the input buffer, +the erase character replaces the character +at the current position in the buffer +with a null character, +then decrements the position by one; +the kill character does the same repeatedly, +backtracking to the beginning of the buffer. +.PP +If the screen's echo option is enabled +(see \fBecho\fP(3X)), +.B \%wgetstr +updates +.I win +with \fB\%waddch\fP(3X). +Further, .bP -The \fIerase\fP character (e.g., \fB^H\fP) erases the character -at the end of the buffer, moving the cursor to the left. -.IP -If \fIkeypad\fP mode is on for the window, -\fBKEY_LEFT\fP and \fBKEY_BACKSPACE\fP -are both considered equivalent to the user's \fIerase\fP character. +the erase character +and its function key synonyms +move the cursor to the left +(if not already where it was located when +.B \%wgetstr +was called) +and .bP -The \fIkill\fP character (e.g., \fB^U\fP) erases the entire buffer, -leaving the cursor at the beginning of the buffer. +the kill character returns the cursor to where it was located when +.B \%wgetstr +was called. .PP -Characters input are echoed only if \fBecho\fP is currently on. -In that case, -backspace is echoed as deletion of the previous character -(typically a left motion). +.B \%wgetnstr +is similar, +but reads at most +.I n +characters, +aiding the application to avoid overrunning the buffer to which +.I str +points. +.I curses +ignores an attempt to input more than +.I n +characters +(other than the terminating line feed or carriage return), +calling \fBbeep\fP(3X). +If +.I n +is negative, +.B \%wgetn_wstr +reads up to +.I LINE_MAX +characters +(see +.IR sysconf (3)). .PP -The -\fBgetnstr\fP, -\fBmvgetnstr\fP, -\fBmvwgetnstr\fP, and -\fBwgetnstr\fP -functions are identical -to the -\fBgetstr\fP, -\fBmvgetstr\fP, -\fBmvwgetstr\fP, and -\fBwgetstr\fP -functions, respectively, -except that the -\fB*n*\fP -versions read at most -\fIn\fP -characters, letting the application prevent overflow of the -input buffer. +\fB\%ncurses\fP(3X) describes the variants of these functions. .SH RETURN VALUE -All of these functions return the integer \fBOK\fP upon successful completion. -(SVr4 specifies only \*(``an integer value other than \fBERR\fP\*('') -If unsuccessful, they return \fBERR\fP. +These functions return +.B OK +on success and +.B ERR +on failure. .PP -X/Open defines no error conditions. -.PP -In this implementation, -these functions return an error +In +.IR \%ncurses , +these functions fail if +.bP +the +.I curses +screen has not been initialized, .bP -if the window pointer is null, +(for functions taking a +.I \%WINDOW +pointer argument) +.I win +is a null pointer, .bP -if its timeout expires without having any data, or +.I str +is a null pointer, +or .bP -if the associated call to -\fBwgetch\fP -failed. +an internal \fB\%wgetch\fP(3X) call fails. .PP -This implementation provides an extension as well. -If a \fBSIGWINCH\fP interrupts the function, it will return \fBKEY_RESIZE\fP -rather than \fBOK\fP or \fBERR\fP. +Further, +in +.IR \%ncurses "," +these functions return +.B \%KEY_RESIZE +if a +.I \%SIGWINCH +event interrupts the function. .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -155,147 +202,322 @@ .IR x ) is outside the window boundaries. .SH NOTES -Any of these functions other than -\fBwgetnstr\fP -may be macros. +All of these functions except +.B \%wgetnstr +may be implemented as macros. .PP -Using -\fBgetstr\fP, -\fBmvgetstr\fP, -\fBmvwgetstr\fP, or -\fBwgetstr\fP -to read a line that -overflows the array pointed to by -\fBstr\fP -causes undefined -results. -The use of -\fBgetnstr\fP, -\fBmvgetnstr\fP, -\fBmvwgetnstr\fP, or -\fBwgetnstr\fP, -respectively, is recommended. +Reading input that overruns the buffer pointed to by +.I str +causes undefined results. +Use the +.BR n -infixed +functions, +and allocate sufficient storage for +.I str +\(em at least +.IR n +1 +times +.BR sizeof(char) "." +.PP +While these functions conceptually implement +a series of calls to +.BR \%wgetch "," +they also temporarily change properties of the +.I curses +screen to permit simple editing of the input buffer. +Each function saves the screen's state, +calls \fBnl\fP(3X), +and, +if the screen was in canonical (\*(``cooked\*('') mode, +\fB\%cbreak\fP(3X). +Before returning, +it restores the saved screen state. +Other implementations differ in detail, +affecting which control characters they can accept in the buffer; +see section \*(``PORTABILITY\*('' below. +.SH EXTENSIONS +.BR \%getnstr "," +.BR \%wgetnstr "," +.BR \%mvgetnstr "," +and +.BR \%mvwgetnstr "'s" +handing of negative +.I n +values is an +.I \%ncurses +extension. +.PP +The return value +.B \%KEY_RESIZE +is an +.I \%ncurses +extension. .SH PORTABILITY -These functions are described in The Single Unix Specification, Version 2. -No error conditions are defined. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. +.PP +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them, +but indicates that +.I \%wgetnstr +and its variants read +\*(``the entire multi-byte sequence associated with a character\*('' +and \*(``fail\*('' if +.I n +and +.I str +together do not describe a buffer +\*(``large enough to contain any complete characters\*(''. +In +.IR \%ncurses "," +however, +.I \%wgetch +reads only single-byte characters, +so this scenario does not arise. +.\" You can pass ncurses wgetnstr n=0 and it will beep at you with each +.\" key stroke. .PP -This implementation returns \fBERR\fP if the window pointer is null, -or if the lower-level \fBwgetch\fP(3X) call returns an \fBERR\fP. +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 495 .PP -SVr3 and early SVr4 curses implementations did not reject function keys; -the SVr4.0 documentation claimed that \*(``special keys\*('' +SVr3 and early SVr4 +.I curses +implementations did not reject function keys; +the SVr4 documentation asserted that, +like the screen's erase and kill characters, +they were +.PP +.RS +interpreted, +as well as any special keys (such as function keys, \*(``home\*('' key, \*(``clear\*('' key, -\fIetc\fP.) are \*(``interpreted\*('', -without giving details. -It lied. -In fact, the \*(``character\*('' value appended to the -string by those implementations was predictable but not useful -(being, in fact, the low-order eight bits of the key's KEY_ value). +.IR etc. ) +.\" SVID 4, vol. 3, p. 495 +.RE .PP -The functions \fBgetnstr\fP, \fBmvgetnstr\fP, and \fBmvwgetnstr\fP were -present but not documented in SVr4. +without further detail. +It lied. +The \*(``character\*('' value +appended to the string +by those implementations +was predictable but not useful \(em +being, +in fact, +the low-order eight bits of the key code's +.I KEY_ +constant value. +(The same language, +unchanged except for styling, +survived into X/Open Curses Issue\ 4, +Version\ 2 \" p. 94 (PDF 114) +but disappeared from Issue\ 7.) \" p. 105 (PDF 119) .PP -X/Open Curses, Issue 5 (2007) stated that these functions -\*(``read at most \fIn\fP bytes\*('' -but did not state whether the terminating NUL is counted in that limit. -X/Open Curses, Issue 7 (2009) changed that to say they -\*(``read at most \fIn\fP\-1 bytes\*('' -to allow for the terminating NUL. -As of 2018, some implementations count it, some do not: -.bP -\fI\%ncurses\fP 6.1 and PDCurses do not count the NUL in the given limit, while +A draft of X/Open Curses Issue\ 5 +(which never saw final release) +stated that these functions +\*(``read at most +.I n +bytes\*('' +but did not state whether the terminating null character +counted toward that limit. +X/Open Curses Issue\ 7 changed that to say they +\*(``read at most +.IR n \-1 +bytes\*('' +to allow for the terminating null character. +As of 2018, +some implementations count it, +some do not. .bP -Solaris SVr4 and NetBSD curses count the NUL as part of the limit. +.I \%ncurses +6.1 and +.I \%PDCurses +do not count the null character toward the limit, +while Solaris and NetBSD +.I curses +do. .bP -Solaris xcurses provides both: -its wide-character \fBwget_nstr\fP reserves a NUL, -but its \fBwgetnstr\fP does not count the NUL consistently. +Solaris +.I xcurses +offers both behaviors: +its wide-character +.I \%wgetn_wstr +reserves room for a wide null character, +but its non-wide +.I \%wgetnstr +does not consistently count a null character toward the limit. .PP -In SVr4 curses, -a negative value of \fIn\fP tells \fBwgetnstr\fP to assume that the -caller's buffer is large enough to hold the result, -i.e., to act like \fBwgetstr\fP. -X/Open Curses does not mention this -(or anything related to negative or zero values of \fIn\fP), -however most implementations -use the feature, with different limits: -.bP -Solaris SVr4 curses and PDCurses limit the result to 255 bytes. -Other Unix systems than Solaris are likely to use the same limit. +X/Open Curses does not specify what happens if the length +.I n +is negative. .bP -Solaris xcurses limits the result to \fBLINE_MAX\fP bytes. -.bP -NetBSD 7 assumes no particular limit for the result from \fBwgetstr\fP. -However, it limits the \fBwgetnstr\fP parameter \fIn\fP to ensure -that it is greater than zero. -.IP -A comment in NetBSD's source code states that this is specified in SUSv2. +.I \%ncurses +6.2 uses +.I LINE_MAX +or a larger (system-dependent) value +provided by \fI\%sysconf\fP(3). +If neither +.I LINE_MAX +nor +.I \%sysconf +is available, +.I \%ncurses +uses the POSIX minimum value for +.I LINE_MAX +(2048). \" _POSIX2_LINE_MAX +In either case, +it reserves a byte for the terminating null character. .bP -\fI\%ncurses\fP (before 6.2) assumes no particular limit for the result -from \fBwgetstr\fP, and treats the \fIn\fP parameter of \fBwgetnstr\fP -like SVr4 curses. +In SVr4 +.IR curses "," +a negative +.I n +tells +.I \%wgetnstr +to assume that the caller's buffer +is large enough to hold the result; +that is, +the function then acts like +.IR \%wgetstr "." +X/Open Curses does not mention this behavior +(or anything related to nonpositive +.I n +values), +however most +.I curses +libraries implement it. +Most implementations nevertheless enforce an upper limit +on the count of bytes they write to the destination buffer +.IR str "." .bP -\fI\%ncurses\fP 6.2 uses \fBLINE_MAX\fP, -or a larger (system-dependent) value -which the \fBsysconf\fP function may provide. -If neither \fBLINE_MAX\fP or \fBsysconf\fP is available, -\fI\%ncurses\fP uses the POSIX value for \fBLINE_MAX\fP (a 2048 byte limit). -In either case, it reserves a byte for the terminating NUL. -.PP -Although \fBgetnstr\fP is equivalent to a series of calls to \fBgetch\fP, -it also makes changes to the curses modes to allow simple editing of -the input buffer: +BSD +.I curses +lacked +.IR \%wgetnstr "," +and its +.I \%wgetstr +wrote to +.I str +unboundedly, +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/\ +.\" libcurses/getstr.c +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/src/lib/\ +.\" libcurses/getstr.c +as did that in SVr2. +.\" https://github.com/ryanwoodsmall/oldsysv/blob/master/sysvr2-vax/\ +.\" src/lib/libcurses/screen/getstr.c .bP -\fBgetnstr\fP saves the current value of the \fBnl\fP, \fBecho\fP, -\fBraw\fP and \fBcbreak\fP modes, and sets -\fBnl\fP, -\fBnoecho\fP, -\fBnoraw\fP, and -\fBcbreak\fP. -.IP -\fBgetnstr\fP handles the echoing of characters, -rather than relying on the caller to set an appropriate mode. +.IR PDCurses "," +and +SVr3 and later, +.\" https://github.com/ryanwoodsmall/oldsysv/blob/master/\ +.\" sysvr3/301/usr/src/lib/libcurses/screen/getstr.c#L21 +.\" sysvr3/31/usr/src/lib/libcurses/screen/wgetstr.c#L10 +.\" sysvr4/svr4/lib/xlibcurses/screen/wgetstr.c#L12 +and +Solaris +.I curses +limit both functions to writing 256 bytes. +Other System\ V-based platforms likely use the same limit. .bP -It also obtains the \fIerase\fP and \fIkill\fP characters -from \fBerasechar\fP and \fBkillchar\fP, respectively. +Solaris +.I xcurses +limits the write to +.I LINE_MAX +bytes +(see +.IR sysconf (3)). .bP -On return, \fBgetnstr\fP restores the modes to their previous values. +NetBSD 7 +.I curses +imposes no particular limit on the length of the write, +but does validate +.I n +to ensure that it is greater than zero. +A comment in NetBSD's source code asserts that SUSv2 specifies this. .PP -Other implementations differ in their treatment of special characters: +Implementations vary in their handling of input control characters. .bP -While they may set the \fIecho\fP mode, -other implementations do not modify the \fIraw\fP mode, -They may take the \fIcbreak\fP -mode set by the caller into account when deciding whether to handle -echoing within \fBgetnstr\fP or as a side-effect of the \fBgetch\fP calls. +While they may enable the screen's echo option, +some do not take it out of raw mode, +and may take cbreak mode into account +when deciding whether to handle echoing within +.I \%wgetnstr +or to rely on it as a side effect of calling +.IR \%wgetch "." .bP -The original \fI\%ncurses\fP -(as \fIpcurses\fP in 1986) -set \fBnoraw\fP and \fBcbreak\fP when accepting input for \fBgetnstr\fP. -That may have been done to make function- and cursor-keys work; -it is not necessary with \fI\%ncurses\fP. +Originally, +.IR \%ncurses "," +like its progenitor +.IR \%pcurses "," +had its +.I \%wgetnstr +call +.I \%noraw +and +.I \%cbreak +before accepting input. +That may have been done to make function keys work; +it is not necessary with modern +.IR \%ncurses "." .IP Since 1995, -\fI\%ncurses\fP has provided signal handlers for INTR and QUIT -(e.g., \fB^C\fP or \fB^\e\fP). -With the \fBnoraw\fP and \fBcbreak\fP settings, -those may catch a signal and stop the program, -where other implementations allow one to enter those characters in the buffer. +.I \%ncurses +has provided handlers for +.I SIGINTR +and +.I SIGQUIT +events, +which are typically generated at the keyboard with +.B \*^C +and +.B \*^\e +respectively. +In cbreak mode, +those handlers catch a signal and stop the program, +whereas other implementations write those characters into the buffer. .bP -Starting in 2021 -(\fI\%ncurses\fP 6.3), -\fBgetnstr\fP sets \fBraw\fP, -rather than \fBnoraw\fP and \fBcbreak\fP for better compatibility with -SVr4-curses, e.g., allowing one to enter a \fB^C\fP into the buffer. +Starting with +.I \%ncurses +6.3 (2021), +.I \%wgetnstr +preserves raw mode if the screen was already in that state, +allowing one to enter the characters the terminal interprets +as interrupt and quit events +into the buffer, +for better compatibility with SVr4 +.IR curses "." +.SH HISTORY +4BSD (1980) +introduced +.I \%wgetstr +along with its variants. +.PP +SVr3.1 (1987) +added +.IR \%wgetnstr "," +but none of its variants. +.PP +X/Open Curses Issue\ 4 (1995) +specified +.IR \%getnstr "," +.IR \%mvgetnstr "," +and +.IR \%mvwgetnstr "." .SH SEE ALSO \fB\%curs_get_wstr\fP(3X) describes comparable functions of the .I \%ncurses library in its wide-character configuration -.RI ( \%ncursesw ). +.RI \%( ncursesw ). .PP \fB\%curses\fP(3X), +\fB\%curs_addch\fP(3X), \fB\%curs_getch\fP(3X), -\fB\%curs_termattrs\fP(3X), -\fB\%curs_variables\fP(3X) +\fB\%curs_inopts\fP(3X), \" echo(), keypad() +\fB\%curs_termattrs\fP(3X), \" erasechar(), killchar() diff --git a/contrib/ncurses/man/curs_getyx.3x b/contrib/ncurses/man/curs_getyx.3x --- a/contrib/ncurses/man/curs_getyx.3x +++ b/contrib/ncurses/man/curs_getyx.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2020-2023,2024 Thomas E. Dickey * +.\" Copyright 2020-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2007,2010 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_getyx.3x,v 1.44 2024/04/20 21:20:07 tom Exp $ -.TH curs_getyx 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_getyx.3x,v 1.55 2025/02/01 22:48:11 tom Exp $ +.TH curs_getyx 3X 2025-02-01 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -51,62 +51,122 @@ \fB#include .PP \fBvoid getyx(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP); -\fBvoid getparyx(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP); \fBvoid getbegyx(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP); \fBvoid getmaxyx(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP); +.PP +\fBvoid getparyx(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP); .fi .SH DESCRIPTION -The \fB\%getyx\fP macro places the current cursor position -of the given window in the two integer variables \fIy\fP and \fIx\fP. +These macros obtain the cursor position and bounds information of a +.I curses +window +.IR win "." +.B \%getyx +stores +.IR win "'s" +cursor position in the variables +.I y +and +.IR x "." +.B \%getmaxyx +stores +.IR win "'s" +maximum valid line and column numbers in +.I y +and +.IR x "," +respectively. +.B \%getbegyx +similarly stores the position of +.IR win "'s" +origin relative to that of the screen +(for +.BR stdscr "," +these coordinates are always +.BR 0 ")." .PP -If \fIwin\fP is a subwindow, the \fB\%getparyx\fP macro places the beginning -coordinates of the subwindow relative to the parent window into two integer -variables \fIy\fP and \fIx\fP. -Otherwise, \fB\-1\fP is placed into \fIy\fP and \fIx\fP. -.PP -Like \fB\%getyx\fP, the \fB\%getbegyx\fP and \fB\%getmaxyx\fP macros store -the current beginning coordinates and size of the specified window. +If +.I win +is a subwindow +(see \fB\%subwin\fP(3X)), +the +.B \%getparyx +macro places the coordinates of its origin relative to its parent window +into +.I y +and +.IR x "," +and +.B \-1 +into both if it is not. .SH RETURN VALUE -The return values of these macros are undefined (i.e., -they should not be used as the right-hand side of assignment statements). +No return values are defined for macros. +Do not use them as the right-hand side of assignment statements. .SH NOTES -All of these interfaces are macros. -A \*(``&\*('' is not necessary before the variables \fIy\fP and \fIx\fP. +All of these interfaces are implemented as macros. +An \*(``&\*('' operator is not necessary before the variables +.I y +and +.IR x "." .SH PORTABILITY -The -\fB\%getyx\fP, -\fB\%getparyx\fP, -\fB\%getbegyx\fP and -\fB\%getmaxyx\fP -macros are described in X/Open Curses, Issue 4. +These macros are described in X/Open Curses Issue\ 4. .PP -This implementation also provides functions -\fB\%getbegx\fP, -\fB\%getbegy\fP, -\fB\%getcurx\fP, -\fB\%getcury\fP, -\fB\%getmaxx\fP, -\fB\%getmaxy\fP, -\fB\%getparx\fP and -\fB\%getpary\fP -for compatibility with older versions of \fIcurses\fP; +.I \%ncurses +also provides functions +.IR \%getbegy "," +.IR \%getbegx "," +.IR \%getcury "," +.IR \%getcurx "," +.IR \%getmaxy "," +.IR \%getmaxx "," +.IR \%getpary "," +and +.I \%getparx +for compatibility with System\ V +.I curses +that were not standardized; +.\" even by SVID 4 see \fB\%curs_legacy\fP(3X). .PP -Although X/Open Curses does not address this, -many implementations provide members of the \fB\%WINDOW\fP structure -containing values corresponding to these macros. -For best portability, do not rely on using the data in \fB\%WINDOW\fP, -since some implementations make \fB\%WINDOW\fP opaque (do not allow -direct use of its members). +Although X/Open Curses does not address the issue, +many implementations expose members of the +.I \%WINDOW +structure containing values corresponding to these macros. +Do not rely on their availability; +some implementations make +.I \%WINDOW +opaque +(that is, +they do not allow direct access to its members). .PP Besides the problem of opaque structures, -the data stored in like-named members may not have like-values in -different implementations. -For example, the \fB\%WINDOW._maxx\fP and \fB\%WINDOW._maxy\fP values -in \fI\%ncurses\fP have -(at least since release 1.8.1) +the data stored in like-named members may not have values of the same +meaning across different implementations. +For example, +the values of +.I \%WINDOW._maxx +and +.I \%WINDOW._maxy +in +.I \%ncurses +have long +.\" (at least since its initial release, 1.8.1) differed by one from some other implementations. -The difference is hidden by means of the macro \fB\%getmaxyx\fP. +The +.I \%getmaxyx +macro hides this difference. +.SH HISTORY +4BSD (1980) +introduced +.IR \%getyx "." +.PP +SVr3 (1987) +added +.I \%getbegyx +and +.IR \%getmaxyx "." +SVr3.1 later that year supplied +.IR \%getparyx "." .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_legacy\fP(3X), diff --git a/contrib/ncurses/man/curs_in_wch.3x b/contrib/ncurses/man/curs_in_wch.3x --- a/contrib/ncurses/man/curs_in_wch.3x +++ b/contrib/ncurses/man/curs_in_wch.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2002-2010,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_in_wch.3x,v 1.31 2024/04/20 21:20:07 tom Exp $ -.TH curs_in_wch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_in_wch.3x,v 1.44 2025/02/01 22:54:32 tom Exp $ +.TH curs_in_wch 3X 2025-02-01 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -41,30 +41,46 @@ .\} .SH NAME \fB\%in_wch\fP, +\fB\%win_wch\fP, \fB\%mvin_wch\fP, -\fB\%mvwin_wch\fP, -\fB\%win_wch\fP \- +\fB\%mvwin_wch\fP \- get a \fIcurses\fR complex character from a window .SH SYNOPSIS .nf \fB#include .PP -\fBint in_wch(cchar_t *\fIwch\fP); -\fBint win_wch(WINDOW *\fIwin\fP, cchar_t *\fIwch\fP); -.PP -\fBint mvin_wch(int \fIy\fP, int \fIx\fP, cchar_t *\fIwch\fP); -\fBint mvwin_wch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, cchar_t *\fIwch\fP); +\fBint in_wch(cchar_t * \fIwch\fP); +\fBint win_wch(WINDOW * \fIwin\fP, cchar_t * \fIwch\fP); +\fBint mvin_wch(int \fIy\fP, int \fIx\fP, cchar_t * \fIwch\fP); +\fBint mvwin_wch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, cchar_t * \fIwch\fP); .fi .SH DESCRIPTION -These functions extract the complex character and rendition from -the current position in the named window into the \fBcchar_t\fP object -referenced by wch. +.B \%win_wch +copies the +.I curses +complex character at the cursor position in +.I win +into +.IR wch "." +Use \fB\%getcchar\fP(3X) to extract its character code, +attributes, +and color pair identifier. +\fB\%ncurses\fP(3X) describes the variants of this function. .SH RETURN VALUE -No errors are defined in X/Open Curses. -This implementation checks for null pointers, returns \fBERR\fP in that case. -Also, the \fImv\fP routines check for error moving the cursor, -returning \fBERR\fP in that case. -Otherwise they return \fBOK\fP. +These functions return +.B OK +on success and +.B ERR +on failure. +.PP +In +.IR \%ncurses "," +they return +.B ERR +if +.I win +is +.IR NULL "." .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -72,9 +88,38 @@ .IR x ) is outside the window boundaries. .SH NOTES -Note that all of these routines may be macros. +.BR \%in_wch "," +.BR mvin_wch "," +and +.B mvwin_wch +may be implemented as macros. +.PP +Unlike \fB\%winch\fP(3X), +.B \%win_wch +and its variants store the value of the retrieved character in an +additional +.I wch +parameter instead of the return value. .SH PORTABILITY -These functions are described in X/Open Curses, Issue 4. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.SH HISTORY +X/Open Curses Issue\ 4 (1995) initially specified these functions. +The System\ V Interface Definition Version\ 4 +of the same year +specified a function named +.I \%winwch +(and the usual variants). +.\" SVID 4, vol 3., p. 514 +This was a later addition to +.RI SVr4. x , +not appearing in the first SVr4 (1989). +It differed from X/Open's later +.I \%win_wch +in that it returned a value of type +.I \%chtype +instead of +.IR \%cchar_t "." .SH SEE ALSO \fB\%curs_inch\fP(3X) describes comparable functions of the .I \%ncurses diff --git a/contrib/ncurses/man/curs_in_wchstr.3x b/contrib/ncurses/man/curs_in_wchstr.3x --- a/contrib/ncurses/man/curs_in_wchstr.3x +++ b/contrib/ncurses/man/curs_in_wchstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2002-2012,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_in_wchstr.3x,v 1.39 2024/04/20 21:24:19 tom Exp $ -.TH curs_in_wchstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_in_wchstr.3x,v 1.56 2025/10/21 00:03:06 tom Exp $ +.TH curs_in_wchstr 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -58,42 +58,68 @@ .nf \fB#include .PP -\fBint in_wchstr(cchar_t *\fIwchstr\fP); -\fBint win_wchstr(WINDOW *\fIwin\fP, cchar_t *\fIwchstr\fP); -\fBint mvin_wchstr(int \fIy\fP, int \fIx\fP, cchar_t *\fIwchstr\fP); -\fBint mvwin_wchstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, cchar_t *\fIwchstr\fP); +\fBint in_wchstr(cchar_t * \fIwchstr\fP); +\fBint win_wchstr(WINDOW * \fIwin\fP, cchar_t * \fIwchstr\fP); +\fBint mvin_wchstr(int \fIy\fP, int \fIx\fP, cchar_t * \fIwchstr\fP); +\fBint mvwin_wchstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, cchar_t * \fIwchstr\fP); .PP -\fBint in_wchnstr(cchar_t *\fIwchstr\fP, int \fIn\fP); -\fBint win_wchnstr(WINDOW *\fIwin\fP, cchar_t *\fIwchstr\fP, int \fIn\fP); -\fBint mvin_wchnstr(int \fIy\fP, int \fIx\fP, cchar_t *\fIwchstr\fP, int \fIn\fP); -\fBint mvwin_wchnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, cchar_t *\fIwchstr\fP, int \fIn\fP); +\fBint in_wchnstr(cchar_t * \fIwchstr\fP, int \fIn\fP); +\fBint win_wchnstr(WINDOW * \fIwin\fP, cchar_t * \fIwchstr\fP, int \fIn\fP); +\fBint mvin_wchnstr(int \fIy\fP, int \fIx\fP, cchar_t * \fIwchstr\fP, int \fIn\fP); +\fBint mvwin_wchnstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, cchar_t * \fIwchstr\fP, int \fIn\fP) .fi .SH DESCRIPTION -These functions return an array of complex characters in \fIwchstr\fP, -starting at the current cursor position in the named window. -Attributes (rendition) are stored with the characters. -.PP -The four functions with \fIn\fP as the last argument return -a leading substring at most \fIn\fP characters long -(exclusive of the trailing zeroed \fBcchar_t\fR. -Transfer stops at the end of the current line, or when \fIn\fP characters have -been stored at the location referenced by \fIwchstr\fP. -.PP -Constants defined in \fB\fP can be used with the \fB&\fP (logical -AND) operator to extract the character or the attribute alone from any position -in the \fIwchstr\fP [see \fBgetcchar\fP(3X)]. +.B \%win_wchstr +extracts a +.I curses +complex character string from a +.I curses +window +.IR win "," +starting at the cursor and stopping at the end of the line, +and stores it in +.IR wchstr "," +terminating it with a wide null +.I curses +character. +.B \%win_wchnstr +does the same, +but copies at most +.I n +.I curses +complex characters from +.IR win "." +A negative +.I n +implies no limit; +.B \%win_wchnstr +then works like +.BR \%win_wchstr "." +\fB\%ncurses\fP(3X) describes the variants of these functions. .SH RETURN VALUE -Upon successful completion, these functions return -\fBOK\fP. -Otherwise, they return -\fBERR\fP. +These functions return +.B OK +on success and +.B ERR +on failure. .PP -X/Open Curses defines no error conditions. -This implementation returns an error +In +.IR \%ncurses "," +these functions fail if .bP -if the \fIwin\fP parameter is null or +the +.I curses +screen has not been initialized, .bP -if the \fIwchstr\fP parameter is null. +(for functions taking a +.I \%WINDOW +pointer argument) +.I win +is a null pointer, +or +.bP +.I wchstr +is a null pointer. .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -101,27 +127,40 @@ .IR x ) is outside the window boundaries. .SH NOTES -All routines except \fBwin_wchnstr\fP may be macros. +All of these functions except +.B \%win_wchnstr +may be implemented as macros. .PP Reading a line that overflows the array pointed to by -\fIwchstr\fP -with -\fBin_wchstr\fP, -\fBmvin_wchstr\fP, -\fBmvwin_wchstr\fP -or -\fBwin_wchstr\fP -causes undefined results. -Therefore, the use of -\fBin_wchnstr\fP, -\fBmvin_wchnstr\fP, -\fBmvwin_wchnstr\fP, or -\fBwin_wchnstr\fP -is recommended. +.I wchstr +and its variants causes undefined results. +Instead, +use the +.IR n -infixed +functions with a positive +.I n +argument no larger than the size of the buffer backing +.IR wchstr "." .SH PORTABILITY -X/Open Curses defines no error conditions. -This implementation checks for null pointers, -returning \fBERR\fP in that case. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.SH HISTORY +X/Open Curses Issue\ 4 (1995) initially specified these functions. +The System\ V Interface Definition Version\ 4 +of the same year +specified a function named +.I \%winwchstr +(and the usual variants). +.\" SVID 4, vol 3., p. 515 +This was a later addition to +.RI SVr4. x , +not appearing in the first SVr4 (1989). +It differed from X/Open's later +.I \%win_wchstr +in that it took an argument of type +.RI pointer-to- chtype +instead of +.RI pointer-to- cchar_t "." .SH SEE ALSO \fB\%curs_inchstr\fP(3X) describes comparable functions of the .I \%ncurses diff --git a/contrib/ncurses/man/curs_inch.3x b/contrib/ncurses/man/curs_inch.3x --- a/contrib/ncurses/man/curs_inch.3x +++ b/contrib/ncurses/man/curs_inch.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_inch.3x,v 1.51 2024/04/20 21:20:07 tom Exp $ -.TH curs_inch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_inch.3x,v 1.70 2025/02/15 19:36:03 tom Exp $ +.TH curs_inch 3X 2025-02-15 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -56,73 +56,113 @@ \fB#include .PP \fBchtype inch(void); -\fBchtype winch(WINDOW *\fIwin\fP); -.PP +\fBchtype winch(WINDOW * \fIwin\fP); \fBchtype mvinch(int \fIy\fP, int \fIx\fP); -\fBchtype mvwinch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP); +\fBchtype mvwinch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP); .fi .SH DESCRIPTION -These routines return the character, of type \fBchtype\fP, at the current -position in the named window. -If any attributes are set for that position, -their values are OR'ed into the value returned. -Constants defined in -\fB\fP can be used with the \fB&\fP (logical AND) operator to -extract the character or attributes alone. -. -.SS Attributes -The following bit masks may be AND-ed with characters returned by \fBwinch\fP. -.PP -.TS -Lb Lb -Lb Lx. -Name Description -_ -A_CHARTEXT Extract character -A_ATTRIBUTES Extract attributes -A_COLOR Extract color pair information -.TE +.B \%winch +returns the +.I curses +character, +including its attributes and color pair identifier, +at the cursor position in the window +.IR win "." +Subsection \*(``Video Attributes\*('' of \fB\%attron\fP(3X) explains +how to extract these data from a +.IR chtype "." +\fB\%ncurses\fP(3X) describes the variants of this function. .SH RETURN VALUE +These functions return +.B OK +on success and +.B ERR +on failure. +.PP +In +.IR \%ncurses "," +they return +.B ERR +if +.I win +is +.IR NULL "." +.PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position .RI ( y , .IR x ) is outside the window boundaries. -.PP -The \fBwinch\fP function does not return an error if the window contains -characters larger than 8-bits (255). -Only the low-order 8 bits of the character are used by \fBwinch\fP. .SH NOTES -Note that all of these routines may be macros. -.SH PORTABILITY -These functions are described in X/Open Curses, Issue 4. +.BR \%inch , +.BR \%mvinch , +and +.B \%mvwinch +may be implemented as macros. .PP -Very old systems (before standardization) provide a different function -with the same name: -.bP -The \fBwinch\fP function was part of the original BSD curses library, -which stored a 7-bit character combined with the \fIstandout\fP attribute. -.IP -In BSD curses, \fBwinch\fP returned only the character (as an integer) -with the \fIstandout\fP attribute removed. -.bP -System V curses added support for several video attributes which -could be combined with characters in the window. -.IP -Reflecting this improvement, the function was altered to return the -character combined with all video attributes in a \fBchtype\fP value. +These functions do not fail if the window contains cells of +.I curses +complex characters; +that is, +if they contain characters with codes wider than eight bits +(or greater than 255 as an unsigned decimal integer). +They instead extract only the low-order eight bits of the character code +from the cell. +.SH PORTABILITY +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.SH HISTORY +The original +.I curses +in 4BSD (1980) defined +.I \%winch +as a macro accessing the +.I \%WINDOW +structure member representing character cell data, +at that time a +.IR char "," +containing only a 7-bit ASCII character code +and a \*(``standout\*(`` attribute bit, +the only one the library supported. .PP -X/Open Curses does not specify -the size and layout of attributes, color and character values in -\fBchtype\fP; it is implementation-dependent. -This implementation uses 8 bits for character values. -An application using more bits, e.g., a Unicode value, -should use the wide-character equivalents to these functions. +SVr2 +.I curses +(1984) +extended this approach, +widening the character code to eight bits +and permitting several attributes to be combined with it +by storing them together in a +.IR \%chtype "," +an alias of +.IR "unsigned short" "." +.\" ...indirectly through a preprocessor macro named CHTYPE, encouraging +.\" builders to change the typedef to `char` or `long` as desired. More +.\" innocent times with respect to ABI compatibility concerns... --GBR +Because a macro was used, +its value was not type-checked +as a function return value could have been. +Goodheart documented SVr3 (1987) +.I \%winch +as returning an +.IR int "." +.\" ...but the implementation remained unchanged. +SVr3.1's (1987) +.I \%chtype +became an alias of +.IR "unsigned long" "," +using 16 bits for the character code and +widening the type in practical terms to 32 bits, +as 64-bit Unix systems were not yet in wide use, +and fixed-width integral types would not be standard until ISO C99. +.\" Cray's UNICOS was 1985 (how many shops had Crays?). DEC OSF/1 for +.\" the Alpha arrived in 1993. --GBR +SVr3.2 (1988) +added a 6-bit color pair identifier alongside the attributes. .SH SEE ALSO \fB\%curs_in_wch\fP(3X) describes comparable functions of the .I \%ncurses library in its wide-character configuration -.RI ( \%ncursesw ). +.RI \%( ncursesw ). .PP \fB\%curses\fP(3X), \fB\%curs_instr\fP(3X) diff --git a/contrib/ncurses/man/curs_inchstr.3x b/contrib/ncurses/man/curs_inchstr.3x --- a/contrib/ncurses/man/curs_inchstr.3x +++ b/contrib/ncurses/man/curs_inchstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_inchstr.3x,v 1.45 2024/04/20 21:20:07 tom Exp $ -.TH curs_inchstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_inchstr.3x,v 1.65 2025/10/21 00:05:02 tom Exp $ +.TH curs_inchstr 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -58,41 +58,68 @@ .nf \fB#include .PP -\fBint inchstr(chtype *\fIchstr\fP); -\fBint inchnstr(chtype *\fIchstr\fP, int \fIn\fP); -\fBint winchstr(WINDOW *\fIwin\fP, chtype *\fIchstr\fP); -\fBint winchnstr(WINDOW *\fIwin\fP, chtype *\fIchstr\fP, int \fIn\fP); +\fBint inchstr(chtype * \fIchstr\fP); +\fBint inchnstr(chtype * \fIchstr\fP, int \fIn\fP); +\fBint winchstr(WINDOW * \fIwin\fP, chtype * \fIchstr\fP); +\fBint winchnstr(WINDOW * \fIwin\fP, chtype * \fIchstr\fP, int \fIn\fP); .PP -\fBint mvinchstr(int \fIy\fP, int \fIx\fP, chtype *\fIchstr\fP); -\fBint mvinchnstr(int \fIy\fP, int \fIx\fP, chtype *\fIchstr\fP, int \fIn\fP); -\fBint mvwinchstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, chtype *\fIchstr\fP); -\fBint mvwinchnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, chtype *\fIchstr\fP, int \fIn\fP); +\fBint mvinchstr(int \fIy\fP, int \fIx\fP, chtype * \fIchstr\fP); +\fBint mvinchnstr(int \fIy\fP, int \fIx\fP, chtype * \fIchstr\fP, int \fIn\fP); +\fBint mvwinchstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, chtype * \fIchstr\fP); +\fBint mvwinchnstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, chtype * \fIchstr\fP, int \fIn\fP); .fi .SH DESCRIPTION -These routines return a NULL-terminated array of \fBchtype\fP quantities, -starting at the current cursor position in the named window and ending at the -right margin of the window. -.PP -The four functions with \fIn\fP as the last argument, return -a leading substring at most \fIn\fP characters long -(exclusive of the trailing (chtype)0). -Transfer stops at the end of the current line, or when \fIn\fP characters have -been stored at the location referenced by \fIchstr\fP. -.PP -Constants defined in \fB\fP can be used with the \fB&\fP (logical -AND) operator to extract the character or the attribute alone from any position -in the \fIchstr\fP [see \fBcurs_inch\fP(3X)]. +.B \%winchstr +extracts a +.I curses +character string from a +.I curses +window +.IR win "," +starting at the cursor and stopping at the end of the line, +and stores it in +.IR chstr "," +terminating it with a null +.I curses +character. +.B \%winchnstr +does the same, +but copies at most +.I n +.I curses +characters from +.IR win "." +A negative +.I n +implies no limit; +.B \%winchnstr +then works like +.BR \%winchstr "." +\fB\%ncurses\fP(3X) describes the variants of these functions. .SH RETURN VALUE -All routines return the integer \fBERR\fP upon failure and an integer value -other than \fBERR\fP upon successful completion (the number of characters -retrieved, exclusive of the trailing 0). +These functions return +.B OK +on success and +.B ERR +on failure. .PP -X/Open Curses defines no error conditions. -This implementation returns an error +In +.IR \%ncurses "," +these functions fail if .bP -if the \fIwin\fP parameter is null or +the +.I curses +screen has not been initialized, .bP -if the \fIchstr\fP parameter is null. +(for functions taking a +.I \%WINDOW +pointer argument) +.I win +is a null pointer, +or +.bP +.I chstr +is a null pointer. .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -100,36 +127,72 @@ .IR x ) is outside the window boundaries. .SH NOTES -All routines except \fBwinchnstr\fP may be macros. -.PP -SVr4 does not -document whether the result string is zero-terminated; it does not document -whether a length limit argument includes any trailing 0; and it does not -document the meaning of the return value. +All of these functions except +.B \%winchnstr +may be implemented as macros. .PP Reading a line that overflows the array pointed to by -\fIchstr\fP -with -\fBinchstr\fP, -\fBmvinchstr\fP, -\fBmvwinchstr\fP -or -\fBwinchstr\fP -causes undefined results. -Therefore, the use of -\fBinchnstr\fP, -\fBmvinchnstr\fP, -\fBmvwinchnstr\fP, or -\fBwinchnstr\fP -is recommended. +.I chstr +and its variants causes undefined results. +Instead, +use the +.IR n -infixed +functions with a positive +.I n +argument no larger than the size of the buffer backing +.IR chstr "." +.SH EXTENSIONS +.BR \%inchnstr "," +.BR \%winchnstr "," +.BR \%mvinchnstr "," +and +.BR \%mvwinchnstr "'s" +acceptance of negative +.I n +values is an +.I \%ncurses +extension. .SH PORTABILITY -These functions are described in X/Open Curses, Issue 4. -It is no -more specific than the SVr4 documentation on the trailing 0. -It does specify -that the successful return of the functions is \fBOK\fP. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. +.PP +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +It characterizes the strings stored by these functions as containing +\*(``at most +.I n +elements\*('' from a window, +.\" X/Open Issue 4, Version 2, p. 113, PDF p. 133 +.\" Issue 7 doesn't change this wording at all. +but does not specify whether the string stored by these functions is +null-terminated. +.PP +SVr4 does not document whether it null-terminates the +.I curses +character string it stores +in +.IR chstr "," +and does not document whether a trailing null +.I curses +character counts +toward the length limit +.IR n "." +.PP +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 503 +.SH HISTORY +SVr3.1 (1987) +introduced these functions. .SH SEE ALSO +\fB\%curs_in_wchstr\fP(3X) describes comparable functions of the +.I \%ncurses +library in its wide-character configuration +.RI \%( ncursesw ). +.PP \fB\%curses\fP(3X), \fB\%curs_inch\fP(3X), -\fB\%curs_inwstr\fP(3X), -\fB\%curs_in_wchstr\fP(3X) +\fB\%curs_inwstr\fP(3X) diff --git a/contrib/ncurses/man/curs_initscr.3x b/contrib/ncurses/man/curs_initscr.3x --- a/contrib/ncurses/man/curs_initscr.3x +++ b/contrib/ncurses/man/curs_initscr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_initscr.3x,v 1.69 2024/04/20 21:24:19 tom Exp $ -.TH curs_initscr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_initscr.3x,v 1.112 2025/08/23 22:41:44 tom Exp $ +.TH curs_initscr 3X 2025-08-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -56,205 +56,545 @@ .nf \fB#include .PP -\fBWINDOW *initscr(void); +\fBWINDOW * initscr(void); \fBint endwin(void); .PP \fBbool isendwin(void); .PP -\fBSCREEN *newterm(const char *\fItype\fP, FILE *\fIoutf\fP, FILE *\fIinf\fP); -\fBSCREEN *set_term(SCREEN *\fInew\fP); -\fBvoid delscreen(SCREEN* \fIsp\fP); +\fBSCREEN * newterm(const char * \fItype\fP, FILE * \fIoutf\fP, FILE * \fIinf\fP); +\fBSCREEN * set_term(SCREEN * \fInew\fP); +\fBvoid delscreen(SCREEN * \fIsp\fP); .fi .SH DESCRIPTION .SS initscr -\fBinitscr\fP is normally the first \fBcurses\fP routine to call when -initializing a program. -A few special routines sometimes need to be called before it; -these are \fBslk_init\fP(3X), \fBfilter\fP, \fBripoffline\fP, -\fBuse_env\fP. -For multiple-terminal applications, -\fBnewterm\fP may be called before \fBinitscr\fP. +.B \%initscr +determines the terminal type and initializes the library's +.IR SCREEN "," +.IR WINDOW "," +and other data structures. +It is normally the first +.I curses +function call a program performs. +However, +an application with unusual needs might employ a few other +.I curses +functions beforehand: +.bP +\fB\%slk_init\fP(3X) to set up soft-label keys; +.bP +\fB\%filter\fP(3X) if the program is designed to operate in a process +pipeline; +.bP +\fB\%ripoffline\fP(3X) to reserve up to five lines at the top and/or +bottom of the screen from management by +.BR \%stdscr "," +the standard +.I curses +window; +and +.bP +\fB\%use_env\fP(3X) and/or \fB\%use_tioctl\fP(3X) to configure use of +the process environment and operating system's terminal driver, +respectively, +when determining the dimensions of the terminal display. .PP -The initscr code determines the terminal type and initializes all \fBcurses\fP -data structures. -\fBinitscr\fP also causes the first call to \fBrefresh\fP(3X) -to clear the screen. -If errors occur, \fBinitscr\fP writes an appropriate error -message to standard error and exits; -otherwise, a pointer is returned to \fBstdscr\fP. -.SS newterm -A program that outputs to more than one terminal should use the \fBnewterm\fP -routine for each terminal instead of \fBinitscr\fP. -A program that needs to inspect capabilities, -so it can continue to run in a line-oriented mode if the -terminal cannot support a screen-oriented program, would also use -\fBnewterm\fP. +Further, +a +.I curses +program might call +.B \%newterm +prior to or instead of +.B \%initscr +in two specialized cases described in its subsection below. .PP -The routine \fBnewterm\fP should be called once for each terminal. -It returns a variable of type \fISCREEN *\fP which should be saved -as a reference to that terminal. -\fBnewterm\fP's arguments are +.B \%initscr +causes the first \fB\%refresh\fP(3X) call to clear the screen. +If errors occur, +.B \%initscr +writes an appropriate diagnostic message to the standard error stream +and exits; +otherwise, +it returns a pointer to +.BR stdscr "." +.SS newterm +An application that manages multiple terminals should call +.B \%newterm +once for each such device +.I instead +of +.BR \%initscr "." +.BR \%newterm 's +arguments are .bP -the \fItype\fP of the terminal to be used in place of \fB$TERM\fP, +the +.I type +of the associated terminal, +or a null pointer to use the +.I TERM +environment variable; .bP -an output stream connected to the terminal, and +an output stream +.I outf +connected to the terminal; +and .bP -an input stream connected to the terminal +an input stream +.I inf +connected to the terminal. .PP -If the \fItype\fP parameter is \fBNULL\fP, \fB$TERM\fP will be used. +.B \%newterm +returns a variable of +.RI pointer-to- SCREEN +type, +which should be saved for later use with +.B \%set_term +and +.BR \%delscreen "." .PP -The file descriptor of the output stream is passed to \fBsetupterm\fP(3X), -which returns a pointer to a \fI\%TERMINAL\fP structure. -\fBnewterm\fP's return value holds a pointer to the \fI\%TERMINAL\fP structure. +.B \%newterm +passes the file descriptor of the output stream to the +.I \%term\%info +function \fB\%setupterm\fP(3X), +which returns a pointer to a +.I \%TERMINAL +structure that +.B \%newterm +stores in the +.I SCREEN +it returns to the application. +.PP +An application that needs to inspect a terminal type's capabilities, +so that it can continue to run in a line-oriented mode +if the terminal type does not support capabilities the application +demands, +would also use +.BR \%newterm "." +If at most one terminal connection is needed, +the programmer could perform such a capability test, +decide the mode in which to operate, +then call +.B \%delscreen +on the pointer returned by +.BR \%newterm "," +and proceed with either +.B \%initscr +or a +.RI non- curses +interface. .SS endwin The program must also call -\fBendwin\fP for each terminal being used before exiting from \fBcurses\fP. -If \fBnewterm\fP is called more than once for the same terminal, the first -terminal referred to must be the last one for which \fBendwin\fP is called. +.B \%endwin +for each terminal being used before exiting from +.IR curses "." +If +.B \%newterm +is called more than once for the same terminal, +the first terminal referred to must be the last one for which +.B \%endwin +is called. .PP -A program should always call \fBendwin\fP before exiting or escaping from -\fBcurses\fP mode temporarily. -This routine +A program should always call +.B \%endwin +before exiting the application +or temporarily suspending +.IR curses "'s" +management of the terminal. +.BR \%endwin ":" .bP -resets colors to correspond with the default color pair 0, +(if \fB\%start_color\fP(3X) has been called) +resets the terminal's foreground and background colors +to correspond with those of color pair 0 +(the default pair), .bP moves the cursor to the lower left-hand corner of the screen, .bP -clears the remainder of the line so that it uses the default colors, +(if \fB\%start_color\fP(3X) has been called) +restores the default color pair, +.bP +clears the line, .bP -sets the cursor to normal visibility (see \fBcurs_set\fP(3X)), +sets the cursor to normal visibility +(see \fB\%curs_set\fP(3X)), .bP -stops cursor-addressing mode using the \fIexit_ca_mode\fP terminal capability, +if applicable, +stops cursor-addressing mode using the +.B \%exit_ca_mode +.RB \%( rmcup ) +terminal capability, +and .bP -restores tty modes (see \fBreset_shell_mode\fP(3X)). +restores terminal modes (see \fB\%reset_shell_mode\fP(3X)). .PP -Calling \fBrefresh\fP(3X) or \fBdoupdate\fP(3X) after a -temporary escape causes the program to resume visual mode. +Calling \fB\%refresh\fP(3X) or \fB\%doupdate\fP(3X) after a +temporary suspension causes +.I curses +to resume managing the terminal. .SS isendwin -The \fBisendwin\fP routine returns \fBTRUE\fP if \fBendwin\fP has been -called without any subsequent calls to \fBwrefresh\fP, -and \fBFALSE\fP otherwise. +.B \%isendwin +returns +.B TRUE +if \fB\%wrefresh\fP(3X) +has not been called since the most recent +.B \%endwin +call, +and +.B FALSE +otherwise. .SS set_term -The \fBset_term\fP routine is used to switch between different terminals. -The screen reference \fInew\fP becomes the new current terminal. -The previous terminal is returned by the routine. -This is the only routine which manipulates \fISCREEN\fP pointers; -all other routines affect only the current terminal. +.B \%set_term +re-orients the +.I curses +library's operations to another terminal +when the application has arranged to manage more than one with +.BR \%newterm "." +.B \%set_term +expects a +.I SCREEN +pointer previously returned by +.B \%newterm +as an argument, +and returns the previous one. +.B \%set_term +is the only standard +.I curses +API function that manipulates +.I SCREEN +pointers; +all others affect only the current terminal +(but see \fBcurs_sp_funcs\fP(3X)). .SS delscreen -The \fBdelscreen\fP routine frees storage associated with the -\fISCREEN\fP data structure. -The \fBendwin\fP routine does not do -this, so \fBdelscreen\fP should be called after \fBendwin\fP if a -particular \fISCREEN\fP is no longer needed. +.B \%delscreen +frees the storage backing the supplied +.I SCREEN +pointer argument. +.B \%endwin +does not, +so that an application can resume managing a terminal with +.I curses +after a +(possibly conditional or temporary) +suspension; +see \fB\%curs_kernel\fP(3X). +Use +.B \%delscreen +after +.B \%endwin +when the application has no more need of a terminal device +but will not soon exit. .SH RETURN VALUE -\fBendwin\fP returns the integer \fBERR\fP upon failure and \fBOK\fP -upon successful completion. -.PP -Routines that return pointers always return \fBNULL\fP on error. +.B \%delscreen +returns no value. +.B \%endwin +returns +.B OK +on success and +.B ERR +on failure. +.B \%isendwin +returns +.B TRUE +or +.B FALSE +as described above. .PP -X/Open defines no error conditions. -In this implementation +In +.IR \%ncurses "," .bP -\fBendwin\fP returns an error if +.B \%endwin +returns +.B ERR +if .RS .bP -the terminal was not initialized, or +the terminal was not initialized, .bP -\fBendwin\fP is called more than once without updating the screen, or +it is called more than once without updating the screen, +or .bP -\fBreset_shell_mode\fP(3X) returns an error. +its call of \fB\%reset_shell_mode\fP(3X) returns +.BR ERR ";" +and .RE .bP -\fBnewterm\fP -returns an error if it cannot allocate the data structures for the screen, -or for the top-level windows within the screen, -i.e., -\fBcurscr\fP, \fBnewscr\fP, or \fBstdscr\fP. +.B \%newterm +returns +.B ERR +if it cannot allocate storage for the +.I SCREEN +structure +or the +.I WINDOW +structures automatically associated with it: +.BR \%curscr "," +.BR \%newscr "," +and +.BR \%stdscr "." +.PP +Functions that return pointers return null pointers on error. +In +.IR \%ncurses "," +.B \%set_term +does not fail, +and +.B \%initscr +exits the application if it does not operate successfully. +.SH NOTES +.I \%ncurses +establishes signal handlers when a function that initializes a +.IR SCREEN "," +either +.B \%initscr +or +.BR \%newterm "," +is first called. +Applications that wish to handle the following signals themselves +should set up their corresponding handlers +.I after +initializing the screen. +.TP +.I SIGINT +.IR \%ncurses 's +handler +.I attempts +to clean up the screen on exit. +Although it +.I usually +works as expected, +there are limitations. +.RS .bP -\fBset_term\fP -returns no error. +Walking the +.I SCREEN +list is unsafe, since all list management +is done without any signal blocking. +.bP +When an application has been built with the +.I \%_REENTRANT +macro defined +(and corresponding system support), +.B \%set_term +uses functions that could deadlock or misbehave in other ways. +.bP +.B \%endwin +calls other functions, +many of which use \fI\%stdio\fP(3) or other library functions that are +clearly unsafe. +.RE +.TP +.I SIGTERM +.I \%ncurses +uses the same handler as for +.IR \%SIGINT "," +with the same limitations. +It is not mentioned in X/Open Curses, +but is more suitable for this purpose than +.I \%SIGQUIT +(which is used in debugging). +.TP +.I SIGTSTP +.IR \%ncurses 's +handler manages the terminal-generated stop signal, +used in job control. +When resuming the process, +.I \%ncurses +discards pending input with \fB\%flushinp\fP(3X) +and repaints the screen, +assuming that it has been completely altered. +It also updates the saved terminal modes with +\fB\%def_shell_mode\fP(3X). +.TP +.I SIGWINCH +.I \%ncurses +handles changes to the terminal's window size, +a phenomenon ignored in standardization efforts. +It sets a (signal-safe) variable +that is later tested by \fB\%wgetch\fP(3X) and \fB\%wget_wch\fP(3X). +.RS +.bP +.B \%wgetch +returns the key code +.BR \%KEY_RESIZE "." +.bP +.B \%wget_wch +returns +.B \%KEY_CODE_YES +and sets its +.I wch +parameter to +.BR \%KEY_RESIZE "." +.RE +.IP +At the same time, +.I \%ncurses +calls \fB\%resizeterm\fP(3X) +to adjust the standard screen +.B \%stdscr +and update global variables such as +.B LINES +and +.BR COLS "." .SH PORTABILITY -These functions were described in X/Open Curses, Issue 4. -As of 2015, the current document is X/Open Curses, Issue 7. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. .SS Differences X/Open Curses specifies that portable applications must not -call \fBinitscr\fP more than once: +call +.I \%initscr +more than once. .bP -The portable way to use \fBinitscr\fP is once only, -using \fB\%refresh\fP(3X) -to restore the screen after \fBendwin\fP. +The portable way to use +.I \%initscr +is once only, +using +.I \%refresh +to restore the screen after +.IR \%endwin "." .bP -This implementation allows using \fBinitscr\fP after \fBendwin\fP. +.I \%ncurses +permits use of +.I \%initscr +after +.IR \%endwin "." .PP -Old versions of curses, e.g., BSD 4.4, would return a null pointer -from \fBinitscr\fP when an error is detected, rather than exiting. -It is safe but redundant to check the return value of \fBinitscr\fP +.I \%initscr +in BSD, +from its inception (1980) through the Net/2 release (1991) returned +.I ERR +cast to a +.I \%WINDOW +pointer when detecting an error. +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/libcurses/initscr.c +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=Net2/usr/src/lib/libcurses/initscr.c +4.4BSD (1995) +instead returned a null pointer. +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/src/lib/libcurses/initscr.c +Neither exited the application. +It is safe but redundant to check the return value of +.I \%initscr in X/Open Curses. .PP -Calling \fBendwin\fP does not dispose of the memory allocated in \fBinitscr\fP -or \fBnewterm\fP. -Deleting a \fISCREEN\fP provides a way to do this: +Calling +.I \%endwin +does not dispose of the memory allocated by +.I \%initscr +or +.IR \%newterm "." +Deleting a +.I SCREEN +provides a way to do this. .bP -X/Open Curses does not say what happens to \fI\%WINDOW\fPs when \fBdelscreen\fP -\*(``frees storage associated with the \fISCREEN\fP\*('' +X/Open Curses does not say what happens to +.IR \%WINDOW s +when +.I \%delscreen +\*(``frees storage associated with the +.IR SCREEN "\*(''" nor does the SVr4 documentation help, -adding that it should be called after \fBendwin\fP if a \fISCREEN\fP +adding that it should be called after +.I \%endwin +if a +.I SCREEN is no longer needed. .bP -However, \fI\%WINDOW\fPs are implicitly associated with a \fISCREEN\fP. -so that it is reasonable to expect \fBdelscreen\fP to deal with these. +However, +every +.I \%WINDOW +is implicitly associated with a +.IR SCREEN "," +so it is reasonable to expect +.I \%delscreen +to dispose of them. .bP -SVr4 curses deletes the standard \fI\%WINDOW\fP structures -\fBstdscr\fP and \fBcurscr\fP as well as a work area \fBnewscr\fP. -SVr4 curses ignores other windows. +SVr4 deletes the standard +.I \%WINDOW +structures +.I \%stdscr +and +.I \%curscr +as well as a work area +.IR \%newscr "." +It ignores other windows. .bP Since version 4.0 (1996), -\fI\%ncurses\fP has maintained a list of all windows for each screen, -using that information to delete those windows when \fBdelscreen\fP is called. -.bP -NetBSD copied this feature of \fI\%ncurses\fP in 2001. -PDCurses follows the SVr4 model, -deleting only the standard \fI\%WINDOW\fP structures. -.SS "High-level versus Low-level" -Different implementations may disagree regarding the level of some functions. -For example, \fISCREEN\fP (returned by \fBnewterm\fP) and -\fI\%TERMINAL\fP (returned by \fBsetupterm\fP(3X)) hold file descriptors for -the output stream. -If an application switches screens using \fBset_term\fR, -or switches terminals using \fBset_curterm\fP(3X), -applications which use the output file descriptor can have different -behavior depending on which structure holds the corresponding descriptor. -.PP -For example +.I \%ncurses +has maintained a list of all windows for each screen, +using that information to delete those windows when +.I \%delscreen +is +called. +.bP +NetBSD copied this feature of +.I \%ncurses +in 2001. +.I \%PDCurses +follows the SVr4 model, +deleting only the standard +.I \%WINDOW +structures and +.IR \%newscr "." +.SS "High-level versus Low-level Functions" +Implementations disagree +regarding the level of abstraction applicable to a function or property. +For example, +.I SCREEN +(returned by +.IR \%newterm ")" +and +.I \%TERMINAL +(returned by \fB\%setupterm\fP(3X)) hold file +descriptors for the output stream. +If an application switches screens using +.IR \%set_term "," +or switches terminals using \fB\%set_curterm\fP(3X), +applications +using the output file descriptor can behave differently +depending on the structure holding the corresponding descriptor. .bP -NetBSD's \fBbaudrate\fP(3X) function uses the descriptor in \fI\%TERMINAL\fP. -\fI\%ncurses\fP and SVr4 use the descriptor in \fISCREEN\fP. +NetBSD's +.I \%baudrate +function uses the descriptor in +.IR \%TERMINAL "." +.I \%ncurses +and SVr4 use the descriptor in +.IR SCREEN "." .bP -NetBSD and \fI\%ncurses\fP use the descriptor -in \fI\%TERMINAL\fP +NetBSD and +.I \%ncurses +use the descriptor +in +.I \%TERMINAL for terminal I/O modes, e.g., -\fBdef_shell_mode\fP(3X), -\fBdef_prog_mode\fP(3X). -SVr4 curses uses the descriptor in \fISCREEN\fP. -.SS "Unset \fITERM\fP Variable" -If the \fITERM\fP variable is missing or empty, \fBinitscr\fP uses the -value \*(``unknown\*('', -which normally corresponds to a terminal entry with the \fIgeneric\fP -(\fIgn\fP) capability. -Generic entries are detected by \fBsetupterm\fP(3X) +\fB\%def_shell_mode\fP(3X), +\fB\%def_prog_mode\fP(3X). +SVr4 uses the descriptor in +.IR SCREEN "." +.SS "Unset \fITERM\fP Environment Variable" +If the +.I TERM +variable is not set in the environment or has an empty value, +.I \%initscr +uses the value \*(``unknown\*('', +which normally corresponds to a terminal entry with the +.B \%generic +.RB ( gn ) +capability. +Generic entries are detected by \fB\%setupterm\fP(3X) and cannot be used for full-screen operation. Other implementations may handle -a missing/empty \fITERM\fP variable differently. +a missing or empty +.I TERM +variable differently. .SS "Signal Handlers" -Quoting from X/Open Curses Issue 7, section 3.1.1: +Quoting X/Open Curses Issue\ 7, +section 3.1.1: .RS 5 .PP Curses implementations may provide for special handling of the \%SIGINT, \%SIGQUIT, and \%SIGTSTP signals if their disposition is \%SIG_DFL at the time -.I \%initscr +.IR \%initscr () is called.\|.\|. .PP Any special handling for these signals may remain in effect for the @@ -265,50 +605,27 @@ with respect to signals.\|.\|. .RE .PP -This implementation establishes signal handlers during initialization, -e.g., \fBinitscr\fP or \fBnewterm\fP. -Applications which must handle these signals should set up the corresponding -handlers \fIafter\fP initializing the library: -.TP 5 -.B SIGINT -The handler \fIattempts\fP to clean up the screen on exit. -Although it \fIusually\fP works as expected, there are limitations: -.RS 5 -.bP -Walking the \fISCREEN\fP list is unsafe, since all list management -is done without any signal blocking. -.bP -On systems which have \fBREENTRANT\fP turned on, \fBset_term\fP uses -functions which could deadlock or misbehave in other ways. -.bP -\fBendwin\fP calls other functions, -many of which use \fI\%stdio\fP(3) or other library functions which are -clearly unsafe. -.RE -.TP 5 -.B SIGTERM -This uses the same handler as \fBSIGINT\fP, with the same limitations. -It is not mentioned in X/Open Curses, but is more suitable for this -purpose than \fBSIGQUIT\fP (which is used in debugging). -.TP 5 -.B SIGTSTP -This handles the \fIstop\fP signal, used in job control. -When resuming the process, this implementation discards pending -input with \fB\%flushinp\fP(3X), and repaints the screen -assuming that it has been completely altered. -It also updates the saved terminal modes with -\fB\%def_shell_mode\fP(3X). -.TP 5 -.B SIGWINCH -This handles the window-size changes which were ignored in -the standardization efforts. -The handler sets a (signal-safe) variable -which is later tested in \fB\%wgetch\fP(3X). -If \fBkeypad\fP has been enabled for the corresponding window, -\fBwgetch\fP returns the key symbol \fBKEY_RESIZE\fP. -At the same time, \fBwgetch\fP calls \fBresizeterm\fP to adjust the -standard screen \fBstdscr\fP, -and update other data such as \fBLINES\fP and \fBCOLS\fP. +Section \*(``NOTES\*('' above discusses +.IR \%ncurses 's +signal handlers. +.SH HISTORY +4BSD (1980) +introduced +.I \%initscr +and +.IR \%endwin "." +.PP +SVr2 (1984) +added +.I \%newterm +and +.IR \%set_term "." +.PP +SVr3.1 (1987) +supplied +.I \%delscreen +and +.IR \%isendwin "." .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_kernel\fP(3X), diff --git a/contrib/ncurses/man/curs_inopts.3x b/contrib/ncurses/man/curs_inopts.3x --- a/contrib/ncurses/man/curs_inopts.3x +++ b/contrib/ncurses/man/curs_inopts.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_inopts.3x,v 1.66 2024/04/13 22:20:29 tom Exp $ -.TH curs_inopts 3X 2024-04-13 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_inopts.3x,v 1.116 2025/10/04 20:15:02 tom Exp $ +.TH curs_inopts 3X 2025-10-04 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -40,6 +40,11 @@ .ie t .ds '' '' .el .ds '' "" .\} +. +.de bP +.ie n .IP \(bu 4 +.el .IP \(bu 2 +.. .SH NAME \fB\%cbreak\fP, \fB\%echo\fP, @@ -75,24 +80,24 @@ \fBint echo(void); \fBint noecho(void); .PP -\fBint intrflush(WINDOW *\fIwin\fP, bool \fIbf\fP); -\fBint keypad(WINDOW *\fIwin\fP, bool \fIbf\fP); -\fBint meta(WINDOW *\fIwin\fP, bool \fIbf\fP); -\fBint nodelay(WINDOW *\fIwin\fP, bool \fIbf\fP); -\fBint notimeout(WINDOW *\fIwin\fP, bool \fIbf\fP); +\fBint intrflush(WINDOW * \fIwin\fP \fI/* ignored */\fP, bool \fIbf\fP); +\fBint keypad(WINDOW * \fIwin\fP, bool \fIbf\fP); +\fBint meta(WINDOW * \fIwin\fP \fI/* ignored */\fP, bool \fIbf\fP); +\fBint nodelay(WINDOW * \fIwin\fP, bool \fIbf\fP); +\fBint notimeout(WINDOW * \fIwin\fP, bool \fIbf\fP); .PP \fBint nl(void); \fBint nonl(void); .PP -\fBint raw(void); -\fBint noraw(void); -.PP \fBvoid qiflush(void); \fBvoid noqiflush(void); .PP +\fBint raw(void); +\fBint noraw(void); +.PP \fBint halfdelay(int \fItenths\fP); \fBvoid timeout(int \fIdelay\fP); -\fBvoid wtimeout(WINDOW *\fIwin\fP, int \fIdelay\fP); +\fBvoid wtimeout(WINDOW * \fIwin\fP, int \fIdelay\fP); .PP \fBint typeahead(int \fIfd\fP); .PP @@ -103,287 +108,552 @@ \fBint is_raw(void); .fi .SH DESCRIPTION -.I \%ncurses -provides several functions that let an application change the way input -from the terminal is handled. -Some are global, -applying to all windows. -Others apply only to a specific window. -Window-specific settings are not automatically applied to new or derived -windows. -An application must apply these to each window if the same behavior is -desired. +.I curses +offers configurable parameters permitting an application to control the +handling of input from the terminal. +Some, +such as those affecting the terminal's +.I mode +or line discipline, +are global, +applying to all windows; +others apply only to a specific window. +The library does not automatically apply such parameters to new or +derived windows; +an application must configure each window for the desired behavior. +.PP +Some descriptions below make reference to an +.IR "input character reading function" ":" +this is \fB\%wgetch\fP(3X) in the non-wide character +.I curses +API and \fB\%wget_wch\fP(3X) in the wide character API. +In addition to the variant forms of these described in +\fB\%ncurses\fP(3X), +the +.I curses +functions \fB\%wgetstr\fP(3X) and \fB\%wget_wstr\fP(3X) and their own +variants call the appropriate input character reading function. .\" .SS "cbreak, nocbreak" Normally, -the terminal driver buffers typed characters until a newline or carriage -return is typed. -The \fB\%cbreak\fP routine disables line buffering and -erase/kill character-processing -(interrupt and flow control characters are unaffected), -making characters typed by the user immediately available to the +the terminal driver buffers typed characters, +not delivering them to an application +until a line feed or carriage return is typed. +This canonical (\*(``cooked\*('') line discipline also supports +software flow control, +simple line editing functions +(character and word erase, +and whole-line erasure or \*(``kill\*(''), +and job control. +.B \%cbreak +configures the terminal in +.IR "cbreak mode" "," +which disables line buffering +and erase and kill character processing \(em +the interrupt, +quit, +suspend, +and flow control characters are unaffected \(em +and makes characters typed by the user immediately available to the program. -The \fB\%nocbreak\fP routine returns the terminal to normal (cooked) -mode. +.B \%nocbreak +restores canonical (\*(``cooked\*('') mode. .PP -Initially the terminal may or may not be in \fB\%cbreak\fP mode, -as the mode is inherited; +The state of the terminal is unknown to a +.I curses +application when it starts; therefore, -a program should call \fB\%cbreak\fP or \fB\%nocbreak\fP explicitly. +a program should call +.B \%cbreak +or +.B \%nocbreak +explicitly. Most interactive programs using .I curses -set the \fB\%cbreak\fP mode. -Note that \fB\%cbreak\fP overrides \fBraw\fP. -[See \fB\%curs_getch\fP(3X) for a discussion of how these routines -interact with \fBecho\fP and \fB\%noecho\fP.] +set \%cbreak +mode. +Calling +.B \%cbreak +overrides +.BR raw "." +The man page for the input character reading function +discusses how +.B \%cbreak +and +.B \%nocbreak +interact with +.B echo +and +.BR \%noecho "." .\" .SS "echo, noecho" -The \fBecho\fP and \fB\%noecho\fP routines control whether characters -typed by the user are echoed by \fB\%getch\fP(3X) as they are typed. -Echoing by the terminal driver is always disabled, -but initially \fB\%getch\fP is in echo mode, -so characters typed are echoed. -Authors of most interactive programs prefer to do -their own echoing in a controlled area of the screen, +.B echo +and +.B \%noecho +determine whether characters typed by the user are written to the +.I curses +window by the input character reading function as they are typed. +.I curses +always disables the terminal driver's own echoing. +By default, +a +.I curses +screen's echo option is set. +Authors of most interactive programs prefer +to do their own echoing in a controlled area of the screen, or not to echo at all, -so they disable echoing by calling \fB\%noecho\fP. -[See \fB\%curs_getch\fP(3X) for a -discussion of how these routines interact with \fB\%cbreak\fP and -\fB\%nocbreak\fP.] +so they call +.BR \%noecho "." +The man page for the input character reading function +discusses how +.B echo +and +.B \%noecho +interact with +.B \%cbreak +and +.BR \%nocbreak "." .\" .SS halfdelay -The \fB\%halfdelay\fP routine is used for half-delay mode, -which is similar to \fB\%cbreak\fP mode in that characters typed by the -user are immediately available to the program. +.B \%halfdelay +configures +.IR "half-delay mode" "," +which is similar to \%cbreak mode in that characters typed by the user +are immediately available to the program. However, -after blocking for \fItenths\fP tenths of seconds, -\fBERR\fP is returned if nothing has been typed. -The value of \fItenths\fP must be a number between 1 and 255. -Use \fB\%nocbreak\fP to leave half-delay mode. +after blocking for +.I tenths +tenth-seconds, +an input character reading function returns +.B ERR +if no input is pending. +The value of +.I tenths +must be between 1 and 255. +Use +.B \%nocbreak +to leave half-delay mode. .\" .SS intrflush -If the \fB\%intrflush\fP option is enabled -.RI ( bf +.B \%intrflush +calls +.B \%qiflush +(see below) +if +.I bf is -.BR TRUE ), -and an interrupt key is pressed on the keyboard -(interrupt, -break, -quit), -all output in the terminal driver queue is flushed, -giving the effect of faster response to the interrupt, -but causing -.I curses -to have the wrong idea of what is on the screen. -Disabling the option -.RI ( bf +.BR TRUE "," +and +.B \%noqiflush +if +.I bf is -.BR FALSE ), -prevents the flush. -The default for the option is inherited from the terminal driver -settings. -The +.BR FALSE "." +It ignores its .I win -argument is ignored. +argument. .\" .SS keypad -The \fB\%keypad\fP option enables the keypad of the user's terminal. +.B keypad +enables recognition of a terminal's function keys. If enabled .RI ( bf is -.BR TRUE ), -the user can press a function key -(such as an arrow key) -and \fB\%wgetch\fP(3X) returns a single value representing the function -key, -as in \fB\%KEY_LEFT\fP. +.BR TRUE ")" +then when an input character reading function reads ESC, +it waits for further input corresponding to an escape sequence +defined by the terminal type description. +If a valid sequence populates the input stream, +the input character reading function +returns a value representing the function key, +such as +.BR KEY_LEFT "." +(Wide-character API users: +\fB\%wget_wch\fP(3X) returns +.B \%KEY_CODE_YES +to indicate the availability of a function key code in its +.I wch +parameter.) +If the sequence is invalid, +the input character reading function returns only its last character. If disabled -(\fIbf\fP is \fBFALSE\fP), +.RI ( bf +is +.BR FALSE ), .I curses does not treat function keys specially and the program has to interpret -the escape sequences itself. -If the keypad in the terminal can be turned on -(made to transmit) -and off -(made to work locally), -turning on this option causes the terminal keypad to be turned on when -\fB\%wgetch\fP(3X) is called. -The default value for keypad is \fBFALSE\fP. +escape sequences itself. +If the terminal type description defines the +.B \%keypad_local +.RB ( rmkx ) +and +.B \%keypad_xmit +.RB ( smkx ) +capabilities, +enabling a window's keypad mode +sets the terminal's keypad to transmit, +and disabling keypad mode +sets the terminal's keypad to work locally. +By default, +a window's keypad mode is off. .\" .SS meta Initially, -whether the terminal returns 7 or 8 significant bits on input depends on -the control mode of the terminal driver [see \fI\%termios\fP(3)]. +whether the terminal returns 7- or 8-bit character codes on input +depends on the configuration of the terminal driver; +on POSIX systems, +see \fI\%termios\fP(3). To force 8 bits to be returned, -invoke -\fBmeta\fP(\fIwin\fP, \fBTRUE\fP); +call +.BR meta( .\|.\|. , +.BR TRUE) ; this is equivalent, -under POSIX, +on POSIX systems, to setting the CS8 flag on the terminal. To force 7 bits to be returned, -invoke -\fBmeta\fP(\fIwin\fP, \fBFALSE\fP); +call +.BR meta( .\|.\|. , +.BR FALSE) ; this is equivalent, -under POSIX, +on POSIX systems, to setting the CS7 flag on the terminal. -The window argument, -.IR win , -is always ignored. -If the terminfo capabilities -\fBsmm\fP (meta_on) and -\fBrmm\fP (meta_off) are defined for the terminal, -\fBsmm\fP is sent to the terminal when -\fBmeta\fP(\fIwin\fP, \fBTRUE\fP) -is called and \fBrmm\fP is sent when -\fBmeta\fP(\fIwin\fP, \fBFALSE\fP) is called. +.I curses +ignores the window argument +.IR win "." +If the +.I \%term\%info +string capabilities +.B \%meta_on +.RB ( smm ) +and +.B \%meta_off +.RB ( rmm ) +are defined for the terminal type, +enabling meta mode sends +.BR smm 's +value to the terminal and disabling it sends that of +.B rmm +to the terminal. .\" .SS "nl, nonl" -The \fBnl\fP and \fBnonl\fP routines control whether the underlying -display device translates the return key into newline on input. +Initially, +whether the terminal reports a carriage return +using the character code for a line feed +in cbreak or raw modes +depends on the configuration of the terminal driver; +see \fI\%termios\fP(3). +.B nl +configures the terminal to perform this translation. +.B nonl +disables it. +Under its canonical (\*(``cooked\*('') line discipline, +the terminal driver always translates carriage returns to line feeds. .\" .SS nodelay -The \fB\%nodelay\fP option causes \fB\%getch\fP to be a non-blocking -call. +.B \%nodelay +configures the input character reading function to be non-blocking for +window +.IR "win" . If no input is ready, -\fB\%getch\fP returns \fBERR\fP. +the reading function returns +.BR ERR "." If disabled .RI ( bf is .BR FALSE ), -\fB\%getch\fP waits until a key is pressed. +the reading function does not return until it has input. .SS notimeout -When interpreting an escape sequence, -\fB\%wgetch\fP(3X) sets a timer -while waiting for the next character. -If -\fB\%notimeout(\fIwin\fR, \fBTRUE\fP) -is called, -then \fB\%wgetch\fP does not set a timer. +When +.B \%keypad +has been called on a window +and the input character reading function reads an ESC character from it, +.I curses +sets a timer while waiting for the next character. +If the timer elapses, +.I curses +interprets the ESC as an explicit press of the terminal's Escape key +(or equivalent). +.\" like Control+[ +.BI \%notimeout( win , +.B TRUE) +disables this timer. The purpose of the timeout is to distinguish sequences produced by a function key from those typed by a user. +If this timer is disabled, +.I curses +waits forever for subsequent keystrokes +until it determines the escape sequence to be valid or invalid. +.\" +.SS "qiflush, noqiflush" +.\" +.B \%qiflush +and +.B \%noqiflush +configure the terminal driver's treatment of its input and output queues +when it handles the interrupt, +suspend, +or quit characters under the canonical (\*(``cooked\*('') +or cbreak line disciplines on POSIX systems; +see \fI\%termios\fP(3). +The default behavior is inherited from the terminal driver settings. +Calling +.B \%qiflush +configures the terminal to +.I flush +the queues +(discarding their contents) +when any of these events occurs, +giving the impression of faster response to user input, +but making the library's model of the screen contents incorrect. +Calling +.B \%noqiflush +prevents such flushing, +but might frustrate impatient users on slow connections if a +.I curses +update of the screen is in progress when the event occurs; +see +.B \%typeahead +below for a mitigation of this problem. +You may want to call +.B \%noqiflush +in a signal handler if, +after the handler exits, +you want output to continue +as though the signal had not occurred. .\" .SS "raw, noraw" -The \fBraw\fP and \fB\%noraw\fP routines place the terminal into or out -of raw mode. -Raw mode is similar to \fB\%cbreak\fP mode, -in that characters typed are immediately passed through to the user -program. -The differences are that in raw mode, -the interrupt, +.B raw +configures the terminal to read input in +.IR "raw mode" , +which is similar to cbreak mode +(see +.B \%cbreak +above) +except that it furthermore passes through the terminal's configured +interrupt, quit, suspend, -and flow control characters are all -passed through uninterpreted, -instead of generating a signal. -The behavior of the BREAK key depends on other bits in the terminal -driver that are not set by -.IR curses . -.\" -.SS "qiflush, nqiflush" -When the \fB\%noqiflush\fP routine is used, -normal flush of input and output queues associated with the \fBINTR\fP, -\fBQUIT\fP and \fBSUSP\fP characters will not be done -[see \fB\%termios\fP(3)]. -When -\fB\%qiflush\fP is called, -the queues will be flushed when these control characters are read. -You may want to call \fB\%noqiflush\fP in a signal handler if you want -output to continue as though the interrupt had not occurred, -after the handler exits. +and flow control characters +uninterpreted to the application, +instead of generating a signal or acting on I/O flow. +The behavior of the terminal's \*(``Break\*('' key +(if any) +depends on terminal driver configuration parameters that +.I curses +does not handle. +.B \%noraw +restores the terminal's canonical (\*(``cooked\*('') line discipline. .\" .SS "timeout, wtimeout" -The \fB\%timeout\fP and \fB\%wtimeout\fP routines set blocking or -non-blocking read for a given window. -If \fIdelay\fP is negative, -a blocking read is used -(i.e., -waits indefinitely for input). -If \fIdelay\fP is zero, -then a non-blocking read is used -(i.e., -.I read -returns \fBERR\fP if no input is waiting). +.B \%wtimeout +configures whether a +.I curses +input character reading function called on window +.I win +uses blocking or non-blocking reads. If -\fIdelay\fP is positive, -then -.I read -blocks for \fIdelay\fP milliseconds, -and returns \fBERR\fP if there is still no input. -Hence, -these routines provide the same functionality as \fB\%nodelay\fP, -plus the additional capability of being able to block for only -\fIdelay\fP milliseconds -(where \fIdelay\fP is positive). +.I delay +is negative, +.I curses +uses a blocking read, +waiting indefinitely for input. +If +.I delay +is zero, +the read is non-blocking; +an input character reading function returns +.B ERR +if no input is pending. +If +.I delay +is positive, +an input character reading function +blocks for +.I delay +milliseconds, +and returns +.B ERR +if the delay elapses and there is still no input pending. +.B \%timeout +calls +.B \%wtimeout +on +.BR stdscr "." .\" .SS typeahead -.I curses -does \*(``line-breakout optimization\*('' by looking for typeahead -periodically while updating the screen. -If input is found, -and it is coming from a terminal, -the current update is postponed until -\fB\%refresh\fP(3X) or \fB\%doupdate\fP is called again. -This allows faster response to commands typed in advance. Normally, -the input +a +.I curses +library checks the terminal's input file descriptor for activity +with \fIpoll\fP(2) or \fI\%select\fP(2) +while updating the screen; +if it finds any, +it postpones output +until the next \fB\%wrefresh\fP(3X) or \fB\%doupdate\fP(3X) call, +allowing faster response to user key strokes. +The library tests the file descriptor corresponding to the .I FILE -pointer passed to \fB\%newterm\fP, -or \fBstdin\fP in the case that \fB\%initscr\fP was used, -will be used to do this typeahead checking. -The \fB\%typeahead\fP routine specifies that the file descriptor -\fIfd\fP is to be used to check for typeahead instead. -If \fIfd\fP is -\-1, -then no typeahead checking is done. +stream pointer passed to \fB\%newterm\fP(3X) +(or +.I stdin +if \fB\%initscr\fP(3X) was called), +for pending input. +.B \%typeahead +instructs +.I curses +to test file descriptor +.I fd +instead. +An +.I fd +of +.B \-1 +disables the check. .\" .SH RETURN VALUE -All routines that return an integer return \fBERR\fP upon failure and -\fBOK\fP -(SVr4 specifies only \*(``an integer value other than \fBERR\fP\*('') -upon successful completion, -unless otherwise noted in the preceding routine descriptions. +.B \%timeout +and +.B \%wtimeout +return no value. +.PP +.BR \%cbreak "," +.BR \%nocbreak "," +.BR \%echo "," +.BR \%noecho "," +.BR \%halfdelay "," +.BR \%intrflush "," +.BR \%keypad "," +.BR \%meta "," +.BR \%nodelay "," +.BR \%notimeout "," +.BR \%nl "," +.BR \%nonl "," +.BR \%raw "," +.BR \%noraw "," +and +.B \%typeahead +return +.B OK +on success and +.B ERR +on failure. +.PP +In +.IR \%ncurses "," +the functions in the previous paragraph return +.B ERR +if +.bP +the library's +.I \%TERMINAL +structure for the device has not been initialized with +\fB\%initscr\fP(3X), +\fB\%newterm\fP(3X), +or +\fB\%setupterm\fP(3X), +or +.bP +.I win +is a null pointer +(except with +.B \%intrflush +and +.BR meta "," +which ignore its value). +.PP +Further, +.B \%halfdelay +returns +.B ERR +if +.I delay +is outside the range 1..255. .PP -X/Open Curses does not specify any error conditions. -In this implementation, -functions with a window parameter will return an error if it is null. -Any function will also return an error if the terminal was not -initialized. -Also, -.RS 3 -.TP 5 -\fB\%halfdelay\fP -returns an error -if its parameter is outside the range 1..255. -.RE +See section \*(``EXTENSIONS\*('' below for the +return values of +.BR is_cbreak "," +.BR is_echo "," +.BR is_nl "," +and +.BR is_raw "." .SH NOTES -\fBecho\fP, -\fB\%noecho\fP, -\fB\%halfdelay\fP, -\fB\%intrflush\fP, -\fBmeta\fP, -\fBnl\fP, -\fBnonl\fP, -\fB\%nodelay\fP, -\fB\%notimeout\fP, -\fB\%noqiflush\fP, -\fB\%qiflush\fP, -\fB\%timeout\fP, +.BR echo "," +.BR \%noecho "," +.BR \%halfdelay "," +.BR \%intrflush "," +.BR meta "," +.BR nl "," +.BR nonl "," +.BR \%nodelay "," +.BR \%notimeout "," +.BR \%noqiflush "," +.BR \%qiflush "," +.BR \%timeout "," and -\fB\%wtimeout\fP +.B \%wtimeout may be implemented as macros. .PP -\fB\%noraw\fP and \fB\%nocbreak\fP follow historical practice in that -they attempt to restore normal (\*(``cooked\*('') mode -from raw and cbreak modes respectively. -Mixing \fBraw\fP/\fB\%noraw\fP and \fB\%cbreak\fP/\fB\%nocbreak\fP calls -leads to terminal driver control states that are hard to predict or -understand; +.B \%noraw +and +.B \%nocbreak +follow historical practice in that they attempt to restore +the terminal's canonical (\*(``cooked\*('') line discipline +from raw and cbreak, +respectively. +Mixing +.BR \%raw / noraw +calls with +.BR \%cbreak / nocbreak +calls leads to terminal driver control states that are hard to predict +or understand; doing so is not recommended. +.PP +.I curses +documentation uses the terms \*(``delay\*('' and \*(``timeout\*('' +freely to describe two related but distinct aspects of input handling, +at the risk of confusing the user. +The functions +.BR \%halfdelay "," +.BR \%nodelay "," +.BR \%timeout "," +and +.B \%wtimeout +configure whether the input character reading function +\%(\fBwgetch\fP(3X) or \fB\%wget_wch\fP(3X)) +waits for keyboard input to begin, +and for how long. +.B \%keypad +configures whether that function waits for further input +if the first character it reads is ESC. +Calling +.BR \%notimeout "," +which has nothing to do with +.B \%timeout +or +.BR \%wtimeout "," +makes this delay in expectation of further characters +effectively infinite. +X/Open Curses affords no means of otherwise configuring +the length of this second delay, +but an AIX and +.I \%ncurses +extension, +.BR \%ESCDELAY , +is available both as an environment variable and a global symbol +permitting the user and application, +respectively, +to do so; +see \fB\%ncurses\fP(3X) and \fB\%curs_variables\fP(3X). .SH EXTENSIONS .I \%ncurses -provides four \*(``is_\*('' functions that may be used to detect if the -corresponding flags were set or reset. +provides four \*(``is_\*('' functions corresponding to +.BR \%cbreak "," +.BR echo "," +.BR nl "," +and +.BR raw "," +permitting their states to be queried by the application. .PP .TS center; @@ -399,26 +669,18 @@ .PP In each case, the function returns -.TP 4 \" "-1" + 2n -1 -if the flag is set, +.TP 5 \" "-1" + 2n tag separation + 1n fudge for typesetters like grops +.B 1 +if the option is set, .TP -0 -if the flag is reset, +.B 0 +if the option is unset, or .TP -\-1 -if the library is not initialized. -.PP -They were designed for -\fB\%ncurses\fP(3X), -and are not found in SVr4 -.IR curses , -4.4BSD -.IR curses , -or any other previous -.I curses -implementation. +.B \-1 +if the library's +.I \%TERMINAL +structure for the device has not been initialized. .SH PORTABILITY Applications employing .I \%ncurses @@ -427,33 +689,54 @@ preprocessor macro. .PP Except as noted in section \*(``EXTENSIONS\*('' above, -X/Open Curses, Issue 4, Version 2 describes these functions. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.PP +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 508 +.\" It continues "unless otherwise noted in the preceding routine +.\" descriptions", but no notes otherwise are present; the man page +.\" discusses getch()'s return value repeatedly, but never those of the +.\" functions the page ostensibly documents. .PP .I \%ncurses follows X/Open Curses -and the historical practice of AT&T -.I curses -implementations, -in that the echo bit is cleared when -.I curses -initializes the terminal state. +and the historical practice of System\ V +.IR curses "," +clearing the terminal driver's \*(``echo\*('' flag when initializing the +screen. BSD .I curses -differed from this slightly; -it left the echo bit on at initialization, -but the BSD \fBraw\fP call turned it off as a side effect. +did not, +but its +.I raw +function turned it off as a side effect. +.\" SGTTY's sg_flags had a "RAW" symbol; termio in SVr1 for the PDP-11 +.\" did not. +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/include/curses.h +.\" https://github.com/ryanwoodsmall/oldsysv/blob/master/sysv-pdp11_man/a_man/man7/termio.7 For best portability, -set \fBecho\fP or \fB\%noecho\fP explicitly just after initialization, -even if your program remains in cooked mode. +call +.I echo +or +.I \%noecho +explicitly just after initialization, +even if your program retains the terminal's canonical (\*(``cooked\*('') +line discipline. .PP -X/Open Curses is ambiguous regarding whether \fBraw\fP should disable -the CR/LF translations controlled by \fBnl\fP and \fBnonl\fP. +X/Open Curses is ambiguous regarding whether +.I raw +should disable the carriage return and line feed translation feature +controlled by +.I nl +and +.IR \%nonl "." BSD .I curses -did turn off these translations; -AT&T +turned off these translations; +System\ V .I curses -(at least as late as SVr1) did not. .I \%ncurses does so, @@ -462,65 +745,124 @@ 8-bit clean) connection that the operating system will not alter. .PP -When \fB\%keypad\fP is first enabled, +When +.B \%keypad +is first enabled for a window, .I \%ncurses -loads the key definitions for the current terminal description. -If the terminal description includes extended string capabilities, -e.g., -from using the +loads the standard function key string capabilities +for the terminal type description of its screen; +see the entries beginning with \*(``key_\*('' in \fB\%terminfo\fP(5). +If that description includes extended string capabilities, +produced by the .B \-x -option of \fB\%@TIC@\fP, +option of \fB\%@TIC@\fP(1), +for example, then .I \%ncurses -also defines keys for the capabilities whose names begin with +also defines keys for the capabilities whose codes begin with \*(``k\*(''. -The corresponding keycodes are generated and -(depending on previous loads of terminal descriptions) -may differ from one execution of a program to the next. -The generated keycodes are recognized by the \fB\%keyname\fP(3X) -function -(which will then return a name beginning with \*(``k\*('' denoting the -terminfo capability name rather than \*(``K\*('', +.I \%ncurses +generates a numeric key code for each such extended capability; +depending on previous loads of terminal type descriptions, +these may differ from one execution of a program to the next. +\fB\%keyname\fP(3X) recognizes the generated key codes +and returns a name beginning with \*(``k\*('' denoting the +.I \%term\%info +capability name rather than \*(``KEY_\*('', used for .I curses -key names). +key names. On the other hand, -an application can use \fB\%define_key\fP(3X) to establish -a specific keycode for a given string. -This makes it possible for an application to check for an extended -capability's presence with \fB\%tigetstr\fP, -and reassign the keycode to match its own needs. +an application can use \fB\%define_key\fP(3X) to bind +a selected key to a string of the programmer's choice. +This feature enables an application to check for its presence +with \fB\%tigetstr\fP(3X), +and reassign the numeric key code to match its own needs. .PP -Low-level applications can use \fB\%tigetstr\fP to obtain the definition -of any particular string capability. -Higher-level applications which use the +Low-level applications can use \fB\%tigetstr\fP(3X) to obtain the +definition of any string capability. .I curses -\fB\%wgetch\fP and similar functions to return keycodes rely upon the -order in which the strings are loaded. -If more than one key definition has the same string value, -then \fB\%wgetch\fP can return only one keycode. +applications use the input character reading function +to obtain key codes from input +and rely upon the order in which the string capabilities are loaded. +Multiple key capability strings can have the same value, +but the input character reading function can report only one key code. Most .I curses implementations (including .IR \%ncurses ) load key definitions in the order -defined by the array of string capability names. -The last key to be loaded determines the keycode which will be returned. +they appear in the +.B \%strfnames +array of string capability names; +see \fB\%term_variables\fP(3X). +.\" ncurses/tinfo/parse_entry.c:lookup_fullname, I think --GBR +The last capability read using a particular definition determines the +key code to be reported. In .IR \%ncurses , -you may also have extended capabilities interpreted as key definitions. -These are loaded after the predefined keys, -and if a capability's value is the same as a previously-loaded -key definition, -the later definition is the one used. +extended capabilities can be interpreted as key definitions. +The library loads these after its built-in definitions, +and if an extended capability's value +is the same as one previously loaded, +the library uses the later definition. .SH HISTORY +4BSD (1980) +introduced +.IR echo "," +.IR \%noecho "," +.IR nl "," +.IR \%nonl "," +.IR raw "," +and +.IR \%noraw "." \" also crmod and nocrmod, never standardized +.PP +SVr2 (1984) +featured a new terminal driver, +extending the +.I curses +API to support it with +.IR \%cbreak "," +.IR \%nocbreak "," +.IR \%intrflush "," +.IR \%keypad "," +.IR \%meta "," +.IR \%nodelay "," +and +.IR \%typeahead "." +.PP +SVr3 (1987) +added +.IR \%halfdelay "," +.IR \%notimeout "," +and +.IR \%wtimeout "." +.I \%qiflush +and +.I \%noqiflush +appeared in SVr3.1 (1987), +at which point +.I \%intrflush +became a wrapper for either of these functions, +depending on the value of its Boolean argument. +SVr3.1 also added +.IR \%timeout "." +.PP +.I \%ncurses +6.5 (2024) introduced +.IR is_cbreak "," +.IR is_echo "," +.IR is_nl "," +and +.IR is_raw "." +.PP Formerly, .I \%ncurses used -.B \%nl +.I \%nl and -.B \%nonl +.I \%nonl to control the conversion of newlines to carriage return/line feed on output as well as input. X/Open Curses documents the use of these functions only for input. @@ -535,15 +877,15 @@ .I \%termios (the POSIX terminal API). In the former, -both input and output were controlled via a single option -.BR \%CRMOD , +both input and output conversions were controlled via a single option +\%\*(``CRMOD\*('', while the latter separates these features. Because that conversion interferes with output optimization, .I \%ncurses 6.2 (2020) amended -.B \%nl +.I \%nl and -.B \%nonl +.I \%nonl to eliminate their effect on output. .SH SEE ALSO \fB\%curses\fP(3X), @@ -551,4 +893,5 @@ \fB\%curs_initscr\fP(3X), \fB\%curs_util\fP(3X), \fB\%define_key\fP(3X), -\fB\%termios\fP(3) +\fB\%termios\fP(3), +\fB\%term_variables\fP(3X) diff --git a/contrib/ncurses/man/curs_ins_wch.3x b/contrib/ncurses/man/curs_ins_wch.3x --- a/contrib/ncurses/man/curs_ins_wch.3x +++ b/contrib/ncurses/man/curs_ins_wch.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-2024,2025 Thomas E. Dickey * .\" Copyright 2002-2010,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_ins_wch.3x,v 1.30 2024/04/20 19:18:18 tom Exp $ -.TH curs_ins_wch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_ins_wch.3x,v 1.52 2025/10/21 00:09:49 tom Exp $ +.TH curs_ins_wch 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -39,41 +39,64 @@ .ie t .ds '' '' .el .ds '' "" .\} +. +.de bP +.ie n .IP \(bu 4 +.el .IP \(bu 2 +.. .SH NAME \fB\%ins_wch\fP, +\fB\%wins_wch\fP, \fB\%mvins_wch\fP, -\fB\%mvwins_wch\fP, -\fB\%wins_wch\fP \- +\fB\%mvwins_wch\fP \- insert a \fIcurses\fR complex character in a window .SH SYNOPSIS .nf \fB#include \fP .PP -\fBint ins_wch(const cchar_t *\fIwch\fP); -\fBint wins_wch(WINDOW *\fIwin\fP, const cchar_t *\fIwch\fP); -\fBint mvins_wch(int \fIy\fP, int \fIx\fP, const cchar_t *\fIwch\fP); -\fBint mvwins_wch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const cchar_t *\fIwch\fP); +\fBint ins_wch(const cchar_t * \fIwch\fP); +\fBint wins_wch(WINDOW * \fIwin\fP, const cchar_t * \fIwch\fP); +\fBint mvins_wch(int \fIy\fP, int \fIx\fP, const cchar_t * \fIwch\fP); +\fBint mvwins_wch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, const cchar_t * \fIwch\fP); .fi .SH DESCRIPTION -These functions insert the +.B \%wins_wch +inserts the .I curses complex character .I wch -at the cursor in the specified window -.I win -(or -.BR \%stdscr ). +at the cursor position in the window +.IR win "." The character previously at the cursor and any to its right move one cell to the right; -the rightmost character on the line is discarded. -The cursor does not advance. +the formerly rightmost character on the line is discarded. +Unlike \fB\%add_wch\fP(3X), +.B \%wins_wch +does not advance the cursor. +\fB\%ncurses\fP(3X) describes the variants of this function. .SH "RETURN VALUE" -These functions return \fBOK\fP on success and \fBERR\fP on failure. +These functions return +.B OK +on success and +.B ERR +on failure. .PP -Functions taking a +In +.IR \%ncurses , +they return +.B ERR +if +.bP +the +.I curses +screen has not been initialized, +or +.bP +(for functions taking a .I \%WINDOW -pointer argument fail if the pointer is -.BR NULL . +pointer argument) +.I win +is a null pointer. .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -81,30 +104,37 @@ .IR x ) is outside the window boundaries. .SH NOTES -A terminal's -.B \%insert_character -.RB ( ich1 ) -capability -is not necessarily employed. -.PP -\fB\%ins_wch\fP, -\fB\%mvins_wch\fP, +.BR \%ins_wch "," +.BR \%mvins_wch "," and -\fB\%mvwins_wch\fP +.B \%mvwins_wch may be implemented as macros. -.SH PORTABILITY -X/Open Curses, -Issue 4 describes these functions. .PP -SVr4 describes successful return values only as -\*(``an integer value other than \fBERR\fP\*(''. +.I curses +does not necessarily employ the terminal's +.B \%insert_character +.RB ( ich1 ) +capability to achieve insertion. +.SH PORTABILITY +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. .SH HISTORY -SVr4 (1989) implemented these functions under the names -.BR inswch , -.BR winswch , -.BR mvinswch , -and -.BR mvwinswch . +X/Open Curses Issue\ 4 (1995) initially specified these functions. +The System\ V Interface Definition Version\ 4 +of the same year +specified a function named +.I \%winswch +(and the usual variants). +.\" SVID 4, vol 3., p. 512 +This was a later addition to +.RI SVr4. x , +not appearing in the first SVr4 (1989). +It differed from X/Open's later +.I \%wins_wch +in that it took an argument of type +.I \%chtype +instead of +.IR \%cchar_t "." .SH "SEE ALSO" \fB\%curs_insch\fP(3X) describes comparable functions in the non-wide-character diff --git a/contrib/ncurses/man/curs_ins_wstr.3x b/contrib/ncurses/man/curs_ins_wstr.3x --- a/contrib/ncurses/man/curs_ins_wstr.3x +++ b/contrib/ncurses/man/curs_ins_wstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-2024,2025 Thomas E. Dickey * .\" Copyright 2002-2012,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_ins_wstr.3x,v 1.38 2024/04/20 21:23:08 tom Exp $ -.TH curs_ins_wstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_ins_wstr.3x,v 1.60 2025/03/01 21:30:14 tom Exp $ +.TH curs_ins_wstr 3X 2025-03-01 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -46,57 +46,93 @@ .. .SH NAME \fB\%ins_wstr\fP, -\fB\%ins_nwstr\fP, \fB\%wins_wstr\fP, -\fB\%wins_nwstr\fP, \fB\%mvins_wstr\fP, -\fB\%mvins_nwstr\fP, \fB\%mvwins_wstr\fP, +\fB\%ins_nwstr\fP, +\fB\%wins_nwstr\fP, +\fB\%mvins_nwstr\fP, \fB\%mvwins_nwstr\fP \- insert a wide-character string in a \fIcurses\fR window .SH SYNOPSIS .nf \fB#include .PP -\fBint ins_wstr(const wchar_t *\fIwstr\fP); -\fBint ins_nwstr(const wchar_t *\fIwstr\fP, int \fIn\fP); -\fBint wins_wstr(WINDOW *\fIwin\fP, const wchar_t *\fIwstr\fP); -\fBint wins_nwstr(WINDOW *\fIwin\fP, const wchar_t *\fIwstr\fP, int \fIn\fP); +\fBint ins_wstr(const wchar_t * \fIwstr\fP); +\fBint wins_wstr(WINDOW * \fIwin\fP, const wchar_t * \fIwstr\fP); +\fBint mvins_wstr(int \fIy\fP, int \fIx\fP, const wchar_t * \fIwstr\fP); +\fBint mvwins_wstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, + const wchar_t * \fIwstr\fP); .PP -\fBint mvins_wstr(int \fIy\fP, int \fIx\fP, const wchar_t *\fIwstr\fP); -\fBint mvins_nwstr(int \fIy\fP, int \fIx\fP, const wchar_t *\fIwstr\fP, int \fIn\fP); -\fBint mvwins_wstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const wchar_t *\fIwstr\fP); -\fBint mvwins_nwstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const wchar_t *\fIwstr\fP, int \fIn\fP); +\fBint ins_nwstr(const wchar_t * \fIwstr\fP, int \fIn\fP); +\fBint wins_nwstr(WINDOW * \fIwin\fP, const wchar_t * \fIwstr\fP, int \fIn\fP); +\fBint mvins_nwstr(int \fIy\fP, int \fIx\fP, const wchar_t * \fIwstr\fP, int \fIn\fP); +\fBint mvwins_nwstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, + const wchar_t * \fIwstr\fP, int \fIn\fP); .fi .SH DESCRIPTION -These routines insert a \fBwchar_t\fP character string -(as many characters as will fit on the line) -before the character under the cursor, -as if calling \fBwins_wch\fP(3X). -All characters to the right of the cursor are shifted right, -with the possibility of the rightmost characters on the line being lost. -No wrapping is performed. -.PP +.B \%wins_wstr +inserts a wide-character string +.I wstr +before the character at the cursor in window +.I win +as if by calling \fBwins_wch\fP(3X) for each +.I \%wchar_t +in +.IR wstr "." +No line wrapping is performed. +Characters to the right of the cursor are shifted right; +those at the right edge of the window may be lost. +.B \%wins_wstr +stops inserting if it would have to wrap to the next line to write the +next +.I \%wchar_t +in +.IR wstr "." The cursor position does not change -(after moving to \fIy\fP, \fIx\fP, if specified). -.PP -The functions with \fIn\fP as the last argument -insert a leading substring of at most \fIn\fP \fBwchar_t\fP characters. -If \fIn\fP is less than zero, the entire string is inserted -(stopping on a L'\e0' character). -.PP -Special characters are handled as in \fBwadd_wch\fP(3X). +(after moving to +.RI ( y , +.IR x ")," +if specified). +.B \%wins_nwstr +does the same, +but inserts at most +.I n +wide characters, +or as many as possible +(up to the end of the line) +if +.I n +is negative. +\fB\%ncurses\fP(3X) describes the variants of these functions. .SH RETURN VALUE -All functions return the integer \fBERR\fP upon failure and \fBOK\fP on success. +These functions return +.B OK +on success and +.B ERR +on failure. .PP -X/Open Curses does not specify any error conditions. -This implementation returns an error +In +.IR \%ncurses "," +they return +.B ERR +if .bP -if the \fIwin\fP parameter is null or +.I win +is +.IR NULL "," .bP -if the \fIwstr\fP parameter is null or +.I wstr +is +.IR NULL "," .bP -if the \fBwins_wch\fP function returns an error. +the first wide character in +.I wstr +is a non-spacing character, +or +.bP +an internal \fB\%wins_wch\fP(3X) call returns +.BR ERR "." .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -104,20 +140,71 @@ .IR x ) is outside the window boundaries. .SH NOTES -All but \fBwins_nwstr\fP may be macros. +All of these functions except +.B \%wins_nwstr +may be implemented as macros. +.SH EXTENSIONS +.BR \%ins_nwstr "," +.BR \%wins_nwstr "," +.BR \%mvins_nwstr "," +and +.BR \%mvwins_nwstr "'s" +acceptance of negative +.I n +values is an +.I \%ncurses +extension. +.SH PORTABILITY +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. .PP -If the first character in the string is a non-spacing character, these -functions will fail. -X/Open Curses does not define what will happen +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.PP +X/Open Curses does not specify what happens if a non-spacing character follows a control character. -.SH PORTABILITY -These functions are described in X/Open Curses, Issue 4, -which adds \fI\%const\fP qualifiers to the arguments. .PP -X/Open states that the entire string is inserted if \fIn\fP is less than 1. +Issue\ 4 states that the entire string is inserted if +.I n +is less than 1. This is probably an error, -because it is inconsistent with other functions, -and differs from the X/Open implementation on Solaris. +.\" ...copied from SVID 4, which made the same error; see p. 513. +because it is inconsistent with other functions +such as +.IR \%waddwstr "," +and differs from the SVr4 +.I curses +and Solaris +.I xcurses +implementations. +Nevertheless, +Issue\ 7 retains the language. +.SH HISTORY +X/Open Curses Issue\ 4 (1995) initially specified these functions. +The System\ V Interface Definition Version\ 4 (1995), +specified functions named +.I \%winswstr +and +.I \%winsnwstr +(and the usual variants). +.\" SVID 4, vol 3., p. 513 +.\" The prototypes also identify the data type as `wchar`, not +.\" `wchar_t`, but this may be an error since the "DESCRIPTION" section +.\" consistently uses the latter. --GBR +These were later additions to +.RI SVr4. x , +not appearing in the first SVr4 (1989). +They differ from X/Open's later +.I \%wins_wstr +and +.I \%wins_nwstr +in that their +.I wstr +parameters are not +.IR const "-qualified." .SH SEE ALSO \fB\%curs_insstr\fP(3X) describes comparable functions of the .I \%ncurses diff --git a/contrib/ncurses/man/curs_insch.3x b/contrib/ncurses/man/curs_insch.3x --- a/contrib/ncurses/man/curs_insch.3x +++ b/contrib/ncurses/man/curs_insch.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_insch.3x,v 1.40 2024/04/20 19:03:47 tom Exp $ -.TH curs_insch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_insch.3x,v 1.56 2025/03/08 23:10:02 tom Exp $ +.TH curs_insch 3X 2025-03-08 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -39,6 +39,11 @@ .ie t .ds '' '' .el .ds '' "" .\} +. +.de bP +.ie n .IP \(bu 4 +.el .IP \(bu 2 +.. .SH NAME \fB\%insch\fP, \fB\%winsch\fP, @@ -50,23 +55,25 @@ \fB#include \fP .PP \fBint insch(chtype \fIch\fP); -\fBint winsch(WINDOW *\fIwin\fP, chtype \fIch\fP); +\fBint winsch(WINDOW * \fIwin\fP, chtype \fIch\fP); \fBint mvinsch(int \fIy\fP, int \fIx\fP, chtype \fIch\fP); -\fBint mvwinsch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, chtype \fIch\fP); +\fBint mvwinsch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, chtype \fIch\fP); .fi .SH DESCRIPTION -These functions insert the +.B \%winsch +inserts the .I curses character .I ch -at the cursor in the specified window -.I win -(or -.BR \%stdscr ). +at the cursor position in the window +.IR win "." The character previously at the cursor and any to its right move one cell to the right; -the rightmost character on the line is discarded. -The cursor does not advance. +the formerly rightmost character on the line is discarded. +Unlike \fB\%addch\fP(3X), +.B \%winsch +does not advance the cursor. +\fB\%ncurses\fP(3X) describes the variants of this function. .SH "RETURN VALUE" These functions return .B OK @@ -74,10 +81,22 @@ .B ERR on failure. .PP -Functions taking a +In +.IR \%ncurses , +they return +.B ERR +if +.bP +the +.I curses +screen has not been initialized, +or +.bP +(for functions taking a .I \%WINDOW -pointer argument fail if the pointer is -.BR NULL . +pointer argument) +.I win +is a null pointer. .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -85,26 +104,26 @@ .IR x ) is outside the window boundaries. .SH NOTES -.BR \%insch , -.BR \%mvinsch , +.BR \%insch "," +.BR \%mvinsch "," and .B \%mvwinsch may be implemented as macros. .PP -A terminal's +.I curses +does not necessarily employ the terminal's .B \%insert_character .RB ( ich1 ) -capability -is not necessarily employed. +capability to achieve insertion. .SH PORTABILITY -X/Open Curses, -Issue 4 describes these functions. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. .PP -SVr4 -.I curses -describes a successful return value only as +SVr4 describes a successful return value only as \*(``an integer value other than -.BR ERR \*(''. +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 509 +.SH HISTORY +SVr2 (1984) introduced these functions. .SH "SEE ALSO" \fB\%curs_ins_wch\fP(3X) describes comparable functions in the wide-character diff --git a/contrib/ncurses/man/curs_insstr.3x b/contrib/ncurses/man/curs_insstr.3x --- a/contrib/ncurses/man/curs_insstr.3x +++ b/contrib/ncurses/man/curs_insstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_insstr.3x,v 1.51 2024/04/20 21:20:07 tom Exp $ -.TH curs_insstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_insstr.3x,v 1.72 2025/10/21 00:11:17 tom Exp $ +.TH curs_insstr 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -46,56 +46,87 @@ .. .SH NAME \fB\%insstr\fP, -\fB\%insnstr\fP, \fB\%winsstr\fP, -\fB\%winsnstr\fP, \fB\%mvinsstr\fP, \fB\%mvinsnstr\fP, +\fB\%insnstr\fP, +\fB\%winsnstr\fP, \fB\%mvwinsstr\fP, \fB\%mvwinsnstr\fP \- insert a string in a \fIcurses\fR window .SH SYNOPSIS .nf \fB#include -\fBint insstr(const char *\fIstr\fP); -\fBint insnstr(const char *\fIstr\fP, int \fIn\fP); -\fBint winsstr(WINDOW *\fIwin\fP, const char *\fIstr\fP); -\fBint winsnstr(WINDOW *\fIwin\fP, const char *\fIstr\fP, int \fIn\fP); .PP -\fBint mvinsstr(int \fIy\fP, int \fIx\fP, const char *\fIstr\fP); -\fBint mvinsnstr(int \fIy\fP, int \fIx\fP, const char *\fIstr\fP, int \fIn\fP); -\fBint mvwinsstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const char *\fIstr\fP); -\fBint mvwinsnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const char *\fIstr\fP, int \fIn\fP); +\fBint insstr(const char * \fIstr\fP); +\fBint winsstr(WINDOW * \fIwin\fP, const char * \fIstr\fP); +\fBint mvinsstr(int \fIy\fP, int \fIx\fP, const char * \fIstr\fP); +\fBint mvwinsstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, const char * \fIstr\fP); +.PP +\fBint insnstr(const char * \fIstr\fP, int \fIn\fP); +\fBint winsnstr(WINDOW * \fIwin\fP, const char * \fIstr\fP, int \fIn\fP); +\fBint mvinsnstr(int \fIy\fP, int \fIx\fP, const char * \fIstr\fP, int \fIn\fP); +\fBint mvwinsnstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, const char * \fIstr\fP, int \fIn\fP); .fi .SH DESCRIPTION -These routines insert a character string -(as many characters as will fit on the line) -before the character under the cursor, -as if calling \fBwinsch\fP(3X). -All characters to the right of the cursor are shifted right, -with the possibility of the rightmost characters on the line being lost. -No wrapping is performed. -.PP +.B \%winsstr +inserts a string +.I str +before the character at the cursor in window +.I win +as if by calling \fBwinsch\fP(3X) for each +.I char +in +.IR str "." +No line wrapping is performed. +Characters to the right of the cursor are shifted right; +those at the right edge of the window may be lost. +.B \%winsstr +stops inserting if it would have to wrap to the next line to write the +next +.I \%char +in +.IR str "." The cursor position does not change -(after moving to \fIy\fP, \fIx\fP, if specified). -.PP -The functions with \fIn\fP as the last argument -insert a leading substring of at most \fIn\fP characters. -If \fIn\fP is less than zero, the entire string is inserted -(stopping on a NUL character). -.PP -Special characters are handled as in \fBwaddch\fP(3X). +(after moving to +.RI ( y , +.IR x ")," +if specified). +.B \%insnstr +does the same, +but inserts at most +.I n +characters, +or as many as possible +(up to the end of the line) +if +.I n +is negative. +\fB\%ncurses\fP(3X) describes the variants of these functions. .SH RETURN VALUE -All functions return the integer \fBERR\fP upon failure and \fBOK\fP on success. +These functions return +.B OK +on success and +.B ERR +on failure. .PP -X/Open Curses does not specify any error conditions. -This implementation returns an error +In +.IR \%ncurses "," +they return +.B ERR +if .bP -if the \fIwin\fP parameter is null or +.I win +is +.IR NULL "," .bP -if the \fIstr\fP parameter is null or +.I str +is +.IR NULL "," +or .bP -the \fBwinsch\fP(3X) function returns an error. +an internal \fBwinsch\fP(3X) call returns +.BR ERR "." .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -103,21 +134,75 @@ .IR x ) is outside the window boundaries. .SH NOTES -All but \fBwinsnstr\fP may be macros. +All of these functions except +.B \%winsnstr +may be implemented as macros. +.SH EXTENSIONS +.BR \%insnstr "," +.BR \%winsnstr "," +.BR \%mvinsnstr "," +and +.BR \%mvwinsnstr "'s" +acceptance of negative +.I n +values is an +.I \%ncurses +extension. .SH PORTABILITY -These functions are described in X/Open Curses, Issue 4, -which adds \fI\%const\fP qualifiers to the arguments. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. .PP -The Single Unix Specification, Version 2 states that -\fBinsnstr\fP and \fBwinsnstr\fP perform wrapping. -This is probably an error, since it makes this group of functions inconsistent. -Also, no implementation of curses documents this inconsistency. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. .PP -X/Open states that the entire string is inserted if \fIn\fP is less than 1. +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 510 +.PP +Issue\ 4 distinguished +.I \%insnstr +and +.I \%winsnstr +from the other functions documented above +by stating they \*(``do not perform wrapping\*(''. +This was probably an error, +since it makes this group of functions inconsistent. +No implementation of +.I curses +manifests this inconsistency, +and Issue\ 7 removed the claim. +.PP +Issue\ 4 states that the entire string is inserted if +.I n +is less than 1. This is probably an error, -because it is inconsistent with other functions, -and differs from the SVr4 and X/Open implementations on Solaris. +.\" ...copied from SVID 4, which made the same error; see p. 510. +because it is inconsistent with other functions +such as +.IR \%waddstr "," +and differs from the SVr4 +.I curses +and Solaris +.I xcurses +implementations. +Nevertheless, +Issue\ 7 retains the language. +.SH HISTORY +SVr3.1 (1987) +introduced +.I \%winsstr +and +.I \%winsnstr +and their variants. .SH SEE ALSO +\fB\%curs_ins_wstr\fP(3X) describes comparable functions of the +.I \%ncurses +library in its wide-character configuration +.RI \%( ncursesw ). +.PP \fB\%curses\fP(3X), \fB\%curs_inch\fP(3X), \fB\%curs_ins_wstr\fP(3X), diff --git a/contrib/ncurses/man/curs_instr.3x b/contrib/ncurses/man/curs_instr.3x --- a/contrib/ncurses/man/curs_instr.3x +++ b/contrib/ncurses/man/curs_instr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_instr.3x,v 1.51 2024/04/20 21:24:19 tom Exp $ -.TH curs_instr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_instr.3x,v 1.82 2025/10/21 00:04:35 tom Exp $ +.TH curs_instr 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -46,48 +46,83 @@ .. .SH NAME \fB\%instr\fP, -\fB\%innstr\fP, \fB\%winstr\fP, -\fB\%winnstr\fP, \fB\%mvinstr\fP, -\fB\%mvinnstr\fP, \fB\%mvwinstr\fP, +\fB\%innstr\fP, +\fB\%winnstr\fP, +\fB\%mvinnstr\fP, \fB\%mvwinnstr\fP \- get a string from a \fIcurses\fR window .SH SYNOPSIS .nf \fB#include .PP -\fBint instr(char *\fIstr\fP); -\fBint innstr(char *\fIstr\fP, int \fIn\fP); -\fBint winstr(WINDOW *\fIwin\fP, char *\fIstr\fP); -\fBint winnstr(WINDOW *\fIwin\fP, char *\fIstr\fP, int \fIn\fP); +\fBint instr(char * \fIstr\fP); +\fBint winstr(WINDOW * \fIwin\fP, char * \fIstr\fP); +\fBint mvinstr(int \fIy\fP, int \fIx\fP, char * \fIstr\fP); +\fBint mvwinstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, char * \fIstr\fP); .PP -\fBint mvinstr(int \fIy\fP, int \fIx\fP, char *\fIstr\fP); -\fBint mvinnstr(int \fIy\fP, int \fIx\fP, char *\fIstr\fP, int \fIn\fP); -\fBint mvwinstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, char *\fIstr\fP); -\fBint mvwinnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, char *\fIstr\fP, int \fIn\fP); +\fBint innstr(char * \fIstr\fP, int \fIn\fP); +\fBint winnstr(WINDOW * \fIwin\fP, char * \fIstr\fP, int \fIn\fP); +\fBint mvinnstr(int \fIy\fP, int \fIx\fP, char * \fIstr\fP, int \fIn\fP); +\fBint mvwinnstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, char * \fIstr\fP, int \fIn\fP); .fi .SH DESCRIPTION -These routines return a string of characters in \fIstr\fP, -starting at the current cursor position in the named window. -Attributes are stripped from the characters. -.PP -The four functions with \fIn\fP as the last argument return -a leading substring at most \fIn\fP characters long -(exclusive of the trailing NUL). -Transfer stops at the end of the current line, or when \fIn\fP characters have -been stored at the location referenced by \fIstr\fP. +.B \%winstr +extracts a string from a +.I curses +window +.IR win "," +starting at the cursor and stopping at the end of the line, +and stores it in +.IR str "," +terminating it with a null character +and +omitting any attributes and color pair identifier +that +.I curses +associates with each character. +.B \%winnstr +does the same, +but copies at most +.I n +characters from +.IR win "." +A negative +.I n +implies no limit; +.B \%winnstr +then works like +.BR \%winstr "." +\fB\%ncurses\fP(3X) describes the variants of these functions. .SH RETURN VALUE -All of the functions return \fBERR\fP upon failure, -or the number of characters actually read into the string. +These functions return the count of characters copied from +.I win +to +.I str +(not including the null terminator), +or +.B ERR +upon failure. .PP -X/Open Curses defines no error conditions. -This implementation returns an error +In +.IR \%ncurses "," +these functions fail if .bP -if the \fIwin\fP parameter is null or +the +.I curses +screen has not been initialized, .bP -if the \fIchstr\fP parameter is null. +(for functions taking a +.I \%WINDOW +pointer argument) +.I win +is a null pointer, +or +.bP +.I str +is a null pointer. .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -95,35 +130,88 @@ .IR x ) is outside the window boundaries. .SH NOTES -All routines except \fBwinnstr\fP may be macros. +All of these functions except +.B \%winnstr +may be implemented as macros. .PP Reading a line that overflows the array pointed to by -\fIstr\fP +.I str with -\fBinstr\fP, -\fBmvinstr\fP, -\fBmvwinstr\fP -or -\fBwinstr\fP -causes undefined results. -Therefore, the use of -\fBinnstr\fP, -\fBmvinnstr\fP, -\fBmvwinnstr\fP, or -\fBwinnstr\fP -is recommended. +and its variants causes undefined results. +Instead, +use the +.IR n -infixed +functions with a positive +.I n +argument no larger than the size of the buffer backing +.IR str "." +.SH EXTENSIONS +.BR \%innstr "," +.BR \%winnstr "," +.BR \%mvinnstr "," +and +.BR \%mvwinnstr "'s" +acceptance of negative +.I n +values is an +.I \%ncurses +extension. .SH PORTABILITY -SVr4 does not -document whether a length limit includes or excludes the trailing NUL. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. +.PP +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.PP +X/Open Curses Issues 4 and 7 both state that +.IR \%instr "," +.IR \%winstr "," +.IR \%mvinstr "," +and +.I \%mvwinstr +return +.I OK +rather than a character count. +.\" X/Open Issue 4, Version 2, p. 117, PDF p. 137 +.\" Issue 7 makes the same claim. +This is likely an erratum. +.bP +SVr3.1 and SVr4 implemented +.I \%winstr +as a wrapper around +.IR \%winnstr "," +returning the latter's return value. +X/Open Curses's specification thus may have been an editorial solecism +copied from System\ V's documentation +(see below) +by X/Open, +rather than an intentional change. +.bP +.I \%ncurses +retains compatibility with System\ V +.I curses +behavior. .PP -The \fI\%ncurses\fP library extends the X/Open Curses description by allowing a -negative value for \fIn\fP. -In this case, the functions return the string ending at the right margin. +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 503 +.PP +SVr4 does not +document whether +.I n +counts the null terminator that these functions write to +.IR str "." +.SH HISTORY +SVr3.1 (1987) +introduced these functions. .SH SEE ALSO -\fB\%curs_ins_wstr\fP(3X) describes comparable functions of the +\fB\%curs_inwstr\fP(3X) describes comparable functions of the .I \%ncurses library in its wide-character configuration -.RI ( \%ncursesw ). +.RI \%( ncursesw ). .PP \fB\%curses\fP(3X), \fB\%curs_inch\fP(3X), diff --git a/contrib/ncurses/man/curs_inwstr.3x b/contrib/ncurses/man/curs_inwstr.3x --- a/contrib/ncurses/man/curs_inwstr.3x +++ b/contrib/ncurses/man/curs_inwstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2002-2012,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_inwstr.3x,v 1.41 2024/04/20 21:20:07 tom Exp $ -.TH curs_inwstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_inwstr.3x,v 1.66 2025/10/21 00:04:48 tom Exp $ +.TH curs_inwstr 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -45,59 +45,100 @@ .. .SH NAME \fB\%inwstr\fP, -\fB\%innwstr\fP, \fB\%winwstr\fP, -\fB\%winnwstr\fP, \fB\%mvinwstr\fP, -\fB\%mvinnwstr\fP, \fB\%mvwinwstr\fP, +\fB\%innwstr\fP, +\fB\%winnwstr\fP, +\fB\%mvinnwstr\fP, \fB\%mvwinnwstr\fP \- get a wide-character string from a \fIcurses\fR window .SH SYNOPSIS .nf \fB#include .PP -\fBint inwstr(wchar_t *\fIwstr\fP); -\fBint innwstr(wchar_t *\fIwstr\fP, int \fIn\fP); -\fBint winwstr(WINDOW *\fIwin\fP, wchar_t *\fIwstr\fP); -\fBint winnwstr(WINDOW *\fIwin\fP, wchar_t *\fIwstr\fP, int \fIn\fP); +\fBint inwstr(wchar_t * \fIwstr\fP); +\fBint winwstr(WINDOW * \fIwin\fP, wchar_t * \fIwstr\fP); +\fBint mvinwstr(int \fIy\fP, int \fIx\fP, wchar_t * \fIwstr\fP); +\fBint mvwinwstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, wchar_t * \fIwstr\fP); .PP -\fBint mvinwstr(int \fIy\fP, int \fIx\fP, wchar_t *\fIwstr\fP); -\fBint mvinnwstr(int \fIy\fP, int \fIx\fP, wchar_t *\fIwstr\fP, int \fIn\fP); -\fBint mvwinwstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, wchar_t *\fIwstr\fP); -\fBint mvwinnwstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, wchar_t *\fIwstr\fP, int \fIn\fP); +\fBint innwstr(wchar_t * \fIwstr\fP, int \fIn\fP); +\fBint winnwstr(WINDOW * \fIwin\fP, wchar_t * \fIwstr\fP, int \fIn\fP); +\fBint mvinnwstr(int \fIy\fP, int \fIx\fP, wchar_t * \fIwstr\fP, int \fIn\fP); +\fBint mvwinnwstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, wchar_t * \fIwstr\fP, int \fIn\fP); .fi .SH DESCRIPTION -These routines return a string of \fBwchar_t\fP wide characters in \fIwstr\fP, -starting at the current cursor position in the named window. -.PP -The four functions with \fIn\fP as the last argument return -a leading substring at most \fIn\fP characters long -(exclusive of the trailing NUL). -Transfer stops at the end of the current line, or when \fIn\fP characters have -been stored at the location referenced by \fIwstr\fP. -.PP -If the size \fIn\fP is not large enough to store a complete complex character, -an error is generated. +.B \%winwstr +extracts a wide-character string from a +.I curses +window +.IR win "," +starting at the cursor and stopping at the end of the line, +and stores it in +.IR wstr "," +terminating it with a wide null character +and +omitting any attributes and color pair identifier +that +.I curses +associates with each character. +.B \%winnwstr +does the same, +but copies at most +.I n +wide characters from +.IR win "." +A negative +.I n +implies no limit; +.B \%winnwstr +then works like +.BR \%winwstr "." +\fB\%ncurses\fP(3X) describes the variants of these functions. .SH RETURN VALUE -All routines return -\fBERR\fP +On successful operation, +these functions return the count of wide characters copied from +.I win +to +.I wstr +(not including the wide null terminator), +or +.B ERR upon failure. -Upon -successful completion, the *\fBinwstr\fP -routines return -\fBOK\fP, and the *\fBinnwstr\fP -routines return the -number of characters read into the string. +.BR \%innwstr "," +.BR \%winnwstr "," +.BR \%mvinnwstr "," +and +.B \%mvwinnwstr +return +.B ERR +if +.I n +is insufficiently large to store a complete wide character string. +(Recall that a +.I curses +complex character can contain multiple wide characters, +some of which may be non-spacing.) .PP -X/Open defines no error conditions. -This implementation returns an error +In +.IR \%ncurses "," +these functions return +.B ERR +if .bP -if the \fIwin\fP parameter is null or +the +.I curses +screen has not been initialized, .bP -if the \fIwstr\fP parameter is null, or +(for functions taking a +.I \%WINDOW +pointer argument) +.I win +is a null pointer, +or .bP -if no characters could be read. +.I wstr +is a null pointer. .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -105,37 +146,103 @@ .IR x ) is outside the window boundaries. .SH NOTES -All routines except -\fBwinnwstr\fP -may be macros. -.PP -Each cell in the window holds a complex character -(a spacing character and zero or more non-spacing characters) -together with attributes and color. -These functions store only the wide characters, -ignoring attributes and color. -Use \fBin_wchstr\fP to return the complex characters from a window. +All of these functions except +.B \%winnwstr +may be implemented as macros. .PP Reading a line that overflows the array pointed to by -\fIwstr\fP -with -\fBinwstr\fP, -\fBmvinwstr\fP, -\fBmvwinwstr\fP -or -\fBwinwstr\fP -causes undefined results. -Therefore, the use of -\fBinnwstr\fP, -\fBmvinnwstr\fP, -\fBmvwinnwstr\fP, or -\fBwinnwstr\fP -is recommended. +.I wstr +and its variants causes undefined results. +Instead, +use the +.IR n -infixed +functions with a positive +.I n +argument no larger than the size of the buffer backing +.IR wstr "." +.SH EXTENSIONS +.BR \%innwstr "," +.BR \%winnwstr "," +.BR \%mvinnwstr "," +and +.BR \%mvwinnwstr "'s" +acceptance of negative +.I n +values is an +.I \%ncurses +extension. .SH PORTABILITY -These functions are described in X/Open Curses, Issue 4. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. +.PP +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.PP +Notwithstanding the foregoing, +X/Open Curses Issues 4 and 7 both state that +.IR \%innwstr "," +.IR \%winnwstr "," +.IR \%mvinnwstr "," +and +.I \%mvwinnwstr +\*(``fail .\|.\|. [i]f the array is not large enough to contain any +complete characters\*(''. +Strictly interpreted, +this means that a caller of these functions cannot use their return +values to detect truncation of a wide-character string copied from more +than one character cell in +.IR win "." +.I \%ncurses +reports any truncation with +.IR ERR "." +.PP +X/Open Curses specifies +.IR \%inwstr "," +.IR \%winwstr "," +.IR \%mvinwstr "," +and +.I \%mvwinwstr +as returning +.I OK +rather than a (wide) character count, +unlike their non-wide counterparts +.IR \%instr "," +.IR \%winstr "," +.IR \%mvinstr "," +and +.IR \%mvwinstr "." +.I \%ncurses +regards this inconsistency as an error in the standard. +.SH HISTORY +The System\ V Interface Definition, +Version 4 (1995), +specified +.I \%winwstr +and +.I \%winnwstr +(and the usual variants). +.\" SVID 4, vol 3., p. 516 +These were later additions to +.RI SVr4. x , +not appearing in the first SVr4 (1989). +Their synopses described each function as taking +an argument of type +.RI pointer-to- char +instead of +.RI pointer-to- wchar_t , +despite describing them as \*(``returning the string of +.I \%wchar_t +in +.IR str "\*(''." +Presumably this was an error in the System\ V Interface Definition. .SH SEE ALSO +\fB\%curs_instr\fP(3X) describes comparable functions of the +.I \%ncurses +library in its non-wide-character configuration. +.PP \fB\%curses\fP(3X), -\fB\%curs_inch\fP(3X), -\fB\%curs_inchstr\fP(3X), -\fB\%curs_instr\fP(3X), +\fB\%curs_in_wch\fP(3X), \fB\%curs_in_wchstr\fP(3X) diff --git a/contrib/ncurses/man/curs_kernel.3x b/contrib/ncurses/man/curs_kernel.3x --- a/contrib/ncurses/man/curs_kernel.3x +++ b/contrib/ncurses/man/curs_kernel.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_kernel.3x,v 1.61 2024/04/20 21:24:19 tom Exp $ -.TH curs_kernel 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_kernel.3x,v 1.89 2025/08/16 19:50:07 tom Exp $ +.TH curs_kernel 3X 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -53,9 +53,10 @@ \fB\%savetty\fP, \fB\%getsyx\fP, \fB\%setsyx\fP, -\fB\%ripoffline\fP, \fB\%curs_set\fP, -\fB\%napms\fP \- +\fB\%mvcur\fP, +\fB\%napms\fP, +\fB\%ripoffline\fP \- low-level \fIcurses\fR routines .SH SYNOPSIS .nf @@ -73,9 +74,10 @@ \fBvoid getsyx(int \fIy\fP, int \fIx\fP); \fBvoid setsyx(int \fIy\fP, int \fIx\fP); .PP -\fBint ripoffline(int \fIline\fP, int (*\fIinit\fP)(WINDOW *, int)); \fBint curs_set(int \fIvisibility\fP); +\fBint mvcur(int \fIoldrow\fP, int \fIoldcol\fP, int \fInewrow\fP, int \fInewcol\fP); \fBint napms(int \fIms\fP); +\fBint ripoffline(int \fIline\fP, int (*\fIinit\fP)(WINDOW *, int)); .fi .SH DESCRIPTION The following routines give low-level access @@ -104,67 +106,118 @@ a buffer and \fBresetty\fP restores the state to what it was at the last call to \fBsavetty\fP. .SS getsyx -The \fBgetsyx\fP routine returns the current coordinates -of the \fIvirtual screen\fP cursor in \fIy\fP and \fIx\fP. -If \fBleaveok\fP is currently \fBTRUE\fP, then -\fB\-1\fP,\fB\-1\fP is returned. -If lines have been removed from the top of the -screen, using \fBripoffline\fP, \fIy\fP and \fIx\fP include these lines; -therefore, \fIy\fP and \fIx\fP should be used only as arguments for -\fBsetsyx\fP. -.PP -Few applications will use this feature, -most use \fBgetyx\fP instead. -.SS setsyx -The \fBsetsyx\fP routine sets -the \fIvirtual screen\fP cursor to \fIy\fP, \fIx\fP. -If \fIy\fP and \fIx\fP are both \fB\-1\fP, then -\fBleaveok\fP is set. -The two routines \fBgetsyx\fP and \fBsetsyx\fP -are designed to be used by a library routine, which manipulates -\fBcurses\fP windows but does not want to change the current position -of the program's cursor. -The library routine would call \fBgetsyx\fP -at the beginning, do its manipulation of its own windows, do a -\fBwnoutrefresh\fP on its windows, call \fBsetsyx\fP, and then call -\fBdoupdate\fP. -.PP -Few applications will use this feature, -most use \fBwmove\fP instead. -.SS ripoffline -.B \%ripoffline -provides access to the same facility that \fB\%slk_init\fP(3X) uses to -reduce the size of the screen. -\fB\%ripoffline\fP must be called before \fBinitscr\fP or -\fBnewterm\fP is called, to prepare these initial actions: -.bP -If \fIline\fP is positive, a line is removed from the top of \fBstdscr\fP. -.bP -if \fIline\fP is negative, a line is removed from the bottom. +.B \%getsyx +stores the coordinates of virtual screen +.RB \%( newscr ) +cursor in +.I y +and +.IR x "." +If +.BR \%newscr 's +\fB\%leaveok\fP(3X) output option is +.BR TRUE "," +.B \%getsyx +stores +.B \-1 +in both +.I y +and +.IR x "." +If lines have been removed from the top of the screen using +.BR \%ripoffline "," +.I y +includes these lines; +therefore, +.I y +and +.I x +populated by +.B \%getsyx +should be used only as arguments for +.BR \%setsyx "." .PP -When the resulting initialization is done inside \fBinitscr\fP, the -routine \fBinit\fP (supplied by the user) is called with two -arguments: -.bP -a window pointer to the one-line window that has been -allocated and -.bP -an integer with the number of columns in the window. +Few applications use this feature; +most call \fB\%getyx\fP(3X) instead. +.SS setsyx +.B \%setsyx +sets the virtual screen +.RB \%( newscr ) +cursor location to +.RI ( y , +.IR x ")." +.B "\%setsyx(\-1, \-1)" +is equivalent to +.BR "\%leaveok(newscr, TRUE)" "." .PP -Inside this initialization routine, the integer variables \fBLINES\fP -and \fBCOLS\fP (defined in \fB\fP) are not guaranteed to be -accurate and \fBwrefresh\fP or \fBdoupdate\fP must not be called. -It is allowable to call \fBwnoutrefresh\fP during the initialization routine. +.B \%getsyx +and +.B \%setsyx +are designed to be used by a function that manipulates +.I curses +windows but seeks to avoid changing the cursor position. +Such a function would first call +.BR \%getsyx "," +modify its windows' content, +call \fB\%wnoutrefresh\fP(3X) on them, +call +.BR \%setsyx "," +then call \fB\%doupdate\fP(3X). .PP -\fBripoffline\fP can be called up to five times before calling \fBinitscr\fP or -\fBnewterm\fP. +Few applications use this feature; +most call \fB\%wmove\fP(3X) instead. .SS curs_set -The \fBcurs_set\fP routine sets the cursor state to invisible, -normal, or very visible for \fBvisibility\fP equal to \fB0\fP, -\fB1\fP, or \fB2\fP respectively. -If the terminal supports the \fIvisibility\fP requested, -the previous \fIcursor\fP state is returned; -otherwise, \fBERR\fP is returned. +.B \%curs_set +adjusts the cursor visibility to +\*(``invisible\*('', +\*(``visible\*('', +\*(``very visible\*('', +as its argument is +.BR 0 , +.BR 1 , +or +.BR 2 , +respectively. +It returns the previous +.I visibility +if the requested one is supported, +and +.B ERR +otherwise. +.SS mvcur +.B \%mvcur +provides low-level cursor motion. +It takes effect immediately, +rather than at the next refresh. +Unlike the other low-level output functions, +which either write to the standard output stream +or are passed a function pointer to perform output, +.B \%mvcur +uses a file descriptor derived from the output stream parameter of +\fB\%newterm\fP(3X). +.PP +One application of +.B \%mvcur +accompanies the temporary use of another program to write to the +terminal screen. +For example, +first call \fB\%refresh\fP(3X) to ensure that the screen and the +library's model of it are up to date; +then call +.BR \%reset_shell_mode ";" +write to the screen with the external application; +call +.BR \%reset_prog_mode ";" +and finally call +.BR \%mvcur( ".\|.\|." , +.RB .\|.\|. , +.B \-1, \-1) +to move the terminal cursor to where +.I \%curses +thinks it is, +since the library has no knowledge of how the external application +moved it. +.\" https://lists.gnu.org/archive/html/bug-ncurses/2016-10/msg00002.html .SS napms .B \%napms sleeps for @@ -174,53 +227,263 @@ .I ms exceeds 30,000 (thirty seconds), -it is capped at that value. +.I \%ncurses +caps it at that value. +.SS ripoffline +.B \%ripoffline +provides access to the same facility that \fB\%slk_init\fP(3X) uses to +reduce the size of the screen. +The application must call +.B \%ripoffline +before \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X) +so that the latter functions prepare a +.B \%stdscr +of the correct size. +.bP +If +.I line +is positive, +.B \%ripoffline +removes a line from the top of what will become +.BR \%stdscr "." +.bP +If +.I line +is negative, +.B \%ripoffline +removes a line from the bottom of what will become +.BR \%stdscr "." +.PP +When +.B \%initscr +initializes +.IR curses "," +it calls the +.I init +function supplied to +.B \%ripoffline +by the application with two arguments: +.bP +a pointer to the one-line +.I \%WINDOW +that it allocates, +and +.bP +an integer with the number of columns in the window. +.PP +Inside this +.I init +function, +the values of the integer variables +.B LINES +and +.B COLS +(see \fB\%curs_variables\fP(3X)) +are not guaranteed to be reliable; +it must not call \fB\%wrefresh\fP(3X) or \fB\%doupdate\fP(3X). +A \fB\%wnoutrefresh\fP(3X) call is permissible. +.PP +.B \%ripoffline +can be called up to five times before +.B \%initscr +or +.BR \%newterm "." .SH RETURN VALUE -Except for \fBcurs_set\fP, these routines always return \fBOK\fP. -.PP -\fBcurs_set\fP -returns the previous cursor state, or \fBERR\fP if the -requested \fIvisibility\fP is not supported. -.PP -X/Open defines no error conditions. -In this implementation -.TP 5 -\fBdef_prog_mode\fP, \fBdef_shell_mode\fP, \fBreset_prog_mode\fP, \fBreset_shell_mode\fP -return an error -if the terminal was not initialized, or -if the I/O call to obtain the terminal settings fails. -.TP 5 -\fBripoffline\fP -returns an error if the maximum number of ripped-off lines -exceeds the maximum (5). -.SH NOTES -Note that \fBgetsyx\fP is a macro, so \fB&\fP is not necessary before -the variables \fIy\fP and \fIx\fP. +Except for +.BR \%curs_set "," +these functions return +.B OK +on success and +.B ERR +on failure. .PP -Older SVr4 man pages warn that the return value -of \fBcurs_set\fP \*(``is currently incorrect\*(''. -This implementation gets it right, but it may be unwise to count -on the correctness of the return value anywhere else. +.B \%curs_set +returns the previous cursor visibility, +and returns +.B ERR +if the terminal type does not support the requested +.IR visibility "." +.PP +.B \%napms +always succeeds. +.PP +.B \%mvcur +fails if the position +.RI ( newrow , +.IR newcol ) +is outside the screen boundaries. +.PP +In +.IR \%ncurses "," +.bP +.BR \%def_prog_mode "," +.BR \%def_shell_mode "," +.BR \%reset_prog_mode "," +and +.B \%reset_shell_mode +return +.B ERR +if the terminal was not initialized, +or if the operating system's function for obtaining terminal settings +fails. +.bP +.B \%ripoffline +returns +.B ERR +if the accumulated quantity of ripped-off lines +would exceed the maximum (5). +.SH NOTES +.B \%getsyx +is a macro; +use of the +.B & +operator before its arguments is unnecessary. .PP -Both \fI\%ncurses\fP and SVr4 will call \fBcurs_set\fP in \fBendwin\fP -if \fBcurs_set\fP -has been called to make the cursor other than normal, i.e., either +The +.B \%endwin +function of both +.I \%ncurses +and SVr4 +.I curses +calls +.B \%curs_set +if the latter has previously been called to set the cursor visibility +to a value other than normal; +that is, +either invisible or very visible. -There is no way for \fI\%ncurses\fP to determine the initial cursor -state to restore that. +There is no way for +.I \%ncurses +to determine the initial cursor visibility to restore it. +.PP +.I \%ncurses +imposes a limit of 30 seconds on a delay requested of +.BR \%napms . +.PP +While the +.I init +function called by +.B \%ripoffline +is specified to return an +.IR int "," +.I \%ncurses +pays no attention to its return value. +.PP +If +.B \%ripoffline +cannot allocate memory for the required +.I \%WINDOW +structure backing the ripped-off line, +it stores a null pointer to the +.I \%WINDOW +pointer argument supplied by the +.I init +function the application specifies. +The application must check this argument for validity after calling +.B \%initscr +and prior to performing +.I curses +operations on that window. +.SH EXTENSIONS +In +.IR \%ncurses "," +.B \%mvcur +accepts +.B \-1 +for either or both old coordinates. +This value tells +.I \%ncurses +that the old location is unknown, +and that it must use only absolute motion, +as with the +.B \%cursor_address +.RB ( cup ) +capability, +rather than the least costly combination of absolute and relative +motion. .SH PORTABILITY -The \fIvirtual screen\fP functions \fBsetsyx\fP and \fBgetsyx\fP -are not described in X/Open Curses, Issue 4. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. +.PP +The +.I "virtual screen" +functions +.I \%setsyx +and +.I \%getsyx +are not described in X/Open Curses Issue\ 4. +SVr4 documents each of them +as returning an +.IR int "." +This is misleading, +as they are macros with no documented semantics for returning values. +.PP All other functions are as described in X/Open Curses. +It specifies no error conditions for them, +except as described for +.I \%curs_set +in section \*(``RETURN VALUE\*('' above. +.PP +The System\ V Interface Definition, +Version 4 (1995), +specified all of these functions except +.I \%curs_set +as returning +.IR OK "." +.\" SVID 4, vol 3., p. 518 +.PP +Older SVr4 man pages warn that the return value of +.I \%curs_set +\*(``is currently incorrect\*(''. +This implementation gets it right, +but counting on its correctness anywhere else may be unwise. +.PP +X/Open Curses specifies +.I \%ripoffline +as returning +.I OK +with no possibility of failure +(\*(``[c]alls to +.I \%ripoffline +above this limit +[five lines] +have no effect but report success\*(''). +.PP +X/Open Curses notes: +.RS +.PP +After use of +.IR \%mvcur "()," +the model Curses maintains of the state of the terminal might not +match the actual state of the terminal. +An application should touch and refresh the window before +resuming conventional use of Curses. +.RE .PP -The SVr4 documentation describes \fBsetsyx\fP and \fBgetsyx\fP -as having return type int. -This is misleading, as they are macros with no documented semantics -for the return value. +Both +.I \%ncurses +and SVr4 +.I curses +implement +.I \%mvcur +using the +.I SCREEN +object allocated in either \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X). +X/Open Curses states that the old location must be given for +.I \%mvcur +to accommodate terminals that lack absolute cursor positioning. +.\" X/Open Curses Issue 7, p. 161 .PP -If interrupted, \fI\%ncurses\fP restarts \fBnapms\fP. -That, and the limitation to 30 seconds, -are different from other implementations. +If interrupted by a signal, +.I \%ncurses +restarts +.IR \%napms "." +That, +and the limitation to 30 seconds, +differ from other implementations. .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_initscr\fP(3X), diff --git a/contrib/ncurses/man/curs_legacy.3x b/contrib/ncurses/man/curs_legacy.3x --- a/contrib/ncurses/man/curs_legacy.3x +++ b/contrib/ncurses/man/curs_legacy.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-2024,2025 Thomas E. Dickey * .\" Copyright 2007-2015,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,19 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_legacy.3x,v 1.32 2024/03/16 15:35:01 tom Exp $ -.TH curs_legacy 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" -.ie \n(.g \{\ -.ds `` \(lq -.ds '' \(rq -.\} -.el \{\ -.ie t .ds `` `` -.el .ds `` "" -.ie t .ds '' '' -.el .ds '' "" -.\} -. +.\" $Id: curs_legacy.3x,v 1.36 2025/02/15 18:43:02 tom Exp $ +.TH curs_legacy 3X 2025-02-15 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 @@ -107,24 +96,6 @@ Except as noted, these functions return an integer, or \fBERR\fP if the window parameter is null. -.SH NOTES -All of these interfaces are implemented as macros and functions. -The macros are suppressed -(and only the functions provided) -in an \*(``opaque\*('' -.I \%ncurses -build, -which defines the preprocessor symbol -.BR \%NCURSES_OPAQUE . -See section \*(``ALTERNATE CONFIGURATIONS\*('' in \fB\%ncurses\fP(3X). -.PP -The standard forms such as \fB\%getyx\fP -.I must -be implemented as macros, -and -(in this implementation) -are defined in terms of the functions described here, -to avoid reliance on internal details of the \fI\%WINDOW\fP structure. .SH PORTABILITY These functions were supported on Version 7, BSD or System V implementations. None of those implementations checked the window parameter. diff --git a/contrib/ncurses/man/curs_mouse.3x b/contrib/ncurses/man/curs_mouse.3x --- a/contrib/ncurses/man/curs_mouse.3x +++ b/contrib/ncurses/man/curs_mouse.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2015,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_mouse.3x,v 1.98 2024/04/20 19:02:07 tom Exp $ -.TH curs_mouse 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_mouse.3x,v 1.131 2025/11/12 01:06:36 tom Exp $ +.TH curs_mouse 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -53,75 +53,127 @@ \fB\%wenclose\fP, \fB\%mouse_trafo\fP, \fB\%wmouse_trafo\fP, -\fB\%mouseinterval\fP \- -get mouse events in \fIcurses\fR +\fB\%mouseinterval\fP, +\fB\%mmask_t\fP, +\fB\%MEVENT\fP \- +get mouse events in \fIncurses\fR .SH SYNOPSIS .nf \fB#include .PP +\fI/* data types */ \fBtypedef unsigned long mmask_t; .PP \fBtypedef struct { -\fB short id; \fI/* ID to distinguish multiple devices */ -\fB int x, y, z; \fI/* event coordinates */ -\fB mmask_t bstate; \fI/* button state bits */ +\fB short id; \fI/* ID to distinguish multiple devices */ +\fB int x, y, z; \fI/* event coordinates */ +\fB mmask_t bstate; \fI/* button state bits */ \fB} MEVENT; .PP +\fI/* functions */ \fBbool has_mouse(void); .PP -\fBmmask_t mousemask(mmask_t \fInewmask\fP, mmask_t *\fIoldmask\fP); +\fBmmask_t mousemask(mmask_t \fInew-mask\fP, mmask_t * \fIold-mask\fP); .PP -\fBint getmouse(MEVENT *\fIevent\fP); -\fBint ungetmouse(MEVENT *\fIevent\fP); +\fBint getmouse(MEVENT * \fIevent\fP); +\fBint ungetmouse(MEVENT * \fIevent\fP); .PP -\fBbool wenclose(const WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP); +\fBbool wenclose(const WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP); .PP -\fBbool mouse_trafo(int* \fIpY\fP, int* \fIpX\fP, bool \fIto_screen\fP); -\fBbool wmouse_trafo(const WINDOW* \fIwin\fP, -.ti +18n \" "bool wmouse_trafo(" -\fBint* \fIpY\fB, int* \fIpX\fB, bool \fIto_screen\fB); +\fBbool mouse_trafo(int * \fIpY\fP, int * \fIpX\fP, bool \fIto-screen\fP); +\fBbool wmouse_trafo(const WINDOW * \fIwin\fP, + \fBint * \fIpY\fB, int * \fIpX\fB, bool \fIto-screen\fB); .PP \fBint mouseinterval(int \fIerval\fB);\fR .fi .SH DESCRIPTION -These functions provide an interface to mouse events from -\fB\%ncurses\fP(3X). -Mouse events are represented by \fB\%KEY_MOUSE\fP -pseudo-key values in the \fB\%wgetch\fP(3X) input stream. +.I \%ncurses +provides an interface to the mouse or other pointing device. +An application can register its interest in such events; +the library then exposes the availability of a mouse event via an +.IR "input character reading function" ":" +this is \fB\%wgetch\fP(3X) in the non-wide character +.I curses +API and \fB\%wget_wch\fP(3X) in the wide character API. +A queue distinct from that used for keyboard events +accumulates the details of mouse events. +The input character reading function +reports the +.B \%KEY_MOUSE +key code when a mouse event is available for collection. +A single mouse event queue serves all windows +associated with the screen. +.PP +The +.I \%MEVENT +structure describes a mouse event. +Its +.I y +and +.I x +coordinates are screen-, +not window-, +relative. +The +.I \%bstate +member has exactly one bit set indicating the event type. +.PP +.I \%ncurses +ignores mouse events when input is in canonical (\*(``cooked\*('') mode, +and produces an error beep when they occur +while the library simulates canonical mode in a window, +as with \fB\%getstr\fP(3X) +(wide-character API users: \fB\%get_wstr\fP(3X)), +which expects a line feed to terminate its input loop. .SS has_mouse -The \fB\%has_mouse\fP function returns \fBTRUE\fP if the mouse driver -has been successfully initialized, -and \fBFALSE\fP otherwise. -.PP -Mouse events are ignored when input is in cooked mode, and -cause an error beep when cooked mode is being simulated in a window by a -function such as \fB\%getstr\fP that expects a linefeed for input-loop -termination. +The terminal type or operating system interface +must support the encoding of mouse events. +.B \%has_mouse +returns +.B TRUE +if +.IR \%ncurses 's +mouse driver initialized successfully, +and +.B FALSE +otherwise. .SS mousemask -To make mouse events visible, use the \fB\%mousemask\fP function. -This sets the mouse events to be reported. -By default, no mouse events are reported. +Use +.B \%mousemask +to select the varieties of mouse event your application wishes to +receive. +By default, +.I \%ncurses +reports no mouse events. .bP -The function returns an updated copy of \fInewmask\fP -to indicate which of the specified mouse events can be reported. +The function returns an updated copy of +.I new-mask +indicating which event types of interest +are reportable by the terminal's mouse protocol. .IP -If the screen has not been initialized, -or if the terminal does not support mouse-events, -this function returns 0. +If the screen is not initialized, +or the terminal interface does not report mouse events, +.B \%mousemask +returns 0. .bP -If \fIoldmask\fP is non-\fBNULL\fP, -this function fills the indicated location with the previous value of the -current screen's mouse event mask. -.PP -As a side effect, setting a zero mouse mask may turn off the mouse pointer; +If +.I old-mask +is not a null pointer, +.B \%mousemask +stores the previous value +of the screen's mouse event mask there. +.PP +As a side effect, +setting a zero mouse mask may turn off the mouse cursor; setting a nonzero mask may turn it on. Whether this happens is device-dependent. .SS "Mouse Events" -Here are the mouse event type masks which may be defined: +Several mouse event types may be selected; +construct a mask by logically \*(``or\*(''-ing their values. .PP .TS Lb Lb -Lb Lx. +Lb Lw(33n)x. Name Description = BUTTON1_PRESSED mouse button 1 down @@ -155,90 +207,165 @@ BUTTON5_TRIPLE_CLICKED mouse button 5 triple clicked _ BUTTON_SHIFT T{ -shift was down during button state change +a shift key was down during button state change T} BUTTON_CTRL T{ -control was down during button state change +a control key was down during button state change T} BUTTON_ALT T{ -alt was down during button state change +an alt key was down during button state change T} ALL_MOUSE_EVENTS report all button state changes REPORT_MOUSE_POSITION report mouse movement _ .TE .SS getmouse -Once a class of mouse events has been made visible in a window, -calling the \fB\%wgetch\fP function on that window may return -\fB\%KEY_MOUSE\fP as an indicator that a mouse event has been queued. -To read the event data and pop the event off the queue, call -\fB\%getmouse\fP. -This function will return \fBOK\fP if a mouse event -is actually visible in the given window, \fBERR\fP otherwise. -When \fB\%getmouse\fP returns \fBOK\fP, the data deposited as y and -x in the event structure coordinates will be screen-relative character-cell -coordinates. -The returned state mask will have exactly one bit set to -indicate the event type. -The corresponding data in the queue is marked invalid. -A subsequent call to \fB\%getmouse\fP will retrieve the next older -item from the queue. +When a window is configured to report a non-empty set of event types, +calling the input character reading function on that window may return +.B \%KEY_MOUSE +to indicate availability of an enqueued mouse event. +To read the event data and remove it from the queue, +call +.BR \%getmouse "," +which returns +.B OK +if a mouse event is visible in the given window +and +.B ERR +otherwise. +When +.B \%getmouse +returns +.BR OK "," +it deposits data describing the mouse event in the +.I event +pointer you supply. +A subsequent +.B \%getmouse +call retrieves the next older event from the queue. .SS ungetmouse -The \fB\%ungetmouse\fP function behaves analogously to \fB\%ungetch\fP. -It pushes -a \fB\%KEY_MOUSE\fP event onto the input queue, and associates with that event -the given state data and screen-relative character-cell coordinates. +.B \%ungetmouse +behaves analogously to \fB\%ungetch\fP(3X). +It pushes a +.B \%KEY_MOUSE +event onto the screen's input queue, +and +.I event +onto the mouse event queue. .SS wenclose -The \fB\%wenclose\fP function tests whether a given pair of screen-relative -character-cell coordinates is enclosed by a given window, returning \fBTRUE\fP -if it is and \fBFALSE\fP otherwise. -It is useful for determining what subset of -the screen windows enclose the location of a mouse event. -.PP -If the parameter is a pad, -\fB\%wenclose\fP uses the most recent screen coordinates used for -this pad in -\fB\%prefresh\fP(3X) or -\fB\%pnoutrefresh\fP(3X). +.B \%wenclose +returns +.B TRUE +if the pair of screen-relative coordinates +.RI ( y , +.IR x ")" +is enclosed by the given window +.IR win "," +and +.B FALSE +otherwise. +If +.I win +is a pad, +.B \%wenclose +uses its most recent screen coordinates as specified in +a \fB\%prefresh\fP(3X) or \fB\%pnoutrefresh\fP(3X) call. +.PP +.B \%wenclose +is useful for determining what subset of the screen's windows +encloses the location of a mouse event; +it is otherwise independent of the +.I \%ncurses +mouse API. .SS wmouse_trafo -The \fB\%wmouse_trafo\fP function transforms a given pair of coordinates -from \fB\%stdscr\fP-relative coordinates -to coordinates relative to the given window or vice versa. -The resulting \fB\%stdscr\fP-relative coordinates are not always -identical to screen coordinates due to the mechanism to reserve -lines on top or bottom of the screen for other purposes -(see the \fB\%ripoffline\fP(3X) and \fB\%slk_init\fP(3X) calls, for example). -.bP -If the parameter \fIto_screen\fP is \fBTRUE\fP, the pointers -\fIpY, pX\fP must reference the coordinates of a location -inside the window \fIwin\fP. -They are converted to \fB\%stdscr\fP-relative coordinates and returned -through the pointers. -If the conversion was successful, the function returns \fBTRUE\fP. -.IP -If one of the parameters was \fBNULL\fP or the location is -not inside the window, \fBFALSE\fP is returned. -.bP -If \fIto_screen\fP is -\fBFALSE\fP, the pointers \fIpY, pX\fP must reference -\fB\%stdscr\fP-relative coordinates. -They are converted to window-relative coordinates if the -window \fIwin\fP encloses this point. -In this case the function returns \fBTRUE\fP. -.IP -If one of the parameters is \fBNULL\fP or the point is not inside the -window, \fBFALSE\fP is returned. -.PP -The referenced coordinates -are only replaced by the converted coordinates if the transformation was -successful. +.B \%wmouse_trafo +transforms the given pair of coordinate pointers +.RI ( pY , +.IR pX ")" +from a +.IR win -relative +basis to a screen-relative one or +.IR "vice versa" "," +as +.I to-screen +is +.B TRUE +or +.BR FALSE "," +respectively. +.BR \%stdscr -relative +coordinates are not always identical to screen coordinates: +.I curses +supports reservation of screen lines at the top and/or bottom +for other purposes; +see \fB\%ripoffline\fP(3X) and \fB\%slk_init\fP(3X). +.PP +If +.I to-screen is +.B TRUE +and the pointers +.RI ( pY , +.IR pX ")" +reference coordinates inside +.IR win "," +.I \%ncurses +updates their values to +.BR \%stdscr -relative +coordinates and returns +.BR TRUE "." +If either +.I pY +or +.I pX +is a null pointer, +or +.RI ( pY , +.IR pX ")" +is not inside +.IR win "," +.B \%wmouse_trafo +returns +.BR FALSE "." +.PP +If +.I to-screen is +.B FALSE +and the pointers +.RI ( pY , +.IR pX ")" +reference coordinates inside +.BR stdscr "," +.I \%ncurses +updates their values to +.IR win -relative +coordinates and returns +.BR TRUE "." +If either +.I pY +or +.I pX +is a null pointer, +or +.RI ( pY , +.IR pX ")" +is not inside +.BR stdscr "," +.B \%wmouse_trafo +returns +.BR FALSE "." .SS mouse_trafo -The \fB\%mouse_trafo\fP function performs the same translation -as \fB\%wmouse_trafo\fP, -using \fB\%stdscr\fP for \fIwin\fP. +.B \%mouse_trafo +applies the +.B \%wmouse_trafo +translation to +.BR \%stdscr "." +If no screen lines are reserved by \fB\%ripoffline\fP(3X) or +\fB\%slk_init\fP(3X), +this is the identity transformation. .SS mouseinterval -The \fB\%mouseinterval\fP function sets the maximum time -(in thousands of a second) +.B \%mouseinterval +sets the maximum time +(in thousandths of a second) that can elapse between press and release events for them to be resolved as a .IR click . @@ -248,55 +375,76 @@ with motion, as a \*(``drag\*(''. .PP -Calling \fB\%mouseinterval(0)\fP disables click resolution. When .I \%ncurses detects a mouse event, it awaits further input activity up to this interval, and then checks for a subsequent mouse event which can be combined with the first event. -If the timeout expires without input activity -(which would happen with a zero interval), -then no click resolution will occur. -.PP -This function returns the previous interval value. -Use \fB\%mouseinterval(\-1)\fP to obtain the interval without altering it. +If the timeout expires without input activity, +then no click resolution occurs. +Calling +.B \%mouseinterval(0) +disables click resolution. +.PP +.B \%mouseinterval +returns the previous interval value. +Use +.B \%mouseinterval(\-1) +to obtain the interval without altering it. .PP The mouse interval is set to one sixth of a second when the corresponding screen is initialized, e.g., in \fBinitscr\fP(3X) or \fBsetupterm\fP(3X). .SH RETURN VALUE -\fB\%has_mouse\fP, -\fB\%wenclose\fP, -\fB\%mouse_trafo\fP, +.BR \%has_mouse "," +.BR \%wenclose "," +.BR \%mouse_trafo "," and -\fB\%wmouse_trafo\fP -return \fBTRUE\fP or \fBFALSE\fP as noted above. -.PP -\fB\%getmouse\fP and \fB\%ungetmouse\fP -return \fBERR\fP upon failure and \fBOK\fP upon success. -.PP -\fB\%getmouse\fP fails if: +.B \%wmouse_trafo +return +.B TRUE +or +.B FALSE +as noted above. +.PP +.B \%getmouse +and +.B \%ungetmouse +return +.B ERR +upon failure and +.B OK +upon success. +.PP +.B \%getmouse +fails if: .bP no mouse driver was initialized, .bP the mask of reportable events is zero, .bP a mouse event was detected that does not match the mask, +or .bP -or if no more events remain in the queue. +no more events remain in the queue. .PP -\fB\%ungetmouse\fP returns an error if the event queue is full. +.B \%ungetmouse +returns +.B ERR +if the event queue is full. .PP -\fB\%mousemask\fP +.B \%mousemask returns the mask of reportable events. .PP -\fB\%mouseinterval\fP +.B \%mouseinterval returns the previous interval value, unless the terminal was not initialized. In that case, it returns the maximum interval value (166). .SH NOTES -The order of the \fB\%MEVENT\fP structure members is not guaranteed. +The order of the +.B \%MEVENT +structure members is not guaranteed. Additional fields may be added to the structure in the future. .PP Under @@ -315,41 +463,66 @@ .RE .PP If you are using an unsupported configuration, -mouse events will not be visible to -\fI\%ncurses\fP (and the \fB\%mousemask\fP function will always -return \fB0\fP). +mouse events are not visible to +.I \%ncurses +(and the +.B \%mousemask +function always returns +.BR 0 ")." .PP -If the +If the terminal type possesses the (nonstandard) .I \%term\%info -entry contains a \fBXM\fP string, -this is used in the +string capability +.BR XM "," +.IR \%ncurses "'s" .I \%xterm -mouse driver to control the -way the terminal is initialized for mouse operation. -The default, if \fBXM\fP is not found, +mouse driver uses it when initializing the terminal for mouse operation. +The default, +if +.B XM +is not found, corresponds to private mode 1000 of -.I \%xterm: +.IR \%xterm "." .PP .RS 3 +.EX \eE[?1000%?%p1%{1}%=%th%el%; +.EE .RE .PP -The mouse driver also recognizes a newer -.I \%xterm -private mode 1006, -e.g., +.I \%ncurses +also recognizes +.IR \%xterm 's +newer private mode 1006. .PP .RS 3 +.EX \eE[?1006;1000%?%p1%{1}%=%th%el%; +.EE .RE .PP -The \fIz\fP member in the event structure is not presently used. +The +.I id +member of the mouse event structure is not presently used; +no terminal type or operating system interface supports reporting events +from distinguishable pointing devices. +If you synthesize an +.IR \%MEVENT "," +use an +.I id +of 0. +.PP +The +.I z +member of the mouse event structure is not presently used. It is intended for use with touch screens (which may be pressure-sensitive) or with 3D-mice/trackballs/power gloves. .PP -The \fB\%ALL_MOUSE_EVENTS\fP class does not -include \fB\%REPORT_MOUSE_POSITION\fP. +The +.B \%ALL_MOUSE_EVENTS +class does not include +.BR \%REPORT_MOUSE_POSITION "." They are distinct. For example, in @@ -357,19 +530,23 @@ wheel/scrolling mice send position reports as a sequence of presses of buttons 4 or 5 without matching button-releases. .SH EXTENSIONS -These functions were designed for -\fB\%ncurses\fP(3X), +These functions are +.I \%ncurses +extensions, and are not found in SVr4 .IR curses , 4.4BSD .IR curses , -or any other previous curses implementation. +or any other previous +.I curses +implementation. (SVr4 .I curses did have a .I \%getmouse function, -which took no argument and returned a different type.) +which took no argument and returned an +.IR "unsigned long" ".)" .SH PORTABILITY Applications employing the .I \%ncurses @@ -385,27 +562,27 @@ The following values may be specified. .RS 3 .TP 3 -1 +.B 1 has definitions for reserved events. The mask uses 28 bits. .TP 3 -2 +.B 2 adds definitions for button 5, removes the definitions for reserved events. The mask uses 29 bits. .RE -.PP -SVr4 -.I curses -had support for the mouse in a variant of \fI\%xterm\fP(1). +.SH HISTORY +SVr4 (1989) added mouse support to its variant of \fI\%xterm\fP(1). It is mentioned in a few places, with little supporting documentation. .bP Its \*(``libcurses\*('' manual page lists functions for this feature -prototyped in \fI\%curses.h\fP. +prototyped in +.IR \%curses.h "." .PP .RS 8 .EX +.nf extern int mouse_set(long int); extern int mouse_on(long int); extern int mouse_off(long int); @@ -413,16 +590,18 @@ extern int map_button(unsigned long); extern void wmouse_position(WINDOW *, int *, int *); extern unsigned long getmouse(void), getbmap(void); +.fi .EE .RE .bP Its \*(``terminfo\*('' manual page lists capabilities for the feature. -.\" These don't appear in in the SVID 4th edition, Volume 3, +.PP +.\" These don't appear in the SVID 4th edition, Volume 3, .\" terminfo(TI_ENV) man page. They can be found in, e.g., the "z/OS .\" V1R1.0 C Curses" book, Chapter 17, pp. 179-186 (PDF 213-220). .RS 8 .TS -Lb Lb Lb Lx. +Lb Lb Lb Lw(23n)x. buttons btns BT T{ Number of buttons on the mouse T} @@ -449,11 +628,17 @@ For instance, the SVr4 .I curses -library used the \fB\%get_mouse\fP capability to tell the terminal which +library used the +.B \%get_mouse +.RB ( getm ) +capability to tell the terminal which mouse button events it should send, passing the mouse-button bit mask to the terminal. Also, it could ask the terminal -where the mouse was using the \fB\%req_mouse_pos\fP capability. +where the mouse was using the +.B \%req_mouse_pos +.RB ( reqmp ) +capability. .IP Those features required a terminal program that had been modified to work with SVr4 @@ -481,37 +666,54 @@ .I \%xterm are .I not -ignored in cooked mode if they have been enabled by \fB\%mousemask\fP. +ignored in canonical (\*(``cooked\*('') mode +if they have been enabled by +.BR \%mousemask "." Instead, the .I \%xterm mouse report sequence appears in the string read. .PP -Mouse event reports from +An +.I \%ncurses +window must enable \fB\%keypad\fP(3X) to correctly receive mouse event +reports from .I \%xterm -are not detected correctly in a window with keypad application mode -disabled, -since they are interpreted as a variety of function key. +since they are encoded like function keys. Set the terminal's .I \%term\%info -capability \fB\%kmous\fP to \*(``\eE[M\*('' +capability +.B \%key_mouse +.RB ( \%kmous ) +to \*(``\eE[M\*('' (the beginning of the response from .I \%xterm for mouse clicks). -Other values of \fB\%kmous\fP are permitted under the same assumption, +Other values of +.B \%key_mouse +are permitted under the same assumption \(em that is, -the report begins with that sequence. +a mouse report begins with the value of the +.B \%key_mouse +.RB ( \%kmous ) +string capability. .PP Because there are no standard response sequences that serve to identify terminals supporting the .I \%xterm mouse protocol, .I \%ncurses -assumes that if \fB\%kmous\fP is defined in the terminal description, +assumes that if +.B \%key_mouse +.RB ( \%kmous ) +is defined in the terminal description, or if the terminal type's primary name or aliases contain the string \%\*(``xterm\*('', then the terminal may send mouse events. -The \fB\%kmous\fP capability is checked first, +.I \%ncurses +checks the +.B \%kmous +cap-code first, allowing use of newer .I \%xterm mouse protocols, diff --git a/contrib/ncurses/man/curs_move.3x b/contrib/ncurses/man/curs_move.3x --- a/contrib/ncurses/man/curs_move.3x +++ b/contrib/ncurses/man/curs_move.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,23 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_move.3x,v 1.40 2024/04/27 17:56:05 tom Exp $ -.TH curs_move 3X 2024-04-27 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_move.3x,v 1.63 2025/04/05 22:08:55 tom Exp $ +.TH curs_move 3X 2025-04-05 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.ie \n(.g \{\ +.ds `` \(lq +.ds '' \(rq +.\} +.el \{\ +.ie t .ds `` `` +.el .ds `` "" +.ie t .ds '' '' +.el .ds '' "" +.\} +. +.de bP +.ie n .IP \(bu 4 +.el .IP \(bu 2 +.. .SH NAME \fB\%move\fP, \fB\%wmove\fP \- @@ -38,7 +53,7 @@ \fB#include .PP \fBint move(int \fIy\fP, int \fIx\fP); -\fBint wmove(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP); +\fBint wmove(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP); .fi .SH DESCRIPTION .B \%wmove @@ -57,32 +72,47 @@ is relative to the upper left-hand corner of the window, which has coordinates (0,\ 0). -\fB\%ncurses\fP(3X) describes the -.B \%move -variant of this function. +.B move +similarly moves the cursor in the +.B \%stdscr +window. .SH RETURN VALUE These functions return .B OK on success and .B ERR on failure. -.PP -They fail if the position +In +.IR \%ncurses , +these functions fail if +.bP +the +.I curses +screen has not been initialized, +.bP +(for +.BR \%wmove ")" +.I win +is a null pointer, +or +.bP +the position .RI ( y , .IR x ) is outside the window boundaries. -.PP -.B \%wmove -fails if its -.I \%WINDOW -pointer argument is -.BR NULL . .SH NOTES .B \%move may be implemented as a macro. .SH PORTABILITY -X/Open Curses, -Issue 4 describes these functions. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.PP +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 503 +.SH HISTORY +4BSD (1980) +introduced these functions. .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_refresh\fP(3X) diff --git a/contrib/ncurses/man/curs_opaque.3x b/contrib/ncurses/man/curs_opaque.3x --- a/contrib/ncurses/man/curs_opaque.3x +++ b/contrib/ncurses/man/curs_opaque.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2020-2023,2024 Thomas E. Dickey * +.\" Copyright 2020-2024,2025 Thomas E. Dickey * .\" Copyright 2007-2014,2015 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_opaque.3x,v 1.43 2024/03/16 15:35:01 tom Exp $ -.TH curs_opaque 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_opaque.3x,v 1.50 2025/02/15 19:36:24 tom Exp $ +.TH curs_opaque 3X 2025-02-15 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -136,10 +136,12 @@ .TP \fBwgetparent\fP returns the parent \fI\%WINDOW\fP pointer for subwindows, -or \fBNULL\fP for windows having no parent. +or +.I NULL +for windows having no parent. .TP \fBwgetscrreg\fP -stores the the top and bottom rows for the scrolling margin set by +stores the top and bottom rows for the scrolling margin set by \fB\%wsetscrreg\fP(3X) in the corresponding arguments, returning \fBERR\fP upon failure and \fBOK\fP upon successful completion. @@ -148,11 +150,24 @@ .SH NOTES \fI\%ncurses\fP provides both a C function and a preprocessor macro for each function documented in this page. +.SH EXTENSIONS +These functions originated with +.IR \%ncurses "." .SH PORTABILITY -These routines are specific to \fI\%ncurses\fP. -They were not supported on Version 7, BSD or System V implementations. -It is recommended that any code depending on \fI\%ncurses\fP extensions -be conditioned using \fB\%NCURSES_VERSION\fP. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. +.PP +NetBSD +.I curses +since 10.1 (2024) supports +.IR \%wgetscr_reg "." +It also implements +.IR \%getscr_reg "," +operating on +.IR \%stdscr "." .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_inopts\fP(3X), diff --git a/contrib/ncurses/man/curs_outopts.3x b/contrib/ncurses/man/curs_outopts.3x --- a/contrib/ncurses/man/curs_outopts.3x +++ b/contrib/ncurses/man/curs_outopts.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,164 +27,348 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_outopts.3x,v 1.64 2024/04/20 21:24:19 tom Exp $ -.TH curs_outopts 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_outopts.3x,v 1.106 2025/11/12 00:52:57 tom Exp $ +.TH curs_outopts 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.ie \n(.g \{\ +.ds `` \(lq +.ds '' \(rq +.\} +.el \{\ +.ie t .ds `` `` +.el .ds `` "" +.ie t .ds '' '' +.el .ds '' "" +.\} +. .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 .. .SH NAME \fB\%clearok\fP, -\fB\%idlok\fP, \fB\%idcok\fP, +\fB\%idlok\fP, \fB\%immedok\fP, \fB\%leaveok\fP, +\fB\%scrollok\fP, \fB\%setscrreg\fP, -\fB\%wsetscrreg\fP, -\fB\%scrollok\fP \- +\fB\%wsetscrreg\fP \- set \fIcurses\fR output options .SH SYNOPSIS .nf \fB#include .PP -\fBint clearok(WINDOW *\fIwin\fP, bool \fIbf\fP); -\fBint idlok(WINDOW *\fIwin\fP, bool \fIbf\fP); -\fBvoid idcok(WINDOW *\fIwin\fP, bool \fIbf\fP); -\fBvoid immedok(WINDOW *\fIwin\fP, bool \fIbf\fP); -\fBint leaveok(WINDOW *\fIwin\fP, bool \fIbf\fP); -\fBint scrollok(WINDOW *\fIwin\fP, bool \fIbf\fP); +\fBint clearok(WINDOW * \fIwin\fP, bool \fIbf\fP); +\fBvoid idcok(WINDOW * \fIwin\fP, bool \fIbf\fP); +\fBint idlok(WINDOW * \fIwin\fP, bool \fIbf\fP); +\fBvoid immedok(WINDOW * \fIwin\fP, bool \fIbf\fP); +\fBint leaveok(WINDOW * \fIwin\fP, bool \fIbf\fP); +\fBint scrollok(WINDOW * \fIwin\fP, bool \fIbf\fP); .PP \fBint setscrreg(int \fItop\fP, int \fIbot\fP); -\fBint wsetscrreg(WINDOW *\fIwin\fP, int \fItop\fP, int \fIbot\fP); +\fBint wsetscrreg(WINDOW * \fIwin\fP, int \fItop\fP, int \fIbot\fP); .fi .SH DESCRIPTION -These routines set options that change the style of output within -\fBcurses\fP. -All options are initially \fBFALSE\fP, unless otherwise stated. -It is not necessary to turn these options off before calling \fBendwin\fP(3X). +These functions configure properties of +.I curses +windows that affect their manner of output. +Boolean-valued properties are initially +.B FALSE +except where noted. +\fBendwin\fP(3X) resets any terminal modes corresponding to these +properties; +an application need not restore their initial values. .SS clearok -If \fBclearok\fP is called with \fBTRUE\fP as argument, the next -call to \fBwrefresh\fP with this window will clear the screen completely and -redraw the entire screen from scratch. -This is useful when the contents of the -screen are uncertain, or in some cases for a more pleasing visual effect. +Setting +.IR win 's +.B \%clearok +property to +.B TRUE +causes the next +.B \%wrefresh +call on it to clear the terminal screen and redraw it entirely. +This property is useful to restore the contents of the screen +(perhaps because another process has written to the terminal), +or in some cases to achieve a more pleasing visual effect. If -the \fIwin\fP argument to \fBclearok\fP is the global variable \fBcurscr\fP, -the next call to \fBwrefresh\fP with any window causes the screen to be cleared -and repainted from scratch. -.SS idlok -If \fBidlok\fP is called with \fBTRUE\fP as second argument, \fBcurses\fP -considers using the hardware insert/delete line feature of terminals so -equipped. -Calling \fBidlok\fP with \fBFALSE\fP as second argument disables use -of line insertion and deletion. -This option should be enabled only if the -application needs insert/delete line, for example, for a screen editor. -It is -disabled by default because insert/delete line tends to be visually annoying -when used in applications where it is not really needed. -If insert/delete line -cannot be used, \fBcurses\fP redraws the changed portions of all lines. +.I \%win +is +.B \%curscr +(see \fBcurs_variables\fP(3X)), +the next +.B \%wrefresh +call on +.I any +window causes the terminal screen to clear and redraw as above. +.B \%wrefresh +resets this property to +.BR FALSE "." .SS idcok -If \fBidcok\fP is called with \fBFALSE\fP as second argument, \fBcurses\fP -no longer considers using the hardware insert/delete character feature of -terminals so equipped. -Use of character insert/delete is enabled by default. -Calling \fBidcok\fP with \fBTRUE\fP as second argument re-enables use -of character insertion and deletion. +(This property defaults +.BR TRUE ".)" +Setting +.IR win 's +.B \%idcok +property to +.B FALSE +prevents +.I curses +from using the insert/delete character capabilities of terminal types +possessing them according to the +.I \%term\%info +database. +.SS idlok +Setting +.IR win 's +.B \%idlok +property to +.B TRUE +causes +.I curses +to consider +using the insert/delete line capabilities of terminal types +possessing them according to the +.I \%term\%info +database. +Enable this option +if the application explicitly requires these operations, +as a full-screen text editor might; +otherwise the results may be visually annoying to the user. +.\" TODO: Substantiate that claim. .SS immedok -If \fBimmedok\fP is called with \fBTRUE\fP as second argument, -any change in the window image, -such as the ones caused by \fBwaddch, wclrtobot, wscrl\fP, -etc., automatically causes a call to \fBwrefresh\fP. -However, it may degrade performance considerably, -due to repeated calls to \fBwrefresh\fP. -Calling \fBimmedok\fP with \fBFALSE\fP as second argument +If +.B \%immedok +is called with +.B TRUE +as second argument, +changes to the window image, +such as those caused by +.BR \%waddch "," +.BR \%wclrtobot "," +or +.BR \%wscrl "," +automatically cause a call to +.BR wrefresh "." +Setting a window's +.B \%immedok +property may degrade performance considerably +if writes are frequent. +Calling +.B \%immedok +with +.B FALSE +as second argument restores the default behavior, -i.e., deferring screen updates until a refresh is needed. +deferring screen updates until a refresh is needed +or explicitly directed by the application. .SS leaveok -Normally, the hardware cursor is left at the location of the window cursor -being refreshed. -The \fBleaveok\fP option allows the cursor to be left +Normally, +.I curses +leaves the hardware cursor at the library's cursor location +of the window being refreshed. +The +.B \%leaveok +option allows the cursor to be left wherever the update happens to leave it. -It is useful for applications where -the cursor is not used, since it reduces the need for cursor motions. +It is useful for applications that do not employ a visible cursor, +since it reduces the need for cursor motions. .SS scrollok -The \fBscrollok\fP option controls what happens when the cursor of a window is -moved off the edge of the window or scrolling region, either as a result of a -newline action on the bottom line, or typing the last character of the last -line. -If disabled, (\fIbf\fP is \fBFALSE\fP), the cursor is left on the bottom -line. -If enabled, (\fIbf\fP is \fBTRUE\fP), the window is scrolled up one line -(Note that to get the physical scrolling effect on the terminal, it is -also necessary to call \fBidlok\fP). -.SS "setscrreg, wsetscrreg" -The \fBsetscrreg\fP and \fBwsetscrreg\fP routines allow the application -programmer to set a software scrolling region in a window. -The \fItop\fP and -\fIbot\fP parameters +The +.B \%scrollok +option controls what happens when a window's cursor +moves off the edge of the window or scrolling region, +as a result of either +(1) writing a newline anywhere on its bottom line, +or +(2) writing a character that advances the cursor to the last position +on its bottom line. +If disabled +.RI ( bf +is +.BR FALSE ")," +.I curses +leaves the cursor on the bottom line of the window. +If enabled +.RI ( bf +is +.BR TRUE ")," +.I curses +scrolls the window up one line. +(To get the physical scrolling effect on the terminal, +the application must also enable +.BR idlok ")." +.SS "setscrreg, wsetscrreg" +The +.B \%wsetscrreg +and +.B \%setscrreg +functions allow the application +to set a software scrolling region in the specified window or +.BR \%stdscr "," +respectively. +The +.I top +and +.I bot +parameters are the line numbers of the top and bottom margin of the scrolling region. -(Line 0 is the top line of the window.) If this option and -\fBscrollok\fP are enabled, an attempt to move off the bottom margin line -causes all lines in the scrolling region to scroll one line in the direction -of the first line. +If this option and +.B scrollok +are enabled, +an attempt to move off the bottom margin line +causes all lines in the scrolling region +to scroll one line in the direction of the first line. Only the text of the window is scrolled. -(Note that this -has nothing to do with the use of a physical scrolling region capability in the -terminal, like that in the VT100. -If \fBidlok\fP is enabled and the terminal -has either a scrolling region or insert/delete line capability, they will -probably be used by the output routines.) +(This process has nothing to do +with the scrolling region capability of the terminal, +as found in the DEC VT100.) +If +.B \%idlok +is enabled and the terminal +has either a scrolling region or insert/delete line capability, +they will probably be used by the output routines. .SH RETURN VALUE -The functions \fBsetscrreg\fP and \fBwsetscrreg\fP return \fBOK\fP upon success -and \fBERR\fP upon failure. +The functions +.B \%setscrreg +and +.B \%wsetscrreg +return +.B OK +upon success +and +.B ERR +upon failure. All other routines that return an integer always -return \fBOK\fP. -.PP -X/Open Curses does not specify any error conditions. +return +.BR OK "." .PP -In this implementation, +In +.IR \%ncurses "," +these functions fail if .bP -those functions that have a window pointer -will return an error if the window pointer is null +the +.I curses +screen has not been initialized, .bP -\fBwsetscrreg\fP -returns an error if the scrolling region limits extend outside the -window boundaries. +(for functions taking a +.I \%WINDOW +pointer argument) +.I win +is a null pointer, +or +.bP +(for +.B \%setscrreg +and +.BR \%wsetscrreg ")" +the function is passed arguments describing a scrolling region +with limits that extend outside the window boundaries. .SH NOTES -Note that -\fBclearok\fP, -\fBleaveok\fP, -\fBscrollok\fP, -\fBidcok\fP, and -\fBsetscrreg\fP may be macros. +.BR \%clearok "," +.BR \%leaveok "," +.BR \%scrollok "," +.BR \%idcok "," +and +.B \%setscrreg +may be implemented as macros. +.PP +Unlike the other functions described by this page, +.B \%setscrreg +does not accept a +.RI pointer-to- WINDOW +parameter, +but operates on +.BR stdscr "." +Use +.B \%wsetscrreg +to configure the scrolling region of a selected window. .PP -The \fBimmedok\fP routine is useful for windows that are used as terminal -emulators. +Historically, +applications used +.B \%idcok(FALSE) +to accommodate the \*(``magic cookie\*('' feature +of some terminal types; +see subsection \*(``Highlighting, Underlining, and Visible Bells\*('' +of \fB\%terminfo\fP(5). +When updating a line, +the presence of character cells with magic cookies in them +made the +.I curses +library's computations of characters to be rewritten inaccurate. +A better solution is to indicate the +.B \%magic_cookie_glitch +.RB ( xmc ) +capability in the terminal's type description. +.PP +.B \%immedok +is useful for windows that are used as terminal emulators. .SH PORTABILITY -These functions are described in X/Open Curses, Issue 4. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. .PP -Some historic curses implementations had, as an undocumented feature, the -ability to do the equivalent of \fBclearok(..., 1)\fP by saying -\fBtouchwin(stdscr)\fP or \fBclear(stdscr)\fP. -This will not work under \fI\%ncurses\fP. +Some historic +.I curses +implementations, +as an undocumented feature, +did the equivalent of +.RB \*(`` \%clearok( .\|.\|. ", 1)" \*('' +when +.B \%touchwin(stdstr) +or +.B \%clear(stdstr) +were used. +This trick does not work with +.IR \%ncurses . .PP -Earlier System V curses implementations specified that with \fBscrollok\fP -enabled, any window modification triggering a scroll also forced a physical -refresh. -X/Open Curses does not require this, and \fI\%ncurses\fP avoids doing -it to perform better vertical-motion optimization at \fBwrefresh\fP -time. +Early System\ V +.I curses +implementations specified that with +.I \%scrollok +enabled, +any window modification triggering a scroll +also forced a physical refresh. +X/Open Curses does not require this, +and +.I \%ncurses +avoids doing so to better optimize vertical motions upon a +.IR \%wrefresh "." .PP X/Open Curses does not mention that the cursor should be -made invisible as a side-effect of \fBleaveok\fP. -SVr4 curses documentation does this, but the code does not. -Use \fBcurs_set\fP to make the cursor invisible. +made invisible as a side effect of +.IR \%leaveok "." +SVr4 +.I curses +documentation notes this behavior, +but the code neglects to implement it. +Use \fB\%curs_set\fP(3X) to make the cursor invisible. .SH HISTORY +4BSD (1980) +introduced +.IR \%clearok "," +.IR \%leaveok "," +and +.IR \%scrollok "." +.PP +SVr2 (1984) +supplied +.IR \%idlok "," +.IR \%setscrreg "," +and +.IR \%wsetscrreg "." +.PP +SVr3.1 (1987) +implemented +.I \%idcok +and +.IR \%immedok "." +.PP .I \%ncurses -formerly treated \fBnl\fP(3X) and \fBnonl\fP(3X) as both input +formerly treated +.I nl +and +.I nonl +as both input .I and output options, but no longer; diff --git a/contrib/ncurses/man/curs_overlay.3x b/contrib/ncurses/man/curs_overlay.3x --- a/contrib/ncurses/man/curs_overlay.3x +++ b/contrib/ncurses/man/curs_overlay.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2020-2023,2024 Thomas E. Dickey * +.\" Copyright 2020-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2013,2015 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_overlay.3x,v 1.43 2024/04/20 21:20:07 tom Exp $ -.TH curs_overlay 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_overlay.3x,v 1.55 2025/01/19 00:51:10 tom Exp $ +.TH curs_overlay 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -40,6 +40,10 @@ .el .ds '' "" .\} . +.de bP +.ie n .IP \(bu 4 +.el .IP \(bu 2 +.. .SH NAME \fB\%overlay\fP, \fB\%overwrite\fP, @@ -74,24 +78,41 @@ then copying is non-destructive, as in \fBoverlay\fP. .SH RETURN VALUE -These routines return the integer \fBERR\fP upon failure and an \fBOK\fP -(SVr4 specifies only -\*(``an integer value other than \fBERR\fP\*('') -upon successful completion. +These functions return +.B OK +on success and +.B ERR +on failure. .PP -X/Open defines no error conditions. -In this implementation, -\fBcopywin\fP, -\fBoverlay\fP and \fBoverwrite\fP return an error -if either of the window pointers are null, or -if some part of the window would be placed off-screen. +In +.IR \%ncurses , +they return +.B ERR +if +.bP +either of the window pointers are null, +or +.bP +any part of the window would be placed off-screen. .SH NOTES -Note that \fBoverlay\fP and \fBoverwrite\fP may be macros. +.B \%overlay +and +.B \%overwrite +may be implemented as macros. .SH PORTABILITY -These functions are described in X/Open Curses, Issue 4, -which adds \fI\%const\fP qualifiers to the arguments. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +It adds +.I \%const +qualifiers to the arguments. +. \" TODO: migrate to HISTORY section It further specifies their behavior in the presence of characters with multibyte renditions (not yet supported in this implementation). +.\" XXX: stale? ncurses is fine with multibyte characters now, no? +.PP +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 522 .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_pad\fP(3X), diff --git a/contrib/ncurses/man/curs_pad.3x b/contrib/ncurses/man/curs_pad.3x --- a/contrib/ncurses/man/curs_pad.3x +++ b/contrib/ncurses/man/curs_pad.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2015,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_pad.3x,v 1.61 2024/04/27 17:55:43 tom Exp $ -.TH curs_pad 3X 2024-04-27 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_pad.3x,v 1.81 2025/08/23 22:50:00 tom Exp $ +.TH curs_pad 3X 2025-08-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -87,7 +87,8 @@ .B \%pnoutrefresh instead. .SS newpad -\fB\%newpad\fP creates and returns a pointer to a new pad data structure +.B \%newpad +creates and returns a pointer to a new pad data structure with the given number of lines, .IR nlines , and columns, @@ -114,7 +115,7 @@ before calling .BR \%prefresh . .SS "prefresh, pnoutrefresh" -.B \%prefresh\fP +.B \%prefresh and .B \%pnoutrefresh are analogous to \fB\%wrefresh\fP(3X) and \fB\%wnoutrefresh\fP(3X) @@ -156,7 +157,7 @@ written to the pad is used to populate the arguments to .BR \%prefresh . .SS pecho_wchar -.B \%pecho_wchar\fP +.B \%pecho_wchar is functionally equivalent to calling \fB\%wadd_wch\fP(3X) followed by .BR \%prefresh . It suggests to the @@ -168,111 +169,206 @@ written to the pad is used to populate the arguments to .BR \%prefresh . .SH RETURN VALUE -Functions that return an integer return \fBERR\fP upon failure and -\fBOK\fP -(SVr4 specifies only -\*(``an integer value other than \fBERR\fP\*('') +Functions that return an integer return +.B ERR +upon failure and +.B OK upon successful completion. .PP -Functions that return pointers return \fBNULL\fP on error, -and set \fB\%errno\fP to \fB\%ENOMEM\fP. +Functions that return pointers return a null pointer on failure, +and set +.I \%errno +to +.BR \%ENOMEM "." .PP -X/Open Curses does not specify any error conditions. In this implementation .RS 3 .TP 5 -\fB\%prefresh\fP and \fB\%pnoutrefresh\fP -return an error +.BR prefresh\ and\ pnoutrefresh +return +.B ERR if the window pointer is null, or if the window is not really a pad or if the area to refresh extends off-screen or if the minimum coordinates are greater than the maximum. .TP 5 -\fBpechochar\fP -returns an error -if the window is not really a pad, and the associated call -to \fB\%wechochar\fP returns an error. +.B pechochar +returns +.B ERR +if the window is not really a pad, +and the associated call to +.B \%wechochar +returns +.BR ERR "." .TP 5 -\fBpecho_wchar\fP -returns an error -if the window is not really a pad, and the associated call -to \fB\%wecho_wchar\fP returns an error. +.B pecho_wchar +returns +.B ERR +if the window is not really a pad, +and the associated call to +.B \%wecho_wchar +returns +.BR ERR "." .RE .SH NOTES -\fB\%pechochar\fP may be a macro. -.SH PORTABILITY -BSD \fIcurses\fP has no \fIpad\fP feature. -.PP -SVr2 \fIcurses\fP (1986) provided the \fB\%newpad\fP and related functions, -documenting them in a single line each. -SVr3 (1987) provided more extensive documentation. +.B \%pechochar +may be implemented as a macro. .PP -The documentation does not explain the term \fIpad\fP. -However, the Apollo \fIAegis\fP workstation operating system -supported a graphical \fIpad\fP feature: +.I curses +documentation is traditionally averse to motivating the term +\*(``pad\*(''. +The Apollo Aegis workstation operating system +.RI ( circa +1981) +supported a graphical pad feature. .bP These graphical pads could be much larger than the computer's display. .bP -The read-only output from a command could be scrolled back to inspect, +The read-only output from a command could be scrolled back to inspect and select text from the pad. .PP The two uses may be related. +.SH PORTABILITY +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.PP +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 524 .PP -X/Open Curses, Issue 4 describes these functions, -without significant change from the SVr3 documentation. -It describes no error conditions. -The behavior of \fB\%subpad\fP if the parent window is not -a pad is undocumented, -and is not checked by the vendor Unix implementations: +The behavior of +.I \%subpad +if the parent window is not a pad is undocumented, +and is not checked by the vendor Unix implementations. .bP -SVr4 \fIcurses\fP sets a flag in the \fI\%WINDOW\fP structure in -\fB\%newpad\fP which tells if the window is a \fIpad\fP. +SVr4 +.IR curses 's +.I \%newpad +sets a flag in the +.I \%WINDOW +structure indicating that the window is a pad. .IP -However, it uses this information only in -\fB\%waddch\fP (to decide if it should call \fB\%wrefresh\fP) and -\fB\%wscrl\fP (to avoid scrolling a pad), -and does not check in \fB\%wrefresh\fP to ensure that the pad -is refreshed properly. +However, +it uses this information only in +.I \%waddch +(to decide if it should call +.IR \%wrefresh ")" +and +.I \%wscrl +(to avoid scrolling a pad); +its +.I \%wrefresh +does not check it to ensure that a pad is properly updated. .bP -Solaris \fI\%xcurses\fP checks whether a window is a pad in -\fB\%wnoutrefresh\fP, -returning \fBERR\fP in that case. +Solaris +.I \%xcurses +checks whether a window is a pad in its +.IR \%wnoutrefresh "," +returning +.I ERR +in that case. .IP However, -it only sets the flag for subwindows if the parent window is a pad. -Its \fB\%newpad\fP function does not set this information. -Consequently, the check will never fail. +it sets the flag on subwindows only if the parent window is a pad. +Its +.I \%newpad +does not set this information. +Consequently, +the check never fails. .IP -It makes no comparable check in \fB\%pnoutrefresh\fP, -though interestingly enough, a comment in the source code -states that the lack of a check was an MKS extension. +It makes no comparable check in +.I \%pnoutrefresh +\(em though interestingly enough, +a comment in the source code states that the lack of a check +was an MKS extension. .bP -NetBSD 7 \fIcurses\fP -sets a flag in the \fI\%WINDOW\fP structure -for \fB\%newpad\fP and \fB\%subpad\fP, -using this to help with the distinction between \fB\%wnoutrefresh\fP -and \fB\%pnoutrefresh\fP. +NetBSD\ 7 +.I curses +sets a flag in the +.I \%WINDOW +structure for +.I \%newpad +and +.IR \%subpad "," +aiding itself to distinguish between +.I \%wnoutrefresh +and +.IR \%pnoutrefresh "." .IP It does not check for the case where a subwindow is created in -a pad using \fB\%subwin\fP or \fB\%derwin\fP. +a pad using +.I \%subwin +or +.IR \%derwin "." .IP -The \fB\%dupwin\fP function returns a regular window when duplicating a pad. -Likewise, \fB\%getwin\fP always returns a window, even if the saved -data was from a pad. +Its +.I \%dupwin +returns a regular window when duplicating a pad. +Likewise, +its +.I \%getwin +always returns a window, +even if the saved data was from a pad. .PP -This implementation +.IR \%ncurses ":" .bP -sets a flag in the \fI\%WINDOW\fP structure -for \fB\%newpad\fP and \fB\%subpad\fP, +sets a flag in the +.I \%WINDOW +structure for +.I \%newpad +and +.IR \%subpad "," .bP -allows a \fB\%subwin\fP or \fB\%derwin\fP call to succeed having a pad parent by -forcing the subwindow to be a pad, +allows a +.I \%subwin +or +.I \%derwin +call to succeed having a pad parent +by forcing the subwindow to be a pad, .bP -checks in both \fB\%wnoutrefresh\fP and \fB\%pnoutrefresh\fP to ensure -that pads and windows are handled distinctly, and +checks in both +.I \%wnoutrefresh +and +.I \%pnoutrefresh +to ensure that pads and windows are handled distinctly, +and .bP -ensures that \fB\%dupwin\fP and \fB\%getwin\fP treat -pads versus windows consistently. +ensures that +.I \%dupwin +and +.I \%getwin +treat pads versus windows consistently. +.SH HISTORY +SVr2 (1984) introduced +.IR \%newpad "," +.IR \%prefresh "," +and +.IR \%pnoutrefresh "," +documenting them in a single line each. +.PP +SVr3 (1987) added +.I \%subpad +and +.IR \%pechochar "," +and provided more extensive documentation. +.PP +The System\ V Interface Definition, +Version 4 (1995), +specified a function named +.IR \%pechowchar "." +This was a later addition to +.RI SVr4. x , +not appearing in the first SVr4 (1989). +It differs from X/Open's later +.I \%pecho_wchar +in that its +.I wstr +parameter was a +.I \%chtype +instead of a +.IR \%wchar_t "," +and was not +.IR const "-qualified." .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_addch\fP(3X), diff --git a/contrib/ncurses/man/curs_print.3x b/contrib/ncurses/man/curs_print.3x --- a/contrib/ncurses/man/curs_print.3x +++ b/contrib/ncurses/man/curs_print.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_print.3x,v 1.38 2024/03/16 15:35:01 tom Exp $ -.TH curs_print 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_print.3x,v 1.41 2025/02/15 18:42:34 tom Exp $ +.TH curs_print 3X 2025-02-15 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fB\%mcprint\fP \- write binary data to printer using \fIterminfo\fR capabilities @@ -36,54 +36,93 @@ .nf \fB#include .PP -\fBint mcprint(char *\fIdata\fP, int \fIlen\fP); +\fBint mcprint(char * \fIdata\fP, int \fIlen\fP); .fi .SH DESCRIPTION -This function uses the \fBmc5p\fP or \fBmc4\fP and \fBmc5\fP capabilities, -if they are present, to ship given data to a printer attached to the terminal. +.BR \%mcprint "," +an +.I \%ncurses +extension to the +.I curses +library, +uses the terminal's +.B \%prtr_non +.RB ( mc5p ) +or +.B \%prtr_on +.RB ( mc5 ) +and +.B \%prtr_off +.RB ( mc4 ) +media copy capabilities, +if defined, +to send +.I len +bytes of the given string +.I data +to a printer attached to the terminal. .PP -Note that the \fB\%mcprint\fP code has no way -to do flow control with the printer -or to know how much buffering it has. -Your application is responsible for -keeping the rate of writes to the printer below its continuous throughput rate -(typically about half of its nominal cps rating). +.B \%mcprint +has no means of flow control to the printer +nor of knowing how much buffering it has. +Your application is responsible +for keeping the rate of writes to the printer +below its continuous throughput rate, +typically about half of its nominal characters-per-second (cps) rating. Dot-matrix printers and -6-page-per-minute lasers can typically handle 80cps, so a good conservative -rule of thumb is to sleep for a second after shipping each 80-character line. -. +6-page-per-minute laser printers can typically handle 80 cps, +so a conservative rule of thumb +is to sleep for one second after sending an 80-character line. .SH RETURN VALUE -The \fB\%mcprint\fP function returns \fBERR\fP if the write operation aborted -for some reason. -In this case, \fB\%errno\fP will contain either an error associated -with \fBwrite\fP(2) or one of the following: +On success, +.B \%mcprint +returns the number of characters sent to the printer. +.PP +.B \%mcprint +returns +.B ERR +if the write operation fails for any reason. +In that event, +.B errno +contains either a value set by \fIwrite\fP(2), +or one of the following. .TP 5 \fBENODEV\fP -Capabilities for printer redirection do not exist. +The terminal lacks relevant media copy capabilities. .TP 5 \fBENOMEM\fP -Couldn't allocate sufficient memory to buffer the printer write. -.PP -When \fB\%mcprint\fP succeeds, it returns the number of characters actually -sent to the printer. +.I \%ncurses +could not allocate sufficient memory to buffer the write operation. .SH EXTENSIONS -\fB\%mcprint\fP was designed for -\fB\%ncurses\fP(3X), -and was not found in SVr4 -.IR curses , +.B \%mcprint +is an \fB\%ncurses\fP(3X) extension, +and is not found in SVr4 +.IR curses "," 4.4BSD -.IR curses , -or any other previous curses implementation. +.IR curses "," +or any other previous +.I curses +implementation. .SH PORTABILITY Applications employing this .I \%ncurses extension should condition its use on the visibility of the .B \%NCURSES_VERSION preprocessor macro. +.SH HISTORY +.I \%ncurses +introduced +.I \%mcprint +prior to version 1.9.9g (1996). .SH BUGS Padding in the -\fBmc5p\fP, -\fBmc4\fP, and -\fBmc5\fP capabilities is not interpreted. +.B \%prtr_non +.RB ( mc5p ), +.B \%prtr_on +.RB ( mc5 ), +and +.B \%prtr_off +.RB ( mc4 ) +capabilities is not interpreted. .SH SEE ALSO \fB\%curses\fP(3X) diff --git a/contrib/ncurses/man/curs_printw.3x b/contrib/ncurses/man/curs_printw.3x --- a/contrib/ncurses/man/curs_printw.3x +++ b/contrib/ncurses/man/curs_printw.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_printw.3x,v 1.53 2024/04/20 19:18:18 tom Exp $ -.TH curs_printw 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_printw.3x,v 1.65 2025/08/16 19:59:33 tom Exp $ +.TH curs_printw 3X 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -118,8 +118,7 @@ window, consider using \fI\%swprintf\fP(3) and \fB\%waddwstr\fP(3X) or similar. .SH PORTABILITY -X/Open Curses, -Issue 4 describes these functions. +X/Open Curses Issue\ 4 describes these functions. It specifies no error conditions for them. .PP .I \%ncurses @@ -128,75 +127,135 @@ However, the latter is obsolete. .bP -X/Open Curses, -Issue 4 Version 2 (1996), +X/Open Curses Issue\ 4 Version\ 2 (1996), marked \fB\%vwprintw\fP as requiring \fI\%varargs.h\fP and \*(``TO BE WITHDRAWN\*('', and specified \fB\%vw_printw\fP using the \fI\%stdarg.h\fP interface. .bP -X/Open Curses, Issue 5, Draft 2 +X/Open Curses Issue\ 5, Draft 2 (December 2007) marked \fBvwprintw\fP (along with \fBvwscanw\fP and the \fItermcap\fP interface) as withdrawn. After incorporating review comments, this became -X/Open Curses, Issue 7 (2009). +X/Open Curses Issue\ 7 (2009). .bP .I \%ncurses provides \fB\%vwprintw\fP, but marks it as deprecated. .SH HISTORY -While \fB\%printw\fP was implemented in 4BSD -(November 1980), +4BSD (1980) +introduced +.I \%wprintw +and its variants. .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/\ .\" libcurses/printw.c -it was unused until 4.2BSD -(August 1983), -which employed it for games. -That early version of +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/\ +.\" libcurses/mvprintw.c +It implemented all as functions, +not macros; +this initial distribution of .I curses -preceded the ANSI C standard of 1989. -It did not use \fI\%varargs.h\fP, -though that had been available since Seventh Edition Unix (1979). +preceded the ANSI C standard of 1989, +prior to which a variadic macro facility was not widely available +in the language. +.I \%printw +went unused in Berkeley distributions until 4.1cBSD (1983), +which employed it in games. +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.1cBSD/usr/src/\ +.\" games/canfield.c +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.1cBSD/usr/src/\ +.\" games/worm.c +4BSD's +.I \%wprintw +did not use +.IR \%varargs.h "," +which had been available since Seventh Edition Unix (1979). .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/include/\ .\" varargs.h In 1991 (a couple of years after SVr4 was generally available, and after the C standard was published), other developers updated the library, -using \fI\%stdarg.h\fP internally in 4.4BSD +using +.I \%stdarg.h +internally in 4.4BSD .IR curses . Even with this improvement, BSD .I curses did not use function prototypes (nor even declare functions) -in \fI\%curses.h\fP until 1992. +in +.I \%curses.h +until 1992. .PP -SVr2 (1984) documented \fB\%printw\fP and \fB\%wprintw\fP tersely as -\*(``printf on \fB\%stdscr\fP\*('' and -\*(``printf on \fIwin\fP\*('', +4BSD documented +.I \%printw +and +.I \%wprintw +tersely as \*(``printf on +.IR \%stdscr "\*(''" +and \*(``printf on +.IR win "\*(''," respectively. +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/man/man3/\ +.\" curses.3 +.PP +SVr3 summarized the functions in three lines, +asserting that they were analogous to \fI\%printf\fP(3) +and explaining that the string that \fI\%printf\fP(3) would write to the +standard output stream would instead be output using +.I \%waddstr +to the given window. +.\" GBR can't find a source to cite for this paraphrase, +.\" even after checking +.\" . +.\" +.\" The indicated paraphrase is from page 432: +.\" Unix System V Programmer's Reference Manual +.\" Prentice-Hall +.\" ISBN 0-13-940479-1 +.\" (bitsavers has 3rd printing from 1987) +.\" +.\" This lists mvprintw without detail, and printw as "printf on stdscr": +.\" Unix Programmer's Manual +.\" System Calls and Library Routines +.\" CBS College Publishing's UNIX System Library +.\" Holt, Rinehard and Winston, 1986 +.\" ISBN 0-03-009314-7 .PP -SVr3 (1987) added \fB\%mvprintw\fP and \fB\%mvwprintw\fP, -with a three-line summary asserting that they were analogous to -\fI\%printf\fP(3), -explaining that the string that \fI\%printf\fP(3) would write to the -standard output stream would instead be output using \fB\%waddstr\fP to -the given window. -SVr3 also implemented \fB\%vwprintw\fP, -describing its third parameter as a \fI\%va_list\fP, -defined in \fI\%varargs.h\fP, -and referred the reader to the manual pages for \fI\%varargs\fP and -\fI\%vprintf\fP for detailed descriptions. +SVr3 added +.IR \%vwprintw "," +describing its third parameter as a +.IR \%va_list "," +defined in +.IR \%varargs.h "," +and referred the reader to the manual pages for +.I \%varargs +and +.I \%vprintf +for detailed descriptions. .PP -SVr4 (1989) introduced no new variations of \fI\%printw\fP, -but provided for using either \fI\%varargs.h\fP or \fI\%stdarg.h\fP to -define the \fI\%va_list\fP type. +SVr4 (1989) introduced no new variations of +.IR \%printw "," +but provided for using either +.I \%varargs.h +or +.I \%stdarg.h +to define the +.I \%va_list +type. .\" either header declares "va_list", but only one can be used .PP -X/Open Curses, Issue 4 (1995), -defined \fB\%vw_printw\fP to replace \fB\%vwprintw\fP, -stating that its \fI\%va_list\fP type is defined in \fI\%stdarg.h\fP. +X/Open Curses Issue\ 4 (1995), +defined +.I \%vw_printw +to replace +.IR \%vwprintw "," +stating that its +.I \%va_list +type is defined in +.IR \%stdarg.h "." .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_addstr\fP(3X), diff --git a/contrib/ncurses/man/curs_refresh.3x b/contrib/ncurses/man/curs_refresh.3x --- a/contrib/ncurses/man/curs_refresh.3x +++ b/contrib/ncurses/man/curs_refresh.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2016 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_refresh.3x,v 1.46 2024/04/20 21:20:07 tom Exp $ -.TH curs_refresh 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_refresh.3x,v 1.58 2025/01/19 00:51:10 tom Exp $ +.TH curs_refresh 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -129,27 +129,34 @@ The routine \fBredrawwin\fP touches the entire window. .SH RETURN VALUE These routines return the integer \fBERR\fP upon failure and \fBOK\fP -(SVr4 specifies only -\*(``an integer value other than \fBERR\fP\*('') -upon successful completion. .PP -X/Open Curses does not specify any error conditions. In this implementation .RS 3 .TP 5 \fBwnoutrefresh\fP -returns an error +returns +.B ERR if the window pointer is null, or if the window is really a pad. .TP 5 \fBwredrawln\fP -returns an error -if the associated call to \fBtouchln\fP returns an error. +return +.B ERR +if the associated call to \fBtouchln\fP returns +.BR ERR "." .RE .SH NOTES -Note that \fBrefresh\fP and \fBredrawwin\fP may be macros. +.B \%refresh +and +.B \%redrawwin +may be implemented as macros. .SH PORTABILITY -X/Open Curses, Issue 4 describes these functions. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.PP +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 527 .PP Whether \fBwnoutrefresh\fP copies to the virtual screen the entire contents of a window or just its changed portions has never been well-documented in @@ -161,5 +168,5 @@ \fBwnoutrefresh\fP call to guarantee an entire-contents copy anywhere. .SH SEE ALSO \fB\%curses\fP(3X), -\fB\%curs_outopts\fP(3X) +\fB\%curs_outopts\fP(3X), \fB\%curs_variables\fP(3X) diff --git a/contrib/ncurses/man/curs_scanw.3x b/contrib/ncurses/man/curs_scanw.3x --- a/contrib/ncurses/man/curs_scanw.3x +++ b/contrib/ncurses/man/curs_scanw.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_scanw.3x,v 1.53 2024/04/20 19:18:18 tom Exp $ -.TH curs_scanw 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_scanw.3x,v 1.62 2025/07/05 13:03:05 tom Exp $ +.TH curs_scanw 3X 2025-07-05 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -126,8 +126,7 @@ implements \fI\%vsscanf\fP(3) internally if it is unavailable when the library is configured. .SH PORTABILITY -X/Open Curses, -Issue 4 describes these functions. +X/Open Curses Issue\ 4 describes these functions. It specifies no error conditions for them. .PP .I \%ncurses @@ -136,19 +135,17 @@ However, the latter is obsolete. .bP -X/Open Curses, -Issue 4 Version 2 (1996), +X/Open Curses Issue\ 4 Version\ 2 (1996), marked \fB\%vwscanw\fP as requiring \fI\%varargs.h\fP and \*(``TO BE WITHDRAWN\*('', and specified \fB\%vw_scanw\fP using the \fI\%stdarg.h\fP interface. .bP -X/Open Curses, -Issue 5, +X/Open Curses Issue\ 5, Draft 2 (December 2007) marked \fB\%vwscanw\fP (along with \fB\%vwscanw\fP and the \fItermcap\fP interface) as withdrawn. After incorporating review comments, this became -X/Open Curses, Issue 7 (2009). +X/Open Curses Issue\ 7 (2009). .bP .I \%ncurses provides \fB\%vwscanw\fP, @@ -188,65 +185,111 @@ and check the value of the corresponding variable to determine how many conversions succeeded. .SH HISTORY -\fB\%scanw\fP was implemented in 4BSD -(November 1980); +4BSD (1980) +introduced +.I \%wscanw +and its variants. .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/\ .\" libcurses/scanw.c -that early version of +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/\ +.\" libcurses/mvscanw.c +It implemented all as functions, +not macros; +this initial distribution of .I curses -preceded the ANSI C standard of 1989. -The function was unused in Berkeley distributions for over ten years, -until 4.4BSD, +preceded the ANSI C standard of 1989, +prior to which a variadic macro facility was not widely available. +.I \%scanw +went unused in Berkeley distributions until 4.3BSD-Reno (1990), which employed it in a game. -The 4BSD \fB\%scanw\fP did not use \fI\%varargs.h\fP, -though that had been available since Seventh Edition Unix (1979). +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD-Reno/src/\ +.\" games/chess/uxdsp.c +4BSD's +.I \%wscanw +did not use +.IR \%varargs.h "," +which had been available since Seventh Edition Unix (1979). .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/include/\ .\" varargs.h In 1991 (a couple of years after SVr4 was generally available, and after the C standard was published), other developers updated the library, -using \fI\%stdarg.h\fP internally in 4.4BSD +using +.I \%stdarg.h +internally in 4.4BSD .IR curses . Even with this improvement, BSD .I curses did not use function prototypes (nor even declare functions) -in \fI\%curses.h\fP until 1992. +in +.I \%curses.h +until 1992. .PP -SVr2 (1984) documented \fB\%scanw\fP and \fB\%wscanw\fP tersely as -\*(``scanf through \fB\%stdscr\fP\*('' and -\*(``scanf through \fIwin\fP\*('', +4BSD documented +.I \%scanw +and +.I \%wscanw +tersely as \*(``scanf through +.IR \%stdscr "\*(''" +and \*(``scanf through +.IR win "\*(''," respectively. -.PP -SVr3 (1987) added -\fB\%mvscanw\fP, and -\fB\%mvwscanw\fP, stating +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/man/man3/\ +.\" curses.3 +SVr3 (1987) +stated .RS .PP -\*(``[t]hese routines correspond to \fIscanf\fP(3S), +[t]hese routines correspond to \fIscanf\fP(3S), as do their arguments and return values. -\fB\%wgetstr\fP() is called on the window, -and the resulting line is used as input for the scan.\*('' +.IR \%wgetstr "()" +is called on the window, +and the resulting line is used as input for the scan. .RE +.\" GBR can't find a source to cite for this quotation, +.\" even after checking +.\" . .PP -SVr3 also implemented \fB\%vwscanw\fP, -describing its third parameter as a \fI\%va_list\fP, -defined in \fI\%varargs.h\fP, -and referred the reader to the manual pages for \fI\%varargs\fP and -\fI\%vprintf\fP for detailed descriptions. -(Because the SVr3 documentation does not mention \fI\%vscanf\fP, -the reference to \fI\%vprintf\fP might not be an error). +SVr3 added +.IR \%vwscanw "," +describing its third parameter as a +.IR \%va_list "," +defined in +.IR \%varargs.h "," +and referred the reader to the manual pages for +.I \%varargs +and +.I \%vprintf +for detailed descriptions. +(Because SVr3 documentation does not mention +.IR \%vscanf "," +the reference to +.I \%vprintf +might not be an error). .PP -SVr4 (1989) introduced no new variations of \fI\%scanw\fP, -but provided for using either \fI\%varargs.h\fP or \fI\%stdarg.h\fP to -define the \fI\%va_list\fP type. +SVr4 (1989) introduced no new variations of +.IR \%scanw "," +but provided for using either +.I \%varargs.h +or +.I \%stdarg.h +to define the +.I \%va_list +type. .\" either header declares "va_list", but only one can be used .PP -X/Open Curses, Issue 4 (1995), -defined \fI\%vw_scanw\fP to replace \fI\%vwscanw\fP, -stating that its \fI\%va_list\fP type is defined in \fI\%stdarg.h\fP. +X/Open Curses Issue\ 4 (1995) +defined +.I \%vw_scanw +to replace +.IR \%vwscanw "," +stating that its +.I \%va_list +type is defined in +.IR \%stdarg.h "." .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_getstr\fP(3X), diff --git a/contrib/ncurses/man/curs_scr_dump.3x b/contrib/ncurses/man/curs_scr_dump.3x --- a/contrib/ncurses/man/curs_scr_dump.3x +++ b/contrib/ncurses/man/curs_scr_dump.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_scr_dump.3x,v 1.43 2024/04/20 18:54:36 tom Exp $ -.TH curs_scr_dump 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_scr_dump.3x,v 1.55 2025/01/19 00:51:10 tom Exp $ +.TH curs_scr_dump 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -54,10 +54,10 @@ .nf \fB#include .PP -\fBint scr_dump(const char *\fIfilename\fP); -\fBint scr_restore(const char *\fIfilename\fP); -\fBint scr_init(const char *\fIfilename\fP); -\fBint scr_set(const char *\fIfilename\fP); +\fBint scr_dump(const char * \fIfilename\fP); +\fBint scr_restore(const char * \fIfilename\fP); +\fBint scr_init(const char * \fIfilename\fP); +\fBint scr_set(const char * \fIfilename\fP); .fi .SH DESCRIPTION .I curses @@ -70,83 +70,183 @@ \fB\%putwin\fP(3X), respectively. .SS scr_dump -\fB\%scr_dump\fP writes to +.B \%scr_dump +writes to .I filename the contents of the virtual screen; see \fB\%curscr\fP(3X). .SS scr_restore -\fB\%scr_restore\fP updates the virtual screen to contain the contents -of +.B \%scr_restore +updates the virtual screen to match the contents of .I filename -(if it was validly written with \fB\%scr_dump\fP). -No refresh is performed; -after performing any further desired updates, +(if validly written with +.BR \%scr_dump ")." +.I curses +does not perform a refresh; +after making any desired changes, call \fB\%doupdate\fP(3X) or similar. .SS scr_init -\fB\%scr_init\fP reads -.IR filename , +.B \%scr_init +reads +.IR filename "," using it to initialize .I curses data structures describing the state of the terminal screen. -If these data are valid, .I curses +then, +if it decides the terminal state is valid, bases its next update of the screen on this information rather than clearing it and starting from scratch. .PP -The data fail the validity check +.I curses +regards the terminal as in an invalid state for computation of updates +based on the contents of +.I filename +if +.bP +.I curses +knows that the terminal has been written to since the preceding +.B \%scr_dump +call, +or .bP -if the terminal employs +the terminal type supports the .I \%term\%info capabilities .B \%exit_ca_mode -.RB ( \%rmcup ) +.RB \%( rmcup ) or .B \%non_rev_rmcup -.RB ( \%nrrmc ) -are defined, -or -.bP -if +.RB \%( nrrmc ). +.PP +Either of the foregoing conditions means that .I curses -knows that the terminal has been written to since the preceding -\fB\%scr_dump\fP call. +cannot assume that the terminal's contents +match their representation in +.IR filename "." +The former is due to terminal features +(such as \fI\%xterm\fP(1)'s \*(``alternate screen\*('') +that couple cursor-positioning mode with a local cache of screen +contents. +.I curses +cannot know whether the terminal is displaying from that local cache +at the time the application calls +.BR \%scr_init "," +so it makes a pessimistic assumption that a full redraw is required; +see subsection \*(``Cursor Motions\*('' of \fB\%terminfo\fP(5). .PP -\fB\%scr_init\fP could be used after \fB\%initscr\fP(3X) or -\fB\%system\fP(3) to share the screen with another process that has -done a \fBscr_dump\fP after \fB\%endwin\fP(3X). +.B \%scr_init +could be used after \fB\%initscr\fP(3X) or \fI\%system\fP(3) to share +the screen with another process that has done a +.B \%scr_dump +after \fB\%endwin\fP(3X). +An application that supports suspending its state on exit and subsequent +resumption upon later execution might use +.B \%scr_dump +and +.B \%scr_init +thus. .SS scr_set -The \fBscr_set\fP routine is a combination of \fBscr_restore\fP and -\fBscr_init\fP. It tells the program that the information in \fIfilename\fP is -what is currently on the screen, and also what the program wants on the screen. -This can be thought of as a screen inheritance function. +.B \%scr_set +combines +.B \%scr_restore +and +.BR \%scr_init "," +synchronizing the contents of +.I filename +with the virtual screen. +It can be regarded as a screen inheritance function; +consider a real-time screen-sharing application. .SH RETURN VALUE -These functions return \fBOK\fP on success and \fBERR\fP on failure. +These functions return +.B OK +on success and +.B ERR +on failure. .PP -X/Open defines no failure conditions. -In this implementation, -each function fails if it cannot open -.IR filename . +In +.IR \%ncurses "," +each function returns +.B ERR +if it cannot open +.IR filename "." +.BR \%scr_init "," +.BR \%scr_restore "," +and +.B \%scr_set +return +.B ERR +if the contents of +.I filename +are invalid. .SH NOTES -\fB\%scr_init\fP, -\fB\%scr_set\fP, +.BR \%scr_init "," +.BR \%scr_restore "," and -\fB\%scr_restore\fP may be macros. +.B \%scr_set +may be implemented as macros. .SH PORTABILITY -X/Open Curses, -Issue 4 describes these functions. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.\" Unusually, SVID 4 explicitly indicated "OK" as a possible return +.\" value, rather than the "integer other than ERR" refrain (p. 529). .PP .\" SVID 4, p. 529 SVr4 omitted the .I \%const qualifiers. .PP -SVr4 documentation describes \fB\%scr_init\fP such that the dump data is -also considered invalid \*(``if the time-stamp of the tty is old\*('' +SVr4 documentation describes +.I \%scr_init +such that the dump data is also considered invalid +\*(``if the time-stamp of the tty is old\*('' but does not define \*(``old\*(''. +.PP +As of 2024, +.I \%PDCurses +provides these functions. +NetBSD +.I curses +does not. +.PP +Other implementations of +.I curses +store the window in binary form, +which makes the dump dependent +upon the +.I curses +library's internal data structures. +.I \%ncurses +avoids this drawback by storing the dump in textual form, +allowing more flexible use of the data. +For instance, +the +.I \%scr_restore +of SVr4 +.I curses +requires that the dumped window have the same dimensions +as the restored window. +.I \%ncurses +uses its +\fB\%wresize\fP(3X) +extension +to adjust the restored window size. +.SH HISTORY +SVr3 (1987) introduced +.IR \%scr_dump "," +.IR \%scr_init "," +and +.IR \%scr_restore "." +SVr3.1 added +.IR \%scr_set "." .SH SEE ALSO +.na \fB\%curses\fP(3X), \fB\%curs_initscr\fP(3X), \fB\%curs_refresh\fP(3X), \fB\%curs_util\fP(3X), \fB\%system\fP(3), -\fB\%scr_dump\fP(5) +\fB\%scr_dump\fP(5), +\fB\%terminfo\fP(5), +\fB\%wresize\fP(3X) +.ad diff --git a/contrib/ncurses/man/curs_scroll.3x b/contrib/ncurses/man/curs_scroll.3x --- a/contrib/ncurses/man/curs_scroll.3x +++ b/contrib/ncurses/man/curs_scroll.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2006,2010 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_scroll.3x,v 1.43 2024/04/20 18:54:36 tom Exp $ -.TH curs_scroll 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_scroll.3x,v 1.59 2025/04/05 22:20:39 tom Exp $ +.TH curs_scroll 3X 2025-04-05 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -48,43 +48,59 @@ \fB\%scroll\fP, \fB\%scrl\fP, \fB\%wscrl\fP \- -scroll a \fIcurses\fR window +scroll a \fIcurses\fP window .SH SYNOPSIS .nf \fB#include .PP -\fBint scroll(WINDOW *\fIwin\fP); +\fBint scroll(WINDOW * \fIwin\fP); .PP \fBint scrl(int \fIn\fP); -\fBint wscrl(WINDOW *\fIwin\fP, int \fIn\fP); +\fBint wscrl(WINDOW * \fIwin\fP, int \fIn\fP); .fi .SH DESCRIPTION -\fBscroll\fP scrolls the given window up one line. +.B scroll +scrolls the given window up one line. That is, every visible line we might number .I i becomes line .IR i "\-1." -The text of the top line in the window disappears and the bottom line -is populated with blank characters; -see \fB\%bkgd\fP(3X) or \fB\%bkgrnd\fP(3X). -As an optimization, -if the scrolling region of the window is the entire screen, -the physical screen may be scrolled at the same time; -see \fB\%curscr\fP(3X). -.PP -\fB\%scrl\fP and \fB\%wscrl\fP scroll -.B \%stdscr -or the specified window up or down depending on the sign of -.IR n . +.B \%wscrl +and +.B \%scrl +scroll the specified window or +.BR \%stdscr "," +respectively, +up or down per the sign of +.IR n "." .bP For positive -.IR n , -line \fIi\fP+\fIn\fP becomes \fIi\fP (scrolling up); +.IR n "," +line +.IR i + n +becomes +.I i +(scrolling up); .bP for negative -.IR n , -line \fIi\fP-\fIn\fP becomes \fIi\fP (scrolling down). +.IR n "," +line +.IR i \- n +becomes +.I i +(scrolling down). +.PP +A line that scrolls beyond the window boundaries disappears; +.I curses +populates a new one emerging at the opposite boundary +with the background character; +see \fB\%bkgd\fP(3X) +(wide-character API users: \fB\%bkgrnd\fP(3X)). +As an optimization, +if the scrolling region of the window is the entire screen, +the physical screen may be scrolled at the same time; +see \fB\%curscr\fP(3X). .PP The cursor does not move. These functions perform no operation unless scrolling is enabled for the @@ -96,42 +112,79 @@ .B OK upon success. .PP -.I \%ncurses -returns \fBERR\fP if scrolling is not enabled in the window, -for example with \fB\%scrollok\fP(3X), -or if the +In +.IR \%ncurses "," +they return +.B ERR +if +.bP +the +.I curses +screen has not been initialized, +.bP +(for functions taking a .I \%WINDOW -pointer is null. +pointer argument) +.I win +is a null pointer, +or +.bP +scrolling is not enabled in the window +(as by \fB\%scrollok\fP(3X)). .SH NOTES -Unusually, -there is no \fB\%wscroll\fP function; -\fBscroll\fP behaves as one would expect \fB\%wscroll\fP to, -accepting a \fI\%WINDOW\fP pointer argument. +.B \%scroll +and +.B \%scrl +may be implemented as macros. .PP -\fB\%scrl\fP and \fB\%scroll\fP may be implemented as macros. +Unusually, +there is no +.B \%wscroll +function; +.B scroll +behaves as one would expect +.B \%wscroll +to, +accepting a +.I \%WINDOW +pointer argument. .SH PORTABILITY -X/Open Curses, -Issue 4 describes these functions. -It defines no error conditions. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. .PP -SVr4 specifies only -\*(``an integer value other than \fBERR\fP\*('' as a successful return -value. +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 531 .PP SVr4 indicates that the optimization of physically scrolling immediately if the scroll region is the entire screen \*(``is\*('' performed, not \*(``may be\*('' performed. .I \%ncurses -deliberately does not guarantee that this will occur, -to leave open the possibility of smarter optimization of multiple scroll +deliberately does not guarantee that this occurs, +to leave open the possibility of better optimization of multiple scroll actions on the next update. .PP Neither SVr4 .I curses -nor X/Open Curses specify whether the current attribute or current color -pair of blanks generated by the scroll function are zeroed. -.I \%ncurses -does so. +nor X/Open Curses specify whether these functions zero the attributes or +color pair identifier of the background character. +In +.IR \%ncurses "," +they do not. +.SH HISTORY +4BSD (1980) +introduced +.IR scroll "," +defining it as a function. +.PP +SVr3.1 (1987) +added +.I \%scrl +and +.IR \%wscrl "," +redefining +.I \%scroll +as a macro wrapping the latter. .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_outopts\fP(3X) diff --git a/contrib/ncurses/man/curs_slk.3x b/contrib/ncurses/man/curs_slk.3x --- a/contrib/ncurses/man/curs_slk.3x +++ b/contrib/ncurses/man/curs_slk.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_slk.3x,v 1.71 2024/04/20 18:54:36 tom Exp $ -.TH curs_slk 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_slk.3x,v 1.85 2025/01/19 00:51:10 tom Exp $ +.TH curs_slk 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -135,9 +135,9 @@ \fBLINES\fP and the vertical size of \fB\%stdscr\fP are further reduced. .SS Labels Populate the labels with normal strings -(\fB\%slk_set\fP) +\%(\fBslk_set\fP) or wide-character strings -(\fB\%slk_wset\fP). +\%(\fBslk_wset\fP). Each function takes three parameters. .TP 8 \" "labnum" + 2n .I labnum @@ -213,47 +213,54 @@ \fB\%extended_slk_color\fP, which accepts an \fIint\fP value of at least 32 bits. .SH RETURN VALUE -Routines that return an integer return \fBERR\fP upon failure and -\fBOK\fP -(SVr4 specifies only -\*(``an integer value other than \fBERR\fP\*('') -upon successful completion. +Functions that return integers return +.B ERR +upon failure and +.B OK +upon success. .PP -X/Open Curses defines no error conditions. -.PP -In this implementation +In +.IR \%ncurses "," .RS 3 .TP 5 \fBslk_attr\fP returns the attribute used for the soft keys. .TP 5 \fBslk_attroff\fP, \fBslk_attron\fP, \fBslk_clear\fP, \fBslk_noutrefresh\fP, \fBslk_refresh\fP, \fBslk_touch\fP -return an error +return +.B ERR if the terminal or the softkeys were not initialized. .TP 5 \fBslk_attrset\fP -returns an error +returns +.B ERR if the terminal or the softkeys were not initialized. .TP 5 \fBslk_attr_set\fP -returns an error +returns +.B ERR if the terminal or the softkeys were not initialized, or the color pair is outside the range 0..\fBCOLOR_PAIRS\fP\-1. .TP 5 \fBslk_color\fP -returns an error +returns +.B ERR if the terminal or the softkeys were not initialized, or the color pair is outside the range 0..\fBCOLOR_PAIRS\fP\-1. .TP 5 \fBslk_init\fP -returns an error +returns +.B ERR if the format parameter is outside the range 0..3. .TP 5 \fBslk_label\fP -returns \fBNULL\fP on error. +returns +.I NULL +on error. .TP 5 \fBslk_set\fP -returns an error +returns +.B ERR if the terminal or the softkeys were not initialized, or the \fIlabnum\fP parameter is outside the range of label counts, or if the format parameter is outside the range 0..2, or if @@ -263,12 +270,15 @@ Most applications would use \fB\%slk_noutrefresh\fP because a \fB\%wrefresh\fP is likely to follow soon. .SH EXTENSIONS -X/Open Curses documents the \fIopts\fP argument -as reserved for future use, -saying that it must be null. -This implementation -uses that parameter in ABI 6 for the functions which have a color pair -parameter to support extended color pairs. +X/Open Curses documents the +.I opts +argument as reserved for future use, +saying that it must be a null pointer. +The +.IR \%ncurses\ 6 +ABI uses it +for the functions that accept a color pair parameter +to support extended color pairs. .PP For functions which modify the color, e.g., @@ -277,9 +287,12 @@ and used to set the color pair instead of the \fIshort\fP pair parameter. .SH PORTABILITY -X/Open Curses, -Issue 4 describes these functions, -with some differences from SVr4 \fIcurses\fP: +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.PP +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 533 .bP X/Open added functions like the SVr4 attribute-manipulation functions \fB\%slk_attron\fP, @@ -332,11 +345,13 @@ If \fB\%slk_start\fP is given a non-null \fIgp\fP, it copies the \fIng\fP elements of the group of soft-keys, up to 16. .IP -If there are more than 16 elements, \fB\%slk_start\fP returns an error. +If there are more than 16 elements, \fB\%slk_start\fP returns +.BR ERR "." .bP The format codes \fB2\fP and \fB3\fP for \fB\%slk_init\fP were added by \fI\%ncurses\fP in 1996. -PDCurses 2.4 added this feature in 2001. +.I \%PDCurses +2.4 added this feature in 2001. .PP The function \fB\%slk_attr\fP was added by \fI\%ncurses\fP in 1996. .PP diff --git a/contrib/ncurses/man/curs_sp_funcs.3x b/contrib/ncurses/man/curs_sp_funcs.3x --- a/contrib/ncurses/man/curs_sp_funcs.3x +++ b/contrib/ncurses/man/curs_sp_funcs.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2010-2015,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_sp_funcs.3x,v 1.50 2024/04/20 18:56:31 tom Exp $ -.TH curs_sp_funcs 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_sp_funcs.3x,v 1.57 2025/02/01 22:47:44 tom Exp $ +.TH curs_sp_funcs 3X 2025-02-01 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -46,169 +46,169 @@ .nf \fB#include .PP -\fBint alloc_pair_sp(SCREEN* \fIsp\fP, int \fIfg\fP, int \fIbg\fP); -\fBint assume_default_colors_sp(SCREEN* \fIsp\fP, int \fIfg\fP, int \fIbg\fP); -\fBint baudrate_sp(SCREEN* \fIsp\fP); -\fBint beep_sp(SCREEN* \fIsp\fP); -\fBbool can_change_color_sp(SCREEN* \fIsp\fP); -\fBint cbreak_sp(SCREEN* \fIsp\fP); -\fBint color_content_sp(SCREEN* \fIsp\fP, short \fIcolor\fP, short* \fIr\fP, short* \fIg\fP, short* \fIb\fP); -\fBint curs_set_sp(SCREEN* \fIsp\fP, int \fIvisibility\fP); -\fBint def_prog_mode_sp(SCREEN* \fIsp\fP); -\fBint def_shell_mode_sp(SCREEN* \fIsp\fP); +\fBint alloc_pair_sp(SCREEN * \fIsp\fP, int \fIfg\fP, int \fIbg\fP); +\fBint assume_default_colors_sp(SCREEN * \fIsp\fP, int \fIfg\fP, int \fIbg\fP); +\fBint baudrate_sp(SCREEN * \fIsp\fP); +\fBint beep_sp(SCREEN * \fIsp\fP); +\fBbool can_change_color_sp(SCREEN * \fIsp\fP); +\fBint cbreak_sp(SCREEN * \fIsp\fP); +\fBint color_content_sp(SCREEN * \fIsp\fP, short \fIcolor\fP, short * \fIr\fP, short * \fIg\fP, short * \fIb\fP); +\fBint curs_set_sp(SCREEN * \fIsp\fP, int \fIvisibility\fP); +\fBint def_prog_mode_sp(SCREEN * \fIsp\fP); +\fBint def_shell_mode_sp(SCREEN * \fIsp\fP); .PP -\fBint define_key_sp(SCREEN* \fIsp\fP, const char * \fIdefinition\fP, int \fIkeycode\fP); -\fBint delay_output_sp(SCREEN* \fIsp\fP, int \fIms\fP); -\fBint doupdate_sp(SCREEN* \fIsp\fP); -\fBint echo_sp(SCREEN* \fIsp\fP); -\fBint endwin_sp(SCREEN* \fIsp\fP); -\fBchar erasechar_sp(SCREEN* \fIsp\fP); -\fBint erasewchar_sp(SCREEN* \fIsp\fP, wchar_t *\fIwc\fP); +\fBint define_key_sp(SCREEN * \fIsp\fP, const char * \fIdefinition\fP, int \fIkeycode\fP); +\fBint delay_output_sp(SCREEN * \fIsp\fP, int \fIms\fP); +\fBint doupdate_sp(SCREEN * \fIsp\fP); +\fBint echo_sp(SCREEN * \fIsp\fP); +\fBint endwin_sp(SCREEN * \fIsp\fP); +\fBchar erasechar_sp(SCREEN * \fIsp\fP); +\fBint erasewchar_sp(SCREEN * \fIsp\fP, wchar_t *\fIwc\fP); \fBint extended_color_content_sp(SCREEN * \fIsp\fP, int \fIcolor\fP, int * \fIr\fP, int * \fIg\fP, int * \fIb\fP); -\fBint extended_pair_content_sp(SCREEN* \fIsp\fP, int \fIpair\fP, int * \fIfg\fP, int * \fIbg\fP); -\fBint extended_slk_color_sp(SCREEN* \fIsp\fP, int \fIpair\fP); +\fBint extended_pair_content_sp(SCREEN * \fIsp\fP, int \fIpair\fP, int * \fIfg\fP, int * \fIbg\fP); +\fBint extended_slk_color_sp(SCREEN * \fIsp\fP, int \fIpair\fP); .PP -\fBvoid filter_sp(SCREEN* \fIsp\fP); -\fBint find_pair_sp(SCREEN* \fIsp\fP, int \fIfg\fP, int \fIbg\fP); -\fBint flash_sp(SCREEN* \fIsp\fP); -\fBint flushinp_sp(SCREEN* \fIsp\fP); -\fBint free_pair_sp(SCREEN* \fIsp\fP, int \fIpair\fP); -\fBint get_escdelay_sp(SCREEN* \fIsp\fP); -\fBint getmouse_sp(SCREEN* \fIsp\fP, MEVENT* \fIevent\fP); -\fBWINDOW* getwin_sp(SCREEN* \fIsp\fP, FILE* \fIfilep\fP); -\fBint halfdelay_sp(SCREEN* \fIsp\fP, int \fItenths\fP); -\fBbool has_colors_sp(SCREEN* \fIsp\fP); +\fBvoid filter_sp(SCREEN * \fIsp\fP); +\fBint find_pair_sp(SCREEN * \fIsp\fP, int \fIfg\fP, int \fIbg\fP); +\fBint flash_sp(SCREEN * \fIsp\fP); +\fBint flushinp_sp(SCREEN * \fIsp\fP); +\fBint free_pair_sp(SCREEN * \fIsp\fP, int \fIpair\fP); +\fBint get_escdelay_sp(SCREEN * \fIsp\fP); +\fBint getmouse_sp(SCREEN * \fIsp\fP, MEVENT * \fIevent\fP); +\fBWINDOW * getwin_sp(SCREEN * \fIsp\fP, FILE * \fIfilep\fP); +\fBint halfdelay_sp(SCREEN * \fIsp\fP, int \fItenths\fP); +\fBbool has_colors_sp(SCREEN * \fIsp\fP); .PP -\fBbool has_ic_sp(SCREEN* \fIsp\fP); -\fBbool has_il_sp(SCREEN* \fIsp\fP); -\fBint has_key_sp(SCREEN* \fIsp\fP, int \fIc\fP); -\fBbool has_mouse_sp(SCREEN* \fIsp\fP); -\fBint init_color_sp(SCREEN* \fIsp\fP, short \fIcolor\fP, short \fIr\fP, short \fIg\fP, short \fIb\fP); -\fBint init_extended_color_sp(SCREEN* \fIsp\fP, int \fIcolor\fP, int \fIr\fP, int \fIg\fP, int \fIb\fP); -\fBint init_extended_pair_sp(SCREEN* \fIsp\fP, int \fIpair\fP, int \fIfg\fP, int \fIbg\fP); -\fBint init_pair_sp(SCREEN* \fIsp\fP, short \fIpair\fP, short \fIfg\fP, short \fIbg\fP); -\fBint intrflush_sp(SCREEN* \fIsp\fP, WINDOW* \fIwin\fP, bool \fIbf\fP); -\fBint is_cbreak_sp(SCREEN* \fIsp\fP); +\fBbool has_ic_sp(SCREEN * \fIsp\fP); +\fBbool has_il_sp(SCREEN * \fIsp\fP); +\fBint has_key_sp(SCREEN * \fIsp\fP, int \fIc\fP); +\fBbool has_mouse_sp(SCREEN * \fIsp\fP); +\fBint init_color_sp(SCREEN * \fIsp\fP, short \fIcolor\fP, short \fIr\fP, short \fIg\fP, short \fIb\fP); +\fBint init_extended_color_sp(SCREEN * \fIsp\fP, int \fIcolor\fP, int \fIr\fP, int \fIg\fP, int \fIb\fP); +\fBint init_extended_pair_sp(SCREEN * \fIsp\fP, int \fIpair\fP, int \fIfg\fP, int \fIbg\fP); +\fBint init_pair_sp(SCREEN * \fIsp\fP, short \fIpair\fP, short \fIfg\fP, short \fIbg\fP); +\fBint intrflush_sp(SCREEN * \fIsp\fP, WINDOW * \fIwin\fP, bool \fIbf\fP); +\fBint is_cbreak_sp(SCREEN * \fIsp\fP); .PP -\fBint is_echo_sp(SCREEN* \fIsp\fP); -\fBint is_nl_sp(SCREEN* \fIsp\fP); -\fBint is_raw_sp(SCREEN* \fIsp\fP); -\fBbool is_term_resized_sp(SCREEN* \fIsp\fP, int \fIlines\fP, int \fIcolumns\fP); -\fBbool isendwin_sp(SCREEN* \fIsp\fP); -\fBint key_defined_sp(SCREEN* \fIsp\fP, const char *\fIdefinition\fP); -\fBchar* keybound_sp(SCREEN* \fIsp\fP, int \fIkeycode\fP, int \fIcount\fP); -\fBNCURSES_CONST char* keyname_sp(SCREEN* \fIsp\fP, int \fIc\fP); -\fBint keyok_sp(SCREEN* \fIsp\fP, int \fIkeycode\fP, bool \fIenable\fP); -\fBchar killchar_sp(SCREEN* \fIsp\fP); +\fBint is_echo_sp(SCREEN * \fIsp\fP); +\fBint is_nl_sp(SCREEN * \fIsp\fP); +\fBint is_raw_sp(SCREEN * \fIsp\fP); +\fBbool is_term_resized_sp(SCREEN * \fIsp\fP, int \fIlines\fP, int \fIcolumns\fP); +\fBbool isendwin_sp(SCREEN * \fIsp\fP); +\fBint key_defined_sp(SCREEN * \fIsp\fP, const char *\fIdefinition\fP); +\fBchar * keybound_sp(SCREEN * \fIsp\fP, int \fIkeycode\fP, int \fIcount\fP); +\fBNCURSES_CONST char * keyname_sp(SCREEN * \fIsp\fP, int \fIc\fP); +\fBint keyok_sp(SCREEN * \fIsp\fP, int \fIkeycode\fP, bool \fIenable\fP); +\fBchar killchar_sp(SCREEN * \fIsp\fP); .PP -\fBint killwchar_sp(SCREEN* \fIsp\fP, wchar_t *\fIwc\fP); -\fBchar* longname_sp(SCREEN* \fIsp\fP); -\fBint mcprint_sp(SCREEN* \fIsp\fP, char *\fIdata\fP, int \fIlen\fP); -\fBint mouseinterval_sp(SCREEN* \fIsp\fP, int \fIerval\fP); -\fBmmask_t mousemask_sp(SCREEN* \fIsp\fP, mmask_t \fInewmask\fP, mmask_t *\fIoldmask\fP); -\fBint mvcur_sp(SCREEN* \fIsp\fP, int \fIoldrow\fP, int \fIoldcol\fP, int \fInewrow\fP, int \fInewcol\fP); -\fBint napms_sp(SCREEN* \fIsp\fP, int \fIms\fP); -\fBWINDOW* newpad_sp(SCREEN* \fIsp\fP, int \fInrows\fP, int \fIncols\fP); -\fBSCREEN* new_prescr(void); -\fBSCREEN* newterm_sp(SCREEN* \fIsp\fP, const char *\fItype\fP, FILE *\fIoutfd\fP, FILE *\fIinfd\fP); +\fBint killwchar_sp(SCREEN * \fIsp\fP, wchar_t *\fIwc\fP); +\fBchar * longname_sp(SCREEN * \fIsp\fP); +\fBint mcprint_sp(SCREEN * \fIsp\fP, char *\fIdata\fP, int \fIlen\fP); +\fBint mouseinterval_sp(SCREEN * \fIsp\fP, int \fIerval\fP); +\fBmmask_t mousemask_sp(SCREEN * \fIsp\fP, mmask_t \fInewmask\fP, mmask_t *\fIoldmask\fP); +\fBint mvcur_sp(SCREEN * \fIsp\fP, int \fIoldrow\fP, int \fIoldcol\fP, int \fInewrow\fP, int \fInewcol\fP); +\fBint napms_sp(SCREEN * \fIsp\fP, int \fIms\fP); +\fBWINDOW * newpad_sp(SCREEN * \fIsp\fP, int \fInrows\fP, int \fIncols\fP); +\fBSCREEN * new_prescr(void); +\fBSCREEN * newterm_sp(SCREEN * \fIsp\fP, const char *\fItype\fP, FILE *\fIoutf\fP, FILE *\fIinf\fP); .PP -\fBWINDOW* newwin_sp(SCREEN* \fIsp\fP, int \fInlines\fP, int \fIncols\fP, int \fIbegin_y\fP, int \fIbegin_x\fP); -\fBint nl_sp(SCREEN* \fIsp\fP); -\fBint nocbreak_sp(SCREEN* \fIsp\fP); -\fBint noecho_sp(SCREEN* \fIsp\fP); -\fBvoid nofilter_sp(SCREEN* \fIsp\fP); -\fBint nonl_sp(SCREEN* \fIsp\fP); -\fBvoid noqiflush_sp(SCREEN* \fIsp\fP); -\fBint noraw_sp(SCREEN* \fIsp\fP); -\fBint pair_content_sp(SCREEN* \fIsp\fP, short \fIpair\fP, short* \fIfg\fP, short* \fIbg\fP); -\fBvoid qiflush_sp(SCREEN* \fIsp\fP); +\fBWINDOW * newwin_sp(SCREEN * \fIsp\fP, int \fInlines\fP, int \fIncols\fP, int \fIbegin_y\fP, int \fIbegin_x\fP); +\fBint nl_sp(SCREEN * \fIsp\fP); +\fBint nocbreak_sp(SCREEN * \fIsp\fP); +\fBint noecho_sp(SCREEN * \fIsp\fP); +\fBvoid nofilter_sp(SCREEN * \fIsp\fP); +\fBint nonl_sp(SCREEN * \fIsp\fP); +\fBvoid noqiflush_sp(SCREEN * \fIsp\fP); +\fBint noraw_sp(SCREEN * \fIsp\fP); +\fBint pair_content_sp(SCREEN * \fIsp\fP, short \fIpair\fP, short * \fIfg\fP, short * \fIbg\fP); +\fBvoid qiflush_sp(SCREEN * \fIsp\fP); .PP -\fBint raw_sp(SCREEN* \fIsp\fP); -\fBvoid reset_color_pairs_sp(SCREEN* \fIsp\fP); -\fBint reset_prog_mode_sp(SCREEN* \fIsp\fP); -\fBint reset_shell_mode_sp(SCREEN* \fIsp\fP); -\fBint resetty_sp(SCREEN* \fIsp\fP); -\fBint resize_term_sp(SCREEN* \fIsp\fP, int \fIlines\fP, int \fIcolumns\fP); -\fBint resizeterm_sp(SCREEN* \fIsp\fP, int \fIlines\fP, int \fIcolumns\fP); -\fBint ripoffline_sp(SCREEN* \fIsp\fP, int \fIline\fP, int (*\fIinit\fP)(WINDOW* \fIwin\fP, int \fIfmt\fP)); -\fBint savetty_sp(SCREEN* \fIsp\fP); -\fBint scr_init_sp(SCREEN* \fIsp\fP, const char *\fIfilename\fP); +\fBint raw_sp(SCREEN * \fIsp\fP); +\fBvoid reset_color_pairs_sp(SCREEN * \fIsp\fP); +\fBint reset_prog_mode_sp(SCREEN * \fIsp\fP); +\fBint reset_shell_mode_sp(SCREEN * \fIsp\fP); +\fBint resetty_sp(SCREEN * \fIsp\fP); +\fBint resize_term_sp(SCREEN * \fIsp\fP, int \fIlines\fP, int \fIcolumns\fP); +\fBint resizeterm_sp(SCREEN * \fIsp\fP, int \fIlines\fP, int \fIcolumns\fP); +\fBint ripoffline_sp(SCREEN * \fIsp\fP, int \fIline\fP, int (*\fIinit\fP)(WINDOW * \fIwin\fP, int \fIfmt\fP)); +\fBint savetty_sp(SCREEN * \fIsp\fP); +\fBint scr_init_sp(SCREEN * \fIsp\fP, const char *\fIfilename\fP); .PP -\fBint scr_restore_sp(SCREEN* \fIsp\fP, const char *\fIfilename\fP); -\fBint scr_set_sp(SCREEN* \fIsp\fP, const char *\fIfilename\fP); -\fBint set_escdelay_sp(SCREEN* \fIsp\fP, int \fIms\fP); -\fBint set_tabsize_sp(SCREEN* \fIsp\fP, int \fIcols\fP); -\fBint slk_attrset_sp(SCREEN* \fIsp\fP, const chtype \fIa\fP); -\fBint slk_attr_set_sp(SCREEN* \fIsp\fP, const attr_t \fIattrs\fP, short \fIpair\fP, void*\fIopts\fP); -\fBint slk_attroff_sp(SCREEN* \fIsp\fP, const chtype \fIa\fP); -\fBint slk_attron_sp(SCREEN* \fIsp\fP, const chtype \fIa\fP); -\fBattr_t slk_attr_sp(SCREEN* \fIsp\fP); -\fBint slk_clear_sp(SCREEN* \fIsp\fP); +\fBint scr_restore_sp(SCREEN * \fIsp\fP, const char *\fIfilename\fP); +\fBint scr_set_sp(SCREEN * \fIsp\fP, const char *\fIfilename\fP); +\fBint set_escdelay_sp(SCREEN * \fIsp\fP, int \fIms\fP); +\fBint set_tabsize_sp(SCREEN * \fIsp\fP, int \fIcols\fP); +\fBint slk_attrset_sp(SCREEN * \fIsp\fP, const chtype \fIa\fP); +\fBint slk_attr_set_sp(SCREEN * \fIsp\fP, const attr_t \fIattrs\fP, short \fIpair\fP, void *\fIopts\fP); +\fBint slk_attroff_sp(SCREEN * \fIsp\fP, const chtype \fIa\fP); +\fBint slk_attron_sp(SCREEN * \fIsp\fP, const chtype \fIa\fP); +\fBattr_t slk_attr_sp(SCREEN * \fIsp\fP); +\fBint slk_clear_sp(SCREEN * \fIsp\fP); .PP -\fBint slk_color_sp(SCREEN* \fIsp\fP, short \fIpair\fP); -\fBint slk_init_sp(SCREEN* \fIsp\fP, int \fIfmt\fP); -\fBchar* slk_label_sp(SCREEN* \fIsp\fP, int \fIlabnum\fP); -\fBint slk_noutrefresh_sp(SCREEN* \fIsp\fP); -\fBint slk_refresh_sp(SCREEN* \fIsp\fP); -\fBint slk_restore_sp(SCREEN* \fIsp\fP); -\fBint slk_set_sp(SCREEN* \fIsp\fP, int \fIlabnum\fP, const char * \fIlabel\fP, int \fIfmt\fP); -\fBint slk_touch_sp(SCREEN* \fIsp\fP); -\fBint start_color_sp(SCREEN* \fIsp\fP); -\fBattr_t term_attrs_sp(SCREEN* \fIsp\fP); +\fBint slk_color_sp(SCREEN * \fIsp\fP, short \fIpair\fP); +\fBint slk_init_sp(SCREEN * \fIsp\fP, int \fIfmt\fP); +\fBchar * slk_label_sp(SCREEN * \fIsp\fP, int \fIlabnum\fP); +\fBint slk_noutrefresh_sp(SCREEN * \fIsp\fP); +\fBint slk_refresh_sp(SCREEN * \fIsp\fP); +\fBint slk_restore_sp(SCREEN * \fIsp\fP); +\fBint slk_set_sp(SCREEN * \fIsp\fP, int \fIlabnum\fP, const char * \fIlabel\fP, int \fIfmt\fP); +\fBint slk_touch_sp(SCREEN * \fIsp\fP); +\fBint start_color_sp(SCREEN * \fIsp\fP); +\fBattr_t term_attrs_sp(SCREEN * \fIsp\fP); .PP -\fBchtype termattrs_sp(SCREEN* \fIsp\fP); -\fBchar* termname_sp(SCREEN* \fIsp\fP); -\fBint typeahead_sp(SCREEN* \fIsp\fP, int \fIfd\fP); -\fBint unget_wch_sp(SCREEN* \fIsp\fP, const wchar_t \fIwc\fP); -\fBint ungetch_sp(SCREEN* \fIsp\fP, int \fIc\fP); -\fBint ungetmouse_sp(SCREEN* \fIsp\fP, MEVENT* \fIevent\fP); -\fBint use_default_colors_sp(SCREEN* \fIsp\fP); -\fBvoid use_env_sp(SCREEN* \fIsp\fP, bool \fIbf\fP); -\fBint use_legacy_coding_sp(SCREEN* \fIsp\fP, int \fIlevel\fP); +\fBchtype termattrs_sp(SCREEN * \fIsp\fP); +\fBchar * termname_sp(SCREEN * \fIsp\fP); +\fBint typeahead_sp(SCREEN * \fIsp\fP, int \fIfd\fP); +\fBint unget_wch_sp(SCREEN * \fIsp\fP, const wchar_t \fIwc\fP); +\fBint ungetch_sp(SCREEN * \fIsp\fP, int \fIc\fP); +\fBint ungetmouse_sp(SCREEN * \fIsp\fP, MEVENT * \fIevent\fP); +\fBint use_default_colors_sp(SCREEN * \fIsp\fP); +\fBvoid use_env_sp(SCREEN * \fIsp\fP, bool \fIbf\fP); +\fBint use_legacy_coding_sp(SCREEN * \fIsp\fP, int \fIlevel\fP); \fBvoid use_tioctl_sp(SCREEN *\fIsp\fP, bool \fIbf\fP); .PP -\fBint vid_attr_sp(SCREEN* \fIsp\fP, attr_t \fIattrs\fP, short \fIpair\fP, void * \fIopts\fP); -\fBint vid_puts_sp(SCREEN* \fIsp\fP, attr_t \fIattrs\fP, short \fIpair\fP, void * \fIopts\fP, NCURSES_SP_OUTC \fIputc\fP); -\fBint vidattr_sp(SCREEN* \fIsp\fP, chtype \fIattrs\fP); -\fBint vidputs_sp(SCREEN* \fIsp\fP, chtype \fIattrs\fP, NCURSES_SP_OUTC \fIputc\fP); -\fBwchar_t* wunctrl_sp(SCREEN* \fIsp\fP, cchar_t *\fIwch\fP); +\fBint vid_attr_sp(SCREEN * \fIsp\fP, attr_t \fIattrs\fP, short \fIpair\fP, void * \fIopts\fP); +\fBint vid_puts_sp(SCREEN * \fIsp\fP, attr_t \fIattrs\fP, short \fIpair\fP, void * \fIopts\fP, NCURSES_SP_OUTC \fIputc\fP); +\fBint vidattr_sp(SCREEN * \fIsp\fP, chtype \fIattrs\fP); +\fBint vidputs_sp(SCREEN * \fIsp\fP, chtype \fIattrs\fP, NCURSES_SP_OUTC \fIputc\fP); +\fBwchar_t * wunctrl_sp(SCREEN * \fIsp\fP, cchar_t *\fIwch\fP); .PP \fB#include .PP -\fBFORM* new_form_sp(SCREEN* \fIsp\fP, FIELD **\fIfields\fP); +\fBFORM * new_form_sp(SCREEN * \fIsp\fP, FIELD **\fIfields\fP); .PP \fB#include .PP -\fBMENU* new_menu_sp(SCREEN* \fIsp\fP, ITEM **\fIitems\fP); +\fBMENU * new_menu_sp(SCREEN * \fIsp\fP, ITEM **\fIitems\fP); .PP \fB#include .PP -\fBPANEL* ceiling_panel(SCREEN* \fIsp\fP); -\fBPANEL* ground_panel(SCREEN* \fIsp\fP); -\fBvoid update_panels_sp(SCREEN* \fIsp\fP); +\fBPANEL * ceiling_panel(SCREEN * \fIsp\fP); +\fBPANEL * ground_panel(SCREEN * \fIsp\fP); +\fBvoid update_panels_sp(SCREEN * \fIsp\fP); .PP \fB#include .PP -\fBint del_curterm_sp(SCREEN* \fIsp\fP, TERMINAL *\fIoterm\fP); -\fBint putp_sp(SCREEN* \fIsp\fP, const char *\fIstr\fP); -\fBint restartterm_sp(SCREEN* \fIsp\fP, NCURSES_CONST char*\fIterm\fP, int \fIfiledes\fP, int *\fIerrret\fP); -\fBTERMINAL* set_curterm_sp(SCREEN* \fIsp\fP, TERMINAL*\fInterm\fP); -\fBint tgetent_sp(SCREEN* \fIsp\fP, char *\fIbp\fP, const char *\fIname\fP); -\fBint tgetflag_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP); -\fBint tgetnum_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP); -\fBchar* tgetstr_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP, char **\fIarea\fP); -\fBchar* tgoto_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP, int \fIcol\fP, int \fIrow\fP); -\fBint tigetflag_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP); +\fBint del_curterm_sp(SCREEN * \fIsp\fP, TERMINAL *\fIoterm\fP); +\fBint putp_sp(SCREEN * \fIsp\fP, const char *\fIstr\fP); +\fBint restartterm_sp(SCREEN * \fIsp\fP, NCURSES_CONST char *\fIterm\fP, int \fIfiledes\fP, int *\fIerrret\fP); +\fBTERMINAL * set_curterm_sp(SCREEN * \fIsp\fP, TERMINAL *\fInterm\fP); +\fBint tgetent_sp(SCREEN * \fIsp\fP, char *\fIbp\fP, const char *\fIname\fP); +\fBint tgetflag_sp(SCREEN * \fIsp\fP, const char *\fIcapname\fP); +\fBint tgetnum_sp(SCREEN * \fIsp\fP, const char *\fIcapname\fP); +\fBchar * tgetstr_sp(SCREEN * \fIsp\fP, const char *\fIcapname\fP, char **\fIarea\fP); +\fBchar * tgoto_sp(SCREEN * \fIsp\fP, const char *\fIcapname\fP, int \fIcol\fP, int \fIrow\fP); +\fBint tigetflag_sp(SCREEN * \fIsp\fP, const char *\fIcapname\fP); .PP -\fBint tigetnum_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP); -\fBchar* tigetstr_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP); +\fBint tigetnum_sp(SCREEN * \fIsp\fP, const char *\fIcapname\fP); +\fBchar * tigetstr_sp(SCREEN * \fIsp\fP, const char *\fIcapname\fP); \fI/* tparm_sp may use 9 long parameters rather than being variadic */ -\fBchar* tparm_sp(SCREEN* \fIsp\fP, const char *\fIstr\fP, ...); -\fBint tputs_sp(SCREEN* \fIsp\fP, const char *\fIstr\fP, int \fIaffcnt\fP, NCURSES_SP_OUTC \fIputc\fP); +\fBchar * tparm_sp(SCREEN * \fIsp\fP, const char *\fIstr\fP, ...); +\fBint tputs_sp(SCREEN * \fIsp\fP, const char *\fIstr\fP, int \fIaffcnt\fP, NCURSES_SP_OUTC \fIputc\fP); .PP \fB#include .PP -\fBNCURSES_CONST char* unctrl_sp(SCREEN* \fIsp\fP, chtype \fIch\fP); +\fBNCURSES_CONST char * unctrl_sp(SCREEN * \fIsp\fP, chtype \fIch\fP); .fi .SH DESCRIPTION This implementation can be configured to provide a set of functions which diff --git a/contrib/ncurses/man/curs_termattrs.3x b/contrib/ncurses/man/curs_termattrs.3x --- a/contrib/ncurses/man/curs_termattrs.3x +++ b/contrib/ncurses/man/curs_termattrs.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2015 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,18 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_termattrs.3x,v 1.41 2024/04/20 21:20:07 tom Exp $ -.TH curs_termattrs 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_termattrs.3x,v 1.61 2025/08/23 22:39:20 tom Exp $ +.TH curs_termattrs 3X 2025-08-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.ie \n(.g \{\ +.ds `` \(lq +.ds '' \(rq +.\} +.el \{\ +.ie t .ds `` `` +.el .ds `` "" +.ie t .ds '' '' +.el .ds '' "" +.\} .SH NAME \fB\%baudrate\fP, \fB\%erasechar\fP, @@ -41,88 +51,169 @@ \fB\%term_attrs\fP, \fB\%termattrs\fP, \fB\%termname\fP \- -\fIcurses\fR environment query routines +get and set terminal attributes with \fIcurses\fP .SH SYNOPSIS .nf \fB#include .PP \fBint baudrate(void); \fBchar erasechar(void); -\fBint erasewchar(wchar_t *\fIwc\fP); +\fBint erasewchar(wchar_t * \fIwc\fP); \fBbool has_ic(void); \fBbool has_il(void); \fBchar killchar(void); -\fBint killwchar(wchar_t *\fIwc\fP); -\fBchar *longname(void); +\fBint killwchar(wchar_t * \fIwc\fP); +\fBchar * longname(void); \fBattr_t term_attrs(void); \fBchtype termattrs(void); -\fBchar *termname(void); +\fBchar * termname(void); .fi .SH DESCRIPTION .SS baudrate -The \fBbaudrate\fP routine returns the output speed of the terminal. -The -number returned is in bits per second, for example \fB9600\fP, and is an -integer. +.B \%baudrate +returns the line speed of the terminal, +an integer value measured in bits per second, +for example +.BR 9600 "." .SS "erasechar, erasewchar" -The \fBerasechar\fP routine returns the user's current erase character. +.B \%erasechar +returns the terminal's erase character. .PP -The \fBerasewchar\fP routine stores the current erase character -in the location referenced by \fIwc\fP. -If no erase character has been defined, the routine fails -and the location referenced by \fIwc\fP is not changed. +.B \%erasewchar +stores the erase character in the location referenced by +.IR wc "." +If no erase character has been defined, +it fails and the location referenced by +.I wc +is not changed. .SS "has_ic, has_il" -The \fBhas_ic\fP routine is true if the terminal has insert- and delete- -character capabilities. +.B \%has_ic +returns +.B TRUE +if the terminal has insert- and delete-character capabilities. .PP -The \fBhas_il\fP routine is true if the terminal has insert- and delete-line -capabilities, or can simulate them using scrolling regions. -This might -be used to determine if it would be appropriate to turn on physical -scrolling using \fBscrollok\fP(3X). +.B \%has_il +returns +.B TRUE +if the terminal has insert- and delete-line capabilities, +or can simulate them using scrolling regions. +It might be used to determine whether it would be appropriate +to use \fBscrollok\fP(3X) to turn on scrolling. .SS "killchar, killwchar" -The \fBkillchar\fP routine returns the user's current line kill character. +.B \%killchar +returns the terminal's line kill character. .PP -The \fBkillwchar\fP routine stores the current line-kill character -in the location referenced by \fIwc\fP. +.B \%killwchar +stores the line-kill character in the location referenced by +.IR wc "." If no line-kill character has been defined, -the routine fails and the location referenced by \fIwc\fP is not changed. +it fails and the location referenced by +.I wc +is not changed. .SS longname -The \fBlongname\fP routine returns a pointer to a static area -containing a verbose description of the current terminal. -The maximum -length of a verbose description is 128 characters. -It is defined only -after the call to \fBinitscr\fP or \fBnewterm\fP. The area is -overwritten by each call to \fBnewterm\fP and is not restored by -\fBset_term\fP, so the value should be saved between calls to -\fBnewterm\fP if \fBlongname\fP is going to be used with multiple -terminals. +.B \%longname +returns a pointer to static storage +containing a verbose description of the terminal being managed by +.IR curses "." +The maximum length of a verbose description is 128 characters. +The storage is populated only after \fBinitscr\fP(3X) or +\fBnewterm\fP(3X) is called. +This storage is overwritten by each call to +.B \%newterm +and not restored by \fBset_term\fP(3X), +so its contents should be saved between calls to +.B \%initscr +or +.B \%newterm +if +.B \%longname +is to be used with multiple terminals. .SS "termattrs, term_attrs" If a given terminal does not support a video attribute that an -application program is trying to use, \fBcurses\fP may substitute a +application program is trying to use, +.I curses +may substitute a different video attribute for it. -The \fBtermattrs\fP and \fBterm_attrs\fP functions -return a logical \fBOR\fP of all video attributes supported by the -terminal using \fBA_\fP and \fBWA_\fP constants respectively. -This information is useful when a \fBcurses\fP program +.B \%termattrs +and +.B \%term_attrs +return a logical \*(``or\*('' of all video attributes supported by the +terminal using +.B A_ +and +.B WA_ +constants respectively. +This information is useful when a +.I curses +program needs complete control over the appearance of the screen. .SS termname -The \fBtermname\fP routine returns the terminal name used by \fBsetupterm\fP. +.B \%termname +returns the terminal name used by \fBsetupterm\fP(3X). .SH RETURN VALUE -\fBlongname\fP and \fBtermname\fP return \fBNULL\fP on error. +.B \%longname +and +.B \%termname +return +.I NULL +on error. .PP -Routines that return an integer return \fBERR\fP upon failure and \fBOK\fP -(SVr4 only specifies "an integer value other than \fBERR\fP") upon successful -completion. +Functions that return an integer return +.B ERR +upon failure and +.B OK +upon success. .SH NOTES -Note that \fBtermattrs\fP may be a macro. +.BR \%erasewchar "," +.BR \%killwchar "," +and +.B \%term_attrs +are part of +.IR \%ncurses "'s" +wide-character API, +and are not available in its non-wide-character configuration. +.PP +.B \%termattrs +may be implemented as a macro. .SH PORTABILITY -X/Open Curses, Issue 4 describes these functions. -It changes the -return type of \fBtermattrs\fP to the new type \fBattr_t\fP. -Most versions of curses truncate the result returned by \fBtermname\fP to -14 characters. +X/Open Curses Issue\ 4 describes these functions. +.PP +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 535 +.PP +Most versions of +.I curses +truncate the string returned by +.I \%termname +to 14 characters. +.SH HISTORY +4BSD (1980) +introduced +.IR \%longname "." +.PP +SVr2 (1984) +added +.IR \%baudrate "," +.IR \%erasechar "," +.IR \%killchar "," +.IR \%has_ic "," +and +.IR \%has_il "." +.PP +SVr3 (1987) +supplied +.IR \%termname "." +Later that year, +SVr3.1 brought +.IR \%termattrs "." +.PP +X/Open Curses Issue\ 4 (1995) +specified +.IR \%erasewchar "," +.IR \%killwchar "," +and +.IR \%term_attrs "." .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_initscr\fP(3X), diff --git a/contrib/ncurses/man/curs_termcap.3x b/contrib/ncurses/man/curs_termcap.3x --- a/contrib/ncurses/man/curs_termcap.3x +++ b/contrib/ncurses/man/curs_termcap.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2017,2018 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_termcap.3x,v 1.85 2024/04/20 19:13:12 tom Exp $ -.TH curs_termcap 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_termcap.3x,v 1.107 2025/08/16 19:09:12 tom Exp $ +.TH curs_termcap 3X 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -40,11 +40,59 @@ .el .ds '' "" .\} . +.ie \n(.g .ds : \: +.el .ds : \" empty +. .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 .. . +.\" URL hyperlink support macros from groff's "an-ext.tmac" +. +.\" Save the automatic hyphenation mode. +.\" +.\" In AT&T troff, there was no register exposing the hyphenation mode, +.\" and no way to save and restore it. Set `mH` to a reasonable value +.\" for your implementation and preference. +.de mY +. ie !\\n(.g \ +. nr mH 14 +. el \ +. do nr mH \\n[.hy] \" groff extension register +.. +. +.\" Prepare link text for mail/web hyperlinks. `MT` and `UR` call this. +.de mV +. ds mU \\$1\" +.. +. +.\" Emit hyperlink. The optional argument supplies trailing punctuation +.\" after link text. `ME` and `UE` call this. +.de mQ +. mY +. nh +<\\*(mU>\\$1 +. hy \\n(mH +. rm mU +.. +. +.\" Start URL. +.\" .UR url +.if !\n(.g \{\ +.de UR +. mV \\$1 +.. +.\} +. +.\" End URL. +.\" .UE [punctuation] +.if !\n(.g \{\ +.de UE +. mQ \\$1 +.. +.\} +. .SH NAME \fB\%PC\fP, \fB\%UP\fP, @@ -67,12 +115,12 @@ \fBchar * BC; \fB@NCURSES_OSPEED@ ospeed; .PP -\fBint tgetent(char *\fIbp\fP, const char *\fIname\fP); -\fBint tgetflag(const char *\fIid\fP); -\fBint tgetnum(const char *\fIid\fP); -\fBchar *tgetstr(const char *\fIid\fP, char **\fIarea\fP); -\fBchar *tgoto(const char *\fIcap\fP, int \fIcol\fP, int \fIrow\fP); -\fBint tputs(const char *\fIstr\fP, int \fIaffcnt\fP, int (*\fIputc\fP)(int)); +\fBint tgetent(char * \fIbp\fP, const char * \fIname\fP); +\fBint tgetflag(const char * \fIid\fP); +\fBint tgetnum(const char * \fIid\fP); +\fBchar * tgetstr(const char * \fIid\fP, char ** \fIsbuf\fP); +\fBchar * tgoto(const char * \fIcap\fP, int \fIcol\fP, int \fIrow\fP); +\fBint tputs(const char * \fIstr\fP, int \fIaffcnt\fP, int (* \fIputc\fP)(int)); .fi .SH DESCRIPTION .I \%ncurses @@ -90,10 +138,10 @@ It returns .RS 3 .TP 5 \" "-1" + 2n + adjust for PDF -1 +.B 1 on success, .TP -0 +.B 0 if there is no such entry (or if the matching entry describes a generic terminal, having too little information for @@ -101,20 +149,21 @@ applications to run), and .TP -\-1 -if the \fI\%term\%info\fP database could not be found. +.B \-1 +if the +.I \%term\%info +database could not be found. .RE .PP This implementation differs from those of historical \fItermcap\fP libraries. -.RS 3 .bP .I \%ncurses ignores the buffer pointer \fIbp\fP, as do other \fItermcap\fP implementations conforming to portions of X/Open Curses now withdrawn. The BSD \fItermcap\fP library would store a copy of the terminal type -description in the area referenced by this pointer. +description in the buffer referenced by this pointer. \fI\%term\%info\fP stores terminal type descriptions in compiled form, which is not the same thing. .bP @@ -127,7 +176,6 @@ nor whether the terminal type description supports an addressable cursor, a property essential for any \fIcurses\fP implementation to operate. -.RE .SS "Retrieving Capability Values" \fB\%tgetflag\fP reports the Boolean entry for \fIid\fP, or zero if it is not available. @@ -137,38 +185,40 @@ .PP \fB\%tgetstr\fP returns the string entry for \fIid\fP, or -.B NULL +.I NULL if it is not available. Use \fB\%tputs\fP to output the string returned. The -.I area +.I sbuf parameter is used as follows. -.RS 3 .bP It is assumed to be the address of a pointer to a buffer managed by the calling application. .bP However, -\fI\%ncurses\fP checks to ensure that -.I area +.I \%ncurses +checks to ensure that +.I sbuf is not -.BR NULL , -and also that the resulting buffer pointer is not -.BR NULL . +.IR NULL "," +and that the pointer obtained by dereferencing +.I sbuf +is also not +.IR NULL "." If either check fails, -.I area -is ignored. +.I \%ncurses +ignores +.IR sbuf . .bP If the checks succeed, \fI\%ncurses\fP also copies the return value to the buffer pointed to by -\fIarea\fP, +\fIsbuf\fP, and the library updates -.I area +.I sbuf to point past the null character terminating this value. .bP The return value itself is an address in the terminal type description loaded into memory. -.RE .SS "Applying String Capabilities" String capabilities can be parameterized; see subsection \*(``Parameterized Strings\*('' in \fB\%terminfo\fP(5). @@ -216,24 +266,48 @@ It can retrieve capabilities by either \fItermcap\fP or \fI\%term\%info\fP code. .SS "Global Variables" -The variables -\fBPC\fP, -\fBUP\fP and -\fBBC\fP -are set by \fB\%tgetent\fP to the \fI\%term\%info\fP entry's data for -\fB\%pad_char\fP, -\fB\%cursor_up\fP and -\fB\%backspace_if_not_bs\fP, +.B \%tgetent +sets the variables +.BR PC "," +.BR UP "," +and +.B BC +to the +.I \%term\%info +entry's data for +.B \%pad_char +.RB ( pad ), +.B \%cursor_up +.RB ( cuu1 ), +and +.B \%backspace_if_not_bs +.RB ( OTbs ), respectively. -\fBUP\fP is not used by \fI\%ncurses\fP. -\fBPC\fP is used by \fB\%delay_output\fP(3X). -\fBBC\fP is used by \fB\%tgoto\fP emulation. -The variable \fB\%ospeed\fP is set by \fI\%ncurses\fP using a -system-specific encoding to indicate the terminal's data rate. +.I \%ncurses +does not employ +.B cuu1 +internally. +\fB\%delay_output\fP(3X) +uses +.BR pad "," +while +.B \%tgoto +emulation uses the obsolete +.I termcap +capability +.BR bs "," +represented in +.I \%ncurses +.I \%term\%info +as \*(``OTbs\*(''. +.I \%ncurses +assigns the variable +.B \%ospeed +a system-specific value to encode the terminal's data rate. .SS "Releasing Memory" The \fItermcap\fP functions provide no means of freeing memory, -because legacy \fItermcap\fP implementations used only the buffer -areas provided by the caller via \fB\%tgetent\fP and \fB\%tgetstr\fP. +because legacy \fItermcap\fP implementations used only the storage +provided by the caller via \fB\%tgetent\fP and \fB\%tgetstr\fP. Those buffers are unused in \fI\%term\%info\fP. .PP By contrast, @@ -254,7 +328,7 @@ performance. .PP An application that uses only the \fItermcap\fP functions, -not the higher level +not the higher-level .I \%curses API, could release the memory using \fB\%del_curterm\fP(3X), @@ -270,12 +344,12 @@ are documented above. .PP \fB\%tgoto\fP returns -.B NULL +.I NULL on error. Error conditions include: .bP uninitialized state -(\fB\%tgetent\fP was not called successfully), +\%(\fBtgetent\fP was not called successfully), .bP .I cap being a null pointer, @@ -302,110 +376,149 @@ .SH PORTABILITY These functions are no longer standardized (and the variables never were); -\fI\%ncurses\fP provides them to support legacy applications. -They should not be used in new programs. -.SS Standards -.bP -X/Open Curses, Issue 4, Version 2 (1996), -describes these functions, -marking them as -\*(``TO BE WITHDRAWN\*(''. -.bP -X/Open Curses, Issue 7 (2009) marks the \fItermcap\fP interface -(along with \fB\%vwprintw\fP and \fB\%vwscanw\fP) as withdrawn. +see section \*(``HISTORY\*('' below. +.I \%ncurses +provides them to support legacy applications; +they should not be used in new programs. +.PP +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 536 .PP Neither X/Open Curses nor the SVr4 man pages documented the return -values of \fB\%tgetent\fP correctly, +values of +.I \%tgetent +correctly, though all three shown here were in fact returned ever since SVr1. In particular, an omission in the X/Open Curses specification has been misinterpreted -to mean that \fB\%tgetent\fP returns \fBOK\fP or \fBERR\fP. +to mean that +.I \%tgetent +returns +.I OK +or +.IR ERR "." Because the purpose of these functions is to provide compatibility with -the \fItermcap\fP library, -that is a defect in X/Open Curses, Issue 4, Version 2 -rather than in \fI\%ncurses\fP. +the +.I termcap +library, +that is a defect in X/Open Curses Issue\ 4 Version\ 2 +rather than in +.IR \%ncurses "." .SS "Compatibility with BSD \fItermcap\fP" -Externally visible variables are provided for support of certain -\fItermcap\fP applications. +.I \%ncurses +provides externally visible variables to support certain +.I termcap +applications. However, their correct usage is poorly documented; for example, it is unclear when reading and writing them is meaningful. In particular, -some applications are reported to declare and/or modify \fB\%ospeed\fP. +some applications are reported to declare and/or modify +.IR \%ospeed "." .PP -The constraint that only the first two characters of the \fIid\fP -parameter are used escapes many application developers. -The BSD \fItermcap\fP library did not require a trailing null character -on the capability identifier passed to \fB\%tgetstr\fP, -\fB\%tgetnum\fP, +The constraint that only the first two characters of the +.I id +parameter are looked up in the terminal database +escapes many application developers. +The BSD +.I termcap +library did not require a trailing null character +after the capability identifier passed to +.IR \%tgetstr "," +.IR \%tgetnum "," and -\fB\%tgetflag\fP. +.IR \%tgetflag "." .\" See . -Some applications thus assume that the \fItermcap\fP interface does not -require the trailing null character for the capability identifier. -.bP +Some applications thus assume that the +.I termcap +interface does not require the trailing null character +for the capability identifier. .I \%ncurses -disallows matches by the \fItermcap\fP interface against extended -capability names that are longer than two characters; +disallows matches by the +.I termcap +interface against extended capability names +that are longer than two characters; see \fB\%user_caps\fP(5). .PP -The BSD \fItermcap\fP function \fB\%tgetent\fP returns the text of a -\fItermcap\fP entry in the buffer passed as an argument. -This library, -like other \fI\%term\%info\fP implementations, +The BSD +.I termcap +function +.I \%tgetent +returns the text of a +.I termcap +entry in the buffer passed as an argument. +.IR \%ncurses "," +like other +.I \%term\%info +implementations, does not store terminal type descriptions as text. It sets the buffer contents to a null-terminated string. .SS "Header File" -This library includes a \fI\%termcap.h\fP header for compatibility with -other implementations, -but the header is rarely used because the other implementations are not -strictly compatible. +.I \%ncurses +includes a +.I \%termcap.h +header file for compatibility with other implementations, +but it is rarely used because the other implementations +are not mutually compatible; +see below. .SH HISTORY .\" See https://www.oreilly.com/openbook/opensources/book/kirkmck.html .\" for much BSD release history. -Bill Joy originated a forerunner of \fItermcap\fP called -\*(``ttycap\*('', +Bill Joy originated a forerunner of +.I termcap +called \*(``ttycap\*('', dated September 1977, and released in 1BSD (March 1978). .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=1BSD/s7/ttycap.c .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=1BSD/man7/ttycap.7 -It used many of the same function names as the later \fItermcap\fP, +It used many of the same function names as the later +.IR termcap "," such as -\fB\%tgetent\fP, -\fB\%tgetflag\fP, -\fB\%tgetnum\fP, +.IR \%tgetent "," +.IR \%tgetflag "," +.IR \%tgetnum "," and -\fB\%tgetstr\fP. +.IR \%tgetstr "." .PP A clear descendant, -the \fItermlib\fP library, +the +.I termlib +library, .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=2BSD/src/termlib/ followed in 2BSD (May 1979), -adding \fB\%tgoto\fP and \fB\%tputs\fP. +adding +.I \%tgoto +and +.IR \%tputs "." The former applied at that time only to cursor positioning capabilities, .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=2BSD/bin/etc/termcap thus the overly specific name. Little changed in 3BSD (late 1979) -except the addition of test programs and a \fI\%termlib\fP man page, +except the addition of test programs and a +.I termlib +man page, which documented the API shown in section \*(``SYNOPSIS\*('' above. .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=3BSD/usr/src/lib/\ .\" libtermlib/ .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=3BSD/usr/man/man3/\ .\" termlib.3 .PP -4BSD -(November 1980) -renamed \fItermlib\fP to \fItermcap\fP +4BSD (November 1980) +renamed +.I termlib +to +.I termcap .\" ...except in the source tree... .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/\ .\" libtermlib/makefile and added another test program. -The library remained much the same though 4.3BSD +The library remained much the same through 4.3BSD (June 1986). 4.4BSD-Lite (June 1994) @@ -418,10 +531,11 @@ The library long antedated the standard and thus provided no header file declaring them. Nevertheless, -the BSD sources included two different \fI\%termcap.h\fP header files -over time. +the BSD sources included two different +.I \%termcap.h +header files over time. .bP -One was used internally by \fBjove\fP(1) from 4.3BSD onward. +One was used internally by \fIjove\fP(1) from 4.3BSD onward. .\" 2BSD became a branch retaining support for non-virtual memory .\" systems (such as the PDP-11) whereas most BSD development focused on .\" the VAX and other VM-enabled systems starting with 3BSD. @@ -435,55 +549,108 @@ .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD/usr/contrib/\ .\" jove/Makefile .\" --much too late for 2BSD (1979). -It declared global symbols for the \fItermcap\fP variables that it used. +It declared global symbols for the +.I termcap +variables that it used. .bP The other appeared in 4.4BSD-Lite Release 2 (June 1995) -as part of \fIlibedit\fP -(also known as the \fI\%edit\%line\fP library). +as part of +.I libedit +(also known as the +.I \%edit\%line +library). CSRG source history shows that this was added in mid-1992. -The \fIlibedit\fP header file was used internally as a convenience for -compiling the \fI\%edit\%line\fP library. +The +.I libedit +header file was used internally as a convenience +for compiling the +.I \%edit\%line +library. It declared function prototypes, but no global variables. -This header file was added to NetBSD's \fItermcap\fP library in -mid-1994. +NetBSD's +.I termcap +library added this header file in mid-1994. .PP Meanwhile, -GNU \fItermcap\fP began development in 1990. -Its first release (1.0) in 1991 included a \fI\%termcap.h\fP header. -Its second (1.1) in September 1992 modified the header to use -\fIconst\fP for the function prototypes in the header where one would -expect the parameters to be read-only. -BSD \fItermcap\fP did not. -The prototype for \fB\%tputs\fP also differed, +GNU +.I termcap +began development in 1990. +Its first release (1.0) in 1991 included a +.I \%termcap.h +header file. +Its second (1.1) release in September 1992 modified the file to use +.I const +for the function prototypes in the header where one would +expect parameters to be read-only. +BSD +.I termcap +did not. +The prototype for +.I \%tputs +also differed, but in that instance, -it was \fIlibedit\fP that differed from BSD \fItermcap\fP. +it was +.I libedit +that differed from BSD +.IR termcap "." .PP -GNU \fItermcap\fP 1.3 was bundled with \fIbash\fP(1) in mid-1993 to -support the \fI\%readline\fP(3) library. +GNU \fIbash\fP(1) has bundled GNU +.I termcap +1.3 since mid-1993 to support its \fI\%readline\fP(3) library, +and continues to use it if configured to do so. .PP -\fI\%ncurses\fP 1.8.1 +.I \%ncurses +1.8.1 (November 1993) -provided a \fI\%termcap.h\fP file. -It reflected influence from GNU \fItermcap\fP and \fBemacs\fP(1) -(rather than \fBjove\fP(1)), +provided a +.I \%termcap.h +file. +It reflected influence from GNU +.I termcap +and \fI\%emacs\fP(1) +(rather than \fIjove\fP(1)), providing the following interface: .bP -global symbols used by \fIemacs\fP, +global symbols used by +.IR \%emacs "," .bP -\fIconst\fP-qualified function prototypes, +.IR const -qualified +function prototypes, and .bP -a prototype for \fBtparam\fP, -a GNU \fItermcap\fP feature. +a prototype for +.IR tparam "," +a GNU +.I termcap +feature. .PP Later (in mid-1996) -the \fB\%tparam\fP function was removed from \fI\%ncurses\fP. +the +.I tparam +function was removed from +.IR \%ncurses "." Any two of the four implementations thus differ, -and programs that intend to work with all \fItermcap\fP library -interfaces must account for that fact. +and programs that intend to work with all +.I termcap +library interfaces must account for that fact. +.PP +X/Open Curses Issue\ 4, +Version\ 2 (1996), +describes these functions, +marking them as +\*(``TO BE WITHDRAWN\*(''. +.PP +X/Open Curses Issue\ 7 (2009) withdrew the +.I termcap +interface +(along with the +.I \%vwprintw +and +.I \%vwscanw +functions). .SH BUGS If you call \fB\%tgetstr\fP to fetch .B \%column_address @@ -510,15 +677,14 @@ .IP \(bu 4 \fB\%tputs("50")\fP in a \fI\%term\%info\fP system transmits \*(``50\*('' rather than busy-waiting for 50 milliseconds. -.IP \(bu 4 +.IP However, if \fI\%ncurses\fP is configured to support \fItermcap\fP, it may also have been configured to support BSD-style padding. -.IP In that case, \fB\%tputs\fP inspects strings passed to it, looking for digits at the beginning of the string. -.IP +.IP \(bu 4 \fB\%tputs("50")\fP in a \fItermcap\fP system may busy-wait for 50 milliseconds rather than transmitting \*(``50\*(''. .PP @@ -533,15 +699,17 @@ .RB ( sgr0 ) capability) does not reset the alternate character set. -\fI\%ncurses\fP checks for, -and modifies the data shared with, -the \fItermcap\fP interface to accommodate the latter's limitation in -this respect. +\fI\%ncurses\fP inspects the data shared with the +.I termcap +interface and modifies it as necessary +to accommodate the latter's limitation in this respect. .SH "SEE ALSO" +.UR https://\*:invisible\-\*:island\*:.net/\*:ncurses/\*:tctest\*:.html +.I "TCTEST \(em A Termcap Test Utility" +.UE +.PP \fB\%curses\fP(3X), \fB\%curs_terminfo\fP(3X), \fB\%putc\fP(3), \fB\%term_variables\fP(3X), \fB\%terminfo\fP(5) -.PP -https://invisible\-island.net/ncurses/tctest.html diff --git a/contrib/ncurses/man/curs_terminfo.3x b/contrib/ncurses/man/curs_terminfo.3x --- a/contrib/ncurses/man/curs_terminfo.3x +++ b/contrib/ncurses/man/curs_terminfo.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_terminfo.3x,v 1.136 2024/04/14 00:14:40 tom Exp $ -.TH curs_terminfo 3X 2024-04-13 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_terminfo.3x,v 1.176 2025/11/12 01:06:36 tom Exp $ +.TH curs_terminfo 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -48,7 +48,6 @@ . .SH NAME \fB\%del_curterm\fP, -\fB\%mvcur\fP, \fB\%putp\fP, \fB\%restartterm\fP, \fB\%set_curterm\fP, @@ -71,7 +70,7 @@ \fB#include \fB#include .PP -\fBTERMINAL *cur_term; +\fBTERMINAL * cur_term; .PP \fBconst char * const boolnames[]; \fBconst char * const boolcodes[]; @@ -83,40 +82,40 @@ \fBconst char * const strcodes[]; \fBconst char * const strfnames[]; .PP -\fBint setupterm(const char *\fIterm\fP, int \fIfiledes\fP, int *\fIerrret\fP); -\fBTERMINAL *set_curterm(TERMINAL *\fInterm\fP); -\fBint del_curterm(TERMINAL *\fIoterm\fP); -\fBint restartterm(const char *\fIterm\fP, int \fIfiledes\fP, int *\fIerrret\fP); +\fBint setupterm(const char * \fIterm\fP, int \fIfiledes\fP, int * \fIerrret\fP); +\fBTERMINAL * set_curterm(TERMINAL * \fInterm\fP); +\fBint del_curterm(TERMINAL * \fIoterm\fP); +\fBint restartterm(const char * \fIterm\fP, int \fIfiledes\fP, int * \fIerrret\fP); .PP -\fBchar *tparm(const char *\fIstr\fP, \fR.\|.\|.\fP); +\fBchar * tparm(const char * \fIstr\fP, \fR.\|.\|.\fP); \fI/* or */ -\fBchar *tparm(const char *\fIstr\fP, long \fIp1\fP \fR.\|.\|.\fP \fBlong\fP \fIp9\fP); +\fBchar * tparm(const char * \fIstr\fP, long \fIp1\fP \fR.\|.\|.\fP \fBlong\fP \fIp9\fP); .PP -\fBint tputs(const char *\fIstr\fP, int \fIaffcnt\fP, int (*\fIputc\fP)(int)); -\fBint putp(const char *\fIstr\fP); +\fBint tputs(const char * \fIstr\fP, int \fIaffcnt\fP, int (* \fIputc\fP)(int)); +\fBint putp(const char * \fIstr\fP); .PP -\fBint vidputs(chtype \fIattrs\fP, int (*\fIputc\fP)(int)); +\fBint vidputs(chtype \fIattrs\fP, int (* \fIputc\fP)(int)); \fBint vidattr(chtype \fIattrs\fP); -\fBint vid_puts(attr_t \fIattrs\fP, short \fIpair\fP, void *\fIopts\fP, int (*\fIputc\fP)(int)); -\fBint vid_attr(attr_t \fIattrs\fP, short \fIpair\fP, void *\fIopts\fP); +\fBint vid_puts(attr_t \fIattrs\fP, short \fIpair\fP, void * \fIopts\fP, int (* \fIputc\fP)(int)); +\fBint vid_attr(attr_t \fIattrs\fP, short \fIpair\fP, void * \fIopts\fP); .PP -\fBint mvcur(int \fIoldrow\fP, int \fIoldcol\fP, int \fInewrow\fP, int \fInewcol\fP); +\fBint tigetflag(const char * \fIcap-code\fP); +\fBint tigetnum(const char * \fIcap-code\fP); +\fBchar * tigetstr(const char * \fIcap-code\fP); .PP -\fBint tigetflag(const char *\fIcap-code\fP); -\fBint tigetnum(const char *\fIcap-code\fP); -\fBchar *tigetstr(const char *\fIcap-code\fP); -.PP -\fBchar *tiparm(const char *\fIstr\fP, \fR.\|.\|.\fP); +\fBchar * tiparm(const char * \fIstr\fP, \fR.\|.\|.\fP); .PP \fI/* extensions */ -\fBchar *tiparm_s(int \fIexpected\fP, int \fImask\fP, const char *\fIstr\fP, ...); -\fBint tiscan_s(int *\fIexpected\fP, int *\fImask\fP, const char *\fIstr\fP); +\fBchar * tiparm_s(int \fIexpected\fP, int \fImask\fP, const char * \fIstr\fP, .\|.\|.); +\fBint tiscan_s(int * \fIexpected\fP, int * \fImask\fP, const char * \fIstr\fP); .PP \fI/* deprecated */ -\fBint setterm(const char *\fIterm\fP); +\fBint setterm(const char * \fIterm\fP); .fi .SH DESCRIPTION -These low-level functions must be called by programs that deal directly +These lower-level functions of the +.I curses +standard must be called by programs that deal directly with the .I \%term\%info database to handle certain terminal capabilities, @@ -134,92 +133,75 @@ Capability string values have no associated encoding; they are strings of 8-bit characters. .SS Initialization -Initially, -\fB\%setupterm\fP should be called. -The high-level -.I curses -functions \fB\%initscr\fP and \fB\%newterm\fP call \fB\%setupterm\fP to -initialize the low-level set of terminal-dependent variables listed in +Call +.B \%setupterm +from your application to have +.I \%term\%info +manage the terminal device; +this action initializes the terminal-dependent variables listed in \fB\%term_variables\fP(3X). -.PP -Applications can use the terminal capabilities either directly -(via header definitions), -or by special functions. -The header files -.I \%curses.h -and -.I \%term.h -should be included -(in that order) -to get the definitions for these strings, -numbers, -and flags. -.PP -The +(A +.I curses +application calling \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X) achieves +the same result.) +Applications can use the terminal capabilities either directly, +by object definitions corresponding to capability names and codes +(see \fB\%term_variables\fP(3X)) +or by calling the functions documented here. +.B \%setupterm +initializes the .I \%term\%info variables .B \%lines and .B \%columns -are initialized by \fB\%setupterm\fP as follows. -.bP -If \fB\%use_env(FALSE)\fP has been called, -values for -.B \%lines -and -.B \%columns -specified in -.I \%term\%info -are used. -.bP -Otherwise, -if the environment variables -.I LINES -and -.I \%COLUMNS -exist, -their values are used. -If these environment variables do not exist and the program is running -in a window, -the current window size -is used. -Otherwise, -if the environment variables do not exist, -the values for -.B \%lines -and -.B \%columns -specified in the -.I \%term\%info -database are used. +as described in \fB\%use_env\fP(3X). .PP -Parameterized strings should be passed through \fB\%tparm\fP to -instantiate them. +Pass parameterized string capability values through +.B \%tparm +to instantiate them. All .I \%term\%info strings -(including the output of \fB\%tparm\fP) -should be sent to the terminal device with \fB\%tputs\fP or -\fB\%putp\fP. -Call \fB\%reset_shell_mode\fP to restore the terminal modes before -exiting; -see \fB\%curs_kernel\fP(3X). -.PP -Programs that use -cursor addressing should +(including the output of +.BR \%tparm ")" +should be sent to the terminal device with +.B \%tputs +or +.BR \%putp "." +Call +\fB\%reset_shell_mode\fP(3X) to restore the terminal modes before +exiting. +(A +.I curses +application calling \fB\%endwin\fP(3X) achieves the same result.) +.\" XXX: What should a "pure" terminfo application that wants to link +.\" only with libtinfo, and not libcurses, do? +.PP +Programs that use cursor addressing should emit certain capabilities +at specific times. +Specifically, +output .bP -output \fB\%enter_ca_mode\fP upon startup and +.B \%enter_ca_mode +upon startup, +and .bP -output \fB\%exit_ca_mode\fP before exiting. +.B \%exit_ca_mode +before exiting. .PP Programs that execute shell subprocesses should .bP -call \fB\%reset_shell_mode\fP and -output \fB\%exit_ca_mode\fP before the shell -is called and +call \fB\%reset_shell_mode\fP(3X) and output +.B \%exit_ca_mode +before the shell is called, +and .bP -output \fB\%enter_ca_mode\fP and -call \fB\%reset_prog_mode\fP after returning from the shell. +output +.B \%enter_ca_mode +and call \fB\%reset_prog_mode\fP(3X) after returning from the shell. +.\" XXX: What should a "pure" terminfo application that wants to link +.\" only with libtinfo, and not libcurses, do? .PP \fB\%setupterm\fP reads in the .I \%term\%info @@ -228,7 +210,7 @@ .I \%term\%info structures, but does not set up the output virtualization structures used by -.IR curses . +.IR curses "." Its parameters follow. .RS 3 .TP 5 @@ -250,9 +232,9 @@ passing an output .I stream rather than a -.IR descriptor . +.IR descriptor "." In -.IR curses , +.IR curses "," the two are the same because \fB\%newterm\fP calls \fB\%setupterm\fP, passing the file descriptor derived from its output stream parameter. .TP 5 @@ -262,12 +244,14 @@ If .I errret is not null, -then \fB\%setupterm\fP returns +then +.B \%setupterm +returns .B OK or .B ERR and stores a status value in the integer pointed to by -.IR errret . +.IR errret "." A return value of .B OK combined with status of @@ -280,17 +264,16 @@ .B ERR is returned, examine -.I errret: +.IR errret "." .RS .TP 5 .B 1 -means that the terminal is hardcopy, +means that the terminal is a hard-copy type +(lacks destructive backspace), and cannot be used for .I curses applications. -.IP -\fB\%setupterm\fP determines if the entry is a hardcopy type by -checking the +The library determines this fact by checking the terminal type's .B \%hardcopy .RB ( hc ) capability. @@ -302,8 +285,8 @@ .I curses applications to run. .IP -\fB\%setupterm\fP determines if the entry is a generic type by -checking the +.B \%setupterm +determines if the entry is a generic type by checking the .B \%generic_type .RB ( gn ) capability. @@ -317,84 +300,102 @@ If .I errret is null, -\fB\%setupterm\fP reports an error message upon finding an error and -exits. +.B \%setupterm +reports an error message upon finding an error and exits. Thus, the simplest call is: .RS .IP .EX -setupterm((char *)0, 1, (int *)0); +setupterm((char *) NULL, 1, (int *) NULL); .EE .RE .IP which uses all the defaults and sends the output to -.BR stdout . +.IR stdout "." .RE .\" ******************************************************************** .SS "The Terminal State" -\fB\%setupterm\fP stores its information about the terminal in a +.B \%setupterm +stores its information about the terminal in a .I \%TERMINAL -structure pointed to by the global variable \fB\%cur_term\fP. +structure pointed to by the global variable +.BR \%cur_term "." If it detects an error, or decides that the terminal is unsuitable (hardcopy or generic), it discards this information, -making it not available to applications. +making it unavailable to applications. .PP -If \fB\%setupterm\fP is called repeatedly for the same terminal type, -it will reuse the information. -It maintains only one copy of a given terminal's capabilities in memory. -If it is called for different terminal types, -\fB\%setupterm\fP allocates new storage for each set of terminal -capabilities. -.PP -\fB\%set_curterm\fP sets \fB\%cur_term\fP to -.IR \%nterm , -and makes all of the +If +.B \%setupterm +is called repeatedly for the same terminal type, +it reuses the information. +It maintains only one copy of a given type's capabilities in memory. +If called for different types, +.B \%setupterm +allocates new storage for each set of terminal capabilities. +.PP +.B \%set_curterm +sets +.B \%cur_term +to +.IR \%nterm "," +making all of the .I \%term\%info Boolean, numeric, -and string variables use the values from -.IR \%nterm . -It returns the old value of \fB\%cur_term\fP. -.PP -\fB\%del_curterm\fP frees the space pointed to by -.I \%oterm -and makes it available for further use. +and string capabilities use the values from +.IR \%nterm "." +It returns the old value of +.BR \%cur_term "." +.PP +.B \%del_curterm +releases the memory pointed to by +.IR \%oterm "." If .I \%oterm is -the same as \fB\%cur_term\fP, +the same as +.BR \%cur_term "," references to any of the .I \%term\%info Boolean, numeric, -and string variables thereafter may refer to invalid memory locations -until another \fB\%setupterm\fP has been called. -.PP -\fB\%restartterm\fP is similar to \fB\%setupterm\fP and \fB\%initscr\fP, -except that it is called after restoring memory to a previous state +and string capabilities thereafter may refer to invalid memory locations +until +.B \%setupterm +is called again. +.PP +.B \%restartterm +is similar to +.BR \%setupterm "," +but is intended for use after restoring program memory +to a previous state (for example, -when reloading a game saved as a core image dump). -\fB\%restartterm\fP assumes that the windows and the input and output -options are the same as when memory was saved, -but the terminal type and baud rate may be different. +when reloading an application that has been suspended from one terminal +session and restored in another). +.B \%restartterm +assumes that the display dimensions +and the input and output options are the same as when memory was saved, +but the terminal type and line speed may differ. Accordingly, -\fB\%restartterm\fP saves various terminal state bits, -calls \fB\%setupterm\fP, -and then restores the bits. +.B \%restartterm +saves relevant terminal state, +calls +.BR \%setupterm "," +then restores that state. .\" ******************************************************************** .SS "Formatting Output" \fB\%tparm\fP instantiates the string .I str with parameters -.IR pi . -A pointer is returned to the result of +.IR pi "." +It returns a pointer to a character string representing .I str -with the parameters applied. -Application developers should keep in mind these quirks of the -interface: +with the parameters applied to \*(``%\*('' expressions within. +.\" XXX: Whose responsibility is it to free that string? +Application developers should keep in mind some quirks of the interface. .bP Although \fB\%tparm\fP's actual parameters may be integers or strings, the prototype expects @@ -413,67 +414,79 @@ The capability string is null-terminated. Use \*(``\e200\*('' where an ASCII NUL is needed in the output. .PP -\fB\%tiparm\fP is a newer form of \fB\%tparm\fP which uses +\fB\%tiparm\fP is a newer form of \fB\%tparm\fP that uses .I \%stdarg.h -rather than a fixed-parameter list. +rather than a fixed-length parameter list. Its numeric parameters are .IR int s rather than .IR long "s." .PP -Both \fB\%tparm\fP and \fB\%tiparm\fP assume that the application passes -parameters consistent with the terminal description. -Two extensions are provided as alternatives to deal with untrusted data. +.B \%tparm +and +.B \%tiparm +assume that the application +passes parameters consistent with the terminal description. +.I \%ncurses +provides two extensions as alternatives to deal with untrusted data. .bP -\fB\%tiparm_s\fP is an extension which is a safer formatting function -than \fB\%tparm\fR or \fB\%tiparm\fR, +The +.B \%tiparm_s +extension is a safer formatting function than +.B \%tparm +or +.BR \%tiparm "," because it allows the developer to tell the .I curses library how many parameters to expect in the parameter list, and which may be string parameters. .IP -The \fImask\fP parameter has one bit set for each of the parameters +The +.I mask +parameter has one bit set for each of the parameters (up to 9) passed as .I char pointers rather than numbers. .bP -The extension \fB\%tiscan_s\fP allows the application to inspect a -formatting capability to see what the +The extension +.B \%tiscan_s +allows the application +to inspect a formatting capability to see what the .I curses library would assume. .\" ******************************************************************** .SS "Output Functions" -String capabilities can contain padding information, +String capabilities can contain +.IR padding "," a time delay (accommodating performance limitations of hardware terminals) -expressed as \fB$<\fIn\fB>\fR, -where \fIn\fP is a nonnegative integral count of milliseconds. -If \fIn\fP exceeds 30,000 +expressed as +.BI $< n >\c +, +where +.I n +is a nonnegative integral count of milliseconds. +If +.I n +exceeds 30,000 (thirty seconds), -it is capped at that value. +.I \%ncurses +caps it at that value. .PP -\fB\%tputs\fP interprets time-delay information in the string +.B \%tputs +interprets time delays in the string .I str -and outputs it, -executing the delays: +and acts upon them. .bP The .I str parameter must be a .I \%term\%info -string variable or the return value of -\fB\%tparm\fP, -\fB\%tiparm\fP, -\fB\%tgetstr\fP, -or \fB\%tgoto\fP. -.IP -The \fB\%tgetstr\fP and \fB\%tgoto\fP functions are part of the -.I termcap -interface, -which happens to share these function names with the -.I \%term\%info -API. +string capability or the return value of +.B \%tparm +or +.BR \%tiparm "." .bP .I affcnt is the number of lines affected, @@ -486,9 +499,9 @@ .IR \%putchar -like function to which the characters are passed, one at a time. -.IP -If \fB\%tputs\fP processes a time-delay, -it uses the \fB\%delay_output\fP(3X) function, +.PP +.B \%tputs +processes each time delay with the \fB\%delay_output\fP(3X) function, routing any resulting padding characters through this function. .PP \fB\%putp\fR calls @@ -496,19 +509,19 @@ .IB str ", 1, putchar)\c" \*(''. The output of \fB\%putp\fP always goes to -.BR stdout , +.IR stdout "," rather than the .I \%file\%des specified in \fB\%setupterm\fP. .PP \fB\%vidputs\fP displays the string on the terminal in the video attribute mode -.IR attrs , +.IR attrs "," which is any combination of the attributes listed in \fB\%curses\fP(3X). The characters are passed to the .IR \%putchar -like function -.IR putc . +.IR putc "." .PP \fB\%vidattr\fP is like \fB\%vidputs\fP, except that it outputs through \fI\%putchar\fP(3). @@ -519,20 +532,20 @@ correspond to .B \%vidattr and -.BR \%vidputs , +.BR \%vidputs "," respectively. They use multiple parameters to represent the character attributes and color; namely, .bP -.IR \%attrs , +.IR \%attrs "," of type -.IR \%attr_t , +.IR \%attr_t "," for the attributes and .bP -.IR pair , +.IR pair "," of type -.IR short , +.IR short "," for the color pair number. .PP Use the attribute constants prefixed with @@ -540,7 +553,7 @@ with .B \%vid_attr and -.BR \%vid_puts . +.BR \%vid_puts "." .PP X/Open Curses reserves the .I opts @@ -548,44 +561,39 @@ saying that applications must provide a null pointer for that argument; but see section \*(``EXTENSIONS\*('' below. .PP -\fB\%mvcur\fP provides low-level cursor motion. -It takes effect immediately -(rather than at the next refresh). -Unlike the other low-level output functions, -which either write to the standard output or pass an output function -parameter, -\fB\%mvcur\fP uses an output file descriptor derived from -the output stream parameter of \fB\%newterm\fP(3X). -.PP -While \fB\%putp\fP and \fB\%mvcur\fP are low-level functions that do not -use high-level +While +.B \%putp +is a lower-level function +that does not use higher-level .I curses state, .I \%ncurses -declares them in +declares it in .I \%curses.h -because System\ V did this +because System\ V did so (see section \*(``HISTORY\*('' below). .\" ******************************************************************** .SS "Terminal Capability Functions" -\fB\%tigetflag\fP, -\fB\%tigetnum\fP, -and \fB\%tigetstr\fP return the value of the capability corresponding to +.BR \%tigetflag "," +.BR \%tigetnum "," +and +.B \%tigetstr +return the value of the capability corresponding to the .I \%term\%info -.IR cap-code , +.IR cap-code "," such as -.BR xenl , +.BR xenl "," passed to them. The .I cap-code -for each capability is given in the table column entitled -.I cap-code -code in the capabilities section of \fB\%terminfo\fP(5). +for each capability is given in the table column of that name +in the \*(``Capabilities\*('' section of \fB\%terminfo\fP(5). .PP These functions return special values to denote errors. .PP -\fB\%tigetflag\fP returns +.B \%tigetflag +returns .TP .B \-1 if @@ -596,7 +604,8 @@ .B 0 if it is canceled or absent from the terminal description. .PP -\fB\%tigetnum\fP returns +.B \%tigetnum +returns .TP .B \-2 if @@ -607,7 +616,8 @@ .B \-1 if it is canceled or absent from the terminal description. .PP -\fB\%tigetstr\fP returns +.B \%tigetstr +returns .TP .B "(char *)\-1" if @@ -615,7 +625,7 @@ is not a string capability, or .TP -.B 0 +.B NULL if it is canceled or absent from the terminal description. .\" ******************************************************************** .SS "Terminal Capability Names" @@ -628,9 +638,9 @@ .bP the long \fI\%term\%info\fP names (\*(``fnames\*('') .PP -for each of the predefined +for each standard .I \%term\%info -variables: +capability name. .PP .RS .nf @@ -646,11 +656,11 @@ As a side effect, it sets \fB\%cur_term\fP to point to this memory. If an application calls -.IP +.RS .EX del_curterm(cur_term); .EE -.PP +.RE the memory will be freed. .PP The formatting functions \fB\%tparm\fP and \fB\%tiparm\fP extend the @@ -684,11 +694,16 @@ but it is possible to do that using the \fB\%delscreen\fP(3X) function. .\" ******************************************************************** .SH RETURN VALUE -X/Open Curses defines no failure conditions. +Functions that return integers return +.B ERR +upon failure and +.B OK +upon success. +.PP In -.IR \%ncurses , +.IR \%ncurses "," .TP 5 -.B del_curtem +.B del_curterm fails if its terminal parameter is null. .TP 5 .B putp @@ -696,15 +711,16 @@ returning the same error codes. .TP 5 .B restartterm -fails if the associated call to \fB\%setupterm\fP returns an error. +fails if the associated call to \fB\%setupterm\fP returns +.BR ERR "." .TP 5 .B setupterm fails if it cannot allocate enough memory, or create the initial windows -.RB ( \%stdscr , -.BR \%curscr , +.RB \%( stdscr , +.BR \%curscr "," and -.BR \%newscr ) +.BR \%newscr ")." Other error conditions are documented above. .TP 5 .B tparm @@ -738,12 +754,12 @@ is also provided in the non-wide-character configuration. .\" ******************************************************************** .SH EXTENSIONS -The functions marked as extensions were designed for -.IR \%ncurses , +The functions marked as extensions originated in +.IR \%ncurses "," and are not found in SVr4 -.IR curses , +.IR curses "," 4.4BSD -.IR curses , +.IR curses "," or any other previous .I curses implementation. @@ -752,57 +768,84 @@ allows .I opts to be a pointer to -.IR int , +.IR int "," which overrides the .I pair .RI ( short ) argument. .\" ******************************************************************** .SH PORTABILITY -\fB\%setterm\fP is not described by X/Open and must be considered -non-portable. -All other functions are as described by X/Open. +Except for +.IR \%setterm "," +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.PP +SVr4 describes a successful return value +except where \*(``otherwise noted\*('' +as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 539 +.SS "Header Files" +On legacy +.I curses +systems, +include +.I \%curses.h +and +.I \%term.h +in that order +to make visible the definitions of the string arrays +storing the capability names and codes. .SS "Compatibility Macros" -This implementation provides a few macros for compatibility with systems -before SVr4 +.I \%ncurses +implements a few macros for early System\ V +.I curses +compatibility (see section \*(``HISTORY\*('' below). They include -\fB\%Bcrmode\fP, -\fB\%Bfixterm\fP, -\fB\%Bgettmode\fP, -\fB\%Bnocrmode\fP, -\fB\%Bresetterm\fP, -\fB\%Bsaveterm\fP, +.IR \%crmode "," +.IR \%fixterm "," +.IR \%gettmode "," +.IR \%nocrmode "," +.IR \%resetterm "," +.IR \%saveterm "," and -\fB\%Bsetterm\fP. +.IR \%setterm "." .PP In SVr4, these are found in -.IR \%curses.h , -but except for \fB\%setterm\fP, +.IR \%curses.h "," +but except for +.IR \%setterm "," are likewise macros. The one function, -\fB\%setterm\fP, +.IR \%setterm "," is mentioned in the manual page. -It further notes that \fB\%setterm\fP was replaced by \fB\%setupterm\fP, +It further notes that +.I \%setterm +was replaced by +.IR \%setupterm "," stating that the call .RS .EX -setupterm(\fIterm\fP, 1, (int *)0) +.RI setupterm( term ", 1, (int *)0)" .EE .RE -provides the same functionality as \fB\%setterm(\fIterm\fB)\fR, -discouraging the latter for new programs. -.I \%ncurses -implements each of these symbols as macros for BSD -.I curses -compatibility. +provides the same functionality as +.RS +.EX +.RI setterm( term ) +.EE +.RE +and discouraging the latter for new programs. .SS "Legacy Data" -\fB\%setupterm\fP copies the terminal name to the array \fB\%ttytype\fP. -This is not part of X/Open Curses, +.I \%setupterm +copies the terminal name to the array +.IR \%ttytype "." +This behavior is not specified by X/Open Curses, but is assumed by some applications. .PP -Other implementions may not declare the capability name arrays. +Other implementations may not declare the capability name arrays. Some provide them without declaring them. X/Open Curses does not specify them. .PP @@ -811,29 +854,39 @@ .RB \%\*(`` "@TIC@ \-x" \*('', are not stored in the arrays described here. .SS "Output Buffering" -Older versions of \fI\%ncurses\fP assumed that the file descriptor -passed to \fB\%setupterm\fP from \fB\%initscr\fP or \fB\%newterm\fP uses -buffered I/O, -and would write to the corresponding stream. +Older versions of +.I \%ncurses +assumed that the file descriptor passed to +.I \%setupterm +from +.I \%initscr +or +.I \%newterm +used buffered I/O, +and wrote to the corresponding +.I stdio +stream. In addition to the limitation that the terminal was left in block-buffered mode on exit (like System\ V -.IR curses ), +.IR curses ")," it was problematic because .I \%ncurses did not allow a reliable way to clean up on receiving -.BR SIGTSTP . +.IR SIGTSTP "." .PP -The current version (ncurses6) +.I \%ncurses +.RI 6. x uses output buffers managed directly by -.IR \%ncurses . -Some of the low-level functions described in this manual page write -to the standard output. -They are not signal-safe. -The high-level functions in +.IR \%ncurses "." +The lower-level functions described here +that write to the terminal device +do so via the standard output stream; +they thus are not signal-safe. +The higher-level functions in .I \%ncurses -employ alternate versions of these functions using the more reliable -buffering scheme. +employ alternate versions of these functions +using a more reliable buffering scheme. .SS "Function Prototypes" The X/Open Curses prototypes are based on the SVr4 .I curses @@ -844,19 +897,23 @@ X/Open Curses uses .I \%const less effectively than a later design might, -sometimes applying it needlessly to values that are already constant, -and in most cases overlooking parameters that normally would use -.IR \%const . +sometimes applying it needlessly to function parameters +that are passed by value +(and therefore copied), +and in most cases overlooking parameters +that normally would benefit from +.IR \%const "." Passing .IR \%const -qualified parameters to functions that do not declare them .I \%const may prevent the program from compiling. On the other hand, -\*(``writable strings\*('' are an obsolescent feature. +\*(``writable strings\*('' are an obsolescent C language feature. .IP As an extension, -this implementation can be configured to change the function prototypes +.I \%ncurses +can be configured to change the function prototypes to use the .I \%const keyword. @@ -864,41 +921,55 @@ .I \%ncurses ABI 6 enables this feature by default. .bP -X/Open Curses prototypes \fB\%tparm\fP with a fixed number of -parameters, +X/Open Curses prototypes +.I \%tparm +with a fixed number of parameters, rather than a variable argument list. .IP -This implementation uses a variable argument list, +.I \%ncurses +uses a variable argument list, but can be configured to use the fixed-parameter list. Portable applications should provide nine parameters after the format; zeroes are fine for this purpose. .IP In response to review comments by Thomas E. Dickey, -X/Open Curses Issue 7 proposed the \fB\%tiparm\fP function in mid-2009. +X/Open Curses Issue\ 7 proposed the +.I \%tiparm +function in mid-2009. .IP -While \fB\%tiparm\fP is always provided in \fI\%ncurses\fP, -the older form is only available as a build-time configuration option. +While +.I \%tiparm +is always provided in +.IR \%ncurses "," +the older form is available only as a build-time configuration option. If not specially configured, -\fB\%tparm\fP is the same as \fB\%tiparm\fP. +.I \%tparm +is the same as +.IR \%tiparm "." .PP -Both forms of \fB\%tparm\fP have drawbacks: +Both forms of +.I \%tparm +have drawbacks. .bP -Most of the calls to \fB\%tparm\fP use only one or two parameters. +Most calls to +.I \%tparm +require only one or two parameters. Passing nine on each call is awkward. .IP Using .I long for the numeric parameter type is a workaround to make the parameter use -the same amount of stack as a pointer. -That approach dates back to the mid-1980s, +the same amount of stack memory as a pointer. +That approach dates to the mid-1980s, before C was standardized. -Since then, -there is a standard -(and pointers are not required to fit in a -.IR long ). +Since ANSI\ C (1989), +C language standards do not require a pointer to fit in a +.IR long ")." .bP Providing the right number of parameters for a variadic function -such as \fB\%tiparm\fP can be a problem, +such as +.I \%tiparm +can be a problem, in particular for string parameters. However, only a few @@ -907,21 +978,35 @@ (for instance, the ones used for programmable function keys). .IP -The \fI\%ncurses\fP library checks usage of these capabilities, -and returns an error if the capability mishandles string parameters. +The +.I \%ncurses +library checks usage of these capabilities, +and returns +.I ERR +if the capability mishandles string parameters. But it cannot check if a calling program provides strings in the right -places for the \fB\%tparm\fP calls. +places for the +.I \%tparm +calls. .IP -The \fB\%@TPUT@\fR(1) program checks its use of these capabilities with -a table, -so that it calls \fB\%tparm\fP correctly. +.IR \%ncurses 's +\fB\%@TPUT@\fR(1) checks its use of these capabilities with a table, +so that it calls +.I \%tparm +correctly. .SS "Special \fITERM\fP treatment" -If configured to use the terminal driver, -.\" XXX: as opposed to the Unix terminal driver, termio(s)? +If +.I \%ncurses +is configured to use a terminal driver +that does not employ the POSIX +.I \%termios +API, as with the MinGW port, .bP -\fB\%setupterm\fP interprets a missing/empty \fITERM\fP variable as the -special value \*(``unknown\*(''. +.I \%setupterm +interprets a missing or empty +.I TERM +variable as the special value \*(``unknown\*(''. .IP SVr4 .I curses @@ -935,69 +1020,47 @@ while the latter does not. A generic terminal is unsuitable for full-screen applications. .bP -\fB\%setupterm\fP allows explicit use of the -the windows console driver by checking if \fB$TERM\fP is set to -\*(``#win32con\*('' or an abbreviation of that string. +.I \%setupterm +allows explicit use of the Microsoft Windows console driver by checking +whether the +.I TERM +environment variable has the value \*(``#win32con\*('' +or an abbreviation of that string. .SS "Other Portability Issues" In SVr4, -\fB\%set_curterm\fP returns an -.IR int , -.B OK +.I \%set_curterm +returns an +.IR int "," +.I OK or -.BR ERR . +.IR ERR "." We have chosen to implement the X/Open Curses semantics. .PP In SVr4, -the third argument of \fB\%tputs\fP has the type -.RB \*(`` "int (*putc)(char)" \*(''. -.PP -At least one implementation of X/Open Curses (Solaris) returns a value -other than -.B OK +the third argument of +.I \%tputs +has the type +.RB \*(`` "int (*)(char)" \*(''. +.PP +At least one implementation of X/Open Curses +(Solaris +.IR \%xcurses ")" +returns a value other than +.I OK or -.B ERR -from \fB\%tputs\fP. +.I ERR +from +.IR \%tputs "." It instead returns the length of the string, and does no error checking. .PP -X/Open Curses notes that after calling \fB\%mvcur\fP, -the -.I curses -state may not match the actual terminal state, -and that an application should touch and refresh the window before -resuming normal -.I curses -calls. -Both -.I \%ncurses -and SVr4 +Very old versions of AIX +.\" Can we be more specific? Like, AIX 4.3.3 and earlier? --GBR .I curses -implement \fB\%mvcur\fP using the -.I SCREEN -data allocated in either \fB\%initscr\fP or \fB\%newterm\fP. -So though it is documented as a -.I \%term\%info -function, -\fB\%mvcur\fP is really a -.I curses -function that is not well specified. -.PP -X/Open Curses states that the old location must be given for -\fB\%mvcur\fP to accommodate terminals that lack absolute cursor -positioning. -.\" X/Open Curses Issue 7, p. 161 -.I \%ncurses -allows the caller to use \-1 for either or both old coordinates. -The \-1 tells -.I \%ncurses -that the old location is unknown, -and that it must use only absolute motion, -as with the -.B \%cursor_address -.RB ( cup ) -capability, -rather than the least costly combination of absolute and relative -motion. +required inclusion of +.I \%curses.h +before +.IR \%term.h . .\" ******************************************************************** .SH HISTORY SVr2 (1984) introduced the @@ -1006,14 +1069,14 @@ Its programming manual mentioned the following low-level functions. .PP .TS -lB lB -lB lx. +Lb Lb +Li Lw(47n)x. Function Description _ fixterm restore terminal to \*(``in \fIcurses\fP\*('' state gettmode establish current terminal modes mvcur low level cursor motion -putp use \fBtputs\fP to send characters via \fIputchar\fP +putp use \fItputs\fP to send characters via \fIputchar\fP resetterm set terminal modes to \*(``out of \fIcurses\fP\*(''\ state resetty reset terminal flags to stored value @@ -1023,7 +1086,7 @@ setupterm establish terminal with given type tparm interpolate parameters into string capability tputs apply padding information to a string -vidattr like \fBvidputs\fP, but output through \fIputchar\fP +vidattr like \fIvidputs\fP, but output through \fIputchar\fP vidputs T{ write string to terminal, applying specified attributes T} @@ -1036,8 +1099,8 @@ (commenting that they \*(``may go away at a later date\*(''). .PP .TS -lB lB -lB lx. +Lb Lb +Li Lw(48n)x. Function Description _ tgetent look up \fItermcap\fP entry for given \fIname\fP @@ -1054,7 +1117,8 @@ .I \%term\%info programs obtained capability values from the .I \%TERMINAL -structure initialized by \fB\%setupterm\fP. +structure initialized by +.IR \%setupterm "." .PP SVr3 (1987) extended .I \%term\%info @@ -1062,11 +1126,15 @@ (like the .I termcap interface), -and reusing \fB\%tgoto\fP and \fB\%tputs\fP. +and reusing +.I \%tgoto +and +.IR \%tputs "." .PP +.ne 4v .TS -lB lB -lB lx. +Lb Lb +LI Lx. Function Description _ tigetflag get Boolean entry for given \fIid\fP @@ -1082,33 +1150,40 @@ documenting them as obsolete. .PP .TS -lB lB -l lx. +Lb Lb +Li Lix. Function Replaced by _ crmode cbreak fixterm reset_prog_mode -gettmode \fIn/a\fP +gettmode \fRn/a\fP nocrmode nocbreak resetterm reset_shell_mode saveterm def_prog_mode setterm setupterm .TE .PP -SVr3 kept the \fB\%mvcur\fP, -\fB\%vidattr\fP, -and \fB\%vidputs\fP functions, -along with \fB\%putp\fP, -\fB\%tparm\fP, -and \fB\%tputs\fP. +SVr3 kept the +.IR \%mvcur "," +.IR \%vidattr "," +and +.I \%vidputs +functions, +along with +.IR \%putp "," +.IR \%tparm "," +and +.IR \%tputs "." The latter were needed to support padding, -and to handle capabilities accessed by functions such as \fB\%vidattr\fP -(which used more than the two parameters supported by \fB\%tgoto\fP). +and to handle capabilities accessed by functions such as +.I \%vidattr +(which used more than the two parameters supported by +.IR \%tgoto ")." .PP SVr3 introduced the functions for switching between terminal descriptions; for example, -\fB\%set_curterm\fP. +.IR \%set_curterm "." Some changes reflected incremental improvements to the SVr2 library. .bP The @@ -1118,11 +1193,16 @@ .I term structure provided in SVr2. .bP -Various global variables such as \fB\%boolnames\fP were mentioned -in the programming manual at this point, +Various global variables such as +.I \%boolnames +were mentioned in the programming manual at this point, though the variables had been provided in SVr2. .PP -SVr4 (1989) added the \fB\%vid_attr\fP and \fB\%vid_puts\fP functions. +SVr4 (1989) added the +.I \%vid_attr +and +.I \%vid_puts +functions. .PP Other low-level functions are declared in the .I curses diff --git a/contrib/ncurses/man/curs_threads.3x b/contrib/ncurses/man/curs_threads.3x --- a/contrib/ncurses/man/curs_threads.3x +++ b/contrib/ncurses/man/curs_threads.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2021-2023,2024 Thomas E. Dickey * +.\" Copyright 2021-2024,2025 Thomas E. Dickey * .\" Copyright 2008-2015,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_threads.3x,v 1.56 2024/03/16 15:35:01 tom Exp $ -.TH curs_threads 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_threads.3x,v 1.59 2025/02/15 19:41:22 tom Exp $ +.TH curs_threads 3X 2025-02-15 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -102,7 +102,7 @@ \fB\%newscr\fP, and \fB\%ttytype\fP, -maintaining them as as read-only values in the \fISCREEN\fP structure. +maintaining them as read-only values in the \fISCREEN\fP structure. .PP Even this is not enough to make an application using \fIcurses\fP thread-safe. diff --git a/contrib/ncurses/man/curs_touch.3x b/contrib/ncurses/man/curs_touch.3x --- a/contrib/ncurses/man/curs_touch.3x +++ b/contrib/ncurses/man/curs_touch.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2015,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,18 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_touch.3x,v 1.47 2024/04/20 21:20:07 tom Exp $ -.TH curs_touch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_touch.3x,v 1.63 2025/01/19 00:51:10 tom Exp $ +.TH curs_touch 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.ie \n(.g \{\ +.ds `` \(lq +.ds '' \(rq +.\} +.el \{\ +.ie t .ds `` `` +.el .ds `` "" +.ie t .ds '' '' +.el .ds '' "" +.\} .SH NAME \fB\%touchwin\fP, \fB\%touchline\fP, @@ -77,16 +87,19 @@ addition, \fB\%is_linetouched\fP returns \fBERR\fP if \fIline\fP is not valid for the given window. .SH RETURN VALUE -All routines return the integer \fBERR\fP upon failure and an integer value -other than \fBERR\fP upon successful completion, unless otherwise noted in the -preceding routine descriptions. +Functions returning integers return +.B ERR +upon failure and +.B OK +upon success. .PP -X/Open Curses does not specify any error conditions. -In this implementation +In +.IR \%ncurses "," .RS 3 .TP 5 \fBis_linetouched\fP -returns an error +returns +.B ERR if the window pointer is null, or if the line number is outside the window boundaries. .IP @@ -101,23 +114,40 @@ The actual function returns \fBFALSE\fP when it detects an error. .TP 5 \fBwtouchln\fP -returns an error +returns +.B ERR if the window pointer is null, or if the line number is outside the window boundaries. .RE .SH NOTES -All of these routines except \fB\%wtouchln\fP may be macros. +All of these functions except +.B \%wtouchln +may be implemented as macros. .SH PORTABILITY -These functions were introduced by SVr4. -The Solaris \fIcurses\fP header file, -for instance, defines both an actual function and macro for each. -The macros give the same result as the actual functions. -SVr4 \fIcurses\fP does not check the window parameter \fIwin\fP to ensure -that it is not \fBNULL\fP; -otherwise this implementation behaves the same as SVr4. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. .PP -X/Open Curses, Issue 4 describes these functions, -but defines no error conditions. +SVr4 describes a successful return value +except where \*(``otherwise noted\*('' +as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 540 +.PP +SVr4 does not check +.I win +to ensure that it is not a null pointer. +.SH HISTORY +SVr2 (1984) introduced +.IR \%touchwin "," +.PP +SVr3 (1987) added +.IR \%touchline "." +SVr3.1 later that year supplied +.IR \%is_linetouched "," +.IR \%is_wintouched "," +.IR \%untouchwin "," +and +.IR \%wtouchln "." .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_refresh\fP(3X), diff --git a/contrib/ncurses/man/curs_trace.3x b/contrib/ncurses/man/curs_trace.3x --- a/contrib/ncurses/man/curs_trace.3x +++ b/contrib/ncurses/man/curs_trace.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-2024,2025 Thomas E. Dickey * .\" Copyright 2000-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_trace.3x,v 1.50 2024/04/20 21:24:19 tom Exp $ -.TH curs_trace 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_trace.3x,v 1.55 2025/01/19 00:51:10 tom Exp $ +.TH curs_trace 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -139,7 +139,7 @@ .bP If tracing is not available, \fBcurses_trace\fP returns zero (0). .SS "Trace Parameter" -The trace parameter is formed by OR'ing +The trace parameter is formed by logically \*(``or\*(''-ing values from the list of \fBTRACE_\fIxxx\fR definitions in \fB\fR. These include: .TP 5 @@ -264,13 +264,15 @@ .IP The SVr4 tracing feature is undocumented. .bP -PDCurses provides \fBtraceon\fP and \fBtraceoff\fP, +.I \%PDCurses +provides \fBtraceon\fP and \fBtraceoff\fP, which (like SVr4) are always available, and enable tracing to the \*(``trace\*('' file only when a debug-library is built. .IP -PDCurses has a short description of these functions, +.I \%PDCurses +has a short description of these functions, with a note that they are not present in X/Open Curses, \fI\%ncurses\fP or NetBSD. It does not mention SVr4, diff --git a/contrib/ncurses/man/curs_util.3x b/contrib/ncurses/man/curs_util.3x --- a/contrib/ncurses/man/curs_util.3x +++ b/contrib/ncurses/man/curs_util.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2015,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,17 +28,21 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_util.3x,v 1.101 2024/04/20 21:20:07 tom Exp $ -.TH curs_util 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_util.3x,v 1.151 2025/11/12 01:06:36 tom Exp $ +.TH curs_util 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq +.ds ^ \(ha +.ds ~ \(ti .\} .el \{\ .ie t .ds `` `` .el .ds `` "" .ie t .ds '' '' .el .ds '' "" +.ds ^ ^ +.ds ~ ~ .\} . .de bP @@ -63,53 +67,83 @@ .nf \fB#include .PP -\fBconst char *unctrl(chtype \fIch\fP); -\fBwchar_t *wunctrl(cchar_t *\fIwch\fP); +\fBconst char * unctrl(chtype \fIch\fP); +\fBwchar_t * wunctrl(cchar_t * \fIwch\fP); .PP -\fBconst char *keyname(int \fIc\fP); -\fBconst char *key_name(wchar_t \fIwc\fP); +\fBconst char * keyname(int \fIc\fP); +\fBconst char * key_name(wchar_t \fIwc\fP); .PP \fBvoid filter(void); +\fI/* extension */ +\fBvoid nofilter(void); .PP -\fBvoid use_env(bool \fIf\fP); +\fBvoid use_env(bool \fIbf\fP); +\fI/* extension */ +\fBvoid use_tioctl(bool \fIbf\fP); .PP -\fBint putwin(WINDOW *\fIwin\fP, FILE *\fIfilep\fP); -\fBWINDOW *getwin(FILE *\fIfilep\fP); +\fBint putwin(WINDOW * \fIwin\fP, FILE * \fIfilep\fP); +\fBWINDOW * getwin(FILE * \fIfilep\fP); .PP \fBint delay_output(int \fIms\fP); -\fBint flushinp(void); .PP -\fI/* extensions */ -\fBvoid nofilter(void); -\fBvoid use_tioctl(bool \fIf\fP); +\fBint flushinp(void); .fi .SH DESCRIPTION -.SS unctrl -The \fBunctrl\fP routine returns a character string which is a printable -representation of the character \fIch\fP: -.bP -Printable characters are displayed as themselves, -e.g., a one-character string containing the key. -.bP -Control characters are displayed in the \fB^\fIX\fR notation. -.bP -Printing characters are displayed as is. -.bP -DEL (character 127) is displayed as \fB^?\fP. -.bP -Values above 128 are either meta characters -(if the screen has not been initialized, -or if \fBmeta\fP(3X) has been called with a \fBTRUE\fP parameter), -shown in the \fBM\-\fIX\fR notation, -or are displayed as themselves. -In the latter case, the values may not be printable; -this follows the X/Open specification. +.SS "unctrl, wunctrl" +.B unctrl +returns a null-terminated character string printably representing the +.I curses +character +.IR ch , +often one that originated in keyboard input; +see \fBgetch\fP(3X). +.bP +Printable characters represent themselves as a one-character string. +.bP +Control characters are expressed in +.BI \*^ X +notation, +where +.I X +is the printable symbol of the control code's value plus 32 +in the ISO\ 646/\*(``ASCII\*('' character set. +.bP +DEL +(character code 127) +is represented as +.BR \*^? . +.bP +A character code greater than 127 is represented in one of two ways. +.IP +If the screen has not been initialized or is in meta mode +(see \fBmeta\fP(3X)), +it is expressed in +.BI M- X +notation, +where X +is the representation of the code's value minus 128, +as described above. +.IP +If the screen is not in meta mode, +the character code is assumed to represent itself. +It nevertheless may not be printable; +this is the case for character codes 128-159 in ISO\ 8859 encodings. +.IP +.IR \%ncurses 's +\fB\%use_legacy_coding\fP(3X) +function configures +.BR \%unctrl 's +handling of these character codes. .PP -The corresponding \fBwunctrl\fP returns a printable representation of -a complex character \fIwch\fP. +.B \%wunctrl +returns a null-terminated wide-character string printably representing +the +.I curses +complex character +.IR wch . .PP -In both \fBunctrl\fP and \fBwunctrl\fP the attributes and color associated -with the character parameter are ignored. +Both functions ignore the attributes and color pair selection +of their argument. .SS "keyname, key_name" The \fBkeyname\fP routine returns a character string corresponding to the key \fIc\fP. @@ -121,22 +155,28 @@ Values above 256 may be the codes for function keys. The function key name is displayed. .bP -Otherwise (if there is no corresponding name and the key is not a character) -the function returns null, to denote an error. +Otherwise +(if there is no corresponding name and the key is not a character) +the function returns null, +to denote an error. X/Open also lists an \*(``UNKNOWN KEY\*('' return value, which some implementations return rather than null. .LP The corresponding \fBkey_name\fP returns a multibyte character string corresponding -to the wide-character value \fIw\fP. -The two functions (\fBkeyname\fP and \fBkey_name\fP) +to the wide-character value \fIwc\fP. +The two functions +(\fBkeyname\fP and \fBkey_name\fP) do not return the same set of strings: .bP -\fBkeyname\fP returns null where \fBkey_name\fP would display a meta character. +\fBkeyname\fP returns null where \fBkey_name\fP +would display a meta character. .bP \fBkey_name\fP does not return the name of a function key. .SS "filter, nofilter" -The \fBfilter\fP routine, if used, must be called before \fBinitscr\fP or +The \fBfilter\fP routine, +if used, +must be called before \fBinitscr\fP or \fBnewterm\fP are called. Calling \fBfilter\fP causes these changes in initialization: .bP @@ -156,14 +196,15 @@ .bP and the \fBhome\fP string is set to the value of \fBcr\fP. .PP -The \fBnofilter\fP routine cancels the effect of a preceding \fBfilter\fP -call. +The \fBnofilter\fP routine cancels the effect +of a preceding \fBfilter\fP call. That allows the caller to initialize a screen on a different device, using a different value of \fB$TERM\fP. The limitation arises because the \fBfilter\fP routine modifies the in-memory copy of the terminal information. .SS use_env -The \fBuse_env\fP routine, if used, +The \fBuse_env\fP routine, +if used, should be called before \fBinitscr\fP or \fBnewterm\fP are called (because those compute the screen size). @@ -181,43 +222,46 @@ If successful, it overrides the values from the terminal database. .bP -Finally (unless \fBuse_env\fP was called with \fBFALSE\fP parameter), +Finally +(unless \fBuse_env\fP was called with \fBFALSE\fP parameter), \fI\%ncurses\fP examines the \fILINES\fP or \fI\%COLUMNS\fP environment variables, using a value in those to override the results from the operating system or terminal database. .IP -\fI\%curses\fP also updates the screen size in response to -\fBSIGWINCH\fP, +.I curses +also updates the screen size in response to +.IR \%SIGWINCH "," unless overridden by the \fILINES\fP or \fI\%COLUMNS\fP environment variables, .SS use_tioctl -The \fBuse_tioctl\fP routine, if used, +The \fBuse_tioctl\fP routine, +if used, should be called before \fBinitscr\fP or \fBnewterm\fP are called (because those compute the screen size). After \fBuse_tioctl\fP is called with \fBTRUE\fP as an argument, \fI\%ncurses\fP modifies the last step in its computation of screen size as follows: .bP -checks if the \fILINES\fP and \fI\%COLUMNS\fP environment variables +checks whether the \fILINES\fP and \fI\%COLUMNS\fP environment variables are set to a number greater than zero. .bP -for each, \fI\%ncurses\fP updates the corresponding environment variable +for each, +\fI\%ncurses\fP updates the corresponding environment variable with the value that it has obtained via operating system call or from the terminal database. .bP \fI\%ncurses\fP re-fetches the value of the environment variables so -that it is still the environment variables which set the screen size. +that it is still the environment variables that set the screen size. .PP The \fB\%use_env\fP and \fB\%use_tioctl\fP routines combine as follows. .IP .TS -lB lB lB -lB lB lx. +Lb Lb Lb +Lb Lb Lw(29n)x. use_env use_tioctl Summary _ TRUE FALSE T{ -This is the default behavior. \fI\%ncurses\fP uses operating system calls unless overridden by \fILINES\fP or \fI\%COLUMNS\fP environment variables; @@ -234,7 +278,9 @@ .TE .SS "putwin, getwin" The \fBputwin\fP routine writes all data associated -with window (or pad) \fIwin\fP into +with window +(or pad) +\fIwin\fP into the file to which \fIfilep\fP points. This information can be later retrieved using the \fBgetwin\fP function. @@ -248,16 +294,18 @@ .bP the data written is a copy of the \fI\%WINDOW\fP structure, and its associated character cells. -The format differs between the wide-character (\fI\%ncursesw\fP) and -non-wide (\fI\%ncurses\fP) libraries. -You can transfer data between the two, however. +The format differs between the wide-character \%(\fIncursesw\fP) and +non-wide \%(\fIncurses\fP) libraries. +You can transfer data between the two, +however. .bP -the retrieved window is always created as a top-level window (or pad), +the retrieved window is always created as a top-level window +(or pad), rather than a subwindow. .bP the window's character cells contain the color pair \fIvalue\fP, but not the actual color \fInumbers\fP. -If cells in the retrieved window use color pairs which have not been +If cells in the retrieved window use color pairs that have not been created in the application using \fBinit_pair\fP, they will not be colored when the window is refreshed. .SS delay_output @@ -269,7 +317,8 @@ instead of sleeping and requesting resumption from the operating system. Padding is used unless: .bP -the terminal description has \fBnpc\fP (\fBno_pad_char\fP) capability, or +the terminal description has \fBnpc\fP (\fBno_pad_char\fP) capability, +or .bP the environment variable \fB\%NCURSES_NO_PADDING\fP is set. .PP @@ -279,57 +328,85 @@ (thirty seconds), it is capped at that value. .SS flushinp -The \fBflushinp\fP routine throws away any typeahead that has been typed by the -user and has not yet been read by the program. +The \fBflushinp\fP routine throws away any typeahead +that has been typed by the user +and has not yet been read by the program. .SH RETURN VALUE -Except for \fBflushinp\fP, routines that return an integer return \fBERR\fP -upon failure and \fBOK\fP (SVr4 specifies only "an integer value other than -\fBERR\fP") upon successful completion. +Except for +.BR \%flushinp "," +functions that return integers return +.B ERR +upon failure and +.B OK +upon success. .PP -Routines that return pointers return \fBNULL\fP on error. +Functions that return pointers return a null pointer on failure. .PP -X/Open Curses does not specify any error conditions. -In this implementation -.RS 3 -.TP 5 -\fBflushinp\fP -returns an error if the terminal was not initialized. -.TP 5 -\fBputwin\fP -returns an error if the associated \fBfwrite\fP calls return an error. -.RE +In +.IR \%ncurses "," +.bP +.B \%flushinp +returns +.B ERR +if the terminal was not initialized, +and +.bP +.B \%putwin +returns +.B ERR +if its associated \fIwrite\fP(2) calls return +.BR ERR "." +.SH NOTES +.B \%wunctrl +is part of +.IR \%ncurses "'s" +wide-character API, +and is not available in its non-wide-character configuration. .SH PORTABILITY +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.PP +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 542 .SS filter -The SVr4 documentation describes the action of \fBfilter\fP only in the vaguest -terms. -The description here is adapted from X/Open Curses (which -erroneously fails to describe the disabling of \fBcuu\fP). +The SVr4 documentation describes the action of \fBfilter\fP +only in the vaguest terms. +The description here is adapted from X/Open Curses +(which erroneously fails to describe the disabling of \fBcuu\fP). .SS "delay_output padding" The limitation to 30 seconds and the use of \fBnapms\fP differ from other implementations. .bP -SVr4 curses does not delay if no padding character is available. +SVr4 +.I curses +does not delay if no padding character is available. .bP -NetBSD curses uses \fBnapms\fP when no padding character is available, +NetBSD +.I curses +uses \fBnapms\fP when no padding character is available, but does not take timing into account when using the padding character. .PP Neither limits the delay. .SS keyname The \fBkeyname\fP function may return the names of user-defined -string capabilities which are defined in the terminfo entry via the \fB\-x\fP +string capabilities that are defined in the terminfo entry +via the \fB\-x\fP option of \fB@TIC@\fP. -This implementation automatically assigns at run-time keycodes to -user-defined strings which begin with \*(``k\*(''. -The keycodes start at KEY_MAX, but are not guaranteed to be -the same value for different runs because user-defined codes are -merged from all terminal descriptions which have been loaded. +This implementation automatically assigns at run-time key codes to +user-defined strings that begin with \*(``k\*(''. +The key codes start at KEY_MAX, +but are not guaranteed to be the same value for different runs +because user-defined codes are merged +from all terminal descriptions that have been loaded. The \fBuse_extended_names\fP(3X) function controls whether this data is loaded when the terminal description is read by the library. .SS "nofilter, use_tioctl" The \fBnofilter\fP and \fBuse_tioctl\fP routines are specific to \fI\%ncurses\fP. -They were not supported on Version 7, BSD or System V implementations. +They were not supported on Version 7, +BSD or System V implementations. It is recommended that any code depending on \fI\%ncurses\fP extensions be conditioned using \fBNCURSES_VERSION\fP. .SS "putwin/getwin file-format" @@ -341,81 +418,134 @@ Although the format is an obvious target for standardization, it has been overlooked. .IP -Interestingly enough, according to the copyright dates in Solaris source, -the functions (along with \fBscr_init\fP, etc.) originated with -the University of California, Berkeley (in 1982) -and were later (in 1988) incorporated into SVr4. -Oddly, there are no such functions in the 4.3BSD curses sources. -.bP -Most implementations simply dump the binary \fI\%WINDOW\fP structure +Interestingly enough, +according to the copyright dates in Solaris source, +the functions +(along with \fBscr_init\fP, +etc.\&) +originated with the University of California, +Berkeley +(in 1982) +and were later +(in 1988) +incorporated into SVr4. +Oddly, +there are no such functions in the 4.3BSD +.I curses +sources. +.bP +Most implementations simply dump the binary +.I \%WINDOW +structure to the file. -These include SVr4 curses, NetBSD and PDCurses, +These include SVr4 +.IR curses , +NetBSD +.IR curses , +and +.IR \%PDCurses , as well as older \fI\%ncurses\fP versions. This implementation -(as well as the X/Open variant of Solaris curses, dated 1995) +(as well as +.IR \%xcurses "," +the X/Open variant of Solaris +.IR curses "," +dated 1995) uses textual dumps. .IP -The implementations which use binary dumps use block-I/O -(the \fBfwrite\fP and \fBfread\fP functions). -Those that use textual dumps use buffered-I/O. +The implementations that use binary dumps use block I/O +(\fIwrite\fP(2) and \fIread\fP(2) functions). +Those that use textual dumps use buffered I/O. A few applications may happen to write extra data in the file using these functions. -Doing that can run into problems mixing block- and buffered-I/O. -This implementation reduces the problem on writes by flushing the output. -However, reading from a file written using mixed schemes may not be successful. +Doing that can run into problems mixing block and buffered I/O. +This implementation reduces the problem on writes by flushing the +output. +However, +reading from a file written using mixed schemes may not be successful. .SS "unctrl, wunctrl" -X/Open Curses, Issue 4 describes these functions. -It states that \fBunctrl\fP and \fBwunctrl\fP will return a null pointer if -unsuccessful, but does not define any error conditions. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +It states that \fBunctrl\fP and \fBwunctrl\fP will return a null pointer +if unsuccessful. This implementation checks for three cases: .bP the parameter is a 7-bit US\-ASCII code. This is the case that X/Open Curses documented. .bP -the parameter is in the range 128\-159, i.e., a C1 control code. -If \fBuse_legacy_coding\fP(3X) has been called with a \fB2\fP parameter, -\fBunctrl\fP returns the parameter, i.e., a one-character string with +the parameter is in the range 128\-159, +i.e., +a C1 control code. +If \fB\%use_legacy_coding\fP(3X) has been called with a \fB2\fP parameter, +\fBunctrl\fP returns the parameter, +i.e., +a one-character string with the parameter as the first character. -Otherwise, it returns \*(``~@\*('', \*(``~A\*('', etc., -analogous to \*(``^@\*('', \*(``^A\*('', C0 controls. +Otherwise, +it returns \*(``\*~@\*('', +\*(``\*~A\*('', +etc., +analogous to \*(``\*^@\*('', +\*(``\*^A\*('', +C0 controls. .IP -X/Open Curses does not document whether \fBunctrl\fP can be called before -initializing curses. +X/Open Curses does not document whether \fBunctrl\fP can be called +before initializing +.IR curses "." This implementation permits that, -and returns the \*(``~@\*('', etc., values in that case. +and returns the \*(``\*~@\*('', +etc., +values in that case. .bP parameter values outside the 0 to 255 range. \fBunctrl\fP returns a null pointer. .PP -The strings returned by \fBunctrl\fP in this implementation are determined -at compile time, +The strings returned by \fBunctrl\fP in this implementation +are determined at compile time, showing C1 controls from the upper-128 codes -with a \*(``~\*('' prefix rather than \*(``^\*(''. +with a \*(``\*~\*('' prefix rather than \*(``\*^\*(''. Other implementations have different conventions. -For example, they may show both sets of control characters with \*(``^\*('', +For example, +they may show both sets of control characters with \*(``\*^\*('', and strip the parameter to 7 bits. Or they may ignore C1 controls and treat all of the upper-128 codes as printable. -This implementation uses 8 bits but does not modify the string to reflect -locale. -The \fBuse_legacy_coding\fP(3X) function allows the caller to +This implementation uses 8 bits +but does not modify the string to reflect locale. +The \fB\%use_legacy_coding\fP(3X) function allows the caller to change the output of \fBunctrl\fP. .PP -Likewise, the \fBmeta\fP(3X) function allows the caller to change the -output of \fBkeyname\fP, i.e., +Likewise, +the \fBmeta\fP(3X) function allows the caller to change the output +of \fBkeyname\fP, +i.e., it determines whether to use the \*(``M\-\*('' prefix for \*(``meta\*('' keys (codes in the range 128 to 255). -Both \fBuse_legacy_coding\fP(3X) and \fBmeta\fP(3X) succeed only after -curses is initialized. +Both \fB\%use_legacy_coding\fP(3X) and \fBmeta\fP(3X) succeed only after +.I curses +is initialized. X/Open Curses does not document the treatment of codes 128 to 159. When treating them as \*(``meta\*('' keys -(or if \fBkeyname\fP is called before initializing curses), -this implementation returns strings \*(``M\-^@\*('', \*(``M\-^A\*('', etc. +(or if \fBkeyname\fP is called before initializing +.IR curses ")," +this implementation returns strings \*(``M\-\*^@\*('', +\*(``M\-\*^A\*('', +etc. .PP -X/Open Curses documents \fBunctrl\fP as declared in \fB\fP, -which \fI\%ncurses\fP does. -However, \fI\%ncurses\fP' \fB\fP includes \fB\fP, -matching the behavior of SVr4 curses. +X/Open Curses documents +.I \%unctrl +as declared in +.IR \%unctrl.h "," +which +.I \%ncurses +does. +However, +.IR \%ncurses 's +.I \%curses.h +includes +.IR \%unctrl.h "," +matching the behavior of SVr4 +.IR curses "." Other implementations may not do that. .SS "use_env, use_tioctl" If \fI\%ncurses\fP is configured to provide the sp-functions extension, @@ -423,8 +553,49 @@ creating each \fIscreen\fP rather than once only (\fBcurs_sp_funcs\fP(3X)). This feature of \fBuse_env\fP -is not provided by other implementations of curses. +is not provided by other implementations of +.IR curses "." +.SH HISTORY +4BSD (1980) +introduced +.IR \%unctrl "," +defining it as a macro +in +.IR \%unctrl.h "." +.PP +SVr2 (1984) +added +.IR \%delay_output "," +.IR \%flushinp "," +and +.IR \%keyname "." +.PP +SVr3 (1987) supplied +.IR \%filter "." +Later that year, +SVr3.1 brought +.I \%getwin +and +.IR \%putwin "," +reading and writing window dumps +with \fI\%fread\fP(3) and \fI\%fwrite\fP(3), +respectively. +.PP +SVr4 (1989) furnished +.IR \%use_env "." +.PP +X/Open Curses Issue\ 4 (1995) specified +.I \%key_name +and +.IR \%wunctrl "." +.PP +.I \%ncurses +5.6 (2006) added +.IR \%nofilter "," \" 20060107 +and 6.0 (2015) +.IR \%use_tioctl "." \" 20120714 .SH SEE ALSO +.na \fB\%curses\fP(3X), \fB\%curs_initscr\fP(3X), \fB\%curs_inopts\fP(3X), @@ -433,3 +604,4 @@ \fB\%curs_sp_funcs\fP(3X), \fB\%curs_variables\fP(3X), \fB\%legacy_coding\fP(3X) +.ad diff --git a/contrib/ncurses/man/curs_variables.3x b/contrib/ncurses/man/curs_variables.3x --- a/contrib/ncurses/man/curs_variables.3x +++ b/contrib/ncurses/man/curs_variables.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2010-2015,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_variables.3x,v 1.47 2024/04/13 22:37:35 tom Exp $ -.TH curs_variables 3X 2024-04-13 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_variables.3x,v 1.73 2025/08/23 23:02:32 tom Exp $ +.TH curs_variables 3X 2025-08-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -48,6 +48,51 @@ .el .IP \(bu 2 .. . +.\" URL hyperlink support macros from groff's "an-ext.tmac" +. +.\" Save the automatic hyphenation mode. +.\" +.\" In AT&T troff, there was no register exposing the hyphenation mode, +.\" and no way to save and restore it. Set `mH` to a reasonable value +.\" for your implementation and preference. +.de mY +. ie !\\n(.g \ +. nr mH 14 +. el \ +. do nr mH \\n[.hy] \" groff extension register +.. +. +.\" Prepare link text for mail/web hyperlinks. `MT` and `UR` call this. +.de mV +. ds mU \\$1\" +.. +. +.\" Emit hyperlink. The optional argument supplies trailing punctuation +.\" after link text. `ME` and `UE` call this. +.de mQ +. mY +. nh +<\\*(mU>\\$1 +. hy \\n(mH +. rm mU +.. +. +.\" Start URL. +.\" .UR url +.if !\n(.g \{\ +.de UR +. mV \\$1 +.. +.\} +. +.\" End URL. +.\" .UE [punctuation] +.if !\n(.g \{\ +.de UE +. mQ \\$1 +.. +.\} +. .SH NAME \fI\%bool\fP, \fI\%chtype\fP, @@ -59,6 +104,7 @@ \fB\%FALSE\fP, \fB\%ERR\fP, \fB\%OK\fP, +\fB\%CCHARW_MAX\fP, \fB\%curscr\fP, \fB\%newscr\fP, \fB\%stdscr\fP, @@ -88,6 +134,9 @@ \fBconst \fI/*\fP .\|.\|. \fI*/\fP ERR; \fBconst \fI/*\fP .\|.\|. \fI*/\fP OK; .PP +\fI/* extension */ +\fBconst \fI/*\fP .\|.\|. \fI*/\fP CCHARW_MAX; +.PP \fI/* variables */ \fBint COLORS; \fBint COLOR_PAIRS; @@ -114,24 +163,49 @@ In either case, applications should treat them as read-only to avoid confusing the library. -.SH "CONSTANTS" +.SH CONSTANTS .SS "TRUE, FALSE" -The \fIcurses\fP library defines \fBTRUE\fP and \fBFALSE\fP +The +.I curses +library defines +.B TRUE +and +.B FALSE to represent the values of the Boolean data type. .SS "ERR, OK" -\fIcurses\fP and \fIterminfo\fP routines frequently return these -constant integral values indicating failure and success, +.I curses +and +.I \%term\%info +functions frequently return these constant integral values +indicating failure and success, respectively. -.SH "PREDEFINED TYPES" +.SS CCHARW_MAX +This integral value, +an +.I \%ncurses +extension, +indicates the maximum number of +.I \%wchar_t +wide characters that can be stored in a +.I curses +complex character +.IR \%cchar_t "." +.SH "DATA TYPES" .SS "\fIbool\fP" -X/Open Issue 4 \fIcurses\fP (1996) preceded the ISO C99 and ISO C++98 +.I curses +defines an integral type +.IR bool "." +X/Open Issue\ 4 +.I curses +(1996) preceded the ISO\ C99 and ISO\ C++98 standards, -each of which also defined a Boolean data type. -The \fIcurses\fP library requires an integral type \fIbool\fP. +each of which also defined a Boolean data type of the same name. .PP -\fB\%ncurses\fP' configure script attempts to discover the +.IR \%ncurses 's +configure script attempts to discover the data type used by the system's C and C++ compilers, -to reuse for the \fIcurses\fP \fIbool\fP. +to reuse them as its own +.IR bool "." .SS "\fIchtype\fP" The \fI\%chtype\fP integral type combines a (\*(``narrow\*('', @@ -173,7 +247,26 @@ structure type; see subsection \*(``Overview\*('' of \fB\%ncurses\fP(3X). .SH "VARIABLES" -.SS "curscr, stdscr, newscr" +.SS "curscr, newscr, stdscr" +When a +.I curses +application calls +\fB\%initscr\fP(3X) or \fB\%newterm\fP(3X), +the library creates a window named +.B \%stdscr +that is the same size as the terminal screen, +(minus any lines reserved by +\fB\%ripoffline\fP(3X) or \fB\%slk_init\fP(3X)) +and is the implicit window used by functions +that interact with a window +but do not take a parameter identifying one; +many +.I curses +functions use it. +An application need not use +.BR \%stdscr ";" +it might prefer to tile the display into multiple windows instead. +.PP The library records updates to the terminal screen in a window named \fB\%curscr\fP. This object is referred to as the \*(``physical screen\*('' in @@ -190,40 +283,41 @@ When the screen is refreshed, \fIcurses\fP determines a minimal set of updates using the terminal's capabilities to make \fB\%curscr\fP look like \fB\%newscr\fP. -.PP -Once \fIcurses\fP is initialized, -it creates a window named \fB\%stdscr\fP. -It is the same size as the terminal screen and is the default window -used by routines that do not take a parameter identifying one. -Many \fIcurses\fP functions use this window. .SS COLORS -Once \fIcurses\fP is initialized, -\fB\%COLORS\fP +Once a +.I curses +screen is initialized, +.B \%COLORS contains the number of colors supported by the terminal; see \fB\%curs_color\fP(3X). .SS COLOR_PAIRS -Once \fIcurses\fP is initialized, -\fB\%COLOR_PAIRS\fP +Once a +.I curses +screen is initialized, +.B \%COLOR_PAIRS contains the number of color pairs supported by the terminal; see \fB\%curs_color\fP(3X). .SS "COLS, LINES" -Once \fIcurses\fP is initialized, +Once a +.I curses +screen is initialized, .B \%COLS and .B LINES -contain the screen's width and height in character cells, +contain its width and height in character cells, respectively; that is, the number of columns and lines. .SS ESCDELAY -For +When reading key strokes from a window in keypad mode, .I curses -to distinguish the ESC character resulting from a user's press of the -\*(``Escape\*('' key on the input device from one beginning an -.I "escape sequence" -(as commonly produced by function keys), -it waits after the escape character to see if further characters are -available on the input stream within a short interval. +distinguishes the ESC character resulting from a user's press of the +\*(``Escape\*('' key on the input device +from one beginning an escape sequence +(commonly produced by function keys), +by waiting after receiving the escape character +to see if further characters are available +on the input stream within a short interval. .B \%ESCDELAY stores this interval in milliseconds. .PP @@ -236,8 +330,9 @@ spaces as it adds a tab to a window; see \fB\%curs_addch\fP(3X). .SH NOTES -Either \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X) initializes -\fIcurses\fP. +Initialize a +.I curses +screen with either \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X). .PP If .I \%ncurses @@ -246,12 +341,39 @@ and .I \%tinfo libraries, -most of these variables reside in the former. +most of these symbols reside in the former. +Both use the +.B bool +data type. +.SH EXTENSIONS +The +.B \%CCHARW_MAX +constant, +and +.BR \%ESCDELAY "," +.BR \%TABSIZE "," +and +.B \%newscr +variables, +are +extensions, +the first of these originating in +.\" Solaris xcurses calls it M_CCHAR_MAX. +.IR \%ncurses "." .SH PORTABILITY +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. +.PP The X/Open Curses standard documents all of the foregoing types and -symbols except for \fB\%newscr\fP, -\fB\%TABSIZE\fP, -and \fB\%ESCDELAY\fP. +symbols except for +.BR \%CCHARW_MAX "," +.BR \%newscr "," +.BR \%TABSIZE "," +and +.BR \%ESCDELAY "." .PP X/Open Curses describes \fB\%curscr\fP only as \*(``an internal data structure\*(''; @@ -270,52 +392,98 @@ When the update of \fB\%newscr\fP is complete, \fIcurses\fP modifies \fB\%curscr\fP to match \fB\%newscr\fP. .PP -\fB\%TABSIZE\fP is a feature of SVr4 \fIcurses\fP. +.B \%TABSIZE +is a feature of SVr4 +.IR curses "." .bP -SVr4 initially sets \fB\%TABSIZE\fP from the terminal description's -\fB\%init_tabs\fP capability. +SVr4 initially sets +.B \%TABSIZE +from the terminal description's +.B \%init_tabs +.RB ( it ) +capability. After that, -it can be altered by applications using SVr4 \fIcurses\fP. +it can be altered by applications using SVr4 +.IR curses "." .bP -SVr4 \fIcurses\fP uses the value of \fB\%TABSIZE\fP to compute the -position of tab stops when updating both +SVr4 +.I curses +uses +.BR \%TABSIZE 's +value to compute the position of tab stops when updating both the virtual screen with \fB\%addch\fP(3X) and the physical screen with \fB\%mvcur\fP(3X). .bP -\fI\%ncurses\fP uses the value of \fB\%TABSIZE\fP only to update the -virtual screen. -It uses the terminal description's \*(``\fBit\fP\*('' -(\fB\%init_tabs\fP) capability for computing hardware tabs +In +.IR \%ncurses "," +.BR \%TABSIZE 's +value affects only the virtual screen. +The library uses the terminal type description's +.B \%init_tabs +.RB ( it ) +capability to compute hardware tabs (that is, tab stops on the physical screen). .bP Other implementations differ. For instance, -NetBSD \fIcurses\fP allows \fB\%TABSIZE\fP to be set through an -environment variable. -\fI\%ncurses\fP does not. +NetBSD +.I curses +allows +.B \%TABSIZE +to be set through an environment variable. +.I \%ncurses +does not. .IP -NetBSD \fIcurses\fP does not support hardware tabs; -it uses the \fB\%init_tabs\fP capability and the \fB\%TABSIZE\fP -variable only for updating the virtual screen. +NetBSD +.I curses +does not support hardware tabs; +it uses the +.B \%init_tabs +.RB ( it ) +capability and the +.B \%TABSIZE +variable only to update the virtual screen. .PP -\fB\%ESCDELAY\fP is a feature of AIX \fIcurses\fP. +.B \%ESCDELAY +is a feature of AIX +.IR curses "." .bP -In AIX, -the units for \fB\%ESCDELAY\fP are \fIfifths\fP of milliseconds. +AIX treats +.BR \%ESCDELAY 's +value as counting +.I fifths +of milliseconds. .bP -The default value for AIX's \fB\%ESCDELAY\fP equals 0.1 seconds. +AIX's default +.B \%ESCDELAY +equals 0.1 seconds. .bP -AIX also enforces a limit of 10,000 seconds for \fB\%ESCDELAY\fP; -\fI\%ncurses\fP does not enforce any upper limit. +AIX also enforces a limit of 10,000 seconds for +.BR \%ESCDELAY ";" +.I \%ncurses +does not enforce an upper limit. .PP -\fI\%ncurses\fP has long used \fB\%ESCDELAY\fP with units of -milliseconds, +.I \%ncurses +has long interpreted +.B \%ESCDELAY +as a count of milliseconds, making it impossible to be completely compatible with AIX. Consequently, most users have decided either to override the value, or to rely upon its default. .SH SEE ALSO +.UR https://\*:unicode\*:.org/\*:reports/\*:tr29/ +[UAX #29] \*(``Unicode Standard Annex #29: Unicode Text +Segmentation\*('' +.UE +.PP +\fB\%getcchar\fP(3X) +further discusses the +.I \%ncurses +extension +.BR \%CCHARW_MAX "." +.PP \fB\%curses\fP(3X), \fB\%curs_color\fP(3X), \fB\%curs_opaque\fP(3X), @@ -323,7 +491,3 @@ \fB\%curs_threads\fP(3X), \fB\%term_variables\fP(3X), \fB\%terminfo\fP(5) -.PP -[UAX #29] \*(``Unicode Standard Annex #29: Unicode Text -Segmentation\*(''; -\% diff --git a/contrib/ncurses/man/curs_window.3x b/contrib/ncurses/man/curs_window.3x --- a/contrib/ncurses/man/curs_window.3x +++ b/contrib/ncurses/man/curs_window.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2020-2023,2024 Thomas E. Dickey * +.\" Copyright 2020-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2015,2016 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,19 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_window.3x,v 1.48 2024/04/20 21:20:07 tom Exp $ -.TH curs_window 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_window.3x,v 1.71 2025/08/23 22:50:00 tom Exp $ +.TH curs_window 3X 2025-08-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.ie \n(.g \{\ +.ds `` \(lq +.ds '' \(rq +.\} +.el \{\ +.ie t .ds `` `` +.el .ds `` "" +.ie t .ds '' '' +.el .ds '' "" +.\} +. .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 @@ -50,23 +61,23 @@ .nf \fB#include .PP -\fBWINDOW *newwin( - \fBint \fInlines\fB, int \fIncols\fB,\fR - \fBint \fIbegin_y\fB, int \fIbegin_x\fB);\fR -\fBint delwin(WINDOW *\fIwin\fB);\fR -\fBint mvwin(WINDOW *\fIwin\fB, int \fIy\fB, int \fIx\fB);\fR -\fBWINDOW *subwin(WINDOW *\fIorig\fB,\fR - \fBint \fInlines\fB, int \fIncols\fB,\fR - \fBint \fIbegin_y\fB, int \fIbegin_x\fB);\fR -\fBWINDOW *derwin(WINDOW *\fIorig\fB,\fR - \fBint \fInlines\fB, int \fIncols\fB,\fR - \fBint \fIbegin_y\fB, int \fIbegin_x\fB);\fR -\fBint mvderwin(WINDOW *\fIwin\fB, int \fIpar_y\fB, int \fIpar_x\fB);\fR -\fBWINDOW *dupwin(WINDOW *\fIwin\fB);\fR -\fBvoid wsyncup(WINDOW *\fIwin\fB);\fR -\fBint syncok(WINDOW *\fIwin\fB, bool \fIbf\fB);\fR -\fBvoid wcursyncup(WINDOW *\fIwin\fB);\fR -\fBvoid wsyncdown(WINDOW *\fIwin\fB);\fR +\fBWINDOW * newwin(\fR + \fBint \fInlines\fP, int \fIncols\fP, + \fBint \fIbegin_y\fP, int \fIbegin_x\fP); +\fBint delwin(WINDOW * \fIwin\fP); +\fBint mvwin(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP); +\fBWINDOW * subwin(WINDOW * \fIorig\fP, + \fBint \fInlines\fP, int \fIncols\fP, + \fBint \fIbegin_y\fP, int \fIbegin_x\fP); +\fBWINDOW * derwin(WINDOW * \fIorig\fP, + \fBint \fInlines\fP, int \fIncols\fP, + \fBint \fIbegin_y\fP, int \fIbegin_x\fP); +\fBint mvderwin(WINDOW * \fIwin\fP, int \fIpar_y\fP, int \fIpar_x\fP); +\fBWINDOW * dupwin(WINDOW * \fIwin\fP); +\fBvoid wsyncup(WINDOW * \fIwin\fP); +\fBint syncok(WINDOW * \fIwin\fP, bool \fIbf\fP); +\fBvoid wcursyncup(WINDOW * \fIwin\fP); +\fBvoid wsyncdown(WINDOW * \fIwin\fP); .fi .SH DESCRIPTION .SS newwin @@ -94,21 +105,23 @@ (e.g., \fBnewwin\fP, \fBsubwin\fP, \fBderwin\fP, \fBnewpad\fP), rather than a duplicate (with \fBdupwin\fP), all of the window modes are initialized to the default values. -These functions set window modes after a window is created: +The following functions set a window's modes after it is created: .RS .PP -\fB\%idcok\fP -\fB\%idlok\fP -\fB\%immedok\fP -\fB\%keypad\fP -\fB\%leaveok\fP -\fB\%nodelay\fP -\fB\%scrollok\fP -\fB\%setscrreg\fP -\fB\%syncok\fP -\fB\%wbkgdset\fP -\fB\%wbkgrndset\fP and -\fB\%wtimeout\fP. +.BR \%idcok "," +.BR \%idlok "," +.BR \%immedok "," +.BR \%keypad "," +.BR \%leaveok "," +.BR \%nodelay "," +.BR \%notimeout "," +.BR \%scrollok "," +.BR \%setscrreg "," +.BR \%syncok "," +.BR \%wbkgdset "," +.BR \%wbkgrndset "," +and +.BR \%wtimeout "." .RE .SS delwin Calling \fBdelwin\fP deletes the named window, freeing all memory @@ -163,105 +176,168 @@ ancestors of the window to reflect the current cursor position of the window. .SH RETURN VALUE -Routines that return an integer return the integer \fBERR\fP upon failure and -\fBOK\fP (SVr4 only specifies "an integer value other than \fBERR\fP") upon -successful completion. +Functions that return integers return +.B ERR +upon failure and +.B OK +upon success. .PP -Routines that return pointers return \fBNULL\fP on error. +Functions that return pointers return a null pointer on failure. .PP -X/Open defines no error conditions. -In this implementation -.TP 5 -\fBdelwin\fP -returns an error if the window pointer is null, or -if the window is the parent of another window. -.TP 5 -\fBderwin\fP -returns an error if the parent window pointer is null, or -if any of its ordinates or dimensions is negative, or -if the resulting window does not fit inside the parent window. -.TP 5 -\fBdupwin\fP -returns an error if the window pointer is null. +.I \%ncurses +defines several error conditions. +.bP +.B \%delwin +returns +.B ERR +if +.I win +is a null pointer, +or if it is the parent of another window. .IP -This implementation also maintains a list of windows, -and checks that the pointer passed to \fBdelwin\fP is one that -it created, returning an error if it was not.. -.TP 5 -\fBmvderwin\fP -returns an error -if the window pointer is null, or -if some part of the window would be placed off-screen. -.TP 5 -\fBmvwin\fP -returns an error -if the window pointer is null, or -if the window is really a pad, or -if some part of the window would be placed off-screen. -.TP 5 -\fBnewwin\fP -will fail if either of its beginning ordinates is negative, or -if either the number of lines or columns is negative. -.TP 5 -\fBsyncok\fP -returns an error -if the window pointer is null. -.TP 5 -\fBsubwin\fP -returns an error if the parent window pointer is null, or -if any of its ordinates or dimensions is negative, or -if the resulting window does not fit inside the parent window. +.I \%ncurses +maintains a list of windows, +and checks that the pointer passed to +.B \%delwin +is one that it created, +returning +.B ERR +if it was not. +.bP +.B \%derwin +returns +.B ERR +if +.I orig +is a null pointer, +or if any of the ordinate or dimension arguments is negative, +or if the resulting window does not fit inside the parent window. +.bP +.B \%dupwin +returns +.B ERR +if +.I win +is a null pointer. +.bP +.B \%mvderwin +returns +.B ERR +if +.I win +is a null pointer, +or if any part of the window would be placed off-screen. +.bP +.B \%mvwin +returns +.B ERR +if +.I win +is a null pointer, +if +.I win +is a pad, +or if any part of the window would be placed off-screen. +.bP +.B \%newwin +returns +.B ERR +if any of its arguments is negative. +.bP +.B \%subwin +returns +.B ERR +if +.I orig +is a null pointer, +or if any of the ordinate or dimension arguments is negative, +or if the resulting window does not fit inside the parent window. +.bP +.B \%syncok +returns +.B ERR +if +.I win +is a null pointer. +.PP +Functions that return a window pointer fail if memory allocation +for their data structures fails. .PP -The functions which return a window pointer -may also fail if there is insufficient memory for its data structures. -Any of these functions will fail if the screen has not been initialized, -i.e., with \fBinitscr\fP or \fBnewterm\fP. +All of these functions fail if the screen has not been initialized; +see \fBinitscr\fP(3X) or \fBnewterm\fP(3X). .SH NOTES -If many small changes are made to the window, the \fBwsyncup\fP option could -degrade performance. +.B \%syncok +may be implemented as a macro. .PP -Note that \fBsyncok\fP may be a macro. +Calling +.B \%syncup +on a window and making many small changes to it +could degrade performance. .SH PORTABILITY -X/Open Curses, Issue 4 describes these functions. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for +.IR \%delwin "," +.IR \%derwin "," +.IR \%dupwin "," +.IR \%newwin "," +.IR \%mvderwin "," +or +.IR \%syncok "." .PP -X/Open Curses states regarding \fBdelwin\fP: -.bP -It must delete subwindows before deleting their parent. -.bP -If \fBdelwin\fP is asked to delete a parent window, -it can only succeed if the curses library keeps a list of the subwindows. -SVr4 curses kept a count of the number of subwindows rather than a list. -It simply returned \fBERR\fP when asked to delete a subwindow. -Solaris X/Open curses does not even make that check, -and will delete a parent window which still has subwindows. -.bP -Since release 4.0 (1996), -\fI\%ncurses\fP maintains a list of windows for each screen, -to ensure that a window has no subwindows before allowing deletion. -.bP -NetBSD copied this feature of \fI\%ncurses\fP in 2003. -.br -PDCurses follows the scheme used in Solaris X/Open curses. -.SH BUGS -The subwindow functions -\fB\%subwin\fP, -\fB\%derwin\fP, -\fB\%mvderwin\fP, -\fB\%wsyncup\fP, -\fB\%wsyncdown\fP, -\fB\%wcursyncup\fP, -and -\fB\%syncok\fP -are flaky, -incompletely implemented, -and not well tested. +For functions returning integers +(except +.IR \%delwin ")," +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 544 +.PP +Regarding +.IR \%delwin "," +X/Open Curses states that +.RS +.PP +[t]he application must delete subwindows before deleting the main +window. +.RE .PP -System\ V's \fIcurses\fP documentation is unclear about what -\fB\%wsyncup\fP and \fB\%wsyncdown\fP actually do. +If +.I \%delwin +is asked to delete a parent window, +it can succeed only if the +.I curses +library keeps a list of its subwindows. +SVr4 +.I curses +kept a count of the number of subwindows rather than a list. +It simply returned +.B ERR +when asked to delete a subwindow. +Solaris X/Open +.I curses +.RI \%( xcurses ) +does not make even that check, +and will delete a parent window that still has subwindows. +.I \%PDCurses +also behaves this way. +.PP +.I \%ncurses +4.0 (1996) and later maintains a list of windows for each screen +to ensure that a window has no subwindows before allowing its deletion. +NetBSD +.I curses +has followed suit since 2003. +.PP +SVr4 +.I curses +documentation is unclear about what +.I \%wsyncup +and +.I \%wsyncdown +actually do. It seems to imply that they are supposed to touch only those lines that are affected by changes to a window's ancestors. -The language here, -and behavior of \fI\%ncurses\fP, +The description and behavior of these functions in +.I \%ncurses is patterned on the X/Open Curses standard; this approach may result in slower updates. .SH SEE ALSO diff --git a/contrib/ncurses/man/define_key.3x b/contrib/ncurses/man/define_key.3x --- a/contrib/ncurses/man/define_key.3x +++ b/contrib/ncurses/man/define_key.3x @@ -29,43 +29,101 @@ .\" .\" Author: Thomas E. Dickey 1997 .\" -.\" $Id: define_key.3x,v 1.42 2024/03/16 15:35:01 tom Exp $ -.TH define_key 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: define_key.3x,v 1.52 2024/12/28 21:26:21 tom Exp $ +.TH define_key 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +. +.de bP +.ie n .IP \(bu 4 +.el .IP \(bu 2 +.. +. .SH NAME \fB\%define_key\fP \- -define a \fIcurses\fR keycode +define a \fIcurses\fP function key code .SH SYNOPSIS .nf \fB#include .PP -\fBint define_key(const char *\fIdefinition\fP, int \fIkeycode\fP); +\fBint define_key(const char * \fIdefinition\fP, int \fIkey-code\fP); .fi .SH DESCRIPTION -This is an extension to the \fIcurses\fP library. -It permits an application to define keycodes with their corresponding control -strings, -so that the \fI\%ncurses\fP library will interpret them just as it would -the predefined codes in the terminfo database. +The +.B \%define_key +.I \%ncurses +extension permits a +.I curses +application to +.I bind +a string +.I definition +to the function key +.I key-code +returned by \fB\%wgetch\fP(3X) +(wide-character API users: +\fB\%wget_wch\fP(3X)) +when \fB\%keypad\fP(3X) is enabled in a window and a function key is +pressed. +.I \%ncurses +interprets such a binding as it does those in the +.I \%term\%info +database entry for the terminal type. .PP -If \fIdefinition\fP is \fBNULL\fP, -any existing one for the keycode is removed. -Similarly, if the given keycode is negative or zero, any existing string -for the given definition is removed. +A +.I definition +of +.I NULL +removes any existing binding from +.IR key-code "." +Similarly, +a non-positive +.I key-code +removes an existing binding for +.IR definition "," +if any. .SH RETURN VALUE -Either \fIkeycode\fP must be greater than zero, -or \fIdefinition\fP must be non-\fBNULL\fP, -otherwise \fBERR\fP is returned. -\fBERR\fP may also be returned if there is insufficient memory to allocate the -data to store the definition. -If no error is detected, \fBOK\fP is returned. +.B \%define_key +returns +.B ERR +if +.bP +.I definition +is +.I NULL +and +.I key-code +is nonpositive, +or +.bP +insufficient memory is available to bind +.I definition +to +.IR key-code "." +.PP +Otherwise, +.B \%define_key +returns +.BR OK "." +.SH EXTENSIONS +.B \%define_key +is an +.I \%ncurses +extension. .SH PORTABILITY -These routines are specific to \fI\%ncurses\fP. -They were not supported on -Version 7, BSD or System V implementations. -It is recommended that -any code depending on them be conditioned using \fB\%NCURSES_VERSION\fP. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. +.PP +NetBSD +.I curses +since 2.0 (2004) supports +.IR \%define_key "." .SH AUTHORS Thomas Dickey .SH SEE ALSO +\fB\%curses\fP(3X), +\fB\%keybound\fP(3X), \fB\%keyok\fP(3X), -\fB\%key_defined\fP(3X) +\fB\%key_defined\fP(3X), +\fB\%terminfo\fP(5) diff --git a/contrib/ncurses/man/form.3x b/contrib/ncurses/man/form.3x --- a/contrib/ncurses/man/form.3x +++ b/contrib/ncurses/man/form.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form.3x,v 1.54 2024/03/16 15:35:01 tom Exp $ -.TH form 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form.3x,v 1.62 2025/11/12 01:27:41 tom Exp $ +.TH form 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -47,7 +47,7 @@ .. .SH NAME \fBform\fP \- -curses extension for programming forms +present user-fillable forms in \fIcurses\fP windows .SH SYNOPSIS .nf \fB#include @@ -79,7 +79,9 @@ You can get or set this default by calling the appropriate \fBset_\fP or retrieval -routine with a \fBNULL\fP field pointer. +routine with a +.I NULL +field pointer. Changing this default with a \fBset_\fP function affects future field creations, but does not change the rendering of fields already created. @@ -92,10 +94,9 @@ are \fI\%ncurses\fP-specific, not present in SVr4. .PP .TS -l l -l l . +L L. \fBcurses\fP Routine Name Manual Page Name -= +_ current_field \fBform_page\fP(3X) data_ahead \fBform_data\fP(3X) data_behind \fBform_data\fP(3X) @@ -173,7 +174,9 @@ unpost_form \fBform_post\fP(3X) .TE .SH RETURN VALUE -Routines that return pointers return \fBNULL\fP on error, +Routines that return pointers return +.I NULL +on error, and set \fBerrno\fP to the corresponding error-code returned by functions returning an integer. Routines that return diff --git a/contrib/ncurses/man/form_driver.3x b/contrib/ncurses/man/form_driver.3x --- a/contrib/ncurses/man/form_driver.3x +++ b/contrib/ncurses/man/form_driver.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_driver.3x,v 1.61 2024/04/20 18:55:09 tom Exp $ -.TH form_driver 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_driver.3x,v 1.64 2025/10/04 20:59:08 tom Exp $ +.TH form_driver 3X 2025-10-04 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 @@ -51,7 +51,8 @@ through \fBform_driver\fP. This routine has three major input cases: .bP The input is a form navigation request. -Navigation request codes are constants defined in \fB\fP, +Navigation request codes are constants defined in +.IR form.h "," which are distinct from the key- and character codes returned by \fBwgetch\fP(3X). .bP diff --git a/contrib/ncurses/man/form_field.3x b/contrib/ncurses/man/form_field.3x --- a/contrib/ncurses/man/form_field.3x +++ b/contrib/ncurses/man/form_field.3x @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_field.3x,v 1.34 2024/03/16 15:35:01 tom Exp $ -.TH form_field 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_field.3x,v 1.36 2024/12/28 21:26:21 tom Exp $ +.TH form_field 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBform_field\fP \- make and break connections between fields and forms @@ -44,7 +44,8 @@ .fi .SH DESCRIPTION The function \fBset_form_fields\fP changes the field pointer array of -the given \fIform\fP. The array must be terminated by a \fBNULL\fP. +the given \fIform\fP. The array must be terminated by a +.IR NULL "." .PP The function \fBform_fields\fP returns the field array of the given form. .PP @@ -53,11 +54,13 @@ The function \fBmove_field\fP moves the given field (which must be disconnected) to a specified location on the screen. .SH RETURN VALUE -The function \fBform_fields\fP returns a pointer (which may be \fBNULL\fP). +The function \fBform_fields\fP returns a pointer (which may be +.IR NULL ")." It does not set \fBerrno\fP. .PP -The function \fBfield_count\fP returns \fBERR\fP if the \fIform\fP parameter -is \fBNULL\fP. +The function \fBfield_count\fP returns \fBERR\fP if the \fIform\fP +parameter is +.IR NULL "." .PP The functions \fBset_form_fields\fP and \fBmove_field\fP return one of the following codes on error: diff --git a/contrib/ncurses/man/form_field_buffer.3x b/contrib/ncurses/man/form_field_buffer.3x --- a/contrib/ncurses/man/form_field_buffer.3x +++ b/contrib/ncurses/man/form_field_buffer.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_field_buffer.3x,v 1.45 2024/03/16 15:35:01 tom Exp $ -.TH form_field_buffer 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_field_buffer.3x,v 1.47 2024/12/28 21:26:21 tom Exp $ +.TH form_field_buffer 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -104,7 +104,9 @@ The function \fBset_max_field\fP sets the maximum size for a dynamic field. An argument of 0 turns off any maximum size threshold for that field. .SH RETURN VALUE -The \fBfield_buffer\fP function returns NULL on error. +The \fBfield_buffer\fP function returns +.I NULL +on error. It sets \fBerrno\fP according to their success: .TP 5 .B E_OK diff --git a/contrib/ncurses/man/form_field_new.3x b/contrib/ncurses/man/form_field_new.3x --- a/contrib/ncurses/man/form_field_new.3x +++ b/contrib/ncurses/man/form_field_new.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_field_new.3x,v 1.41 2024/03/16 15:35:01 tom Exp $ -.TH form_field_new 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_field_new.3x,v 1.43 2024/12/28 21:26:21 tom Exp $ +.TH form_field_new 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBnew_field\fP, \fBdup_field\fP, @@ -66,7 +66,8 @@ The function \fBfree_field\fP de-allocates storage associated with a field. .SH RETURN VALUE The functions \fBnew_field\fP, \fBdup_field\fP, \fBlink_field\fP return -\fBNULL\fP on error. +.I NULL +on error. They set \fBerrno\fP according to their success: .TP 5 .B E_OK diff --git a/contrib/ncurses/man/form_field_opts.3x b/contrib/ncurses/man/form_field_opts.3x --- a/contrib/ncurses/man/form_field_opts.3x +++ b/contrib/ncurses/man/form_field_opts.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2014,2015 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,18 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_field_opts.3x,v 1.44 2024/03/16 15:35:01 tom Exp $ -.TH form_field_opts 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_field_opts.3x,v 1.47 2025/01/19 00:51:10 tom Exp $ +.TH form_field_opts 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.ie \n(.g \{\ +.ds `` \(lq +.ds '' \(rq +.\} +.el \{\ +.ie t .ds `` `` +.el .ds `` "" +.ie t .ds '' '' +.el .ds '' "" +.\} .SH NAME \fBset_field_opts\fP, \fBfield_opts_on\fP, @@ -46,8 +56,8 @@ \fBint field_opts_off(FIELD *\fIfield\fP, Field_Options \fIopts\fP); .fi .SH DESCRIPTION -The function \fBset_field_opts\fP sets all the given field's option bits (field -option bits may be logically-OR'ed together). +The function \fBset_field_opts\fP sets all the given field's option bits +(field option bits may be logically \*(``or\*(''-ed together). .PP The function \fBfield_opts_on\fP turns on the given option bits, and leaves others alone. diff --git a/contrib/ncurses/man/form_field_userptr.3x b/contrib/ncurses/man/form_field_userptr.3x --- a/contrib/ncurses/man/form_field_userptr.3x +++ b/contrib/ncurses/man/form_field_userptr.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_field_userptr.3x,v 1.30 2024/03/16 15:35:01 tom Exp $ -.TH form_field_userptr 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_field_userptr.3x,v 1.32 2024/12/28 21:26:21 tom Exp $ +.TH form_field_userptr 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBset_field_userptr\fP, \fBfield_userptr\fP \- @@ -46,7 +46,8 @@ These functions get and set that field. .SH RETURN VALUE -The function \fBfield_userptr\fP returns a pointer (which may be \fBNULL\fP). +The function \fBfield_userptr\fP returns a pointer (which may be +.IR NULL ")." It does not set \fBerrno\fP. .PP The function \fBset_field_userptr\fP returns \fBE_OK\fP (success). diff --git a/contrib/ncurses/man/form_field_validation.3x b/contrib/ncurses/man/form_field_validation.3x --- a/contrib/ncurses/man/form_field_validation.3x +++ b/contrib/ncurses/man/form_field_validation.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_field_validation.3x,v 1.53 2024/03/16 15:35:01 tom Exp $ -.TH form_field_validation 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_field_validation.3x,v 1.62 2025/08/16 19:11:47 tom Exp $ +.TH form_field_validation 3X 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -55,7 +55,7 @@ \fBFIELDTYPE *field_type(const FIELD *\fIfield\fP); \fBint set_field_type(FIELD *\fIfield\fP, FIELDTYPE *\fItype\fP, ...); .PP -\fI/* predefined field types */\fP +\fI/* field types */\fP \fBFIELDTYPE *TYPE_ALNUM; \fBFIELDTYPE *TYPE_ALPHA; \fBFIELDTYPE *TYPE_ENUM; @@ -66,7 +66,7 @@ .fi .SH DESCRIPTION By default, no validation is done on form fields. -You can associate a form with with a \fIfield type\fP, +You can associate a form with a \fIfield type\fP, making the form library validate input. .SS field_arg Returns a pointer to the field's argument block. @@ -81,12 +81,12 @@ This is the type checked by validation functions. Most field types are configurable, via arguments which the caller provides when calling \fBset_field_type\fP. -.PP -Several field types are predefined by the form library. -.SH PREDEFINED TYPES -It is possible to set up new programmer-defined field types. -Field types are implemented via the \fBFIELDTYPE\fP data -structure, which contains several pointers to functions. +.SH "FIELD TYPES" +The +.I form +library defines several field types. +They are implemented via the \fBFIELDTYPE\fP data structure, +which contains several pointers to functions. .PP See the \fBform_fieldtype\fP(3X) manual page, which describes functions which can be used to construct @@ -174,7 +174,7 @@ or "^ *[0\-9]* *$" which is good for leading and trailing spaces around the digits. .SS TYPE_IPV4 -An Internet Protocol Version 4 address. +An Internet Protocol Version\ 4 address. Required parameter: .bP none @@ -186,8 +186,12 @@ .PP This is an \fI\%ncurses\fP extension; this field type may not be available in other curses implementations. +.PP +It is possible to set up new programmer-defined field types. .SH RETURN VALUE -The functions \fBfield_type\fP and \fBfield_arg\fP return \fBNULL\fP on error. +The functions \fBfield_type\fP and \fBfield_arg\fP return +.I NULL +on error. The function \fBset_field_type\fP returns one of the following: .TP 5 .B E_OK diff --git a/contrib/ncurses/man/form_fieldtype.3x b/contrib/ncurses/man/form_fieldtype.3x --- a/contrib/ncurses/man/form_fieldtype.3x +++ b/contrib/ncurses/man/form_fieldtype.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2006,2010 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,19 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_fieldtype.3x,v 1.46 2024/03/16 15:35:01 tom Exp $ -.TH form_fieldtype 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_fieldtype.3x,v 1.51 2025/01/19 00:51:10 tom Exp $ +.TH form_fieldtype 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.ie \n(.g \{\ +.ds `` \(lq +.ds '' \(rq +.\} +.el \{\ +.ie t .ds `` `` +.el .ds `` "" +.ie t .ds '' '' +.el .ds '' "" +.\} +. .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 @@ -102,7 +113,9 @@ Frees an argument-block structure. .PP You must supply the \fImake_arg\fP function. -The other two are optional: you may supply NULL for them. +The other two are optional: you may supply +.I NULL +for them. In this case, the form library assumes that \fImake_arg\fP does not allocate memory but simply loads the argument into a single scalar value. @@ -119,7 +132,7 @@ .SS link_fieldtype The function \fBlink_fieldtype\fP creates a new field type from the two given types. -They are connected by an logical 'OR'. +They are connected by a logical \*(``or\*(''. .SH RETURN VALUE The pointer-valued routines return NULL on error. They set \fBerrno\fP according to their success: diff --git a/contrib/ncurses/man/form_hook.3x b/contrib/ncurses/man/form_hook.3x --- a/contrib/ncurses/man/form_hook.3x +++ b/contrib/ncurses/man/form_hook.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_hook.3x,v 1.37 2024/03/16 15:35:01 tom Exp $ -.TH form_hook 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_hook.3x,v 1.39 2024/12/28 21:26:21 tom Exp $ +.TH form_hook 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBform_hook\fP \- set hooks for automatic invocation by applications @@ -55,28 +55,35 @@ sets a hook to be called at form-post time and each time the selected field changes (after the change). .SS field_init -returns the current field init hook, if any (\fBNULL\fP if there is no such -hook). +returns the current field init hook, if any +.RI ( NULL +if there is no such hook). .SS set_field_term sets a hook to be called at form-unpost time and each time the selected field changes (before the change). .SS field_term -returns the current field term hook, if any (\fBNULL\fP if there is no such -hook). +returns the current field term hook, if any +.RI ( NULL +if there is no such hook). .SS set_form_init sets a hook to be called at form-post time and just after a page change once it is posted. .SS form_init returns the current form init hook, -if any (\fBNULL\fP if there is no such hook). +if any +.RI ( NULL +if there is no such hook). .SS set_form_term sets a hook to be called at form-unpost time and just before a page change once it is posted. .SS form_term -returns the current form term hook, if any (\fBNULL\fP if there is no such -hook). +returns the current form term hook, if any +.RI ( NULL +if there is no such hook). .SH RETURN VALUE -Routines that return pointers return \fBNULL\fP on error. +Routines that return pointers return +.I NULL +on error. Other routines return one of the following: .TP 5 diff --git a/contrib/ncurses/man/form_new.3x b/contrib/ncurses/man/form_new.3x --- a/contrib/ncurses/man/form_new.3x +++ b/contrib/ncurses/man/form_new.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_new.3x,v 1.32 2024/03/16 15:35:01 tom Exp $ -.TH form_new 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_new.3x,v 1.34 2024/12/28 21:26:21 tom Exp $ +.TH form_new 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBnew_form\fP, \fBfree_form\fP \- @@ -42,12 +42,15 @@ .fi .SH DESCRIPTION The function \fBnew_form\fP creates a new form connected to a specified field -pointer array (which must be \fBNULL\fP-terminated). +pointer array (which must be +.IR NULL -terminated). .PP The function \fBfree_form\fP disconnects \fIform\fP from its field array and frees the storage allocated for the form. .SH RETURN VALUE -The function \fBnew_form\fP returns \fBNULL\fP on error. +The function \fBnew_form\fP returns +.I NULL +on error. It sets \fBerrno\fP according to the function's success: .TP 5 .B E_OK diff --git a/contrib/ncurses/man/form_opts.3x b/contrib/ncurses/man/form_opts.3x --- a/contrib/ncurses/man/form_opts.3x +++ b/contrib/ncurses/man/form_opts.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2015 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,18 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_opts.3x,v 1.34 2024/03/16 15:35:01 tom Exp $ -.TH form_opts 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_opts.3x,v 1.37 2025/01/19 00:51:10 tom Exp $ +.TH form_opts 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.ie \n(.g \{\ +.ds `` \(lq +.ds '' \(rq +.\} +.el \{\ +.ie t .ds `` `` +.el .ds `` "" +.ie t .ds '' '' +.el .ds '' "" +.\} .SH NAME \fBset_form_opts\fP, \fBform_opts_on\fP, @@ -46,8 +56,8 @@ \fBint form_opts_off(FORM *\fIform\fP, Field_Options \fIopts\fP); .fi .SH DESCRIPTION -The function \fBset_form_opts\fP sets all the given form's option bits (form -option bits may be logically-OR'ed together). +The function \fBset_form_opts\fP sets all the given form's option bits +(form option bits may be logically \*(``or\*(''-ed together). .PP The function \fBform_opts_on\fP turns on the given option bits, and leaves others alone. diff --git a/contrib/ncurses/man/form_page.3x b/contrib/ncurses/man/form_page.3x --- a/contrib/ncurses/man/form_page.3x +++ b/contrib/ncurses/man/form_page.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_page.3x,v 1.37 2024/03/16 15:35:01 tom Exp $ -.TH form_page 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_page.3x,v 1.39 2024/12/28 21:26:21 tom Exp $ +.TH form_page 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBform_page\fP \- set and get form page number @@ -52,7 +52,9 @@ .PP The function \fBunfocus_current_field\fP removes the focus from the current field of the form. -In such state, inquiries via \fBcurrent_field\fP shall return a NULL pointer. +In such state, inquiries via \fBcurrent_field\fP shall return a +.I NULL +pointer. .PP The function \fBset_form_page\fP sets the form's page number (goes to page \fIn\fP of the form). diff --git a/contrib/ncurses/man/form_requestname.3x b/contrib/ncurses/man/form_requestname.3x --- a/contrib/ncurses/man/form_requestname.3x +++ b/contrib/ncurses/man/form_requestname.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_requestname.3x,v 1.35 2024/03/16 15:35:01 tom Exp $ -.TH form_requestname 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_requestname.3x,v 1.37 2024/12/28 21:26:21 tom Exp $ +.TH form_requestname 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBform_request_by_name\fP, \fBform_request_name\fP \- @@ -47,7 +47,9 @@ with the given name and returns its request code. Otherwise E_NO_MATCH is returned. .SH RETURN VALUE -\fBform_request_name\fP returns \fBNULL\fP on error and sets \fBerrno\fP +\fBform_request_name\fP returns +.I NULL +on error and sets \fBerrno\fP to \fBE_BAD_ARGUMENT\fP. .PP \fBform_request_by_name\fP returns \fBE_NO_MATCH\fP on error. diff --git a/contrib/ncurses/man/form_userptr.3x b/contrib/ncurses/man/form_userptr.3x --- a/contrib/ncurses/man/form_userptr.3x +++ b/contrib/ncurses/man/form_userptr.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_userptr.3x,v 1.36 2024/03/16 15:35:01 tom Exp $ -.TH form_userptr 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_userptr.3x,v 1.38 2024/12/28 21:26:21 tom Exp $ +.TH form_userptr 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBset_form_userptr\fP, \fBform_userptr\fP \- @@ -45,7 +45,8 @@ application-specific data (that is, the form-driver code leaves it alone). These functions get and set the form user pointer field. .SH RETURN VALUE -The function \fBform_userptr\fP returns a pointer (which may be \fBNULL\fP). +The function \fBform_userptr\fP returns a pointer (which may be +.IR NULL ")." It does not set \fBerrno\fP. .PP The function \fBset_form_userptr\fP returns \fBE_OK\fP (success). diff --git a/contrib/ncurses/man/form_win.3x b/contrib/ncurses/man/form_win.3x --- a/contrib/ncurses/man/form_win.3x +++ b/contrib/ncurses/man/form_win.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_win.3x,v 1.35 2024/03/16 15:35:01 tom Exp $ -.TH form_win 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_win.3x,v 1.37 2024/12/28 21:26:21 tom Exp $ +.TH form_win 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBform_win\fP \- make and break form window and subwindow associations @@ -54,14 +54,20 @@ It is not necessary to set either window; by default, the driver code uses \fBstdscr\fP for both. .PP -In the \fBset_\fP functions, window argument of \fBNULL\fP is treated as though -it were \fBstsdcr\fP. A form argument of \fBNULL\fP is treated as a request +In the \fBset_\fP functions, window argument of +.I NULL +is treated as though +it were \fBstsdcr\fP. A form argument of +.I NULL +is treated as a request to change the system default form window or subwindow. .PP The function \fBscale_form\fP returns the minimum size required for the subwindow of \fIform\fP. .SH RETURN VALUE -Routines that return pointers return \fBNULL\fP on error. +Routines that return pointers return +.I NULL +on error. Routines that return an integer return one of the following error codes: .TP 5 diff --git a/contrib/ncurses/man/infocmp.1m b/contrib/ncurses/man/infocmp.1m --- a/contrib/ncurses/man/infocmp.1m +++ b/contrib/ncurses/man/infocmp.1m @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2017,2018 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: infocmp.1m,v 1.109 2024/03/16 15:35:01 tom Exp $ -.TH @INFOCMP@ 1M 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" +.\" $Id: infocmp.1m,v 1.128 2025/11/12 00:52:57 tom Exp $ +.TH @INFOCMP@ 1M 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -49,12 +49,13 @@ .el .IP \(bu 2 .. . -.ds d @TERMINFO@ .SH NAME \fB@INFOCMP@\fP \- compare or print out \fIterminfo\fP descriptions .SH SYNOPSIS -\fB@INFOCMP@\fP [\fB\-\ +.HP +.B @INFOCMP@ +.RB [ \-\ 1\ c\ C\ @@ -81,70 +82,59 @@ V\ W\ x\ -\fP] - [\fB\-v\fR \fIn\fR] [\fB\-s d\fR| \fBi\fR| \fBl\fR| \fBc\fR] [\fB\-Q\fR \fIn\fR] [\fB\-R \fBsubset\fR] - [\fB\-w\fP\ \fIwidth\fP] [\fB\-A\fP\ \fIdirectory\fP] [\fB\-B\fP\ \fIdirectory\fP] - [\fIterminal-type\fP ...] +] +.RB [ \-A\ \c +.IR directory ] +.RB [ \-B\ \c +.IR directory ] +.RB [ \-Q\ \c +.IR encoding ] +.RB [ \-R\ \c +.IR subset ] +.RB [ \-s\ \c +.IR key ] +.RB [ \-v\ \c +.IR level ] +.RB [ \-w\ \c +.IR width ] +.RI [ \%terminal\%-type +\&.\|.\|.\& ] .SH DESCRIPTION -\fB@INFOCMP@\fP can be used to compare a binary \fBterminfo\fP entry with other -terminfo entries, rewrite a \fBterminfo\fP description to take advantage of the -\fBuse=\fP terminfo field, or print out a \fBterminfo\fP description from the -binary file (\fBterm\fP) in a variety of formats. -In all cases, the Boolean -fields will be printed first, followed by the numeric fields, followed by the -string fields. +.B @INFOCMP@ +reports a human-readable terminal type description +from a compiled entry in the +.I \%term\%info +database in a variety of selectable formats, +compares such entries to each other, +and rewrites an entry to replace +.RB \*(`` use \*('' +expressions with the content of other entries by reference. +A +.I "\%term\%info entry" +comprises +a list of one or more terminal type identifiers, +a human-readable description of the terminal type, +and a list of terminal +.I capabilities +that characterize its programming interface. +In all cases, +the program reports +Boolean-valued capabilities first, +followed by numeric ones, +and then string-valued capabilities. .SS "Default Options" -If no options are specified and zero or one \fIterminal-types\fP are -specified, -the -\fB\-I\fP option will be assumed. -If more than one \fIterminal-type\fP is specified, -the \fB\-d\fP option will be assumed. -.SS "Comparison Options [\-d] [\-c] [\-n]" -\fB@INFOCMP@\fP compares the \fBterminfo\fP description of the first terminal -\fIterminal-type\fP with each of the descriptions given by the entries -for the other terminal's \fIterminal-types\fP. -If a capability is defined for only one of the -terminals, the value returned depends on the type of the capability: -.bP -\fBF\fP for missing Boolean variables -.bP -\fBNULL\fP for missing integer or string variables -.PP -Use the \fB\-q\fP option to show the distinction between -\fIabsent\fP and \fIcancelled\fP capabilities. -.PP -These options produce a list which you can use to compare two -or more terminal descriptions: -.TP 5 -\fB\-d\fP -produces a list of each capability that is \fIdifferent\fP -between two entries. -Each item in the list shows \*(``:\*('' after the capability name, -followed by the capability values, separated by a comma. -.TP -\fB\-c\fP -produces a list of each capability that is \fIcommon\fP between -two or more entries. -Missing capabilities are ignored. -Each item in the list shows \*(``=\*('' after the capability name, -followed by the capability value. -.IP -The \fB\-u\fP option provides a related output, -showing the first terminal description rewritten to use the second -as a building block via the \*(``use=\*('' clause. -.TP -\fB\-n\fP -produces a list of each capability that is in \fInone\fP of the given entries. -Each item in the list shows \*(``!\*('' before the capability name. -.IP -Normally only the conventional capabilities are shown. -Use the \fB\-x\fP option to add the BSD-compatibility -capabilities (names prefixed with \*(``OT\*(''). -.IP -If no \fIterminal-types\fP are given, -\fB@INFOCMP@\fP uses the environment variable \fITERM\fP -for each of the \fIterminal-types\fP. +If no options are specified and zero or one +.I terminal-types +is specified, +.B @INFOCMP@ +assumes the +.B \-I +option. +If more than one is specified, +the program +assumes the +.B \-d +option. .SS "Source Listing Options [\-I] [\-L] [\-C] [\-r]" The \fB\-I\fP, \fB\-L\fP, and \fB\-C\fP options will produce a source listing for each terminal named. @@ -231,6 +221,90 @@ .\" hpgeneric cup %p2\fR\|.\|.\|.\|\fP%p1 %r hpgeneric .TE +.SS "Entry Comparison Options [-d] [-c] [-n]" +Given +.BR \-c , +.BR \-d , +or +.BR \-n , +.B @INFOCMP@ +compares the +.I \%term\%info +description of the first specified +.I terminal-type +with those of each of the subsequent operands. +If fewer +.I terminal-types +than required are specified, +.B @INFOCMP@ +uses the environment variable +.I TERM +in their place. +.PP +If a capability is defined for only one terminal type, +the value reported depends on the capability's type: +.bP +.B F +for missing Boolean variables +.bP +.B NULL +for missing integer or string variables +.PP +The +.B \-c +and +.B \-d +options report string capability values +between \*(``\*'\*('' characters. +Use the +.B \-q +option to distinguish +.I absent +and +.I canceled +capabilities; +see \fB\%terminfo\fP(5). +.PP +The comparison option selects the form of report. +.TP 5 +.B \-d +lists each capability that +.I differs +between two entries. +Each capability name is followed by \*(``:\*('' +and comma-separated capability values, +then a period. +.TP +.B \-c +lists each capability that two entries have in +.IR common "." +.B @INFOCMP@ +ignores capabilities missing from either entry. +Each capability name is followed by \*(``=\*('', +a space, +and the capability value, +then a period. +.IP +If the +.B \-u +option is further specified, +.B @INFOCMP@ +rewrites the description of the first type +employing \*(``use=\*('' syntax +to use the second as a building block. +.TP +.B \-n +lists capabilities that are in +.I none +of the given entries. +Each capability name is preceded by \*(``!\*('' +and followed by a period. +.IP +Normally only conventional capabilities are shown. +Use the +.B \-x +option to add BSD-compatibility capabilities +(names prefixed with \*(``OT\*(''). .SS "Use= Option [\-u]" The \fB\-u\fP option produces a \fBterminfo\fP source description of the first terminal \fIterminal-type\fP which is relative to the sum of the @@ -278,7 +352,7 @@ superfluous. \fB@INFOCMP@\fP will flag any other \fIterminal-type use=\fP fields that were not needed. -.SS "Changing Databases [\-A \fIdirectory\fR] [\-B \fIdirectory\fR]" +.SS "Changing Databases [\-A \fIdirectory\fP] [\-B \fIdirectory\fP]" Like other \fI\%ncurses\fP utilities, \fB@INFOCMP@\fP looks for the terminal descriptions in several places. You can use the \fI\%TERMINFO\fP and \fI\%TERMINFO_DIRS\fP environment @@ -479,7 +553,8 @@ \*(``\-\*('' for absent capabilities, \*(``@\*('' for canceled rather than \*(``NULL\*(''. .bP -However, show differences between absent and cancelled capabilities. +However, +show differences between absent and canceled capabilities. .bP Omit the \*(``Reconstructed from\*('' comment for source listings. .RE @@ -508,7 +583,7 @@ .RS .TP 5 \fB\-C\fP -sets the \*(``BSD\*('' subset as a side-effect. +sets the \*(``BSD\*('' subset as a side effect. .TP 5 \fB\-I\fP sets the subset to all capabilities. @@ -584,44 +659,62 @@ using the \fB\-x\fP option of \fB@TIC@\fP. .SH FILES .TP -.I \*d +.I @TERMINFO@ compiled terminal description database .SH EXTENSIONS The -\fB\-0\fP, -\fB\-1\fP, -\fB\-E\fP, -\fB\-F\fP, -\fB\-G\fP, -\fB\-Q\fP, -\fB\-R\fP, -\fB\-T\fP, -\fB\-V\fP, -\fB\-a\fP, -\fB\-e\fP, -\fB\-f\fP, -\fB\-g\fP, -\fB\-i\fP, -\fB\-l\fP, -\fB\-p\fP, -\fB\-q\fP and -\fB\-t\fP -options are not supported in SVr4 curses. +.BR \-0 "," +.BR \-1 "," +.BR \-a "," +.BR \-e "," +.BR \-E "," +.BR \-f "," +.BR \-F "," +.BR \-g "," +.BR \-G "," +.BR \-i "," +.BR \-l "," +.BR \-p "," +.BR \-q "," +.BR \-Q "," +.BR \-R "," +.BR \-t "," +.BR \-T "," +and +.B \-V +options are +.I \%ncurses +extensions. +.SH PORTABILITY +X/Open Curses Issue\ 7 (2009) specifies +.IR \%infocmp "." +It does not mention options for producing descriptions in +.I \%term\%cap +format. .PP -SVr4 infocmp does not distinguish between absent and cancelled capabilities. -Also, it shows missing integer capabilities as \fB\-1\fP -(the internal value used to represent missing integers). -This implementation shows those as \*(``NULL\*('', -for consistency with missing strings. +SVr4 +.I \%infocmp +does not distinguish between absent and canceled capabilities. +It furthermore reports missing integer capabilities as +.B \-1 +(its internal representation). +.I \%ncurses +shows these as \*(``NULL\*('' +for consistency with missing string capabilities. .PP -The \fB\-r\fP option's notion of \*(``termcap\*('' capabilities -is System V Release 4's. -Actual BSD curses versions will have a more restricted set. -To see only the -4.4BSD set, use \fB\-r\fP \fB\-RBSD\fP. -.SH PORTABILITY -X/Open Curses, Issue 7 (2009) provides a description of \fBinfocmp\fP. -It does not mention the options used for converting to termcap format. +The +.B \-r +option +of +.I \%ncurses +.I \%infocmp +uses SVr4's notion of \*(``termcap\*('' capabilities. +BSD +.I curses +had a more restricted set. +To see only those present in 4.4BSD, +use +.RB \*(`` "\-r \-RBSD" \*(''. .SH HISTORY Although System V Release 2 provided a terminfo library, it had no documented tool for decompiling the terminal descriptions. diff --git a/contrib/ncurses/man/infotocap.1m b/contrib/ncurses/man/infotocap.1m --- a/contrib/ncurses/man/infotocap.1m +++ b/contrib/ncurses/man/infotocap.1m @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1999-2010,2016 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: infotocap.1m,v 1.41 2024/03/16 15:35:01 tom Exp $ -.TH @INFOTOCAP@ 1M 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" +.\" $Id: infotocap.1m,v 1.52 2025/10/04 20:10:32 tom Exp $ +.TH @INFOTOCAP@ 1M 2025-10-04 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -40,7 +40,6 @@ .el .ds '' "" .\} . -.ds d @TERMINFO@ .SH NAME \fB\%@INFOTOCAP@\fP \- convert a \fI\%terminfo\fR description into a \fI\%termcap\fR description @@ -52,39 +51,60 @@ .P .B "@INFOTOCAP@ \-V" .SH DESCRIPTION -\fB\%@INFOTOCAP@\fP translates terminal descriptions. -It looks in each given text \fIfile\fP for \fI\%terminfo\fP entries and, -For each one found, -it writes an analogous \fI\%termcap\fP description to the standard -output stream. -\fI\%terminfo\fP \*(``\fBuse\fP\*('' capabilities translate to -\fI\%termcap\fP \fBtc\fP capabilities. -Because \fI\%termcap\fP is a less expressive format than -\fI\%terminfo\fP, +.B \%@INFOTOCAP@ +translates terminal descriptions. +It looks in each given text +.I file +for +.I \%terminfo +entries and, +for each one found, +writes an analogous +.I \%termcap +description to the standard output stream. +.I \%terminfo +.RB \*(`` use \*('' +capabilities translate to +.I \%termcap +.B tc +capabilities. +Because +.I \%termcap +is a less expressive format than +.IR \%terminfo , some capabilities cannot be translated. .PP This utility is implemented as a link to \fB\%@TIC@\fP(1M), with the latter's .B \-C option implied. -You can use other \fB\%@TIC@\fP options such as +You can use other +.B \%@TIC@ +options such as .BR \-1 , .BR \-f , .BR \-v , .BR \-w , and .BR \-x . -The \fB\-V\fP option reports the version of \fI\%ncurses\fP associated -with this program and exits with a successful status. +The +.B \-V +option reports the version of +.I \%ncurses +associated with this program and exits with a successful status. .SH FILES .TP -.I \*d +.I @TERMINFO@ compiled terminal description database +.SH EXTENSIONS +This command is an +.I \%ncurses +extension. .SH PORTABILITY -None of X/Open Curses, -Issue 7 (2009), -SVr4, -or NetBSD document this application. +X/Open Curses Issue\ 7 (2009) does not specify this command. +SVr4 and NetBSD +.I curses +do not implement it. .SH AUTHORS Eric S. Raymond and diff --git a/contrib/ncurses/man/key_defined.3x b/contrib/ncurses/man/key_defined.3x --- a/contrib/ncurses/man/key_defined.3x +++ b/contrib/ncurses/man/key_defined.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2003-2006,2010 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -29,33 +29,57 @@ .\" .\" Author: Thomas E. Dickey 2003 .\" -.\" $Id: key_defined.3x,v 1.34 2024/03/16 15:35:01 tom Exp $ -.TH key_defined 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: key_defined.3x,v 1.44 2025/10/04 20:11:22 tom Exp $ +.TH key_defined 3X 2025-10-04 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fB\%key_defined\fP \- -test whether a \fIcurses\fR keycode is defined +obtain key code for an \fIncurses\fP function key definition .SH SYNOPSIS .nf \fB#include .PP -\fBint key_defined(const char *\fIdefinition\fP); +\fBint key_defined(const char * \fIdefinition\fP); .fi .SH DESCRIPTION -This is an extension to the \fIcurses\fP library. -It permits an application to determine if a string is currently bound -to any keycode. +The +.B \%key_defined +.I \%ncurses +extension permits a +.I curses +application to determine the function key code, +if any, +to which the string +.I definition +is bound. .SH RETURN VALUE -If the string is bound to a keycode, its value (greater than zero) is returned. -If no keycode is bound, zero is returned. -If the string conflicts with longer strings -which are bound to keys, \-1 is returned. +.B \%key_defined +returns the first key code to which +.I definition +is bound if any exists. +If none does, +it returns +.BR 0 "." +If +.I definition +is a prefix of another bound definition, +.B \%key_defined +returns +.BR \-1 "." +.SH EXTENSIONS +.B \%key_defined +is an +.I \%ncurses +extension. .SH PORTABILITY -This routine is specific to \fI\%ncurses\fP. -It was not supported on -Version 7, BSD or System V implementations. -It is recommended that -any code depending on them be conditioned using \fB\%NCURSES_VERSION\fP. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. .SH AUTHORS Thomas Dickey .SH SEE ALSO -\fB\%define_key\fP(3X) +\fB\%curses\fP(3X), +\fB\%define_key\fP(3X), +\fB\%keybound\fP(3X), +\fB\%keyok\fP(3X) diff --git a/contrib/ncurses/man/keybound.3x b/contrib/ncurses/man/keybound.3x --- a/contrib/ncurses/man/keybound.3x +++ b/contrib/ncurses/man/keybound.3x @@ -29,37 +29,76 @@ .\" .\" Author: Thomas E. Dickey 1999 .\" -.\" $Id: keybound.3x,v 1.36 2024/03/16 15:35:01 tom Exp $ -.TH keybound 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: keybound.3x,v 1.42 2024/12/28 21:26:21 tom Exp $ +.TH keybound 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fB\%keybound\fP \- -get definition of \fIcurses\fR keycode +get definition of a \fIcurses\fP function key code .SH SYNOPSIS .nf \fB#include .PP -\fBchar * keybound(int \fIkeycode\fP, int \fIcount\fP); +\fBchar * keybound(int \fIkey-code\fP, int \fIcount\fP); .fi .SH DESCRIPTION -This is an extension to the \fIcurses\fP library. -It permits an application to determine the string which is defined -in the terminfo for specific keycodes. +The +.B \%keybound +.I \%ncurses +extension permits a +.I curses +application to obtain the value of the string +.I bound +to the function key +.IR key-code ";" +see \fB\%wgetch\fP(3X) +(wide-character API users: \fB\%wget_wch\fP(3X)). +By default, +such bindings are string capabilities from the +.I \%term\%info +database entry corresponding to the terminal type. +The application can non-destructively and repeatedly +override such definitions with +\fB\%define_key\fP(3X), +as if by pushing new definitions onto a stack. +The +.I count +parameter accesses the +.IR n th +most recently defined binding; +.B 0 +selects the binding that is used on input. .SH RETURN VALUE -The \fIkeycode\fP parameter must be greater than zero, -else \fBNULL\fP is returned. -If it does not correspond to a defined key, then \fBNULL\fP is returned. -The \fIcount\fP parameter is used to allow the application to iterate -through multiple definitions, counting from zero. -When successful, -the function returns a string which must be freed by the caller. +If +.I key-code +corresponds to a function key defined +by the application +or the terminal type in use, +.B \%keybound +allocates and returns a string +that must be freed by the application. +.B \%keybound +returns +.I NULL +if +.I key-code +is not positive +or if it does not correspond to a key code definition. +.SH EXTENSIONS +.B \%keybound +is an +.I \%ncurses +extension. .SH PORTABILITY -This routine is specific to \fI\%ncurses\fP. -It was not supported on -Version 7, BSD or System V implementations. -It is recommended that -any code depending on them be conditioned using \fB\%NCURSES_VERSION\fP. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. .SH AUTHORS Thomas Dickey .SH SEE ALSO +\fB\%curses\fP(3X), \fB\%define_key\fP(3X), -\fB\%keyok\fP(3X) +\fB\%keyok\fP(3X), +\fB\%key_defined\fP(3X), +\fB\%terminfo\fP(5) diff --git a/contrib/ncurses/man/keyok.3x b/contrib/ncurses/man/keyok.3x --- a/contrib/ncurses/man/keyok.3x +++ b/contrib/ncurses/man/keyok.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -29,35 +29,83 @@ .\" .\" Author: Thomas E. Dickey 1997 .\" -.\" $Id: keyok.3x,v 1.40 2024/03/16 15:35:01 tom Exp $ -.TH keyok 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: keyok.3x,v 1.51 2025/10/04 20:59:08 tom Exp $ +.TH keyok 3X 2025-10-04 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +. +.de bP +.ie n .IP \(bu 4 +.el .IP \(bu 2 +.. +. .SH NAME \fB\%keyok\fP \- -enable or disable a \fIcurses\fR keycode +enable or disable an \fIncurses\fP function key code .SH SYNOPSIS .nf \fB#include .PP -\fBint keyok(int \fIkeycode\fP, bool \fIenable\fP); +\fBint keyok(int \fIkey-code\fP, bool \fIbf\fP); .fi .SH DESCRIPTION -This is an extension to the \fIcurses\fP library. -It permits an application to disable specific keycodes, rather than -use the \fB\%keypad\fP function to disable all keycodes. -Keys that have been disabled can be re-enabled. +The +.B \%keyok +.I \%ncurses +extension permits a +.I curses +application to disable a function key +.I key-code +returned by \fB\%wgetch\fP(3X) +(wide-character API users: +\fB\%wget_wch\fP(3X)). +Key codes that have been disabled can be re-enabled. +.I bf +selects the desired enablement status. +This operation is more fine-grained than calling \fB\%keypad\fP(3X), +which affects +.I all +function keys. .SH RETURN VALUE -The keycode must be greater than zero, else \fBERR\fP is returned. -If it does not correspond to a defined key, then \fBERR\fP is returned. -If the \fIenable\fP parameter is true, then the key must have been disabled, -and vice versa. -Otherwise, the function returns \fBOK\fP. +.B \%keyok +returns +.B ERR +if +.bP +.I key-code +is nonpositive, +.bP +.I key-code +is not a recognized value, +or +.bP +enablement of +.I key-code +is already in the desired state. +.PP +Otherwise, +.B \%keyok +returns +.BR OK "." +.SH EXTENSIONS +.B \%keyok +is an +.I \%ncurses +extension. .SH PORTABILITY -This routine is specific to \fI\%ncurses\fP. -It was not supported on -Version 7, BSD or System V implementations. -It is recommended that -any code depending on them be conditioned using \fB\%NCURSES_VERSION\fP. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. +.PP +NetBSD +.I curses +since 2.0 (2004) supports +.IR \%keyok "." .SH AUTHORS Thomas Dickey .SH SEE ALSO -\fB\%define_key\fP(3X) +\fB\%curses\fP(3X), +\fB\%define_key\fP(3X), +\fB\%keybound\fP(3X), +\fB\%keyok\fP(3X), +\fB\%key_defined\fP(3X) diff --git a/contrib/ncurses/man/legacy_coding.3x b/contrib/ncurses/man/legacy_coding.3x --- a/contrib/ncurses/man/legacy_coding.3x +++ b/contrib/ncurses/man/legacy_coding.3x @@ -29,8 +29,8 @@ .\" .\" Author: Thomas E. Dickey .\" -.\" $Id: legacy_coding.3x,v 1.28 2024/04/20 19:13:50 tom Exp $ -.TH legacy_coding 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: legacy_coding.3x,v 1.32 2024/09/14 20:06:50 tom Exp $ +.TH legacy_coding 3X 2024-09-14 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fB\%use_legacy_coding\fP \- override \fIcurses\fR locale encoding checks @@ -41,15 +41,18 @@ \fBint use_legacy_coding(int \fIlevel\fP); .fi .SH DESCRIPTION -.B \%use_legacy_coding -is an extension to the +.BR \%use_legacy_coding "," +an +.I \%ncurses +extension to the .I curses -library. -It allows the caller to change the result of \fB\%unctrl\fP(3X), +library, +permits customiztion of \fB\%unctrl\fP(3X) behavior, suppressing \fI\%isprint\fP(3)-based checks within the library that would normally cause nonprinting characters to be rendered in visible form. -The alteration affects only eight-bit characters. +The alteration affects only byte-wide characters with the most +significant bit set. .PP The .I level @@ -73,7 +76,9 @@ showing codes in the range 128-159 as is. .RE .SH RETURN VALUE -If the screen has not been initialized, +If the +.I curses +screen has not been initialized, or the .I level parameter is out of range, @@ -81,23 +86,24 @@ returns .BR ERR . Otherwise, -it returns the previous level: -.BR 0 , -.BR 1 , -or -.BR 2 . -.SH PORTABILITY +it returns the previous level. +.SH EXTENSIONS .B \%use_legacy_coding -is specific to -.IR \%ncurses . -It was not supported on Version 7, BSD or System V implementations. +is an +.I \%ncurses +extension. +.SH PORTABILITY Applications employing .I \%ncurses extensions should condition their use on the visibility of the .B \%NCURSES_VERSION preprocessor macro. +.SH HISTORY +.I \%ncurses +5.6 (2006) introduced +.I \%use_legacy_coding +to support \fI\%lynx\fP(1)'s font-switching feature. .SH AUTHORS Thomas Dickey -(to support \fI\%lynx\fP(1)'s font-switching feature). .SH SEE ALSO \fB\%unctrl\fP(3X) diff --git a/contrib/ncurses/man/make_sed.sh b/contrib/ncurses/man/make_sed.sh --- a/contrib/ncurses/man/make_sed.sh +++ b/contrib/ncurses/man/make_sed.sh @@ -1,7 +1,7 @@ #!/bin/sh -# $Id: make_sed.sh,v 1.19 2023/12/07 01:16:43 tom Exp $ +# $Id: make_sed.sh,v 1.22 2025/11/12 00:52:57 Branden.Robinson Exp $ ############################################################################## -# Copyright 2020-2022,2023 Thomas E. Dickey # +# Copyright 2020-2023,2025 Thomas E. Dickey # # Copyright 1998-2005,2017 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -31,9 +31,9 @@ # # Author: Thomas E. Dickey 1997 # -# Construct a sed-script to perform renaming within man-pages. Originally +# Construct a sed script to perform renaming within man pages. Originally # written in much simpler form, this one accounts for the common cases of -# section-names in man-pages. +# section names in man pages. if test $# != 1 ; then echo '? expected a single filename' @@ -79,7 +79,7 @@ sed -e 's/]/d # # convert ".SH" into a more manageable form s/\.SH[ ][ ]*/.SH_(/ @@ -79,7 +80,7 @@ # still want to make aliases for those. Do this by extracting names from the # list of function prototypes in the synopsis. # -# Remove any line that does not contain a '(', since we only want functions. +# Remove any line that does not contain a '(', since we only want functions. # then strip off return-type of each function. # # Finally, remove the parameter list, which begins with a '('. diff --git a/contrib/ncurses/man/menu.3x b/contrib/ncurses/man/menu.3x --- a/contrib/ncurses/man/menu.3x +++ b/contrib/ncurses/man/menu.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2014,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu.3x,v 1.45 2024/03/16 15:35:01 tom Exp $ -.TH menu 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu.3x,v 1.54 2025/11/12 01:27:41 tom Exp $ +.TH menu 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -47,7 +47,7 @@ .. .SH NAME \fBmenu\fP \- -curses extension for programming menus +present menus in \fIcurses\fP windows .SH SYNOPSIS .nf \fB#include @@ -70,7 +70,9 @@ The \fBmenu\fP library maintains a default value for item attributes. You can get or set this default by calling the appropriate \fBget_\fP or \fBset_\fP -routine with a \fBNULL\fP item pointer. +routine with a +.I NULL +item pointer. Changing this default with a \fBset_\fP function affects future item creations, but does not change the rendering of items already created. @@ -81,48 +83,48 @@ the manual page on which it is described. .PP .TS -l l . +L L. \fBcurses\fP Routine Name Manual Page Name -= +_ current_item \fBmitem_current\fP(3X) -free_item \fBmitem_new\fP(3X) -free_menu \fBmenu_new\fP(3X) +free_item \fBmitem_new\fP(3X) +free_menu \fBmenu_new\fP(3X) item_count \fBmenu_items\fP(3X) item_description \fBmitem_name\fP(3X) item_index \fBmitem_current\fP(3X) -item_init \fBmenu_hook\fP(3X) -item_name \fBmitem_name\fP(3X) -item_opts \fBmitem_opts\fP(3X) +item_init \fBmenu_hook\fP(3X) +item_name \fBmitem_name\fP(3X) +item_opts \fBmitem_opts\fP(3X) item_opts_off \fBmitem_opts\fP(3X) item_opts_on \fBmitem_opts\fP(3X) -item_term \fBmenu_hook\fP(3X) +item_term \fBmenu_hook\fP(3X) item_userptr \fBmitem_userptr\fP(3X) item_value \fBmitem_value\fP(3X) item_visible \fBmitem_visible\fP(3X) -menu_back \fBmenu_attributes\fP(3X) +menu_back \fBmenu_attributes\fP(3X) menu_driver \fBmenu_driver\fP(3X) -menu_fore \fBmenu_attributes\fP(3X) +menu_fore \fBmenu_attributes\fP(3X) menu_format \fBmenu_format\fP(3X) -menu_grey \fBmenu_attributes\fP(3X) -menu_init \fBmenu_hook\fP(3X) +menu_grey \fBmenu_attributes\fP(3X) +menu_init \fBmenu_hook\fP(3X) menu_items \fBmenu_items\fP(3X) -menu_mark \fBmenu_mark\fP(3X) -menu_opts \fBmenu_opts\fP(3X) +menu_mark \fBmenu_mark\fP(3X) +menu_opts \fBmenu_opts\fP(3X) menu_opts_off \fBmenu_opts\fP(3X) menu_opts_on \fBmenu_opts\fP(3X) -menu_pad \fBmenu_attributes\fP(3X) +menu_pad \fBmenu_attributes\fP(3X) menu_pattern \fBmenu_pattern\fP(3X) menu_request_by_name \fBmenu_requestname\fP(3X) menu_request_name \fBmenu_requestname\fP(3X) menu_spacing \fBmenu_spacing\fP(3X) -menu_sub \fBmenu_win\fP(3X) -menu_term \fBmenu_hook\fP(3X) +menu_sub \fBmenu_win\fP(3X) +menu_term \fBmenu_hook\fP(3X) menu_userptr \fBmenu_userptr\fP(3X) -menu_win \fBmenu_win\fP(3X) -new_item \fBmitem_new\fP(3X) -new_menu \fBmenu_new\fP(3X) +menu_win \fBmenu_win\fP(3X) +new_item \fBmitem_new\fP(3X) +new_menu \fBmenu_new\fP(3X) pos_menu_cursor \fBmenu_cursor\fP(3X) -post_menu \fBmenu_post\fP(3X) +post_menu \fBmenu_post\fP(3X) scale_menu \fBmenu_win\fP(3X) set_current_item \fBmitem_current\fP(3X) set_item_init \fBmenu_hook\fP(3X) @@ -146,11 +148,13 @@ set_menu_userptr \fBmenu_userptr\fP(3X) set_menu_win \fBmenu_win\fP(3X) set_top_row \fBmitem_current\fP(3X) -top_row \fBmitem_current\fP(3X) +top_row \fBmitem_current\fP(3X) unpost_menu \fBmenu_post\fP(3X) .TE .SH RETURN VALUE -Routines that return pointers return \fBNULL\fP on error. +Routines that return pointers return +.I NULL +on error. Routines that return an integer return one of the following error codes: .TP 5 diff --git a/contrib/ncurses/man/menu_driver.3x b/contrib/ncurses/man/menu_driver.3x --- a/contrib/ncurses/man/menu_driver.3x +++ b/contrib/ncurses/man/menu_driver.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_driver.3x,v 1.47 2024/03/16 15:35:01 tom Exp $ -.TH menu_driver 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_driver.3x,v 1.51 2025/10/04 20:59:08 tom Exp $ +.TH menu_driver 3X 2025-10-04 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 @@ -46,8 +46,9 @@ Once a menu has been posted (displayed), you should funnel input events to it through \fBmenu_driver\fP. This routine has three major input cases: .bP -The input is a form navigation request. -Navigation request codes are constants defined in \fB\fP, +The input is a menu navigation request. +Navigation request codes are constants defined in +.IR menu.h "," which are distinct from the key- and character codes returned by \fBwgetch\fP(3X). .bP diff --git a/contrib/ncurses/man/menu_hook.3x b/contrib/ncurses/man/menu_hook.3x --- a/contrib/ncurses/man/menu_hook.3x +++ b/contrib/ncurses/man/menu_hook.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_hook.3x,v 1.32 2024/03/16 15:35:01 tom Exp $ -.TH menu_hook 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_hook.3x,v 1.34 2024/12/28 21:26:21 tom Exp $ +.TH menu_hook 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBmenu_hook\fP \- set hooks for automatic invocation by applications @@ -55,27 +55,33 @@ The function \fBset_item_init\fP sets a hook to be called at menu-post time and each time the selected item changes (after the change). \fBitem_init\fP -returns the current item init hook, if any (\fBNULL\fP if there is no such -hook). +returns the current item init hook, if any +.RI ( NULL +if there is no such hook). .PP The function \fBset_item_term\fP sets a hook to be called at menu-unpost time and each time the selected item changes (before the change). \fBitem_term\fP -returns the current item term hook, if any (\fBNULL\fP if there is no such -hook). +returns the current item term hook, if any +.RI ( NULL +if there is no such hook). .PP The function \fBset_menu_init\fP sets a hook to be called at menu-post time and just after the top row on the menu changes once it is posted. \fBmenu_init\fP -returns the current menu init hook, if any (\fBNULL\fP if there is no such -hook). +returns the current menu init hook, if any +.RI ( NULL +if there is no such hook). .PP The function \fBset_menu_term\fP sets a hook to be called at menu-unpost time and just before the top row on the menu changes once it is posted. -\fBmenu_term\fP returns the current menu term hook, if any (\fBNULL\fP if there -is no such hook). +\fBmenu_term\fP returns the current menu term hook, if any +.RI ( NULL +if there is no such hook). .SH RETURN VALUE -Routines that return pointers return \fBNULL\fP on error. +Routines that return pointers return +.I NULL +on error. Other routines return one of the following: .TP 5 diff --git a/contrib/ncurses/man/menu_items.3x b/contrib/ncurses/man/menu_items.3x --- a/contrib/ncurses/man/menu_items.3x +++ b/contrib/ncurses/man/menu_items.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_items.3x,v 1.34 2024/03/16 15:35:01 tom Exp $ -.TH menu_items 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_items.3x,v 1.36 2024/12/28 21:26:21 tom Exp $ +.TH menu_items 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBset_menu_items\fP, \fBmenu_items\fP, @@ -44,17 +44,20 @@ .fi .SH DESCRIPTION The function \fBset_menu_items\fP changes the item pointer array of the given -\fImenu\fP. The array must be terminated by a \fBNULL\fP. +\fImenu\fP. The array must be terminated by a +.IR NULL "." .PP The function \fBmenu_items\fP returns the item array of the given menu. .PP The function \fBitem_count\fP returns the count of items in \fImenu\fP. .SH RETURN VALUE -The function \fBmenu_items\fP returns a pointer (which may be \fBNULL\fP). +The function \fBmenu_items\fP returns a pointer (which may be +.IR NULL ")." It does not set \fBerrno\fP. .PP The function \fBitem_count\fP returns \fBERR\fP (the general \fBcurses\fP error -return value) if its \fImenu\fP parameter is \fBNULL\fP. +return value) if its \fImenu\fP parameter is +.I NULL "." .PP The function \fBset_menu_items\fP returns one of the following codes on error: .TP 5 diff --git a/contrib/ncurses/man/menu_mark.3x b/contrib/ncurses/man/menu_mark.3x --- a/contrib/ncurses/man/menu_mark.3x +++ b/contrib/ncurses/man/menu_mark.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_mark.3x,v 1.35 2024/03/16 15:35:01 tom Exp $ -.TH menu_mark 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_mark.3x,v 1.37 2024/12/28 21:26:21 tom Exp $ +.TH menu_mark 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBset_menu_mark\fP, \fBmenu_mark\fP \- @@ -51,13 +51,16 @@ menu is posted is likely to produce unhelpful behavior. .PP The default string is "\-" (a dash). -Calling \fBset_menu_mark\fP with -a non-\fBNULL\fP menu argument will change this default. +Calling \fBset_menu_mark\fP with a +.IR non- NULL +menu argument will change this default. .PP -The function \fBmenu_mark\fP returns the menu's mark string (or \fBNULL\fP if -there is none). +The function \fBmenu_mark\fP returns the menu's mark string (or +.I NULL +if there is none). .SH RETURN VALUE -The function \fBmenu_mark\fP returns a pointer (which may be \fBNULL\fP). +The function \fBmenu_mark\fP returns a pointer (which may be +.IR NULL ")." It does not set \fBerrno\fP. .PP The function \fBset_menu_mark\fP may return the following error codes: diff --git a/contrib/ncurses/man/menu_new.3x b/contrib/ncurses/man/menu_new.3x --- a/contrib/ncurses/man/menu_new.3x +++ b/contrib/ncurses/man/menu_new.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_new.3x,v 1.35 2024/03/16 15:35:01 tom Exp $ -.TH menu_new 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_new.3x,v 1.37 2024/12/28 21:26:21 tom Exp $ +.TH menu_new 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBnew_menu\fP, \fBfree_menu\fP \- @@ -42,12 +42,15 @@ .fi .SH DESCRIPTION The function \fBnew_menu\fP creates a new menu connected to a specified item -pointer array (which must be \fBNULL\fP-terminated). +pointer array (which must be +.IR NULL -terminated). .PP The function \fBfree_menu\fP disconnects \fImenu\fP from its item array and frees the storage allocated for the menu. .SH RETURN VALUE -The function \fBnew_menu\fP returns \fBNULL\fP on error. +The function \fBnew_menu\fP returns +.I NULL +on error. It sets \fBerrno\fP according to the function's failure: .TP 5 .B E_NOT_CONNECTED diff --git a/contrib/ncurses/man/menu_opts.3x b/contrib/ncurses/man/menu_opts.3x --- a/contrib/ncurses/man/menu_opts.3x +++ b/contrib/ncurses/man/menu_opts.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2015,2016 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,18 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_opts.3x,v 1.35 2024/03/16 15:35:01 tom Exp $ -.TH menu_opts 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_opts.3x,v 1.38 2025/01/19 00:51:10 tom Exp $ +.TH menu_opts 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.ie \n(.g \{\ +.ds `` \(lq +.ds '' \(rq +.\} +.el \{\ +.ie t .ds `` `` +.el .ds `` "" +.ie t .ds '' '' +.el .ds '' "" +.\} .SH NAME \fBset_menu_opts\fP, \fBmenu_opts_on\fP, @@ -46,8 +56,8 @@ \fBint menu_opts_off(MENU *\fImenu\fP, Menu_Options \fIopts\fP); .fi .SH DESCRIPTION -The function \fBset_menu_opts\fP sets all the given menu's option bits (menu -option bits may be logically-OR'ed together). +The function \fBset_menu_opts\fP sets all the given menu's option bits +(menu option bits may be logically \*(``or\*(''-ed together). .PP The function \fBmenu_opts_on\fP turns on the given option bits, and leaves others alone. diff --git a/contrib/ncurses/man/menu_pattern.3x b/contrib/ncurses/man/menu_pattern.3x --- a/contrib/ncurses/man/menu_pattern.3x +++ b/contrib/ncurses/man/menu_pattern.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_pattern.3x,v 1.38 2024/03/16 15:35:01 tom Exp $ -.TH menu_pattern 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_pattern.3x,v 1.40 2024/12/28 21:26:21 tom Exp $ +.TH menu_pattern 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBset_menu_pattern\fP, \fBmenu_pattern\fP \- @@ -55,7 +55,10 @@ \fImenu\fP. .SH RETURN VALUE The function \fBmenu_pattern\fP returns a pointer, -which is \fBNULL\fP if the \fImenu\fP parameter is \fBNULL\fP. +which is +.I NULL +if the \fImenu\fP parameter is +.IR NULL "." Otherwise, it is a pointer to a string which is empty if no pattern has been set. It does not set \fBerrno\fP. diff --git a/contrib/ncurses/man/menu_requestname.3x b/contrib/ncurses/man/menu_requestname.3x --- a/contrib/ncurses/man/menu_requestname.3x +++ b/contrib/ncurses/man/menu_requestname.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_requestname.3x,v 1.33 2024/03/16 15:35:01 tom Exp $ -.TH menu_requestname 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_requestname.3x,v 1.35 2024/12/28 21:26:21 tom Exp $ +.TH menu_requestname 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBmenu_request_by_name\fP, \fBmenu_request_name\fP \- @@ -48,7 +48,9 @@ with the given name and returns its request code. Otherwise E_NO_MATCH is returned. .SH RETURN VALUE -\fBmenu_request_name\fP returns \fBNULL\fP on error +\fBmenu_request_name\fP returns +.I NULL +on error and sets \fBerrno\fP to \fBE_BAD_ARGUMENT\fP. .br \fBmenu_request_by_name\fP returns \fBE_NO_MATCH\fP on error. diff --git a/contrib/ncurses/man/menu_spacing.3x b/contrib/ncurses/man/menu_spacing.3x --- a/contrib/ncurses/man/menu_spacing.3x +++ b/contrib/ncurses/man/menu_spacing.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_spacing.3x,v 1.37 2024/03/16 15:35:01 tom Exp $ -.TH menu_spacing 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_spacing.3x,v 1.39 2024/12/28 21:26:21 tom Exp $ +.TH menu_spacing 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBset_menu_spacing\fP, \fBmenu_spacing\fP \- @@ -73,7 +73,9 @@ which is 1 for all of them. .PP The function \fBmenu_spacing\fP returns the spacing information for the menu. -If a pointer is NULL, the corresponding information is simply not returned. +If a pointer is +.IR NULL "," +the corresponding information is simply not returned. .SH RETURN VALUE Both routines return \fBE_OK\fP on success. \fBset_menu_spacing\fP may return diff --git a/contrib/ncurses/man/menu_userptr.3x b/contrib/ncurses/man/menu_userptr.3x --- a/contrib/ncurses/man/menu_userptr.3x +++ b/contrib/ncurses/man/menu_userptr.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_userptr.3x,v 1.33 2024/03/16 15:35:01 tom Exp $ -.TH menu_userptr 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_userptr.3x,v 1.35 2024/12/28 21:26:21 tom Exp $ +.TH menu_userptr 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBset_menu_userptr\fP, \fBmenu_userptr\fP \- @@ -45,7 +45,8 @@ application-specific data (that is, the menu-driver code leaves it alone). These functions get and set the menu user pointer field. .SH RETURN VALUE -\fBmenu_userptr\fP returns a pointer (which may be \fBNULL\fP). +\fBmenu_userptr\fP returns a pointer (which may be +.IR NULL ")." It does not set \fBerrno\fP. .PP \fBset_menu_userptr\fP returns \fBE_OK\fP (success). diff --git a/contrib/ncurses/man/menu_win.3x b/contrib/ncurses/man/menu_win.3x --- a/contrib/ncurses/man/menu_win.3x +++ b/contrib/ncurses/man/menu_win.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_win.3x,v 1.32 2024/03/16 15:35:01 tom Exp $ -.TH menu_win 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_win.3x,v 1.34 2024/12/28 21:26:21 tom Exp $ +.TH menu_win 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBmenu_win\fP \- make and break menu window and subwindow associations @@ -54,14 +54,20 @@ It is not necessary to set either window; by default, the driver code uses \fBstdscr\fP for both. .PP -In the \fBset_\fP functions, window argument of \fBNULL\fP is treated as though -it were \fBstsdcr\fP. A menu argument of \fBNULL\fP is treated as a request +In the \fBset_\fP functions, window argument of +.I NULL +is treated as though +it were \fBstsdcr\fP. A menu argument of +.I NULL +is treated as a request to change the system default menu window or subwindow. .PP The function \fBscale_menu\fP returns the minimum size required for the subwindow of \fImenu\fP. .SH RETURN VALUE -Routines that return pointers return \fBNULL\fP on error. +Routines that return pointers return +.I NULL +on error. Routines that return an integer return one of the following error codes: .TP 5 diff --git a/contrib/ncurses/man/mitem_current.3x b/contrib/ncurses/man/mitem_current.3x --- a/contrib/ncurses/man/mitem_current.3x +++ b/contrib/ncurses/man/mitem_current.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: mitem_current.3x,v 1.37 2024/03/16 15:35:01 tom Exp $ -.TH mitem_current 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: mitem_current.3x,v 1.39 2024/12/28 21:26:21 tom Exp $ +.TH mitem_current 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBmitem_current\fP \- set and get current_menu_item @@ -61,11 +61,13 @@ The function \fBitem_index\fP returns the (zero-origin) index of \fIitem\fP in the menu's item pointer list. .SH RETURN VALUE -\fBcurrent_item\fP returns a pointer (which may be \fBNULL\fP). +\fBcurrent_item\fP returns a pointer (which may be +.IR NULL ")." It does not set \fBerrno\fP. .PP \fBtop_row\fP and \fBitem_index\fP return \fBERR\fP (the general \fBcurses\fP -error value) if their \fImenu\fP parameter is \fBNULL\fP. +error value) if their \fImenu\fP parameter is +.IR NULL "." .PP \fBset_current_item\fP and \fBset_top_row\fP return one of the following: .TP 5 diff --git a/contrib/ncurses/man/mitem_name.3x b/contrib/ncurses/man/mitem_name.3x --- a/contrib/ncurses/man/mitem_name.3x +++ b/contrib/ncurses/man/mitem_name.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: mitem_name.3x,v 1.31 2024/03/16 15:35:01 tom Exp $ -.TH mitem_name 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: mitem_name.3x,v 1.33 2024/12/28 21:26:21 tom Exp $ +.TH mitem_name 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBitem_name\fP, \fBitem_description\fP \- @@ -46,7 +46,8 @@ The function \fBitem_description\fP returns the description part of the given item. .SH RETURN VALUE -These routines return a pointer (which may be \fBNULL\fP). +These routines return a pointer (which may be +.IR NULL ")." They do not set \fBerrno\fP. .SH PORTABILITY These routines emulate the System V menu library. diff --git a/contrib/ncurses/man/mitem_new.3x b/contrib/ncurses/man/mitem_new.3x --- a/contrib/ncurses/man/mitem_new.3x +++ b/contrib/ncurses/man/mitem_new.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: mitem_new.3x,v 1.36 2024/03/16 15:35:01 tom Exp $ -.TH mitem_new 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: mitem_new.3x,v 1.38 2024/12/28 21:26:21 tom Exp $ +.TH mitem_new 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBnew_item\fP, \fBfree_item\fP \- @@ -55,7 +55,9 @@ is the responsibility of the application to release the memory for the name or the description of the item. .SH RETURN VALUE -The function \fBnew_item\fP returns \fBNULL\fP on error. +The function \fBnew_item\fP returns +.I NULL +on error. It sets \fBerrno\fP according to the function's failure: .TP 5 .B E_BAD_ARGUMENT diff --git a/contrib/ncurses/man/mitem_opts.3x b/contrib/ncurses/man/mitem_opts.3x --- a/contrib/ncurses/man/mitem_opts.3x +++ b/contrib/ncurses/man/mitem_opts.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2015 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,18 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: mitem_opts.3x,v 1.33 2024/03/16 15:35:01 tom Exp $ -.TH mitem_opts 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: mitem_opts.3x,v 1.36 2025/01/19 00:51:10 tom Exp $ +.TH mitem_opts 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.ie \n(.g \{\ +.ds `` \(lq +.ds '' \(rq +.\} +.el \{\ +.ie t .ds `` `` +.el .ds `` "" +.ie t .ds '' '' +.el .ds '' "" +.\} .SH NAME \fBset_item_opts\fP, \fBitem_opts_on\fP, @@ -46,8 +56,8 @@ \fBint item_opts_off(ITEM *\fIitem\fP, Item_Options \fIopts\fP); .fi .SH DESCRIPTION -The function \fBset_item_opts\fP sets all the given item's option bits (menu -option bits may be logically-OR'ed together). +The function \fBset_item_opts\fP sets all the given item's option bits +(menu option bits may be logically \*(``or\*(''-ed together). .PP The function \fBitem_opts_on\fP turns on the given option bits, and leaves others alone. diff --git a/contrib/ncurses/man/mitem_userptr.3x b/contrib/ncurses/man/mitem_userptr.3x --- a/contrib/ncurses/man/mitem_userptr.3x +++ b/contrib/ncurses/man/mitem_userptr.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: mitem_userptr.3x,v 1.34 2024/03/16 15:35:01 tom Exp $ -.TH mitem_userptr 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: mitem_userptr.3x,v 1.36 2024/12/28 21:26:21 tom Exp $ +.TH mitem_userptr 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBset_item_userptr\fP, \fBitem_userptr\fP \- @@ -46,7 +46,8 @@ These functions get and set that field. .SH RETURN VALUE -The function \fBitem_userptr\fP returns a pointer (possibly \fBNULL\fP). +The function \fBitem_userptr\fP returns a pointer (possibly +.IR NULL ")." It does not set \fBerrno\fP. .PP The \fBset_item_userptr\fP always returns \fBE_OK\fP (success). diff --git a/contrib/ncurses/man/ncurses.3x b/contrib/ncurses/man/ncurses.3x --- a/contrib/ncurses/man/ncurses.3x +++ b/contrib/ncurses/man/ncurses.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2015,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: ncurses.3x,v 1.214 2024/04/27 17:55:43 tom Exp $ -.TH ncurses 3X 2024-04-27 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: ncurses.3x,v 1.289 2025/11/12 01:01:34 tom Exp $ +.TH ncurses 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -54,7 +54,6 @@ . TP .. . -.ds d @TERMINFO@ .SH NAME \fB\%ncurses\fP \- character-cell terminal interface with optimized output @@ -65,7 +64,7 @@ .SH DESCRIPTION The \*(``new curses\*('' library offers the programmer a terminal-independent means of reading keyboard and mouse input and -updating character-cell terminals with output optimized to minimize +writing to character-cell displays with output optimized to minimize screen updates. .I \%ncurses replaces the @@ -86,15 +85,15 @@ .I windows and .IR pads ; -the reading of terminal input; -control of terminal input and output options; -environment query routines; -color manipulation; +acquisition of keyboard and mouse events; +selection of color and rendering attributes +(such as bold or underline); the definition and use of .I "soft label" keys; +access to the .I \%term\%info -capability access; +terminal capability database; a .I termcap compatibility interface; @@ -102,8 +101,7 @@ (such as \fI\%termios\fP(3)). .PP .I \%ncurses -implements the standard interface described by -X/Open Curses Issue\ 7. +implements the interface described by X/Open Curses Issue\ 7. In many behavioral details not standardized by X/Open, .I \%ncurses emulates the @@ -122,8 +120,8 @@ such as limitations on the size of an underlying integral type or the availability of a preprocessor macro exclusive of a function definition (which prevents its address from being taken). -This section also describes implementation details that will be -significant to the programmer but which are not standardized. +This section also describes implementation details +of significance to the programmer but which are not standardized. .bP \*(``EXTENSIONS\*('' presents .I \%ncurses @@ -162,22 +160,21 @@ A debugging version of the library may be available; if so, link with it using -.BR \-lncurses_g . +.BR \-lncurses_g "." (Your system integrator may have installed these libraries such that you can use the options .B \-lcurses and -.BR \-lcurses_g , +.BR \-lcurses_g "," respectively.) The .I \%ncurses_g -library generates trace logs -(in a file called -.I \%trace -in the current directory) -that describe +library logs events describing .I \%ncurses -actions. +actions +to a file called +.I \%trace +in the application's working directory at startup. See section \*(``ALTERNATE CONFIGURATIONS\*('' below. .SS "Application Structure" A @@ -203,10 +200,13 @@ \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X) must be called to initialize .I curses -before use of any functions that deal with windows and screens. +before use of any functions +that access or manipulate windows or screens. .PP -To get character-at-a-time input without echoing\(emmost interactive, -screen-oriented programs want this\(emuse the following sequence. +To get character-at-a-time input without echoing \(em +most interactive, +screen-oriented programs want this \(em +use the following sequence. .PP .RS 4 .EX @@ -214,36 +214,55 @@ .EE .RE .PP -Most applications perform further setup as follows. +Most applications would perform further setup as follows. .PP .RS 4 .EX -intrflush(stdscr, FALSE); +.nf +noqiflush(); keypad(stdscr, TRUE); +.fi .EE .RE .PP A .I curses -program then often enters an event loop of some sort. +program then often enters an event-handling loop. Call \fB\%endwin\fP(3X) before exiting. .SS Overview A .I curses -library abstracts the terminal screen by representing all or part of it -as a +library abstracts the terminal with a +.I \%SCREEN +data structure, +and represents all or part of its display +with .I \%WINDOW -data structure. +structures. +Distinct properties apply to each; +for example, +the +.I "line discipline" +of a typical Unix terminal driver +is in one of three modes: +raw, +\%cbreak, +or canonical (\*(``cooked\*(''). +In +.IR curses "," +the line discipline is a property of the screen, +applying identically to all windows associated with it. +.PP A .I window is a rectangular grid of character cells, -addressed by row and column coordinates -.RI ( y , +addressed by line and column coordinates +.RI ( y "," .IR x ), with the upper left corner as (0, 0). A window called -.BR \%stdscr , -the same size as the terminal screen, +.BR \%stdscr "," +by default the same size as the terminal screen, is always available. Create others with \fB\%newwin\fP(3X). .PP @@ -262,17 +281,16 @@ .PP Functions permit manipulation of a window and the .I cursor -identifying the cell within it at which the next output operation will -occur. +identifying the cell within it at which the next operation will occur. Among those, the most basic are \fB\%move\fP(3X) and \fB\%addch\fP(3X): -these place the cursor and write a character to -.BR \%stdscr , +these place the cursor within and write a character to +.BR \%stdscr "," respectively. .PP Frequent changes to the terminal screen can cause unpleasant flicker or inefficient use of the communication channel to the device, -so the library does not generally update it automatically. +so as a rule the library does not update it automatically. Therefore, after using .I curses @@ -284,7 +302,7 @@ .\" X/Open Curses Issue 7 assumes some optimization will be done, but .\" does not mandate it in any way. .I optimizes -its output by computing a minimal number of operations to mutate the +its output by computing a minimal volume of operations to mutate the screen from its state at the previous refresh to the new one. Effective optimization demands accurate information about the terminal device: @@ -297,48 +315,54 @@ Special windows called .I pads may also be manipulated. -These are windows that are not constrained to the size of the terminal -screen and whose contents need not be completely displayed. +These are not constrained to the size of the terminal screen and their +contents need not be completely displayed. See \fB\%curs_pad\fP(3X). .PP -In addition to drawing characters on the screen, -rendering attributes and colors may be supported, -causing the characters to show up in such modes as underlined, -in reverse video, -or in color on terminals that support such display enhancements. -See \fB\%curs_attr\fP(3X). +Many terminals support configuration of character cell foreground and +background colors as well as +.IR attributes "," +which cause characters to render in such modes as +boldfaced, +underlined, +or in reverse video. +See \fB\%curs_color\fP(3X) and \fB\%curs_attr\fP(3X). .PP .I curses -predefines constants for a small set of forms-drawing graphics +defines constants to simplify access +to a small set of forms-drawing graphics corresponding to the DEC Alternate Character Set (ACS), a feature of VT100 and other terminals. -See \fB\%waddch\fP(3X). +See \fB\%addch\fP(3X). .PP .I curses is implemented using the operating system's terminal driver; -keystroke events are received not as scan codes but as byte sequences. -Graphical keycaps +key events are received not as scan codes but as byte sequences. +The driver reports graphical keycaps (alphanumeric and punctuation keys, and the space) -appear as-is. +as-is. Everything else, including the tab, enter/return, keypad, arrow, and function keys, -appears as a control character or a multibyte +appears to +.I curses +as a control character or a multibyte .I "escape sequence." .I curses -translates these into unique +can translate the latter into unique .I "key codes." -See \fB\%getch\fP(3X). +See \fB\%keypad\fP(3X) and \fB\%getch\fP(3X). .PP .I \%ncurses provides reimplementations of the SVr4 \fBpanel\fP(3X), \fBform\fP(3X), -and \fBmenu\fP(3X) libraries to ease construction of user interfaces +and \fBmenu\fP(3X) libraries; +they permit overlapping windows and ease construction of user interfaces with -.IR curses . +.IR curses "." .SS "Initialization" The selection of an appropriate value of .I TERM @@ -352,10 +376,9 @@ value automatically; \fB\%tset\fP(1) may assist with troubleshooting exotic situations. .PP -If you change the terminal type, -export the -.I TERM -environment variable in the shell, +If you change the terminal type from a shell, +export +.IR TERM "," then run \fB\%tset\fP(1) or the .RB \*(`` "@TPUT@ init" \*('' command. @@ -370,10 +393,10 @@ .I curses program is executing in a graphical windowing environment, the information obtained thence overrides that obtained by -.IR \%term\%info . +.IR \%term\%info "." An .I \%ncurses -extension supports resizable terminals; +extension supports resizable terminal displays; see \fB\%wresize\fP(3X). .PP If the environment variable @@ -384,9 +407,8 @@ program checks first for a terminal type description in the location it identifies. .I \%TERMINFO -is useful for developing experimental type descriptions or when write -permission to -.I \%\*d +is useful for developing type descriptions or when write permission to +.I \%@TERMINFO@ is not available. .PP See section \*(``ENVIRONMENT\*('' below. @@ -402,41 +424,61 @@ a \*(``mvw\*('' prefix indicates both. The \*(``w\*('' function is typically the elemental one; the removal of this prefix usually indicates operation on -.BR \%stdscr . +.BR \%stdscr "." .PP -Four functions prefixed with \*(``p\*('' require a pad argument. +Four functions prefixed with \*(``p\*('' require a +.I pad +argument; +see below. .PP In function synopses, .I \%ncurses man pages apply the following names to parameters. +We introduce the character types in the next subsection. .PP .TS center; Li L. -bf \fIbool\fP (\fBTRUE\fP or \fBFALSE\fP) +bf a \fIbool\fP (\fBTRUE\fP or \fBFALSE\fP) c a \fIchar\fP or \fIint\fP ch a \fIchtype\fP wc a \fIwchar_t\fP or \fIwint_t\fP wch a \fIcchar_t\fP win pointer to a \fIWINDOW\fP pad pointer to a \fIWINDOW\fP that is a pad +pair a foreground/background color pair identifier .TE .SS "Wide and Non-wide Character Configurations" -This manual page describes functions that appear in any configuration -of the library. +This man page primarily surveys functions that appear in any +configuration of the library. There are two common configurations; +for others, see section \*(``ALTERNATE CONFIGURATIONS\*('' below. .TP 10 \" "ncursesw" + 2n .I \%ncurses is the library in its \*(``non-wide\*('' configuration, handling only eight-bit characters. -It stores a character combined with attributes in a +It stores a character combined with attributes +and a color pair identifier +in a .I \%chtype datum, which is often an alias of -.IR int . +.IR int "." +A string of +.I curses +characters is similar to a C +.I char +string; +a +.I chtype +string ends with an integral +.BR 0 "," +the null +.I curses +character. .IP -Attributes alone +Attributes and a color pair identifier (with no corresponding character) can be stored in variables of .I \%chtype @@ -444,12 +486,24 @@ .I \%attr_t type. In either case, -they are represented as an integral bit mask. +they are accessed via an integral bit mask. .IP -Each cell of a +.I \%ncurses +stores each cell of a .I \%WINDOW -is stored as a -.IR \%chtype . +as a +.IR \%chtype "." +X/Open Curses does not specify the sizes of the character code or +color pair identifier, +nor the quantity of attribute bits, +in +.IR chtype ";" +these are implementation-dependent. +.I \%ncurses +uses eight bits for the character code. +An application requiring a wider character type, +for instance to represent Unicode, +should use the wide-character API. .TP 10 .I \%ncursesw is the library in its \*(``wide\*('' configuration, @@ -457,19 +511,49 @@ .I \%char (a byte-sized type) can represent. -It adds about one third more calls using additional data types that -can store such -.I multibyte -characters. +It provides additional functions that complement those in +the non-wide library where the size of the underlying character type is +significant. +A somewhat regular naming convention relates many of the wide variants +to their non-wide counterparts; +where a non-wide function name contains \*(``ch\*('' or \*(``str\*('', +prefix it with \*(``_w\*('' to obtain the wide counterpart. +For example, +\fB\%waddch\fP becomes \fB\%wadd_wch\fP. +An exception is +.B \%ins_nwstr +(and its variants), +spelled thus instead of \*(``insn_wstr\*(''. +(Exceptions that add only \*(``w\*('' comprise +.BR \%addwstr "," +.BR \%inwstr "," +and their variants.) +.\" This is because they operate on "plain" wide-character strings +.\" (`wchar_t*`) and not curses complex character strings (`cchar_t*`). +.\" SVID 4 did specify functions like `addwch()` and `inswch()` that +.\" operated on `chtype`s assuming that they were wide enough for a +.\" `wchar_t` plus attribute and color pair bits; X/Open Curses did not +.\" standardize these. +.IP +This convention is inapplicable to some non-wide function names, +so other transformations are used for the wide configuration: +the window background management function \*(``bkgd\*('' becomes +\*(``bkgrnd\*(''; +the window border-drawing and -clearing functions are suffixed with +\*(``_set\*(''; +and character attribute manipulation functions like +\*(``attron\*('' become \*(``attr_on\*(''. .RS 10 \" same as foregoing tag width .TP 9 \" "cchar_t" + 2n .I \%cchar_t -corresponds to the non-wide configuration's -.IR \%chtype . -It always a structure type, -because it stores more data than fit into a standard scalar type. +is a +.I "curses complex character" +and corresponds to the non-wide-character configuration's +.IR \%chtype "." +It is a structure type +because it requires more storage than a standard scalar type offers. A character code may not be representable as a -.IR \%char , +.IR \%char "," and moreover more than one character may occupy a cell (as with accent marks and other diacritics). Each character is of type @@ -477,20 +561,26 @@ a complex character contains one spacing character and zero or more non-spacing characters (see below). -Attributes and color data are stored in separate fields of the -structure, -not combined as in -.IR \%chtype . +A string of complex characters ends with a +.I \%cchar_t +whose +.I \%wchar_t +member is the null wide character. +Attributes and a color pair identifier are stored in separate fields of +the structure, +not combined into an integer as in +.IR \%chtype "." .PP -Each cell of a +.I \%ncurses +stores each cell of a .I \%WINDOW -is stored as a -.IR \%cchar_t . -.PP +as a +.IR \%cchar_t "." \fB\%setcchar\fP(3X) and \fB\%getcchar\fP(3X) store and retrieve .I \%cchar_t data. +.PP The wide library API of .I \%ncurses depends on two data types standardized by ISO C95. @@ -498,16 +588,16 @@ .I \%wchar_t stores a wide character. Like -.IR \%chtype , +.IR \%chtype "," it may be an alias of -.IR int . +.IR int "." Depending on the character encoding, a wide character may be -.IR spacing , +.IR spacing "," meaning that it occupies a character cell by itself and typically accompanies cursor advancement, or -.IR non-spacing , +.IR non-spacing "," meaning that it occupies the same cell as a spacing character, is often regarded as a \*(``modifier\*('' of the base glyph with which it combines, @@ -517,35 +607,12 @@ can store a .I \%wchar_t or the constant -.BR \%WEOF , +.IR \%WEOF "," analogously to the .IR int -sized character manipulation functions of ISO C and its constant -.BR \%EOF . +.IR \%EOF "." .RE -.IP -The wide library provides additional functions that complement those in -the non-wide library where the size of the underlying character type is -significant. -A somewhat regular naming convention relates many of the wide variants -to their non-wide counterparts; -where a non-wide function name contains \*(``ch\*('' or \*(``str\*('', -prefix it with \*(``_w\*('' to obtain the wide counterpart. -For example, -\fB\%waddch\fP becomes \fB\%wadd_wch\fP. -(Exceptions that add only \*(``w\*('' comprise -.BR \%addwstr , -.BR \%inwstr , -and their variants.) -.IP -This convention is inapplicable to some non-wide function names, -so other transformations are used for the wide configuration: -the window background management function \*(``bkgd\*('' becomes -\*(``bkgrnd\*(''; -the window border-drawing and -clearing functions are suffixed with -\*(``_set\*(''; -and character attribute manipulation functions like -\*(``attron\*('' become \*(``attr_on\*(''. .\" .SS "Function Name Index" The following table lists the @@ -559,8 +626,8 @@ .PP .TS center tab(/); -l l . -\f(BIcurses\fP Function Name/Man Page +L L. +\fIcurses\fP Function Name/Man Page _ COLOR_PAIR/\fBcurs_color\fP(3X) PAIR_NUMBER/\fBcurs_color\fP(3X) @@ -743,7 +810,7 @@ mvaddstr/\fBcurs_addstr\fP(3X) mvaddwstr/\fBcurs_addwstr\fP(3X) mvchgat/\fBcurs_attr\fP(3X) -mvcur/\fBcurs_terminfo\fP(3X) +mvcur/\fBcurs_kernel\fP(3X) mvdelch/\fBcurs_delch\fP(3X) mvderwin/\fBcurs_window\fP(3X) mvget_wch/\fBcurs_get_wch\fP(3X) @@ -1033,20 +1100,19 @@ below. .SH RETURN VALUE Unless otherwise noted, -functions that return an integer return +functions that return integers return the constants .B OK on success and .B ERR -on failure. -Functions that return pointers return -.B NULL -on failure. +on failure; +see \fB\%curs_variables\fP(3X). +Functions that return pointers return a null pointer on failure. Typically, .I \%ncurses treats a null pointer passed as a function parameter as a failure. Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position -.RI ( y , +.RI ( y "," .IR x ) is outside the window boundaries. .SH ENVIRONMENT @@ -1055,27 +1121,30 @@ .I \%ncurses applications. The library may be configured to disregard the variables -.IR \%TERMINFO , -.IR \%TERMINFO_DIRS , -.IR \%TERMPATH , +.IR \%TERMINFO "," +.IR \%TERMINFO_DIRS "," +.IR \%TERMPATH "," and -.IR HOME , +.IR HOME "," if the user is the superuser (root), or the application uses \fI\%setuid\fP(2) or \fI\%setgid\fP(2). .SS "\fIBAUDRATE\fP" The debugging library checks this variable when the application has redirected output to a file. -Its integral value is used for the baud rate. +.I \%ncurses +interprets its integral value as the terminal's line speed +in bits per second. If that value is absent or invalid, .I \%ncurses uses 9600. -This feature allows testers to construct repeatable test cases -that take into account optimization decisions that depend on baud rate. +This feature allows developers to construct repeatable test cases +that take into account optimization decisions that depend +on the terminal's line speed. .SS "\fICC\fP (command character)" When set, the .B \%command_character -.RB ( \%cmdch ) +.RB \%( cmdch ) capability value of loaded .I \%term\%info entries changes to the value of this variable. @@ -1083,14 +1152,16 @@ .I \%term\%info entries provide this feature. .PP -Because this name is also used in development environments to represent -the C compiler's name, +Because this name is also used in development environments to store the +C compiler's name, .I \%ncurses ignores its value if it is not one character in length. .SS "\fICOLUMNS\fP" -This variable specifies the width of the screen in characters. +This variable specifies the width of the screen in character cells. Applications running in a windowing environment usually are able to obtain the width of the window in which they are executing. +.I \%ncurses +enforces an upper limit of 512 when reading the value. If .I \%COLUMNS is not defined and the terminal's screen size is not available from the @@ -1098,7 +1169,7 @@ .I \%ncurses uses the size specified by the .B \%columns -.RB ( \%cols ) +.RB \%( cols ) capability of the terminal type's entry in the .I \%term\%info database, @@ -1156,7 +1227,11 @@ The default value of 1000 (one second) is adequate for most uses. -This environment variable overrides it. +This environment variable overrides it; +.I \%ncurses +enforces an upper limit of 30,000 +(30 seconds) +when reading the value. .PP The most common instance where you may wish to change this value is to work with a remote host over a slow communication channel. @@ -1165,6 +1240,10 @@ application does not receive the characters of an escape sequence in a timely manner, the library can interpret them as multiple key stroke events. +Conversely, +a fast typist on a low-latency connection who happens to input an ESC +followed by characters that match an escape sequence may experience +confusing application behavior. .PP \fI\%xterm\fP(1) mouse events are a form of escape sequence; therefore, @@ -1181,7 +1260,9 @@ If \fB\%keypad\fP(3X) is disabled for the .I curses window receiving input, -a program must disambiguate escape sequences itself. +.B \%ESCDELAY +is irrelevant +and a program must disambiguate escape sequences itself. .SS "\fIHOME\fP" .I \%ncurses may read and write auxiliary terminal descriptions in @@ -1196,7 +1277,7 @@ The corresponding .I \%term\%info capability and code is -.BR \%lines . +.BR \%lines "." See the description of the .I \%COLUMNS variable above. @@ -1228,21 +1309,22 @@ .I \%ncurses not to assume anything about the colors, use a value of \*(``\-1,\-1\*(''. -To make the default color scheme green on black, +To make the default color scheme green on black on a terminal +that uses ANSI\ X3.64/ECMA-48/ISO\ 6429 color assignments, use \*(``2,0\*(''. .I \%ncurses accepts integral values from \-1 up to the value of the .I \%term\%info .B \%max_colors .RB ( colors ) -capability. +capability for the selected terminal type. .SS "\fINCURSES_CONSOLE2\fP" (MinGW port only) The .I \%Console2 .\" https://www.hanselman.com/blog/console2-a-better-windows-command-prompt program defectively handles the Microsoft Console API call -.IR \%Create\%Console\%Screen\%Buffer . +.IR \%Create\%Console\%Screen\%Buffer "." Applications that use it will hang. However, it is possible to simulate the action of this call by mapping @@ -1256,7 +1338,11 @@ When .I \%ncurses is configured to use the GPM interface, -this variable may list one or more terminal names +this variable may list one or more terminal type names, +delimited by vertical bars +.RB ( | ) +or colons +.RB ( : ), against which the .I TERM variable @@ -1265,7 +1351,7 @@ An empty value disables the GPM interface, using .IR \%ncurses 's -built-in support for \fIxterm\fP(1) mouse protocols instead. +built-in support for \fI\%xterm\fP(1) mouse protocols instead. If the variable is absent, .I \%ncurses attempts to open GPM if @@ -1279,18 +1365,20 @@ Set this environment variable to any value to disable the feature. You can also adjust your \fI\%stty\fP(1) settings to avoid the problem. .SS "\fINCURSES_NO_MAGIC_COOKIE\fP" -Many terminals store video attributes as a property of a character cell, +Many terminals store video attributes as properties of a character cell, as .I curses does. Historically, -some recorded changes in video attributes as data that logically -.I occupies +some recorded changes in video attributes as data +that logically +(but invisibly) +.I occupied character cells on the display, switching attributes on or off, -similarly to tags in a markup language; -these are termed \*(``magic cookies\*('', -and must be subsequently overprinted. +similarly to tags in a markup language, +which then had to be overprinted to depict the cells' desired contents; +these are termed \*(``magic cookies\*(''. If the .I \%term\%info entry for your terminal type does not adequately describe its handling @@ -1315,12 +1403,13 @@ limiting the speed of communication to what the hardware could handle. Unless a hardware terminal is interfaced into a terminal concentrator (which does flow control), -an application must manage flow control itself to prevent overruns and -data loss. +an application must manage flow itself to prevent overruns and data +loss. .PP -A solution that comes at no hardware cost is for an application to pause -after directing a terminal to execute an operation that it performs -slowly, +A solution that comes at no hardware cost +is for an application to pause transmission +after directing a terminal to execute an operation +that it performs slowly, such as clearing the display. Many terminal type descriptions, including that for the VT100, @@ -1343,7 +1432,7 @@ initializing the terminal. This was done, as in SVr4 -.IR curses , +.IR curses "," to increase performance. For testing purposes, both of @@ -1359,8 +1448,7 @@ .I \%ncurses performs its own buffering and does not require this workaround; it does not modify the buffering of the standard output stream. -This approach makes signal handling, -as for interrupts, +This approach makes the library's handling of keyboard-initiated signals more robust. A drawback is that certain unconventional programs mixed \fI\%stdio\fP(3) calls with @@ -1421,6 +1509,7 @@ .PP .RS 3 .EX +.nf # linux console, if patched to provide working # VT100 shift\-in/shift\-out, with corresponding font. linux\-vt100|linux console with VT100 line\-graphics, @@ -1429,6 +1518,7 @@ # uxterm with vt100Graphics resource set to false xterm\-utf8|xterm relying on UTF\-8 line\-graphics, U8#1, use=xterm, +.fi .EE .RE .PP @@ -1507,8 +1597,8 @@ Descriptions in .I \%term\%info format are normally stored in a directory tree using subdirectories -named by the common first letters of the terminal types named therein. -This is the scheme used in System\ V. +named for the common first letters of the terminal types named therein. +System\ V used this scheme. .bP If .I \%ncurses @@ -1517,16 +1607,16 @@ .I \%TERM\%INFO may name its location, such as -.IR \%/usr/share/terminfo.db , +.IR \%/usr/share/terminfo.db "," rather than -.IR \%/usr/share/terminfo/ . +.IR \%/usr/share/terminfo/ "." .PP The hashed database uses less disk space and is a little faster than the directory tree. However, -some applications assume the existence of the directory tree, -and read it directly -rather than using the +some applications assume the existence of the directory tree +and read it directly, +ignoring the .I \%term\%info API. .bP @@ -1550,14 +1640,17 @@ .RS 4 .IP .EX +.nf TERMINFO=$(infocmp \-0 \-Q2 \-q) export TERMINFO +.fi .EE .RE .IP -The compiled description is used only if it corresponds to the terminal -type identified by -.IR TERM . +.I \%ncurses +uses the compiled description only if it corresponds +to the terminal type identified by +.IR TERM "." .PP Setting .I \%TERM\%INFO @@ -1588,7 +1681,7 @@ .bP location(s) configured and compiled into .I \%ncurses -.RS 3 +.RS .if !'\*(td'' \{\ .bP .I \%@TERMINFO_DIRS@ @@ -1602,7 +1695,7 @@ .SS "\fITERMINFO_DIRS\fP" This variable specifies a list of locations, akin to -.IR PATH , +.IR PATH "," in which .I \%ncurses searches for the terminal type descriptions described by @@ -1624,10 +1717,10 @@ then .I \%ncurses checks the contents of -.IR \%TERMPATH , +.IR \%TERMPATH "," a list of locations, akin to -.IR PATH , +.IR PATH "," in which it searches for .I termcap terminal type descriptions. @@ -1641,10 +1734,10 @@ are unset or invalid, .I \%ncurses searches for the files -.IR \%/etc/termcap , -.IR \%/usr/share/misc/termcap , +.IR \%/etc/termcap "," +.IR \%/usr/share/misc/termcap "," and -.IR \%$HOME/.termcap , +.IR \%$HOME/.termcap "," in that order. .SH "ALTERNATE CONFIGURATIONS" Many different @@ -1654,102 +1747,204 @@ .I \%configure script when building the library. Run the script with the -.B \-\-help +.B \%\-\-help option to peruse them all. A few are of particular significance to the application developer employing -.IR \%ncurses . +.IR \%ncurses "." .TP 5 .B \-\-disable\-overwrite -The standard include for \fI\%ncurses\fP is as noted in \fBSYNOPSIS\fP: +Avoid file name conflicts between +.I \%ncurses +and an existing +.I curses +installation on the system. +The standard C preprocessor inclusion for the +.I curses +library is as follows. .RS 5 .PP .RS 4 .EX -\fB#include \fP +.nf +.\" The dummy character prevents undesired rewriting of the next line on +.\" installation of the man page. +\fB#\&include \fP +.fi .EE .RE .PP -This option is used to avoid filename conflicts when \fI\%ncurses\fP -is not the main implementation of curses of the computer. -If \fI\%ncurses\fP is installed disabling overwrite, -it puts its headers in a subdirectory, -e.g., +If +.I \%ncurses +is installed disabling overwrite, +it puts its header files in a subdirectory. +Here is an example. .PP .RS 4 .EX -\fB#include \fP +.\" The dummy character prevents undesired rewriting of the next line on +.\" installation of the man page. +\fB#\&include \fP .EE .RE .PP -It also omits a symbolic link which would allow you to use \fB\-lcurses\fP -to build executables. +With +.BR \%\-\-disable\-overwrite "," +installation also omits a symbolic link that would cause the compiler's +.B \%\-lcurses +option to link object files with +.I \%ncurses +instead of the system +.I curses +library. +.PP +The directory used by this configuration of +.I \%ncurses +is shown in section \*(``SYNOPSIS\*('' above. .RE .TP 5 .B \-\-enable\-widec -The configure script renames the library and -(if the \fB\-\-disable\-overwrite\fP option is used) -puts the header files in a different subdirectory. -All of the library names have a \*(``w\*('' appended to them, -i.e., instead of -.RS 5 -.PP -.RS 4 -.EX -\fB\-lncurses\fP -.EE -.RE -.PP -you link with -.PP -.RS 4 -.EX -\fB\-lncursesw\fP -.EE -.RE -.PP -You must also enable the wide-character features in the header file -when compiling for the wide-character library +(default for ABI\ 6+ since 2023-10-21) +Enable support for wide characters. +The +.I \%configure +script renames the +.I \%ncurses +library +(and the +.I tinfo +library, +if +.B \%\-\-with\-termlib +is also specified), +appending \*(``w\*(''. +An application desirous of wide-character support then uses +.B \%\-lncursesw +(or +.BR \%\-ltinfow ) +instead of +.B \%\-lncurses +(or +.BR \%\-ltinfo ) +as its linker option. +The +.IR ncurses++ "," +.IR panel "," +.IR form "," +and +.I menu +libraries are renamed similarly. +.IP +An application must also +define certain C preprocessor symbols +to enable wide-character features +in +.I curses +header files to use the extended (wide-character) functions. -The symbol which enables these features has changed -since X/Open Curses, Issue 4: +The symbol that enables these features has changed +since X/Open Curses Issue\ 4. +.RS 5 .bP -Originally, the wide-character feature required the symbol -\fB_XOPEN_SOURCE_EXTENDED\fP -but that was only valid for XPG4 (1996). +Originally, +the wide-character feature required the symbol +.IR \%_XOPEN_SOURCE_EXTENDED "," +but that was valid only for XPG4 (1996). .bP -Later, that was deemed conflicting with \fB_XOPEN_SOURCE\fP defined to 500. +Later, +that was deemed conflicting with an +.I \%_XOPEN_SOURCE +value of 500. .bP As of mid-2018, -none of the features in this implementation require a \fB_XOPEN_SOURCE\fP -feature greater than 600. -However, X/Open Curses, Issue 7 (2009) recommends defining it to 700. +no +.I \%ncurses +feature requires a +.I \%_XOPEN_SOURCE +value greater than 600. +However, +X/Open Curses Issue\ 7 (2009) recommends defining it to 700. .bP -Alternatively, you can enable the feature by defining \fBNCURSES_WIDECHAR\fP -with the caveat that some other header file than \fBcurses.h\fP -may require a specific value for \fB_XOPEN_SOURCE\fP +Alternatively, +you can enable the feature by defining +.B \%NCURSES_WIDECHAR +with the caveat that some header file other than +.I \%curses.h +may require a specific value for +.I \%_XOPEN_SOURCE (or a system-specific symbol). -.PP -The \fI\%curses.h\fP header file installed for the wide-character -library is designed to be compatible with the non-wide library's header. -Only the size of the \fI\%WINDOW\fP structure differs; -few applications require more than pointers to \fI\%WINDOW\fPs. -.PP -If the headers are installed allowing overwrite, -the wide-character library's headers should be installed last, +.RE +.IP +The +.I \%curses.h +header file installed +for the wide-character library +is designed to be compatible with the non-wide library's header. +Only the size of the +.I \%WINDOW +structure differs; +few applications require more than pointers to +.IR \%WINDOW "." +.\" XXX: What's different in term.h? +.IP +If +.IR \%ncurses 's +header files are installed allowing overwrite +(the default, +but see +.B \%\-\-disable\-overwrite +above), +the wide-character library's headers should be installed last +by packaging systems and similar, to allow applications to be built using either library from the same set of headers. -.RE .TP 5 .B \-\-with\-pthread -The configure script renames the library. -All of the library names have a \*(``t\*('' appended to them -(before any \*(``w\*('' added by \fB\-\-enable\-widec\fP). +Enable support for multi-threaded applications. +The +.I \%configure +script renames the +.I \%ncurses +library +(and the +.I tinfo +library, +if +.B \%\-\-with\-termlib +is also specified), +appending \*(``t\*('' +(before any \*(``w\*('' added by +.BR \%\-\-enable\-widec ). +An application desirous of support for multiple threads of execution +then uses, +for example, +.B \%\-lncursest +(or +.BR \%\-ltinfot ) +instead of +.B \%\-lncurses +(or +.BR \%\-ltinfo ) +as its linker option. +The +.IR ncurses++ "," +.IR panel "," +.IR form "," +and +.I menu +libraries are renamed similarly. .IP -The global variables such as \fBLINES\fP are replaced by macros to -allow read-only access. -At the same time, setter-functions are provided to set these values. -Some applications (very few) may require changes to work with this convention. +.I \%ncursest +and +.I \%ncursestw +replace global variables such as +.B \%LINES +with macros allowing read-only access. +At the same time, +they provide functions to set these values. +Very few applications require changes +to work with this convention. +.\" see definition of NCURSES_WRAPPED_VAR .TP 5 .B \-\-with\-shared .tQ @@ -1758,24 +1953,60 @@ .B \-\-with\-debug .tQ .B \-\-with\-profile +Mandate compilation of the +.I \%ncurses +library +(and the +.I tinfo +library, +if +.B \%\-\-with\-termlib +is also specified) +in the specified forms. The shared and normal (static) library names differ by their suffixes, -e.g., \fBlibncurses.so\fP and \fBlibncurses.a\fP. -The debug and profiling libraries add a \*(``_g\*('' -and a \*(``_p\*('' to the root names respectively, -e.g., \fBlibncurses_g.a\fP and \fBlibncurses_p.a\fP. +as with +.I \%libncurses.so +and +.IR \%libncurses.a "." +The debugging and profiling libraries add a \*(``_g\*('' +and a \*(``_p\*('' to the roots of these respective names, +forming +.I \%libncurses_g.so +and +.IR \%libncurses_p.a "," +for example. +The +.IR ncurses++ "," +.IR panel "," +.IR form "," +and +.I menu +libraries are made available similarly. .TP 5 .B \-\-with\-termlib -Low-level functions which do not depend upon whether the library -supports wide-characters, are provided in the tinfo library. -.IP -By doing this, it is possible to share the tinfo library between -wide/normal configurations as well as reduce the size of the library -when only low-level functions are needed. +Provide +.IR \%ncurses 's +lower-level terminal interface functions +(those that do not depend +on the +.I \%SCREEN +and +.I \%WINDOW +abstractions) +in a library named +.IR \%tinfo "." +This arrangement reduces an application's linking and/or loading times +when it does not require +.IR curses 's +higher-level features. .IP -Those functions are described in these pages: +The following pages document +.I curses +functions provided by +.IR \%tinfo "." .RS .bP -\fB\%curs_extend\fP(3X) \- miscellaneous \fIcurses\fP extensions +\fB\%curs_extend\fP(3X) \- miscellaneous \fIncurses\fP extensions .bP \fB\%curs_inopts\fP(3X) \- \fIcurses\fP input options .bP @@ -1792,16 +2023,28 @@ .RE .TP 5 .B \-\-with\-trace -The \fBtrace\fP function normally resides in the debug library, -but it is sometimes useful to configure this in the shared library. -Configure scripts should check for the function's existence rather -than assuming it is always in the debug library. +Expose the \fBcurses_trace\fP(3X) function +in the +.I ncurses(w) +shared and static libraries. +Normally, +it is available only in the debugging library. +(If +.B \-\-with\-termlib +is also specified, +.I tinfo(w) +rather than +.I ncurses(w) +supplies the deprecated \fBtrace\fP(3X) function.) +An application's configuration script should check +for the function's existence +rather than assuming its confinement to the debugging library. .SH FILES .TP .I @DATADIR@/tabset tab stop initialization database .TP -.I \*d +.I @TERMINFO@ compiled terminal capability database .SH NOTES X/Open Curses permits most functions it specifies to be made available @@ -1819,20 +2062,20 @@ those that move the cursor before another operation), and .bP -a few special cases. +in a few special cases. .PP If the standard output file descriptor of an .I \%ncurses program is redirected to something that is not a terminal device, the library writes screen updates to the standard error file descriptor. This was an undocumented feature of SVr3 -.IR curses . +.IR curses "." .PP See subsection \*(``Header Files\*('' below regarding symbols exposed by inclusion of \fI\%curses.h\fP. .SH EXTENSIONS .I \%ncurses -enables an application to capture mouse events on certain terminals, +enables an application to capture mouse events from certain terminals, including \fI\%xterm\fP(1); see \fB\%curs_mouse\fP(3X). .PP @@ -1872,14 +2115,17 @@ An .I \%ncurses application can eschew knowledge of +.I \%SCREEN +and .I \%WINDOW structure internals, instead using accessor functions such as +\fB\%is_cbreak\fP(3X) and \fB\%is_scrollok\fP(3X). .PP .I \%ncurses -enables an application to direct application output to a printer -attached to the terminal device; +enables an application to direct its output to a printer attached to the +terminal device; see \fB\%curs_print\fP(3X). .PP .I \%ncurses @@ -1889,37 +2135,35 @@ that can gather color information from them when many colors are supported. .PP -Some extensions are available only if .I \%ncurses permits modification of \fB\%unctrl\fP(3X)'s behavior; see \fB\%use_legacy_coding\fP(3X). -.I \%ncurses -is compiled to support them; -section \*(``ALTERNATE CONFIGURATIONS\*('' describes how. -.bP +.PP Rudimentary support for multi-threaded applications may be available; see \fBcurs_threads\fP(3X). -.bP +.PP Functions that ease the management of multiple screens can be exposed; see \fBcurs_sp_funcs\fP(3X). -.bP +.PP To aid applications to debug their memory usage, -.I ncurses +.I \%ncurses optionally offers functions to more aggressively free memory it dynamically allocates itself; see \fBcurs_memleaks\fP(3X). -.bP +.PP The library facilitates auditing and troubleshooting of its behavior; see \fBcurs_trace\fP(3X). -.bP -The compiler option +.PP +Compiling +.I \%ncurses +with the option .B \%\-DUSE_GETCAP -causes the library to fall back to reading +causes it to fall back to reading .I \%/etc/termcap if the terminal setup code cannot find a .I \%term\%info entry corresponding to -.IR TERM . +.IR TERM "." Use of this feature is not recommended, as it essentially includes an entire .I termcap @@ -1943,7 +2187,9 @@ .I \%ncurses intends base-level conformance with X/Open Curses, and supports all features of its enhanced level -except the \fB\%untic\fP utility. +except the +.I \%untic +utility. .PP Differences between X/Open Curses and .I \%ncurses @@ -1963,11 +2209,10 @@ This is done primarily to guard against programmer error. The standard interface does not provide a way for the library to tell an application which of several possible errors occurred. -Relying on this -(or some other) -extension adversely affects the portability of -.I curses -applications. +An application that relies on +.I \%ncurses +to check its function parameters for validity limits its portability and +robustness. .SS "Padding Differences" In historical .I curses @@ -1998,7 +2243,7 @@ itself includes the header files .I \%stdio.h and -.IR \%unctrl.h . +.IR \%unctrl.h "." .PP X/Open Curses has more to say, .RS 4 @@ -2006,20 +2251,20 @@ The inclusion of .I \%curses.h may make visible all symbols from the headers -.IR \%stdio.h , -.IR \%term.h , -.IR \%termios.h , +.IR \%stdio.h "," +.IR \%term.h "," +.IR \%termios.h "," and -.IR \%wchar.h . +.IR \%wchar.h "." .RE .PP but does not finish the story. A more complete account follows. .bP -Starting with 4BSD -.I curses -(1980) -all implementations have provided a +The first +.IR curses "," +in 4BSD, +provided a .I \%curses.h file. .IP @@ -2030,7 +2275,7 @@ and .I \%unctrl.h from an internal header file -.IR \%curses.ext , +.IR \%curses.ext "," where \*(``ext\*('' abbreviated \*(``externs\*(''. .IP @@ -2045,12 +2290,12 @@ but nothing in .I \%curses.h itself relied upon -.IR \%stdio.h . +.IR \%stdio.h "." .bP SVr2 .I curses added -.IR \%newterm , +.IR \%newterm "," which relies upon .I \%stdio.h because its function prototype employs the @@ -2062,9 +2307,9 @@ added .I \%putwin and -.IR \%getwin , +.IR \%getwin "," which also use -.IR \%stdio.h . +.IR \%stdio.h "." .IP X/Open Curses specifies all three of these functions. .IP @@ -2073,22 +2318,22 @@ and X/Open Curses do not require the developer to include .I \%stdio.h before -.IR \%curses.h . +.IR \%curses.h "." Both document use of .I curses as requiring only -.IR \%curses.h . +.IR \%curses.h "." .IP As a result, standard .I \%curses.h always includes -.IR \%stdio.h . +.IR \%stdio.h "." .bP X/Open Curses and SVr4 .I curses are inconsistent with respect to -.IR \%unctrl.h . +.IR \%unctrl.h "." .IP As noted in \fBcurs_util\fP(3X), .I \%ncurses @@ -2113,7 +2358,7 @@ to declare .I \%setupterm in -.IR \%curses.h , +.IR \%curses.h "," but .I \%ncurses and Solaris @@ -2125,7 +2370,7 @@ includes .I \%term.h and -.IR \% termios.h . +.IR \%termios.h "." Again, .I \%ncurses and Solaris @@ -2136,20 +2381,15 @@ .I \%curses.h .B may include -.IR \%term.h , +.IR \%term.h "," but does not require it to do so. .IP Some programs use functions declared in both .I \%curses.h and -.IR \%term.h , -and must include both header files in the same module. -Very old versions of AIX -.I curses -required inclusion of -.I \%curses.h -before -.IR \%term.h . +.IR \%term.h "," +and must include both header files in the same translation unit. +.\" Is that true in ncurses? Can we supply an example? --GBR .IP The header files supplied by .I \%ncurses @@ -2157,11 +2397,11 @@ so .IR \%ncurses 's own header files can be included in any order. -But for portability, -you should include +For portability even to old AIX systems, +include .I \%curses.h before -.IR \%term.h . +.IR \%term.h "." .bP X/Open Curses says \*(``may make visible\*('' because including a header file does not necessarily make visible all of the symbols in it @@ -2185,7 +2425,7 @@ its symbols .B may \" bold for consistency in this paragraph be made visible depending on the value of the -.B _XOPEN_SOURCE +.I \%_XOPEN_SOURCE feature test macro. .bP X/Open Curses mandates an application's inclusion of one standard C @@ -2218,11 +2458,11 @@ provided for the possibility that an application might include either .I \%varargs.h or -.IR \%stdarg.h . +.IR \%stdarg.h "." These represented contrasting approaches to handling variadic argument lists. The older interface, -.IR \%varargs.h , +.IR \%varargs.h "," used a pointer to .I char \" V7, 32V, System III, 3BSD for variadic functions' @@ -2230,9 +2470,9 @@ parameter. Later, the list acquired its own standard data type, -.IR \%va_list , +.IR \%va_list "," defined in -.IR \%stdarg.h , +.IR \%stdarg.h "," empowering the compiler to check the types of a function call's actual parameters against the formal ones declared in its prototype. .IP @@ -2244,7 +2484,7 @@ because they either have allowed for a special type, or, like -.IR \%ncurses , +.IR \%ncurses "," they include .I \%stdarg.h themselves to provide a portable interface. diff --git a/contrib/ncurses/man/new_pair.3x b/contrib/ncurses/man/new_pair.3x --- a/contrib/ncurses/man/new_pair.3x +++ b/contrib/ncurses/man/new_pair.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -29,8 +29,8 @@ .\" .\" Author: Thomas E. Dickey .\" -.\" $Id: new_pair.3x,v 1.46 2024/03/16 15:35:01 tom Exp $ -.TH new_pair 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: new_pair.3x,v 1.51 2025/08/16 19:11:47 tom Exp $ +.TH new_pair 3X 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -101,7 +101,7 @@ .RE .bP An application might use up to a few dozen color pairs to -implement a predefined color scheme. +implement a color scheme. .IP Beyond that lies in the realm of programs using the foreground and background colors for \*(``ASCII art\*('' @@ -115,7 +115,8 @@ .SS alloc_pair The \fBalloc_pair\fP function accepts parameters for foreground and background color, and -checks if that color combination is already associated with a color pair. +checks whether that color combination +is already associated with a color pair. .bP If the combination already exists, \fBalloc_pair\fP returns the existing pair. @@ -135,7 +136,8 @@ .SS find_pair The \fBfind_pair\fP function accepts parameters for foreground and background color, and -checks if that color combination is already associated with a color pair, +checks whether that color combination +is already associated with a color pair, returning the pair number if it has been allocated. Otherwise it returns \-1. .SS free_pair diff --git a/contrib/ncurses/man/panel.3x b/contrib/ncurses/man/panel.3x --- a/contrib/ncurses/man/panel.3x +++ b/contrib/ncurses/man/panel.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: panel.3x,v 1.63 2024/03/16 15:35:01 tom Exp $ -.TH panel 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: panel.3x,v 1.68 2024/12/28 21:26:21 tom Exp $ +.TH panel 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -46,7 +46,7 @@ .. .SH NAME panel \- -panel stack extension for \fIcurses\fP +manage overlapping \fIcurses\fP windows .SH SYNOPSIS .nf \fB#include @@ -215,8 +215,9 @@ but \fB\%doupdate\fP is the function responsible for updating the physical screen. .SH "RETURN VALUE" -Each routine that returns a pointer returns \fBNULL\fP if an error -occurs. +Each routine that returns a pointer returns +.I NULL +if an error occurs. Each routine that returns an int value returns \fBOK\fP if it executes successfully and \fBERR\fP if not. .PP @@ -226,7 +227,10 @@ an error is returned. .PP The \fB\%move_panel\fP function uses \fBmvwin\fP(3X), -and returns an error if \fB\%mvwin\fP returns an error. +and returns +.B ERR +if \fB\%mvwin\fP returns +.BR ERR "." .SH NOTES The header file \fI\%panel.h\fP itself includes the header file \fI\%curses.h\fP. @@ -260,9 +264,14 @@ such as Solaris, provide this library. .bP -\fI\%ncurses\fP (since version 0.6 in 1993) -and \fIPDCurses\fP (since version 2.2 in 1995) -provide a panel library whose common ancestor +.I \%ncurses +(since version 0.6 in 1993) +and +.I \%PDCurses +(since version 2.2 in 1995) +provide a +.I panel +library whose common ancestor is a public domain implementation by Warren Tucker published in \fIu386mon\fP 2.20 (1990). .IP diff --git a/contrib/ncurses/man/resizeterm.3x b/contrib/ncurses/man/resizeterm.3x --- a/contrib/ncurses/man/resizeterm.3x +++ b/contrib/ncurses/man/resizeterm.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2015,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -29,8 +29,8 @@ .\" .\" Author: Thomas E. Dickey 1996-on .\" -.\" $Id: resizeterm.3x,v 1.56 2024/03/16 15:35:01 tom Exp $ -.TH resizeterm 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: resizeterm.3x,v 1.65 2025/07/05 13:06:45 tom Exp $ +.TH resizeterm 3X 2025-07-05 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 @@ -62,11 +62,17 @@ rows and/or columns can be added to existing windows. The added cells should match the current attributes of the windows. .PP -If the calling program has not set up a handler for \fB\%SIGWINCH\fP -when it initializes \fI\%ncurses\fP -(e.g., using \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X)), -then \fI\%ncurses\fP sets a handler for \fB\%SIGWINCH\fP which notifies -the library when a window-size event has occurred. +If the application has not set up a handler for +.I \%SIGWINCH +when it initializes +.I \%ncurses +(by calling \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X)), +then +.I \%ncurses +establishes a +.I \%SIGWINCH +handler that notifies the library +when a window-resizing event has occurred. The library checks for this notification .bP when reading input data, @@ -80,10 +86,13 @@ When the library has found that the terminal's window-size has changed, it calls \fB\%resizeterm\fP to update its data structures. .PP -An application which establishes its own \fB\%SIGWINCH\fP handler +An application which establishes its own +.I \%SIGWINCH +handler can call \fB\%resizeterm\fP, but in that case, the library will not -see \fB\%SIGWINCH\fP, and proper layout will rely upon the application. -.SH FUNCTIONS +see +.IR \%SIGWINCH "," +and proper layout will rely upon the application. .SS resizeterm The function \fB\%resizeterm\fP resizes the standard and current windows (i.e., \fB\%stdscr\fP and \fB\%curscr\fP) @@ -94,7 +103,9 @@ Most of the work for \fB\%resizeterm\fP is done by the inner function \fB\%resize_term\fP. The outer function \fB\%resizeterm\fP adds bookkeeping -for the \fB\%SIGWINCH\fP handler, +for the +.I \%SIGWINCH +handler, as well as repainting the soft-key area (see \fB\%slk_touch\fP(3X)). .PP The \fB\%resize_term\fP function attempts to resize all windows. @@ -127,14 +138,19 @@ or if an error occurs while (re)allocating memory for the windows. .SH NOTES While these functions are intended to be used to support a signal handler -(i.e., for \fB\%SIGWINCH\fP), care should be taken to avoid invoking them in a +(i.e., for +.IR \%SIGWINCH ")," +care should be taken to avoid invoking them in a context where \fB\%malloc\fP or \fB\%realloc\fP may have been interrupted, since it uses those functions. .PP -If \fI\%ncurses\fP is configured to supply its own \fB\%SIGWINCH\fP +If \fI\%ncurses\fP is configured to supply its own +.I \%SIGWINCH handler, .bP -on receipt of a \fB\%SIGWINCH\fP, the handler sets a flag +on receipt of a +.IR \%SIGWINCH "," +the handler sets a flag .bP which is tested in \fB\%wgetch\fP(3X), @@ -158,7 +174,9 @@ If the environment variables \fILINES\fP or \fI\%COLUMNS\fP are set, this overrides the library's use of the window size obtained from the operating system. -Thus, even if a \fB\%SIGWINCH\fP is received, +Thus, even if a +.I \%SIGWINCH +is received, no screen size change may be recorded. .SH PORTABILITY It is possible to resize the screen with SVr4 \fIcurses\fP, @@ -170,8 +188,13 @@ .PP Doing that clears the screen and is visually distracting. .PP -This extension of \fI\%ncurses\fP was introduced in mid-1995. -It was adopted in NetBSD \fIcurses\fP (2001) and PDCurses (2003). +.I \%ncurses +introduced this extension in mid-1995. +NetBSD +.I curses +adopted it in 2001 and +.I \%PDCurses +in 2003. .SH AUTHORS Thomas Dickey (from an equivalent function written in 1988 for BSD \fIcurses\fP) .SH SEE ALSO diff --git a/contrib/ncurses/man/scr_dump.5 b/contrib/ncurses/man/scr_dump.5 --- a/contrib/ncurses/man/scr_dump.5 +++ b/contrib/ncurses/man/scr_dump.5 @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: scr_dump.5,v 1.46 2024/03/23 20:42:29 tom Exp $ -.TH scr_dump 5 2024-03-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "File formats" +.\" $Id: scr_dump.5,v 1.52 2025/04/05 21:56:26 tom Exp $ +.TH scr_dump 5 2025-04-05 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "File formats" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -87,6 +87,7 @@ .PP .RS 4 .EX +.nf # # ncurses5 (and before) did not use a magic number, # making screen dumps "data". @@ -94,6 +95,7 @@ # ncurses6 (2015) uses this format, ignoring byte-order 0 string \e210\e210\e210\e210ncurses ncurses6 screen image # +.fi .EE .RE .RE @@ -135,7 +137,7 @@ screen dumps. A brief survey of the existing implementations follows. .SS "X/Open Curses" -X/Open Curses, Issue 7 specifies little. +X/Open Curses Issue\ 7 specifies little. It says (boldface emphasis added) .RS 3 @@ -173,12 +175,14 @@ .PP .RS 4 .EX +.nf /* terminfo magic number */ #define MAGNUM 0432 /* curses screen dump magic number */ #define SVR2_DUMP_MAGIC_NUMBER 0433 #define SVR3_DUMP_MAGIC_NUMBER 0434 +.fi .EE .RE .PP @@ -193,8 +197,10 @@ .PP .RS 4 .EX +.nf /* curses screen dump magic number */ #define SVR4_DUMP_MAGIC_NUMBER 0435 +.fi .EE .RE .PP @@ -315,6 +321,7 @@ .PP .RS 4 .EX +.nf #include int @@ -339,6 +346,7 @@ endwin(); return 0; } +.fi .EE .RE .PP @@ -346,6 +354,7 @@ .PP .RS 4 .EX +.nf \e210\e210\e210\e210ncurses 6.0.20170415 _cury=5 _curx=11 @@ -368,6 +377,7 @@ 8:\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es 9:\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es 10:\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es +.fi .EE .RE .PP @@ -391,6 +401,7 @@ .PP .RS 4 .EX +.nf MAX=10,20 BEG=0,0 SCROLL=0,10 @@ -424,6 +435,7 @@ 9,0,0,1, 9,19,0,0, CUR=11,5 +.fi .EE .RE .PP @@ -439,6 +451,7 @@ .PP .RS 4 .EX +.nf 0000000 1c 01 c3 d6 f3 58 05 00 0b 00 0a 00 14 00 00 00 0000020 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 0000040 00 00 b8 1a 06 08 cc 1a 06 08 00 00 09 00 10 00 @@ -461,6 +474,7 @@ 0001620 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * 0002371 +.fi .EE .RE .SH AUTHORS diff --git a/contrib/ncurses/man/tabs.1 b/contrib/ncurses/man/tabs.1 --- a/contrib/ncurses/man/tabs.1 +++ b/contrib/ncurses/man/tabs.1 @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2008-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: tabs.1,v 1.59 2024/04/20 19:08:15 tom Exp $ -.TH @TABS@ 1 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" +.\" $Id: tabs.1,v 1.74 2025/08/16 19:11:47 tom Exp $ +.TH @TABS@ 1 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -78,7 +78,7 @@ .PP .RS 4 .EX -tabs \-8 +@TABS@ \-8 .EE .RE .PP @@ -128,8 +128,10 @@ .PP .RS 4 .EX -tabs 1,6,11,16,21 -tabs 1 6 11 16 21 +.nf +@TABS@ 1,6,11,16,21 +@TABS@ 1 6 11 16 21 +.fi .EE .RE .PP @@ -139,13 +141,13 @@ .PP .RS 4 .EX -tabs 1,+5,+5,+5,+5 +@TABS@ 1,+5,+5,+5,+5 .EE .RE .PP which is equivalent to the 1,6,11,16,21 example. -.SS "Predefined Tab Stops" -POSIX defines several predefined lists of tab stops. +.SS "Standard Tab Stops" +POSIX defines several lists of tab stops. .TP 5 .B \-a Assembler, IBM S/370, first format @@ -229,10 +231,10 @@ .I @DATADIR@/tabset tab stop initialization database .SH PORTABILITY -IEEE Std 1003.1/The Open Group Base Specifications Issue 7 +IEEE Std 1003.1/The Open Group Base Specifications Issue\ 7 (POSIX.1-2008) describes a -.B tabs +.I tabs utility. However, .bP @@ -247,8 +249,10 @@ .RB \%( smglp ) capabilities needed to support the feature. .bP -There is no counterpart in X/Open Curses Issue 7 for this utility, -unlike \fB@TPUT@\fP(1). +Unlike +.IR tput , +.I tabs +has no specification in X/Open Curses Issue\ 7. .PP The .B \-d @@ -259,7 +263,7 @@ extensions not provided by other implementations. .SH HISTORY A -.B tabs +.I tabs utility appeared in PWB/Unix 1.0 (1977). .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=PWB1/sys/source/s2/\ .\" tabs.c @@ -270,12 +274,12 @@ .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=3BSD/usr/src/cmd/\ .\" tabs.c (later the same year); -it supported a \*(``\-n\*('' option to set the first tab stop at the +it supported an option \*(``\-n\*('' to set the first tab stop at the left margin. That option is not specified by POSIX. .PP The PWB/Unix -.B tabs +.I tabs utility returned in System III (1980), and used built-in tables to support a half-dozen hardcopy terminal (printer) types. @@ -289,9 +293,9 @@ but retained the tables to support the printers. By this time, System\ V -.B tput +.I tput had incorporated the tab stop initialization feature of BSD's -.B tset +.I tset from 1982, but employed the .I \%term\%info @@ -299,57 +303,58 @@ .PP The .B +m -option was documented in the POSIX Base Specifications Issue 5 +option was documented in the POSIX Base Specifications Issue\ 5 (Unix98, 1997), -then omitted in Issue 6 +then omitted in Issue\ 6 (Unix03, 2004) without express motivation, though an introductory comment \*(``and optionally adjusts the margin\*('' remains, overlooked in the removal. The -.B tabs +.I tabs utility documented in Issues 6 and later has no mechanism for setting margins. The .B +m option in -.I \%ncurses -\fB\%@TABS@\fP differs from the SVr4 feature by using terminal -capabilities rather than built-in tables. +.IR \%ncurses 's +implementation +differs from the SVr4 feature by using terminal capabilities +rather than built-in tables. .PP POSIX documents no limit on the number of tab stops. Other implementations impose one; the limit is 20 in PWB/Unix's -.B tabs +.I tabs utility. While some terminals may not accept an arbitrary number of tab stops, .I \%ncurses -\fB\%@TABS@\fP attempts to set tab stops up to the right margin if the -list thereof is sufficiently long. +attempts to set tab stops up to the right margin +if the list thereof is sufficiently long. .PP -The \*(``Rationale\*('' section of the Issue 6 -.B tabs +The \*(``Rationale\*('' section of the Issue\ 6 +.I tabs reference page .\" https://pubs.opengroup.org/onlinepubs/009604499/utilities/tabs.html details how the committee considered redesigning the -.B tabs +.I tabs and -.B tput +.I tput utilities, without settling on an improved solution. It claims that .PP .RS 4 -\*(``no known historical version of +no known historical version of .I tabs -supports the capability of setting arbitrary tab stops.\*('' +supports the capability of setting arbitrary tab stops. .RE .PP The feature described in subsection \*(``Explicit Lists\*('' above was implemented in PWB/Unix, .\" see URL above -and permitted the setting of abitrary tab stops nevertheless. +and permitted the setting of arbitrary tab stops nevertheless. .SH SEE ALSO \fB\%@INFOCMP@\fP(1M), \fB\%@TSET@\fP(1), diff --git a/contrib/ncurses/man/term.5 b/contrib/ncurses/man/term.5 --- a/contrib/ncurses/man/term.5 +++ b/contrib/ncurses/man/term.5 @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: term.5,v 1.77 2024/04/20 21:24:19 tom Exp $ -.TH term 5 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "File formats" +.\" $Id: term.5,v 1.85 2025/08/16 19:11:47 tom Exp $ +.TH term 5 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "File formats" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -55,69 +55,102 @@ .el .IP \(bu 2 .. . -.ds d @TERMINFO@ .SH NAME term \- -compiled \fIterminfo\fR terminal description -.SH SYNOPSIS -.B term +compiled \fI\%term\%info\fP terminal description +.\"SH SYNOPSIS .SH DESCRIPTION +\fB\%@TIC@\fP(1) compiles a +.I \%term\%info +terminal type description, +and \fB\%setupterm\fP(3X) reads it. +A compiled description may be stored in a file or in a database of, +potentially, +many such descriptions. +Further, +a compiled description may be in one of two formats: +one similar to that used by System\ V, +and a newer, +extensible format employed exclusively by +.IR \%ncurses . .SS "Storage Location" -Compiled terminfo descriptions are placed under the directory \fB\*d\fP. -Two configurations are supported -(when building the \fI\%ncurses\fP libraries): +Compiled +.I \%term\%info descriptions are placed +under the directory +.IR \%@TERMINFO@ . +One of two configurations is selected +when building the +.I \%ncurses +libraries. .TP 5 .B directory tree A two-level scheme is used to avoid a linear search -of a huge Unix system directory: \fB\*d/c/name\fP where +of a huge Unix system directory: +.IR \%@TERMINFO@/ c / name +where .I name -is the name of the terminal, and +is the name of the terminal, +and .I c is the first character of .IR name . Thus, -.I act4 -can be found in the file \fB\*d/a/act4\fP. +the compiled description of terminal type \*(``act4\*('' +is found in the file +.IR \%@TERMINFO@/a/act4 . Synonyms for the same terminal are implemented by multiple links to the same compiled file. .TP 5 .B hashed database -Using Berkeley database, two types of records are stored: -the terminfo data in the same format as stored in a directory tree with -the terminfo's primary name as a key, +Using the Berkeley database API, +two types of records are stored: +the +.I \%term\%info +data in the same format as that stored in a directory tree with +the terminal's primary type name as a key, and records containing only aliases pointing to the primary name. .IP If built to write hashed databases, -\fI\%ncurses\fP can still read terminfo databases organized as a +.I \%ncurses +can still read +.I \%term\%info +databases organized as a directory tree, but cannot write entries into the directory tree. -It can write (or rewrite) entries in the hashed database. +It can write +(or rewrite) +entries in the hashed database. .IP -\fI\%ncurses\fP distinguishes the two cases in the \fI\%TERMINFO\fP and -\fI\%TERMINFO_DIRS\fP environment variable by assuming a directory tree -for entries that correspond to an existing directory, -and hashed database otherwise. +.I \%ncurses +distinguishes the two cases in the +.I \%TERMINFO +and +.I \%TERMINFO_DIRS +environment variable by assuming a directory tree for entries that +correspond to an existing directory, +and a hashed database otherwise. .SS "Legacy Storage Format" The format has been chosen so that it will be the same on all hardware. -An 8 or more bit byte is assumed, but no assumptions about byte ordering +A byte of at least eight bits' width is assumed, +but no assumptions about bit ordering or sign extension are made. .PP -The compiled file is created with the \fB@TIC@\fP program, -and read by the routine \fBsetupterm\fP(3X). The file is divided into six parts: .RS 5 -.TP 3 -a) \fIheader\fP, -.TP 3 -b) \fIterminal names\fP, -.TP 3 -c) \fIBoolean flags\fP, -.TP 3 -d) \fInumbers\fP, -.TP 3 -e) \fIstrings\fP, and -.TP 3 -f) \fIstring table\fP. +.IP (a) 4 +.IR header , +.IP (b) +.IR "terminal names" , +.IP (c) +.IR "Boolean flags" , +.IP (d) +.IR numbers , +.IP (e) +.IR strings , +and +.IP (f) +a +.IR "string table" . .RE .PP The \fIheader\fP section begins the file. @@ -126,54 +159,64 @@ These integers are .RS 5 .TP 5 -(1) the \fImagic number\fP (octal 0432); +(1) the \fImagic number\fP +(octal 0432); .TP 5 -(2) the size, in bytes, of the \fIterminal names\fP section; +(2) the size, +in bytes, +of the \fIterminal names\fP section; .TP 5 (3) the number of bytes in the \fIBoolean flags\fP section; .TP 5 (4) the number of short integers in the \fInumbers\fP section; .TP 5 -(5) the number of offsets (short integers) in the \fIstrings\fP section; +(5) the number of offsets +(short integers) +in the \fIstrings\fP section; .TP 5 -(6) the size, in bytes, of the \fIstring table\fP. +(6) the size, +in bytes, +of the \fIstring table\fP. .RE .PP The capabilities in the \fIBoolean flags\fP, -\fInumbers\fP, and +\fInumbers\fP, +and \fIstrings\fP -sections are in the same order as the file . +sections are in the same order as in the header file +.IR term.h . .PP -Short integers are signed, in the range \-32768 to 32767. -They are stored as two 8-bit bytes. -The first byte contains the least significant 8 bits of the value, -and the second byte contains the most significant 8 bits. -(Thus, the value represented is 256*second+first.) -This format corresponds to the hardware of the \s-1VAX\s+1 -and \s-1PDP\s+1-11 (that is, little-endian machines). -Machines where this does not correspond to the hardware must read the -integers as two bytes and compute the little-endian value. +Short integers are signed, +in the range \-32768 to 32767, +and stored in little-endian format. .PP Numbers in a terminal description, whether they are entries in the \fInumbers\fP or \fIstrings\fP table, are positive integers. Boolean flags are treated as positive one-byte integers. -In each case, those positive integers represent a terminal capability. -The terminal compiler @TIC@ uses negative integers to handle the cases where -a capability is not available: +In each case, +those positive integers represent a terminal capability. +The terminal compiler +.I \%@TIC@ +uses negative integers to handle the cases where a capability is not +available: .bP If a capability is absent from this terminal, -@TIC@ stores a \-1 in the corresponding table. +.I \%@TIC@ +stores a \-1 in the corresponding table. .IP -The integer value \-1 is represented by two bytes 0377, 0377. +The integer value \-1 is represented by two bytes 0377, +0377. .br Absent Boolean values are represented by the byte 0 (false). .bP If a capability has been canceled from this terminal, -@TIC@ stores a \-2 in the corresponding table. +.I \%@TIC@ +stores a \-2 in the corresponding table. .IP -The integer value \-2 is represented by two bytes 0377, 0376. +The integer value \-2 is represented by two bytes 0377, +0376. .br The Boolean value \-2 is represented by the byte 0376. .br @@ -181,18 +224,22 @@ Other negative values are illegal. .PP The \fIterminal names\fP section comes after the \fIheader\fP. -It contains the first line of the terminfo description, +It contains the first line of the +.I \%term\%info +description, listing the various names for the terminal, separated by the \*(``|\*('' character. The \fIterminal names\fP section is terminated with an \s-1ASCII NUL\s+1 character. .PP The \fIBoolean flags\fP section has one byte for each flag. -Boolean capabilities are either 1 or 0 (true or false) +Boolean capabilities are either 1 or 0 +(true or false) according to whether the terminal supports the given capability or not. .PP Between the \fIBoolean flags\fP section and the \fInumber\fP section, -a null byte will be inserted, if necessary, +a null byte will be inserted, +if necessary, to ensure that the \fInumber\fP section begins on an even byte This is a relic of the PDP\-11's word-addressed architecture, originally designed to avoid traps induced @@ -212,27 +259,42 @@ the \fIstrings\fP section. Each string is null-terminated. Special characters in \*^X or \ec notation are stored in their -interpreted form, not the printing representation. -Padding information $ and parameter information %x are -stored intact in uninterpreted form. +interpreted form, +not the printing representation. +Padding information +.BI $< nn > +and parameter information +.B %x +are stored intact in uninterpreted form. .SS "Extended Storage Format" -The previous section describes the conventional terminfo binary format. -With some minor variations of the offsets (see PORTABILITY), +The previous section describes the conventional +.I \%term\%info +binary format. +With some minor variations of the offsets +(see PORTABILITY), the same binary format is used in all modern Unix systems. -Each system uses a predefined set of Boolean, number or string capabilities. +Each system uses a standard set of Boolean, +numeric, +or string capabilities. .PP -The \fI\%ncurses\fP libraries and applications support -extended terminfo binary format, -allowing users to define capabilities which are loaded at runtime. -This -extension is made possible by using the fact that the other implementations -stop reading the terminfo data when they have reached the end of the size given -in the header. -\fI\%ncurses\fP checks the size, -and if it exceeds that due to the predefined data, +The +.I \%ncurses +libraries and applications support extended +.I \%term\%info +binary format, +allowing users to define capabilities that are loaded at runtime. +This extension is made possible by using the fact that the other +implementations stop reading the +.I \%term\%info +data when they reach the end of the size given in the header. +.I \%ncurses +checks the size, +and if it exceeds that specified in the header, continues to parse according to its own scheme. .PP -First, it reads the extended header (5 short integers): +First, +it reads the extended header +(5 short integers): .RS 5 .TP 5 (1) @@ -256,45 +318,62 @@ extended capability \fIvalues\fP. .PP Using the counts and sizes, -\fI\%ncurses\fP allocates arrays and reads data for the extended -capabilities in the same order as the header information. +.I \%ncurses +allocates arrays and reads data for the extended capabilities in the +same order as the header information. .PP The extended string table contains values for string capabilities. -After the end of these values, it contains the names for each of -the extended capabilities in order, e.g., Booleans, then numbers and -finally strings. +After the end of these values, +it contains the names for each of +the extended capabilities in order: +Boolean, +numeric, +and string. .PP By storing terminal descriptions in this way, -\fI\%ncurses\fP is able to provide a database useful with legacy -applications, -as well as providing data for applications which need more than the -predefined capabilities. -See \fBuser_caps\fP(5) for an overview -of the way \fI\%ncurses\fP uses this extended information. +.I \%ncurses +is able to provide a database useful with legacy applications, +as well as providing data for applications that require more information +about a terminal type than was anticipated +by X/Open Curses. +See \fB\%user_caps\fP(5) for an overview of the way +.I \%ncurses +uses this extended information. .PP -Applications which manipulate terminal data can use the definitions -described in \fBterm_variables\fP(3X) which associate the long capability -names with members of a \fBTERMTYPE\fP structure. +Applications that manipulate terminal data can use the definitions +described in \fB\%term_variables\fP(3X) associating the long capability +names with members of a +.I \%TERMTYPE +structure. . .SS "Extended Number Format" -On occasion, 16-bit signed integers are not large enough. -With \fI\%ncurses\fP 6.1, -a new format was introduced by making a few changes -to the legacy format: +On occasion, +16-bit signed integers are not large enough. +.I \%ncurses +6.1 introduced a new format +by making a few changes to the legacy format: .bP -a different magic number (octal 01036) +a different magic number +(octal 01036) .bP changing the type for the \fInumber\fP array from signed 16-bit integers to signed 32-bit integers. .PP -To maintain compatibility, the library presents the same data structures -to direct users of the \fBTERMTYPE\fP structure as in previous formats. -However, that cannot provide callers with the extended numbers. -The library uses a similar but hidden data structure \fBTERMTYPE2\fP -to provide data for the terminfo functions. +To maintain compatibility, +the library presents the same data structures +to direct users of the +.I \%TERMTYPE +structure as in previous formats. +However, +that cannot provide callers with the extended numbers. +The library uses a similar but hidden data structure +.I \%TERMTYPE2 +to provide data for the +.I \%term\%info +functions. .SH FILES .TP -.I \*d +.I @TERMINFO@ compiled terminal description database .SH PORTABILITY .SS setupterm @@ -313,69 +392,101 @@ .B setupterm must be prepared for both possibilities \- this is why the numbers and sizes are included. -Also, new capabilities must always be added at the end of the lists -of Boolean, number, and string capabilities. +Also, +new capabilities must always be added at the end of the lists +of Boolean, +number, +and string capabilities. .SS "Binary Format" -X/Open Curses does not specify a format for the terminfo database. -System V curses used a directory-tree of binary files, +X/Open Curses does not specify a format for the +.I \%term\%info +database. +System\ V +.I curses +used a directory-tree of binary files, one per terminal description. .PP -Despite the consistent use of little-endian for numbers and the otherwise -self-describing format, it is not wise to count on portability of binary -terminfo entries between commercial Unix versions. -The problem is that there -are at least three versions of terminfo (under HP\-UX, AIX, and OSF/1) which -diverged from System V terminfo after SVr1, and have added extension -capabilities to the string table that (in the binary format) collide with -System V and X/Open Curses extensions. -See \fBterminfo\fP(5) for detailed -discussion of terminfo source compatibility issues. +Despite the consistent use of little-endian numbers and the otherwise +self-describing format, +it is not wise to count on portability of binary +.I \%term\%info +entries between commercial Unix versions. +The problem is that there are at least three versions of +.I \%term\%info +(under HP\-UX, +AIX, +and OSF/1) +each of which diverged from System\ V +.I \%term\%info +after SVr1, +and added extension capabilities to the string table that +(in the binary format) +collide with System\ V and X/Open Curses extensions. +See \fB\%terminfo\fP(5) for detailed +discussion of +.I \%term\%info +source compatibility issues. .PP This implementation is by default compatible with the binary -terminfo format used by Solaris curses, +.I \%term\%info +format used by Solaris +.IR curses , except in a few less-used details where it was found that the latter did not match X/Open Curses. The format used by the other Unix versions -can be matched by building \fI\%ncurses\fP +can be matched by building +.I \%ncurses with different configuration options. .SS "Magic Codes" -The magic number in a binary terminfo file is the first 16-bits (two bytes). -Besides making it more reliable for the library to check that a file -is terminfo, -utilities such as \fBfile\fP(1) also use that to tell what the file-format is. -System V defined more than one magic number, -with 0433, 0435 as screen-dumps (see \fBscr_dump\fP(5)). +The magic number in a binary +.I \%term\%info +file is the first 16 bits +(two bytes). +Besides making it more reliable for the library to check that a file is +.IR \%term\%info , +utilities such as \fIfile\fP(1) also use that to tell what the +file-format is. +System\ V defined more than one magic number, +with 0433, +0435 as screen-dumps +(see \fB\%scr_dump\fP(5)). This implementation uses 01036 as a continuation of that sequence, but with a different high-order byte to avoid confusion. .SS "The \fITERMTYPE\fP Structure" -Direct access to the \fBTERMTYPE\fP structure is provided for legacy -applications. -Portable applications should use the \fBtigetflag\fP and related functions -described in \fBcurs_terminfo\fP(3X) for reading terminal capabilities. +Direct access to the +.I \%TERMTYPE +structure is provided for legacy applications. +Portable applications should use \fB\%tigetflag\fP(3X) and related +functions to read terminal capabilities. .SS "Mixed-case Terminal Names" A small number of terminal descriptions use uppercase characters in their names. -If the underlying filesystem ignores the difference between +If the underlying file system ignores the difference between uppercase and lowercase, -\fI\%ncurses\fP represents the \*(``first character\*('' -of the terminal name used as -the intermediate level of a directory tree in (two-character) hexadecimal form. +.I \%ncurses +represents the \*(``first character\*('' of the terminal name used as +the intermediate level of a directory tree in (two-character) +hexadecimal form. .SS Limits -\fI\%ncurses\fP stores compiled terminal descriptions -in three related formats, -described in the sections +.I \%ncurses +stores compiled terminal descriptions in three related formats, +described in the subsections .bP -\fBLEGACY STORAGE FORMAT\fP, and +.BR "Legacy Storage Format" , +and .bP -\fBEXTENDED STORAGE FORMAT\fP, and +.BR "Extended Storage Format" , +and .bP -\fBEXTENDED NUMBER FORMAT\fP. +.BR "Extended Number Format" . .PP The legacy storage format and the extended number format differ by -the types of numeric capability which they can store -(i.e., 16-bit versus 32-bit integers). -The extended storage format introduced by \fI\%ncurses\fP 5.0 adds data -to either of these formats. +the types of numeric capability that they can store +(for example, +16- versus 32-bit integers). +The extended storage format introduced by +.I \%ncurses +5.0 adds data to either of these formats. .PP Some limitations apply: .bP @@ -390,19 +501,25 @@ The legacy format could have supported 32768-byte entries, but was limited to a virtual memory page's 4096 bytes. .SH EXAMPLES -As an example, here is a description for the Lear-Siegler -ADM\-3, a popular though rather stupid early terminal: +Here is a +.I \%term\%info +description of the Lear-Siegler ADM-3, +a popular though rather stupid early terminal. .PP .EX +.nf adm3a|lsi adm3a, am, cols#80, lines#24, bel=\*^G, clear=\e032$<1>, cr=\*^M, cub1=\*^H, cud1=\*^J, cuf1=\*^L, cup=\eE=%p1%{32}%+%c%p2%{32}%+%c, cuu1=\*^K, home=\*^\*^, ind=\*^J, +.fi .EE .PP -and a hexadecimal dump of the compiled terminal description: +A hexadecimal dump of its compiled terminal description +(in legacy format) +follows. .PP .if t .in +4n .ft \*(CW @@ -436,15 +553,27 @@ .SH AUTHORS Thomas E. Dickey .br -extended terminfo format for \fI\%ncurses\fP 5.0 +extended +.I \%term\%info +format for +.I \%ncurses +5.0 .br -hashed database support for \fI\%ncurses\fP 5.6 +hashed database support for +.I \%ncurses +5.6 .br -extended number support for \fI\%ncurses\fP 6.1 +extended number support for +.I \%ncurses +6.1 .sp Eric S. Raymond .br -documented legacy terminfo format, e.g., from \fIpcurses\fP. +documented legacy +.I \%term\%info +format +(that used by +.IR \%pcurses ). .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_terminfo\fP(3X), diff --git a/contrib/ncurses/man/term.7 b/contrib/ncurses/man/term.7 --- a/contrib/ncurses/man/term.7 +++ b/contrib/ncurses/man/term.7 @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2011,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: term.7,v 1.48 2024/03/16 15:35:01 tom Exp $ -.TH term 7 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" Miscellaneous +.\" $Id: term.7,v 1.52 2025/08/16 20:08:21 tom Exp $ +.TH term 7 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" Miscellaneous .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -40,7 +40,6 @@ .el .ds '' "" .\} . -.ds d @TERMINFO@ .SH NAME term \- conventions for naming terminal types @@ -83,7 +82,7 @@ which you wish to override the system default type for your line. .PP Terminal type descriptions are stored as files of capability data underneath -\*d. +.IR \%@TERMINFO@ "." To browse a list of all terminal names recognized by the system, do .sp @TOE@ | more @@ -97,8 +96,9 @@ @INFOCMP@ \fIentry_name\fP .sp where \fIentry_name\fP is the name of the type you wish to examine (and the -name of its capability file the subdirectory of \*d named for its first -letter). +name of its capability file the subdirectory of +.I \%@TERMINFO@ +named for its first letter). This command dumps a capability file in the text format described by \fBterminfo\fP(5). .PP @@ -221,7 +221,7 @@ on the \fITERM\fP environment variable when no \-T option is specified. .SH FILES .TP -.I \*d +.I @TERMINFO@ compiled terminal description database .TP .I /etc/inittab diff --git a/contrib/ncurses/man/term_variables.3x b/contrib/ncurses/man/term_variables.3x --- a/contrib/ncurses/man/term_variables.3x +++ b/contrib/ncurses/man/term_variables.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-2024,2025 Thomas E. Dickey * .\" Copyright 2010-2015,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: term_variables.3x,v 1.36 2024/03/16 15:35:01 tom Exp $ -.TH term_variables 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: term_variables.3x,v 1.44 2025/11/12 01:27:41 tom Exp $ +.TH term_variables 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -81,99 +81,193 @@ \fBNCURSES_CONST char * const strnames[]; .fi .SH DESCRIPTION -This page summarizes variables provided by the \fBcurses\fP library's -low-level terminfo interface. -A more complete description is given in the \fBcurs_terminfo\fP(3X) manual page. -.PP -Depending on the configuration, these may be actual variables, -or macros (see \fBcurs_threads\fP(3X)) -which provide read-only access to \fIcurses\fP's state. -In either case, applications should treat them as read-only to avoid -confusing the library. +This page summarizes variables provided by the +.I curses +library's lower-level +.I \%term\%info +interface. +Locate a more complete description in the \fBcurs_terminfo\fP(3X) manual +page. +.PP +Depending on +.IR \%ncurses 's +build-time configuration, +these may be actual variables, +or macros +(see \fBcurs_threads\fP(3X)) +that provide read-only access to +.IR curses 's +state. +In either case, +applications should treat them as read-only to avoid confusing the +library. .SS "Alternate Character Set Mapping" -After initializing the curses or terminfo interfaces, -the \fBacs_map\fP array holds information used to translate cells -with the \fBA_ALTCHARSET\fP video attribute into line-drawing characters. +After initializing the +.I curses +or +.I \%term\%info +interfaces, +the +.B acs_map +array holds information used to translate cells with the +.B \%A_ALTCHARSET +video attribute into line-drawing characters. .PP The encoding of the information in this array has changed periodically. -Application developers need only know that it is used for the \*(``ACS_\*('' -constants in . +Application developers need only know that it is used for the +\*(``ACS_\*('' constants in +.IR \%curses.h "." .PP -The comparable data for the wide-character library is a private variable. +The comparable data for the wide-character library are not exposed as +symbols in the API. .SS "Current Terminal Data" -After initializing the curses or terminfo interfaces, -the \fBcur_term\fP contains data describing the current terminal. -This variable is also set as a side-effect of \fBset_term\fP(3X) -and \fBdelscreen\fP(3X). -.PP -It is possible to save a value of \fBcur_term\fP for subsequent -use as a parameter to \fBset_term\fP, for switching between screens. -Alternatively, one can save the return value from \fBnewterm\fP -or \fBsetupterm\fP(3X) to reuse in \fBset_term\fP. +After initializing the +.I curses +or +.I \%term\%info +interfaces, +.B cur_term +contains data describing the current terminal. +It is also updated as a side effect of \fBset_term\fP(3X) and +\fBdelscreen\fP(3X). +.PP +It is possible to save a value of +.B cur_term +for subsequent use as a parameter to \fBset_term\fP(3X) +for switching between screens. +Alternatively, +one can save the return value from \fBnewterm\fP(3X) or +\fBsetupterm\fP(3X) to reuse in \fBset_term\fP(3X). .SS "\fIterminfo\fP Lookup Tables" The \fB@TIC@\fP(1) and \fB@INFOCMP@\fP(1) programs use lookup tables for -the long and short names of terminfo capabilities, -as well as the corresponding names for termcap capabilities. +the long and short names of +.I \%term\%info +capabilities, +as well as the corresponding names for +.I termcap +capabilities. These are available to other applications, -although the hash-tables used by -the terminfo and termcap functions are not available. -.PP -The long terminfo capability names use a \*(``f\*('' (eff) in their names: -\fBboolfnames\fP, -\fBnumfnames\fP, and -\fBstrfnames\fP. -.PP -These are the short names for terminfo capabilities: -\fBboolnames\fP, -\fBnumnames\fP, and -\fBstrnames\fP. -.PP -These are the corresponding names used for termcap descriptions: -\fBboolcodes\fP, -\fBnumcodes\fP, and -\fBstrcodes\fP. +though the hash tables used by the +.I \%term\%info +and +.I termcap +functions are not. +.PP +.I \%term\%info +stores capability names in arrays with an \*(``f\*('' (eff) in their +names: +.BR \%boolfnames "," +.BR \%numfnames "," +and +.BR \%strfnames "." +It stores the briefer capability codes in arrays without the +\*(``f\*('': +.BR \%boolnames "," +.BR \%numnames "," +and +.BR \%strnames "." +The corresponding +.I termcap +capability codes are stored in +.BR \%boolcodes "," +.BR \%numcodes "," +and +.BR \%strcodes "." +\fB\%terminfo\fP(5) catalogs these. .\" .SS "Terminal Type" A terminal description begins with one or more terminal names separated by \*(``|\*('' (vertical bars). -On initialization of the curses or terminfo interfaces, -\fBsetupterm\fP(3X) copies the terminal names to the array \fBttytype\fP. +On initialization of the +.I curses +or +.I \%term\%info +interfaces, +\fBsetupterm\fP(3X) copies the terminal name to the array +.BR ttytype "." .\" .SS "\fIterminfo\fP Names" -In addition to the variables, \fB\fP also defines a symbol for each -terminfo capability \fIlong name\fP. -These are in terms of the symbol \fBCUR\fP, +In addition to the variables, +.I term.h +also defines a symbol for each +.I \%term\%info +capability name. +These are in terms of the symbol +.BR CUR "," which is defined .PP +.RS .EX #define CUR ((TERMTYPE *)(cur_term))\-> .EE +.RE .PP -These symbols provide a faster method of accessing terminfo capabilities -than using \fBtigetstr\fP(3X), etc. +These symbols provide a faster method of accessing +.I \%term\%info +capabilities than using, +for example, +\fBtigetstr\fP(3X). .PP -The actual definition of \fBCUR\fP depends upon the implementation, -but each terminfo library provides these long names defined to point -into the current terminal description loaded into memory. +The definition of +.B CUR +is implementation-dependent, +but each +.I \%term\%info +library defines these names to point +into the in-memory description of the current terminal. +For example, +in +.IR \%ncurses "," +the expressions +.B tigetstr("key_dc") +and +\*(``\c\" `` string not reliable in a macro call on DWB/Heirloom nroffs +.B "CUR Strings[59]\c" +\*('' \" '' string not reliable in a macro call on DWB/Heirloom nroffs +are equivalent. .\" -.SH NOTES -The low-level terminfo interface is initialized using -\fB\%setupterm\fP(3X). -The upper-level curses interface uses the low-level terminfo interface, -internally. +.SS "\fIterminfo\fP and \fIcurses" +\fB\%setupterm\fP(3X) initializes the lower-level +.I \%term\%info +interface. +The higher-level +.I curses +interface uses the +.I \%term\%info +interface internally; +the symbol +.B SP +bridges the +.I curses +.I SCREEN +type with the +.I \%term\%info +.I TERMINAL +type. .\" .SH PORTABILITY -X/Open Curses does not describe any of these except for \fBcur_term\fP. -(The inclusion of \fBcur_term\fP appears to be an oversight, -since other comparable low-level information is omitted by X/Open). +X/Open Curses does not describe any of these symbols except for +.IR \%cur_term "." +(The inclusion of +.I \%cur_term +appears to be an oversight, +since other comparable low-level information is omitted by X/Open.) .PP Other implementations may have comparable variables. Some implementations provide the variables in their libraries, but omit them from the header files. .PP -All implementations which provide terminfo interfaces add definitions -as described in the \fBTerminfo Names\fP section. -Most, but not all, base the definition upon the \fBcur_term\fP variable. +All implementations that provide +.I \%term\%info +interfaces add definitions +as described in the +.RI \*(`` terminfo +Names\*('' section above. +Most, +but not all, +base the definition upon the +.I \%cur_term +variable. .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_terminfo\fP(3X), diff --git a/contrib/ncurses/man/terminfo.head b/contrib/ncurses/man/terminfo.head --- a/contrib/ncurses/man/terminfo.head +++ b/contrib/ncurses/man/terminfo.head @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: terminfo.head,v 1.65 2024/04/20 21:14:00 tom Exp $ -.TH terminfo 5 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "File formats" +.\" $Id: terminfo.head,v 1.69 2025/08/16 21:50:23 tom Exp $ +.TH terminfo 5 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "File formats" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -51,12 +51,11 @@ .el .IP \(bu 2 .. . -.ds d @TERMINFO@ .SH NAME \fB\%terminfo\fP \- terminal capability database .SH SYNOPSIS -\*d/*/* +@TERMINFO@/*/* .SH DESCRIPTION .I Terminfo is a database describing terminals, @@ -222,6 +221,6 @@ An entry included via \fBuse\fP can contain canceled capabilities, which have the same effect as if those cancels were inline in the using terminal entry. -.SS "Predefined Capabilities" +.SS "Standard Capabilities" .\" Head of terminfo man page ends here .ps -1 diff --git a/contrib/ncurses/man/terminfo.tail b/contrib/ncurses/man/terminfo.tail --- a/contrib/ncurses/man/terminfo.tail +++ b/contrib/ncurses/man/terminfo.tail @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,66 +27,118 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: terminfo.tail,v 1.148 2024/04/20 21:24:19 tom Exp $ +.\" $Id: terminfo.tail,v 1.163 2025/11/12 01:01:34 Branden.Robinson Exp $ .ps +1 .SS "User-Defined Capabilities" . -The preceding section listed the \fIpredefined\fP capabilities. -They deal with some special features for terminals no longer -(or possibly never) produced. -Occasionally there are special features of newer terminals which -are awkward or impossible to represent by reusing the predefined +The preceding section listed the +.I standard capabilities. -.PP -\fI\%ncurses\fP addresses this limitation by allowing user-defined -capabilities. -The \fB@TIC@\fP and \fB@INFOCMP@\fP programs provide -the \fB\-x\fP option for this purpose. -When \fB\-x\fP is set, -\fB@TIC@\fP treats unknown capabilities as user-defined. -That is, if \fB@TIC@\fP encounters a capability name -which it does not recognize, -it infers its type (Boolean, number or string) from the syntax +Some are esoteric, +supporting functionality that terminal emulators do not implement, +or may never have been realized in manufactured hardware. +Occasionally, +emulators have special features +that are awkward or impossible to represent +via standard capabilities. +.PP +.I \%ncurses +addresses this limitation by allowing user-defined capabilities. +The +.B \%@TIC@ +and +.B \%@INFOCMP@ +programs provide an +.B \-x +option for this purpose. +When +.B \-x +is used, +.B \%@TIC@ +treats unknown capabilities as user-defined. +That is, +if +.B \%@TIC@ +encounters a capability name +that it does not recognize, +the program infers the capability's type +(Boolean, +numeric, +or +string) +from the syntax of the capability value and makes an extended table entry for that capability. -The \fBuse_extended_names\fP(3X) function makes this information +\fBuse_extended_names\fP(3X) makes this information conditionally available to applications. -The \fI\%ncurses\fP library provides the data leaving most of the -behavior to applications: -.bP -User-defined capability strings whose name begins -with \*(``k\*('' are treated as function keys. -.bP -The types (Boolean, number, string) determined by \fB@TIC@\fP -can be inferred by successful calls on \fBtigetflag\fP, etc. +.I \%ncurses +library functions supply callers with capability data, +the interpretation of which is mostly up to the application. +.bP +.I \%ncurses +treats user-defined string capabilities +whose names begin with \*(``k\*('' +as function keys. +.bP +Capability types +(Boolean, +numeric, +or +string) +determined by +.B \%@TIC@ +can be inferred by successful +\fB\%tigetflag\fP(3X), +\fB\%tigetnum\fP(3X), +and +\fB\%tigetstr\fP(3X) +calls. .bP If the capability name happens to be two characters, the capability is also available through the termcap interface. .PP -While termcap is said to be extensible because it does not use a predefined set -of capabilities, -in practice it has been limited to the capabilities defined by -terminfo implementations. +While +.I termcap +is said to be extensible because it mandates no capabilities, +in practice it has been limited to those defined by +.I \%term\%info +implementations. As a rule, -user-defined capabilities intended for use by termcap applications should -be limited to Booleans and numbers to avoid running past the 1023 byte -limit assumed by termcap implementations and their applications. -In particular, providing extended sets of function keys (past the 60 -numbered keys and the handful of special named keys) is best done using -the longer names available using terminfo. -.PP -The \fI\%ncurses\fP library uses a few of these user-defined -capabilities, +employ only user-defined capabilities of Boolean and numeric type +with +.I termcap +applications to avoid overrunning the 1023 byte limit +assumed by +.I termcap +implementations and their applications. +Specifically, +support for extended sets of function keys +(past the 60 numbered keys and the handful of special named keys) +is better achieved with longer names available via +.IR \%term\%info "." +.PP +The +.I \%ncurses +library uses a few of these user-defined capabilities, as described in \fBuser_caps\fR(5). -Other user-defined capabilities (including function keys) are -described in the terminal database, in the section on -.I "NCURSES USER-DEFINABLE CAPABILITIES" +For other user-defined capabilities, +including function keys, +consult the source form of the terminal database, +.IR \%terminfo.src "," +under the heading \*(``NCURSES USER-DEFINABLE CAPABILITIES\*(''. . .SS "A Sample Entry" . -The following entry, describing an ANSI-standard terminal, is representative -of what a \fBterminfo\fP entry for a modern terminal typically looks like. +The following entry, describing an ANSI\ X3.64- +(or ECMA-48-) +-standard terminal +(henceforth \*(``ANSI-standard\*('' for brevity), +is representative +of what a +.I \%term\%info +entry for a modern terminal typically looks like. .PP .EX +.nf \s-2ansi|ansi/pc\-term compatible with color, am, mc5i, mir, msgr, colors#8, cols#80, it#8, lines#24, ncv#3, pairs#64, @@ -117,6 +169,7 @@ sgr0=\eE[0;10m, smacs=\eE[11m, smpch=\eE[11m, smso=\eE[7m, smul=\eE[4m, tbc=\eE[3g, u6=\eE[%i%d;%dR, u7=\eE[6n, u8=\eE[?%[;0123456789]c, u9=\eE[c, vpa=\eE[%i%p1%dd, +.fi .EE .PP Entries may continue onto multiple lines by placing white space at @@ -186,7 +239,8 @@ X/Open Curses does not say what \*(``appropriate \fIx\fP\*('' might be. In practice, that is a printable ASCII graphic character. The special case \*(``\*^?\*('' is interpreted as DEL (127). -In all other cases, the character value is AND'd with 0x1f, +In all other cases, +the character value is logically \*(``and\*(''-ed with 0x1f, mapping to ASCII control codes in the range 0 through 31. .PP Other escapes include @@ -277,14 +331,14 @@ .IP An empty pathname (i.e., if the variable begins or ends with a colon, or contains adjacent colons) -is interpreted as the system location \fI\*d\fP. +is interpreted as the system location \fI@TERMINFO@\fP. .bP Finally, \fI\%ncurses\fP searches these compiled-in locations: .RS .bP a list of directories (@TERMINFO_DIRS@), and .bP -the system terminfo directory, \fI\*d\fP +the system terminfo directory, \fI@TERMINFO@\fP .RE .PP The \fBTERMINFO\fP variable can contain a terminal description instead @@ -348,7 +402,7 @@ applies to storage scope terminals, such as \s-1TEKTRONIX\s+1 4010 series, as well as hard copy and APL terminals.) If there is a code to move the cursor to the left edge of the current -row, give this as +line, give this as .BR cr . (Normally this will be carriage return, control/M.) If there is a code to produce an audible signal (bell, beep, etc) @@ -412,7 +466,7 @@ .B bw is given, then a .B cub1 -from the left edge will move to the right edge of the previous row. +from the left edge will move to the right edge of the previous line. If .B bw is not given, the effect is undefined. @@ -448,11 +502,13 @@ while the Lear Siegler \s-1ADM-3\s0 is described as .PP .EX +.nf .\".in -2 \s-1adm3\||\|3\||\|lsi adm3, am, bel=\*^G, clear=\*^Z, cols#80, cr=\*^M, cub1=\*^H, cud1=\*^J, ind=\*^J, lines#24,\s+1 .\".in +2 +.fi .EE .SS "Parameterized Strings" Cursor addressing and other strings requiring parameters @@ -462,8 +518,8 @@ For example, to address the cursor, the .B cup capability is given, using two parameters: -the row and column to address to. -(Rows and columns are numbered from zero and refer to the +the line and column to address to. +(Lines 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 @@ -569,13 +625,15 @@ arithmetic (%m is \fImod\fP): \fIpush(pop() op pop())\fP .TP \fB%&\fP, \fB%|\fP, \fB%\*^\fP -bit operations (AND, OR and exclusive-OR): \fIpush(pop() op pop())\fP +bit operations +(\*(``and\*('', \*(``or\*('' and exclusive \*(``or\*(''): +\fIpush(pop() op pop())\fP .TP \fB%=\fP, \fB%>\fP, \fB%<\fP logical operations: \fIpush(pop() op pop())\fP .TP \fB%A\fP, \fB%O\fP -logical AND and OR operations (for conditionals) +logical \*(``and\*('' and \*(``or\*('' operations (for conditionals) .TP \fB%!\fP, \fB%\*~\fP unary operations (logical and bit complement): \fIpush(op pop())\fP @@ -608,17 +666,17 @@ \fB%P\fP and \fB%g\fP variables are persistent across escape-string evaluations. .PP -Consider the HP2645, which, to get to row 3 and column 12, needs +Consider the HP2645, which, to get to line 3 and column 12, needs to be sent \eE&a12c03Y padded for 6 milliseconds. -The order of the rows and columns is inverted here, -and the row and column are printed as two digits. +The order of the lines and columns is inverted here, +and the lines and column are printed as two digits. The corresponding terminal description is expressed thus: .RS cup=\eE&a%p2%dc%p1%dY$<6>, .RE .PP -The Microterm \s-1ACT-IV\s0 needs the current row and column sent -preceded by a \fB\*^T\fP, with the row and column simply encoded in binary, +The Microterm \s-1ACT-IV\s0 needs the current line and column sent +preceded by a \fB\*^T\fP, with the line and column simply encoded in binary, .RS cup=\*^T%p1%c%p2%c .RE @@ -632,10 +690,13 @@ tabs are never expanded, so \et is safe to send. This turns out to be essential for the Ann Arbor 4080.) .PP -A final example is the \s-1LSI ADM\s0-3a, which uses row and column -offset by a blank character, thus +A final example is the LSI ADM-3A, +which uses line and column offset by a space, +thus .RS +.EX cup=\eE=%p1%\*' \*'%+%c%p2%\*' \*'%+%c +.EE .RE .PP After sending \*(``\eE=\*('', this pushes the first parameter, pushes the @@ -656,7 +717,7 @@ (Thus, the \eEH sequence on HP terminals cannot be used for .BR home .) .PP -If the terminal has row or column absolute cursor addressing, +If the terminal has line or column absolute cursor addressing, these can be given as single parameter capabilities .B hpa (horizontal position absolute) @@ -713,7 +774,7 @@ line position, and .bP parameterized capabilities for setting the top, bottom, left, right margins -given the number of rows or columns. +given the number of lines or columns. .RE .PP In practice, the categorization into \*(``terminal\*('' and \*(``printer\*('' @@ -744,8 +805,8 @@ .PP .TS center; -lb lb -lb l . +Lb Lb +Lb L . Name Description _ smgl Set left margin at current column @@ -1008,7 +1069,7 @@ with one parameter, .IR n , to delete -.IR n "characters," +.IR n " characters," and delete mode by giving \fBsmdc\fP and \fBrmdc\fP to enter and exit delete mode (any mode the terminal needs to be placed in for @@ -1088,8 +1149,8 @@ .PP .TS center; -lb lb lb -l l l . +Lb Lb Lb +L L L . tparm Parameter Attribute Escape Sequence _ none none \eE[0m @@ -1123,8 +1184,8 @@ .ne 11 .TS center; -lb lb lb -l l l . +Lb Lb Lb +L L L . Sequence When to Output terminfo Translation _ \eE[0 always \eE[0 @@ -1140,8 +1201,10 @@ Putting this all together into the sgr sequence gives: .PP .EX +.nf sgr=\eE[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p4%t;5%; %?%p1%p3%|%t;7%;%?%p7%t;8%;m%?%p9%t\e016%e\e017%;, +.fi .EE .PP Remember that if you specify sgr, you must also specify sgr0. @@ -1296,38 +1359,61 @@ \fBsmln\fP is normally output after one or more pln sequences to make sure that the change becomes visible. .SS "Tabs and Initialization" -A few capabilities are used only for tabs: -.bP -If the terminal has hardware tabs, the command to advance to the next -tab stop can be given as -.B ht -(usually control/I). -.bP -A \*(``back-tab\*('' command which moves leftward to the preceding tab stop can -be given as -.BR cbt . +A few capabilities are used only to manage tab stops. +.bP +If the terminal has hardware tabs, +specify the character sequence that advances to the next tab stop +as the value of the +.B tab +.RB ( ht ) +string capability +(usually Control+I). +.bP +Specify a character sequence that retreats +(moves leftward) +to the preceding tab stop +as the value of the +.B \%back_tab +.RB ( cbt ) +string capability. .IP -By convention, if the teletype modes indicate that tabs are being -expanded by the computer rather than being sent to the terminal, -programs should not use -.B ht +By convention, +if the terminal modes are configured such that tabs are expanded +by the host rather than terminal, +applications should not employ the +.B tab +.RB ( ht ) or -.B cbt -even if they are present, since the user may not have the tab stops -properly set. +.B \%back_tab +.RB ( cbt ) +capabilities even if they are present, +since the user may not have the tab stops properly set. .bP -If the terminal has hardware tabs which are initially set every +If the terminal has hardware tab stops that are set at every +.I n +character cells when the terminal is powered up, +specify .I n -spaces when the terminal is powered up, -the numeric parameter -.B it -is given, showing the number of spaces the tabs are set to. +as the value of the the numeric capability +.B \%init_tabs +.RB ( it )\c +\&. .IP -The \fBit\fP capability is normally used by the \fB@TSET@\fP -command to determine whether to set the mode for hardware tab expansion, -and whether to set the tab stops. +The +.B \%@TSET@ +and +.RB \*(`` \%@TPUT@ +.BR init \*('' +commands interpret the presence of the +.B \%init_tabs +.RB ( it ) +capability as implying that the terminal +is responsible for tab stop expansion +as well as an instruction to set the tab stops to its value. If the terminal has tab stops that can be saved in non-volatile memory, -the terminfo description can assume that they are properly set. +its +.I \%term\%info +type description can assume that they are properly set. .PP Other capabilities include @@ -1446,7 +1532,7 @@ (clear all tab stops) and .B hts -(set a tab stop in the current column of every row). +(set a tab stop in the current column of every line). If a more complex sequence is needed to set the tabs than can be described by this, the sequence can be placed in .B is2 @@ -1618,40 +1704,85 @@ Then read off the VT100/your terminal character pairs right to left in sequence; these become the ACSC string. .SS "Color Handling" -The curses library functions \fBinit_pair\fP and \fBinit_color\fP -manipulate the \fIcolor pairs\fP and \fIcolor values\fP discussed in this -section -(see \fBcurs_color\fP(3X) for details on these and related functions). -.PP -Most color terminals are either \*(``Tektronix-like\*('' or \*(``HP-like\*('': -.bP -Tektronix-like -terminals have a predefined set of \fIN\fP colors -(where \fIN\fP is usually 8), -and can set -character-cell foreground and background characters independently, mixing them -into \fIN\fP\ *\ \fIN\fP color pairs. -.bP -On HP-like terminals, the user must set each color -pair up separately (foreground and background are not independently settable). -Up to \fIM\fP color pairs may be set up from 2*\fIM\fP different colors. -ANSI-compatible terminals are Tektronix-like. -.PP -Some basic color capabilities are independent of the color method. -The numeric -capabilities \fBcolors\fP and \fBpairs\fP specify the maximum numbers of colors -and color pairs that can be displayed simultaneously. -The \fBop\fP (original -pair) string resets foreground and background colors to their default values -for the terminal. -The \fBoc\fP string resets all colors or color pairs to -their default values for the terminal. -Some terminals (including many PC -terminal emulators) erase screen areas with the current background color rather -than the power-up default background; these should have the Boolean capability -\fBbce\fP. -.PP -While the curses library works with \fIcolor pairs\fP +The +.I curses +library functions +.B \%init_pair +and +.B \%init_color +manipulate the +.I "color pairs" +and +.I colors +(color values or indices, +such as \*(``1=red\*('') +discussed in this section +(see \fB\%curs_color\fP(3X) for details on these and related functions). +.PP +Most color terminals are either \*(``Tektronix-like\*('' +or \*(``HP-like\*('' +in their approach to color management. +.bP +.I Tektronix-like +terminals define a set of +.I n +colors +(where +.I n +is usually 8), +and can alter +character-cell foreground and background colors independently, +mixing them into +.IR n \(mu n +color pairs. +ANSI-standard terminals are Tektronix-like. +.bP +On +.I HP-like +terminals, +the user must set up each color pair separately; +foreground and background are not independently alterable. +Up to +.I m +color pairs may be configured from +.RI 2\(mu m +different colors. +.PP +Some basic color management capabilities +are independent of the color encoding method. +The numeric capabilities +.B \%max_colors +.RB ( \%colors ) +and +.B \%max_pairs +.RB ( \%pairs ) +specify the maximum numbers of colors +and color pairs that the device can display simultaneously. +The +.B \%orig_pair +.RB ( \%op ) +(\*(``original pair\*('') +string capability +resets foreground and background colors +to their default values for the terminal. +The +.B \%orig_colors +.RB ( \%oc ) +(\*(``original colors\*('') +string capability +resets all colors or color pairs +to their default values for the terminal. +Some terminal types +(including many PC terminal emulators) +erase screen areas with the current background color rather +than the power-up default background; +these should declare the Boolean capability +.B \%back_color_erase +.RB ( bce ). +.PP +While the +.I curses +library works with \fIcolor pairs\fP (reflecting the inability of some devices to set foreground and background colors independently), there are separate capabilities for setting these features: @@ -1682,8 +1813,8 @@ .PP .TS center; -cb cb cb cb s s -l lb c l1 l1 l . +Cb Cb Cb Cb S S +L Lb C L1 L1 L . Color #define Value RGB _ black COLOR_BLACK 0 0, 0, 0 @@ -1703,8 +1834,8 @@ .PP .TS center; -cb cb cb cb s s -l lb c l1 l1 l . +Cb Cb Cb Cb S S +L Lb C L1 L1 L . Color #define Value RGB _ black COLOR_BLACK 0 0, 0, 0 @@ -1755,8 +1886,8 @@ .PP .TS center; -cb cb cb cb -lb n n lb. +Cb Cb Cb Cb +Lb N N Lb. Attribute Bit Decimal Set by _ A_STANDOUT 0 1 sgr @@ -2019,7 +2150,7 @@ expansion) lengths. .SH FILES .TP -.I \*d +.I @TERMINFO@ compiled terminal description database directory .SH EXTENSIONS Searching for terminal descriptions in @@ -2059,7 +2190,7 @@ signed 16-bit values. This includes the \fIno_color_video\fP (\fBncv\fP) capability. The 32768 mask value used for italics with \fBncv\fP can be confused with -an absent or cancelled \fBncv\fP. +an absent or canceled \fBncv\fP. If italics should work with colors, then the \fBncv\fP value must be specified, even if it is zero. .PP @@ -2076,7 +2207,7 @@ and \fI\%ncurses\fP support all SVr4 capabilities. .bP IRIX supports the SVr4 set and adds one undocumented extended string -capability (\fB\%set_pglen\fP). +capability \%(\fBset_pglen\fP). .bP SVr1 and Ultrix support a restricted subset of \fI\%terminfo\fP capabilities. diff --git a/contrib/ncurses/man/tic.1m b/contrib/ncurses/man/tic.1m --- a/contrib/ncurses/man/tic.1m +++ b/contrib/ncurses/man/tic.1m @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: tic.1m,v 1.110 2024/04/27 17:57:06 tom Exp $ -.TH @TIC@ 1M 2024-04-27 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" +.\" $Id: tic.1m,v 1.128 2025/11/12 00:49:19 tom Exp $ +.TH @TIC@ 1M 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -45,10 +45,9 @@ .el .IP \(bu 2 .. . -.ds d @TERMINFO@ .SH NAME \fB\%@TIC@\fP \- -compile terminal descriptions for \fIterminfo\fR or \fItermcap\fR +compile terminal descriptions for \%\fIterm\%info\fR or \fItermcap\fR .SH SYNOPSIS \fB@TIC@\fP [\fB\-\ @@ -83,134 +82,260 @@ [\fB\-w\fP[\fIn\fP]] \fIfile\fP .SH DESCRIPTION -The \fB@TIC@\fP command translates a \fBterminfo\fP file from source -format into compiled format. -The compiled format is necessary for use with -the library routines in \fB\%ncurses\fP(3X). +.B \%@TIC@ +translates a +.I \%term\%info +file from source format +into the compiled format +used by the +\fB\%ncurses\fP(3X) +library. .PP -As described in \fBterm\fP(5), the database may be either a directory -tree (one file per terminal entry) or a hashed database (one record per entry). -The \fB@TIC@\fP command writes only one type of entry, -depending on how it was built: +As described in \fBterm\fP(5), +the database may be either a directory tree +(one file per terminal entry) +or a hashed database +(one record per entry). +The +.B \%@TIC@ +command writes only one type of entry, +depending on how it was built. .bP -For directory trees, the top-level directory, e.g., /usr/share/terminfo, +For directory trees, +the top-level directory, +such as +.IR \%/usr/share/terminfo "," specifies the location of the database. .bP For hashed databases, a filename is needed. If the given file is not found by that name, -but can be found by adding the suffix ".db", +but can be found by adding the suffix \*(``.db\*('', then that is used. .IP The default name for the hashed database is the same as the -default directory name (only adding a ".db" suffix). +default directory name (only adding a \*(``.db\*('' suffix). .PP In either case (directory or hashed database), -\fB@TIC@\fP will create the container if it does not exist. +.B \%@TIC@ +will create the container if it does not exist. For a directory, this would be the \*(``terminfo\*('' leaf, -versus a "terminfo.db" file. +versus a +.I terminfo.db +file. .PP -The results are normally placed in the system terminfo database \fB\*d\fP. +The results are normally placed +in the system +.I \%term\%info +database +.IR \%@TERMINFO@ "." The compiled terminal description can be placed -in a different terminfo database. +in a different +.I \%term\%info +database. There are two ways to achieve this: .bP First, you may override the system default either by using the \fB\-o\fP option, or by setting the variable \fI\%TERMINFO\fP -in your shell environment to a valid database location. +in the process environment to a valid database location. .bP -Secondly, if \fB@TIC@\fP cannot write in \fI\*d\fP -or the location specified using your \fI\%TERMINFO\fP variable, -it looks for the directory \fI$HOME/.terminfo\fP -(or hashed database \fI$HOME/.terminfo.db)\fP; +Secondly, if +.B \%@TIC@ +cannot write in +.I \%@TERMINFO@ +or the location specified using your +.I \%TERMINFO +variable, +it looks for the directory +.I \%$HOME/.terminfo +(or hashed database +.IR $HOME/.terminfo.db ); if that location exists, the entry is placed there. .PP -Libraries that read terminfo entries are expected to check in succession +Libraries that read +.I \%term\%info +entries are expected to check in succession .bP -a location specified with the \fI\%TERMINFO\fP environment variable, +a location specified by the +.I \%TERMINFO +environment variable, .bP -\fI$HOME/.terminfo\fP, +.IR \%$HOME/.terminfo "," .bP -directories listed in the \fI\%TERMINFO_DIRS\fP environment variable, +directories listed in the +.I \%TERMINFO_DIRS +environment variable, .bP -a compiled-in list of directories (@TERMINFO_DIRS@), and +a compiled-in list of directories +.RI \%( @TERMINFO_DIRS@ ), +and .bP -the system terminfo database (\fI\*d\fP). +the system +.I \%term\%info +database +.RI \%( @TERMINFO@ ). .PP -The \fIFetching Compiled Descriptions\fP section in the \fBterminfo\fR(5) -manual goes into further detail. +Section \*(``Fetching Compiled Descriptions\*('' in \fBterminfo\fP(5) +goes into further detail. .SS Aliases -This is the same program as @INFOTOCAP@ and @CAPTOINFO@; -usually those are linked to, or copied from this program: +.B \%@TIC@ +is the same program as +.B \%@INFOTOCAP@ +and +.BR \%@CAPTOINFO@ ";" +usually those are linked to, +or copied from, this program. .bP -When invoked as @INFOTOCAP@, @TIC@ sets the \fB\-I\fP option. +When invoked as +.BR \%@INFOTOCAP@ "," +.B \%@TIC@ +sets the +.B \-I +option. .bP -When invoked as @CAPTOINFO@, @TIC@ sets the \fB\-C\fP option. +When invoked as +.BR \%@CAPTOINFO@ "," +.B \%@TIC@ +sets the +.B \-C +option. .SH OPTIONS .TP -\fB\-0\fP -restricts the output to a single line +.B \-0 +restricts the output to a single line. .TP -\fB\-1\fP -restricts the output to a single column +.B \-1 +restricts the output to a single column. .TP -\fB\-a\fP -tells \fB@TIC@\fP to retain commented-out capabilities rather than discarding -them. +.B \-a +tells +.B \%@TIC@ +to retain commented-out capabilities rather than discarding them. Capabilities are commented by prefixing them with a period. -This sets the \fB\-x\fP option, because it treats the commented-out -entries as user-defined names. -If the source is termcap, accept the 2-character names required by version 6. +.B \-a +implies +.BR \-x "," +because +.B \%@TIC@ +treats the commented-out entries as user-defined names. +If the source is in +.I termcap +format, +.B \%@TIC@ +accepts the 2-character names required by version 6. +.\" TD added this comment in 2003, prompted by discussion with Don Libes. +.\" Quoting from SunOS 4.1.3 termcap(5): +.\" Each termcap entry consist of a number of colon-separated (:) fields. +.\" The first field for each terminal lists the various names by which it +.\" is known, separated by bar ( | ) characters. The first name is always +.\" two characters long, and is used by older (version 6) systems (which +.\" store the terminal type in a 16-bit word in a system-wide database). +.\" Version 6 sounds like Unix version 6, but termcap was introduced a few +.\" years later. The SunOS man page was based on material in 4.2BSD. Otherwise these are ignored. .TP \fB\-C\fP -Force source translation to termcap format. -Note: this differs from the \fB\-C\fP -option of \fB@INFOCMP@\fP(1M) in that it does not merely translate capability -names, but also translates terminfo strings to termcap format. -Capabilities -that are not translatable are left in the entry under their terminfo names +Force source translation to +.I termcap +format. +Note: this option differs from the +.B \-C +option of \fB\%@INFOCMP@\fP(1M) +in that it does not merely translate capability names, +but also translates +.I \%term\%info +string capability values to +.I termcap +format. +.B \%@TIC@ +leaves capabilities that are not translatable +in the entry under their +.I \%term\%info +names, but commented out with two preceding dots. -The actual format used incorporates some improvements for escaped characters -from terminfo format. -For a stricter BSD-compatible translation, add the \fB\-K\fP option. +The actual format used +incorporates some improvements for escaped characters +from +.I \%term\%info +format. +For a stricter BSD-compatible translation, +specify +.B \-K +as well. .IP -If this is combined with \fB\-c\fP, \fB@TIC@\fP makes additional checks -to report cases where the terminfo values do not have an exact equivalent -in termcap form. +If +.B \-C +is combined with +.BR \-c "," +.B \%@TIC@ +makes additional checks, +reporting cases where +.I \%term\%info +capability values do not have an exact equivalent +in +.I termcap +syntax. For example: .RS .bP -\fBsgr\fP usually will not convert, because termcap lacks the ability to -work with more than two parameters, and because termcap lacks many of -the arithmetic/logical operators used in terminfo. -.bP -capabilities with more than one delay or with delays before the end of -the string will not convert completely. +.B sgr +usually does not convert, +because +.I termcap +is unable to work with more than two parameters, +and because +.I termcap 's +language for encoding parameterized capabilities +lacks many of +.IR \%term\%info 's +arithmetic and logical operators. .RE .TP -\fB\-c\fP -tells \fB@TIC@\fP to only check \fIfile\fP for errors, -including syntax problems and bad use-links. -If you specify \fB\-C\fP (\fB\-I\fP) with this option, the code -will print warnings about entries which, after use resolution, are more than -1023 (4096) bytes long. -Due to a fixed buffer length in older termcap libraries, -as well as buggy checking for the buffer length -(and a documented limit in terminfo), -these entries may cause core -dumps with other implementations. +.B \-c +tells +.B \%@TIC@ +to perform only validation of +.I file "," +including syntax problems and invalid +.RB \*(`` use \*('' +references; +no output is produced. +If you specify +.B \-C +.RB ( \-I ) +with this option, +.B \%@TIC@ +warns about entries that, +after +.RB \*(`` use \*('' +resolution, +exceed 1023 (4096) bytes. +Due to a fixed buffer length in older +.I termcap +libraries, +as well as buggy checking of the buffer length +(and a documented limit in +.IR \%term\%info ), +these entries may cause core dumps +with other implementations. .IP -\fB@TIC@\fP checks string capabilities to ensure that those with parameters -will be valid expressions. -It does this check only for the predefined string capabilities; -those which are defined with the \fB\-x\fP option are ignored. +.B \%@TIC@ +checks string capabilities +to ensure that those with parameters are valid expressions. +It validates only standard string capabilities, +ignoring those defined with the +.B \-x +option. .TP \fB\-D\fP -tells \fB@TIC@\fP to print the database locations that it knows about, and exit. +tells +.B \%@TIC@ +to print the database locations that it knows about, and exit. The first location shown is the one to which it would write compiled terminal descriptions. -If \fB@TIC@\fP is not able to find a writable database location +If +.B \%@TIC@ +is not able to find a writable database location according to the rules summarized above, it will print a diagnostic and exit with an error rather than printing a list of database locations. @@ -223,7 +348,9 @@ Otherwise no output will be generated for it. The option value is interpreted as a file containing the list if it contains a '/'. -(Note: depending on how @TIC@ was compiled, +(Note: depending on how +.B \%@TIC@ +was compiled, this option may require \fB\-I\fP or \fB\-C\fP.) .TP \fB\-f\fP @@ -321,12 +448,16 @@ descriptions are limited (e.g., 1023 for termcap, 4096 for terminfo). .TP \fB\-t\fP -tells \fB@TIC@\fP to discard commented-out capabilities. +tells +.B \%@TIC@ +to discard commented-out capabilities. Normally when translating from terminfo to termcap, untranslatable capabilities are commented-out. .TP \fB\-U\fP -tells \fB@TIC@\fP to not post-process the data after parsing the source file. +tells +.B \%@TIC@ +to not post-process the data after parsing the source file. Normally, it infers data which is commonly missing in older terminfo data, or in termcaps. .TP @@ -336,7 +467,9 @@ .TP \fB\-v\fIn\fR specifies that (verbose) output be written to standard error trace -information showing \fB@TIC@\fP's progress. +information showing +.BR \%@TIC@ 's +progress. .IP The optional parameter \fIn\fP is a number from 1 to 9, inclusive, indicating the desired level of detail of information. @@ -397,43 +530,91 @@ .TP \fB\-x\fP Treat unknown capabilities as user-defined (see \fBuser_caps\fP(5)). -That is, if you supply a capability name which \fB@TIC@\fP does not recognize, +That is, if you supply a capability name which +.B \%@TIC@ +does not recognize, it will infer its type (Boolean, number or string) from the syntax and make an extended table entry for that. User-defined capability strings whose name begins with \*(``k\*('' are treated as function keys. .SS Parameters .TP -\fIfile\fP -contains one or more \fBterminfo\fP terminal descriptions in source -format [see \fBterminfo\fP(5)]. +.I file +contains one or more +.I \%term\%info +terminal descriptions in source format; see \fBterminfo\fP(5). Each description in the file -describes the capabilities of a particular terminal. +describes the capabilities of a particular terminal type. .IP -If \fIfile\fP is \*(``-\*('', then the data is read from the standard input. -The \fIfile\fP parameter may also be the path of a character-device. +If +.I file +is \*(``\-\*('', +the data are read from the standard input stream. +The +.I file +parameter may also be the path of a character device. .SS Processing -All but one of the capabilities recognized by \fB@TIC@\fP are documented -in \fBterminfo\fP(5). -The exception is the \fBuse\fP capability. +\fBterminfo\fP(5) documents all but one of the capabilities +recognized by +.BR \%@TIC@ "." +The exception is the +.B use +capability, +which enables a terminal type description to incorporate others +by reference. .PP -When a \fBuse\fP=\fIentry\fP\-\fIname\fP field is discovered in a -terminal entry currently being compiled, \fB@TIC@\fP reads in the binary -from \fB\*d\fP to complete the entry. -(Entries created from -\fIfile\fP will be used first. -\fB@TIC@\fP duplicates the capabilities in -\fIentry\fP\-\fIname\fP for the current entry, with the exception of -those capabilities that explicitly are defined in the current entry. +.B \%@TIC@ +serially reads and compiles terminal type descriptions; +at any given time, +the program compiles at most one +.I current +entry. +.\" That is, tic doesn't recursively compile entries to resolve "use=". +When +.B \%@TIC@ +encounters a +.BI use= entry-name +field in the current entry, +it reads the compiled description of +.I entry-name +from +.I \%@TERMINFO@ +to complete the current entry. +If +.B \%@TIC@ +has already compiled a description of +.I entry-name +preceding the current entry in +.IR file "," +.B \%@TIC@ +uses it preferentially. +.\" XXX: Check this--tic doesn't read ahead in or index the input file, +.\" does it? Otherwise this feature would break when reading from a +.\" pipe. --GBR +.B \%@TIC@ +duplicates the capabilities in +.I entry-name +for the current entry, +excepting those that the current entry explicitly defines. +The foregoing has implications for capability cancellation. +When +.I entry-1 +declares +.RB \*(`` use=\c +.IR entry-2 \*(``, +any canceled capabilities in +.I entry-2 +must also appear in +.I entry-1 +prior to +.RB \*(`` use=\c +.IR entry-2 \*(`` +for these capabilities to be canceled in +.IR entry-1 "." .PP -When an entry, e.g., \fBentry_name_1\fP, contains a -\fBuse=\fIentry\fR_\fIname\fR_\fI2\fR field, any canceled -capabilities in \fIentry\fR_\fIname\fR_\fI2\fP must also appear in -\fBentry_name_1\fP before \fBuse=\fP for these capabilities to be -canceled in \fBentry_name_1\fP. -.PP -Total compiled entries cannot exceed -4096 bytes in the legacy storage format, or +Compiled entries cannot exceed +4096 bytes in the legacy storage format, +or 32768 using the extended number format. The name field cannot exceed 512 bytes. @@ -443,90 +624,148 @@ and a warning message will be printed. .SH FILES .TP -.I \*d +.I @TERMINFO@ compiled terminal description database .SH NOTES -There is some evidence that historic \fB@TIC@\fP implementations treated +There is some evidence that historic +.B \%@TIC@ +implementations treated description fields with no whitespace in them as additional aliases or short names. -This \fB@TIC@\fP does not do that, but it does warn when +This +.B \%@TIC@ +does not do that, but it does warn when description fields may be treated that way and check them for dangerous characters. .SH EXTENSIONS -Unlike the SVr4 \fB@TIC@\fP command, this implementation can actually -compile termcap sources. -In fact, entries in terminfo and termcap syntax can -be mixed in a single source file. +Unlike the SVr4 +.I tic +command, +.I \%ncurses +.I tic +can compile +.I termcap +sources. +In fact, +entries in +.I \%term\%info +and +.I termcap +syntax can be mixed in a single source file. See \fBterminfo\fP(5) for the list of -termcap names taken to be equivalent to terminfo names. +.I termcap +capability names +.I \%ncurses +.B \%@TIC@ +treats as equivalent to +.I \%term\%info +names. .PP -The SVr4 manual pages are not clear on the resolution rules for \fBuse\fP +The SVr4 man pages are not clear on the resolution rules for +.RB \*(`` use \*('' capabilities. -This implementation of \fB@TIC@\fP will find \fBuse\fP targets anywhere -in the source file, -or anywhere in the file tree rooted at -\fI\%TERMINFO\fP +.IR ncurses 's +.B \%@TIC@ +finds +.RB \*(`` use \*('' +targets anywhere in the source file, +or anywhere in the file tree rooted at the location in the +.I \%TERMINFO +environment variable (if -\fI\%TERMINFO\fP is defined), -or in the user's \fI$HOME/.terminfo\fP database +.I \%TERMINFO +is defined), +or in the user's +.I \%$HOME/.terminfo +database (if it exists), -or (finally) anywhere in the system's file tree of -compiled entries. +or (finally) anywhere in the system's collection of compiled entries. .PP -The error messages from this \fB@TIC@\fP have the same format as GNU C -error messages, and can be parsed by GNU Emacs's compile facility. +The error messages from +.I \%ncurses +.B \%@TIC@ +have the same format as GNU C error messages, +and can be parsed by GNU Emacs's \*(``compile\*('' facility. .PP -Aside from \fB\-c\fP and \fB\-v\fP, options are not portable: +Aside from +.B \-c +and +.BR \-v "," +options are not portable. .bP -Most of @TIC@'s options -are not supported by SVr4 \fBtic\fP: -.sp +Most of +.I \%ncurses +.BR \%@TIC@ 's +options are not supported by SVr4 +.IR tic "." +.PP .RS -\fB\-0\fP -\fB\-1\fP -\fB\-C\fP -\fB\-G\fP -\fB\-I\fP -\fB\-N\fP -\fB\-R\fP -\fB\-T\fP -\fB\-V\fP -\fB\-a\fP -\fB\-e\fP -\fB\-f\fP -\fB\-g\fP -\fB\-o\fP -\fB\-r\fP -\fB\-s\fP -\fB\-t\fP -\fB\-x\fP +.B \-0 +.B \-1 +.B \-C +.B \-G +.B \-I +.B \-N +.B \-R +.B \-T +.B \-V +.B \-a +.B \-e +.B \-f +.B \-g +.B \-o +.B \-r +.B \-s +.B \-t +.B \-x .RE .bP -The NetBSD \fBtic\fP supports a few of the \fI\%ncurses\fP options -.sp +NetBSD +.I tic +supports a few of the +.I \%ncurses +.B \%@TIC@ +options. +.PP .RS -\fB\-a\fP -\fB\-o\fP -\fB\-x\fP +.B \-a +.B \-o +.B \-x .RE -.IP -and adds \fB\-S\fP -(a feature which does the same thing -as @INFOCMP@'s \fB\-e\fP and \fB\-E\fP options). +.bP +NetBSD +.I tic +also adds +.BR \-S "," +a feature which does the same thing as +.I \%ncurses +.BR \%@INFOCMP@ 's +.B \-e +and +.B \-E +options. .PP -The SVr4 \fB\-c\fP mode does not report bad \*(``use=\*('' links. +SVr4 +.IR tic 's +.B \-c +mode does not report bad +.RB \*(`` use \*('' +links. .PP -System V does not compile entries to or read entries from your -\fI$HOME/.terminfo\fP database unless \fI\%TERMINFO\fP is explicitly set -to it. +SVr4 does not compile entries to +or read entries from your +.I \%$HOME/.terminfo +database unless the +.I \%TERMINFO +environment variable is explicitly set to it. .SH PORTABILITY -X/Open Curses, Issue 7 (2009) provides a brief description of \fBtic\fP. +X/Open Curses Issue\ 7 (2009) provides a brief description of \fBtic\fP. It lists one option: \fB\-c\fP. The omission of \fB\-v\fP is unexpected. The change history states that the description is derived from Tru64. According to its manual pages, that system also supported the \fB\-v\fP option. .PP -Shortly after Issue 7 was released, Tru64 was discontinued. +Shortly after Issue\ 7 was released, Tru64 was discontinued. As of 2019, the surviving implementations of \fBtic\fP are SVr4 (AIX, HP-UX and Solaris), \fI\%ncurses\fP @@ -547,7 +786,7 @@ It accepted a single option: \fB\-v\fP (optionally followed by a number). According to Ross Ridge's comment in \fImytinfo\fP, this version of \fBtic\fP was -unable to represent cancelled capabilities. +unable to represent canceled capabilities. .PP System V Release 3 provided a different \fBtic\fP utility, written by Pavel Curtis, @@ -583,28 +822,43 @@ In 2010, Roy Marples provided a \fBtic\fP program and terminfo library for NetBSD. That implementation adapts several features from \fI\%ncurses\fP, -including \fB@TIC@\fP's \fB\-x\fP option. +including +.BR \%@TIC@ 's +\fB\-x\fP option. .PP -The \fB\-c\fP option tells \fB@TIC@\fP to check for problems in the +The \fB\-c\fP option tells +.B \%@TIC@ +to check for problems in the terminfo source file. Continued development provides additional checks: .bP -\fIpcurses\fP had 8 warnings +.I pcurses +had 8 warnings. .bP -\fI\%ncurses\fP in 1996 had 16 warnings +.I \%ncurses +in 1996 had 16 warnings. .bP -Solaris (SVr4) curses has 28 warnings +Solaris (SVr4) +.I curses +has 28 warnings. .bP -NetBSD tic in 2019 has 19 warnings. +NetBSD +.I tic +in 2019 has 19 warnings. .bP -\fI\%ncurses\fP in 2019 has 96 warnings +.I \%ncurses +in 2019 has 96 warnings. .PP -The checking done in \fI\%ncurses\fP' \fB@TIC@\fP helps with the +The checking done in +.IR \%ncurses 's +.B \%@TIC@ +helps with the conversion to termcap, as well as pointing out errors and inconsistencies. It is also used to ensure consistency with the user-defined capabilities. -There are 527 distinct capabilities in \fI\%ncurses\fP' terminal -database; +There are 527 distinct capabilities in +.IR \%ncurses 's +terminal database; 128 of those are user-defined. .SH AUTHORS Eric S. Raymond diff --git a/contrib/ncurses/man/toe.1m b/contrib/ncurses/man/toe.1m --- a/contrib/ncurses/man/toe.1m +++ b/contrib/ncurses/man/toe.1m @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2015,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: toe.1m,v 1.68 2024/04/20 18:59:26 tom Exp $ -.TH @TOE@ 1M 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" +.\" $Id: toe.1m,v 1.75 2025/11/12 01:06:36 tom Exp $ +.TH @TOE@ 1M 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -50,7 +50,6 @@ .ie n .IP \(bu 4 .el .IP \(bu 2 .. -.ds d @TERMINFO@ .SH NAME \fB\%@TOE@\fP \- list table of entries of \fIterminfo\fR terminal types @@ -99,7 +98,7 @@ \fB\%@TOE@\fP does not attempt to merge duplicates in its report. .TP .B \-h -writes a heading naming each each directory as it is accessed. +writes a heading naming each directory as it is accessed. .TP .B \-s sorts the output by the entry names. @@ -143,7 +142,7 @@ with this program and exits with a successful status. .SH FILES .TP -.I \*d +.I @TERMINFO@ compiled terminal description database .SH PORTABILITY \fB\%@TOE@\fP is not provided by other implementations. @@ -172,7 +171,7 @@ .\" toe -a | grep -E '^(xterm|vt)' .ft \*(CW .TS -L2 Lx. +L2 Lw(32n)x. xterm\-color generic color xterm xterm\-xfree86 xterm terminal emulator (XFree86) xterm\-vt220 xterm emulating vt220 @@ -181,7 +180,7 @@ xterm\-r5 xterm R5 version xterm\-mono monochrome xterm xterm T{ -.ad l +.na xterm terminal emulator (X Window System) T} vt220 dec vt220 @@ -202,19 +201,19 @@ .\" toe -as | grep -E '(^-+>|:.(xterm|vt))' .ft \*(CW .TS -Lx. +Lw(31n)x. \-\-> /etc/terminfo \-\-\-\-> /lib/terminfo \-\-\-\-\-\-> /usr/share/terminfo .TE .TS -L1 L2 Lx. +L1 L2 Lw(31n)x. \-\-*\-\-\-: vt100 dec vt100 (w/advanced video) \-\-*\-\-\-: vt102 dec vt102 \-\-*\-\-\-: vt220 dec vt220 \-\-*\-\-\-: vt52 dec vt52 \-\-*\-\-\-: xterm T{ -.ad l +.na xterm terminal emulator (X Window System) T} \-\-*\-\-\-: xterm\-256color xterm with 256 colors @@ -224,7 +223,7 @@ \-\-*\-\-\-: xterm\-r6 xterm X11R6 version \-\-*\-\-\-: xterm\-vt220 xterm emulating vt220 \-\-*\-\-\-: xterm\-xfree86 T{ -.ad l +.na xterm terminal emulator (XFree86) T} .T& diff --git a/contrib/ncurses/man/tput.1 b/contrib/ncurses/man/tput.1 --- a/contrib/ncurses/man/tput.1 +++ b/contrib/ncurses/man/tput.1 @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,44 +28,44 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: tput.1,v 1.113 2024/04/20 19:58:50 tom Exp $ -.TH @TPUT@ 1 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" +.\" $Id: tput.1,v 1.149 2025/11/12 01:05:03 tom Exp $ +.TH @TPUT@ 1 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq .\} .el \{\ .ie t .ds `` `` -.el .ds `` "" +.el .ds `` ""\" cannot be used in quoted macro argument w/ AT&T troff .ie t .ds '' '' -.el .ds '' "" +.el .ds '' ""\" cannot be used in quoted macro argument w/ AT&T troff .\} . .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 .. -.ds d @TERMINFO@ .SH NAME \fB\%@TPUT@\fP \- initialize a terminal, exercise its capabilities, or query \fI\%term\%info\fP database .SH SYNOPSIS -\fB@TPUT@\fP [\fB\-T\fP \fIterminal-type\fP] +\fB@TPUT@\fP [\fB\-v\fP] [\fB\-T\fP \fIterminal-type\fP] {\fIcap-code\fP [\fIparameter\fP .\|.\|.\&]} .\|.\|. .PP -\fB@TPUT@\fP [\fB\-T\fP \fIterminal-type\fP] [\fB\-x\fP] \fBclear\fP +\fB@TPUT@\fP [\fB\-v\fP] [\fB\-T\fP \fIterminal-type\fP] [\fB\-x\fP] \fBclear\fP .PP -\fB@TPUT@\fP [\fB\-T\fP \fIterminal-type\fP] \fBinit\fP +\fB@TPUT@\fP [\fB\-v\fP] [\fB\-T\fP \fIterminal-type\fP] \fBinit\fP .PP -\fB@TPUT@\fP [\fB\-T\fP \fIterminal-type\fP] \fB\%reset\fP +\fB@TPUT@\fP [\fB\-v\fP] [\fB\-T\fP \fIterminal-type\fP] \fB\%reset\fP .PP -\fB@TPUT@\fP [\fB\-T\fP \fIterminal-type\fP] \fB\%longname\fP +\fB@TPUT@\fP [\fB\-v\fP] [\fB\-T\fP \fIterminal-type\fP] \fB\%longname\fP .PP -\fB@TPUT@ \-S\fP +\fB@TPUT@\fP [\fB\-v\fP] \fB\-S\fP .PP -\fB@TPUT@ \-V\fP +\fB@TPUT@\fP [\fB\-v\fP] \fB\-V\fP .SH DESCRIPTION -\fB\%@TPUT@\fP uses the +.B \%@TPUT@ +uses the .I \%term\%info library and database to make terminal-specific capabilities and information available to the shell, @@ -75,26 +75,30 @@ (or specified) terminal type. Terminal capabilities are accessed by -.IR cap-code . +.IR cap-code "." .PP \fB\%terminfo\fP(5) discusses terminal capabilities at length -and presents a complete list of -.IR cap-codes . +and presents a complete list of standardized +.IR cap-codes "." +\fB\%user_caps\fP(5) presents other widely used +but non-standard capabilities. .PP When retrieving capability values, the result depends upon the capability's type. .TP 9 \" "Boolean" + 2n Boolean -\fB\%@TPUT@\fP sets its exit status to +.B \%@TPUT@ +sets its exit status to .B 0 if the terminal possesses -.IR cap-code , +.IR cap-code "," and .B 1 if it does not. .TP numeric -\fB\%@TPUT@\fP writes +.B \%@TPUT@ +writes .IR cap-code 's decimal value to the standard output stream if defined .RB ( \-1 @@ -102,26 +106,30 @@ followed by a newline. .TP string -\fB\%@TPUT@\fP writes +.B \%@TPUT@ +writes .IR cap-code 's value to the standard output stream if defined, without a trailing newline. .PP Before using a value returned on the standard output, -the application should test \fB\%@TPUT@\fP's exit status +the application should test +.BR \%@TPUT@ 's +exit status to be sure it is 0; see section \*(``EXIT STATUS\*('' below. .SS Operands Generally, an operand is a -.IR cap-code , +.IR cap-code "," a capability code from the terminal database, or a parameter thereto. -Three others are specially recognized by \fB\%@TPUT@\fP: -.BR init , -.BR \%reset , +Three others are specially recognized by +.BR \%@TPUT@ ":" +.BR init "," +.BR \%reset "," and -.BR \%longname . +.BR \%longname "." Although these resemble capability codes, they in fact receive special handling; we term them \*(``pseudo-capabilities\*(''. @@ -132,18 +140,23 @@ If .I cap-code is of string type and takes parameters, -\fB\%@TPUT@\fP interprets arguments following +.B \%@TPUT@ +interprets arguments following .I cap-code as the parameters, up to the (fixed) quantity the capability requires. .IP Most parameters are numeric. Only a few terminal capabilities require string parameters; -\fB\%@TPUT@\fP uses a table to decide which to pass as strings. -Normally \fB\%@TPUT@\fP uses \fB\%tparm\fP(3X) to perform the +.B \%@TPUT@ +uses a table to decide which to pass as strings. +Normally +.B \%@TPUT@ +uses \fB\%tparm\fP(3X) to perform the substitution. If no parameters are given for the capability, -\fB\%@TPUT@\fP writes the string without performing the substitution. +.B \%@TPUT@ +writes the string without performing the substitution. .TP .B init initializes the terminal. @@ -153,7 +166,8 @@ .RS .TP 5 (1) -\fB\%@TPUT@\fP retrieves the terminal's mode settings. +.B \%@TPUT@ +retrieves the terminal's mode settings. It successively tests the file descriptors corresponding to .RS .bP @@ -169,22 +183,20 @@ .IP to obtain terminal settings. Having retrieved them, -\fB\%@TPUT@\fP remembers which descriptor to use for further updates. +.B \%@TPUT@ +remembers which descriptor to use for further updates. .TP (2) If the terminal dimensions cannot be obtained from the operating system, but the environment or terminal type database entry describes them, -\fB\%@TPUT@\fP updates the operating system's notion of them. +.B \%@TPUT@ +updates the operating system's notion of them. .TP (3) -\fB\%@TPUT@\fP updates the terminal modes. +.B \%@TPUT@ +updates the terminal modes. .RS .bP -Any delays specified in the entry -(for example, -when a newline is sent) -are set in the terminal driver. -.bP Tab expansion is turned on or off per the specification in the entry, and .bP @@ -199,10 +211,12 @@ detailed in subsection \*(``Tabs and Initialization\*('' of \fB\%terminfo\fP(5), are present, -\fB\%@TPUT@\fP writes them to the standard output stream. +.B \%@TPUT@ +writes them to the standard output stream. .TP (5) -\fB\%@TPUT@\fP flushes the standard output stream. +.B \%@TPUT@ +flushes the standard output stream. .RE .IP If an entry lacks the information needed for an activity above, @@ -214,24 +228,27 @@ .RS .TP 5 (1) -\fB\%@TPUT@\fP sets the the terminal modes to a \*(``sane\*('' state, +.B \%@TPUT@ +sets the terminal modes to a \*(``sane\*('' state, .RS .bP -enabling cooked and echo modes, +enabling canonical (\*(``cooked\*('') and echo modes, .bP disabling cbreak and raw modes, .bP enabling newline translation, and .bP -setting any unset special characters to their default values. +setting any special input characters to their default values. .RE .TP 5 (2) If any reset capabilities are defined for the terminal type, -\fB\%@TPUT@\fP writes them to the output stream. +.B \%@TPUT@ +writes them to the output stream. Otherwise, -\fB\%@TPUT@\fP uses any defined initialization capabilities. +.B \%@TPUT@ +uses any defined initialization capabilities. Reset capabilities are detailed in subsection \*(``Tabs and Initialization\*('' of \fB\%terminfo\fP(5). .RE @@ -246,7 +263,8 @@ X/Open Curses terms the last name the \*(``long name\*('', and indicates that it may include blanks. .IP -\fB\%@TIC@\fP warns if the last name does not include blanks, +.B \%@TIC@ +warns if the last name does not include blanks, to accommodate old .I \%term\%info entries that treated the long name as an optional feature. @@ -254,37 +272,48 @@ .IP If the terminal database is present and an entry for the user's terminal type exists, -\fB\%@TPUT@\fP reports its description to the standard output stream, +.B \%@TPUT@ +reports its description to the standard output stream, without a trailing newline. See \fB\%terminfo\fP(5). .PP .I Note: Redirecting the output of -.RB \%\*(`` "@TPUT@ init" \*('' +\*(``\c +.B "@TPUT@ init\c" +\*('' or -.RB \%\*(`` "@TPUT@ reset" \*('' +\*(``\c +.B "@TPUT@ reset\c" +\*('' to a file will capture only part of their actions. Changes to the terminal modes are not affected by file descriptor redirection, -since the terminal modes are altered via \fB\%ioctl\fP(2). +since the terminal modes are altered via \fI\%ioctl\fP(2). .SS Aliases -If \fB\%@TPUT@\fP is invoked via link with any of the names -.BR clear , -.BR init , +If +.B \%@TPUT@ +is invoked via link with any of the names +.BR clear "," +.BR init "," or -.BR \%reset , +.BR \%reset "," it operates as if run with the corresponding (pseudo-)capability operand. For example, executing a link named .B \%reset -that points to \fB\%@TPUT@\fP has the same effect as -.RB \%\*(`` "@TPUT@ \%reset" \*(''. +that points to +.B \%@TPUT@ +has the same effect as +\%\*(``\c +.B "@TPUT@ \%reset\c" +\*(''. .PP This feature was introduced by .I \%ncurses 5.2 in 2000. -It is rarely used: +It is rarely used. .TP .B \%clear is a separate program, @@ -296,12 +325,13 @@ .B \%reset is provided by the \fB\%@TSET@\fP(1) utility (also via a link named -.BR \%reset ")." +.BR \%reset ). .SS "Terminal Size" Besides the pseudo-capabilities (such as .BR init ), -\fB\%@TPUT@\fP treats the +.B \%@TPUT@ +treats the .B lines and .B cols @@ -310,7 +340,8 @@ it may call \fB\%setupterm\fP(3X) to obtain the terminal size. .bP First, -\fB\%@TPUT@\fP attempts to obtain these capabilities from the terminal +.B \%@TPUT@ +attempts to obtain these capabilities from the terminal database. This generally fails for terminal emulators, which lack a fixed window size and thus omit the capabilities. @@ -324,14 +355,15 @@ it inspects the environment variables .I LINES and -.IR \%COLUMNS , +.IR \%COLUMNS "," which may override the terminal size. .PP If the .B \-T option is given, -\fB\%@TPUT@\fP ignores the environment variables by calling -.BR \%use_tioctl(TRUE) , +.B \%@TPUT@ +ignores the environment variables by calling +.BR \%use_tioctl(TRUE) "," relying upon the operating system (or, ultimately, @@ -339,8 +371,11 @@ .SH OPTIONS .TP 9n \" "-T type" + 2n .B \-S -retrieves more than one capability per invocation of \fB\%@TPUT@\fP. -The capabilities must be passed to \fB\%@TPUT@\fP from the standard +retrieves more than one capability per invocation of +.BR \%@TPUT@ "." +The capabilities must be passed to +.B \%@TPUT@ +from the standard input stream instead of from the command line (see section \*(``EXAMPLES\*('' below). Only one @@ -356,13 +391,14 @@ (see section \*(``EXIT STATUS\*('' below). .IP Some capabilities use string parameters rather than numeric ones. -\fB\%@TPUT@\fP employs a built-in table and the presence of parameters +.B \%@TPUT@ +employs a built-in table and the presence of parameters in its input to decide how to interpret them, and whether to use \fB\%tparm\fP(3X). .TP .BI \-T\ type indicates the terminal's -.IR type . +.IR type "." Normally this option is unnecessary, because a default is taken from the .I TERM @@ -374,19 +410,30 @@ .I \%COLUMNS are also ignored. .TP +.B \-v +causes +.B \%@TPUT@ +to operate verbosely, +reporting warnings. +.TP .B \-V reports the version of .I \%ncurses -associated with \fB\%@TPUT@\fP, +associated with +.BR \%@TPUT@ "," and exits with a successful status. .TP .B \-x prevents -.RB \%\*(`` "@TPUT@ clear" \*('' +\%\*(``\c +.B "@TPUT@ clear\c" +\*('' from attempting to clear the scrollback buffer. .SH EXIT STATUS Normally, -one should interpret \fB\%@TPUT@\fP's exit statuses as follows. +one should interpret +.BR \%@TPUT@ "'s" +exit statuses as follows. .PP .if n .ne 3 .if t .ne 2 @@ -420,30 +467,37 @@ 4 some operands not interpreted .TE .SH ENVIRONMENT -\fB@TPUT@\fP reads one environment variable. -.TP 8n \" "TERM" + 2n + adjustment for PDF +.B \%@TPUT@ +reads up to three environment variables +if the +.B \-T +option is not specified. +.TP 9n \" "COLUMNS" + 2n +.I COLUMNS +specifies the width of the screen in characters. +.TP +.I LINES +specifies the height of the screen in characters. +.TP .I TERM denotes the terminal type. Each terminal type is distinct, though many are similar. -The -.B \-T -option overrides its value. .SH FILES .TP .I @DATADIR@/tabset tab stop initialization database .TP -.I \*d +.I @TERMINFO@ compiled terminal description database .SH PORTABILITY Over time .I \%ncurses -\fB\%@TPUT@\fP +.B \%@TPUT@ has differed from that of System\ V in two important respects, one now mostly historical. .bP -\%\*(``\fB@TPUT@\fP +.RB \%\*(`` @TPUT@ .IR cap-code \*('' writes to the standard output, which need not be a terminal device. @@ -452,16 +506,16 @@ output. .IP System\ V -.BR tput 's +.IR tput 's .B init and .B \%reset operands use logic from 4.1cBSD -.BR tset , +.IR tset "," manipulating terminal modes. It checks the same file descriptors (and -.IR \%/dev/tty ) +.IR \%/dev/tty ")" for association with a terminal device as .I \%ncurses now does, @@ -474,18 +528,21 @@ .I \%ncurses 6.1 (see section \*(``HISTORY\*('' below), -\fB\%@TPUT@\fP did not modify terminal modes. +.B \%@TPUT@ +did not modify terminal modes. It now employs a scheme similar to System\ V, -using functions shared with \fB\%@TSET@\fP +using functions shared with +.B \%@TSET@ (and ultimately based on 4.4BSD -.BR tset ). +.IR tset ). If it is not able to open a terminal (for instance, when run by \fIcron\fP(1)), -\fB\%@TPUT@\fP exits with an error status. +.B \%@TPUT@ +exits with an error status. .bP System\ V -.B tput +.I tput assumes that the type of a .I cap-code operand is numeric if all the characters of its value are decimal @@ -499,10 +556,12 @@ .I cap-code operands use the \fB\%tparm\fP(3X) function to expand its parameters. That function expects a mixture of numeric and string parameters, -requiring \fB\%@TPUT@\fP to know which type to use. +requiring +.B \%@TPUT@ +to know which type to use. .IP .I \%ncurses -\fB\%@TPUT@\fP +.B \%@TPUT@ uses a table to determine the parameter types for the standard .I cap-code @@ -517,9 +576,9 @@ .I \%ncurses to port NetBSD's .IR termcap -based -.B tput +.I tput to -.IR \%term\%info , +.IR \%term\%info "," and modified it to interpret multiple .I cap-codes (and parameters) @@ -528,7 +587,9 @@ .I \%ncurses offers it to support applications written specifically for OpenBSD. .PP -This implementation, +.IR \%ncurses 's +implementation of +.IR tput ","\" generic unlike others, accepts both .I termcap @@ -540,7 +601,6 @@ support is compiled in. In that case, however, -the predefined .I termcap and .I \%term\%info @@ -561,17 +621,17 @@ but .B \%parm_delete_line to -.IR \%term\%info . +.IR \%term\%info "." .I termcap uses the code .B DL for -.BR \%parm_delete_line . +.BR \%parm_delete_line "." .I \%term\%info uses the code .B dl1 for -.BR \%delete_line . +.BR \%delete_line "." .bP The .I cap-code @@ -583,17 +643,17 @@ but .B \%clr_eos to -.IR \%term\%info . +.IR \%term\%info "." .I termcap uses the code .B cd for -.BR \%clr_eos . +.BR \%clr_eos "." .I \%term\%info uses the code .B rmdc for -.BR \%exit_delete_mode . +.BR \%exit_delete_mode "." .PP The .B \%longname @@ -609,16 +669,16 @@ before SVr4 (1989). Later, 4.3BSD-Reno (1990) added support for -.BR \%longname , +.BR \%longname "," .\" longname was added in October 1989. and in 1994, NetBSD added support for the parameter-substitution features. .PP -IEEE Std 1003.1/The Open Group Base Specifications Issue 7 +IEEE Std 1003.1/The Open Group Base Specifications Issue\ 7 (POSIX.1-2008) documents only the -.BR clear , -.BR init , +.BR clear "," +.BR init "," and .B \%reset operands. @@ -628,15 +688,15 @@ supports .B clear as it does any other standard -.IR cap-code . +.IR cap-code "." The others .RB ( init and -.BR \%longname ) +.BR \%longname ")" do not correspond to terminal capabilities. .bP The -.B tput +.I tput on SVr4-based systems such as Solaris, IRIX64, and HP-UX, @@ -650,11 +710,11 @@ codes rather than .I \%term\%info capability codes in their respective -.B tput +.I tput commands. Since 2010, NetBSD's -.B tput +.I tput uses .I \%term\%info codes. @@ -668,7 +728,7 @@ Beginning in 2021, FreeBSD uses .I \%ncurses -.BR tput , +.BR tput "," configured for both .I \%term\%info (tested first) @@ -681,7 +741,7 @@ Unix systems support the full set of capability codes, the reason for documenting only a few may not be apparent. .bP -X/Open Curses Issue 7 documents +X/Open Curses Issue\ 7 documents .B tput differently, with @@ -690,23 +750,23 @@ .bP That is, there are two standards for -.BR tput : +.IR tput ":" POSIX (a subset) and X/Open Curses (the full implementation). POSIX documents a subset to avoid the complication of including X/Open Curses and the terminal capability database. .bP While it is certainly possible to write a -.B tput +.I tput program without using -.IR curses , +.IR curses "," no system with a .I curses implementation provides a -.B tput +.I tput utility that does not also support standard -.IR cap-codes . +.IR cap-codes "." .PP -X/Open Curses Issue 7 (2009) is the first version to document utilities. +X/Open Curses Issue\ 7 (2009) is the first version to document utilities. However that part of X/Open Curses does not follow existing practice (that is, System\ V @@ -727,14 +787,14 @@ database. That likely is a documentation error, mistaking the \*(``\-1\*('' written to the standard output to indicate -an absent or cancelled numeric capability for an (unsigned) exit status. +an absent or canceled numeric capability for an (unsigned) exit status. .PP The various System\ V implementations (AIX, HP-UX, Solaris) use the same exit statuses as -.IR \%ncurses . +.IR \%ncurses "." .PP NetBSD .I curses @@ -743,7 +803,7 @@ nor X/Open Curses. .SH HISTORY Bill Joy wrote a -.B tput +.I tput command during development of 4BSD in October 1980. This initial version only cleared the screen, and did not ship with official distributions. @@ -753,15 +813,15 @@ .\" See Spinellis's "unix-history-repo" on GitHub. .PP System\ V developed a different -.B tput +.I tput command. .bP SVr2 (1984) provided a rudimentary -.B tput +.I tput that checked the parameter against each -predefined capability and returned the corresponding value. +capability name and returned the corresponding value. This version of -.B tput +.I tput did not use \fB\%tparm\fP(3X) for parameterized capabilities. .bP SVr3 (1987) replaced that @@ -777,7 +837,7 @@ incorporated the .B \%reset feature of BSD -.B tset +.I tset written by Eric Allman. .bP SVr4 (1989) added color initialization by using the @@ -791,19 +851,21 @@ logic. .PP Keith Bostic refactored BSD -.B tput -for shipment in 4.3BSD-Tahoe (1988), -then replaced it the next year with a new implementation based on -System\ V -.BR tput . -Bostic's version similarly accepted some parameters named for +.I tput +for shipment in 4.3BSD-Reno (1990), +making it follow the interface of System\ V +.I tput +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD-Reno/src/usr.bin/tput/tput.c +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=Net2/usr/src/usr.bin/tput/tput.c +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/src/usr.bin/tput/tput.c +by accepting some parameters named for .I \%term\%info (pseudo-)capabilities: -.BR clear , -.BR init , -.BR \%longname , +.BR clear "," +.BR init "," +.BR \%longname "," and -.BR \%reset . +.BR \%reset "." However, because he had only .I termcap @@ -813,22 +875,22 @@ codes for other capabilities. Also, Bostic's BSD -.B tput +.I tput did not modify the terminal modes as the earlier BSD -.B tset +.I tset had done. -.PP At the same time, Bostic added a shell script named \*(``clear\*('' that used -.B tput +.I tput to clear the screen. -Both of these appeared in 4.4BSD, -becoming the \*(``modern\*('' BSD implementation of -.BR tput . +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD-Reno/src/usr.bin/tput/clear.sh +These became the \*(``modern\*('' BSD implementation of +.IR tput "." .PP The origin of .I \%ncurses -\fB\%@TPUT@\fP lies outside both System\ V and BSD, +.B \%@TPUT@ +lies outside both System\ V and BSD, in Ross Ridge's .I \%mytinfo package, @@ -838,10 +900,10 @@ Ridge's program made more sophisticated use of the terminal capabilities than the BSD program. Eric Raymond used that -.B tput +.I tput program (and other parts of -.IR \%mytinfo ) +.IR \%mytinfo ")" in .I \%ncurses in June 1995. @@ -853,13 +915,19 @@ Before .I \%ncurses 6.1 (2018), -its \fB\%@TSET@\fP and \fB\%@TPUT@\fP utilities differed. +its +.B \%@TSET@ +and +.B \%@TPUT@ +utilities differed. .bP -\fB\%@TSET@\fP was more effective, -resetting the terminal modes and special characters. +.B \%@TSET@ +was more effective, +resetting the terminal's modes and special input characters. .bP On the other hand, -\fB\%@TSET@\fP's repertoire of terminal capabilities for resetting the +.BR \%@TSET@ "'s" +repertoire of terminal capabilities for resetting the terminal was more limited; it had only equivalents of .B \%reset_1string @@ -869,12 +937,15 @@ and .B \%reset_file .RB ( rf ), -and not the tab stop and margin update features of \fB\%@TPUT@\fP. +and not the tab stop and margin update features of +.BR \%@TPUT@ "." .PP The -.B \%reset -program is traditionally an alias for \fB\%@TSET@\fP due to its ability -to reset terminal modes and special characters. +.I \%reset +program is traditionally an alias for +.B \%@TSET@ +due to its ability +to reset the terminal's modes and special input characters. .PP As of .I \%ncurses @@ -882,14 +953,24 @@ the \*(``reset\*('' features of the two programs are (mostly) the same. Two minor differences remain. .bP -The \fB\%@TSET@\fP program waits one second when resetting, -in case the terminal happens to be a hardware device. +When issuing a reset, +the +.B \%@TSET@ +program +checks whether the device appears to be a pseudoterminal +(as might be used by a terminal emulator program), +and, +if it does not, +waits one second in case it is communicating with a hardware terminal. .bP The two programs write the terminal initialization strings to different streams; that is, -standard error for \fB\%@TSET@\fP and -standard output for \fB\%@TPUT@\fP. +standard error for +.B \%@TSET@ +and +standard output for +.BR \%@TPUT@ "." .SH EXAMPLES .TP .B "@TPUT@ init" @@ -914,7 +995,7 @@ Set cursor to normal visibility. .TP .B "@TPUT@ home" -Move the cursor to row 0, +Move the cursor to line 0, column 0: the upper left corner of the screen, usually known as the \*(``home\*('' cursor position. @@ -935,7 +1016,7 @@ Set shell variables to capability values: .B strong and -.BR normal , +.BR normal "," to begin and end, respectively, stand-out mode for the terminal. @@ -951,7 +1032,7 @@ Indicate via exit status whether the terminal is a hard copy device. .TP .B "@TPUT@ cup 23 4" -Move the cursor to row 23, +Move the cursor to line 23, column 4. .TP .B "@TPUT@ cup" @@ -976,11 +1057,13 @@ option can be profitably used with a shell \*(``here document\*(''. .IP .EX +.nf .RB $\ "@TPUT@ \-S <\ clear .RB >\ "cup 10 10" .RB >\ bold .RB >\ ! +.fi .EE .IP The foregoing @@ -993,7 +1076,9 @@ .TP .B "@TPUT@ clear cup 10 10 bold" Perform the same actions as the foregoing -.RB \%\*(`` "@TPUT@ \-S" \*('' +\%\*(``\c +.B "@TPUT@ \-S\c" +\*('' example. .SH SEE ALSO \fB\%@CLEAR@\fP(1), @@ -1001,4 +1086,5 @@ \fB\%@TABS@\fP(1), \fB\%@TSET@\fP(1), \fB\%curs_termcap\fP(3X), -\fB\%terminfo\fP(5) +\fB\%terminfo\fP(5), +\fB\%user_caps\fP(5) diff --git a/contrib/ncurses/man/tset.1 b/contrib/ncurses/man/tset.1 --- a/contrib/ncurses/man/tset.1 +++ b/contrib/ncurses/man/tset.1 @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: tset.1,v 1.85 2024/04/27 17:57:47 tom Exp $ -.TH @TSET@ 1 2024-04-27 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" +.\" $Id: tset.1,v 1.94 2025/01/19 00:51:54 tom Exp $ +.TH @TSET@ 1 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -47,7 +47,6 @@ .el .IP \(bu 2 .. . -.ds d @TERMINFO@ .SH NAME \fB\%@TSET@\fP, \fB\%@RESET@\fP \- @@ -124,7 +123,10 @@ unless the \*(``\fB\-I\fP\*('' option is enabled, the terminal and tab \fIinitialization\fP strings are sent to the standard error output, -and \fB@TSET@\fP waits one second (in case a hardware reset was issued). +and, +if the terminal device does not appear to be a pseudoterminal +(as might be used by a terminal emulator program), +\fB@TSET@\fP waits one second in case a hardware reset was issued. .bP Finally, if the erase, interrupt and line kill characters have changed, or are not set to their default values, their values are displayed to the @@ -133,13 +135,13 @@ When invoked as \fB@RESET@\fP, \fB@TSET@\fP sets the terminal modes to \*(``sane\*('' values: .bP -sets cooked and echo modes, +sets canonical (\*(``cooked\*('') and echo modes, .bP turns off cbreak and raw modes, .bP turns on newline translation and .bP -resets any unset special characters to their default values +resets special input characters to their default values .PP before doing the terminal initialization described above. @@ -314,12 +316,12 @@ .I /etc/ttys system port name to terminal type mapping database (BSD versions only). .TP -.I \*d +.I @TERMINFO@ compiled terminal description database directory .SH PORTABILITY -Neither IEEE Std 1003.1/The Open Group Base Specifications Issue 7 +Neither IEEE Std 1003.1/The Open Group Base Specifications Issue\ 7 (POSIX.1-2008) nor -X/Open Curses Issue 7 documents \fB@TSET@\fP or \fB@RESET@\fP. +X/Open Curses Issue\ 7 documents \fB@TSET@\fP or \fB@RESET@\fP. .PP The AT&T \fBtput\fP utility (AIX, HP-UX, Solaris) incorporated the terminal-mode manipulation as well as termcap-based features diff --git a/contrib/ncurses/man/user_caps.5 b/contrib/ncurses/man/user_caps.5 --- a/contrib/ncurses/man/user_caps.5 +++ b/contrib/ncurses/man/user_caps.5 @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: user_caps.5,v 1.49 2024/03/16 15:35:01 tom Exp $ -.TH user_caps 5 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "File formats" +.\" $Id: user_caps.5,v 1.60 2025/11/12 01:01:01 tom Exp $ +.TH user_caps 5 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "File formats" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -47,260 +47,456 @@ .. .SH NAME user_caps \- -user-defined \fIterminfo\fR capability format +user-defined \%\fIterm\%info\fP capability format .SH SYNOPSIS .B @INFOCMP@ \-x .PP .B @TIC@ \-x .SH DESCRIPTION .SS Background -Before \fI\%ncurses\fP 5.0, -terminfo databases used a \fIfixed repertoire\fP of terminal -capabilities designed for the SVr2 terminal database in 1984, -and extended in stages through SVr4 (1989), -and standardized in the Single Unix Specification beginning in 1995. +Prior to +.I \%ncurses +5.0 (1999), +.I \%term\%info +databases used a +.I "fixed repertoire" +of terminal capabilities designed +for the SVr2 terminal database in 1984, +added to in stages through SVr4 (1989), +and standardized in X/Open Curses starting in 1995. +.\" That date is a surmise based on the capability list appearing in +.\" Issue 4, Version 2 (1996). That list is not in man page format in +.\" the standard, so lacks a "HISTORY" section. However, `tigetstr()` +.\" and `tputs()` are identified in the same document as new to Issue 4, +.\" so GBR conjectures that the list came in at the same time. +.\" +.\" TED: the list is reflected in term.h, seen in examples from AIX 3 and 4, +.\" HP-UX 9, OSF/1, Solaris 2.4, dating from 1992-1994 -- all before 1996. +.\" The AIX 4 file has copyright dates starting in 1984; +.\" the Solaris file cites 1988 (the others have no copyright comments). +.\" Those term.h files note in a comment that it is generated by a script with +.\" a data file, i.e., +.\" term.h - this file is automatically made from caps and maketerm.ex. +.\" illumos-gate has related source, with a "caps" file having AT&T copyright +.\" for 1988, and UCB copyright for 1982, 1986, 1988. That 1982 is interesting +.\" (hinting that something may have been in the initial releases of System V) +.\" but the first release with tic appears to be SVr2 in 1984. .PP -Most of the \fIextensions\fP in this fixed repertoire were additions -to the tables of Boolean, numeric and string capabilities. -Rather than change the meaning of an existing capability, a new name was added. -The terminfo database uses a binary format; binary compatibility was -ensured by using a header which gave the number of items in the -tables for each type of capability. -The standardization was incomplete: +Most such additions to this fixed repertoire +suppelmented the tables of Boolean, +numeric, +and string capabilities. +Rather than changing the meaning of an existing capability, +a new name was added. +The +.I \%term\%info +database uses a binary format; +binary compatibility was ensured +by using a header +that counted the number of items in the tables +for each type of capability. +Because each +.I curses +vendor extended the standard capability lists in distinct ways, +a library could be programmed to recognize only compiled +.I \%term\%info +entries that it was prepared to interpret. +Standardization was incomplete. .bP -The \fIbinary format\fP itself is not described -in the X/Open Curses documentation. -Only the \fIsource format\fP is described. +X/Open Curses describes only the +.I source +format, +not its +.I binary +representation on disk. .IP -Library developers rely upon the SVr4 documentation, -and reverse-engineering the compiled terminfo files to match the binary format. +Library developers rely upon SVr4 documentation +and reverse engineering of compiled +.I \%term\%info +files to match the binary format. .bP -Lacking a standard for the binary format, most implementations -copy the SVr2 binary format, which uses 16-bit signed integers, +Lacking a standard for the binary format, +most implementations copy the SVr2 binary format, +which uses 16-bit signed integers, and is limited to 4096-byte entries. .IP -The format cannot represent very large numeric capabilities, -nor can it represent large numbers of special keyboard definitions. +The SVr2 format cannot represent very large numeric capability values, +nor can it represent large numbers of key definitions, +as are required to distinguish multiple modifier keys used +in combination with a function key. .bP The tables of capability names differ between implementations. .IP -Although they \fImay\fP provide all of the standard capability names, -the position in the tables differs because some features were added as needed, -while others were added (out of order) to comply with X/Open Curses. +Although they +.I may +provide all of the standard capability names, +each arranges its table entries differently +because some features were added as needed, +while others were added +\(em out of order \(em +for X/Open Curses conformance. .IP -While \fI\%ncurses\fP' repertoire of predefined capabilities is closest -to Solaris, -Solaris's terminfo database has a few differences from -the list published by X/Open Curses. -For example, -\fI\%ncurses\fP can be configured with tables which match the terminal -databases for AIX, HP-UX or OSF/1, +While +.IR ncurses 's +capability repertoire is closest to that of Solaris, +the set of capabilities supported by +each vendor's +.I \%term\%info +database differs +from the list published by X/Open Curses. +.I \%ncurses +can be configured +with tables that match the terminal databases +for AIX, +HP-UX, +or OSF/1, rather than the default Solaris-like configuration. .bP -In SVr4 curses and \fI\%ncurses\fP, -the terminal database is defined at compile-time using a text file -which lists the different terminal capabilities. +In SVr4 +.I curses +and +.IR \%ncurses "," +the terminal database is defined at compile time +by interpolating a text file +that lists the different terminal capabilities. .IP -In principle, the text-file can be extended, -but doing this requires recompiling and reinstalling the library. -The text-file used in \fI\%ncurses\fP for terminal capabilities includes -details for various systems past the documented X/Open Curses features. -For example, \fI\%ncurses\fP supports these capabilities in each configuration: +In principle, +the text file can be extended, +but doing so requires recompiling and reinstalling the library. +The text file used by +.I \%ncurses +for terminal capabilities includes details of extensions +to X/Open Curses +made by various systems. +For example, +.I \%ncurses +supports the following nonstandard capabilities in each configuration. .RS 8 .TP 5 -memory_lock -(meml) +.B memory_lock +.RB ( meml ) lock memory above cursor .TP 5 -memory_unlock -(memu) +.B memory_unlock +.RB ( memu ) unlock memory .TP 5 -box_chars_1 -(box1) +.B box_chars_1 +.RB ( box1 ) box characters primary set .RE .IP The memory lock/unlock capabilities were included because they were used -in the X11R6 terminal description for \fBxterm\fP(1). -The \fIbox1\fP capability is used in @TIC@ to help with terminal descriptions -written for AIX. +in the X11R6 terminal description for \fIxterm\fP(1). +.B \%@TIC@ +uses the +.B box1 +capability to cope with terminal descriptions written for AIX. .PP -During the 1990s, some users were reluctant to use terminfo -in spite of its performance advantages over termcap: +During the 1990s, +some application developers were reluctant to use +.I \%term\%info +in spite of its performance +(and other) +advantages over +.IR termcap "." .bP -The fixed repertoire prevented users from adding features -for unanticipated terminal improvements +The fixed repertoire prevented users from adding support +for terminal features unanticipated by X/Open Curses (or required them to reuse existing capabilities as a workaround). .bP The limitation to 16-bit signed integers was also mentioned. -Because termcap stores everything as a string, +Because +.I termcap +stores everything as a string, it could represent larger numbers. .PP -Although termcap's extensibility was rarely used -(it was never the \fIspeaker\fP who had actually used the feature), +Although +.IR termcap 's +extensibility was rarely used +\(em the claimant was never an implementor +who had actually exercised it \(em the criticism had a point. -\fI\%ncurses\fP 5.0 provided a way to detect nonstandard capabilities, -determine their -type and optionally store and retrieve them in a way which did not interfere -with other applications. -These are referred to as \fIuser-defined capabilities\fP because no -modifications to the toolset's predefined capability names are needed. +.I \%ncurses +5.0 provided a way to detect nonstandard capabilities, +to determine their type, +and to optionally store and retrieve them +in a way that did not interfere with other applications. +.I ncurses +terms these +.I "user-defined capabilities" +because no modifications +to the standard capability list are needed. .PP -The \fI\%ncurses\fP utilities \fB@TIC@\fP and \fB@INFOCMP@\fP have a -command-line option \*(``\-x\*('' to control whether the nonstandard -capabilities are stored or retrieved. -A library function \fBuse_extended_names\fP -is provided for the same purpose. +The +.I \%ncurses +utilities +.B \%@TIC@ +and +.B \%@INFOCMP@ +have a command-line option \*(``\-x\*('' +to control whether the nonstandard capabilities +are stored or retrieved. +.I \%ncurses +provides \fBuse_extended_names\fP(3X) to programs for the same purpose. .PP -When compiling a terminal database, if \*(``\-x\*('' is set, -\fB@TIC@\fP will store a user-defined capability if the capability name is not -one of the predefined names. +When compiling a terminal database, if \*(``\-x\*('' is used, +.B \%@TIC@ +stores a user-defined capability +if the capability name is not standard. .PP -Because \fI\%ncurses\fP provides a termcap library interface, -these user-defined capabilities may be visible to termcap applications: +Because +.I \%ncurses +provides a +.I termcap +library interface, +these user-defined capabilities may be visible to +.I termcap +applications. .bP -The termcap interface (like all implementations of termcap) -requires that the capability names are 2-characters. +The +.I termcap +interface +(like all implementations of +.IR termcap ) +restricts capability names to two characters. .IP -When the capability is simple enough for use in a termcap application, -it is provided as a 2-character name. +When the capability is simple enough for use in a +.I termcap +application, +it is provided as a two-character name. .bP -There are other -user-defined capabilities which refer to features not usable in termcap, -e.g., parameterized strings that use more than two parameters -or use more than the trivial expression support provided by termcap. -For these, the terminfo database should have only capability names with -3 or more characters. +Other user-defined capabilities employ features not usable in +.IR termcap "," +such as parameterized strings that use more than two parameters +or require more powerful expressions than +.I termcap +supports. +Such capabilities should, +in the +.I \%term\%info +database, +have names at least three characters in length. .bP Some terminals can send distinct strings for special keys (cursor-, keypad- or function-keys) depending on modifier keys (shift, control, etc.). -While terminfo and termcap have a set of 60 predefined function-key names, +While +.I \%term\%info +and +.I termcap +define a set of sixty function key names, to which a series of keys can be assigned, that is insufficient for more than a dozen keys multiplied by more than a couple of modifier combinations. -The \fI\%ncurses\fP database uses a convention based on \fBxterm\fP(1) +The +.I \%ncurses +database uses a convention based on \fIxterm\fP(1) to provide extended special-key names. .IP -Fitting that into termcap's limitation of 2-character names +Fitting that into +.IR termcap 's +limitation of 2-character names would be pointless. -These extended keys are available only with terminfo. +These extended keys are available only with +.IR \%term\%info "." .SS "Recognized Capabilities" -The \fI\%ncurses\fP library uses the user-definable capabilities. -While the terminfo database may have other extensions, -\fI\%ncurses\fP makes explicit checks for these: +The +.I \%ncurses +library employs user-definable capabilities. +While the +.I \%term\%info +database may have other extensions, +.I \%ncurses +makes explicit checks for the following. .RS 3 .TP 3 -AX -\fIBoolean\fP, asserts that the terminal interprets SGR 39 and SGR 49 -by resetting the foreground and background color, respectively, to the default. +.B AX +(Boolean) +asserts that the terminal interprets SGR 39 and SGR 49 +by resetting the foreground and background colors, +respectively, +to the default. .IP -This is a feature recognized by the \fBscreen\fP program as well. +\fBscreen\fP(1) +recognizes this capability as well. .TP 3 -E3 -\fIstring\fP, tells how to clear the terminal's scrollback buffer. -When present, the \fBclear\fP(1) program sends this before clearing -the terminal. +.B E3 +(string) +tells an application how to clear the terminal's scrollback buffer. +When present, +the \fBclear\fP(1) program sends this before clearing the terminal. .IP -The command \*(``\fBtput clear\fP\*('' does the same thing. +The command +.RB \*(`` "tput clear" \*('' +does the same thing. .TP 3 -NQ -\fIBoolean\fP, -used to suppress a consistency check in @TIC@ for the \fI\%ncurses\fP -capabilities -in user6 through user9 (u6, u7, u8 and u9) -which tell how to query the terminal's cursor position +.B NQ +(Boolean) +suppresses a consistency check in +.B \%@TIC@ +for the +.I \%ncurses +string capabilities +.B user6 +.RB ( u6 ) +through +.B user9 +.RB ( u9 ), +which tell an application how to query the terminal's cursor position and its device attributes. .TP 3 -RGB -\fIBoolean\fP, \fInumber\fP \fBor\fP \fIstring\fP, -used to assert that the -\fBset_a_foreground\fP and -\fBset_a_background\fP capabilities correspond to \fIdirect colors\fP, +.B RGB +(Boolean, +numeric, +or +string) +asserts that the +.B \%set_a_foreground +.RB ( setaf ) +and +.B \%set_a_background +.RB ( setab ) +capabilities employ +.IR "direct colors" "," using an RGB (red/green/blue) convention. -This capability allows the \fBcolor_content\fP function to -return appropriate values without requiring the application -to initialize colors using \fBinit_color\fP. +This capability allows \fBcolor_content\fP(3X) +to return appropriate values +without requiring the application +to initialize colors using \fBinit_color\fP(3X). .IP -The capability type determines the values which \fI\%ncurses\fP sees: +The capability type determines the values +.I \%ncurses +sees. .RS 3 .TP 3 -\fIBoolean\fP -implies that the number of bits for red, green and blue are the same. -Using the maximum number of colors, -\fI\%ncurses\fP adds two, -divides that sum by three, +Boolean +implies that the number of bits for red, +green, +and blue are the same. +Starting with the value of the capability +.B max_colors +.RB \%( colors ; +.I termcap: +.BR co ), +.I \%ncurses +adds two, +divides the sum by three, and assigns the result to red, -green and blue in that order. +green, +and blue, +in that order. .IP -If the number of bits needed for the number of colors is not a multiple -of three, the blue (and green) components lose in comparison to red. +If the number of bits needed for the number of colors +is not a multiple of three, +the blue (and green) color channels lose in comparison to red. .TP 3 -\fInumber\fP -tells \fI\%ncurses\fP what result to add to red, green and blue. -If \fI\%ncurses\fP runs out of bits, -blue (and green) lose just as in the \fIBoolean\fP case. +numeric +tells +.I \%ncurses +what result to add to red, +green, +and blue. +If +.I \%ncurses +runs out of bits, +blue (and green) lose just as in the Boolean case. .TP 3 -\fIstring\fP -explicitly list the number of bits used for red, green and blue components +string +specify the quantity of bits used for +red, +green, +and blue color channels as a slash-separated list of decimal integers. .RE .IP Because there are several RGB encodings in use, -applications which make assumptions about the number of bits per color +applications that make assumptions +about the number of bits per color channel are unlikely to work reliably. -As a trivial case, for example, one could define \fBRGB#1\fP -to represent the standard eight ANSI colors, i.e., one bit per color. +As a trivial case, +one could define +.B RGB#1 +to represent the standard eight ANSI\ X3.64/ECMA-48/ISO\ 6429 colors +using one bit per color channel. .TP 3 -U8 -\fInumber\fP, -asserts that \fI\%ncurses\fP must use Unicode values for line-drawing -characters, -and that it should ignore the alternate character set capabilities +.B U8 +(numeric) +asserts whether +.I \%ncurses +must use Unicode values for line-drawing characters, +and that it should ignore the alternate character set (ACS) capabilities when the locale uses UTF-8 encoding. -For more information, see the discussion of -\fBNCURSES_NO_UTF8_ACS\fP in \fB\%ncurses\fP(3X). +See the discussion of +.B \%NCURSES_NO_UTF8_ACS +in section \*(``ENVIRONMENT\*('' of \fB\%ncurses\fP(3X). .IP Set this capability to a nonzero value to enable it. .TP 3 -XM -\fIstring\fP, -override \fI\%ncurses\fP's built-in string which -enables/disables \fBxterm\fP(1) mouse mode. +.B XM +(string) +override +.IR \%ncurses 's +built-in string that directs \fIxterm\fP(1) +to enable or disable mouse mode. .IP -\fI\%ncurses\fP sends a character sequence to the terminal to initialize mouse mode, -and when the user clicks the mouse buttons or (in certain modes) moves the -mouse, handles the characters sent back by the terminal to tell it what -was done with the mouse. +.I \%ncurses +sends a character sequence to the terminal to initialize mouse mode, +and when the user clicks the mouse buttons or +(in certain modes) +moves the mouse, +handles the characters sent back by the terminal +to tell the application what was done with the mouse. .IP -The mouse protocol is enabled when -the \fImask\fP passed in the \fBmousemask\fP function is nonzero. +The mouse protocol is enabled +when the +.I \fImask\fP +argument to the \fBmousemask\fP(3X) function is nonzero. By default, -\fI\%ncurses\fP handles the responses for the X11 xterm mouse protocol. -It also knows about the \fISGR 1006\fP xterm mouse protocol, -but must to be told to look for this specifically. -It will not be able to guess which mode is used, +.I \%ncurses +handles the responses for the X11 +.I xterm +mouse protocol. +It also knows about the SGR\ 1006 +.I xterm +mouse protocol, +but must to be told to look for it specifically. +.I \%ncurses +is not be able to guess which of the two modes is used, because the responses are enough alike that only confusion would result. .IP -The \fBXM\fP capability has a single parameter. -If nonzero, the mouse protocol should be enabled. -If zero, the mouse protocol should be disabled. -\fI\%ncurses\fP inspects this capability if it is present, +The +.B XM +capability has a single numeric parameter. +If nonzero, +the mouse protocol should be enabled. +If zero, +the mouse protocol should be disabled. +.I \%ncurses +inspects this capability if it is present, to see whether the 1006 protocol is used. -If so, it expects the responses to use the \fISGR 1006\fP xterm mouse protocol. +If so, +it expects the responses to use the SGR\ 1006 +.I xterm +mouse protocol. .IP -The xterm mouse protocol is used by other terminal emulators. -The terminal database uses building-blocks for the various xterm mouse -protocols which can be used in customized terminal descriptions. +The +.I xterm +mouse protocol is used by other terminal emulators. +The terminal database uses building blocks for the various +.I xterm +mouse protocols usable in customized terminal descriptions. .IP -The terminal database building blocks for this mouse -feature also have an experimental capability \fIxm\fP. -The \*(``xm\*('' capability describes the mouse response. -Currently there is no interpreter which would use this -information to make the mouse support completely data-driven. +The terminal database building blocks for this mouse feature +also have an experimental capability, +.BR xm "," +that describes the mouse response. +No known interpreter uses this information, +which could make mouse support completely data-driven. .IP -\fIxm\fP shows the format of the mouse responses. -In this experimental capability, the parameters are +.B xm +shows the format of the mouse responses. +In this experimental capability, +the parameters are as follows. .RS 5 .TP 5 .I p1 @@ -329,8 +525,10 @@ .RE .IP Here are examples from the terminal database for the most commonly used -xterm mouse protocols: +.I xterm +mouse protocols. .IP +.EX .nf xterm+x11mouse|X11 xterm mouse protocol, kmous=\eE[M, XM=\eE[?1000%?%p1%{1}%=%th%el%;, @@ -338,7 +536,7 @@ %?%p4%t%p3%e%{3}%;%'\ '%+%c %p2%'!'%+%c %p1%'!'%+%c, - +.IP xterm+sm+1006|xterm SGR-mouse, kmous=\eE[<, XM=\eE[?1006;1000%?%p1%{1}%=%th%el%;, xm=\eE[<%i%p3%d; @@ -346,18 +544,20 @@ %p2%d; %?%p4%tM%em%;, .fi +.EE . .SS "Extended Key Definitions" Several terminals provide the ability to send distinct strings for combinations of modified special keys. There is no standard for what those keys can send. .PP -Since 1999, \fBxterm\fP(1) has supported +Since 1999, \fIxterm\fP(1) has supported \fIshift\fP, \fIcontrol\fP, \fIalt\fP, and \fImeta\fP modifiers which produce distinct special-key strings. In a terminal description, \fI\%ncurses\fP has no special knowledge of the modifiers used. -Applications can use the \fInaming convention\fP established for \fBxterm\fP +Applications can use the \fInaming convention\fP established for +\fIxterm\fP to find these special keys in the terminal description. .PP Starting with the @@ -403,9 +603,10 @@ .PP .RS 5 .TS -tab(/) ; -l l . -\fBValue\fP/\fBDescription\fP +tab(/); +Lb Lb +L L . +Value/Description _ 2/Shift 3/Alt @@ -425,8 +626,14 @@ .TE .RE .PP -None of these are predefined; terminal descriptions can refer to \fInames\fP -which \fI\%ncurses\fP will allocate at runtime to \fIkey-codes\fP. +.I ncurses +defines no capabilities for modified F-keys; +terminal descriptions can refer to +.I names +that +.I \%ncurses +allocates at runtime to +.IR "key codes" "." To use these keys in an \fI\%ncurses\fP program, an application could do this: .bP @@ -438,27 +645,34 @@ would be returned for those keys by \fBwgetch\fP(3X). .\" .SH PORTABILITY -The \*(``\-x\*('' extension feature of \fB@TIC@\fP and \fB@INFOCMP@\fP -has been adopted in NetBSD curses. +The \*(``\-x\*('' extension feature of +.B \%@TIC@ +and +.B \%@INFOCMP@ +has been adopted in NetBSD +.IR curses "." That implementation stores user-defined capabilities, but makes no use of these capabilities itself. .\" .SH AUTHORS Thomas E. Dickey .br -beginning with \fI\%ncurses\fP 5.0 (1999) +beginning with +.I \%ncurses +5.0 (1999) .\" .SH SEE ALSO \fB\%@INFOCMP@\fP(1M), \fB\%@TIC@\fP(1M) .PP -The terminal database section -.I "NCURSES USER-DEFINABLE CAPABILITIES" +In the source form of the terminal database, +.IR \%terminfo.src "," +the section \*(``NCURSES USER-DEFINABLE CAPABILITIES\*(''. summarizes commonly-used user-defined capabilities -which are used in the terminal descriptions. +employed in the terminal descriptions. Some of those features are mentioned in \fB\%screen\fP(1) or \fBtmux\fP(1). .PP .I "XTerm Control Sequences" -provides further information on the \fB\%xterm\fP(1) features +provides further information on the \fI\%xterm\fP(1) features that are used in these extended capabilities. diff --git a/contrib/ncurses/man/wresize.3x b/contrib/ncurses/man/wresize.3x --- a/contrib/ncurses/man/wresize.3x +++ b/contrib/ncurses/man/wresize.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2015 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -29,8 +29,8 @@ .\" .\" Author: Thomas E. Dickey 1996 .\" -.\" $Id: wresize.3x,v 1.36 2024/03/16 15:35:01 tom Exp $ -.TH wresize 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: wresize.3x,v 1.47 2025/01/19 00:51:54 tom Exp $ +.TH wresize 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fB\%wresize\fP \- resize a \fIcurses\fR window @@ -38,35 +38,94 @@ .nf \fB#include .PP -\fBint wresize(WINDOW *\fIwin\fP, int \fIlines\fP, int \fIcolumns\fP); +\fBint wresize(WINDOW * \fIwin\fP, int \fIlines\fP, int \fIcolumns\fP); .fi .SH DESCRIPTION -This \fI\%ncurses\fP extension to standard \fIcurses\fP reallocates -storage for a \fIcurses\fP window to adjust its dimensions to the -specified values. +.BR \%wresize "," +an +.I \%ncurses +extension to the +.I curses +library, +reallocates storage for +.IR win , +adjusting its dimensions to +.I lines +and +.IR columns "." If either dimension is larger than its current value, -the expanded part of the window is filled with blanks merged with -current background rendition -(as set by \fB\%wbkgdset\fP(3X)). +.I \%ncurses +fills the expanded part of the window +with the window's background character as configured by +\fB\%wbkgdset\fP(3X) +(wide-character API: \fB\%wbkgrndset\fP(3X)). .SH RETURN VALUE -\fB\%wresize\fP returns \fBERR\fP upon failure and \fBOK\fP on success. -It will fail if either of the dimensions is less than or equal to zero, -or if an error occurs while (re)allocating memory for the window. +.B \%wresize +returns +.B OK +on success and +.B ERR +on failure. +It fails if either +.I lines +or +.I columns +is less than or equal to zero, +or if an error occurs while (re)allocating memory for +.IR win "." .SH NOTES -The only restriction placed on the dimensions is that they be greater -than zero. -They are \fInot\fP compared to the \fIcurses\fP screen dimensions; +The only restriction placed on the values of +.I lines +and +.I columns +is that they be greater than zero. +They are +.I not +compared to the dimensions of the +.I curses +screen; this keeps the logic of \fB\%resizeterm\fP(3X) simple. -The caller must ensure that the window's dimensions fit within the -actual screen dimensions. +The caller must ensure that +.IR win 's +dimensions fit within those of the screen. +.SH EXTENSIONS +.B \%wresize +is an \fB\%ncurses\fP(3X) extension, +and is not found in SVr4 +.IR curses "," +4.4BSD +.IR curses "," +or any other previous +.I curses +implementation. .SH PORTABILITY -It is not possible to resize windows with SVr4 \fIcurses\fP. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. .PP -\fI\%ncurses\fP introduced this extension in mid-1995. -NetBSD \fIcurses\fP adopted it in 2001, -and \fI\%PDCurses\fP in 2003. +NetBSD +.I curses +adopted +.I \%wresize +in 2001 (release 1.5.3), +and +.I \%PDCurses +in 2004 (version 2.7). +.PP +It is not possible to resize windows with SVr4 +.IR curses "." +.SH HISTORY +Thomas Dickey developed +.I \%wresize +as an extension to BSD +.I curses +in 1988, +and brought it to +.I \%ncurses +in mid-1995. .SH AUTHORS Thomas Dickey -(from an equivalent function written in 1988 for BSD \fIcurses\fP). .SH SEE ALSO \fB\%resizeterm\fP(3X) diff --git a/contrib/ncurses/menu/Makefile.in b/contrib/ncurses/menu/Makefile.in --- a/contrib/ncurses/menu/Makefile.in +++ b/contrib/ncurses/menu/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.71 2021/07/03 15:45:33 tom Exp $ +# $Id: Makefile.in,v 1.76 2025/10/25 17:59:51 tom Exp $ ############################################################################## -# Copyright 2020,2021 Thomas E. Dickey # +# Copyright 2020-2024,2025 Thomas E. Dickey # # Copyright 1998-2015,2018 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -47,11 +47,14 @@ VPATH = @srcdir@ THIS = Makefile +@SET_MAKE@ +@SET_DESTDIR@ +TOP_MFLAGS = DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)" + x = @EXEEXT@ o = .@OBJEXT@ MODEL = @DFT_LWR_MODEL@ -DESTDIR = @DESTDIR@ top_srcdir = @top_srcdir@ srcdir = @srcdir@ prefix = @prefix@ @@ -61,7 +64,9 @@ includedir = @includedir@ includesubdir = @includesubdir@ -INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) +INCLUDEDIR = $(DESTDIR)$(includedir@MERGE_PREFIX@)$(includesubdir) +BINDIR = $(DESTDIR)$(bindir@MERGE_PREFIX@) +LIBDIR = $(DESTDIR)$(libdir@MERGE_PREFIX@) PACKAGE = @PACKAGE@ @@ -110,7 +115,7 @@ LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@ SHLIB_DIRS = -L../lib -SHLIB_LIST = $(SHLIB_DIRS) -lncurses@USE_LIB_SUFFIX@ @SHLIB_LIST@ +SHLIB_LIST = $(SHLIB_DIRS) -lncurses@ABI_SUFFIX@ @SHLIB_LIST@ RPATH_LIST = @RPATH_LIST@ RESULTING_SYMS = @RESULTING_SYMS@ @@ -153,10 +158,13 @@ libs \ install :: $(AUTO_SRC) $(LIBRARIES) +check :: + @echo "no unit-test implemented" + sources : $(AUTO_SRC) -$(DESTDIR)$(bindir) \ -$(DESTDIR)$(libdir) : +$(BINDIR) \ +$(LIBDIR) : mkdir -p $@ # make copies to simplify include-paths while still keeping menu's include @@ -207,6 +215,12 @@ realclean :: distclean +# These rules are used to allow "make -n" to work on a clean directory-tree +../include/curses.h \ +../include/ncurses_def.h \ +../include/term.h : + ( cd ../include && $(MAKE) $(TOP_MFLAGS) ) + ############################################################################### # The remainder of this file is automatically generated during configuration ############################################################################### diff --git a/contrib/ncurses/menu/m_driver.c b/contrib/ncurses/menu/m_driver.c --- a/contrib/ncurses/menu/m_driver.c +++ b/contrib/ncurses/menu/m_driver.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2012,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,7 +38,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_driver.c,v 1.37 2021/03/27 23:46:29 tom Exp $") +MODULE_ID("$Id: m_driver.c,v 1.39 2024/12/07 22:01:57 tom Exp $") /* Macros */ @@ -307,7 +307,7 @@ else { my_top_row += rdiff; - while (rdiff-- > 0 && item != 0 && item->down != 0) + while (rdiff-- > 0 && item != NULL && item->down != NULL) item = item->down; } break; @@ -320,7 +320,7 @@ else { my_top_row -= rdiff; - while (rdiff-- > 0 && item != 0 && item->up != 0) + while (rdiff-- > 0 && item != NULL && item->up != NULL) item = item->up; } break; @@ -449,7 +449,7 @@ else if (KEY_MOUSE == c) { MEVENT event; - WINDOW *uwin = Get_Menu_UserWin(menu); + const WINDOW *uwin = Get_Menu_UserWin(menu); getmouse(&event); if ((event.bstate & (BUTTON1_CLICKED | @@ -459,7 +459,7 @@ { /* we react only if the click was in the userwin, that means * inside the menu display area or at the decoration window. */ - WINDOW *sub = Get_Menu_Window(menu); + const WINDOW *sub = Get_Menu_Window(menu); int ry = event.y, rx = event.x; /* screen coordinates */ result = E_REQUEST_DENIED; @@ -548,7 +548,7 @@ result = E_UNKNOWN_COMMAND; } - if (item == 0) + if (item == NULL) { result = E_BAD_STATE; } diff --git a/contrib/ncurses/menu/m_global.c b/contrib/ncurses/menu/m_global.c --- a/contrib/ncurses/menu/m_global.c +++ b/contrib/ncurses/menu/m_global.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2021,2023 Thomas E. Dickey * + * Copyright 2020-2023,2024 Thomas E. Dickey * * Copyright 1998-2012,2014 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,7 +38,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_global.c,v 1.34 2023/09/16 16:39:26 tom Exp $") +MODULE_ID("$Id: m_global.c,v 1.35 2024/12/07 23:02:27 tom Exp $") static char mark[] = "-"; /* *INDENT-OFF* */ @@ -256,13 +256,13 @@ int result = item->length; T((T_CALLED("_nc_menu_text_width(%p)"), (const void *)item)); - if (result != 0 && item->str != 0) + if (result != 0 && item->str != NULL) { - int count = (int)mbstowcs(0, item->str, 0); - wchar_t *temp = 0; + int count = (int)mbstowcs(NULL, item->str, 0); + wchar_t *temp = NULL; if (count > 0 - && (temp = typeMalloc(wchar_t, 2 + count)) != 0) + && (temp = typeMalloc(wchar_t, 2 + count)) != NULL) { int n; @@ -296,7 +296,7 @@ assert(menu && menu->items); - if (menu->items != 0) + if (menu->items != NULL) { ITEM **items; diff --git a/contrib/ncurses/menu/m_item_new.c b/contrib/ncurses/menu/m_item_new.c --- a/contrib/ncurses/menu/m_item_new.c +++ b/contrib/ncurses/menu/m_item_new.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2010,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -45,7 +45,7 @@ #endif #endif -MODULE_ID("$Id: m_item_new.c,v 1.38 2021/06/17 21:26:02 tom Exp $") +MODULE_ID("$Id: m_item_new.c,v 1.40 2024/12/07 22:01:57 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -60,16 +60,16 @@ static bool Is_Printable_String(const char *s) { - int result = TRUE; + bool result = TRUE; #if USE_WIDEC_SUPPORT - int count = (int)mbstowcs(0, s, 0); - wchar_t *temp = 0; + int count = (int)mbstowcs(NULL, s, 0); + wchar_t *temp = NULL; assert(s); if (count > 0 - && (temp = typeCalloc(wchar_t, (2 + (unsigned)count))) != 0) + && (temp = typeCalloc(wchar_t, (2 + (unsigned)count))) != NULL) { int n; @@ -231,7 +231,7 @@ else { menu->mark = old_mark; - menu->marklen = (short)((old_mark != 0) ? strlen(old_mark) : 0); + menu->marklen = (short)((old_mark != NULL) ? strlen(old_mark) : 0); RETURN(E_SYSTEM_ERROR); } } diff --git a/contrib/ncurses/menu/m_item_vis.c b/contrib/ncurses/menu/m_item_vis.c --- a/contrib/ncurses/menu/m_item_vis.c +++ b/contrib/ncurses/menu/m_item_vis.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2004,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,7 +38,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_vis.c,v 1.20 2021/06/17 21:20:30 tom Exp $") +MODULE_ID("$Id: m_item_vis.c,v 1.21 2024/07/27 18:14:09 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -53,7 +53,7 @@ MENU_EXPORT(bool) item_visible(const ITEM *item) { - MENU *menu; + const MENU *menu; T((T_CALLED("item_visible(%p)"), (const void *)item)); if (item && diff --git a/contrib/ncurses/menu/m_pattern.c b/contrib/ncurses/menu/m_pattern.c --- a/contrib/ncurses/menu/m_pattern.c +++ b/contrib/ncurses/menu/m_pattern.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2006,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,7 +38,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_pattern.c,v 1.20 2021/06/17 21:20:30 tom Exp $") +MODULE_ID("$Id: m_pattern.c,v 1.21 2024/12/07 23:00:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -57,7 +57,7 @@ static char empty[] = ""; T((T_CALLED("menu_pattern(%p)"), (const void *)menu)); - returnPtr(menu ? (menu->pattern ? menu->pattern : empty) : 0); + returnPtr(menu ? (menu->pattern ? menu->pattern : empty) : NULL); } /*--------------------------------------------------------------------------- diff --git a/contrib/ncurses/menu/m_post.c b/contrib/ncurses/menu/m_post.c --- a/contrib/ncurses/menu/m_post.c +++ b/contrib/ncurses/menu/m_post.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2021,2022 Thomas E. Dickey * + * Copyright 2020-2022,2024 Thomas E. Dickey * * Copyright 1998-2010,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,7 +38,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_post.c,v 1.38 2022/09/24 09:38:44 tom Exp $") +MODULE_ID("$Id: m_post.c,v 1.41 2024/07/27 18:08:59 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -67,7 +67,7 @@ - it is a onevalued menu and it is the current item - or it has a selection value */ - wattron(menu->win, (int)menu->back); + wattr_on(menu->win, menu->back, NULL); if (item->value || (item == menu->curitem)) { if (menu->marklen) @@ -79,13 +79,13 @@ item. */ if (!(menu->opt & O_ONEVALUE) && item->value && item != menu->curitem) { - wattron(menu->win, (int)menu->fore); + wattr_on(menu->win, menu->fore, NULL); isfore = TRUE; } waddstr(menu->win, menu->mark); if (isfore) { - wattron(menu->win, (int)menu->fore); + wattr_on(menu->win, menu->fore, NULL); isfore = FALSE; } } @@ -93,7 +93,7 @@ else /* otherwise we have to wipe out the marker area */ for (ch = ' ', i = menu->marklen; i > 0; i--) waddch(menu->win, ch); - wattroff(menu->win, (int)menu->back); + wattr_off(menu->win, menu->back, NULL); count += menu->marklen; /* First we have to calculate the attribute depending on selectability @@ -101,19 +101,19 @@ */ if (!(item->opt & O_SELECTABLE)) { - wattron(menu->win, (int)menu->grey); + wattr_on(menu->win, menu->grey, NULL); isgrey = TRUE; } else { if (item->value || item == menu->curitem) { - wattron(menu->win, (int)menu->fore); + wattr_on(menu->win, menu->fore, NULL); isfore = TRUE; } else { - wattron(menu->win, (int)menu->back); + wattr_on(menu->win, menu->back, NULL); isback = TRUE; } } @@ -159,10 +159,10 @@ assert(cx >= 0 && cy >= 0); getyx(menu->win, ncy, ncx); if (isgrey) - wattroff(menu->win, (int)menu->grey); + wattr_off(menu->win, menu->grey, NULL); else if (isfore) - wattroff(menu->win, (int)menu->fore); - wattron(menu->win, (int)menu->back); + wattr_off(menu->win, menu->fore, NULL); + wattr_on(menu->win, menu->back, NULL); for (j = 1; j < menu->spc_rows; j++) { if ((item_y + j) < getmaxy(menu->win)) @@ -176,17 +176,17 @@ } wmove(menu->win, ncy, ncx); if (!isback) - wattroff(menu->win, (int)menu->back); + wattr_off(menu->win, menu->back, NULL); } } /* Remove attributes */ if (isfore) - wattroff(menu->win, (int)menu->fore); + wattr_off(menu->win, menu->fore, NULL); if (isback) - wattroff(menu->win, (int)menu->back); + wattr_off(menu->win, menu->back, NULL); if (isgrey) - wattroff(menu->win, (int)menu->grey); + wattr_off(menu->win, menu->grey, NULL); } /*--------------------------------------------------------------------------- @@ -201,7 +201,7 @@ _nc_Draw_Menu(const MENU *menu) { ITEM *item = menu->items[0]; - ITEM *lastvert; + const ITEM *lastvert; ITEM *hitem; chtype s_bkgd; @@ -220,7 +220,7 @@ do { - ITEM *lasthor; + const ITEM *lasthor; wmove(menu->win, y, 0); @@ -231,7 +231,7 @@ { _nc_Post_Item(menu, hitem); - wattron(menu->win, (int)menu->back); + wattr_on(menu->win, menu->back, NULL); if (((hitem = hitem->right) != lasthor) && hitem) { int i, j, cy, cx; @@ -250,7 +250,7 @@ } } while (hitem && (hitem != lasthor)); - wattroff(menu->win, (int)menu->back); + wattr_off(menu->win, menu->back, NULL); item = item->down; y += menu->spc_rows; @@ -291,7 +291,7 @@ { int h = 1 + menu->spc_rows * (menu->rows - 1); - WINDOW *win = Get_Menu_Window(menu); + const WINDOW *win = Get_Menu_Window(menu); int maxy = getmaxy(win); if ((menu->win = newpad(h, menu->width))) diff --git a/contrib/ncurses/menu/m_req_name.c b/contrib/ncurses/menu/m_req_name.c --- a/contrib/ncurses/menu/m_req_name.c +++ b/contrib/ncurses/menu/m_req_name.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2012,2015 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,7 +38,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_req_name.c,v 1.27 2021/06/17 21:11:08 tom Exp $") +MODULE_ID("$Id: m_req_name.c,v 1.28 2024/12/07 23:00:37 tom Exp $") #define DATA(s) { s } @@ -106,7 +106,7 @@ T((T_CALLED("menu_request_by_name(%s)"), _nc_visbuf(str))); - if (str != 0 && (i = strlen(str)) != 0) + if (str != NULL && (i = strlen(str)) != 0) { char buf[16]; diff --git a/contrib/ncurses/menu/menu.priv.h b/contrib/ncurses/menu/menu.priv.h --- a/contrib/ncurses/menu/menu.priv.h +++ b/contrib/ncurses/menu/menu.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: menu.priv.h,v 1.29 2020/05/24 01:40:20 anonymous.maarten Exp $ */ +/* $Id: menu.priv.h,v 1.30 2024/08/03 15:41:22 tom Exp $ */ /*************************************************************************** * Module menu.priv.h * @@ -61,9 +61,6 @@ /* Normalize menu to default if none was given */ #define Normalize_Menu( menu ) ((menu)=(menu)?(menu):&_nc_Default_Menu) -#define Get_Menu_Screen( menu ) (menu->userwin ? \ - _nc_screen_of(menu->userwin) : CURRENT_SCREEN) - /* Get the user defined (framing) window of the menu */ #define Get_Menu_UserWin(menu) ((menu)->userwin ? \ (menu)->userwin : CURRENT_SCREEN->_stdscr) diff --git a/contrib/ncurses/menu/mf_common.h b/contrib/ncurses/menu/mf_common.h --- a/contrib/ncurses/menu/mf_common.h +++ b/contrib/ncurses/menu/mf_common.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2005,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: mf_common.h,v 0.25 2020/02/02 23:34:34 tom Exp $ */ +/* $Id: mf_common.h,v 0.27 2024/12/07 22:01:18 tom Exp $ */ /* Common internal header for menu and form library */ @@ -64,7 +64,7 @@ #if USE_RCS_IDS #define MODULE_ID(id) static const char Ident[] = id; #else -#define MODULE_ID(id) /*nothing */ +#define MODULE_ID(id) /* nothing */ #endif /* Maximum regular 8-bit character code */ @@ -88,7 +88,7 @@ /* Call object hook */ #define Call_Hook( object, handler ) \ - if ( (object) != 0 && ((object)->handler) != (void *) 0 )\ + if ( (object) != NULL && ((object)->handler) != (void *) 0 )\ {\ SetStatus(object, _IN_DRIVER);\ (object)->handler(object);\ diff --git a/contrib/ncurses/misc/Makefile.in b/contrib/ncurses/misc/Makefile.in --- a/contrib/ncurses/misc/Makefile.in +++ b/contrib/ncurses/misc/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.79 2021/11/06 23:36:12 tom Exp $ +# $Id: Makefile.in,v 1.88 2025/12/25 22:26:15 tom Exp $ ############################################################################## -# Copyright 2018-2020,2021 Thomas E. Dickey # +# Copyright 2018-2024,2025 Thomas E. Dickey # # Copyright 1998-2016,2017 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -47,10 +47,9 @@ VPATH = @srcdir@ THIS = Makefile -CF_MFLAGS = @cf_cv_makeflags@ @SET_MAKE@ +@SET_DESTDIR@ -DESTDIR = @DESTDIR@ top_srcdir = @top_srcdir@ srcdir = @srcdir@ prefix = @prefix@ @@ -61,7 +60,7 @@ datadir = @datadir@ includesubdir = @includesubdir@ -INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) +INCLUDEDIR = $(DESTDIR)$(includedir@MERGE_PREFIX@)$(includesubdir) tabsetdir = $(datadir)/tabset ticdir = @TERMINFO@ @@ -75,6 +74,17 @@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +BINDIR = $(DESTDIR)$(bindir@MERGE_PREFIX@) +DATADIR = $(DESTDIR)$(datadir@MERGE_PREFIX@) + +@MAKE_DATABASE@INSTALL_PREFIX = $(DESTDIR)$(prefix@MERGE_PREFIX@) +@MAKE_DATABASE@LIBDIR = $(DESTDIR)$(libdir@MERGE_PREFIX@) +@MAKE_DATABASE@TICDIR = $(DESTDIR)$(ticdir@MERGE_PREFIX@) +@MAKE_DATABASE@TICFILE = $(DESTDIR)$(ticfile@MERGE_PREFIX@) +@MAKE_DATABASE@TABSETDIR = $(DESTDIR)$(tabsetdir@MERGE_PREFIX@) + +@MAKE_PC_FILES@INSTALL_CONFIG = $(DESTDIR)$(PKG_CONFIG_LIBDIR@MERGE_PREFIX@) + ################################################################################ @MAKE_PHONY@.PHONY : all @@ -97,31 +107,28 @@ depend \ sources :: +check :: + @echo "no unit-test implemented" + @MAKE_DATABASE@all \ @MAKE_DATABASE@sources :: terminfo.tmp @MAKE_DATABASE@install :: @MISC_INSTALL_DATA@ @MAKE_DATABASE@install.data :: terminfo.tmp \ -@MAKE_DATABASE@ $(DESTDIR)$(libdir) \ -@MAKE_DATABASE@ $(DESTDIR)$(datadir) \ -@MAKE_DATABASE@ $(DESTDIR)$(tabsetdir) -@MAKE_DATABASE@ DESTDIR=${DESTDIR} \ -@MAKE_DATABASE@ prefix=${prefix} \ -@MAKE_DATABASE@ exec_prefix=${exec_prefix} \ -@MAKE_DATABASE@ bindir=${bindir} \ -@MAKE_DATABASE@ top_srcdir=${top_srcdir} \ -@MAKE_DATABASE@ srcdir=${srcdir} \ -@MAKE_DATABASE@ datadir=${datadir} \ -@MAKE_DATABASE@ ticdir=${ticdir} \ -@MAKE_DATABASE@ source=terminfo.tmp \ -@MAKE_DATABASE@ cross_compiling=@cross_compiling@ \ +@MAKE_DATABASE@ $(LIBDIR) \ +@MAKE_DATABASE@ $(DATADIR) \ +@MAKE_DATABASE@ $(TABSETDIR) +@MAKE_DATABASE@ INSTALL_PREFIX=${INSTALL_PREFIX} \ +@MAKE_DATABASE@ TICDIR=${TICDIR} \ +@MAKE_DATABASE@ BINDIR=${BINDIR} \ +@MAKE_DATABASE@ tic_source=terminfo.tmp \ @MAKE_DATABASE@ $(SHELL) ./run_tic.sh @MAKE_DATABASE@ @( cd $(srcdir)/tabset && \ @MAKE_DATABASE@ $(SHELL) -c 'for i in * ; do \ @MAKE_DATABASE@ if test -f $$i ; then \ @MAKE_DATABASE@ echo installing $$i; \ -@MAKE_DATABASE@ $(INSTALL_DATA) $$i $(DESTDIR)$(tabsetdir)/$$i; \ +@MAKE_DATABASE@ $(INSTALL_DATA) $$i $(TABSETDIR)/$$i; \ @MAKE_DATABASE@ fi; done' ) install.data :: @echo "finished $@" @@ -129,8 +136,8 @@ NCURSES_CONFIG = ncurses@DFT_ARG_SUFFIX@@cf_cv_abi_version@@cf_config_suffix@-config install \ -install.libs :: $(DESTDIR)$(bindir) ncurses-config - $(INSTALL_SCRIPT) ncurses-config $(DESTDIR)$(bindir)/$(NCURSES_CONFIG) +install.libs :: $(BINDIR) ncurses-config + $(INSTALL_SCRIPT) ncurses-config $(BINDIR)/$(NCURSES_CONFIG) # Make a list of the files that gen-pkgconfig might create: @MAKE_PC_FILES@PC_FILES = \ @@ -148,12 +155,12 @@ @MAKE_PC_FILES@install \ @MAKE_PC_FILES@install.libs :: pc-files @MAKE_PC_FILES@ @$(SHELL) -c 'case "x$(PKG_CONFIG_LIBDIR)" in \ -@MAKE_PC_FILES@ x/*) \ -@MAKE_PC_FILES@ mkdir -p $(DESTDIR)$(PKG_CONFIG_LIBDIR); \ +@MAKE_PC_FILES@ x@GLOB_FULLPATH_POSIX@|x@GLOB_FULLPATH_OTHER@) \ +@MAKE_PC_FILES@ mkdir -p $(INSTALL_CONFIG); \ @MAKE_PC_FILES@ for name in $(PC_FILES); do \ @MAKE_PC_FILES@ test -f $$name || continue; \ @MAKE_PC_FILES@ echo installing $$name; \ -@MAKE_PC_FILES@ $(INSTALL_DATA) $$name $(DESTDIR)$(PKG_CONFIG_LIBDIR)/$$name; \ +@MAKE_PC_FILES@ $(INSTALL_DATA) $$name $(INSTALL_CONFIG)/$$name; \ @MAKE_PC_FILES@ done \ @MAKE_PC_FILES@ ;; \ @MAKE_PC_FILES@ *) \ @@ -177,27 +184,29 @@ datadir=${datadir} \ $(SHELL) $(srcdir)/gen_edit.sh >$@ -$(DESTDIR)$(bindir) \ -$(DESTDIR)$(libdir) \ -$(DESTDIR)$(datadir) \ -$(DESTDIR)$(tabsetdir) : +$(BINDIR) \ +$(DATADIR) : mkdir -p $@ +@MAKE_DATABASE@$(LIBDIR) \ +@MAKE_DATABASE@$(TABSETDIR) : +@MAKE_DATABASE@ mkdir -p $@ + uninstall : @MISC_UNINSTALL_DATA@ uninstall.libs uninstall.data : - -test -d $(DESTDIR)$(tabsetdir) && rm -rf $(DESTDIR)$(tabsetdir) - -test -d $(DESTDIR)$(ticdir) && rm -rf $(DESTDIR)$(ticdir) - -test -f $(DESTDIR)$(ticfile) && rm -f $(DESTDIR)$(ticfile) +@MAKE_DATABASE@ -$(SHELL) -c 'if test -d $(TABSETDIR) ; then rm -rf $(TABSETDIR); fi' +@MAKE_DATABASE@ -$(SHELL) -c 'if test -d $(TICDIR) ; then rm -rf $(TICDIR); fi' +@MAKE_DATABASE@ -$(SHELL) -c 'if test -f $(TICFILE) ; then rm -f $(TICFILE); fi' uninstall.libs : - -rm -f $(DESTDIR)$(bindir)/$(NCURSES_CONFIG) -@MAKE_PC_FILES@ @$(SHELL) -c 'case x$(DESTDIR)$(PKG_CONFIG_LIBDIR) in \ -@MAKE_PC_FILES@ x/*) \ + -rm -f $(BINDIR)/$(NCURSES_CONFIG) +@MAKE_PC_FILES@ @$(SHELL) -c 'case x$(INSTALL_CONFIG) in \ +@MAKE_PC_FILES@ x@GLOB_FULLPATH_POSIX@|x@GLOB_FULLPATH_OTHER@) \ @MAKE_PC_FILES@ for name in $(PC_FILES); do \ @MAKE_PC_FILES@ test -f $$name || continue; \ @MAKE_PC_FILES@ echo uninstalling $$name; \ -@MAKE_PC_FILES@ rm -f $(DESTDIR)$(PKG_CONFIG_LIBDIR)/$$name; \ +@MAKE_PC_FILES@ rm -f $(INSTALL_CONFIG)/$$name; \ @MAKE_PC_FILES@ done \ @MAKE_PC_FILES@ ;; \ @MAKE_PC_FILES@ esac' diff --git a/contrib/ncurses/misc/gen-pkgconfig.in b/contrib/ncurses/misc/gen-pkgconfig.in --- a/contrib/ncurses/misc/gen-pkgconfig.in +++ b/contrib/ncurses/misc/gen-pkgconfig.in @@ -1,7 +1,7 @@ #!@SHELL@ -# $Id: gen-pkgconfig.in,v 1.56 2022/10/08 16:45:20 tom Exp $ +# $Id: gen-pkgconfig.in,v 1.58 2024/09/28 20:21:23 tom Exp $ ############################################################################## -# Copyright 2018-2021,2022 Thomas E. Dickey # +# Copyright 2018-2022,2024 Thomas E. Dickey # # Copyright 2009-2015,2018 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -92,7 +92,7 @@ -specs*) # ignore linker specs-files which were used to build library continue ;; - -Wl,-z,*) # ignore flags used to manipulate shared image + -Wl,-z*) # ignore flags used to manipulate shared image continue ;; -Wl,--dynamic-linker*) # ignore ELF interpreter @@ -112,7 +112,7 @@ @LD_SEARCHPATH@) # skip standard libdir if [ "$lib_check" = "$libdir" ] then - lib_first=yes + lib_first=no IFS_save="$IFS" IFS='|' LIBDIRS="@LD_SEARCHPATH@" @@ -120,11 +120,11 @@ do if [ -d "$lib_check" ] then - if [ "$lib_check" != "$libdir" ] + if [ "$lib_check" = "$libdir" ] then - lib_first=no + lib_first=yes + break fi - break fi done IFS="$IFS_save" diff --git a/contrib/ncurses/misc/gen_edit.sh b/contrib/ncurses/misc/gen_edit.sh --- a/contrib/ncurses/misc/gen_edit.sh +++ b/contrib/ncurses/misc/gen_edit.sh @@ -1,6 +1,6 @@ #!/bin/sh ############################################################################## -# Copyright 2020,2021 Thomas E. Dickey # +# Copyright 2020-2021,2025 Thomas E. Dickey # # Copyright 2004-2011,2012 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -30,8 +30,8 @@ # # Author: Thomas E. Dickey # -# $Id: gen_edit.sh,v 1.7 2021/09/04 15:55:29 tom Exp $ -# Generate a sed-script for converting the terminfo.src to the form which will +# $Id: gen_edit.sh,v 1.9 2025/11/12 00:52:57 Branden.Robinson Exp $ +# Generate a sed script for converting the terminfo.src to the form which will # be installed. # # Assumes: @@ -48,13 +48,13 @@ # If we're not installing into /usr/share/, we'll have to adjust the location # of the tabset files in terminfo.src (which are in a parallel directory). TABSET=${datadir}/tabset -if test "x$TABSET" != "x/usr/share/tabset" ; then +if [ "x$TABSET" != "x/usr/share/tabset" ] ; then cat <&2 cat <&2 cat </dev/null` - if test "x$system" = xLinux + if [ "$system" = Linux ] then case x`uname -r` in x1.*) @@ -108,7 +108,7 @@ ;; esac -if test $WHICH_LINUX != $linux_dft +if [ "$WHICH_LINUX" != "$linux_dft" ] then echo "** using $WHICH_LINUX terminal description for Linux console" >&2 cat <>12 regex \^[a-zA-Z0-9][a-zA-Z0-9.][^|]* Compiled 32-bit terminfo entry "%-s" !:mime application/x-terminfo2 # -# While the compiled terminfo uses little-endian format irregardless of -# platform, System V screen dumps do not. They came later, and that detail was -# overlooked. +# While the compiled terminfo uses little-endian format regardless of platform, +# System V screen dumps do not. They came later; that detail was overlooked. # # AIX and HPUX use the SVr4 big-endian format # Solaris uses the SVr3 formats (sparc and x86 differ endian-ness) diff --git a/contrib/ncurses/misc/makellib b/contrib/ncurses/misc/makellib --- a/contrib/ncurses/misc/makellib +++ b/contrib/ncurses/misc/makellib @@ -1,6 +1,6 @@ #!/bin/sh ############################################################################## -# Copyright 2020,2021 Thomas E. Dickey # +# Copyright 2020-2021,2025 Thomas E. Dickey # # Copyright 1998,2000 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -30,7 +30,7 @@ # # Author: Thomas E. Dickey 1996,1997,2000 # -# $Id: makellib,v 1.11 2021/09/04 15:49:38 tom Exp $ +# $Id: makellib,v 1.12 2025/06/14 14:44:56 tom Exp $ # System-dependent wrapper for 'lint' that creates a lint-library via the # following method (XXX is the name of the library): # a. If the file llib-lXXX doesn't exist, create it using the make-rule @@ -52,7 +52,7 @@ # $* = C-preprocessor options # ARCH=`uname -s` -if test "x$ARCH" = "xSunOS" ; then +if [ "$ARCH" = "SunOS" ] ; then case `uname -r` in 5.*) ARCH=Solaris ;; @@ -64,7 +64,7 @@ LLIB="" llib="" # -while test $# != 0 +while [ $# != 0 ] do case $1 in -L*) @@ -74,7 +74,7 @@ OPT="$OPT $1" ;; *) - if test -z "$LLIB" + if [ -z "$LLIB" ] then LLIB=$1 else @@ -85,16 +85,16 @@ shift done -if test -z "$LLIB" +if [ -z "$LLIB" ] then echo '? no library name specified' exit 1 -elif test -z "$llib" +elif [ -z "$llib" ] then llib="llib-l$LLIB" fi -if test ! -f "$llib" ; then +if [ ! -f "$llib" ] ; then if ( make "$llib" ) then : @@ -142,16 +142,16 @@ exit 1 esac -echo OPT "$OPT" -echo TARGET "$TARGET" -echo LIBNAME "$llib" +echo "OPT $OPT" +echo "TARGET $TARGET" +echo "LIBNAME $llib" if ( lint "$CREATE" "$OPT" "$TARGET" ) then - if test -f "$llib.ln" + if [ -f "$llib.ln" ] then for p in $HOME/lib $HOME/lib/$ARCH $HOME/lib/$ARCH/lint do - if test ! -d "$p" + if [ ! -d "$p" ] then mkdir "$p" fi @@ -163,6 +163,6 @@ rm -f "$llib.ln" fi fi -if test "x$TARGET" = "x$llib.c" ; then +if [ "$TARGET" = "$llib.c" ] ; then rm -f "$TARGET" fi diff --git a/contrib/ncurses/misc/ncurses-config.in b/contrib/ncurses/misc/ncurses-config.in --- a/contrib/ncurses/misc/ncurses-config.in +++ b/contrib/ncurses/misc/ncurses-config.in @@ -1,7 +1,7 @@ #!@SHELL@ -# $Id: ncurses-config.in,v 1.52 2022/07/26 21:36:28 tom Exp $ +# $Id: ncurses-config.in,v 1.63 2025/11/22 19:19:28 tom Exp $ ############################################################################## -# Copyright 2018-2021,2022 Thomas E. Dickey # +# Copyright 2018-2024,2025 Thomas E. Dickey # # Copyright 2006-2015,2017 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -46,12 +46,10 @@ datadir="@datadir@" mandir="@mandir@" -THIS="@LIB_NAME@@USE_LIB_SUFFIX@" +CURSES_LIB="@LIB_NAME@@ABI_SUFFIX@" TINFO_LIB="@TINFO_ARG_SUFFIX@" RPATH_LIST="@RPATH_LIST@" -includesubdir="@includedir@/${THIS}" - # Ensure that RPATH_LIST contains only absolute pathnames, if it is nonempty. # We cannot filter it out within the build-process since the variable is used # in some special cases of installation using a relative path. @@ -80,18 +78,29 @@ # the headers to include like this: # if [ x@WITH_OVERWRITE@ = xno ]; then + includesubdir="@includedir@/${CURSES_LIB}" case $includedir in $prefix/include/ncurses@LIB_SUFFIX@@EXTRA_SUFFIX@) includedir=`echo "$includedir" | sed -e 's,/[^/]*$,,'` ;; esac +else + includesubdir="@includedir@" fi LIBS="@LIBS@" if [ "@TINFO_NAME@" = "@LIB_NAME@" ]; then - LIBS="-l${THIS} $LIBS" + LIBS="-l${CURSES_LIB} $LIBS" else - LIBS="-l${THIS} -l${TINFO_LIB} $LIBS" + LIBS="-l${CURSES_LIB} -l${TINFO_LIB} $LIBS" +fi + +CFLAGS="@PKG_CFLAGS@" +if [ "$includesubdir" != "/usr/include" ]; then + CFLAGS="$CFLAGS -I${includesubdir}" + if [ "$includedir" != "/usr/include" ]; then + [ x@WITH_OVERWRITE@ = xno ] && CFLAGS="$CFLAGS -I${includedir}" + fi fi # Ignore -L options which do not correspond to an actual directory, or which @@ -107,7 +116,7 @@ -specs*) # ignore linker specs-files which were used to build library continue ;; - -Wl,-z,*) # ignore flags used to manipulate shared image + -Wl,-z*) # ignore flags used to manipulate shared image continue ;; -Wl,--dynamic-linker*) # ignore ELF interpreter @@ -123,7 +132,7 @@ @LD_SEARCHPATH@) # skip standard libdir if [ "$lib_check" = "$libdir" ] then - lib_first=yes + lib_first=no IFS_save="$IFS" IFS='|' LIBDIRS="@LD_SEARCHPATH@" @@ -131,11 +140,11 @@ do if [ -d "$lib_check" ] then - if [ "$lib_check" != "$libdir" ] + if [ "$lib_check" = "$libdir" ] then - lib_first=no + lib_first=yes + break fi - break fi done IFS="$IFS_save" @@ -186,16 +195,57 @@ ;; # compile/link --cflags) - INCS="@PKG_CFLAGS@" - if [ "x@WITH_OVERWRITE@" = xno ]; then - INCS="$INCS -I${includesubdir}" - fi - if [ "${includedir}" != /usr/include ]; then - INCS="$INCS -I${includedir}" - fi - sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO - $INCS -ENDECHO + OPTS= + for opt in $CFLAGS + do + case "x$opt" in + x-[fgOW]*) + opt= + ;; + esac + if [ -n "$opt" ] + then + [ -n "$OPTS" ] && OPTS="$OPTS " + OPTS="$OPTS$opt" + fi + done + printf "%s\n" "$OPTS" + ;; + --cflags-only-I) + OPTS= + for opt in $CFLAGS + do + case "x$opt" in + x-[I]*) + ;; + *) + opt= + ;; + esac + if [ -n "$opt" ] + then + [ -n "$OPTS" ] && OPTS="$OPTS " + OPTS="$OPTS$opt" + fi + done + printf "%s\n" "$OPTS" + ;; + --cflags-only-other) + OPTS= + for opt in $CFLAGS + do + case "x$opt" in + x-[I]*|x-[fgOW]*) + opt= + ;; + esac + if [ -n "$opt" ] + then + [ -n "$OPTS" ] && OPTS="$OPTS " + OPTS="$OPTS$opt" + fi + done + printf "%s\n" "$OPTS" ;; --libs) OPTS= @@ -294,30 +344,32 @@ Usage: `basename "$0"` [options] Options: - --prefix echos the package-prefix of ${THIS} - --exec-prefix echos the executable-prefix of ${THIS} + --prefix echoes the package-prefix of ${CURSES_LIB} + --exec-prefix echoes the executable-prefix of ${CURSES_LIB} - --cflags echos the C compiler flags needed to compile with ${THIS} - --libs echos the libraries needed to link with ${THIS} + --cflags echoes the C compiler flags needed to compile for ${CURSES_LIB} + --cflags-only-I echoes only -I C compiler flags needed with ${CURSES_LIB} + --cflags-only-other echoes only C compiler flags other than -I for ${CURSES_LIB} + --libs echoes the libraries needed to link with ${CURSES_LIB} - --libs-only-L echos -L linker options (search path) for ${THIS} - --libs-only-l echos -l linker options (libraries) for ${THIS} - --libs-only-other echos linker options other than -L/-l + --libs-only-L echoes -L linker options (search path) for ${CURSES_LIB} + --libs-only-l echoes -l linker options (libraries) for ${CURSES_LIB} + --libs-only-other echoes linker options other than -L/-l - --version echos the release+patchdate version of ${THIS} - --abi-version echos the ABI version of ${THIS} - --mouse-version echos the mouse-interface version of ${THIS} + --version echoes the release+patchdate version of ${CURSES_LIB} + --abi-version echoes the ABI version of ${CURSES_LIB} + --mouse-version echoes the mouse-interface version of ${CURSES_LIB} - --bindir echos the directory containing ${THIS} programs - --datadir echos the directory containing ${THIS} data - --includedir echos the directory containing ${THIS} header files - --libdir echos the directory containing ${THIS} libraries - --mandir echos the directory containing ${THIS} manpages - --terminfo echos the \$TERMINFO terminfo database path - --terminfo-dirs echos the \$TERMINFO_DIRS directory list - --termpath echos the \$TERMPATH termcap list + --bindir echoes the directory containing ${CURSES_LIB} programs + --datadir echoes the directory containing ${CURSES_LIB} data + --includedir echoes the directory containing ${CURSES_LIB} header files + --libdir echoes the directory containing ${CURSES_LIB} libraries + --mandir echoes the directory containing ${CURSES_LIB} man pages + --terminfo echoes the \$TERMINFO terminfo database path + --terminfo-dirs echoes the \$TERMINFO_DIRS directory list + --termpath echoes the \$TERMPATH termcap list - --help prints this message + --help prints this message ENDHELP ;; --error|*) diff --git a/contrib/ncurses/misc/run_tic.in b/contrib/ncurses/misc/run_tic.in --- a/contrib/ncurses/misc/run_tic.in +++ b/contrib/ncurses/misc/run_tic.in @@ -1,7 +1,7 @@ #!@SHELL@ -# $Id: run_tic.in,v 1.40 2022/07/16 19:37:03 tom Exp $ +# $Id: run_tic.in,v 1.44 2025/09/13 16:52:46 tom Exp $ ############################################################################## -# Copyright 2019-2020,2022 Thomas E. Dickey # +# Copyright 2019-2024,2025 Thomas E. Dickey # # Copyright 2000-2012,2017 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -42,50 +42,59 @@ # The script is designed to be run from the misc/Makefile as # make install.data -: "${suffix:=@EXEEXT@}" -: "${DESTDIR:=@DESTDIR@}" +# Symbols which are not overridden by misc/Makefile: : "${prefix:=@prefix@}" : "${exec_prefix:=@exec_prefix@}" -: "${bindir:=@bindir@}" : "${top_srcdir:=@top_srcdir@}" : "${srcdir:=@srcdir@}" : "${datarootdir:=@datarootdir@}" : "${datadir:=@datadir@}" -: "${TIC_PATH:=@TIC@}" -: "${ticdir:=@TERMINFO@}" -: "${source:=@TERMINFO_SRC@}" -: "${cross_compiling:=no}" +: "${cross_compiling:=@cross_compiling@}" +: "${suffix:=@EXEEXT@}" + : "${ext_funcs:=@NCURSES_EXT_FUNCS@}" +: "${tic_path:=@TIC@}" +: "${ticdir:=@TERMINFO@}" +: "${tic_source:=@TERMINFO_SRC@}" + +# Symbols which $DESTDIR and/or install-prefix may affect: +: "${INSTALL_PREFIX:=$prefix}" +: "${BINDIR:=@bindir@}" +: "${TICDIR:=$ticdir}" -test -z "${DESTDIR}" && DESTDIR= +failed() { + echo "? $*" >&2 + exit 1 +} + +unset CDPATH # Allow tic to run either from the install-path, or from the build-directory. # Do not do this if we appear to be cross-compiling. In that case, we rely # on the host's copy of tic to compile the terminfo database. -if test "x$cross_compiling" = "xno" +if test "$cross_compiling" = "no" then - if test -f ../progs/tic$suffix + if test -f ../progs/tic"$suffix" then case "$PATH" in \@PATH_SEPARATOR@*) - PATH="../progs@PATH_SEPARATOR@../lib@PATH_SEPARATOR@${DESTDIR}$bindir$PATH" + PATH="../progs@PATH_SEPARATOR@../lib@PATH_SEPARATOR@${BINDIR}$PATH" ;; *) - PATH="../progs@PATH_SEPARATOR@../lib@PATH_SEPARATOR@${DESTDIR}$bindir@PATH_SEPARATOR@$PATH" + PATH="../progs@PATH_SEPARATOR@../lib@PATH_SEPARATOR@${BINDIR}@PATH_SEPARATOR@$PATH" ;; esac export PATH if test @DFT_LWR_MODEL@ = shared then SHLIB="sh $srcdir/shlib" - TIC_PATH="$SHLIB tic" + tic_path="$SHLIB tic" else - TIC_PATH="tic" + tic_path="tic" fi - elif test "$TIC_PATH" = unknown + elif test "$tic_path" = unknown then - echo "? no tic program found" - exit 1 + failed "no tic program found" fi else # Cross-compiling, so don't set PATH or run shlib. @@ -95,26 +104,27 @@ fi -# set another env var that doesn't get reset when `shlib' runs, so `shlib' uses +# Set another env var that doesn't get reset when `shlib' runs, so `shlib' uses # the PATH we just set. SHLIB_PATH=$PATH export SHLIB_PATH -# set a variable to simplify environment update in shlib +# Set a variable to simplify environment update in the shlib script. SHLIB_HOST=@host_os@ export SHLIB_HOST -# don't use user's TERMINFO variable +# Don't use user's TERMINFO or TERMINFO_DIRS variables. The explicit "-o" +# option makes this moot, but this may reduce confusion. unset TERMINFO_DIRS -TERMINFO="${DESTDIR}$ticdir" ; export TERMINFO +unset TERMINFO umask 022 # Construct the name of the old (obsolete) pathname, e.g., /usr/lib/terminfo. -TICDIR=`echo "$TERMINFO" | sed -e 's%/share/\([^/]*\)$%/lib/\1%'` +OLD_DIR=`echo "$TICDIR" | sed -e 's%/share/\([^/]*\)$%/lib/\1%'` # Parent directory may not exist, which would confuse the install for hashed # database. Fix. -PARENT=`echo "$TERMINFO" | sed -e 's%/[^/]*$%%'` +PARENT=`echo "$TICDIR" | sed -e 's%/[^/]*$%%'` if test -n "$PARENT" then mkdir -p "$PARENT" @@ -124,87 +134,102 @@ # would generate a lot of confusing error messages if we tried to overwrite it. # We explicitly remove its contents rather than the directory itself, in case # the directory is actually a symbolic link. -if test -d "$TERMINFO" +if test -d "$TICDIR" then - ( cd "$TERMINFO" && rm -fr ./? 2>/dev/null ) -elif test -f "$TERMINFO.db" + test -w "$TICDIR" || failed "existing $TICDIR is not writable" + ( cd "$TICDIR" && rm -fr ./? 2>/dev/null ) +elif test -f "$TICDIR.db" then - ( rm -f "$TERMINFO.db" 2>/dev/null ) + ( rm -f "$TICDIR.db" 2>/dev/null ) + test -f "$TICDIR.db" && failed "cannot remove $TICDIR.db" fi if test "$ext_funcs" = 1 ; then cat </dev/null ) - if ( cd "$TICDIR" 2>/dev/null ) +if test "$OLD_DIR" != "$TICDIR" ; then + ( rm -f "$OLD_DIR" 2>/dev/null ) + if ( cd "$OLD_DIR" 2>/dev/null ) then - cd "$TICDIR" || exit - TICDIR=`pwd` - if test "$TICDIR " != "$TERMINFO "; then + cd "$OLD_DIR" || exit + OLD_DIR=`pwd` + if test "$OLD_DIR " != "$TICDIR "; then # Well, we tried. Some systems lie to us, so the # installer will have to double-check. - echo "Verify if $TICDIR and $TERMINFO are the same." - echo "The new terminfo is in $TERMINFO; the other should be a link to it." - echo "Otherwise, remove $TICDIR and link it to $TERMINFO." + echo "Verify if $OLD_DIR and $TICDIR are the same." + echo "The new terminfo is in $TICDIR; the other should be a link to it." + echo "Otherwise, remove $OLD_DIR and link it to $TICDIR." fi else - cd ${DESTDIR}$prefix || exit + cd "${INSTALL_PREFIX}" || exit # Construct a symbolic link that only assumes $ticdir has the # same $prefix as the other installed directories. - RELATIVE=`echo $ticdir|sed -e 's%^'$prefix'/%%'` - if test "$RELATIVE" != "$ticdir" ; then - RELATIVE=../`echo $ticdir|sed -e 's%^'$prefix'/%%' -e 's%^/%%'` + SOURCE=`echo "$ticdir"|sed -e 's%^'"$prefix"'/%%'` + if test "$SOURCE" != "$ticdir" ; then + SOURCE=../`echo "$ticdir"|sed -e 's%^'"$prefix"'/%%' -e 's%^/%%'` fi - if ( @LN_S@ "$RELATIVE" "$TICDIR" ) + test -d lib || mkdir lib + cd lib || exit + TARGET=`pwd`/terminfo + if ( @LN_S@ "$SOURCE" terminfo ) then - echo "** sym-linked $TICDIR for compatibility" + echo "** sym-linked $TARGET for compatibility" else - echo "** could not sym-link $TICDIR for compatibility" + echo "** could not sym-link $TARGET for compatibility" fi fi fi -# vile:shmode +# vile:shmode ts=4 sw=4 diff --git a/contrib/ncurses/misc/terminfo.src b/contrib/ncurses/misc/terminfo.src --- a/contrib/ncurses/misc/terminfo.src +++ b/contrib/ncurses/misc/terminfo.src @@ -6,8 +6,8 @@ # Report bugs and new terminal descriptions to # bug-ncurses@gnu.org # -# $Revision: 1.1143 $ -# $Date: 2024/03/09 20:01:40 $ +# $Revision: 1.1200 $ +# $Date: 2025/11/12 00:52:57 $ # # The original header is preserved below for reference. It is noted that there # is a "newer" version which differs in some cosmetic details (but actually @@ -423,11 +423,10 @@ # , but this isn't a documented feature of ANSI.SYS. klone+sgr|attribute control for ansi.sys displays, blink=\E[5m, bold=\E[1m, rev=\E[7m, rmpch=\E[10m, - rmso=\E[m, rmul=\E[m, sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6 %t;1%;%?%p9%t;11%;m, - sgr0=\E[0;10m, smpch=\E[11m, smso=\E[7m, smul=\E[4m, - use=klone+acs, + sgr0=\E[0;10m, smpch=\E[11m, use=ansi+sgrso, + use=ansi+sgrul, use=klone+acs, # Most Intel boxes do not treat "invis" (invisible) text. klone+sgr8|attribute control for ansi.sys displays with invis, @@ -475,9 +474,15 @@ ecma+italics|ECMA-48 italics, ritm=\E[23m, sitm=\E[3m, +ecma+standout|ECMA-48 standout, + rmso=\E[27m, smso=\E[7m, + +ecma+underline|ECMA-48 underline, + rmul=\E[24m, smul=\E[4m, + # Attribute control for ECMA-48-compatible terminals ecma+sgr|attribute capabilities for true ECMA-48 terminals, - rmso=\E[27m, rmul=\E[24m, use=klone+sgr8, + use=ecma+underline, use=ecma+standout, use=klone+sgr8, ecma+strikeout|ECMA-48 strikeout/crossed-out, rmxx=\E[29m, smxx=\E[9m, @@ -494,10 +499,10 @@ ibcs2|Intel Binary Compatibility Standard prescriptions, cbt=\E[Z, clear=\Ec, cub1=\E[1D, cud1=\E[1B, cuf1=\E[1C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[1A, dch=\E[%p1%dP, - dispc=\E=%p1%dg, ech=\E[%p1%dX, hpa=\E[%i%p1%dG, hts=\EH, - ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, rc=\E7, - rmam=\E[?7l, sc=\E7, smam=\E[?7h, tbc=\E[g, - vpa=\E[%i%p1%dd, use=ansi+local, use=ecma+index, + dispc=\E=%p1%dg, ech=\E[%p1%dX, hts=\EH, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL, rc=\E7, rmam=\E[?7l, sc=\E7, + smam=\E[?7h, tbc=\E[g, use=ansi+local, use=ansi+rca2, + use=ecma+index, #### ANSI/ECMA-48 terminals and terminal emulators # @@ -559,12 +564,12 @@ ansi77|ANSI 3.64 standard 1977 version, OTbs, am, mir, cols#80, it#8, lines#24, - bel=^G, clear=\E[;H\E[2J, cr=\r, cub1=^H, - cup=\E[%i%p1%d;%p2%dH, dch1=\E[P, dl1=\E[M$<5*/>, - ed=\E[J, el=\E[K, home=\E[H, ht=^I, il1=\E[L$<5*/>, ind=\ED, - kf1=\EOP, kf2=\EOR, kf4=\EOS, nel=\r\ED, ri=\EM, rmir=\E[4l, - rmso=\E[m, rmul=\E[m, smir=\E[4h, smso=\E[7m, smul=\E[4m, - use=ansi+arrows, use=ansi+csr, use=ansi+local1, + bel=^G, clear=\E[;H\E[2J, cr=\r, cub1=^H, dch1=\E[P, + dl1=\E[M$<5*/>, ed=\E[J, el=\E[K, ht=^I, il1=\E[L$<5*/>, + ind=\ED, kf1=\EOP, kf2=\EOR, kf4=\EOS, nel=\r\ED, ri=\EM, + rmir=\E[4l, smir=\E[4h, use=ansi+arrows, use=ansi+csr, + use=ansi+cup, use=ansi+local1, use=ansi+sgrso, + use=ansi+sgrul, # Procomm and some other ANSI emulations don't recognize all of the ANSI- # standard capabilities. This entry deletes , , , , and @@ -579,10 +584,9 @@ pcansi-m|pcansi-mono|ibm-pc terminal programs claiming to be ANSI (mono mode), OTbs, am, mir, msgr, cols#80, lines#24, - bel=^G, cr=\r, cup=\E[%i%p1%d;%p2%dH, dch1=\E[P, dl1=\E[M, - home=\E[H, ht=^I, il1=\E[L, ind=\n, use=ansi+arrows, - use=ansi+erase, use=ansi+inittabs, use=ansi+local1, - use=klone+sgr-dumb, + bel=^G, cr=\r, dch1=\E[P, ind=\n, use=ansi+arrows, + use=ansi+cup, use=ansi+erase, use=ansi+idl1, + use=ansi+inittabs, use=ansi+local1, use=klone+sgr-dumb, pcansi-25-m|pcansi25m|ibm-pc terminal programs with 25 lines (mono mode), lines#25, use=pcansi-m, @@ -607,10 +611,10 @@ ansi-m|ansi-mono|ANSI X3.64-1979 terminal with ANSI.SYS compatible attributes, mc5i, dch=\E[%p1%dP, dl=\E[%p1%dM, ech=\E[%p1%dX, el1=\E[1K, - hpa=\E[%i%p1%dG, ht=\E[I, ich=\E[%p1%d@, il=\E[%p1%dL, - kcbt=\E[Z, kich1=\E[L, mc4=\E[4i, mc5=\E[5i, nel=\r\E[S, + ht=\E[I, ich=\E[%p1%d@, il=\E[%p1%dL, kcbt=\E[Z, + kich1=\E[L, mc4=\E[4i, mc5=\E[5i, nel=\r\E[S, rep=%p1%c\E[%p2%{1}%-%db, s0ds=\E(B, s1ds=\E)B, - s2ds=\E*B, s3ds=\E+B, vpa=\E[%i%p1%dd, use=ansi+local, + s2ds=\E*B, s3ds=\E+B, use=ansi+local, use=ansi+rca2, use=ecma+index, use=pcansi-m, # ECMA-48 addresses three of the four capabilities here: @@ -636,7 +640,7 @@ # Parameter default value: Ps = 0 # With a parameter value not equal to 0, DA is used to identify the # device which sends the DA. The parameter value is a device type -# identification code according to a register which is to be established. +# identification code according to a register which is to be established. # If the parameter value is 0, DA is used to request an identifying DA # from a device. # @@ -687,10 +691,10 @@ ansi.sys-old|ANSI.SYS under PC-DOS 2.0, OTbs, am, mir, msgr, xon, cols#80, lines#25, - clear=\E[2J, cub1=^H, cup=\E[%i%p1%d;%p2%dH, el=\E[k, - home=\E[H, is2=\E[m\E[?7h, kcub1=^H, kcud1=\n, kcuf1=^L, - kcuu1=^K, khome=^^, pfkey=\E[0;%p1%{58}%+%d;%p2"%s"p, - rc=\E[u, rmam=\E[?7l, sc=\E[s, smam=\E[?7h, use=ansi+cpr, + clear=\E[2J, cub1=^H, el=\E[k, is2=\E[m\E[?7h, kcub1=^H, + kcud1=\n, kcuf1=^L, kcuu1=^K, khome=^^, + pfkey=\E[0;%p1%{58}%+%d;%p2"%s"p, rc=\E[u, rmam=\E[?7l, + sc=\E[s, smam=\E[?7h, use=ansi+cpr, use=ansi+cup, use=ansi+local1, use=klone+color, use=klone+sgr8, # Keypad: Home=\0G Up=\0H PrPag=\0I @@ -834,17 +838,15 @@ yzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, civis=\Ef, clear=\E[2J\E[H, cnorm=\Ee, cr=\r, cub1=^H, cud1=\EB, - cuf1=\EC, cup=\E[%i%p1%d;%p2%dH, cuu1=\EA, dch1=\Ea, - dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, - el1=\E[1K, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, il1=\EL, - ind=\n, is2=\E<\E)0, kdch1=^?, kf1=\EOP, kf10=\EOY, kf11=\Ep, - kf12=\Eq, kf13=\Er, kf14=\Es, kf15=\Et, kf16=\Eu, kf17=\Ev, - kf18=\Ew, kf19=\Ex, kf2=\EOQ, kf20=\Ey, kf3=\EOR, kf4=\EOS, - kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, kf9=\EOX, khlp=\EH, + cuf1=\EC, cuu1=\EA, dch1=\Ea, dim=\E[2m, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, ht=^I, hts=\EH, + ich=\E[%p1%d@, il1=\EL, ind=\n, is2=\E<\E)0, kdch1=^?, + kf10=\EOY, kf11=\Ep, kf12=\Eq, kf13=\Er, kf14=\Es, kf15=\Et, + kf16=\Eu, kf17=\Ev, kf18=\Ew, kf19=\Ex, kf20=\Ey, kf5=\EOT, + kf6=\EOU, kf7=\EOV, kf8=\EOW, kf9=\EOX, khlp=\EH, khome=\E\EE, kich1=\EI, knp=\Eb, kpp=\E\Ea, kund=\EK, ll=\E[24H, nel=\EE, oc=\E[30;47m, op=\E[30;47m, rev=\E[7m, ri=\EM, rmacs=^O, rmcup=\E[?7h, rmir=\Ei, rmkx=\E[?1l\E>, - rmso=\E[m, rmul=\E[m, rs1=\E<\E[20l\E[?3;6;9l\E[r\Eq\E(B\017\E)0\E>, setb=\E[4%p1%'0'%+%Pa%?%ga%'0'%=%t0%e%ga%'1'%=%t4%e%ga%'2'%= %t2%e%ga%'3'%=%t6%e%ga%'4'%=%t1%e%ga%'5'%=%t5%e%ga%'6' @@ -853,8 +855,9 @@ %t2%e%ga%'3'%=%t6%e%ga%'4'%=%t1%e%ga%'5'%=%t5%e%ga%'6' %=%t3%e7%;m, sgr0=\E[m, smacs=^N, smcup=\E[?7l, smir=\Eh, - smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, - use=ansi+apparrows, use=ansi+csr, use=ansi+local, + smkx=\E[?1h\E=, tbc=\E[3g, use=ansi+apparrows, + use=ansi+csr, use=ansi+cup, use=ansi+local, + use=ansi+sgrso, use=ansi+sgrul, use=vt100+pf1-pf4, # The entries for stv52 and stv52pc probably need a revision. stv52|MiNT virtual console, @@ -925,19 +928,18 @@ beterm|BeOS Terminal, am, eo, mir, msgr, xenl, xon, cols#80, it#8, lines#25, ncv#5, - bel=^G, bold=\E[1m, cr=\r, cub1=^H, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, ech=\E[%p1%dX, el1=\E[1K, - home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ind=\n, - kf1=\E[11~, kf10=\E[20~, kf11=\E[21~, kf12=\E[22~, - kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[16~, - kf7=\E[17~, kf8=\E[18~, kf9=\E[19~, khome=\E[1~, kspd=^Z, - nel=\r\n, op=\E[m, rev=\E[7m, ri=\EM, rmkx=\E[?4l, rmso=\E[m, - rmul=\E[24m, rs1=\Ec, setb=\E[%p1%{40}%+%cm, - setf=\E[%p1%{30}%+%cm, sgr0=\E[0;10m, smkx=\E[?4h, - smso=\E[7m, smul=\E[4m, u6=\E[%i%p1%d;%p2%dR, u7=\E[6n, - vpa=\E[%i%p1%dd, use=ansi+arrows, use=ansi+csr, - use=ansi+erase, use=ansi+idc, use=ansi+idl, - use=ansi+local, use=klone+color, use=vt220+pcedit, + bel=^G, bold=\E[1m, cr=\r, cub1=^H, cud1=\n, ech=\E[%p1%dX, + el1=\E[1K, ht=^I, hts=\EH, ind=\n, kf10=\E[20~, kf11=\E[21~, + kf12=\E[22~, kf6=\E[16~, kf7=\E[17~, kf8=\E[18~, + kf9=\E[19~, khome=\E[1~, kspd=^Z, nel=\r\n, op=\E[m, + rev=\E[7m, ri=\EM, rmkx=\E[?4l, rs1=\Ec, + setb=\E[%p1%{40}%+%cm, setf=\E[%p1%{30}%+%cm, + sgr0=\E[0;10m, smkx=\E[?4h, u6=\E[%i%p1%d;%p2%dR, + u7=\E[6n, use=ecma+underline, use=ansi+arrows, + use=ansi+csr, use=ansi+cup, use=ansi+erase, use=ansi+idc, + use=ansi+idl, use=ansi+local, use=ansi+rca2, + use=ansi+sgrso, use=klone+color, use=vt220+pcedit, + use=xterm+r5+fkeys, #### Linux consoles # @@ -973,28 +975,31 @@ acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i \316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u \264v\301w\302x\263y\363z\362{\343|\330}\234~\376, - bel=^G, cr=\r, cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, - dim=\E[2m, ech=\E[%p1%dX, el1=\E[1K, - flash=\E[?5h$<200/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG, - ht=^I, hts=\EH, ind=\n, kb2=\E[G, kbs=^?, kcbt=\E[Z, kf1=\E[[A, - kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\E[[B, - kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, - kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kmous=\E[M, kspd=^Z, - nel=\r\n, ri=\EM, rmam=\E[?7l, rmso=\E[27m, rmul=\E[24m, - rs1=\Ec\E]R, + bel=^G, cr=\r, cub1=^H, cud1=\n, dim=\E[2m, ech=\E[%p1%dX, + el1=\E[1K, flash=\E[?5h$<200/>\E[?5l, ht=^I, hts=\EH, + ind=\n, kb2=\E[G, kbs=^?, kcbt=\E[Z, khome=\E[1~, kmous=\E[M, + kspd=^Z, nel=\r\n, ri=\EM, rmam=\E[?7l, rs1=\Ec\E]R, sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5 %t;2%;%?%p6%t;1%;%?%p9%t;11%;m, - smam=\E[?7h, tbc=\E[3g, vpa=\E[%i%p1%dd, use=ansi+arrows, - use=ansi+csr, use=ansi+erase, use=ansi+idc, use=ansi+idl, - use=ansi+local, use=vt220+pcedit, use=vt102+enq, - use=klone+sgr, use=ecma+color, use=linux+sfkeys, + smam=\E[?7h, tbc=\E[3g, use=ecma+underline, + use=ecma+standout, use=ansi+arrows, use=ansi+csr, + use=ansi+cup, use=ansi+erase, use=ansi+idc, use=ansi+idl, + use=ansi+local, use=ansi+rca2, use=vt220+pcedit, + use=vt102+enq, use=klone+sgr, use=ecma+color, + use=linux+lockeys, use=linux+sfkeys, use=vt220+ufkeys, + +# VT220 uses F1-F5 for "local" manipulation, normally not sending anything to +# the host. Rather than adapt the numbering scheme used by xterm, Linux used +# this arrangement which doubles the "[", making it inconsistent with most +# terminals having function-keys in the same format as control sequences -TD +linux+lockeys|Linux "local" keys in vt220 scheme, + kf1=\E[[A, kf2=\E[[B, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, linux+decid|ncurses extension for Linux console DECID, u8=\E[?6c, use=decid+cpr, linux+sfkeys|shifted function-keys for Linux console, - kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, - kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, + use=vt220+sfkeys, linux-m|Linux console no color, colors@, pairs@, @@ -1140,34 +1145,29 @@ # of the functionality), but does not recognize as many control sequences. # The program comes bundled with an old (circa 1998) copy of the Linux # console terminfo. It recognizes some non-ANSI/VT100 sequences such as -# \E* move cursor to home, as as \E[H +# \E* move cursor to home, as \E[H # \E,X same as \E(X # \EE move cursor to beginning of row # \E[y,xf same as \E[y,xH # # Note: The status-line support is buggy (dsl does not work). kon|kon2|Kanji ON Linux console, - am, bce, ccc, eo, eslok, hs, mir, msgr, xenl, xon, + am, bce, ccc, eo, mir, msgr, xenl, xon, it#8, ncv#18, - bel=^G, civis=\E[?25l, cnorm=\E[?25h, cr=\r, cub1=^H, - cud1=\n, cup=\E[%i%p1%d;%p2%dH, dim=\E[2m, - dsl=\E[?H\E[?E, el1=\E[1K, fsl=\E[?F, home=\E[H, - hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ind=\n, + bel=^G, cr=\r, cub1=^H, cud1=\n, dim=\E[2m, dsl=\E[?H\E[?E, + el1=\E[1K, fsl=\E[?F, ht=^I, hts=\EH, ind=\n, initc=\E]P%p1%x%p2%02x%p3%02x%p4%02x, kb2=\E[G, kbs=^?, - kf1=\E[[A, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, - kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, - kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[[B, - kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, - kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kspd=^Z, - nel=\r\n, op=\E[37;40m, ri=\EM, rmso=\E[27m, rmul=\E[24m, - rs1=\Ec, + khome=\E[1~, kspd=^Z, nel=\r\n, ri=\EM, rs1=\Ec, sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5 %t;2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, sgr0=\E[0;10m, tbc=\E[3g, tsl=\E[?T, u8=\E[?6c, - vpa=\E[%i%p1%dd, use=ansi+arrows, use=ansi+csr, + use=ecma+underline, use=ecma+standout, use=vt220+cvis, + use=ansi+arrows, use=ansi+csr, use=ansi+cup, use=ansi+enq, use=ansi+erase, use=ansi+idc, use=ansi+idl, - use=ansi+local, use=ansi+sgrbold, use=ecma+sgr, - use=klone+color, use=vt220+pcedit, + use=ansi+local, use=ansi+sgrbold, use=ansi+rca2, + use=dec+sl, use=ecma+sgr, use=klone+color, + use=linux+lockeys, use=linux+sfkeys, use=vt220+ufkeys, + use=vt220+pcedit, # release: 0.4.7 2005/05 # @@ -1237,18 +1237,33 @@ am, bce, colors#8, cols#80, lines#24, pairs#64, acsc=aajjkkllmmqqttuuxx, bold=\E[1m, clear=\E[H\E[2J, - cr=\r, cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, ed=\E[J, - el=\E[K, home=\E[H, ind=\n, kb2=\E[G, kbs=^?, kcbt=\E[Z, - kf1=\E[[A, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, - kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, - kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[[B, - kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, - kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[1~, - kmous=\E[M, kspd=^Z, nel=\r\n, op=\E[49m\E[39m, rev=\E[7m, - ri=\EM, rmacs=^O, rmso=\E[27m, rmul=\E[24m, + cr=\r, cub1=^H, cud1=\n, ed=\E[J, el=\E[K, ind=\n, kb2=\E[G, + kbs=^?, kcbt=\E[Z, khome=\E[1~, kmous=\E[M, kspd=^Z, + nel=\r\n, op=\E[49m\E[39m, rev=\E[7m, ri=\EM, rmacs=^O, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[0m, smacs=^N, - smso=\E[7m, smul=\E[4m, use=ansi+arrows, - use=vt220+pcedit, use=vt220+cvis, + smul=\E[4m, use=ecma+underline, use=ecma+standout, + use=ansi+arrows, use=ansi+cup, use=linux+lockeys, + use=linux+sfkeys, use=vt220+pcedit, use=vt220+cvis, + use=vt220+ufkeys, + +# https://lists.gnu.org/archive/html/bug-ncurses/2025-04/msg00014.html +sclp|IBM s390 driver for Linux, + xon, + cols#80, lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, cr=\r, cub1=^H, cud1=\n, + cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, el1=\E[1K, + enacs=\E)0, ht=^I, ich=\E[%p1%d@, ind=\ED, is2=\Ec, + kf5=\E[15~, khome=\E[1~, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, + rmacs=\E(B$<4>, sc=\E7, + sgr=\E[0%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e + \E(B%;$<2>, + sgr0=\E[m\E(B, smacs=\E(0$<2>, smul=\E[4m, + use=ecma+underline, use=ecma+standout, use=klone+color, + use=ansi+arrows, use=ansi+cpr, use=ansi+erase, + use=ansi+local, use=ansi+rca, use=linux+sfkeys, + use=vt100+pf1-pf4, use=vt220+ufkeys, use=vt220+pcedit, #### Mach # @@ -1258,20 +1273,19 @@ am, km, NQ, cols#80, it#8, lines#25, bel=^G, blink=\E[5m, bold=\E[1m, clear=\Ec, cr=\r, cub1=^H, - cud1=\n, cup=\E[%i%p1%d;%p2%dH, ed=\E[J, el=\E[K, - home=\E[H, ht=^I, ind=\n, kbs=^?, kdch1=\E[9, kend=\E[Y, - kf1=\EOP, kf10=\EOY, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, - kf6=\EOU, kf7=\EOV, kf8=\EOW, kf9=\EOX, kich1=\E[@, kll=\E[F, - knp=\E[U, kpp=\E[V, rev=\E[7m, rmso=\E[0m, rmul=\E[24m, - sgr0=\E[0m, smso=\E[7m, smul=\E[4m, use=ansi+arrows, - use=ansi+idl, use=ansi+local, + cud1=\n, ed=\E[J, el=\E[K, ht=^I, ind=\n, kbs=^?, kdch1=\E[9, + kend=\E[Y, kf10=\EOY, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, + kf9=\EOX, kich1=\E[@, kll=\E[F, knp=\E[U, kpp=\E[V, + rev=\E[7m, rmso=\E[0m, sgr0=\E[0m, use=ecma+underline, + use=ansi+arrows, use=ansi+cup, use=ansi+idl, + use=ansi+local, use=ansi+sgrso, use=vt100+pf1-pf4, mach-bold|Mach console with bold instead of underline, rmul=\E[0m, smul=\E[1m, use=mach, mach-color|Mach console with ANSI color, colors#8, pairs#64, - dim=\E[2m, invis=\E[8m, op=\E[37;40m, rmso=\E[27m, - setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=mach, + dim=\E[2m, invis=\E[8m, op=\E[37;40m, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, use=ecma+standout, use=mach, # From: Samuel Thibault # Source: git://git.sv.gnu.org/hurd/gnumach.git @@ -1291,8 +1305,8 @@ mach-gnu-color|GNU Mach console with ANSI color, colors#8, pairs#64, - op=\E[37;40m, rmso=\E[27m, setab=\E[4%p1%dm, - setaf=\E[3%p1%dm, use=mach-gnu, + op=\E[37;40m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + use=ecma+standout, use=mach-gnu, # From: Marcus Brinkmann # http://git.savannah.gnu.org/cgit/hurd/hurd.git/log/console/ @@ -1329,22 +1343,19 @@ bel=^G, cbt=\E[Z, clear=\Ec, cr=\r, cub1=^H, cvvis=\E[34l, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, ech=\E[%p1%dX, el1=\E[1K, flash=\Eg, ht=^I, ich=\E[%p1%d@, ind=\E[S, - kb2=\E[G, kbs=^?, kcbt=\E[Z, kf1=\EOP, kf10=\E[21~, - kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, - kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, - kf19=\E[33~, kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, - kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, - khome=\E[1~, kmous=\E[M, kspd=^Z, nel=\r\n, op=\E[39;49m, - ri=\E[T, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, + kb2=\E[G, kbs=^?, kcbt=\E[Z, khome=\E[1~, kmous=\E[M, + kspd=^Z, nel=\r\n, op=\E[39;49m, ri=\E[T, rmir=\E[4l, rs1=\EM\E[?1000l, sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t; 2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, smir=\E[4h, grbom=\E[>1l, gsbom=\E[>1h, + use=ecma+underline, use=ecma+standout, use=ansi+apparrows, use=ansi+csr, use=ansi+cup, use=ansi+erase, use=ansi+idl, use=ansi+local, use=ansi+rca2, use=ansi+sgrbold, use=vt220+pcedit, use=ecma+index, use=ecma+italics, use=klone+acs, - use=klone+color, use=vt220+cvis, + use=klone+color, use=linux+sfkeys, use=vt100+pf1-pf4, + use=vt220+cvis, use=xterm+r5+fkeys, #### QNX # @@ -1462,14 +1473,13 @@ kLFT=\E[d, kNXT=\E[u, kOPT=\ENz, kPRV=\E[v, kRIT=\E[c, kcan=\E[S, kcbt=\E[Z, kclo=\ENc, kclr=\ENa, kcmd=\E[G, kcpy=\E[g, kctab=\E[z, kdch1=\E[P, kdl1=\E[p, kend=\E[Y, - kext=\E[y, kf1=\EOP, kf10=\EOY, kf11=\EOZ, kf12=\EOA, - kf13=\EOp, kf14=\EOq, kf15=\EOr, kf16=\EOs, kf17=\EOt, - kf18=\EOu, kf19=\EOv, kf2=\EOQ, kf20=\EOw, kf21=\EOx, - kf22=\EOy, kf23=\EOz, kf24=\EOa, kf25=\E[1~, kf26=\E[2~, - kf27=\E[3~, kf28=\E[4~, kf29=\E[5~, kf3=\EOR, kf30=\E[6~, - kf31=\E[7~, kf32=\E[8~, kf33=\E[9~, kf34=\E[10~, - kf35=\E[11~, kf36=\E[12~, kf37=\E[17~, kf38=\E[18~, - kf39=\E[19~, kf4=\EOS, kf40=\E[20~, kf41=\E[21~, + kext=\E[y, kf10=\EOY, kf11=\EOZ, kf12=\EOA, kf13=\EOp, + kf14=\EOq, kf15=\EOr, kf16=\EOs, kf17=\EOt, kf18=\EOu, + kf19=\EOv, kf20=\EOw, kf21=\EOx, kf22=\EOy, kf23=\EOz, + kf24=\EOa, kf25=\E[1~, kf26=\E[2~, kf27=\E[3~, kf28=\E[4~, + kf29=\E[5~, kf30=\E[6~, kf31=\E[7~, kf32=\E[8~, kf33=\E[9~, + kf34=\E[10~, kf35=\E[11~, kf36=\E[12~, kf37=\E[17~, + kf38=\E[18~, kf39=\E[19~, kf40=\E[20~, kf41=\E[21~, kf42=\E[22~, kf43=\E[23~, kf44=\E[24~, kf45=\E[25~, kf46=\E[26~, kf47=\E[27~, kf48=\E[28~, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, kf9=\EOX, kfnd=\ENf, khlp=\ENh, @@ -1478,7 +1488,7 @@ kpp=\E[V, kref=\ENl, kres=\ENp, krfr=\ENg, kri=\E[b, krpl=\ENr, krst=\ENj, ksav=\ENq, kslt=\E[T, ktbc=\ENd, kund=\ENu, ll=\E[99H, nel=\EE, op=\E[39;49m, ri=\E[T, - rmacs=^O, rmam=\E[?7l, rmso=\E[27m, rmul=\E[24m, + rmacs=^O, rmam=\E[?7l, rs1=\017\E[?7h\E[0;39;49m$<2>\E>\E[?1l, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6} @@ -1488,10 +1498,11 @@ sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1 %|%t;7%;%?%p7%t;9%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smam=\E[?7h, - tsl=\E7\E1;24r\E[?6l\E[25;%i%p1%dH, use=ansi+arrows, + tsl=\E7\E1;24r\E[?6l\E[25;%i%p1%dH, + use=ecma+underline, use=ecma+standout, use=ansi+arrows, use=ansi+local, use=ansi+rep, use=ansi+inittabs, use=ansi+sgrbold, use=att610+cvis0, use=decid+cpr, - use=ecma+index, + use=ecma+index, use=vt100+pf1-pf4, # qansi|QNX ANSI with console writes, daisy, xhpa, use=qansi-g, @@ -1523,8 +1534,8 @@ # # klone+sgr-dumb is an error since the acsc does not match -TD # -# In this description based on SCO's keyboard(HW) manpage list of default -# function key values: +# In this description based on SCO's keyboard(HW) man page list of +# default function key values: # F13-F24 are shifted F1-F12 # F25-F36 are control F1-F12 # F37-F48 are shift+control F1-F12 @@ -1547,26 +1558,26 @@ yszr{c}\034~\207, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[=14;12C, clear=\E[H\E[2J, cnorm=\E[=10;12C, - cub1=^H, cup=\E[%i%p1%d;%p2%dH, cvvis=\E[=0;12C, - dch=\E[%p1%dP, dch1=\E[P, dispc=\E[=%p1%dg, ed=\E[m\E[J, - el=\E[m\E[K, el1=\E[1K, home=\E[H, ht=^I, hts=\EH, - ich=\E[%p1%d@, ich1=\E[@, ind=\E[S, invis=\E[8m, kbeg=\E[E, - kcbt=\E[Z, kdch1=^?, kend=\E[F, kf1=\E[M, kf10=\E[V, - kf11=\E[W, kf12=\E[X, kf13=\E[Y, kf15=\E[a, kf16=\E[b, - kf17=\E[c, kf18=\E[d, kf19=\E[e, kf2=\E[N, kf20=\E[f, - kf21=\E[g, kf22=\E[h, kf23=\E[i, kf24=\E[j, kf25=\E[k, - kf26=\E[l, kf27=\E[m, kf28=\E[n, kf29=\E[o, kf3=\E[O, - kf30=\E[p, kf31=\E[q, kf32=\E[r, kf33=\E[s, kf34=\E[t, - kf35=\E[u, kf36=\E[v, kf37=\E[w, kf38=\E[x, kf39=\E[y, - kf4=\E[P, kf40=\E[z, kf41=\E[@, kf42=\E[[, kf43=\E[\\, - kf44=\E[], kf45=\E[\^, kf46=\E[_, kf47=\E[`, kf48=\E[{, - kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, kich1=\E[L, - knp=\E[G, kpp=\E[I, op=\E[0;37;40m, rc=\E8, rev=\E[7m, - ri=\E[T, rmacs=\E[10m, rmam=\E[?7l, rmso=\E[m, rmul=\E[m, + cub1=^H, cvvis=\E[=0;12C, dch=\E[%p1%dP, dch1=\E[P, + dispc=\E[=%p1%dg, ed=\E[m\E[J, el=\E[m\E[K, el1=\E[1K, + ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, ind=\E[S, + invis=\E[8m, kbeg=\E[E, kcbt=\E[Z, kdch1=^?, kend=\E[F, + kf1=\E[M, kf10=\E[V, kf11=\E[W, kf12=\E[X, kf13=\E[Y, + kf15=\E[a, kf16=\E[b, kf17=\E[c, kf18=\E[d, kf19=\E[e, + kf2=\E[N, kf20=\E[f, kf21=\E[g, kf22=\E[h, kf23=\E[i, + kf24=\E[j, kf25=\E[k, kf26=\E[l, kf27=\E[m, kf28=\E[n, + kf29=\E[o, kf3=\E[O, kf30=\E[p, kf31=\E[q, kf32=\E[r, + kf33=\E[s, kf34=\E[t, kf35=\E[u, kf36=\E[v, kf37=\E[w, + kf38=\E[x, kf39=\E[y, kf4=\E[P, kf40=\E[z, kf41=\E[@, + kf42=\E[[, kf43=\E[\\, kf44=\E[], kf45=\E[\^, kf46=\E[_, + kf47=\E[`, kf48=\E[{, kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, + kf9=\E[U, kich1=\E[L, knp=\E[G, kpp=\E[I, op=\E[0;37;40m, + rc=\E8, rev=\E[7m, ri=\E[T, rmacs=\E[10m, rmam=\E[?7l, sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, - sgr0=\E[0;10m, smacs=\E[12m, smam=\E[?7h, smso=\E[7m, - smul=\E[4m, use=ansi+arrows, use=ansi+idl, - use=ansi+local, use=ecma+index, + sgr0=\E[0;10m, smacs=\E[12m, smam=\E[?7h, + use=ansi+arrows, use=ansi+cup, use=ansi+idl, + use=ansi+local, use=ansi+sgrso, use=ansi+sgrul, + use=ecma+index, scoansi-new|SCO Extended ANSI standard crt (5.0.6), km, @@ -1625,9 +1636,8 @@ cols#80, it#8, lines#40, bel=^G, bold=\E[1m, clear=\E[H\E[2J, cnorm=\E[9/y\E[12/y\E[=6l, cr=\r, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, cvvis=\E[10/y\E[=1h\E[=2l\E[=6h, ed=\E[J, el=\E[K, - el1=\E[1K, home=\E[H, ht=^I, hts=\EH, ind=\ED, + el1=\E[1K, ht=^I, hts=\EH, ind=\ED, is2=\E[?1l\E>\E[?7h\E[100g\E[0m\E7\E[r\E8, kDC=\E[P, kEND=\E[147q, kHOM=\E[143q, kLFT=\E[158q, kPRT=\E[210q, kRIT=\E[167q, kSPD=\E[218q, kcbt=\E[Z, kdch1=^?, @@ -1637,22 +1647,23 @@ kf8=\E[008q, kf9=\E[009q, kich1=\E[139q, knp=\E[154q, kpp=\E[150q, kprt=\E[209q, krmir=\E[146q, kspd=\E[217q, nel=\EE, pfkey=\EP101;%p1%d.y%p2%s\E\\, rc=\E8, - rev=\E[7m, ri=\EM, rmam=\E[?7l, rmso=\E[m, rmul=\E[m, sc=\E7, - sgr0=\E[m, smam=\E[?7h, smso=\E[1;7m, smul=\E[4m, - tbc=\E[3g, use=ansi+arrows, use=ansi+idl, use=ansi+local, + rev=\E[7m, ri=\EM, rmam=\E[?7l, rmso=\E[m, sc=\E7, sgr0=\E[m, + smam=\E[?7h, smso=\E[1;7m, tbc=\E[3g, use=ansi+arrows, + use=ansi+cup, use=ansi+idl, use=ansi+local, + use=ansi+sgrul, iris-ansi-ap|IRIS ANSI in application-keypad mode, is2=\E[?1l\E=\E[?7h, kent=\EOM, use=iris-ansi, -# From the man-page, this is a quasi-vt100 emulator that runs on SGI's IRIX +# From the man page, this is a quasi-vt100 emulator that runs on SGI's IRIX # (T.Dickey 98/1/24) iris-color|xwsh|IRIX ANSI with color, ncv#33, csr=\E[%i%p1%d;%p2%dr, dch=\E[%p1%dP, dim=\E[2m, - ech=\E[%p1%dX, ich=\E[%p1%d@, rmul=\E[24m, rs1=\Ec, + ech=\E[%p1%dX, ich=\E[%p1%d@, rs1=\Ec, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, - use=ecma+italics, use=vt100+enq, use=klone+color, - use=iris-ansi-ap, + use=ecma+underline, use=ecma+italics, use=vt100+enq, + use=klone+color, use=iris-ansi-ap, #### OpenBSD consoles # @@ -1669,51 +1680,48 @@ # Notes from testing with vttest: # fails wrapping test # no 8-bit controls -# identifies as vt200 with selective erase, but does not implement DECSCA +# DA1 says vt200 with selective erase, but does not implement DECSCA +# DA2 says vt320, has DECTABSR # no vt52 mode # also lacks these: # ESC # 8 DEC Screen Alignment Test (DECALN). # CSI ? 5 h Reverse Video (DECSCNM). # pccon+keys|OpenBSD PC keyboard keys, - kbs=^?, kend=\E[8~, kent=\r, kf1=\E[11~, kf10=\E[21~, - kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, - kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, - kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, kf21=\E[35~, - kf22=\E[36~, kf23=\E[37~, kf24=\E[38~, kf3=\E[13~, - kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, - kf9=\E[20~, khome=\E[7~, krfr=^R, use=ansi+arrows, - use=vt220+pcedit, + kbs=^?, kend=\E[8~, kent=\r, kf21=\E[35~, kf22=\E[36~, + kf23=\E[37~, kf24=\E[38~, khome=\E[7~, krfr=^R, + use=ansi+arrows, use=vt220+pcedit, use=vt220+sfkeys, + use=xterm+r5+fkeys, pccon+sgr+acs0|sgr and simple ASCII pseudographics for OpenBSD PC console, acsc=+>\,<-\^.v0#`+a:f\\h#i#j+k+l+m+n+o~p-q-r-s_t+u+v+w+x|y# z#{*|!}#~o, - bold=\E[1m, rev=\E[7m, rmso=\E[27m, + bold=\E[1m, rev=\E[7m, sgr=\E[0%?%p1%p3%|%t;7%;%?%p6%t;1%;%?%p2%t;4%;m, - sgr0=\E[m, smso=\E[7m, + sgr0=\E[m, use=ecma+standout, pccon+sgr+acs|sgr and default ASCII pseudographics for OpenBSD PC console, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bold=\E[1m, enacs=\E)0, rev=\E[7m, rmacs=\E(B, rmso=\E[27m, + bold=\E[1m, enacs=\E)0, rev=\E[7m, rmacs=\E(B, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e \E(B%;, - sgr0=\E[m\E(B, smacs=\E(0, smso=\E[7m, + sgr0=\E[m\E(B, smacs=\E(0, use=ecma+standout, # underline renders as color pccon+colors|ANSI colors for OpenBSD PC console, bce, ncv#2, op=\E[49;39m, use=klone+color, -# OpenBSD uses wscons, -# + which does not implement DECSCNM or anything comparable, so it does not +# OpenBSD uses wscons, "imported" from NetBSD in 2000. +# + it does not implement DECSCNM or anything comparable, so it does not # support flash. # + it renders underline using color. pccon+base|base capabilities for OpenBSD PC console, am, km, mc5i, msgr, npc, nxon, xenl, xon, cols#80, it#8, lines#24, - bel=^G, cr=\r, cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, - dch=\E[%p1%dP, dch1=\E[P, ech=\E[%p1%dX, el1=\E[1K, - home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ind=\ED, nel=\EE, - ri=\EM, rmam=\E[?7l, rmul=\E[24m, rs2=\Ec, smam=\E[?7h, - smul=\E[4m, tbc=\E[3g, use=ansi+cpr, use=ansi+csr, - use=ansi+erase, use=ansi+idl, use=ansi+local, + bel=^G, cr=\r, cub1=^H, cud1=\n, dch=\E[%p1%dP, dch1=\E[P, + ech=\E[%p1%dX, el1=\E[1K, ht=^I, hts=\EH, ich=\E[%p1%d@, + ich1=\E[@, ind=\ED, nel=\EE, ri=\EM, rmam=\E[?7l, rs2=\Ec, + smam=\E[?7h, smul=\E[4m, tbc=\E[3g, use=ecma+underline, + use=ansi+cpr, use=ansi+csr, use=ansi+cup, use=ansi+erase, + use=ansi+idl, use=ansi+local, use=xterm+keypad, pccon0-m|OpenBSD PC console without colors & with simple ASCII pseudographics, use=pccon+sgr+acs0, use=pccon+base, use=pccon+keys, @@ -1744,19 +1752,19 @@ acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxy yzz~~, bel=^G, blink=\E[5m, bold=\E[1m, cr=\r, cub1=^H, - cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, - el1=\E[1K, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ind=\ED, + dch=\E[%p1%dP, dch1=\E[P, el1=\E[1K, ht=^I, hts=\EH, + ich=\E[%p1%d@, ind=\ED, is1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, kbs=^?, kdch1=\E[3~, kf1=\E[17~, kf2=\E[18~, kf3=\E[19~, kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, khome=\E[1~, kich1=\E[2~, kll=\E[4~, knp=\E[6~, kpp=\E[5~, nel=\EE, rev=\E[7m, rf=/usr/share/tabset/vt100, ri=\EM, rmacs=\E(B, rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, - rmso=\E[27m, rmul=\E[24m, rs1=\Ec\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sgr0=\E[m, smacs=\E(0, smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, - smso=\E[7m, smul=\E[4m, tbc=\E[3g, use=ansi+apparrows, - use=ansi+csr, use=ansi+erase, use=ansi+idl, + smul=\E[4m, tbc=\E[3g, use=ecma+underline, + use=ecma+standout, use=ansi+apparrows, use=ansi+csr, + use=ansi+cup, use=ansi+erase, use=ansi+idl, use=ansi+local, use=decid+cpr, use=ecma+index, use=vt220+cvis, @@ -1807,12 +1815,10 @@ # OpenBSD implements a color variation pcvt25-color|DEC VT220 emulation with 25 lines and color, cols#80, lines#25, - is2=\E[1;25r\E[25;1H, kf1=\EOP, kf10=\E[29~, kf11=\E[23~, - kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, - kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, - kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf5=\E[17~, - kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, kf9=\E[21~, use=pcvtXX, - use=ecma+color, + is2=\E[1;25r\E[25;1H, kf10=\E[29~, kf11=\E[23~, + kf12=\E[24~, kf5=\E[17~, kf6=\E[18~, kf7=\E[19~, + kf8=\E[20~, kf9=\E[21~, use=vt100+pf1-pf4, use=pcvtXX, + use=ecma+color, use=vt220+sfkeys, # Terminfo entries to enable the use of the ncurses library in colour on a # NetBSD-arm32 console (only tested on a RiscPC). @@ -1886,10 +1892,9 @@ wsvt25|NetBSD wscons in 25 line DEC VT220 mode, bce, colors#8, lines#25, pairs#64, - is2=\E[r\E[25;1H, kdch1=\E[3~, kend=\E[8~, kf1=\E[11~, - kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, - khome=\E[7~, op=\E[m, rs1=\Ec, setab=\E[4%p1%dm, - setaf=\E[3%p1%dm, use=vt220, + is2=\E[r\E[25;1H, kdch1=\E[3~, kend=\E[8~, khome=\E[7~, + op=\E[m, rs1=\Ec, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + use=xterm+r5+lockeys, use=vt220, wsvt25m|NetBSD wscons in 25 line DEC VT220 mode with Meta, km, use=wsvt25, @@ -1949,17 +1954,17 @@ OTbs, OTpt, am, bce, bw, eo, km, msgr, npc, colors#8, cols#80, it#8, lines#18, pairs#64, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, cr=\r, cub1=^H, - cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, - dim=\E[30;1m, ech=\E[%p1%dX, el1=\E[1K, home=\E[H, - hpa=\E[%i%p1%d`, ht=^I, ich=\E[%p1%d@, ich1=\E[@, ind=\E[S, - kb2=\E[E, kcbt=\E[Z, kdch1=^?, kend=\E[F, kf1=\E[M, - kf10=\E[V, kf11=\E[W, kf12=\E[X, kf2=\E[N, kf3=\E[O, - kf4=\E[P, kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, - kich1=\E[L, knp=\E[G, kpp=\E[I, nel=\E[E, op=\E[x, rev=\E[7m, - ri=\E[T, rmso=\E[m, rs2=\E[x\E[m\Ec, setb=\E[4%p1%dm, - setf=\E[3%p1%dm, sgr0=\E[m, smso=\E[7m, vpa=\E[%i%p1%dd, - use=ansi+arrows, use=ansi+csr, use=ansi+erase, - use=ansi+idl, use=ansi+local, use=ecma+index, + dch=\E[%p1%dP, dch1=\E[P, dim=\E[30;1m, ech=\E[%p1%dX, + el1=\E[1K, hpa=\E[%i%p1%d`, ht=^I, ich=\E[%p1%d@, + ich1=\E[@, ind=\E[S, kb2=\E[E, kcbt=\E[Z, kdch1=^?, + kend=\E[F, kf1=\E[M, kf10=\E[V, kf11=\E[W, kf12=\E[X, + kf2=\E[N, kf3=\E[O, kf4=\E[P, kf5=\E[Q, kf6=\E[R, kf7=\E[S, + kf8=\E[T, kf9=\E[U, kich1=\E[L, knp=\E[G, kpp=\E[I, nel=\E[E, + op=\E[x, rev=\E[7m, ri=\E[T, rs2=\E[x\E[m\Ec, + setb=\E[4%p1%dm, setf=\E[3%p1%dm, sgr0=\E[m, + vpa=\E[%i%p1%dd, use=ansi+arrows, use=ansi+csr, + use=ansi+cup, use=ansi+erase, use=ansi+idl, + use=ansi+local, use=ansi+sgrso, use=ecma+index, #### FreeBSD console entries @@ -1997,27 +2002,27 @@ am, bce, bw, eo, msgr, npc, cols#80, it#8, lines#25, ncv#21, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, cnorm=\E[=0C, - cr=\r, cub1=^H, cup=\E[%i%p1%d;%p2%dH, cvvis=\E[=1C, - dch=\E[%p1%dP, dch1=\E[P, dim=\E[30;1m, ech=\E[%p1%dX, - home=\E[H, hpa=\E[%i%p1%d`, ht=^I, ich=\E[%p1%d@, - ich1=\E[@, ind=\E[S, kb2=\E[E, kcbt=\E[Z, kdch1=^?, - kend=\E[F, kf1=\E[M, kf10=\E[V, kf11=\E[W, kf12=\E[X, - kf13=\E[Y, kf14=\E[Z, kf15=\E[a, kf16=\E[b, kf17=\E[c, - kf18=\E[d, kf19=\E[e, kf2=\E[N, kf20=\E[f, kf21=\E[g, - kf22=\E[h, kf23=\E[i, kf24=\E[j, kf25=\E[k, kf26=\E[l, - kf27=\E[m, kf28=\E[n, kf29=\E[o, kf3=\E[O, kf30=\E[p, - kf31=\E[q, kf32=\E[r, kf33=\E[s, kf34=\E[t, kf35=\E[u, - kf36=\E[v, kf37=\E[w, kf38=\E[x, kf39=\E[y, kf4=\E[P, - kf40=\E[z, kf41=\E[@, kf42=\E[[, kf43=\E[\\, kf44=\E[], - kf45=\E[\^, kf46=\E[_, kf47=\E[`, kf48=\E[{, kf5=\E[Q, - kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, kich1=\E[L, knp=\E[G, - kpp=\E[I, nel=\E[E, op=\E[x, rc=\E8, rev=\E[7m, ri=\E[T, - rmso=\E[m, rs2=\E[x\E[m\Ec, sc=\E7, + cr=\r, cub1=^H, cvvis=\E[=1C, dch=\E[%p1%dP, dch1=\E[P, + dim=\E[30;1m, ech=\E[%p1%dX, hpa=\E[%i%p1%d`, ht=^I, + ich=\E[%p1%d@, ich1=\E[@, ind=\E[S, kb2=\E[E, kcbt=\E[Z, + kdch1=^?, kend=\E[F, kf1=\E[M, kf10=\E[V, kf11=\E[W, + kf12=\E[X, kf13=\E[Y, kf14=\E[Z, kf15=\E[a, kf16=\E[b, + kf17=\E[c, kf18=\E[d, kf19=\E[e, kf2=\E[N, kf20=\E[f, + kf21=\E[g, kf22=\E[h, kf23=\E[i, kf24=\E[j, kf25=\E[k, + kf26=\E[l, kf27=\E[m, kf28=\E[n, kf29=\E[o, kf3=\E[O, + kf30=\E[p, kf31=\E[q, kf32=\E[r, kf33=\E[s, kf34=\E[t, + kf35=\E[u, kf36=\E[v, kf37=\E[w, kf38=\E[x, kf39=\E[y, + kf4=\E[P, kf40=\E[z, kf41=\E[@, kf42=\E[[, kf43=\E[\\, + kf44=\E[], kf45=\E[\^, kf46=\E[_, kf47=\E[`, kf48=\E[{, + kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, kich1=\E[L, + knp=\E[G, kpp=\E[I, nel=\E[E, op=\E[x, rc=\E8, rev=\E[7m, + ri=\E[T, rs2=\E[x\E[m\Ec, sc=\E7, sgr=\E[0%?%p1%t;2;7%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;30;1%;%? %p6%t;1%;m, - sgr0=\E[m, smso=\E[7m, vpa=\E[%i%p1%dd, use=ansi+arrows, - use=ansi+erase, use=ansi+idl, use=ansi+local, - use=ecma+index, use=klone+color, + sgr0=\E[m, vpa=\E[%i%p1%dd, use=ansi+arrows, + use=ansi+cup, use=ansi+erase, use=ansi+idl, + use=ansi+local, use=ansi+sgrso, use=ecma+index, + use=klone+color, cons25|ansis|ansi80x25|FreeBSD console (25-line ANSI mode), acsc=-\030.^Y0\333`\004a\260f\370g\361h\261i\025j\331k\277l @@ -2028,9 +2033,8 @@ kbs=^?, kdch1=\E[3~, use=cons25, cons25-m|ansis-mono|ansi80x25-mono|FreeBSD console (25-line mono ANSI mode), colors@, pairs@, - bold@, dim@, op@, rmul=\E[m, setab@, setaf@, - sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m, - smul=\E[4m, use=cons25, + bold@, dim@, op@, setab@, setaf@, + sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m, use=ansi+sgrul, use=cons25, cons30|ansi80x30|FreeBSD console (30-line ANSI mode), lines#30, use=cons25, cons30-m|ansi80x30-mono|FreeBSD console (30-line mono ANSI mode), @@ -2054,10 +2058,10 @@ use=cons25w, cons25r-m|pc3r-m|ibmpc3r-mono|cons25-koi8r-m|FreeBSD console w/koi8-r cyrillic (mono), colors@, pairs@, - op@, rmul=\E[m, setab@, setaf@, + op@, setab@, setaf@, sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5 %t;30;1%;%?%p6%t;1%;m, - smul=\E[4m, use=cons25r, + use=ansi+sgrul, use=cons25r, cons50r|cons50-koi8r|FreeBSD console w/koi8-r cyrillic (50 lines), lines#50, use=cons25r, cons50r-m|cons50-koi8r-m|FreeBSD console w/koi8-r cyrillic (50-line mono), @@ -2074,9 +2078,8 @@ use=cons25w, cons25l1-m|cons25-iso-m|FreeBSD console w/iso 8859-1 chars (mono), colors@, pairs@, - bold@, dim@, op@, rmul=\E[m, setab@, setaf@, - sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m, - smul=\E[4m, use=cons25l1, + bold@, dim@, op@, setab@, setaf@, + sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m, use=ansi+sgrul, use=cons25l1, cons50l1|cons50-iso8859|FreeBSD console w/iso 8859-1 chars (50 lines), lines#50, use=cons25l1, cons50l1-m|cons50-iso-m|FreeBSD console w/iso 8859-1 chars (50-line mono), @@ -2180,30 +2183,27 @@ acsc=0\333a\260f\370g\361h\261j\331k\277l\332m\300n\305q \304t\303u\264v\301w\302x\263y\363z\362~\371, cvvis@, hpa=\E[%i%p1%dG, hts=\EH, kdch1=\E[3~, kent=\r, - kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, - kf3=\EOR, kf4=\EOS, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, - kf8=\E[19~, kf9=\E[20~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, - rmir=\E[4l, smir=\E[4h, tbc=\E[3g, use=vt220+cvis, - use=cons25, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf5=\E[15~, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + kich1=\E[2~, knp=\E[6~, kpp=\E[5~, rmir=\E[4l, smir=\E[4h, + tbc=\E[3g, use=vt100+pf1-pf4, use=vt220+cvis, use=cons25, teken-2022|teken as of 2022, am, bce, eo, mir, msgr, npc, NQ, cols#80, it#8, lines#25, ncv#21, U8#1, bold=\E[1m, cr=\r, cub1=^H, dim=\E[30;1m, ech=\E[%p1%dX, ind=\E[S, kent=\r, nel=\E[E, op=\E[x, rev=\E[7m, ri=\E[T, - rmso=\E[27m, rs2=\E[x\E[m\Ec, + rs2=\E[x\E[m\Ec, sgr=\E[0%?%p1%t;2;7%;%?%p3%t;7%;%?%p5%t;30;1%;%?%p6%t;1%;m, - sgr0=\E[m, use=vt220+cvis, use=ecma+index, - use=ansi+arrows, use=ansi+csr, use=ansi+cup, - use=ansi+erase, use=ansi+idc, use=ansi+idl, + sgr0=\E[m, use=ecma+standout, use=vt220+cvis, + use=ecma+index, use=ansi+arrows, use=ansi+csr, + use=ansi+cup, use=ansi+erase, use=ansi+idc, use=ansi+idl, use=ansi+local, use=ansi+rca2, use=ansi+sgrso, use=ansi+tabs, use=klone+color, teken-vt+fkeys|teken's xterm special keys, - kend=\E[F, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, - kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[15~, kf6=\E[17~, - kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[H, - use=vt220+pcedit, + kend=\E[F, khome=\E[H, use=vt100+pf1-pf4, + use=vt220+pcedit, use=xterm+r5+fkeys, teken-sc+fkeys|teken's syscons special keys, kdch1=^?, kend=\E[F, kf1=\E[M, kf10=\E[V, kf11=\E[W, @@ -2243,9 +2243,9 @@ oldpc3|oldibmpc3|old IBM PC BSD/386 console, OTbs, km, lines#25, - bel=^G, bold=\E[=15F, cr=\r, cud1=\n, dim=\E[=8F, dl1=\E[M, - ht=^I, il1=\E[L, ind=\n, kich1=\E[L, kll=\E[F, knp=\E[G, - kpp=\E[I, nel=\r\n, sgr0=\E[=R, use=ansi+arrows, + bel=^G, bold=\E[=15F, cr=\r, cud1=\n, dim=\E[=8F, ht=^I, + ind=\n, kich1=\E[L, kll=\E[F, knp=\E[G, kpp=\E[I, nel=\r\n, + sgr0=\E[=R, use=ansi+arrows, use=ansi+idl1, # Description of BSD/OS console emulator in version 1.1, 2.0, 2.1 # Note, the emulator supports many of the additional console features @@ -2266,14 +2266,13 @@ bsdos-pc-m|bsdos-pc-mono|BSD/OS PC console mono, OTbs, am, eo, km, xon, cols#80, it#8, lines#25, - bel=^G, clear=\Ec, cr=\r, cub1=^H, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, ed=\E[J, el=\E[K, home=\E[H, ht=^I, - ind=\n, kich1=\E[L, kll=\E[F, knp=\E[G, kpp=\E[I, nel=\r\n, - rc=\E8, sc=\E7, + bel=^G, clear=\Ec, cr=\r, cub1=^H, cud1=\n, ed=\E[J, el=\E[K, + ht=^I, ind=\n, kich1=\E[L, kll=\E[F, knp=\E[G, kpp=\E[I, + nel=\r\n, rc=\E8, sc=\E7, sgr=\E[0;10%?%p1%t;7%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7 %t;8%;%?%p9%t;11%;m%?%p5%t\E[=8F%;, - use=ansi+arrows, use=ansi+idl, use=ansi+local, - use=klone+sgr8, + use=ansi+arrows, use=ansi+cup, use=ansi+idl, + use=ansi+local, use=klone+sgr8, # Old names for BSD/OS PC console used in releases before 4.1. pc3|BSD/OS on the PC console, @@ -2438,9 +2437,10 @@ # support: vt100+keypad|DEC VT100 numeric keypad no fkeys, ka1=\EOq, ka3=\EOs, kb2=\EOr, kc1=\EOp, kc3=\EOn, +vt100+pf1-pf4|DEC VT100 PF1-PF4, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, vt100+pfkeys|DEC VT100 numeric keypad (kf1-kf4), - kent=\EOM, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, - use=vt100+keypad, + kent=\EOM, use=vt100+pf1-pf4, use=vt100+keypad, vt100+fnkeys|DEC VT100 numeric keypad (kf0-kf10), kf0=\EOy, kf10=\EOx, kf5=\EOt, kf6=\EOu, kf7=\EOv, kf8=\EOl, kf9=\EOw, use=vt100+pfkeys, @@ -2555,8 +2555,8 @@ # VT100 with no advanced video. vt100-nav|VT100 without advanced video option, xmc#1, - blink@, bold@, rev@, rmso=\E[m, rmul@, sgr@, sgr0@, smso=\E[7m, - smul@, use=vt100, + blink@, bold@, rev@, rmul@, sgr@, sgr0@, smul@, use=ansi+sgrso, + use=vt100, vt100-nav-w|vt100-w-nav|DEC VT100 132 cols 14 lines (no advanced video option), cols#132, lines#14, use=vt100-nav, @@ -2582,7 +2582,7 @@ # This entry (or vt102-nsgr) is probably the right thing to use for # these. vt102|DEC VT102, - dch1=\E[P, dl1=\E[M, il1=\E[L, rmir=\E[4l, smir=\E[4h, + dch1=\E[P, rmir=\E[4l, smir=\E[4h, use=ansi+idl1, use=vt100, vt102-w|DEC VT102 in wide mode, cols#132, @@ -2615,13 +2615,13 @@ cuf1=\E[C$<2/>, cup=\E[%i%p1%d;%p2%dH$<5/>, cuu1=\E[A$<2/>, ed=\E[J$<50/>, el=\E[K$<3/>, home=\E[H, ht=^I, is2=\E[1;24r\E[24;1H, kbs=^H, kcub1=\EOD, - kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, - kf3=\EOR, kf4=\EOS, nel=\r\n, rev=\E[7m$<2/>, ri=\EM$<5/>, - rmam=\E[?7h, rmkx=\E[?1l\E>, rmso=\E[m$<2/>, - rmul=\E[m$<2/>, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, nel=\r\n, + rev=\E[7m$<2/>, ri=\EM$<5/>, rmam=\E[?7h, rmkx=\E[?1l\E>, + rmso=\E[m$<2/>, rmul=\E[m$<2/>, rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sgr0=\E[m$<2/>, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7m$<2/>, smul=\E[4m$<2/>, use=ansi+csr, + use=vt100+pf1-pf4, # vt132 - like vt100 but slower and has ins/del line and such. # I'm told that / are backwards in the terminal from the @@ -2648,21 +2648,19 @@ bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, clear=\E[H\E[2J$<50>, cr=\r, cub1=^H, cup=\E[%i%p1%d;%p2%dH$<10>, dch1=\E[P, ed=\E[J$<50>, - el=\E[K$<3>, home=\E[H, ht=^I, - if=/usr/share/tabset/vt100, ind=\ED$<20/>, - is2=\E[1;24r\E[24;1H, kf1=\EOP, kf10=\E[29~, kf2=\EOQ, - kf3=\EOR, kf4=\EOS, kf5=\E[17~, kf6=\E[18~, kf7=\E[19~, - kf8=\E[20~, kf9=\E[21~, khome=\E[1~, kich1=\E[2~, - rev=\E[7m$<2>, rf=/usr/share/tabset/vt100, + el=\E[K$<3>, ht=^I, if=/usr/share/tabset/vt100, + ind=\ED$<20/>, is2=\E[1;24r\E[24;1H, kf10=\E[29~, + kf5=\E[17~, kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, kf9=\E[21~, + khome=\E[1~, rev=\E[7m$<2>, rf=/usr/share/tabset/vt100, ri=\EM$<14/>, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, - rmso=\E[27m, rmul=\E[24m, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%? %p9%t\E(0%e\E(B%;$<2>, sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, - smso=\E[7m, smul=\E[4m, use=ansi+arrows, use=ansi+csr, - use=ansi+idl1, use=ansi+local1, use=vt220+pcedit, - use=vt220+cvis, + smul=\E[4m, use=ecma+underline, use=ecma+standout, + use=ansi+arrows, use=ansi+csr, use=ansi+cup, + use=ansi+idl1, use=ansi+local1, use=ansi+sgrso, + use=vt100+pf1-pf4, use=vt220+pcedit, use=vt220+cvis, # Here's a picture of the Sun/PC editing keypad: # +--------+--------+--------+ @@ -2710,20 +2708,19 @@ enacs=\E)0, flash=\E[?5h$<200/>\E[?5l, ht=^I, hts=\EH, ich=\E[%p1%d@, if=/usr/share/tabset/vt100, ind=\ED, is2=\E[?7h\E[>\E[?1l\E F\E[?4l, kbs=^H, kcub1=\E[D, - kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf10=\E[21~, - kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, - kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\EOQ, - kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf6=\E[17~, kf7=\E[18~, - kf8=\E[19~, kf9=\E[20~, khlp=\E[28~, krdo=\E[29~, lf1=pf1, - lf2=pf2, lf3=pf3, lf4=pf4, nel=\EE, rev=\E[7m, ri=\EM, - rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, rmso=\E[27m, - rmul=\E[24m, rs1=\E[?3l, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf13=\E[25~, + kf14=\E[26~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf20=\E[34~, khlp=\E[28~, krdo=\E[29~, lf1=pf1, lf2=pf2, + lf3=pf3, lf4=pf4, nel=\EE, rev=\E[7m, ri=\EM, rmacs=\E(B$<4>, + rmam=\E[?7l, rmir=\E[4l, rs1=\E[?3l, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%? %p9%t\E(0%e\E(B%;$<2>, sgr0=\E[m\E(B, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, - smso=\E[7m, smul=\E[4m, tbc=\E[3g, use=ansi+csr, - use=ansi+cup, use=ansi+pp, use=ansi+enq, use=ansi+erase, - use=ansi+idl, use=ansi+local, use=vt220+vtedit, + smul=\E[4m, tbc=\E[3g, use=ecma+underline, + use=ecma+standout, use=ansi+csr, use=ansi+cup, + use=ansi+pp, use=ansi+enq, use=ansi+erase, use=ansi+idl, + use=ansi+local, use=vt100+pf1-pf4, use=vt220+vtedit, + use=vt220+ufkeys, vt220|vt200|DEC VT220, use=vt220+cvis, use=vt220-base, @@ -2745,20 +2742,20 @@ il=\233%p1%dL, il1=\233L, ind=\ED, is2=\233?7h\233>\233?1l\E F\233?4l, kbs=^H, kcub1=\233D, kcud1=\233B, kcuf1=\233C, kcuu1=\233A, - kdch1=\2333~, kf1=\EOP, kf10=\23321~, kf11=\23323~, - kf12=\23324~, kf13=\23325~, kf14=\23326~, kf17=\23331~, - kf18=\23332~, kf19=\23333~, kf2=\EOQ, kf20=\23334~, - kf3=\EOR, kf4=\EOS, kf6=\23317~, kf7=\23318~, kf8=\23319~, - kf9=\23320~, kfnd=\2331~, khlp=\23328~, khome=\233H, - kich1=\2332~, knp=\2336~, kpp=\2335~, krdo=\23329~, - kslt=\2334~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, mc0=\233i, - mc4=\2334i, mc5=\2335i, nel=\EE, rc=\E8, rev=\2337m, ri=\EM, - rmacs=\E(B, rmam=\233?7l, rmir=\2334l, rmso=\23327m, - rmul=\23324m, rs1=\233?3l, sc=\E7, + kdch1=\2333~, kf10=\23321~, kf11=\23323~, kf12=\23324~, + kf13=\23325~, kf14=\23326~, kf17=\23331~, kf18=\23332~, + kf19=\23333~, kf20=\23334~, kf6=\23317~, kf7=\23318~, + kf8=\23319~, kf9=\23320~, kfnd=\2331~, khlp=\23328~, + khome=\233H, kich1=\2332~, knp=\2336~, kpp=\2335~, + krdo=\23329~, kslt=\2334~, lf1=pf1, lf2=pf2, lf3=pf3, + lf4=pf4, mc0=\233i, mc4=\2334i, mc5=\2335i, nel=\EE, rc=\E8, + rev=\2337m, ri=\EM, rmacs=\E(B, rmam=\233?7l, rmir=\2334l, + rmso=\23327m, rmul=\23324m, rs1=\233?3l, sc=\E7, sgr=\2330%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m %?%p9%t\E(0%e\E(B%;$<2>, sgr0=\2330m\E(B, smacs=\E(0, smam=\233?7h, smir=\2334h, - smso=\2337m, smul=\2334m, tbc=\2333g, use=vt220+cvis8, + smso=\2337m, smul=\2334m, tbc=\2333g, use=vt100+pf1-pf4, + use=vt220+cvis8, # vt220d: # This VT220 description regards F6--F10 as the second block of function keys @@ -2768,10 +2765,17 @@ # See vt220 for an alternate mapping. # vt220d|DEC VT220 in VT100 mode with DEC function key labeling, - kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, - kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, - kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, kf5@, kf6=\E[17~, - kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, use=vt220-old, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf5@, kf6=\E[17~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, use=vt220+sfkeys, + use=vt220-old, + +# These are often mapped to unshifted/shifted keys on PC-keyboards -TD +vt220+ufkeys|first 8 function-keys for VT220, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf5@, kf6=\E[17~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, +vt220+sfkeys|second 8 function-keys for VT220, + kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, + kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, vt220-nam|v200-nam|VT220 in VT100 mode with no auto margins, am@, @@ -2796,18 +2800,18 @@ vt200-js|vt220-js|DEC VT200 series with jump scroll, am, msgr, cols#80, - bel=^G, cr=\r, cub1=^H, cud1=\n, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, - home=\E[H, ht=^I, il1=\E[L, ind=\ED, + bel=^G, cr=\r, cub1=^H, cud1=\n, cuf1=\E[C, cuu1=\E[A, + dch1=\E[P, ht=^I, ind=\ED, is2=\E[61"p\E[H\E[?3l\E[?4l\E[?1h\E[?5l\E[?6l\E[?7h\E[?8h\E[ ?25h\E>\E[m, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, - kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=\r\ED, - rf=/usr/share/tabset/vt100, ri=\EM, rmdc=, rmir=\E[4l, - rmkx=\E[?1l\E>, rmso=\E[27m$<5/>, rmul=\E[24m, + nel=\r\ED, rf=/usr/share/tabset/vt100, ri=\EM, rmdc=, + rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m$<5/>, rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, smdc=, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m$<5/>, smul=\E[4m, - use=ansi+csr, use=ansi+erase, use=vt220+cvis, + use=ecma+underline, use=ansi+csr, use=ansi+cup, + use=ansi+erase, use=ansi+idl1, use=vt100+pf1-pf4, + use=vt220+cvis, # This was DEC's VT320. Use the purpose-built one below instead #vt320|DEC VT320 in VT100 emulation mode, @@ -2838,27 +2842,23 @@ cols#80, lines#24, wsl#80, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cr=\r, - cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, - dch1=\E[P, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, - home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ind=\ED, + cub1=^H, cud1=\n, dch=\E[%p1%dP, dch1=\E[P, ech=\E[%p1%dX, + el1=\E[1K, ht=^I, hts=\EH, ich=\E[%p1%d@, ind=\ED, is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, - kbs=^?, kdch1=\E[3~, kel=\E[4~, kf10=\E[21~, kf11=\E[23~, - kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, - kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, - kf20=\E[34~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, - kf9=\E[20~, khome=\E[1~, kich1=\E[2~, knp=\E[6~, knxt=^I, - kpp=\E[5~, kprv=\E[Z, kslt=\E[4~, nel=\EE, rev=\E[7m, + kbs=^?, kdch1=\E[3~, kel=\E[4~, kf12=\E[24~, khome=\E[1~, + kich1=\E[2~, knp=\E[6~, knxt=^I, kpp=\E[5~, kprv=\E[Z, + kslt=\E[4~, nel=\EE, rev=\E[7m, rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B, - rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, - rmul=\E[m, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%? %p9%t\E(0%e\E(B%;$<2>, sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smir=\E[4h, - smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, - use=ansi+apparrows, use=ansi+csr, use=ansi+enq, - use=ansi+idl, use=ansi+local, use=dec+pp, use=vt220+cvis, - use=vt220+keypad, use=dec+sl, + smkx=\E[?1h\E=, tbc=\E[3g, use=ansi+apparrows, + use=ansi+csr, use=ansi+cup, use=ansi+enq, use=ansi+erase, + use=ansi+idl, use=ansi+local, use=ansi+sgrso, + use=ansi+sgrul, use=dec+pp, use=dec+sl, use=vt220+cvis, + use=vt220+keypad, use=vt220+sfkeys, use=vt220+ufkeys, vt320-nam|vt300-nam|DEC VT320 7 bit terminal with no am to make SAS happy, am@, @@ -2899,25 +2899,24 @@ cols#80, it#8, lines#24, vt#3, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, blink=\E[5m, bold=\E[1m, cr=\r, cub1=^H, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, - dsl=\E[2$~\r\E[1$}\E[K\E[$}, - flash=\E[?5h$<200/>\E[?5l, fsl=\E[$}, home=\E[H, ht=^I, - hts=\EH, ich=\E[%p1%d@, ind=\ED, + dch=\E[%p1%dP, dch1=\E[P, dsl=\E[2$~\r\E[1$}\E[K\E[$}, + flash=\E[?5h$<200/>\E[?5l, fsl=\E[$}, ht=^I, hts=\EH, + ich=\E[%p1%d@, ind=\ED, is2=\E<\E\sF\E>\E[?1h\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r \E[24;1H, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, - kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, - kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, lf2=pf2, - lf3=pf3, lf4=pf4, nel=\r\ED, rev=\E[7m, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, + lf2=pf2, lf3=pf3, lf4=pf4, nel=\r\ED, rev=\E[7m, rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B, - rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, - rmul=\E[24m, rs1=\E[?3l, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rs1=\E[?3l, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%? %p9%t\E(0%e\E(B%;$<2>, sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smir=\E[4h, - smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, - tsl=\E[2$~\E[1$}\E[1;%dH, use=ansi+csr, use=ansi+erase, - use=ansi+idl, use=ansi+local, use=vt220+cvis, + smkx=\E[?1h\E=, smul=\E[4m, tbc=\E[3g, + tsl=\E[2$~\E[1$}\E[1;%dH, use=ecma+underline, + use=ecma+standout, use=ansi+csr, use=ansi+cup, + use=ansi+erase, use=ansi+idl, use=ansi+local, + use=vt100+pf1-pf4, use=vt220+cvis, # Left/right margins are supported in xterm since patch #279 (2012/05/10) vt420+lrmm|VT420 left/right margins, @@ -2947,7 +2946,7 @@ # (vt400: string capability ":sb=\E[M:" corrected to ":sr=\E[M:"; # also, added / based on the init string -- esr) vt400|vt400-24|dec-vt400|DEC VT400 24x80 column autowrap, - am, eslok, mir, msgr, xenl, xon, + am, mir, msgr, xenl, xon, cols#80, it#8, lines#24, vt#3, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J$<10/>, cr=\r, @@ -2957,18 +2956,17 @@ is2=\E<\E\sF\E>\E[?1h\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r \E[24;1H, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, - kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, - kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, lf2=pf2, - lf3=pf3, lf4=pf4, nel=\r\ED, rev=\E[7m, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, + lf2=pf2, lf3=pf3, lf4=pf4, nel=\r\ED, rev=\E[7m, rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B, - rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, - rs1=\E<\E[?3l\E[!p\E[?7h, + rmam=\E[?7l, rmkx=\E[?1l\E>, rs1=\E<\E[?3l\E[!p\E[?7h, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%? %p9%t\E(0%e\E(B%;$<2>, sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smkx=\E[?1h\E=, - smso=\E[7m, smul=\E[4m, tbc=\E[3g, - tsl=\E[2$~\E[1$}\E[1;%dH, use=ansi+csr, use=ansi+cup, - use=ansi+idc, use=ansi+idl, use=ansi+local, use=dec+sl, + smul=\E[4m, tbc=\E[3g, tsl=\E[2$~\E[1$}\E[1;%dH, + use=ecma+underline, use=ecma+standout, use=ansi+csr, + use=ansi+cup, use=ansi+idc, use=ansi+idl, use=ansi+local, + use=ansi+sgrso, use=dec+sl, use=vt100+pf1-pf4, use=vt220+cvis, # (vt420: I removed , it collided with . I also restored @@ -2986,19 +2984,20 @@ hts=\EH, ich=\E[%p1%d@, if=/usr/share/tabset/vt300, ind=\ED, is2=\E[1;24r\E[24;1H, is3=\E[?67h\E[64;1"p, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, - kf1=\EOP, kf10=\E[29~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, - kf5=\E[17~, kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, kf9=\E[21~, - nel=\EE, rev=\E[7m$<2>, rf=/usr/share/tabset/vt300, - ri=\EM, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, + kf10=\E[29~, kf5=\E[17~, kf6=\E[18~, kf7=\E[19~, + kf8=\E[20~, kf9=\E[21~, nel=\EE, rev=\E[7m$<2>, + rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B$<4>, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, - rmso=\E[27m, rmul=\E[24m, rs3=\E[?67h\E[64;1"p, + rs3=\E[?67h\E[64;1"p, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%? %p9%t\E(0%e\E(B%;$<2>, sgr0=\E[m\E(B$<2>, smacs=\E(0$<2>, smam=\E[?7h, - smir=\E[4h, smkx=\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, - use=ansi+csr, use=ansi+enq, use=ansi+idl, use=ansi+pp, - use=ansi+local, use=dec+sl, use=vt220+cvis, - use=vt420+lrmm, use=vt220+vtedit, + smir=\E[4h, smkx=\E=, tbc=\E[3g, use=ecma+underline, + use=ecma+standout, use=ansi+csr, use=ansi+enq, + use=ansi+idl, use=ansi+pp, use=ansi+local, use=dec+sl, + use=vt100+pf1-pf4, use=vt220+cvis, use=vt420+lrmm, + use=vt220+vtedit, # DEC VT220 and up support DECUDK (user-defined keys). DECUDK (i.e., pfx) # takes two parameters, the key and the string. Translating the key is @@ -3017,24 +3016,24 @@ # application has to know it. # vt420pc|DEC VT420 w/PC keyboard, - kdch1=^?, kend=\E[4~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, + kdch1=^?, kend=\E[4~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[11;2~, kf14=\E[12;2~, kf15=\E[13;2~, kf16=\E[14;2~, kf17=\E[15;2~, kf18=\E[17;2~, - kf19=\E[18;2~, kf2=\E[12~, kf20=\E[19;2~, kf21=\E[20;2~, + kf19=\E[18;2~, kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~, kf25=\E[23~, kf26=\E[24~, kf27=\E[25~, kf28=\E[26~, kf29=\E[28~, - kf3=\E[13~, kf30=\E[29~, kf31=\E[31~, kf32=\E[32~, - kf33=\E[33~, kf34=\E[34~, kf35=\E[35~, kf36=\E[36~, - kf37=\E[23;2~, kf38=\E[24;2~, kf39=\E[25;2~, kf4=\E[14~, - kf40=\E[26;2~, kf41=\E[28;2~, kf42=\E[29;2~, - kf43=\E[31;2~, kf44=\E[32;2~, kf45=\E[33;2~, - kf46=\E[34;2~, kf47=\E[35;2~, kf48=\E[36;2~, kf5=\E[15~, - kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[H, + kf30=\E[29~, kf31=\E[31~, kf32=\E[32~, kf33=\E[33~, + kf34=\E[34~, kf35=\E[35~, kf36=\E[36~, kf37=\E[23;2~, + kf38=\E[24;2~, kf39=\E[25;2~, kf40=\E[26;2~, + kf41=\E[28;2~, kf42=\E[29;2~, kf43=\E[31;2~, + kf44=\E[32;2~, kf45=\E[33;2~, kf46=\E[34;2~, + kf47=\E[35;2~, kf48=\E[36;2~, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, khome=\E[H, pctrm=USR_TERM:vt420pcdos:, pfx=\EP1;1|%?%{16}%p1%>%t%{0}%e%{21}%p1%>%t%{1}%e%{25}%p1%> %t%{2}%e%{27}%p1%>%t%{3}%e%{30}%p1%>%t%{4}%e%{5}%;%p1%+ %d/%p2%s\E\\, - use=vt420, + use=xterm+r5+lockeys, use=vt420, vt420pcdos|DEC VT420 w/PC for DOS Merge, lines#25, @@ -3045,12 +3044,8 @@ sgr0=\E[m, smsc=\E[?1;2r\E[34h, use=vt420pc, vt420f|DEC VT420 with VT kbd; VT400 mode; F1-F5 used as Fkeys, - kdch1=^?, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, - kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, - kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, - kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, - kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, - khome=\E[H, lf1=\EOP, lf2=\EOQ, lf3=\EOR, lf4=\EOS, + kdch1=^?, kf10=\E[21~, khome=\E[H, lf1=\EOP, lf2=\EOQ, + lf3=\EOR, lf4=\EOS, use=vt220+sfkeys, use=xterm+r5+fkeys, use=vt420, vt510|DEC VT510, @@ -3076,9 +3071,20 @@ vt520|DEC VT520, use=ansi+rca, use=vt420, use=ansi+tabs, +vt520-w|DEC VT520 in wide mode, + cols#132, use=vt520, + +# See "4.7.5 Visual Attributes Control Functions" and +# "Table 5-15 (Cont.) Visual Character Attribute Values" +# in EK-VT520-RM vt525|DEC VT525, + colors#8, pairs#64, + op=\E[39;49m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=vt520, +vt525-w|DEC VT525 in wide mode, + cols#132, use=vt525, + # I just got a brand new Boundless VT520 with that company's "ANSI 2011" # Keyboard, which replaces the old LK41R-AA keyboard. # @@ -3125,10 +3131,9 @@ # The missing "=" in smkx is not a typo (here), but an error in tkterm. tt|tkterm|Don Libes' tk text widget terminal emulator, clear=\E[H\E[J, cr=\r, cub1=^H, cud1=\n, cuf1=\E[C, - cup=\E[%p1%d;%p2%dH, cuu1=\E[A, ind=\n, kf1=\EOP, kf2=\EOQ, - kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, - kf9=\EOX, rmkx=\E[?1l\E>, rmso=\E[m, smkx=\E[?1h\E, - smso=\E[7m, + cup=\E[%p1%d;%p2%dH, cuu1=\E[A, ind=\n, kf5=\EOT, kf6=\EOU, + kf7=\EOV, kf8=\EOW, kf9=\EOX, rmkx=\E[?1l\E>, + smkx=\E[?1h\E, use=ansi+sgrso, use=vt100+pf1-pf4, ######## APPLE @@ -3228,7 +3233,7 @@ # my faulty memory, and the following online sources and references: # # [1] "Three Scotts and a Duane" by Simson L. Garfinkel -# http://www.nextcomputers.org/NeXTfiles/Articles/NeXTWORLD/93.8/93.8.Dec.Community1.html +# https://web.archive.org/web/20121019083801/http://www.nextcomputers.org/NeXTfiles/Articles/NeXTWORLD/93.8/93.8.Dec.Community1.html # # [2] NeXTSTEP entry from Wikipedia, the free encyclopedia # https://secure.wikimedia.org/wikipedia/en/wiki/Nextstep @@ -3457,14 +3462,11 @@ # vt52, vt100, vt102 and xterm. nsterm-16color|AppKit Terminal.app v240.2+ with Mac OS X version 10.5, bw@, mir, npc, - flash=\E[?5h$<200/>\E[?5l, hpa=\E[%i%p1%dG, - kdch1=\E[3~, kend=\E[F, kf10=\E[21~, kf11=\E[23~, - kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, - kf16=\E[29~, kf17=\E[31~, kf18=\E[22~, kf19=\E[33~, - kf20=\E[34~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, - kf8=\E[19~, kf9=\E[20~, khome=\E[H, knp=\E[6~, kpp=\E[5~, - vpa=\E[%i%p1%dd, kLFT5=\E[5D, kRIT5=\E[5C, use=ansi+idc, - use=xterm+alt47, use=nsterm-c-s-acs, use=vt220+cvis, + flash=\E[?5h$<200/>\E[?5l, kdch1=\E[3~, kend=\E[F, + kf18=\E[22~, kf5=\E[15~, khome=\E[H, knp=\E[6~, kpp=\E[5~, + kLFT5=\E[5D, kRIT5=\E[5C, use=ansi+idc, use=ansi+rca2, + use=vt220+cvis, use=vt220+sfkeys, use=vt220+ufkeys, + use=xterm+alt47, use=nsterm-c-s-acs, # The versions of Terminal.app in Mac OS X version 10.3.x seem to have # the background color erase feature. The newer version 240.2 in Mac OS X @@ -3525,7 +3527,8 @@ # Earlier reports state that these differences also apply to OS X 10.7 (Lion), # TERM_PROGRAM_VERSION=303 nsterm-build309|Terminal.app in OS X 10.8, - use=xterm+256setaf, use=nsterm-bce, + use=bracketed+paste, use=xterm+256setaf, + use=nsterm-bce, # removed bogus kDC7 -TD nsterm-build326|Terminal.app in OS X 10.9, @@ -3585,8 +3588,9 @@ # # Improved rmso/rmul -TD nsterm-build400|Terminal.app in OS X 10.13, - rmso=\E[27m, rmul=\E[24m, use=xterm+sm+1006, - use=ecma+italics, use=nsterm-build361, + use=ecma+underline, use=ecma+standout, + use=xterm+sm+1006, use=ecma+italics, + use=nsterm-build361, nsterm-build440|Terminal.app in MacOS 11.6.8, use=xterm+alt1049, use=nsterm-build400, @@ -3636,29 +3640,79 @@ wsl#50, blink=\E[5m, bold=\E[1m, cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, el1=\E[1K, - flash=\E[?5h$<200/>\E[?5l, hpa=\E[%i%p1%dG, - kLFT=\E[1;2D, kRIT=\E[1;2C, kbs=^?, kcbt=\E[Z, kdch1=\E[3~, - kend=\EOF, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, - kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, - knp=\E[6~, kpp=\E[5~, op=\E[0m, rev=\E[7m, ri=\EM, - rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + flash=\E[?5h$<200/>\E[?5l, kLFT=\E[1;2D, kRIT=\E[1;2C, + kbs=^?, kcbt=\E[Z, kdch1=\E[3~, kend=\EOF, knp=\E[6~, + kpp=\E[5~, op=\E[0m, rev=\E[7m, ri=\EM, rmam=\E[?7l, + rmkx=\E[?1l\E>, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%? %p9%t\016%e\017%;, - sgr0=\E[m\017, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7m, - smul=\E[4m, vpa=\E[%i%p1%dd, kEND5=\E[1;5F, - kHOM5=\E[1;5H, use=ansi+apparrows, use=ansi+csr, - use=ansi+enq, use=ansi+erase, use=ansi+idc, use=ansi+idl, - use=ansi+local, use=vt100+4bsd, use=vt100+keypad, - use=vt100+pfkeys, use=xterm+alt47, use=xterm+sl-twm, - use=xterm+x11mouse, use=xterm+256setaf, use=vt220+cvis, + sgr0=\E[m\017, smam=\E[?7h, smkx=\E[?1h\E=, + kEND5=\E[1;5F, kHOM5=\E[1;5H, use=ansi+apparrows, + use=ansi+csr, use=ansi+enq, use=ansi+erase, use=ansi+idc, + use=ansi+idl, use=ansi+local, use=ansi+rca2, + use=ansi+sgrso, use=ansi+sgrul, use=vt100+4bsd, + use=vt100+keypad, use=vt100+pfkeys, use=xterm+r5+fkeys, + use=xterm+alt47, use=xterm+sl-twm, use=xterm+x11mouse, + use=xterm+256setaf, use=vt220+cvis, -# iTerm2 3.0.15 +# iTerm2 # # https://iterm2.com/ # https://github.com/gnachman/iTerm2 # ~/Library/Preferences/com.googlecode.iterm2.plist # "iTerm" stalled in 2009. A different set of developers began "iTerm2". # +# iTerm2 3.5.0 +# +# NOTES: +# with esctest: +# 365 tests passed, 196 known bugs, 2 tests fail intermittently +# the known bugs include several of the cursor-movement tests +# the ED, EL tests include those failing intermittently +# DECCOLM, DECERA, DECSED, DECSERA and SPA do not work +# most of the DECRPM, DECRQSS reports fail +# with vttest: +# reports primary DA as VT420 +# VT420 rectangular operations, as well as DECBI/DEVFI work with margins +# SRM does not work +# DECSED, and SPA do not work +# REP and SD work, SL/SR/SU do not work +# with tack: +# status-line does not work +# +# The default settings have blinking-text and keypad-application mode disabled. +# Enabling the latter make it half-working (numlock sends an escape character). +# About half of the modified function-keys are untestable due to preassigned +# features. +# +# iTerm2 3.5.0 comes with a 4-year-old copy of xterm's terminfo (June 2020), +# which is modified, using the ncurses TERMINFO_DIRS variable to substitute +# this locally: +# + xterm-nrc and xterm+pcfN are removed +# + the developer made changes to adapt it to the 16-year-old version of +# ncurses bundled with MacOS, i.e., changing the mouse protocol to the +# legacy X11 format and reducing the number of colors to 32k (in more than +# one place). In the former case, the developer was confused about why that +# was necessary. In the latter, the developer clearly misunderstood how the +# tools work. +# + vt420+lrmm is modified, removing smglr and corrupting mgc (again, developer +# confusion). +# + the developer added a couple of features, misnaming them as "xterm" blocks: +# + a copy of kitty+setal renamed to xterm+setulc (and Setulc) is added, but +# the feature is first mentioned in iTerm2 changes in May 2020, while +# it is first mention in kitty changes in December 2016. +# + Smulx is added +# +# iTerm2 3.4.0 +# +# NOTES: +# with esctest: +# 293 tests pass, 270 tests fail +# with tack: +# minor improvements which do not alter the terminfo +# +# iTerm2 3.0.15 +# # NOTES: # with vttest: # reports primary DA as VT100 with AVO: \E[?1;2c @@ -3692,21 +3746,24 @@ kf19=\E[18;2~, kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~, kind=\E[1;2B, kri=\E[1;2A, nel=\EE, op=\E[39;49m, - rmso=\E[27m, rmul=\E[24m, rs2=\E[!p\E[?3;4l\E[4l\E>\E[?1000l, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%? %p5%t;2%;m%?%p9%t\016%e\017%;, - kDN3=\E\E[B, kDN4=\E[1;10B, kDN5=\E[1;5B, kDN6=\E[1;6B, - kEND3=\E[1;9F, kEND4=\E[1;10F, kEND6=\E[1;6F, - kEND7=\E[1;13F, kEND8=\E[1;14F, kHOM3=\E[1;9H, - kHOM4=\E[1;10H, kHOM6=\E[1;6H, kHOM7=\E[1;13H, - kHOM8=\E[1;14H, kLFT3=\E\E[D, kLFT4=\E[1;10D, - kLFT5=\E[1;5D, kLFT6=\E[1;6D, kNXT3=\E\E[6~, - kPRV3=\E\E[5~, kRIT3=\E\E[C, kRIT4=\E[1;10C, - kRIT5=\E[1;5C, kRIT6=\E[1;6C, kUP3=\E\E[A, kUP4=\E[1;10A, - kUP5=\E[1;5A, kUP6=\E[1;6A, use=ecma+index, + Smulx=\E[4:%p1%dm, kDN3=\E\E[B, kDN4=\E[1;10B, + kDN5=\E[1;5B, kDN6=\E[1;6B, kEND3=\E[1;9F, + kEND4=\E[1;10F, kEND6=\E[1;6F, kEND7=\E[1;13F, + kEND8=\E[1;14F, kHOM3=\E[1;9H, kHOM4=\E[1;10H, + kHOM6=\E[1;6H, kHOM7=\E[1;13H, kHOM8=\E[1;14H, + kLFT3=\E\E[D, kLFT4=\E[1;10D, kLFT5=\E[1;5D, + kLFT6=\E[1;6D, kNXT3=\E\E[6~, kPRV3=\E\E[5~, + kRIT3=\E\E[C, kRIT4=\E[1;10C, kRIT5=\E[1;5C, + kRIT6=\E[1;6C, kUP3=\E\E[A, kUP4=\E[1;10A, kUP5=\E[1;5A, + kUP6=\E[1;6A, rv=\E\\[>64;[1-6][0-9];0c, smxx=\E[9m, + xr=\EP>\\|iTerm2 ([1-9][.0-9])\E\\\\, + use=ecma+underline, use=ecma+standout, use=ecma+index, + use=report+version, use=report+da2, use=xterm+alt+title, use=ecma+italics, use=iterm, - use=bracketed+paste, + use=bracketed+paste, use=kitty+setal, # xnuppc - Darwin PowerPC Console (a.k.a. "darwin") # @@ -3806,15 +3863,15 @@ xnuppc+basic|Darwin PowerPC console basic capabilities, am, bce, mir, xenl, NQ, it#8, - bold=\E[1m, cr=\r, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, - dsl=\E]2;\007, el1=\E[1K, home=\E[H, ht=^I, hts=\EH, ind=\n, - kbs=^?, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, - rev=\E[7m, ri=\EM, rmam=\E[?7l, rmkx=\E[?1l\E>, + bold=\E[1m, cr=\r, dsl=\E]2;\007, el1=\E[1K, ht=^I, hts=\EH, + ind=\n, kbs=^?, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, + kcuu1=\EOA, rev=\E[7m, ri=\EM, rmam=\E[?7l, rmkx=\E[?1l\E>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m, sgr0=\E[m, smam=\E[?7h, smkx=\E[?1h\E=, tbc=\E[3g, - use=ansi+csr, use=ansi+erase, use=ansi+local, - use=ansi+sgrso, use=ansi+sgrul, use=vt100+keypad, + use=ansi+csr, use=ansi+cup, use=ansi+erase, + use=ansi+local, use=ansi+sgrso, use=ansi+sgrul, + use=vt100+keypad, xnuppc+c|Darwin PowerPC console ANSI color support, ncv#32, use=klone+color, @@ -3993,7 +4050,7 @@ # TN3270, TVI910, TVI925, Wyse 50/60, and ANSI. # Changes: # Added ANSI sc/rc and REP in 2019/12/17 -# Added TVI910/ TVI925 in 2019/11/20 +# Added TVI910/ TVI925 in 2019/11/20 # # Default: # Emulate "Xterm", using "ANSI with 256color" @@ -4058,8 +4115,8 @@ # TERM=xterm # # vttest: -# DA1: \E[?62;1;2;6;7;8;9;15;22c (VT200 with DRCS, UDK, NRCS) -# DA2: \E[>1;10;0c +# DA1: \E[?62;1;2;6;7;8;9;15;22c (VT200 with DRCS, UDK, NRCS) +# DA2: \E[>1;10;0c # However: # + NRCS tests do not work # + DECUDK test fails @@ -4151,8 +4208,8 @@ am, bce, bw, ccc, mir, msgr, xenl, xon, XT, it#8, ncv#22, U8#1, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, cr=\r, cub1=^H, cud1=\ED, cup=\E[%i%p1%d;%p2%dH, - cuu1=\EM, dch=\E[%p1%dP, dch1=\E[P, + bel=^G, cr=\r, cub1=^H, cud1=\ED, cuu1=\EM, dch=\E[%p1%dP, + dch1=\E[P, dispc=%?%p1%{8}%=%t\E%%G\342\227\230\E%%@%e%p1%{10}%=%t\E%%G \342\227\231\E%%@%e%p1%{12}%=%t\E%%G\342\231\0\E%%@%e %p1%{13}%=%t\E%%G\342\231\252\E%%@%e%p1%{14}%=%t\E%%G @@ -4160,26 +4217,26 @@ %e%p1%{27}%=%t\E%%G\342\206\220\E%%@%e%p1%{155}%=%t\E %%G\340\202\242\E%%@%e%p1%c%;, ech=\E[%p1%dX, el1=\E[1K, enacs=\E(B\E)0, - flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG, - ind=\n, + flash=\E[?5h$<100/>\E[?5l, ind=\n, initc=\E]P%p1%x%p2%{255}%*%{1000}%/%02x%p3%{255}%*%{1000}%/ %02x%p4%{255}%*%{1000}%/%02x, is2=\E7\E[r\E[m\E[?7h\E[?1;4;6l\E[4l\E8\E>\E]R, kbs=^?, kcbt=\E[Z, khome=\E[1~, kind=\E[B, kri=\E[A, kspd=^Z, nel=\r\n, oc=\E]R, op=\E[39;49m, ri=\EM, rmacs=^O, - rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, - rmul=\E[24m, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rs2=\E<\E["p\E[50;6"p\Ec\E[?3l\E]R\E[?1000l, s0ds=\E[10m, s1ds=\E[11m, s2ds=\E[12m, sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 %;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, - smkx=\E[?1h\E=, vpa=\E[%i%p1%dd, E3=\E[3J, - use=ansi+apparrows, use=ansi+csr, use=ansi+erase, - use=ansi+idl, use=ansi+local, use=ansi+tabs, - use=ansi+rep, use=bracketed+paste, use=ecma+index, - use=ecma+strikeout, use=klone+color, use=klone+sgr, - use=putty+cursor, use=putty+fnkeys, use=vt220+pcedit, + smkx=\E[?1h\E=, E3=\E[3J, rv=\E\\[>0;136;0c, + use=ecma+underline, use=ecma+standout, + use=ansi+apparrows, use=ansi+csr, use=ansi+cup, + use=ansi+erase, use=ansi+idl, use=ansi+local, + use=ansi+tabs, use=ansi+rep, use=bracketed+paste, + use=ecma+index, use=ansi+rca2, use=ecma+strikeout, + use=klone+color, use=klone+sgr, use=putty+cursor, + use=putty+fnkeys, use=report+da2, use=vt220+pcedit, use=xterm+alt1049, use=vt102+enq, use=xterm+sm+1006, use=xterm+sl, use=vt100+fnkeys, use=putty+keypad, use=vt220+cvis, @@ -4226,19 +4283,14 @@ use=putty+fnkeys+esc, putty+fnkeys+esc|ESC[n~ fn-keys for PuTTY, - kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, - kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, - kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, - kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, - kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + use=vt220+sfkeys, use=xterm+r5+fkeys, putty+fnkeys+linux|Linux fn-keys for PuTTY, kf1=\E[[A, kf2=\E[[B, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, use=putty+fnkeys+esc, putty+fnkeys+xterm|Xterm R6 fn-keys for PuTTY, - kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, - use=putty+fnkeys+esc, + use=vt100+pf1-pf4, use=putty+fnkeys+esc, putty+fnkeys+vt400|VT400 fn-keys for PuTTY, use=putty+fnkeys+esc, @@ -4246,9 +4298,9 @@ # Shifted F1 is F11. F13-F20 inherit from the defaults, and the last distinct # key is F20. putty+fnkeys+vt100|VT100+ fn-keys for PuTTY, - kf1=\EOP, kf10=\EOY, kf11=\EOZ, kf12=\EO[, kf2=\EOQ, - kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, - kf9=\EOX, use=putty+fnkeys+esc, + kf10=\EOY, kf11=\EOZ, kf12=\EO[, kf5=\EOT, kf6=\EOU, + kf7=\EOV, kf8=\EOW, kf9=\EOX, use=vt100+pf1-pf4, + use=putty+fnkeys+esc, # Unlike xterm-sco, this leaves kmous ambiguous with kf1. # @@ -4259,8 +4311,7 @@ # F37-F48 - control/shift # putty+fnkeys+sco|SCO fn-keys for PuTTY, - kbeg=\E[E, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, - kdch1=^?, kend=\E[F, kf1=\E[M, kf10=\E[V, kf11=\E[W, + kbeg=\E[E, kdch1=^?, kf1=\E[M, kf10=\E[V, kf11=\E[W, kf12=\E[X, kf13=\E[Y, kf14=\E[Z, kf15=\E[a, kf16=\E[b, kf17=\E[c, kf18=\E[d, kf19=\E[e, kf2=\E[N, kf20=\E[f, kf21=\E[g, kf22=\E[h, kf23=\E[i, kf24=\E[j, kf25=\E[k, @@ -4269,8 +4320,8 @@ kf35=\E[u, kf36=\E[v, kf37=\E[w, kf38=\E[x, kf39=\E[y, kf4=\E[P, kf40=\E[z, kf41=\E[@, kf42=\E[[, kf43=\E[\\, kf44=\E[], kf45=\E[\^, kf46=\E[_, kf47=\E[`, kf48=\E[{, - kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H, - kich1=\E[L, knp=\E[G, kpp=\E[I, + kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, kich1=\E[L, + knp=\E[G, kpp=\E[I, use=vt100+noapp, #### mintty # https://github.com/mintty/mintty @@ -4312,11 +4363,16 @@ rsupm=\E[75m, smm@, smpch=\E[11m, sshm=\E[1:2m, ssubm=\E[74m, ssupm=\E[73m, Rmol=\E[55m, Smol=\E[53m, Smulx=\E[4:%p1%dm, blink2=\E[6m, norm=\E[22m, - opaq=\E[28m, smul2=\E[21m, use=linux+kbs, use=ansi+rep, - use=ecma+strikeout, use=ecma+index, use=vt420+lrmm, - use=xterm+focus, use=xterm+sm+1006, use=xterm+pcfkeys, - use=xterm+tmux, use=ecma+italics, use=xterm-basic, - use=bracketed+paste, use=report+version, + opaq=\E[28m, rv=\E\\[>77;[0-9];0c, smul2=\E[21m, + xr=\EP>\\|mintty ([1-9][.0-9]+)\E\\\\, use=linux+kbs, + use=ansi+rep, use=ecma+strikeout, use=ecma+index, + use=mintty+keypad, use=vt420+lrmm, use=xterm+focus, + use=xterm+sm+1006, use=xterm+pcfkeys, use=xterm+tmux, + use=ecma+italics, use=xterm-basic, use=bracketed+paste, + use=report+version, +mintty+keypad|mintty special numeric keypad, + kbeg=\EOE, kpADD=\EOk, kpDIV=\EOo, kpMUL=\EOj, kpSUB=\EOm, + # 2019-06-09: These capabilities are commented-out for compatibility with # existing releases 5.9-6.1, and may be considered for inclusion after the # release of ncurses 6.2: @@ -4377,7 +4433,7 @@ # "resize -s"), though it does not pass SIGWINCH to the application if the # user resizes the window with the mouse. teraterm2.3|Tera Term Pro 2.3, - km, + km, npc, ncv#43, vt@, acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i \316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u @@ -4385,16 +4441,13 @@ blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, - flash=\E[?5h$<200/>\E[?5l, hpa=\E[%i%p1%dG, kf1=\E[11~, - kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, - kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, - kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, - kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, - kf8=\E[19~, kf9=\E[20~, op=\E[100m, rev=\E[7m, ri=\EM, - rmso=\E[27m, rmul=\E[24m, sgr0=\E[0m\017, smso=\E[7m, - smul=\E[4m, vpa=\E[%i%p1%dd, use=ansi+idl, - use=vt220+vtedit, use=vt100+enq, use=klone+color, - use=vt100, use=vt220+cvis, + flash=\E[?5h$<100/>\E[?5l, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, + kf9=\E[20~, op=\E[100m, rev=\E[7m, ri=\EM, sgr0=\E[0m\017, + smul=\E[4m, use=ecma+underline, use=ecma+standout, + use=ansi+idl, use=ansi+rca2, use=vt100+enq, + use=klone+color, use=vt220+cvis, use=vt220+vtedit, + use=vt220+sfkeys, use=xterm+r5+lockeys, use=vt100, # Version 4.59 has regular VT100 line-drawing (so it is no longer necessary # to choose a Windows OEM font). @@ -4409,7 +4462,7 @@ # - it recognizes the dtterm window controls for reporting size in # characters and pixels. # - it passes SIGWINCH. -teraterm4.59|Tera Term Pro 4.59, +teraterm4.59|Tera Term 4.59, bce, xenl@, ncv#41, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, @@ -4439,13 +4492,48 @@ # + recognizes xterm's original direct-colors sequences, but result is # poor. # + no UTF-8 apparent when UTF-8 is set, with font Lucida Control -teraterm4.97|Tera Term Pro 4.97, +teraterm4.97|Tera Term 4.97, XT, use=ecma+color, use=xterm+sm+1006, use=teraterm4.59, teraterm-256color|TeraTerm with xterm 256-colors, use=xterm+256setaf, use=teraterm, +teraterm5.0|Tera Term 5.0, + xenl, + rv=\E\\[>32;331;0c, use=bracketed+paste, use=dec+sl, + use=xterm+keypad, use=report+da2, use=teraterm4.97, teraterm|Tera Term, - use=teraterm4.97, + use=teraterm5.0, + +#### RLogin +# RLogin 2.30.4 +# https://github.com/kmiya-culti/RLogin +rlogin-color, + OTbs, OTpt, am, bce, km, mir, msgr, npc, xenl, + OTkn#12, colors#0x100, cols#80, lines#24, pairs#0x10000, + OTrs=\E[!p\E[?3;4l\E[4l\E>\E]104\007, bel=^G, + bold=\E[1m, civis=\E[?25l, clear=\E[H\E[2J, + cnorm=\E[?25h, cr=\r, csr=\E[%i%p1%d;%p2%dr, cub1=^H, + cud1=\n, dch=\E[%p1%dP, dch1=\E[P, ech=\E[%p1%dX, ed=\E[J, + el=\E[K, el1=\E[1K, flash=\E[?5h$<100/>\E[?5l, + ich=\E[%p1%d@, ind=\n, + is2=\E[!p\E[?3;4l\E[4l\E>\E]104\007, kbeg=\EOE, + kcbt=\E[Z, kend=\EOF, kf5=\E[15~, kll=\EOF, kmous=\E[M, + kslt=\EOF, meml=\El, memu=\Em, op=\E[39;49m, rc=\E8, ri=\EM, + rmam=\E[?7l, rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>, + rmso=\E[27m, rmul=\E[24m, rs1=\Ec, sc=\E7, + setab=\E[48;5;%p1%dm, setaf=\E[38;5;%p1%dm, + sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%; + %?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, + sgr0=\E[m, smam=\E[?7h, smcup=\E[?1049h, smir=\E[4h, + smkx=\E[?1h\E=, rv=\E\\[>65;331;0c, + xr=\EP>\\|RLogin\\(([1-9][.0-9]+)\\)\E\\\\, + use=ansi+apparrows, use=ansi+cup, use=ansi+idl, + use=ansi+inittabs, use=ansi+local, use=ansi+rca2, + use=ansi+sgrdim, use=bracketed+paste, use=ecma+index, + use=ecma+italics, use=ecma+strikeout, use=vt420+lrmm, + use=decid+cpr, use=report+da2, use=report+version, + use=vt100+pf1-pf4, use=vt220+pcedit, use=vt220+ufkeys, + use=xterm+acs, #### Command prompt @@ -4525,8 +4613,8 @@ # # The cnorm/civis definitions added in 2015 are unrelated to any standard. ms-vt100-16color|VT-UTF-8 and VT100+, - civis=\E[?h, cnorm=\E[?l, rmso=\E[27m, rmul=\E[24m, - use=ibm+16color, use=ms-vt100+, + civis=\E[?h, cnorm=\E[?l, use=ecma+underline, + use=ecma+standout, use=ibm+16color, use=ms-vt100+, # Based on # https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences @@ -4582,11 +4670,45 @@ use=ansi+local, use=ecma+sgr, use=ecma+color, use=vt220+cvis, use=vt220+pcedit, use=xterm+nopcfkeys, -# Windows Terminal (Preview) +# Windows Terminal # https://github.com/microsoft/terminal # +# Version 1.21.2911.0 +# 2024-10-17 +# +# - The "About" dialog has a pointer to the release notes, but that turns out +# to be for all branches. This particular version (unlike those previously +# tested) happens to be a non-preview version. +# - Windows Terminal #2958 has relevant discussion. +# +# tack: +# - keypad escapes still do not work +# - meta mode does not work +# - when running tests, the screen maximized and did not resume normal size +# +# vttest: +# - identifies as a VT100-level terminal supporting Greek and Turkish (not +# applicable to a VT100), horizontal scrolling () and DRCS (seems to work) +# - left/right margins work +# - DECSCUSR is okay except for mode 1 +# - SL/SR fail +# - does not support XTVERSION +# - some mouse controls work, but not highlight tracking and X10 compatibility +# - mouse focus events appear - but not in the test-screen (like VTE). +# - cursor position after alternate screen is correct for 1049, not otherwise +# - window reporting does not work +# +# wraptest: +# - DECRC does not restore wrap +# +# other: +# - change history says it supports bracketed paste +# - Greek and Turkish character sets work with GL, not GR +# - source code says it implements OSC 52, as well as 12, 112, but not 104. +# # Windows 10 22H2 (also Windows 11) # Version 1.16.10261.0 +# 2020-01-25 # # - Windows Terminal #1553: "Feature Request: Mouse/Touch/Pointer Bindings # (like middle-click paste, right-click context menu, etc.)", compare to @@ -4597,6 +4719,7 @@ # # Windows 10 21H1 # Version 1.9.1942.0 +# 2021-07-13 # # This has longstanding issues with CR/LF mapping, e.g., # - first reported by Juergen Pfeifer August 13, 2020, with workaround @@ -4646,6 +4769,7 @@ # # Windows 10 1903 # Version 0.2.1831.0 +# 2019-07-02 # # The task manager shows this as "OpenConsole.exe", which differs # from the "Windows Command Processor" used for the command-prompt. @@ -4682,13 +4806,19 @@ # - color palette can be altered, but OSC 104 for resetting does not work # - crashed with a script used for testing NRCS. # - does not recognize either xterm+direct or xterm+indirect escapes. -ms-terminal|Windows10 terminal, +ms-terminal|Windows terminal, + use=xterm+256color, use=ms+terminal, +ms-terminal-direct|Windows terminal with direct-colors, + use=xterm+direct, use=ms+terminal, +ms+terminal|building block for Windows terminal, npc, - cud1=\E[B, kcbt=\E[Z, rmkx=\E[?1l, rmm@, smkx=\E[?1h, smm@, - Cr@, Ms@, use=linux+kbs, use=xterm+256color, - use=xterm+pcfkeys, use=ansi+rep, use=xterm+sm+1006, - use=ecma+index, use=ecma+italics, use=ecma+strikeout, - use=xterm-basic, use=xterm+tmux, + cud1=\E[B, kbeg=\EOE, kcbt=\E[Z, oc@, rmkx=\E[?1l, rmm@, + smkx=\E[?1h, smm@, rv=\E\\[>0;10;1c, use=linux+kbs, + use=bracketed+paste, use=xterm+pcfkeys, use=ansi+rep, + use=xterm+sm+1006, use=ecma+index, use=ecma+italics, + use=ecma+strikeout, use=report+da2, use=vt420+lrmm, + use=xterm-basic, use=xterm+focus, use=xterm+tmux, + use=xterm+sm+1003, #### Visual Studio # Visual Studio Code 1.45.0 uses xterm.js 12.8.1 (see https://xtermjs.org/). @@ -4737,10 +4867,11 @@ # - color-palette cannot be changed vscode|xterm.js|Visual Studio Code terminal using xterm.js, npc, - kcbt=\E[Z, rmkx=\E[?1l, smkx=\E[?1h, use=linux+kbs, - use=xterm+256setaf, use=ecma+index, use=xterm+focus, - use=xterm+sm+1006, use=xterm+pcfkeys, use=ecma+italics, - use=xterm-basic, use=bracketed+paste, + kcbt=\E[Z, rmkx=\E[?1l, smkx=\E[?1h, rv=\E\\[>0;276;0c, + use=linux+kbs, use=report+da2, use=xterm+256setaf, + use=ecma+index, use=xterm+focus, use=xterm+sm+1006, + use=xterm+pcfkeys, use=ecma+italics, use=xterm-basic, + use=bracketed+paste, vscode-direct|Visual Studio Code with direct-colors, use=xterm+indirect, use=vscode, @@ -4766,14 +4897,13 @@ OTbs, am, km, mir, msgr, xenl, xon, cols#80, it#8, lines#65, bold=\E[1m, clear=\E[H\E[2J, csr=\E[%i%p1%d;%p2%dr, - cub1=^H, cud1=\n, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, - cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, ed=\E[J, el=\E[K, - home=\E[H, ht=^I, ind=\n, is2=\E\E[m\E[?7h\E[?1;4l, kbs=^H, - kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, - kf2=\EOQ, kf3=\EOR, kf4=\EOS, rev=\E[7m, ri=\EM, rmam=\E[?7l, - rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, - sgr0=\E[m, smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, - smso=\E[7m, smul=\E[4m, use=ansi+idl, + cub1=^H, cud1=\n, cuf1=\E[C, cuu1=\E[A, dch=\E[%p1%dP, + dch1=\E[P, ed=\E[J, el=\E[K, ht=^I, ind=\n, + is2=\E\E[m\E[?7h\E[?1;4l, kbs=^H, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, rev=\E[7m, ri=\EM, rmam=\E[?7l, + rmir=\E[4l, rmkx=\E[?1l\E>, sgr0=\E[m, smam=\E[?7h, + smir=\E[4h, smkx=\E[?1h\E=, use=ansi+cup, use=ansi+idl, + use=ansi+sgrso, use=ansi+sgrul, use=vt100+pf1-pf4, # csl is extension which clears the status line x10term+sl|status-line for X10 xterm, @@ -4789,20 +4919,25 @@ OTbs, am, km, msgr, xenl, cols#80, it#8, lines#24, bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=\r, cub1=^H, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, ed=\E[J, el=\E[K, home=\E[H, ht=^I, - hts=\EH, ind=\n, kdl1=\E[31~, kel=\E[8~, kf0=\EOq, - kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, - kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, - kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[1~, - kil1=\E[30~, kmous=\E[M, rev=\E[7m, ri=\EM, rmkx=\E[?1l\E>, - rmso=\E[m, rmul=\E[m, + ed=\E[J, el=\E[K, ht=^I, hts=\EH, ind=\n, kdl1=\E[31~, + kel=\E[8~, kf0=\EOq, khome=\E[1~, kil1=\E[30~, kmous=\E[M, + rev=\E[7m, ri=\EM, rmkx=\E[?1l\E>, rs2=\E>\E[?1;3;4;5;6l\E[4l\E[?7h\E[m\E[r\E[2J\E[H, sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1 %;m, - sgr0=\E[m, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, - tbc=\E[3g, use=xterm+kbs, use=ansi+apparrows, - use=ansi+csr, use=ansi+idc, use=ansi+idl, use=ansi+local, - use=vt220+pcedit, use=vt100+enq, + sgr0=\E[m, smkx=\E[?1h\E=, tbc=\E[3g, use=xterm+kbs, + use=ansi+apparrows, use=ansi+csr, use=ansi+cup, + use=ansi+idc, use=ansi+idl, use=ansi+local, + use=ansi+sgrso, use=ansi+sgrul, use=vt220+pcedit, + use=vt100+enq, use=xterm+r5+fkeys, + +# X11R5 used function-keys based on, but different from VT220, assigning keys +# F1-R5 (unlike VT220), and limiting to F12 (perhaps influenced by other +# keyboards). +xterm+r5+fkeys|VT220-like function keys in X11R5 xterm, + use=xterm+r5+lockeys, use=vt220+ufkeys, +xterm+r5+lockeys|XTerm "local" keys in vt220 scheme, + kf1=\E[11~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, # Compatible with the R6 xterm # (from XFree86 3.2 distribution, and added, removed) @@ -4814,22 +4949,18 @@ cols#80, it#8, lines#24, acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=\r, cub1=^H, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, - dch1=\E[P, ed=\E[J, el=\E[K, enacs=\E)0, home=\E[H, ht=^I, - hts=\EH, ind=\n, + dch=\E[%p1%dP, dch1=\E[P, enacs=\E)0, ht=^I, hts=\EH, ind=\n, is2=\E[m\E[?7h\E[4l\E>\E7\E[r\E[?1;3;4;6l\E8, - kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\E[11~, - kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, - kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, - kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, - kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, - kf8=\E[19~, kf9=\E[20~, kmous=\E[M, meml=\El, memu=\Em, - rev=\E[7m, ri=\EM, rmacs=^O, rmir=\E[4l, rmkx=\E[?1l\E>, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kmous=\E[M, + meml=\El, memu=\Em, rev=\E[7m, ri=\EM, rmacs=^O, rmir=\E[4l, + rmkx=\E[?1l\E>, rs2=\E[m\E[?7h\E[4l\E>\E7\E[r\E[?1;3;4;6l\E8, sgr0=\E[m, smacs=^N, smir=\E[4h, smkx=\E[?1h\E=, tbc=\E[3g, - use=xterm+alt47, use=ansi+csr, use=ansi+idl, - use=ansi+local, use=ansi+sgrso, use=ansi+sgrul, - use=vt220+vtedit, use=xterm+kbs, use=vt100+enq, + use=xterm+alt47, use=ansi+csr, use=ansi+cup, + use=ansi+erase, use=ansi+idl, use=ansi+local, + use=ansi+sgrso, use=ansi+sgrul, use=vt220+vtedit, + use=xterm+kbs, use=vt100+enq, use=vt220+sfkeys, + use=xterm+r5+fkeys, xterm-old|antique xterm version, use=xterm-r6, @@ -4849,18 +4980,12 @@ cols#80, lines#24, ncv@, acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=\r, cub1=^H, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, ech=\E[%p1%dX, ed=\E[J, el=\E[K, - el1=\E[1K, enacs=\E(B\E)0, flash=\E[?5h$<100/>\E[?5l, - home=\E[H, hpa=\E[%i%p1%dG, ind=\n, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, + flash=\E[?5h$<100/>\E[?5l, ind=\n, is2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, - kbeg=\EOE, kbs=^?, kdch1=^?, kend=\EOF, kf1=\E[11~, - kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, - kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, - kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, - kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, - kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, kmous=\E[M, kslt=\E[4~, - meml=\El, memu=\Em, rev=\E[7m, ri=\EM, rmacs=^O, rmam=\E[?7l, - rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, rs1=^O, + kbeg=\EOE, kbs=^?, kdch1=^?, kend=\EOF, kfnd=\E[1~, + kmous=\E[M, kslt=\E[4~, meml=\El, memu=\Em, rev=\E[7m, + ri=\EM, rmacs=^O, rmam=\E[?7l, rmkx=\E[?1l\E>, rs1=^O, rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;3;4;6l\E[4l\E>, setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6} %=%t3%e%p1%d%;m, @@ -4869,17 +4994,18 @@ sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 %;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, - smso=\E[7m, smul=\E[4m, vpa=\E[%i%p1%dd, - use=ansi+apparrows, use=ansi+csr, use=ansi+idc, - use=ansi+idl, use=ansi+inittabs, use=ansi+local, - use=xterm+alt47, use=xterm+kbs, use=vt100+enq, + smul=\E[4m, use=ecma+underline, use=ecma+standout, + use=ansi+apparrows, use=ansi+csr, use=ansi+cup, + use=ansi+idc, use=ansi+idl, use=ansi+inittabs, + use=ansi+local, use=ansi+rca2, use=xterm+alt47, + use=xterm+kbs, use=vt100+enq, use=xterm+r5+fkeys, use=ecma+color, use=vt220+cvis, use=vt220+keypad, - use=vt220+pcedit, + use=vt220+pcedit, use=vt220+sfkeys, # This is the stock xterm entry supplied with XFree86 3.3, which uses VT100 # codes for F1-F4 except while in VT220 mode. xterm-xf86-v33|xterm terminal emulator (XFree86 3.3 Window System), - kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, use=xterm-xf86-v32, + use=vt100+pf1-pf4, use=xterm-xf86-v32, # This version was released in XFree86 3.3.3 (November 1998). # Besides providing printer support, it exploits a new feature that allows @@ -4935,7 +5061,7 @@ att610+cvis0|AT&T 610 cursor-visibility, civis=\E[?25l, cnorm=\E[?12l\E[?25h, att610+cvis|AT&T 610 cursor-visibility with blink, - civis=\E[?25l, cnorm=\E[?12l\E[?25h, cvvis=\E[?12;25h, + cvvis=\E[?12;25h, use=att610+cvis0, # This version was released in XFree86 4.4. xterm-xf86-v44|xterm terminal emulator (XFree86 4.4 Window System), @@ -4952,8 +5078,8 @@ use=xterm+keypad, use=xterm-basic, xterm-p370|xterm patch #370, - rv=\E\\[41;[1-6][0-9][0-9];0c, - xr=\EP>\\|XTerm\\([1-9][0-9]+\\)\E\\\\, + rv=\E\\[>41;[1-6][0-9][0-9];0c, + xr=\EP>\\|XTerm\\(([1-9][0-9]+)\\)\E\\\\, use=ecma+index, use=ansi+rep, use=ecma+strikeout, use=xterm+pcfkeys, use=xterm+nofkeys, use=bracketed+paste, use=report+version, @@ -4974,7 +5100,7 @@ kbs=^H, # Use this fragment for terminals that always use DEL for "backspace". -linux+kbs|fragment for "backspace" key, +linux+kbs|Linux fragment for "backspace" key, kbs=^?, # # This fragment describes as much of XFree86 xterm's "pc-style" function @@ -5005,25 +5131,20 @@ # kf21 control f1 = \E[42~ # kf31 shift control f1 = \E[52~ xterm+nopcfkeys|fragment without PC-style fkeys, - kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, - kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, - kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, - kf20=\E[34~, kf21=\E[42~, kf22=\E[43~, kf23=\E[44~, - kf24=\E[45~, kf25=\E[46~, kf26=\E[47~, kf27=\E[48~, - kf28=\E[49~, kf29=\E[50~, kf3=\E[13~, kf30=\E[51~, - kf31=\E[52~, kf32=\E[53~, kf33=\E[54~, kf34=\E[55~, - kf35=\E[56~, kf36=\E[57~, kf37=\E[58~, kf38=\E[59~, - kf39=\E[60~, kf4=\E[14~, kf40=\E[61~, kf41=\E[62~, - kf42=\E[63~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, - kf8=\E[19~, kf9=\E[20~, + kf21=\E[42~, kf22=\E[43~, kf23=\E[44~, kf24=\E[45~, + kf25=\E[46~, kf26=\E[47~, kf27=\E[48~, kf28=\E[49~, + kf29=\E[50~, kf30=\E[51~, kf31=\E[52~, kf32=\E[53~, + kf33=\E[54~, kf34=\E[55~, kf35=\E[56~, kf36=\E[57~, + kf37=\E[58~, kf38=\E[59~, kf39=\E[60~, kf40=\E[61~, + kf41=\E[62~, kf42=\E[63~, use=vt220+sfkeys, + use=xterm+r5+fkeys, vt100+noapp|fragment with cursor keys in normal mode, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, use=vt100+noapp+pc, -xterm+noapp|fragment with cursor keys in normal mode, - kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kend=\E[F, - khome=\E[H, +xterm+noapp|alias for vt100+noapp, + use=vt100+noapp, xterm+app|fragment with cursor keys in application mode, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, @@ -5106,41 +5227,39 @@ # Here are corresponding fragments from xterm patch #216: # xterm+pcf0|fragment with modifyFunctionKeys:0, - kf1=\EOP, kf13=\EO2P, kf14=\EO2Q, kf15=\EO2R, kf16=\EO2S, - kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, kf2=\EOQ, + kf13=\EO2P, kf14=\EO2Q, kf15=\EO2R, kf16=\EO2S, + kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~, kf25=\EO5P, kf26=\EO5Q, - kf27=\EO5R, kf28=\EO5S, kf29=\E[15;5~, kf3=\EOR, - kf30=\E[17;5~, kf31=\E[18;5~, kf32=\E[19;5~, - kf33=\E[20;5~, kf34=\E[21;5~, kf35=\E[23;5~, - kf36=\E[24;5~, kf37=\EO6P, kf38=\EO6Q, kf39=\EO6R, - kf4=\EOS, kf40=\EO6S, kf41=\E[15;6~, kf42=\E[17;6~, - kf43=\E[18;6~, kf44=\E[19;6~, kf45=\E[20;6~, - kf46=\E[21;6~, kf47=\E[23;6~, kf48=\E[24;6~, kf49=\EO3P, - kf50=\EO3Q, kf51=\EO3R, kf52=\EO3S, kf53=\E[15;3~, - kf54=\E[17;3~, kf55=\E[18;3~, kf56=\E[19;3~, - kf57=\E[20;3~, kf58=\E[21;3~, kf59=\E[23;3~, - kf60=\E[24;3~, kf61=\EO4P, kf62=\EO4Q, kf63=\EO4R, - use=xterm+nopcfkeys, -# -xterm+pcf2|fragment with modifyFunctionKeys:2, - kf1=\EOP, kf13=\E[1;2P, kf14=\E[1;2Q, kf15=\E[1;2R, - kf16=\E[1;2S, kf17=\E[15;2~, kf18=\E[17;2~, - kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~, - kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~, - kf25=\E[1;5P, kf26=\E[1;5Q, kf27=\E[1;5R, kf28=\E[1;5S, - kf29=\E[15;5~, kf3=\EOR, kf30=\E[17;5~, kf31=\E[18;5~, - kf32=\E[19;5~, kf33=\E[20;5~, kf34=\E[21;5~, - kf35=\E[23;5~, kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q, - kf39=\E[1;6R, kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~, + kf27=\EO5R, kf28=\EO5S, kf29=\E[15;5~, kf30=\E[17;5~, + kf31=\E[18;5~, kf32=\E[19;5~, kf33=\E[20;5~, + kf34=\E[21;5~, kf35=\E[23;5~, kf36=\E[24;5~, kf37=\EO6P, + kf38=\EO6Q, kf39=\EO6R, kf40=\EO6S, kf41=\E[15;6~, kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~, kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~, - kf48=\E[24;6~, kf49=\E[1;3P, kf50=\E[1;3Q, kf51=\E[1;3R, - kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~, + kf48=\E[24;6~, kf49=\EO3P, kf50=\EO3Q, kf51=\EO3R, + kf52=\EO3S, kf53=\E[15;3~, kf54=\E[17;3~, kf55=\E[18;3~, + kf56=\E[19;3~, kf57=\E[20;3~, kf58=\E[21;3~, + kf59=\E[23;3~, kf60=\E[24;3~, kf61=\EO4P, kf62=\EO4Q, + kf63=\EO4R, use=vt100+pf1-pf4, use=xterm+nopcfkeys, +# +xterm+pcf2|fragment with modifyFunctionKeys:2, + kf13=\E[1;2P, kf14=\E[1;2Q, kf15=\E[1;2R, kf16=\E[1;2S, + kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, + kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, + kf23=\E[23;2~, kf24=\E[24;2~, kf25=\E[1;5P, kf26=\E[1;5Q, + kf27=\E[1;5R, kf28=\E[1;5S, kf29=\E[15;5~, kf30=\E[17;5~, + kf31=\E[18;5~, kf32=\E[19;5~, kf33=\E[20;5~, + kf34=\E[21;5~, kf35=\E[23;5~, kf36=\E[24;5~, + kf37=\E[1;6P, kf38=\E[1;6Q, kf39=\E[1;6R, kf40=\E[1;6S, + kf41=\E[15;6~, kf42=\E[17;6~, kf43=\E[18;6~, + kf44=\E[19;6~, kf45=\E[20;6~, kf46=\E[21;6~, + kf47=\E[23;6~, kf48=\E[24;6~, kf49=\E[1;3P, kf50=\E[1;3Q, + kf51=\E[1;3R, kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~, kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~, kf58=\E[21;3~, kf59=\E[23;3~, kf60=\E[24;3~, kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, - use=xterm+nopcfkeys, + use=vt100+pf1-pf4, use=xterm+nopcfkeys, # # Chunks from xterm #230: xterm+pce2|fragment with modifyCursorKeys:2 editing-keys, @@ -5160,8 +5279,7 @@ use=xterm+pc+edit, use=vt220+pcedit, xterm+decedit|fragment for vt220 6-key editing-keypad, - kdch1=\E[3~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, - use=xterm+vt+edit, + use=vt220+vtedit, use=xterm+vt+edit, xterm+pc+edit|fragment for pc-style editing keypad, kend=\E[4~, khome=\E[1~, @@ -5251,14 +5369,13 @@ OTbs, am, bce, mir, msgr, xenl, AX, XT, colors#8, cols#80, lines#24, pairs#64, bel=^G, clear=\E[H\E[2J, cr=\r, cub1=^H, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, - dim=\E[2m, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, - flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG, + dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, ech=\E[%p1%dX, + ed=\E[J, el=\E[K, el1=\E[1K, flash=\E[?5h$<100/>\E[?5l, ich=\E[%p1%d@, ind=\n, is2=\E[!p\E[?3;4l\E[4l\E>, kmous=\E[M, meml=\El, memu=\Em, op=\E[39;49m, ri=\EM, - rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, - rmul=\E[24m, rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, - setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rs1=\Ec, + rs2=\E[!p\E[?3;4l\E[4l\E>, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6} %=%t3%e%p1%d%;m, setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6} @@ -5266,9 +5383,10 @@ sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%; %?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, sgr0=\E(B\E[m, smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, - vpa=\E[%i%p1%dd, E3=\E[3J, use=ansi+csr, use=ansi+enq, - use=ansi+idl, use=ansi+inittabs, use=ansi+local, - use=ansi+pp, use=ansi+sgrbold, use=xterm+kbs, + E3=\E[3J, use=ecma+underline, use=ecma+standout, + use=ansi+csr, use=ansi+cup, use=ansi+enq, use=ansi+idl, + use=ansi+inittabs, use=ansi+local, use=ansi+pp, + use=ansi+rca2, use=ansi+sgrbold, use=xterm+kbs, use=xterm+alt+title, use=att610+cvis, use=xterm+acs, use=xterm+meta, @@ -5338,6 +5456,10 @@ ;%p1%d%;m, setb@, setf@, +xterm+256setaf2|xterm 256-color (set-only with colon), + ccc@, + initc@, use=xterm+256setaf, + # 88-colors is a compile-time feature of XFree86 xterm beginning with # xterm patch #115 (1999/9/18) -TD # @@ -5609,14 +5731,11 @@ # xterm-vt220|xterm emulating VT220, npc, - kcbt=\E[Z, kend=\E[4~, kf10=\E[21~, kf11=\E[23~, - kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, - kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, - kf20=\E[34~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, - kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kmous=\E[M, nel=\EE, + kcbt=\E[Z, kend=\E[4~, khome=\E[1~, kmous=\E[M, nel=\EE, use=xterm+app, use=xterm+edit, use=vt220+keypad, use=ecma+italics, use=ecma+index, use=ansi+rep, - use=ecma+strikeout, use=xterm+focus, use=xterm+sm+1006, + use=ecma+strikeout, use=vt220+sfkeys, + use=xterm+r5+fkeys, use=xterm+focus, use=xterm+sm+1006, use=xterm+tmux, use=xterm+keypad, use=xterm-basic, xterm-vt52|xterm emulating DEC VT52, @@ -5652,7 +5771,7 @@ # c) fsl ends the escape sequence begun by tsl. Printable characters between # those (probably) will appear in the window title. Nonprintable characters # may cause the escape sequence to end with an error. -# d) the BEL (^G or \007) used in the original title-as-statusline came from +# d) the BEL (^G or \007) used in the original title-as-statusline came from # David J. MacKenzie's "pseudo-color" entry in 20 Apr 1995. At that time # xterm used BEL as the string-terminator rather than ST (\E\\). Either # BEL or ST has worked since xterm patch #28 in 1996, but most uses of @@ -5742,6 +5861,8 @@ # The response is a DSR sequence identifying the version: DCS > | text ST # For example: # ^[P>|XTerm(354)^[\ +# tack expects this string to be a regular expression, so some characters such +# as "|" are escaped. report+version|Report xterm name and version (XTVERSION), XR=\E[>0q, xr=\EP>\\|[ -~]+\E\\\\, use=report+da2, @@ -5750,8 +5871,10 @@ # - the second as the patch number for xterm, and # - the third parameter as zero. # Other terminals may provide useful responses, though few are documented. +# Some are hardcoded to match some (usually old) version of xterm. For the +# others, rv is a regular expression which tack can match. report+da2|report secondary device attributes (DA2), - RV=\E[>c, rv=\E\\[[0-9]+;[0-9]+;[0-9]+c, + RV=\E[>c, rv=\E\\[>[0-9]+;[0-9]+;[0-9]+c, #### XTERM Mouse # The xterm mouse protocol is used by other terminal emulators. @@ -5975,10 +6098,10 @@ # http://nion.modprobe.de/blog/archives/569-colored-manpages.html # (blog posting by Nico Golde, June 24 2007) # archive: -# https://web-beta.archive.org/web/20070921042430/http://nion.modprobe.de/mostlike.txt +# https://web.archive.org/web/20070921042430/http://nion.modprobe.de/mostlike.txt # The comment hints where it started, but there are differences: # Reconstructed via infocmp from file: /usr/share/terminfo/x/xterm-pcolor -mostlike|manpages with color looking like most, +mostlike|man pager with color looking like most, OTbs@, bold=\E[1m\E[31m, is2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, kbs=^H, @@ -5997,23 +6120,21 @@ cols#80, it#8, lines#65, ncv@, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=\r, cub1=^H, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, ed=\E[J, - el=\E[K, el1=\E[1K, enacs=\E(B\E)0, home=\E[H, ht=^I, - ich=\E[%p1%d@, ind=\n, is1=\E[r\E[m\E[?7h\E[?4;6l\E[4l, - kend=\E[8~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, - kf12=\E[24~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, - kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + dch=\E[%p1%dP, dch1=\E[P, ed=\E[J, el=\E[K, el1=\E[1K, + enacs=\E(B\E)0, ht=^I, ich=\E[%p1%d@, ind=\n, + is1=\E[r\E[m\E[?7h\E[?4;6l\E[4l, kend=\E[8~, khome=\E[7~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, rev=\E[7m, ri=\EM, rmacs=^O, rmam=\E[?7l, - rmcup=\E>\E[?41;1r, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, + rmcup=\E>\E[?41;1r, rmir=\E[4l, rs1=\E(B\017\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E<, sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 %;m%?%p9%t\016%e\017%;, sgr0=\E[0m\017, smacs=^N, smam=\E[?7h, - smcup=\E[?1;41s\E[?1;41h\E=, smir=\E[4h, smso=\E[7m, - smul=\E[4m, use=ansi+apparrows, use=ansi+csr, - use=ansi+idl, use=ansi+local, use=decid+cpr, - use=ecma+color, use=vt220+keypad, + smcup=\E[?1;41s\E[?1;41h\E=, smir=\E[4h, smul=\E[4m, + use=ecma+underline, use=ecma+standout, + use=xterm+r5+fkeys, use=ansi+apparrows, use=ansi+csr, + use=ansi+cup, use=ansi+idl, use=ansi+local, + use=decid+cpr, use=ecma+color, use=vt220+keypad, # The IRAF source has a terminfo using "xterm-r5", but line-drawing does not # work in that case. This entry uses xterm+acs, to work around that problem. @@ -6087,8 +6208,8 @@ # this describes the alpha-version of GNOME terminal shipped with Redhat 6.0 gnome-rh62|GNOME terminal, bce, - kdch1=^?, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, - use=linux+kbs, use=xterm-color, + kdch1=^?, use=linux+kbs, use=vt100+pf1-pf4, + use=xterm-color, # GNOME Terminal 1.4.0.4 (Redhat 7.2) # @@ -6110,11 +6231,11 @@ # it hangs in tack after running function-keys test. gnome-rh72|GNOME Terminal in RedHat 7, bce, km@, - kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, rmam=\E[?7l, + rmam=\E[?7l, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m%?%p9%t\016%e \017%;, - sgr0=\E[0m\017, smam=\E[?7h, tbc@, use=vt220+cvis, - use=linux+kbs, use=xterm-color, + sgr0=\E[0m\017, smam=\E[?7h, tbc@, use=linux+kbs, + use=vt100+pf1-pf4, use=vt220+cvis, use=xterm-color, # GNOME Terminal 2.0.1 (Redhat 8.0) # @@ -6139,9 +6260,9 @@ # bce and msgr are repaired. gnome-rh90|GNOME Terminal in RedHat 9, bce, msgr, XT, - hpa=\E[%i%p1%dG, kLFT=\EO2D, kRIT=\EO2C, kb2=\E[E, - kcbt=\E[Z, tbc=\E[3g, vpa=\E[%i%p1%dd, use=xterm+pcf0, - use=xterm+pcfkeys, use=gnome-rh80, + kLFT=\EO2D, kRIT=\EO2C, kb2=\E[E, kcbt=\E[Z, tbc=\E[3g, + use=ansi+rca2, use=xterm+pcf0, use=xterm+pcfkeys, + use=gnome-rh80, # GNOME Terminal 2.14.2 (Fedora Core 5) # Ed Catmur notes that gnome-terminal has recognized soft-reset since May 2002. @@ -6184,9 +6305,10 @@ # Testing with tack shows that flash does not/has not worked -TD vte-2012|VTE 0.34.1, ncv#16, - dim=\E[2m, flash@, invis=\E[8m, rmso=\E[27m, rmul=\E[24m, + dim=\E[2m, flash@, invis=\E[8m, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p5%t;2%;%?%p7%t;8%;%?%p1%p3 %|%t;7%;m%?%p9%t\016%e\017%;, + use=ecma+underline, use=ecma+standout, use=ecma+italics, use=vte-2008, # Version 3.6.1 sets TERM to xterm-256color (still hardcoded), which has # 61 differences from a correct entry for gnome terminal. @@ -6278,8 +6400,12 @@ # - AT&T cursor-blinking # - meta mode, as documented in terminfo(5) # - xterm's extension to clear scrollback +vte-2022|VTE aka GNOME Terminal, + xr=\EP>\\|VTE\\(([0-9])\\)\E\\\\, use=report+version, + use=report+da2, use=vte-2018, + vte|VTE aka GNOME Terminal, - use=vte-2018, + use=vte-2022, vte-256color|VTE with xterm 256-colors, use=xterm+256color, use=vte, @@ -6342,22 +6468,21 @@ acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxy yzz{{||}}~~, bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=\r, cub1=^H, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, ech=\E[%p1%dX, ed=\E[J, el=\E[K, - el1=\E[1K, flash=\E[?5h$<100/>\E[?5l, home=\E[H, - hpa=\E[%i%p1%dG, ind=\n, invis=\E[8m, - is2=\E[!p\E[?3;4l\E[4l\E>, kb2=\EOE, kbs=^?, kcbt=\E[Z, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, + flash=\E[?5h$<100/>\E[?5l, ind=\n, invis=\E[8m, + is2=\E[!p\E[?3;4l\E[4l\E>, kb2=\EOE, kcbt=\E[Z, kent=\EOM, kmous=\E[M, rev=\E[7m, ri=\EM, rmacs=\E(B, - rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, - rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, + rmam=\E[?7l, rmkx=\E[?1l\E>, rs1=\Ec, + rs2=\E[!p\E[?3;4l\E[4l\E>, sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%| %t;7%;%?%p7%t;8%;m, sgr0=\E(B\E[m, smacs=\E(0, smam=\E[?7h, smkx=\E[?1h\E=, - smso=\E[7m, smul=\E[4m, vpa=\E[%i%p1%dd, use=ansi+csr, - use=ansi+enq, use=ansi+idc, use=ansi+idl, - use=ansi+inittabs, use=ecma+index, use=ecma+italics, - use=ansi+local, use=xterm+alt1049, use=xterm+256color, - use=ecma+color, use=vt220+cvis, use=xterm+pcfkeys, - use=xterm+sl-twm, + use=ansi+csr, use=ansi+cup, use=ansi+enq, use=ansi+idc, + use=ansi+idl, use=ansi+inittabs, use=ansi+local, + use=ansi+rca2, use=ecma+index, use=ecma+italics, + use=ecma+underline, use=ecma+standout, use=linux+kbs, + use=xterm+alt1049, use=xterm+256color, use=ecma+color, + use=vt220+cvis, use=xterm+pcfkeys, use=xterm+sl-twm, #### Other GNOME # Multi-GNOME-Terminal 1.6.2 @@ -6431,20 +6556,21 @@ konsole-base|KDE console window (common), bce, km@, npc, XT, ncv@, - ech=\E[%p1%dX, flash=\E[?5h$<100/>\E[?5l, - hpa=\E[%i%p1%dG, kend=\E[4~, kf1@, kf10@, kf11@, kf12@, kf13@, - kf14@, kf15@, kf16@, kf17@, kf18@, kf19@, kf2@, kf20@, kf3@, kf4@, - kf5@, kf6@, kf7@, kf8@, kf9@, kfnd@, khome=\E[1~, kslt@, - rmam=\E[?7l, rmso=\E[27m, rmul=\E[24m, rs1=\Ec, + ech=\E[%p1%dX, flash=\E[?5h$<100/>\E[?5l, kf1@, kf10@, + kf11@, kf12@, kf13@, kf14@, kf15@, kf16@, kf17@, kf18@, kf19@, kf2@, + kf20@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, kf9@, kfnd@, kslt@, + rmam=\E[?7l, rs1=\Ec, rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[?25h, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%? %p5%t;2%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, - sgr0=\E[0m\017, smam=\E[?7h, vpa=\E[%i%p1%dd, + sgr0=\E[0m\017, smam=\E[?7h, rv=\E\\[>1;115;0c, + xr=\EP>\\|Konsole ([1-9][.0-9])\E\\\\, + use=ecma+underline, use=ecma+standout, use=ansi+rca2, use=ansi+sgrdim, use=ecma+index, use=xterm+focus, use=xterm+sm+1006, use=ecma+strikeout, use=ecma+italics, use=ecma+color, use=xterm-r6, use=vt220+cvis, use=bracketed+paste, - use=report+version, + use=report+version, use=xterm+pc+edit, # The keytab feature was introduced in 0.9.12 (February 2000) with "linux" and # "vt100" key-table files along with a compiled-in default key-table. @@ -6530,11 +6656,10 @@ # it is still useful for deriving the other entries, since the developer # provided function-keys based on xterm. konsole-vt100|KDE console window with VT100 (sic) keyboard, - kend=\E[F, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, - kf12=\E[24~, kf13@, kf14@, kf15@, kf16@, kf17@, kf18@, kf19@, - kf2=\E[12~, kf20@, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, - kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[H, - use=konsole-base, + kend=\E[F, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13@, + kf14@, kf15@, kf16@, kf17@, kf18@, kf19@, kf20@, kf6=\E[17~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[H, + use=xterm+r5+lockeys, use=konsole-base, # Obsolete: vt420pc.keytab was added in June 2000, dropped from the install in # September 2008 and removed in June 2016. The developer who removed it stated @@ -6599,6 +6724,8 @@ is2=\E[!p\E[?3;4l\E>, rs2=\E[!p\E[?3;4l\E>, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;%? %p7%t;8%;m%?%p9%t\E(0%e\E(B%;, + rv=\E\\[>24;279;0c, + xr=\EP>\\|mlterm\\([0-9][.0-9](-.*)?\\)?\E\\\\, use=ansi+enq, use=ansi+rep, use=ecma+italics, use=ecma+strikeout, use=xterm+app, use=xterm+pcf2, use=xterm+pcc2, use=xterm+pce2, use=xterm+meta, @@ -6630,25 +6757,24 @@ colors#8, cols#80, lines#24, pairs#64, acsc=00``aaffgghhjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=\r, cub1=^H, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, - ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=, - home=\E[H, hpa=\E[%i%p1%dG, ich=\E[%p1%d@, ind=\n, + dch=\E[%p1%dP, dch1=\E[P, ech=\E[%p1%dX, ed=\E[J, el=\E[K, + el1=\E[1K, enacs=, ich=\E[%p1%d@, ind=\n, is2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, kbs=^?, kcbt=\E[Z, kend=\EOF, kent=\EOM, kind=\EO1;2B, kmous=\E[M, kri=\EO1;2A, mc0=\E[i, nel=\EE, op=\E[39;49m, rev=\E[7m, ri=\EM, rmacs=\E(B, rmam=\E[?7l, rmir=\E[4l, - rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, rs1=\Ec, + rmkx=\E[?1l\E>, rs1=\Ec, rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e \E(B%;, sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smir=\E[4h, - smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, u8=\E[?1;2c, - vpa=\E[%i%p1%dd, use=ansi+apparrows, use=ansi+csr, - use=ansi+enq, use=ansi+idl, use=ansi+inittabs, - use=ansi+local, use=vt220+vtedit, use=xterm+alt1049, - use=ecma+index, use=mlterm+pcfkeys, use=vt220+cvis, - use=xterm+r6f2, + smkx=\E[?1h\E=, u8=\E[?1;2c, use=ecma+underline, + use=ecma+standout, use=ansi+apparrows, use=ansi+csr, + use=ansi+cup, use=ansi+enq, use=ansi+idl, + use=ansi+inittabs, use=ansi+local, use=ansi+rca2, + use=vt220+vtedit, use=xterm+alt1049, use=ecma+index, + use=mlterm+pcfkeys, use=vt220+cvis, use=xterm+r6f2, # The insert/delete/home/end keys do not respond to modifiers because mlterm # looks in its termcap to decide which string to send. If it used terminfo @@ -6697,17 +6823,18 @@ is1=\E[?47l\E=\E[?1l, is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kcbt=\E[Z, kmous=\E[M, rev=\E[7m, ri=\EM, rmir=\E[4l, - rmkx=\E>, rmso=\E[27m, rmul=\E[24m, + rmkx=\E>, rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[? 25h, s0ds=\E(B, s1ds=\E(0, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%? %p9%t\016%e\017%;, - sgr0=\E[0m\017, smir=\E[4h, smkx=\E=, smso=\E[7m, - smul=\E[4m, use=ansi+csr, use=ansi+idl, use=ansi+local, - use=xterm+alt47, use=vt100+enq, use=vt100+4bsd, - use=rxvt+pcfkeys, use=vt220+cvis, use=vt220+keypad, + sgr0=\E[0m\017, smir=\E[4h, smkx=\E=, smul=\E[4m, + use=ecma+underline, use=ecma+standout, use=ansi+csr, + use=ansi+idl, use=ansi+local, use=xterm+alt47, + use=vt100+enq, use=vt100+4bsd, use=rxvt+pcfkeys, + use=vt220+cvis, use=vt220+keypad, # Key Codes from rxvt reference: # @@ -6791,8 +6918,7 @@ # Removed kDN6, etc (control+shift) since rxvt does not implement this -TD rxvt+pcfkeys|rxvt fragment for PC-style fkeys, kDC=\E[3$, kEND=\E[8$, kHOM=\E[7$, kIC=\E[2$, kLFT=\E[d, - kNXT=\E[6$, kPRV=\E[5$, kRIT=\E[c, kcub1=\E[D, kcud1=\E[B, - kcuf1=\E[C, kcuu1=\E[A, kel=\E[8\^, kend=\E[8~, + kNXT=\E[6$, kPRV=\E[5$, kRIT=\E[c, kel=\E[8\^, kend=\E[8~, kf21=\E[23$, kf22=\E[24$, kf23=\E[11\^, kf24=\E[12\^, kf25=\E[13\^, kf26=\E[14\^, kf27=\E[15\^, kf28=\E[17\^, kf29=\E[18\^, kf30=\E[19\^, kf31=\E[20\^, kf32=\E[21\^, @@ -6804,10 +6930,9 @@ kHOM5=\E[7\^, kHOM6=\E[7@, kIC5=\E[2\^, kIC6=\E[2@, kLFT5=\EOd, kNXT5=\E[6\^, kNXT6=\E[6@, kPRV5=\E[5\^, kPRV6=\E[5@, kRIT5=\EOc, kUP=\E[a, kUP5=\EOa, - use=vt220+vtedit, use=xterm+nopcfkeys, + use=vt100+noapp, use=vt220+vtedit, use=xterm+nopcfkeys, # rxvt was originally "xvt", first announced in April 1993: -# http://www.krsaborio.net/linux-desktops/research/1993/0416.html #------------------------------------------------------------------------------ # Article: 567 of comp.os.linux.announce # Path: pavo.csi.cam.ac.uk!warwick!uknet!pipex!uunet!zaphod.mps.ohio-state.edu! @@ -6857,8 +6982,8 @@ # with the default background color. rxvt|rxvt-color|rxvt terminal emulator (X Window System), ncv@, - hpa=\E[%i%p1%dG, kf0=\E[21~, sgr0=\E[m\017, - vpa=\E[%i%p1%dd, use=rxvt-basic, use=ecma+color, + kf0=\E[21~, sgr0=\E[m\017, use=ansi+rca2, use=rxvt-basic, + use=ecma+color, rxvt-256color|rxvt 2.7.9 with xterm 256-colors, use=xterm+256color, use=rxvt, rxvt-88color|rxvt 2.7.9 with xterm 88-colors, @@ -6932,22 +7057,21 @@ blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cub1=^H, cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0, - hpa=\E[%i%p1%dG, ich=\E[%p1%d@, is1=\E[?47l\E>\E[?1l, + ich=\E[%p1%d@, is1=\E[?47l\E>\E[?1l, is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kNXT@, kPRV@, ka1=\E[7~, ka3=\E[5~, kb2=\EOu, kbeg=\EOu, kc1=\E[8~, kc3=\E[6~, kent=\EOM, khlp=\E[28~, kmous=\E[M, mc4=\E[4i, mc5=\E[5i, rev=\E[7m, ri=\EM, rmam=\E[?7l, rmir=\E[4l, rmkx=, - rmso=\E[27m, rmul=\E[24m, rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[? 25h, sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 %;m%?%p9%t\016%e\017%;, - sgr0=\E[m\017, smam=\E[?7h, smir=\E[4h, smkx=, smso=\E[7m, - smul=\E[4m, vpa=\E[%i%p1%dd, use=ansi+csr, use=ansi+idl, - use=ansi+local, use=xterm+alt47, use=vt100+enq, - use=rxvt+pcfkeys, use=ecma+color, use=vt100+4bsd, - use=vt220+cvis, + sgr0=\E[m\017, smam=\E[?7h, smir=\E[4h, smkx=, smul=\E[4m, + use=ecma+underline, use=ecma+standout, use=ansi+csr, + use=ansi+idl, use=ansi+local, use=ansi+rca2, + use=xterm+alt47, use=vt100+enq, use=rxvt+pcfkeys, + use=ecma+color, use=vt100+4bsd, use=vt220+cvis, Eterm-256color|Eterm with xterm 256-colors, use=xterm+256color, use=Eterm, @@ -6959,7 +7083,7 @@ # Based on rxvt 2.4.8, it has a few differences in key bindings aterm|AfterStep terminal, XT, - kbs=^?, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, use=rxvt, + kbs=^?, use=vt100+pf1-pf4, use=rxvt, #### XITERM # xiterm 0.5-5.2 @@ -7009,7 +7133,7 @@ # This article does not cover the HP 46020A keyboard that is used by the Model # 217 and 237 computers. For information on this keyboard read the article, # "The Series 300 ITE as System Console" found in the manual, HP-UX Concepts -# and Tutorials, Vol. 7. +# and Tutorials, Vol. 7. # # Possibly: # http://bitsavers.trailing-edge.com/pdf/hp/9000_hpux/1986/97089-90042_198608_HP-UX_Concepts_and_Tutorials.pdf @@ -7093,10 +7217,9 @@ cols#80, it#8, lines#24, vt#200, acsc=aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, blink=\E[0;5m, bold=\E[0;1m, clear=\E[2J\E[H, cr=\r, - cub1=\E[1D, cud1=\E[1B, cuf1=\E[1C, - cup=\E[%i%p1%d;%p2%dH, cuu1=\E[1A, dch=\E[%p1%dP, - dch1=\E[1P, dl=\E[%p1%dM, dl1=\E[1M, ed=\E[0J, el=\E[0K, - el1=\E[1K, enacs=\E)0, home=\E[H, ht=^I, hts=\EH, + cub1=\E[1D, cud1=\E[1B, cuf1=\E[1C, cuu1=\E[1A, + dch=\E[%p1%dP, dch1=\E[1P, dl=\E[%p1%dM, dl1=\E[1M, + ed=\E[0J, el=\E[0K, el1=\E[1K, enacs=\E)0, ht=^I, hts=\EH, if=/usr/share/tabset/vt300, il=\E[%p1%dL, il1=\E[1L, ind=\ED, is2=\E>\E[?1l\E[?3l\E[4l\E[?7h, kbs=^H, kcmd=\E[29~, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, @@ -7113,7 +7236,8 @@ 2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smcup=\E[?1l\E=, smkx=\E=, smso=\E[0;7m, smul=\E[0;4m, tbc=\E[3g, use=ansi+csr, - use=ansi+local, use=vt220+vtedit, use=vt220+cvis, + use=ansi+cup, use=ansi+local, use=vt220+vtedit, + use=vt220+cvis, #### MVTERM # A commercial product, Reportedly a version of Xterm with an OPEN LOOK UI, @@ -7133,13 +7257,13 @@ cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, ed=\E[J, el=\E[K, ich=\E[%p1%d@, ich1=\E[@, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, op=\E[100m, rev=\E[7m, ri=\EM, - rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + rmkx=\E[?1l\E>, rmso=\E[m, rs2=\E>\E[1;3;4;5;6l\E[?7h\E[100m\E[m\E[r\E[2J\E[H, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 %;m%?%p9%t\016%e\017%;, - sgr0=\E[m\017, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, - use=ansi+csr, use=ansi+idl, use=ansi+local, + sgr0=\E[m\017, smkx=\E[?1h\E=, smso=\E[7m, use=ansi+csr, + use=ansi+idl, use=ansi+local, use=ansi+sgrul, use=xterm+alt47, use=vt100+fnkeys, use=vt100+4bsd, use=x10term+sl, @@ -7152,15 +7276,15 @@ am, bw, mir, msgr, it#8, acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, cr=\r, cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, - dim=\E[2m, ech=\E[%p1%dX, home=\E[H, hpa=\E[%i%p1%d`, - ht=^I, ich1=, ind=\E[S, is2=\E)0\017, kbs=^H, nel=\EE, ri=\E[T, - rmacs=^O, rmso=\E[27m, rmul=\E[24m, + bel=^G, cr=\r, dch=\E[%p1%dP, dim=\E[2m, ech=\E[%p1%dX, + hpa=\E[%i%p1%d`, ht=^I, ich1=, ind=\E[S, is2=\E)0\017, + kbs=^H, nel=\EE, ri=\E[T, rmacs=^O, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%? %p5%t;2%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, - sgr0=\E[m\017, smacs=^N, vpa=\E[%i%p1%dd, use=ansi+erase, - use=ansi+idc1, use=ansi+idl, use=ansi+local, - use=ansi+sgrbold, use=ecma+index, + sgr0=\E[m\017, smacs=^N, vpa=\E[%i%p1%dd, + use=ecma+underline, use=ecma+standout, use=ansi+cup, + use=ansi+erase, use=ansi+idc1, use=ansi+idl, + use=ansi+local, use=ansi+sgrbold, use=ecma+index, # mterm normally sets $TERM to "mterm" mterm|mouse-sun|Der Mouse term, @@ -7177,25 +7301,20 @@ am, mir, msgr, xenl, colors#8, it#8, pairs#64, acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, cr=\r, cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, - dim=\E[2m, ech=\E[%p1%dX, enacs=\E(B\E)0, home=\E[H, - hpa=\E[%i%p1%d`, ht=^I, ich1=, ind=\E[S, is2=\E)0\E[r\017, - kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, - kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, - kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, - kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, - kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, - kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, nel=\EE, - op=\E[0m, ri=\E[T, rmacs=^O, rmam=\E[?7l, rmkx=\E[?1l\E>, - rmso=\E[27m, rmul=\E[24m, setab=\E[4%p1%dm, + bel=^G, cr=\r, dch=\E[%p1%dP, dim=\E[2m, ech=\E[%p1%dX, + enacs=\E(B\E)0, hpa=\E[%i%p1%d`, ht=^I, ich1=, ind=\E[S, + is2=\E)0\E[r\017, kbs=^H, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, nel=\EE, op=\E[0m, ri=\E[T, rmacs=^O, + rmam=\E[?7l, rmkx=\E[?1l\E>, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%? %p5%t;2%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, - vpa=\E[%i%p1%dd, use=ansi+cpr, use=ansi+csr, - use=ansi+erase, use=ansi+idc1, use=ansi+idl, - use=ansi+local, use=ansi+sgrbold, use=vt220+vtedit, - use=ecma+index, use=vt220+cvis, + vpa=\E[%i%p1%dd, use=ecma+underline, use=ecma+standout, + use=ansi+cpr, use=ansi+csr, use=ansi+cup, use=ansi+erase, + use=ansi+idc1, use=ansi+idl, use=ansi+local, + use=ansi+sgrbold, use=vt220+vtedit, use=ecma+index, + use=vt220+cvis, use=vt220+sfkeys, use=xterm+r5+fkeys, #### VWM # http://vwm.sourceforge.net/ @@ -7207,20 +7326,18 @@ am, bce, ccc, mir, msgr, npc, xenl, xon, colors#8, pairs#64, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, bold=\E[1m, cr=\r, cub1=^H, cup=\E[%i%p1%d;%p2%dH, - cvvis=\E[?25h, dim=\E[2m, home=\E[H, il1=\E[L, ind=\n, - kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, - kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, kf10=\E[21~, - kf11=\E[22~, kf12=\E[23~, kf2=\E[[B, kf3=\E[[C, kf4=\E[[D, - kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, - khome=\E[1~, knp=\E[6~, kpp=\E[5~, rmacs=\E[10m, + bel=^G, bold=\E[1m, cr=\r, cub1=^H, cvvis=\E[?25h, dim=\E[2m, + il1=\E[L, ind=\n, kdch1=\E[3~, kend=\E[4~, kf11=\E[22~, + kf12=\E[23~, khome=\E[1~, knp=\E[6~, kpp=\E[5~, rmam=\E[?7l, rs1=\E[H\E[J\E[m\Ec, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr=\E[0;10%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5 %t;2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, - sgr0=\E[0;10m, smacs=\E[11m, smam=\E[?7h, smso=\E[3m, - smul=\E[4m, use=ansi+erase, use=ansi+local, use=ansi+sgr, - use=vt220+cvis, use=xterm+alt1049, + sgr0=\E[0;10m, smam=\E[?7h, smso=\E[3m, smul=\E[4m, + use=ansi+cup, use=ansi+erase, use=ansi+local, + use=ansi+sgr, use=klone+acs, use=linux+lockeys, + use=vt100+noapp, use=vt220+cvis, use=vt220+ufkeys, + use=xterm+alt1049, #### MGR # @@ -7251,16 +7368,35 @@ kopn=\E[198z, kpp=\E[216z, kund=\E[195z, use=mgr, mgr-linux|Mgr window with Linux keyboard, ka1=\E[H, ka3=\E[5~, kb2=\E[G, kc1=\E[Y, kc3=\E[6~, - kdch1=\E[3~, kend=\E[4~, kf0=\E[[J, kf1=\E[[A, kf10=\E[21~, - kf11=\E[23~, kf12=\E[24~, kf2=\E[[B, kf3=\E[[C, kf4=\E[[D, - kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, - khome=\E[1~, knp=\E[6~, kpp=\E[5~, use=mgr, + kdch1=\E[3~, kf0=\E[[J, knp=\E[6~, kpp=\E[5~, + use=linux+lockeys, use=vt220+ufkeys, use=xterm+pc+edit, + use=mgr, #### SIMPLETERM # st.suckless.org st|stterm|aka simpleterm, - use=st-0.8, + use=st-0.8.5, + +# Reviewed 0.9.2 (Debian testing package "stterm"): +# Inspected source, saw nothing to change in terminfo. +# +# Reviewed 0.8.5 (Debian stable package "stterm"): +# In tack, +# sends nothing for control- and alt-modifiers to function-keys +# does not support application-mode for numeric keypad +# In vttest, +# identifies as a VT102 +# SRM, DECTCEM and ECH work, but not DECSCA +# incomplete DECSCUSR, shapes work but no blinking cursor +# SD and SL work, but not SL or SR +# supports normal, button-event and any-event mouse +# focus events are unreliable +# Other: +# supports xterm OSC 12, but not 112, so Cs applies but not Cr +# OSC allows ST \E\\ in addition to \007 +st-0.8.5|simpleterm 0.8.5, + Cs=\E]12;%p1%s\007, use=ansi+rep, use=st-0.8, # Reviewed 0.8.2: # In tack, @@ -7335,18 +7471,17 @@ clear=\E[H\E[2J, cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0, - flash=\E[?5h$<100/>\E[?5l, hpa=\E[%i%p1%dG, - ich=\E[%p1%d@, is2=\E[4l\E>\E[?1034l, kDC=\E[3;2~, - kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D, - kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\E[1;2C, ka1=\E[1~, - ka3=\E[5~, kb2=\EOu, kbs=^?, kc1=\E[4~, kc3=\E[6~, kcbt=\E[Z, - kclr=\E[3;5~, kdl1=\E[3;2~, ked=\E[1;5F, kel=\E[1;2F, - khome=\E[1~, kil1=\E[2;5~, kind=\E[1;2B, kmous=\E[M, - kri=\E[1;2A, krmir=\E[2;2~, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, + flash=\E[?5h$<100/>\E[?5l, ich=\E[%p1%d@, + is2=\E[4l\E>\E[?1034l, kDC=\E[3;2~, kEND=\E[1;2F, + kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D, kNXT=\E[6;2~, + kPRV=\E[5;2~, kRIT=\E[1;2C, ka1=\E[1~, ka3=\E[5~, kb2=\EOu, + kbs=^?, kc1=\E[4~, kc3=\E[6~, kcbt=\E[Z, kclr=\E[3;5~, + kdl1=\E[3;2~, ked=\E[1;5F, kel=\E[1;2F, khome=\E[1~, + kil1=\E[2;5~, kind=\E[1;2B, kmous=\E[M, kri=\E[1;2A, + krmir=\E[2;2~, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, op=\E[39;49m, ri=\EM, rmacs=\E(B, rmir=\E[4l, - rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, rs1=\Ec, - rs2=\E[4l\E>\E[?1034l, setab=\E[4%p1%dm, - setaf=\E[3%p1%dm, + rmkx=\E[?1l\E>, rs1=\Ec, rs2=\E[4l\E>\E[?1034l, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6} %=%t3%e%p1%d%;m, setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6} @@ -7354,14 +7489,14 @@ sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%| %t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p7%t;8%;m, smacs=\E(0, smir=\E[4h, smkx=\E[?1h\E=, u8=\E[?1;2c, - vpa=\E[%i%p1%dd, Se=\E[2 q, Ss=\E[%p1%d q, - use=ansi+apparrows, use=ansi+csr, use=ansi+enq, - use=ansi+idl, use=ansi+inittabs, use=ansi+local, - use=ansi+sgrbold, use=vt100+4bsd, use=vt100+pfkeys, - use=vt220+pcedit, use=ecma+index, use=xterm+alt1049, - use=vt220+cvis, use=xterm+sl, use=ecma+italics, - use=ecma+strikeout, use=bracketed+paste, - use=xterm+pcf2, + Se=\E[2 q, Ss=\E[%p1%d q, use=ecma+underline, + use=ecma+standout, use=ansi+apparrows, use=ansi+csr, + use=ansi+enq, use=ansi+idl, use=ansi+inittabs, + use=ansi+local, use=ansi+rca2, use=ansi+sgrbold, + use=vt100+4bsd, use=vt100+pfkeys, use=vt220+pcedit, + use=ecma+index, use=xterm+alt1049, use=vt220+cvis, + use=xterm+sl, use=ecma+italics, use=ecma+strikeout, + use=bracketed+paste, use=xterm+pcf2, # # st-0.1.1 # @@ -7386,19 +7521,16 @@ cols#80, it#8, lines#24, bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=\r, cub1=^H, cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, - dch1=\E[P, ed=\E[J, el=\E[K, home=\E[H, hpa=\E[%i%p1%dG, - ht=^I, ich=\E[%p1%d@, ind=\n, kbs=^?, kdch1=\E[3~, - kend=\E[4~, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, - kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[15~, - kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, - khome=\E[1~, knp=\E[6~, kpp=\E[5~, rev=\E[7m, rmso=\E[m, - rmul=\E[m, + cuu=\E[%p1%dA, cuu1=\E[A, dch1=\E[P, ed=\E[J, el=\E[K, + hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, ind=\n, kbs=^?, + kdch1=\E[3~, kend=\E[4~, khome=\E[1~, knp=\E[6~, kpp=\E[5~, + rev=\E[7m, sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%| %t;7%;m, - sgr0=\E[0m, smso=\E[7m, smul=\E[4m, use=ansi+arrows, - use=ansi+csr, use=ansi+idl, use=vt220+cvis, - use=ecma+index, use=klone+color, use=xterm+acs, + sgr0=\E[0m, use=ansi+arrows, use=ansi+csr, use=ansi+cup, + use=ansi+idl, use=ansi+sgrso, use=ansi+sgrul, + use=vt220+cvis, use=ecma+index, use=klone+color, + use=vt100+pf1-pf4, use=xterm+r5+fkeys, use=xterm+acs, st-16color|stterm-16color|simpleterm with 16-colors, use=ibm+16color, use=st, @@ -7490,25 +7622,24 @@ cols#80, it#8, lines#24, lm#0, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bold=\E[1m, clear=\E[H\E[2J, cr=\r, cub1=^H, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, - dim=\E[2m, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, - flash=^G, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ind=\n, + dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, ed=\E[J, el=\E[K, + el1=\E[1K, enacs=\E(B\E)0, flash=^G, ht=^I, hts=\EH, ind=\n, is1=\E[?47l\E=\E[?1l, is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kbs=^?, - kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, - kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[15~, kf6=\E[17~, - kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[1~, rev=\E[7m, - ri=\EM, rmacs=\E(B, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, + khome=\E[1~, rev=\E[7m, ri=\EM, rmacs=\E(B, rmir=\E[4l, rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, s0ds=\E(B, s1ds=\E(0, sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p5%t;2%;%?%p1%p3%|%t;7 %;m%?%p9%t\E(0%e\E(B%;, - sgr0=\E[m\E(B, smacs=\E(0, smir=\E[4h, smso=\E[7m, - smul=\E[4m, tbc=\E[3g, vpa=\E[%i%p1%dd, use=ansi+arrows, - use=ansi+csr, use=ansi+enq, use=ansi+idl, use=ansi+local, - use=vt220+pcedit, use=ecma+italics, use=ecma+index, + sgr0=\E[m\E(B, smacs=\E(0, smir=\E[4h, smul=\E[4m, + tbc=\E[3g, use=ecma+underline, use=ecma+standout, + use=ansi+arrows, use=ansi+csr, use=ansi+cup, + use=ansi+enq, use=ansi+idl, use=ansi+local, + use=ansi+rca2, use=bracketed+paste, use=ecma+italics, + use=ecma+index, use=vt100+pf1-pf4, use=vt220+cvis, + use=vt220+pcedit, use=xterm+r5+fkeys, use=xterm+256setaf, use=xterm+sl-twm, - use=xterm+alt1049, use=vt220+cvis, use=bracketed+paste, + use=xterm+alt1049, #### TERMINOLOGY # https://www.enlightenment.org/about-terminology @@ -7573,8 +7704,9 @@ kLFT3=\E[1;3D, kLFT4=\E[1;4D, kLFT5=\E[1;5D, kLFT6=\E[1;6D, kLFT7=\E[1;7D, kRIT3=\E[1;3C, kRIT4=\E[1;4C, kRIT5=\E[1;5C, kRIT6=\E[1;6C, - kRIT7=\E[1;7C, kUP=\E[1;2A, use=ansi+enq, use=xterm+pcf0, - use=vt100, use=xterm+256setaf, + kRIT7=\E[1;7C, kUP=\E[1;2A, use=ansi+enq, + use=bracketed+paste, use=xterm+pcf0, use=vt100, + use=xterm+256setaf, # 2017-11-11: # Tested terminology 1.0.0 @@ -7607,7 +7739,7 @@ # italics and crossed-out text work # no meta mode # vttest - -# DA1 says this is a VT420 with with 132 columns, NRCS, horizontal scrolling +# DA1 says this is a VT420 with 132 columns, NRCS, horizontal scrolling # DA2 says this is a VT510, version 33.7 # NRCS does not work, program hangs in the locking shift test. # some of the VT420 rectangle operations work @@ -7690,7 +7822,8 @@ alacritty+common|base fragment for alacritty, km@, npc, kb2=\EOE, kcbt=\E[Z, kent=\EOM, Se=\E[0 q, - Smulx=\E[4:%p1%dm, use=ecma+index, use=xterm+focus, + Smulx=\E[4:%p1%dm, rv=\E\\[>0;25[0-9][0-9];1c, + use=ecma+index, use=report+da2, use=xterm+focus, use=xterm+sm+1006, use=xterm-basic, use=xterm+app, use=ansi+rep, use=xterm+tmux, use=ecma+strikeout, use=xterm+sl-twm, use=ecma+italics, use=xterm+pce2, @@ -7700,7 +7833,7 @@ # derived from alacritty rio|fork of alacritty, use=alacritty, -rio-direct|fork of alacritty, +rio-direct|rio with direct-colors, use=alacritty-direct, #### Kitty @@ -7825,22 +7958,24 @@ acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxy yzz{{||}}~~, bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=\r, cub1=^H, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, - dim=\E[2m, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, - flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG, - ich=\E[%p1%d@, ind=\n, kBEG=\E[1;2E, kbeg=\EOE, kbs=^?, - kcbt=\E[Z, op=\E[39;49m, rev=\E[7m, ri=\EM, rmacs=\E(B, - rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l, rmso=\E[27m, - rmul=\E[24m, rs1=\E]\E\\\Ec, + dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, ech=\E[%p1%dX, + ed=\E[J, el=\E[K, el1=\E[1K, flash=\E[?5h$<100/>\E[?5l, + ich=\E[%p1%d@, ind=\n, kBEG=\E[1;2E, kbeg=\EOE, kcbt=\E[Z, + op=\E[39;49m, rev=\E[7m, ri=\EM, rmacs=\E(B, rmam=\E[?7l, + rmir=\E[4l, rmkx=\E[?1l, rs1=\E]\E\\\Ec, sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%; %?%p1%p3%|%t;7%;m, sgr0=\E(B\E[m, smacs=\E(0, smam=\E[?7h, smir=\E[4h, - smkx=\E[?1h, smso=\E[7m, smul=\E[4m, vpa=\E[%i%p1%dd, - Smulx=\E[4:%p1%dm, use=ansi+csr, use=ansi+enq, - use=ansi+idl, use=ansi+inittabs, use=ansi+local, + smkx=\E[?1h, Smulx=\E[4:%p1%dm, + rv=\E\\[>1;4[0-9][0-9][0-9];41c, + xr=\EP>\\|kitty\\([0-9]+\\.[0-9]+\\.[0-9]+\\)\E\\ + \\, + use=ansi+csr, use=ansi+cup, use=ansi+enq, use=ansi+idl, + use=ansi+inittabs, use=ansi+local, use=ansi+rca2, use=ansi+rep, use=xterm+focus, use=xterm+sm+1006, - use=ecma+index, use=xterm+pcfkeys, use=xterm+sl-twm, - use=ecma+strikeout, use=ecma+italics, + use=ecma+index, use=ecma+strikeout, use=ecma+italics, + use=ecma+standout, use=ecma+underline, use=linux+kbs, + use=report+da2, use=xterm+pcfkeys, use=xterm+sl-twm, use=xterm+alt1049, use=att610+cvis, use=xterm+tmux, use=bracketed+paste, use=report+version, @@ -7852,7 +7987,15 @@ #### Foot # https://codeberg.org/dnkl/foot/ -# Version 1.8.2 +# Version 1.18.1 2024/08/17 +# +# vttest: +# device attributes list 28=rectangular editing +# supports rectangle operations, but problems with left/right margins +# reports window-size, but not icon or window label +# numeric keypad has no application-mode +# +# Version 1.8.2 2021/07/31 # # This identifies as a VT220 with 4=sixel and 22=color, however: # tack: @@ -7871,7 +8014,7 @@ # otherwise few reports, except cursor-position and mouse and some dtterm # VT520 cursor-movement works, except for left/right margins # supports xterm/DECSCUSR, though default case in vttest does not blink -# Send: <27> [ 0 <32> q +# Send: <27> [ 0 <32> q # Text: The cursor should be a blinking rectangle # partial support for xterm mouse any-event mode and button-event mode: # + does not report focus-in/focus-out @@ -7889,20 +8032,24 @@ bel=^G, clear=\E[H\E[2J, cr=\r, cub1=^H, cud1=\n, dim=\E[2m, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, flash=\E]555\E\\, ind=\n, is2=\E[!p\E[4l\E>, kbs=^?, - kcbt=\E[Z, oc=\E]104\E\\, op=\E[39;49m, ri=\EM, - rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, + kcbt=\E[Z, nel=\EE, oc=\E]104\E\\, op=\E[39;49m, ri=\EM, + rmam=\E[?7l, rmkx=\E[?1l\E>, rmm=\E[?1036h\E[?1034l, rs1=\Ec, rs2=\E[!p\E[4l\E>, sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%; %?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, - sgr0=\E(B\E[m, smam=\E[?7h, smkx=\E[?1h\E=, E3=\E[3J, - use=att610+cvis, use=ansi+csr, use=ansi+cup, - use=ansi+enq, use=ansi+local, use=ansi+idc, use=ansi+idl, - use=ansi+rca2, use=ansi+rep, use=ansi+tabs, - use=ansi+sgrbold, use=ecma+index, use=ecma+italics, - use=ecma+strikeout, use=xterm+acs, use=xterm+alt+title, - use=xterm+pcfkeys, use=xterm+sm+1006, use=xterm+tmux2, - use=xterm+sl-alt, use=bracketed+paste, - use=report+version, use=xterm+focus, + sgr0=\E(B\E[m, smam=\E[?7h, smkx=\E[?1h\E=, + smm=\E[?1036l\E[?1034h, E3=\E[3J, Smulx=\E[4:%p1%dm, + rv=\E\\[>1;[0-9];0c, + xr=\EP>\\|foot\\([0-9][.0-9](-.*)?\\)?\E\\\\, + use=ecma+underline, use=ecma+standout, use=att610+cvis, + use=ansi+csr, use=ansi+cup, use=ansi+enq, use=ansi+local, + use=ansi+idc, use=ansi+idl, use=ansi+rca2, use=ansi+rep, + use=ansi+tabs, use=ansi+sgrbold, use=ecma+index, + use=ecma+italics, use=ecma+strikeout, use=kitty+setal, + use=xterm+acs, use=xterm+alt+title, use=xterm+pcfkeys, + use=xterm+sm+1006, use=xterm+tmux2, use=xterm+sl-alt, + use=bracketed+paste, use=report+version, + use=xterm+focus, ######## WEB CLIENTS @@ -7918,6 +8065,30 @@ # it can connect to, and display in, a web browser, or as a standalone Qt # application. Either way, it displays in the current desktop session. # +# Testing AppImage for 3.2.0, on Fedora 40: +# + appears to implement erase-display by painting a double-line on the screen, +# doesn't use full screen for ded though it sort-of works for vi. +# + sets TERMINFO in its shell (imitating iTerm2), and TERM=domterm-xterm which +# doesn't work when doing sudo. According to the git log, that was April 1, +# 2023. The VTE developers copied the feature (i.e., a partially workable +# private terminal database) in February 2024. +# + the canonical name for the terminal description is still "domterm", and +# presumably the "domterm-xterm" alias is a workaround for hardcoded scripts +# that look for "xterm". +# + almost all of the differences between ncurses's "domterm" and DomTerm's +# are additions, but (read further) most are untestable due to breakage in +# the program. +# + DomTerm's updated terminal description says it implements italics, but +# + hangs in tack when doing blink (just before testing italics) +# + vttest, ncurses test-program also fare badly, e.g., due to improper line +# wrapping and/or inability to consistently clear the screen. +# +# The review of DomTerm 3.2.0 was prompted by noticing this page +# https://domterm.org/Wire-byte-protocol.html +# which goes on at length for extensions which collide with a commonly-used +# control for restoring a saved cursor position: +# CSI u Restore cursor (SCORC, also ANSI.SYS). +# # Testing current code (2019/07/06) with Fedora 30: # tack # no flash @@ -7956,13 +8127,87 @@ bel@, blink@, dim@, invis@, kcbt=\E[Z, ritm@, rmkx=\E[?1l, sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%| %t;7%;m, - sitm@, smkx=\E[?1h, use=linux+kbs, use=xterm+256setaf, - use=ecma+index, use=xterm+focus, use=xterm+sm+1006, - use=xterm+pcfkeys, use=xterm-basic, - use=bracketed+paste, + sitm@, smkx=\E[?1h, rv=\E\\[>990;[0-9];0c, + xr=\EP>\\|DomTerm\\([0-9][.0-9]\\)?\E\\\\, + use=bracketed+paste, use=linux+kbs, use=xterm+256setaf, + use=ecma+index, use=report+da2, use=report+version, + use=xterm+focus, use=xterm+sm+1006, use=xterm+pcfkeys, + use=xterm-basic, ######## Miscellaneous +#### pangoterm +# https://www.leonerd.org.uk/code/pangoterm/ +# https://github.com/bfredl/pangoterm +# https://github.com/neovim/libvterm +# +# which says: +# "A GTK/Pango-based terminal that uses libvterm to provide terminal +# emulation." +# +# This probably has few users, because it cannot put the cursor reliably in the +# right place (i.e., it appears several columns to the right). It is included +# here because it implements what Evans refers to as "fixterms" but sets TERM +# to "xterm". +# +# vttest: +# - no 80/132 column mode +# - no blink mode +# - no protected modes +# - fails wrapping tests +# - no VT52 +# - responds to ENQ with illegal character +# - no SRM +# - no origin mode +# - identifies as VT100 with AVO +# - responds to secondary DA as \E[>0;100;0c +# - responds to DECREQTPARM with illegal character +# - no application-keypad +# - has application cursor-keys +# - backspace key sends DEL, does not support toggle for BS +# - keyboard does not provide LF +# - has DECTCEM and ECH +# - has REP, SD and SL +# - has CBT, CHT, CNL, CPL +# - has ISO 6429 colors +# - BCE tests partially work (text is cleared incorrectly) +# - lacks any other VT220 or higher features. +# - xterm mouse except for modes 9 and 1001 +# wraptest: +# - 6/25 differences from xterm +# tack: +# - no dim mode +# - no invisible mode +# - has italics +# - has strike-out mode +pangoterm|terminal using libvterm, + am, bce, mir, msgr, npc, xenl, AX, XT, + colors#8, cols#80, lines#24, pairs#64, + bel=^G, blink@, clear=\E[H\E[2J, cr=\r, cub1=^H, cud1=\n, + dch=\E[%p1%dP, dch1=\E[P, ech=\E[%p1%dX, ed=\E[J, el=\E[K, + el1=\E[1K, flash=\E[?5h$<100/>\E[?5l, ich=\E[%p1%d@, + ind=\n, invis@, is2=\E[!p, kbs=^?, kcbt=\E[Z, nel=\EE, + op=\E[39;49m, ri=\EM, rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l, + rs1=\Ec, rs2=\E[!p, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%| + %t;7%;m, + sgr0=\E(B\E[m, smam=\E[?7h, smir=\E[4h, smkx=\E[?1h, + rv=\E\\[>0;100;0c, use=ecma+underline, + use=ecma+standout, use=ecma+index, use=ansi+rep, + use=ecma+strikeout, use=xterm+pcfkeys, + use=bracketed+paste, use=vt420+lrmm, use=xterm+focus, + use=xterm+sm+1006, use=ecma+italics, use=ansi+csr, + use=ansi+cup, use=ansi+enq, use=ansi+idl, + use=ansi+inittabs, use=ansi+local, use=ansi+rca2, + use=ansi+sgrbold, use=xterm+alt+title, use=att610+cvis, + use=xterm+acs, + +pangoterm-256color|pangoterm with 256-colors, + use=xterm+256setaf2, use=pangoterm, + +pangoterm-direct|pangoterm with direct-colors, + use=xterm+direct, use=pangoterm, + #### WezTerm # https://wezfurlong.org/wezterm/ # https://github.com/wez/wezterm @@ -7971,6 +8216,27 @@ # "wezterm is a terminal emulator with support for modern features # such as fonts with ligatures, hyperlinks, tabs and multiple windows." # +# The documentation bears mention. It refers to the "ANSI" standard and +# https://wezfurlong.org/wezterm/what-is-a-terminal.html#ansi-and-ecma-48 +# X3.64 (withdrawn long ago). A related website +# https://github.com/wez/ecma48 +# states that ECMA-48 was issued in 1979 and not revised since. Actually that +# was the second revision; the fifth revision in 1991 is current. The source +# code refers to the second revision in a half-dozen places. Further, there +# are three times as many references to Wikipedia as to xterm's documentation. +# The git commit comments in several instances hint at an incomplete reading +# of the relevant standards. +# +# wezterm-20240203-110809-5046fc22 tested with MacOS +# General: +# + initial screensize is now 80x24 +# tack: +# + no change +# wraptest: +# + erasures (EL, ED, DCH, ICH, ESC) do not cancel wrap +# vttest: +# + some of the problems with debris have been fixed +# # wezterm-20230712_072601_f4abf8fd-1.fedora38.x86_64 # tested with MacOS and Fedora 38/39. # @@ -7995,7 +8261,7 @@ # + poor (doesn't copy anyone, most of the results are wrong) # vttest: # + DA is VT5xx with sixel, selective erase, user windows, color -# + DA2 is VT220 version 277 +# + DA2 is VT220 version 277, perhaps a reference to xterm #277 # + only the VT100 character set works, contrary to DA/DA2. # + no NRCS, either # + double-sized character work, with some debris @@ -8017,9 +8283,28 @@ # + implements xterm normal, any-event and button-event mouse, none of the rest # + reports window size, none of the other window reports wezterm|Wez's Terminal Emulator, - km@, xenl@, - cvvis@, rmkx=\E[?1l, rmm@, smkx=\E[?1h, smm@, - use=xterm-256color, + am, bce, km, mir, msgr, npc, xenl, + bel=^G, bold=\E[1m, cr=\r, cub1=^H, cud1=\n, ech=\E[%p1%dX, + el1=\E[1K, flash=\E[?5h$<100/>\E[?5l, ind=\n, + is2=\E[!p\E[?3;4l\E[4l\E>, kbs=^?, kcbt=\E[Z, kend=\EOF, + op=\E[39;49m, ri=\EM, rmam=\E[?7l, rmkx=\E[?1l\E>, + rs1=\Ec\E]104\007, rs2=\E[!p\E[?3;4l\E[4l\E>, + sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%; + %?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, + sgr0=\E(B\E[m, smam=\E[?7h, smkx=\E[?1h\E=, Smol=\E[53m, + Smulx=\E[4:%p1%dm, rv=\E\\[>1;277;0c, + xr=\EP>\\|WezTerm ([0-9]+)(-[[:xdigit:]]+)+\E\\\\, + use=ecma+underline, use=ecma+standout, + use=ansi+apparrows, use=ansi+csr, use=ansi+cup, + use=ansi+enq, use=ansi+erase, use=ansi+idc, use=ansi+idl, + use=ansi+inittabs, use=ansi+local, use=ansi+rca2, + use=ansi+rep, use=ansi+sgrdim, use=bracketed+paste, + use=ecma+index, use=ecma+italics, use=ecma+strikeout, + use=report+da2, use=report+version, use=vt220+cvis, + use=xterm+256color2, use=xterm+acs, + use=xterm+alt+title, use=xterm+focus, use=xterm+pcc2, + use=xterm+pce2, use=xterm+pcf2, use=xterm+sl-alt, + use=xterm+sm+1006, use=xterm+tmux, #### Contour # https://github.com/contour-terminal/contour @@ -8034,6 +8319,21 @@ # - cannot run, because the package is not signed. # # Fedora rawhide +# contour-terminal-0.6.1.7494-2.fc42.x86_64 +# - most core dumps are finally gone, works when 3D acceleration is disabled. +# - fails mir and related "in" tests in tack. +# - function-keys do not match developer's version. +# - sitm/ritm (italics) still do not work. +# - private mode 12 (cursor) does not work. +# - source code references Unicode values to a page which has none: +# https://vt100.net/docs/vt102-ug/chapter5.html#T5-13 +# (actual source for this information is xterm) +# - identifies as a VT525 with sixel graphics, UDK, rectangle editing and color. +# - adds a control sequence to retrieve contents of entire screen. +# - dumps core in vttest for rectangle editing +# - UDK feature does not work +# - fails vttest for REP, SL, SR, CBT, CHT, VPR +# - sixel feature needs some work (most of my testcases do not work) -TD # contour-terminal-0.3.12.262-6.fc39.x86_64 # - dumps core, cannot test # @@ -8075,32 +8375,198 @@ # # Developer's terminfo (compiled-in) uses some extensions. contour|contour-latest|Contour Terminal Emulator, - am, bce, eslok, hs, km, mc5i, mir, msgr, npc, xenl, xvpa, + am, bce, mc5i, msgr, npc, xenl, xvpa, AX, XT, cols#80, lines#24, pairs#0x7fff, - bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=\r, cub1=^H, cud1=\n, - dim=\E[2m, dsl=\E[$~, ech=\E[%p1%dX, el1=\E[1K, - flash=\E[?5h$<100/>\E[?5l, fsl=\E[$}, hpa=\E[%i%p1%dG, - ind=\n, indn=\E[%p1%dS, invis=\E[8m, ka1=, ka3=, kbs=^?, kc1=, - kc3=, kcbt=\E[Z, kend=\EOF, khlp=, kmous=\E[M, kund=, - oc=\E]104\E\\, op=\E[39;49m, rev=\E[7m, ri=\EM, - rin=\E[%p1%dT, rmam=\E[?7l, rmkx=\E[?1l, rmso=\E[27m, - rmul=\E[24m, rs1=\E]\E\\\Ec, - sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%| - %t;7%;%?%p4%t;5%;%?%p7%t;8%;m, - sgr0=\E(B\E[m, smam=\E[?7h, smkx=\E[?1h, smso=\E[7m, - smul=\E[4m, tsl=\E[2$~\E[1$}\E[H\E[2J, vpa=\E[%i%p1%dd, + bel=^G, clear=\E[H\E[2J, cr=\r, cub1=^H, cud1=\n, dim=\E[2m, + ech=\E[%p1%dX, el1=\E[1K, flash=\E[?5h$<100/>\E[?5l, + ind=\n, ka1=, ka3=, kbs=^?, kc1=, kc3=, kcbt=\E[Z, kend=\EOF, + kf13=\E[O2P, kf14=\E[O2Q, kf15=\E[O2R, kf16=\E[O2S, + kf25=\E[O5P, kf26=\E[O5Q, kf27=\E[O5R, kf28=\E[O5S, + kf37=\E[O6P, kf38=\E[O6Q, kf39=\E[O6R, kf40=\E[O6S, + kf49=\E[O3P, kf50=\E[O3Q, kf51=\E[O3R, kf52=\E[O3S, + kf61=\E[O4P, kf62=\E[O4Q, kf63=\E[O4R, khlp=, kmous=\E[M, + kund=, oc=\E]104\E\\, op=\E[39;49m, ri=\EM, rmam=\E[?7l, + rmkx=\E[?1l, rs1=\E]\E\\\Ec, + sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p5%t;2%; + %?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, + sgr0=\E(B\E[m, smam=\E[?7h, smkx=\E[?1h, Cs=\E]12;%p1%s\E\\, E3=\E[3J, Rmol=\E[55m, Se=\E[ q, Smol=\E[53m, Smulx=\E[4:%p1%dm, Ss=\E[%p1%d q, + xr=\EP>\\|contour ([0-9]\\.[0-9]\\.[0-9])\E\\\\, + use=ecma+underline, use=ecma+standout, use=ansi+apparrows, use=ansi+cup, use=ansi+csr, - use=ansi+erase, use=ansi+idc, use=ansi+idl, - use=ansi+inittabs, use=ansi+local, use=ansi+rep, - use=att610+cvis, use=ecma+italics, use=ecma+strikeout, + use=ansi+enq, use=ansi+erase, use=ansi+idc, use=ansi+idl, + use=ansi+inittabs, use=ansi+local, use=ansi+rca2, + use=ansi+sgrbold, use=bracketed+paste, use=dec+sl, + use=ecma+index, use=vt220+cvis, use=ecma+strikeout, use=xterm+256color, use=xterm+acs, use=xterm+alt1049, use=xterm+pcc2, use=xterm+pce2, use=xterm+pcf2, + use=report+version, contour-direct|Contour terminal with direct colors, use=xterm+direct, use=contour, +#### Ghostty +# https://github.com/ghostty-org/ghostty +# +# Its readme and man page begin with a lot of hype, concluding with +# +# While aiming for this ambitious goal, our first step is to make Ghostty +# one of the best fully standards compliant terminal emulator, remaining +# compatible with all existing shells and software while supporting all +# of the latest terminal innovations in the ecosystem. You can use +# Ghostty as a drop-in replacement for your existing terminal emulator. +# +# However, it uses xterm as a standard: +# +# We believe Ghostty is one of the most compliant terminal emulators +# available. Terminal behavior is partially a de jure standard (i.e. +# [ECMA-48](https://ecma-international.org/publications-and-standards/stand> +# but mostly a de facto standard as defined by popular terminal emulators +# worldwide. Ghostty takes the approach that our behavior is defined by +# (1) standards, if available, (2) xterm, if the feature exists, (3) +# other popular terminals, in that order. This defines what the Ghostty +# project views as a "standard." +# +# while xterm uses ECMA-48 and DEC 070 along with related documentation such as +# the DEC terminal reference manuals. xterm's documentation does not attempt +# to duplicate those sources of information, so that developers should rely +# upon both xterm's documentation and the published standards. +# +# Comments in ghostty's source code and commits demonstrate that the developers +# study xterm's source code closer than xterm's documentation. The quote above +# is the only mention of ECMA-48. +# +# ghostty 1.1.0 tested with Arch Linux: +# ------------- +# The issue with vttest is repaired. Other issues remain. The reader may not +# have noticed, but the ghostty developers disallow direct bug reports. +# Quoting the developers: +# +# https://github.com/ghostty-org/ghostty/issues/3558 +# Users are not allowed to create Issues directly in this repository - we +# ask that you create a Discussion first. +# ... +# Any Discussion which clearly identifies a problem in Ghostty and can be +# confirmed or reproduced will be converted to an Issue by a maintainer, +# so as a user finding a valid problem you don't do any extra work +# anyway. Thank you. +# +# As a direct consequence, details and attribution in those "Discussion" notes +# may be omitted, as in this instance. +# +# https://web.archive.org/web/20250124124041/https://github.com/ghostty-org/ghostty/issues/2542 +# ghostty #2542 Publish ghostty terminfo to ncurses terminal database +# Opened October 30, 2024, this terminal description is mentioned December 31. +# +# https://web.archive.org/web/20250115170223/https://github.com/ghostty-org/ghostty/issues/4523 +# ghostty #4523 Renderers (Metal and OpenGL) should clip terminal if terminal +# grid size mismatches physical window +# Opened January 3, 2025, with a note +# The only known way to trigger this is DECCOLM, so it's low priority +# since almost nothing uses this. But notably vtetest uses this and it +# makes it appear like we perform much worse than we do. +# +# Issue #4523 does not mention the bug report (nor, as in some other instances +# refer obliquely to a discussion on "Discord"). vttest sends a DECCOLM to +# ensure that the screen is not in 132-column mode. That is the case for the +# testing reported. If ghostty were implementing DECCOLM correctly, it would +# not have decided that the screensize changed. The fix in #4523 is a +# workaround masking other potential issues. +# +# By the way, that should be "vttest" (there is no such program as "vtetest"). +# +# ghostty 1.0.0 tested with Arch Linux: +# ------------- +# tack: +# - does not implement blinking text +# - does not implement meta mode (kmm). +# - implements VT100-style alternate character set +# - testing video-attributes unexpectedly clears the display before acsc +# - italics and strike-out work +# - function-keys mostly match; however because this client (unlike X11 +# clients) does not work with a remote display, some (such as control/alt key +# combinations, and the shifted editing keys) are untestable because +# - numeric keypad does not send VT100-style escapes +# wraptest: +# - matches xterm +# vttest: +# - ghostty hangs in more than one menu, making it impossible to test more than +# a small part of the program. In particular, these are untestable: +# 1. Test of cursor movements +# 2. Test of screen features +# 4. Test of double-sized characters +# - ghostty has tabs (imitating gnome-terminal); when closing a tab with a +# running process (e.g., a hung vttest), ghostty does not prompt about the +# process to be killed. +# - identifies as a "VT220 with color": +# <27> [ ? 6 2 ; 2 2 c +# - although claiming to be a VT220, it does not support NRCS. Actually, it +# fails the VT100 character set test as well. This is a complete failure: +# 3. Test of character sets +# - it does not hang in this menu entry: +# 8. Test of VT102 features (Insert/Delete Char/Line) +# although because it does not implement double-sized characters, most of +# that test counts as a failure. +# - implements VT220 DECTCEM and ECH, but not SRM or DECSCA +# - implements VT420 left/right margins +# - does not implement VT420 rectangle operations +# - does not implement 8-bit controls +# - does implement ISO-6429 cursor-movement +# - supports BCE partially: ED/EL work, but not ECH and indexing. +# - does not support blinking text +# - responds to XTVERSION +# - responds to DECRPM controls, though many are "unknown" +# - does not respond to most DECRQSS except for SGR, DECSCUSR, DECSTBM +# - implements most of xterm mouse protocol except for +# - Mouse Highlight Tracking +# - DEC Locator Events +# - some window reporting works: +# 14 - size of text area in pixels +# 16 - size of character in pixels +# 18 - size of window in chars +# 21 - report window label +# - window-modifying does not work +# - cursor position is incorrect after switching to/from alternate screen +# +# The developers set "Tc" in their terminal description to hint that it +# supports direct-colors, but the feature did not work with this version -TD +ghostty|Ghostty terminal emulator, + am, bce, km, mc5i, mir, msgr, npc, xenl, AX, XT, + cols#80, lines#24, pairs#0x7fff, + acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxy + yzz{{||}}~~, + bel=^G, bold=\E[1m, clear=\E[H\E[2J, + cnorm=\E[?12l\E[?25h, cr=\r, cub1=^H, cud1=\n, + cvvis=\E[?12;25h, dim=\E[2m, ech=\E[%p1%dX, el1=\E[1K, + flash=\E[?5h$<100/>\E[?5l, ind=\n, invis=\E[8m, kbs=^?, + kcbt=\E[Z, kend=\EOF, kent=\EOM, op=\E[39;49m, rev=\E[7m, + ri=\EM, rmam=\E[?7l, rmcup=\E[?1049l, rmkx=\E[?1l\E>, + rmso=\E[27m, rmul=\E[24m, rs1=\E]\E\\\Ec, + setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48; + 5;%p1%d%;m, + setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5 + ;%p1%d%;m, + sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%| + %t;7%;%?%p5%t;2%;%?%p7%t;8%;m, + sgr0=\E(B\E[m, smam=\E[?7h, smcup=\E[?1049h, + smkx=\E[?1h\E=, E3=\E[3J, Ms=\E]52;%p1%s;%p2%s\007, + Se=\E[2 q, Smulx=\E[4:%p1%dm, Ss=\E[%p1%d q, + rv=\E\\[>[0-9];[0-9];[0-9]c, + xr=\EP>\\|ghostty %[0-9.]([[:print:]])*\E\\\\, + use=linux+kbs, use=ansi+apparrows, use=ansi+csr, + use=ansi+cup, use=ansi+enq, use=ansi+erase, use=ansi+idc, + use=ansi+idl, use=ansi+inittabs, use=ansi+local, + use=ansi+rca2, use=ansi+rep, use=ansi+sgrso, + use=ansi+sgrul, use=ansi+tabs, use=ecma+index, + use=ecma+italics, use=ecma+strikeout, + use=report+version, use=vt220+cvis, + use=xterm+256color2, use=xterm+acs, + use=xterm+alt+title, use=bracketed+paste, + use=kitty+setal, use=vt420+lrmm, use=xterm+focus, + use=xterm+pce2, use=xterm+pcc2, use=xterm+pcf2, + use=xterm+sm+1006, use=xterm+sl-twm, + ######## UNIX VIRTUAL TERMINALS, VIRTUAL CONSOLES, AND TELNET CLIENTS # @@ -8133,24 +8599,23 @@ am, mir, xenl, cols#80, lines#24, bel=^G, bold=\E[1m, cr=\r, csr=\E[%i%p1%d;%p2%dr, cub1=^H, - cud1=\n, cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, - el1=\E[1K, home=\E[H, ht=^I, ich=\E[%p1%d@, ind=\n, - rev=\E[7m, rmir=\E[4l, rmso=\E[m, rmul=\E[m, sgr0=\E[m, - smir=\E[4h, smso=\E[7m, smul=\E[4m, use=ansi+cpr, - use=ansi+erase, use=ansi+idl, use=ansi+local, - use=xterm+alt47, + cud1=\n, dch=\E[%p1%dP, dch1=\E[P, el1=\E[1K, ht=^I, + ich=\E[%p1%d@, ind=\n, rev=\E[7m, rmir=\E[4l, sgr0=\E[m, + smir=\E[4h, use=ansi+cpr, use=ansi+cup, use=ansi+erase, + use=ansi+idl, use=ansi+local, use=ansi+sgrso, + use=ansi+sgrul, use=xterm+alt47, # The codes supported by the term.el terminal emulation in GNU Emacs 22.2 eterm-color|Emacs term.el terminal emulator term-protocol-version 0.96, msgr, colors#8, pairs#64, - kbs=^?, khome=\E[1~, op=\E[39;49m, ri=\EM, rmso=\E[27m, - rmul=\E[24m, rs1=\Ec, setab=\E[%p1%'('%+%dm, - setaf=\E[%p1%{30}%+%dm, + kbs=^?, khome=\E[1~, op=\E[39;49m, ri=\EM, rs1=\Ec, + setab=\E[%p1%'('%+%dm, setaf=\E[%p1%{30}%+%dm, sgr=\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p6%t;1%;%? %p7%t;8%;m, - sgr0=\E[m, use=ansi+apparrows, use=ansi+csr, - use=ansi+sgr, use=vt220+pcedit, use=eterm, + sgr0=\E[m, use=ecma+underline, use=ecma+standout, + use=ansi+apparrows, use=ansi+csr, use=ansi+sgr, + use=vt220+pcedit, use=eterm, # shell.el can "do" color, though not nearly as well. # @@ -8168,9 +8633,8 @@ dumb-emacs-ansi|Emacs dumb terminal with ANSI color codes, am, hc, it#8, ncv#13, - bold=\E[1m, cud1=\n, ht=^I, ind=\n, op=\E[39;49m, - rmul=\E[24m, sgr0=\E[m, smul=\E[4m, use=ecma+italics, - use=klone+color, + bold=\E[1m, cud1=\n, ht=^I, ind=\n, op=\E[39;49m, sgr0=\E[m, + use=ecma+underline, use=ecma+italics, use=klone+color, #### Screen @@ -8249,25 +8713,23 @@ ncv@, U8#1, acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxy yzz{{||}}~~, - blink=\E[5m, bold=\E[1m, civis=\E[?25l, - cnorm=\E[34h\E[?25h, cub1=^H, cud1=\n, + blink=\E[5m, bold=\E[1m, cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, cuu1=\EM, cvvis=\E[34l, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, el1=\E[1K, flash=\Eg, - hpa=\E[%i%p1%dG, ich=\E[%p1%d@, indn=\E[%p1%dS, is2=\E)0, - kbs=^?, kcbt=\E[Z, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, - kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[15~, - kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + ich=\E[%p1%d@, indn=\E[%p1%dS, is2=\E)0, kbs=^?, kcbt=\E[Z, khome=\E[1~, kmous=\E[M, nel=\EE, rev=\E[7m, ri=\EM, - rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[23m, rmul=\E[24m, + rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[23m, rs2=\Ec\E[?1000l\E[?25h, sgr=\E[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t; 5%;%?%p5%t;2%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[3m, - smul=\E[4m, vpa=\E[%i%p1%dd, E0=\E(B, S0=\E(%p1%c, + E0=\E(B, S0=\E(%p1%c, use=ecma+underline, use=ansi+apparrows, use=ansi+csr, use=ansi+erase, use=ansi+idl, use=ansi+inittabs, use=ansi+local, - use=xterm+kbs, use=vt220+pcedit, use=xterm+alt1049, - use=ecma+color, use=vt100+enq, use=vt100+4bsd, + use=ansi+rca2, use=bracketed+paste, use=ecma+color, + use=vt100+pf1-pf4, use=vt220+pcedit, use=xterm+alt1049, + use=xterm+kbs, use=vt100+enq, use=vt100+4bsd, + use=xterm+r5+fkeys, use=wyse+cvis, screen|VT 100/ANSI X3.64 virtual terminal, use=screen4, @@ -8335,7 +8797,7 @@ # ====================================================================== -# Read the fine manpage: +# Read the fine man page: # When screen tries to figure out a terminal name for # itself, it first looks for an entry named "screen.", # where is the contents of your $TERM variable. If @@ -8343,12 +8805,11 @@ # if the terminal is wide (132 cols or more)). If even this # entry cannot be found, "vt100" is used as a substitute. # -# Notwithstanding the manpage, screen uses its own notion of the termcap +# Notwithstanding the man page, screen uses its own notion of the termcap # and some keys from "screen." are ignored. Here is an entry which # covers those (tested with screen 4.00.02) -TD screen+fkeys|function-keys according to screen, - kend=\E[4~, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kfnd@, - khome=\E[1~, kslt@, + kend=\E[4~, kfnd@, khome=\E[1~, kslt@, use=vt100+pf1-pf4, # See explanation before "screen" entry. Cancel italics so that applications # do not assume screen supports the feature. Add this tweak to entries which @@ -8474,23 +8935,22 @@ ed=\E[J, el=\E[K, ich1=, ind=\n, kbs=^H, kf0=\E~, kf1=\ES, kf2=\ET, kf3=\EU, kf4=\EV, kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, kf9=\E0I, khome=\EH, nel=\r\n, rc=\E8, ri=\EM, rmso=\E[23m, - rmul=\E[24m, rs1=\Ec, sc=\E7, sgr0=\E[m, smso=\E[3m, - smul=\E[4m, use=ansi+idc, use=ansi+idl, - use=ansi+inittabs, use=ansi+local, use=vt52+arrows, + rs1=\Ec, sc=\E7, sgr0=\E[m, smso=\E[3m, use=ecma+underline, + use=ansi+idc, use=ansi+idl, use=ansi+inittabs, + use=ansi+local, use=vt52+arrows, # (screen3: removed unknown ":xv:LP:G0:" -- esr) screen3|VT 100/ANSI X3.64 virtual terminal (old 3.x), km, mir, msgr, cols#80, lines#24, bel=^G, blink=\E[5m, bold=\E[1m, cr=\r, cub1=^H, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, cuu1=\EM, dch=\E[%p1%dP, - dch1=\E[P, home=\E[H, ich=\E[%p1%d@, ind=\n, is2=\E)0, - kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, - kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=\EE, rev=\E[7m, - ri=\EM, rmir=\E[4l, rmkx=\E>, rmso=\E[23m, rmul=\E[24m, - rs1=\Ec, sgr0=\E[m, smir=\E[4h, smkx=\E=, smso=\E[3m, - smul=\E[4m, use=ansi+csr, use=ansi+erase, use=ansi+idl, - use=ansi+inittabs, use=ansi+local, + cuu1=\EM, dch=\E[%p1%dP, dch1=\E[P, ich=\E[%p1%d@, ind=\n, + is2=\E)0, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, + kcuu1=\EOA, nel=\EE, rev=\E[7m, ri=\EM, rmir=\E[4l, rmkx=\E>, + rmso=\E[23m, rs1=\Ec, sgr0=\E[m, smir=\E[4h, smkx=\E=, + smso=\E[3m, use=ecma+underline, use=ansi+csr, + use=ansi+cup, use=ansi+erase, use=ansi+idl, + use=ansi+inittabs, use=ansi+local, use=vt100+pf1-pf4, # screen 4.0 was released 2003-07-21, and as of March 2019, its terminfo file # was last updated in 2009 to include 256-color support. The most recent @@ -8498,23 +8958,20 @@ screen4|VT 100/ANSI X3.64 virtual terminal (4.x), use=ecma+index, use=screen-base, -# As of December 2022, screen 5.0 has not been released. -# -# However, +# screen 5.0 was released in August 2024. As of May 2025, few systems use it. # # https://savannah.gnu.org/bugs/?36676 # -# mentions a change to implement italics which should be in a version 5, -# (implemented 2016-11-05, but merged 2017-07-09). That does away with the -# longstanding use of SGR 3 for standout, and interprets it as italics. +# mentions a change to implement italics (implemented 2016-11-05, merged +# 2017-07-09), this may do away with the longstanding use of SGR 3 for +# standout, interpreting it as italics. # -# The same development branch has some support for direct-colors, but none -# of this has been documented. -screen5|VT 100/ANSI X3.64 virtual terminal (someday), - rmso=\E[27m, +# This version has limited support for direct-colors, but does not use the +# outer terminal's $TERM in deciding if or how to apply this. +screen5|VT 100/ANSI X3.64 virtual terminal (5.x), sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%? %p5%t;2%;m%?%p9%t\016%e\017%;, - smso=\E[7m, use=ecma+italics, use=ecma+index, + use=ecma+standout, use=ecma+italics, use=ecma+index, use=screen-base, #### Tmux @@ -8528,10 +8985,10 @@ # various entries such as screen.xterm-new provide a way to more closely # match the terminal. tmux|tmux terminal multiplexer, - invis=\E[8m, rmso=\E[27m, + invis=\E[8m, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%? %p5%t;2%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, - smso=\E[7m, E3=\E[3J, Smulx=\E[4:%p1%dm, + E3=\E[3J, Smulx=\E[4:%p1%dm, use=ecma+standout, use=ecma+italics, use=ecma+strikeout, use=xterm+edit, use=xterm+pcfkeys, use=xterm+sl, use=xterm+tmux, use=screen, use=bracketed+paste, use=report+version, @@ -8551,7 +9008,7 @@ # "xterm-256color" (hard-coded), which in its pretense that it is xterm, is # several years out of date. # -# There is little documentation; the existing manpages amount to a quarter of +# There is little documentation; the existing man pages amount to a quarter of # the length of mosh.org's heavily promotional website. This entry is based # on testing, and reading the source-code. For the latter, analysis is aided # by the developer's extensive use of hard-coded strings. @@ -8616,31 +9073,26 @@ ncv@, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, ed=\E[J, el=\E[K, el1=\E[1K, - hpa=\E[%i%p1%dG, ich=\E[%p1%d@, ich1=\E[@, - is1=\E[?47l\E=\E[?1l, + ich=\E[%p1%d@, ich1=\E[@, is1=\E[?47l\E=\E[?1l, is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kDC=\E[3$, kEND=\E[8$, kHOM=\E[7$, kIC=\E[2$, kLFT=\E[d, kNXT=\E[6$, kPRV=\E[5$, kRIT=\E[c, ka1=\EOw, ka3=\EOy, kb2=\EOu, kbs=^?, kc1=\EOq, kc3=\EOs, kcbt=\E[Z, kel=\E[8\^, - kend=\E[8~, kent=\EOM, kf0=\E[21~, kf1=\E[11~, kf10=\E[21~, - kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, - kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, - kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, kf21=\E[23$, - kf22=\E[24$, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, - kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, - khome=\E[7~, kind=\E[a, kmous=\E[M, kri=\E[b, rev=\E[7m, - ri=\EM, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, + kend=\E[8~, kent=\EOM, kf0=\E[21~, kf21=\E[23$, + kf22=\E[24$, khome=\E[7~, kind=\E[a, kmous=\E[M, kri=\E[b, + rev=\E[7m, ri=\EM, rmir=\E[4l, rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[? 25h, s0ds=\E(B, s1ds=\E(0, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%? %p9%t\016%e\017%;, - sgr0=\E[m\017, smir=\E[4h, smso=\E[7m, smul=\E[4m, - vpa=\E[%i%p1%dd, use=ansi+arrows, use=ansi+csr, - use=ansi+idl, use=ansi+local, use=xterm+alt47, - use=vt220+vtedit, use=vt220+cvis, use=ecma+color, - use=ecma+italics, use=vt100+4bsd, + sgr0=\E[m\017, smir=\E[4h, use=ecma+underline, + use=ecma+standout, use=ansi+arrows, use=ansi+csr, + use=ansi+idl, use=ansi+local, use=ansi+rca2, + use=xterm+alt47, use=vt220+vtedit, use=vt220+cvis, + use=ecma+color, use=ecma+italics, use=vt100+4bsd, + use=vt220+sfkeys, use=xterm+r5+fkeys, dvtm-256color|dynamic virtual terminal manager with 256 colors, colors#0x100, pairs#0x10000, @@ -8689,10 +9141,9 @@ ncsa-m|ncsa-vt220-8|NCSA Telnet 2.6 for Macintosh in VT220-8 mode, am, km, mir, msgr, xenl, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cr=\r, - cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, - dch1=\E[P, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0, - flash=\E[?5h$<100/>\E[?5l, home=\E[H, ht=^I, hts=\EH, - ich=\E[%p1%d@, if=/usr/share/tabset/vt100, + cub1=^H, cud1=\n, dch=\E[%p1%dP, dch1=\E[P, ed=\E[J, el=\E[K, + el1=\E[1K, enacs=\E)0, flash=\E[?5h$<100/>\E[?5l, ht=^I, + hts=\EH, ich=\E[%p1%d@, if=/usr/share/tabset/vt100, ind=\n$<150*>, is2=\E7\E[r\E[m\E[?7h\E[?1;4;6l\E[4l\E8\E>, kdch1=\E[4~, kend=\E[5~, kf1=\E[17~, kf10=\E[28~, @@ -8701,15 +9152,15 @@ kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, khlp=\E[1~, khome=\E[2~, knp=\E[6~, kpp=\E[3~, mc4=\E[4i, mc5=\E[5i, rev=\E[7m, rf=/usr/share/tabset/vt100, ri=\EM, - rmam=\E[?7l, rmcup=\E[2J\E8, rmir=\E[4l, rmso=\E[27m, - rmul=\E[24m, + rmam=\E[?7l, rmcup=\E[2J\E8, rmir=\E[4l, rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;4;6l\E[4l\E>, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%? %p9%t\E(0%e\E(B%;, sgr0=\E[m\E(B, smam=\E[?7h, smcup=\E7, smir=\E[4h, - smso=\E[7m, smul=\E[4m, tbc=\E[3g, u8=\E[?62;1;6c, - use=ansi+arrows, use=ansi+csr, use=ansi+idl, - use=ansi+local, use=vt220+cvis, use=xterm+acs, + tbc=\E[3g, u8=\E[?62;1;6c, use=ecma+underline, + use=ecma+standout, use=ansi+arrows, use=ansi+csr, + use=ansi+idl, use=ansi+local, use=ansi+cup, + use=vt220+cvis, use=xterm+acs, use=vt100+pf1-pf4, use=xterm+sl, use=ansi+enq, ncsa|NCSA Telnet 2.7 for Macintosh in VT220-8 mode (color), @@ -8727,11 +9178,10 @@ # some keyboards and many applications require these as F1-F4. # ncsa-vt220|NCSA Telnet using VT220-compatible function keys, - kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, - kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, - kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\EOQ, - kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf6=\E[17~, kf7=\E[18~, - kf8=\E[19~, kf9=\E[20~, use=ncsa, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, use=vt100+pf1-pf4, use=ncsa, + use=vt220+sfkeys, #### Pilot Pro Palm-Top # @@ -8768,9 +9218,8 @@ home=\EH, use=elks-glasstty, elks-ansi|ELKS ANSI console, - clear=\E[H\E[2J, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, - el=\E[K, home=\E[H, use=ansi+local1, use=ansi+sgrso, - use=elks-glasstty, + clear=\E[H\E[2J, el=\E[K, use=ansi+cup, use=ansi+local1, + use=ansi+sgrso, use=elks-glasstty, # As a matter of fact, ELKS 0.0.83 on PCs defaults to ANSI emulation # instead of VT52, but the "elks" entry still refers to the latter. @@ -8795,10 +9244,9 @@ am, xon, cols#80, lines#25, bel=^G, clear=\E[H\E[2J, cr=\r, cub1=^H, cud1=\n, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, - el=\E[K, home=\E[H, ht=^I, ich1=\E[@, il1=\E[L, nel=\r\n, - rev=\E[7m, rmso=\E[m, sgr0=\E[m, smso=\E[7m, - use=ansi+arrows, + cuu1=\E[A, dch1=\E[P, el=\E[K, ht=^I, ich1=\E[@, nel=\r\n, + rev=\E[7m, sgr0=\E[m, use=ansi+arrows, use=ansi+cup, + use=ansi+idl1, use=ansi+sgrso, #### Sun consoles # @@ -8810,9 +9258,9 @@ bel=^G, clear=^L, cr=\r, cub1=^H, cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, ed=\E[J, el=\E[K, ht=^I, ich=\E[%p1%d@, ich1=\E[@, ind=\n, is1=\E[1r, kcub1=\E[D, - kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, - kf3=\EOR, kf4=\EOS, khome=\E[H, rmso=\E[m, sgr0=\E[m, - smso=\E[7m, use=ansi+idl, use=ansi+local1, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, sgr0=\E[m, + use=ansi+idl, use=ansi+local1, use=ansi+sgrso, + use=vt100+pf1-pf4, # From: Alexander Lukyanov , 14 Nov 1995 # capability later corrected by J.T. Conklin @@ -8828,10 +9276,9 @@ kf3=\E[226z, kf4=\E[227z, kf5=\E[228z, kf6=\E[229z, kf7=\E[230z, kf8=\E[231z, kf9=\E[232z, khome=\E[214z, kich1=\E[247z, knp=\E[222z, kopt=\E[194z, kpp=\E[216z, - kres=\E[193z, kund=\E[195z, rev=\E[7m, rmso=\E[m, rmul@, - rs2=\E[s, sgr=\E[0%?%p1%p3%|%t;7%;m, sgr0=\E[m, - smso=\E[7m, u8=\E[1t, u9=\E[11t, use=ansi+arrows, - use=ansi+idl, + kres=\E[193z, kund=\E[195z, rev=\E[7m, rmul@, rs2=\E[s, + sgr=\E[0%?%p1%p3%|%t;7%;m, sgr0=\E[m, u8=\E[1t, + u9=\E[11t, use=ansi+arrows, use=ansi+idl, use=ansi+sgrso, # On some versions of CGSIX framebuffer firmware (SparcStation 5), / # flake out on the last line. Unfortunately, without them the terminal has no @@ -8850,8 +9297,8 @@ # incomplete manual page. Presumably the intent was to document features of # shelltool not in wscons: # -# https://manpages.ubuntu.com/manpages/bionic/en/man1/shelltool.1.html -# https://manpages.ubuntu.com/manpages/bionic/en/man1/cmdtool.1.html +# https://web.archive.org/web/20230608051050/manpages.ubuntu.com/manpages/bionic/en/man1/shelltool.1.html +# https://web.archive.org/web/20220520165933/manpages.ubuntu.com/manpages/bionic/en/man1/cmdtool.1.html # # The wscons manual page and the XView source show that it had no feature that # could be used in ncurses u6/u7/u8/u9 extensions. Interesting, the XView @@ -8882,9 +9329,8 @@ sun-12|Sun 12-line window, cols#80, lines#12, use=sun, sun-1|Sun 1-line window for sysline, - eslok, hs, - cols#80, lines#1, - dsl=^L, fsl=\E[K, tsl=\r, use=sun, + lines#1, + dsl=^L, fsl=\E[K, tsl=\r, use=sun, use=dec+sl, sun-e|sun-nic|sune|Sun Microsystems Workstation without insert character, ich1@, rmir@, smir@, use=sun, sun-c|sun-cmd|Sun Microsystems Workstation console with scrollable history, @@ -8895,11 +9341,11 @@ kcuu1=\E[215z, use=sun-il, # Most of the current references to sun-color are from users wondering why this -# is the default on install. Details from reading the wscons manpage, adding +# is the default on install. Details from reading the wscons man page, adding # cub, etc., here (rather than in the base sun-il entry) since it is not clear # when those were added -TD (2005-05-28) # -# According to wscons manpage, color is supported only on IA systems. +# According to wscons man page, color is supported only on IA systems. # Sun's terminfo entry documents bold and smul/rmul capabilities, but wscons # does not list these. It also sets ncv#3, however that corresponds to # underline and standout. @@ -8922,7 +9368,43 @@ setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6} %=%t3%e%p1%d%;m, sgr=\E[0%?%p6%t;1%;%?%p1%p3%|%t;7%;m, use=ansi+local, - use=sun, use=klone+color, + use=ansi+rca, use=ansi+tabs, use=ecma+index, use=sun, + use=klone+color, + +# These date from March 2017: +# https://www.illumos.org/issues/10360 terminfo: sun-color has 256 colors +# https://www.illumos.org/issues/10359 terminfo: add underline for sun-color +# +# https://www.illumos.org/issues/14919 tem: implement xenl +# https://illumos.topicbox.com/groups/developer/T58d08b48578a674d-M491357a8bb9a7d39b114097f +# +# The developer chose to modify the existing "sun-color" (changing the number +# of colors and color-pairs without adjusting setaf and setab) rather than +# following the advice given in review to add a new terminal description. As a +# result, some ncurses applications will render color incorrectly, while a few +# hard-coded applications may work as intended. +# +# These variants are based on reading the source code. +# https://github.com/illumos/illumos-gate/blob/loader/usr/src/boot/sys/boot/common/tem.c +illumos|Illumos framebuffer console, + xenl, + blink=\E[5m, dim=\E[2m, rmam=\E[?7l, + sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%? + %p4%t;5%;m, + sgr0=\E[0m, smam=\E[?7h, use=ecma+underline, + use=ecma+standout, use=vt220+cvis, use=sun-color, + use=ansi+apparrows, +# +# Referring to these as "sun-" is misleading, but close to the intent of the +# developer -TD +sun-16color|Illumos framebuffer console with 16 colors, + use=ibm+16color, use=illumos, + +sun-256color|Illumos framebuffer console with 256 colors, + use=xterm+256setaf, use=illumos, + +sun-direct|Illumos framebuffer console with direct-color, + use=xterm+indirect, use=illumos, #### Iris consoles # @@ -8995,9 +9477,9 @@ am, xt, cols#80, it#8, lines#24, bel=^G, clear=^L, cr=\r, cub1=^H, cud1=\n, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[K, home=\E[H, - ht=^I, ind=\n, kbs=^H, kcub1=^H, kcud1=\n, nel=\r\n, - rmso=\E[4;1m, sgr0=\E[m, smso=\E[4;2m, + cuu1=\E[A, el=\E[K, ht=^I, ind=\n, kbs=^H, kcub1=^H, kcud1=\n, + nel=\r\n, rmso=\E[4;1m, sgr0=\E[m, smso=\E[4;2m, + use=ansi+cup, nextshell|NeXT Shell application, am, cols#80, @@ -9012,17 +9494,15 @@ OTbs, OTpt, am, xenl, cols#80, OTnl=\n, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, - cr=\r, cub1=^H, cud1=\n, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, - cuu1=\E[A, ed=\E[J, el=\E[K, home=\E[H, ht=^I, - if=/usr/share/tabset/vt100, + cr=\r, cub1=^H, cud1=\n, ht=^I, if=/usr/share/tabset/vt100, is2=\E[?7h\E[?1h\E[?3l\E7\E8, kbs=^H, kcub1=\EOD, - kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOY, kf1=\EOP, - kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, - kf8=\EOW, kf9=\EOX, rev=\E[7m, ri=\EM, rmkx=\E[?1l\E>, - rmso=\E[m, rmul=\E[m, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOY, kf3=\EOR, + kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, kf9=\EOX, rev=\E[7m, + ri=\EM, rmkx=\E[?1l\E>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[r, sgr0=\E[m, - smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, use=ansi+csr, - use=ansi+idl, + smkx=\E[?1h\E=, use=ansi+csr, use=ansi+cup, + use=ansi+erase, use=ansi+idl, use=ansi+local1, + use=ansi+sgrul, use=ansi+sgrso, use=vt100+pf1-pf4, # # (news-29: this had :TY=ascii: --esr) news-29|Sony NEWS VT100 emulator with 29 lines, @@ -9061,14 +9541,13 @@ OTbs, OTpt, am, xenl, cols#80, vt#3, OTnl=\n, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[;H\E[2J, - cr=\r, cub1=^H, cud1=\n, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, - cuu1=\E[A, ed=\E[J, el=\E[K, home=\E[H, ht=^I, - if=/usr/share/tabset/vt100, kbs=^H, kcub1=\E[D, - kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, - kf3=\EOR, kf4=\EOS, rev=\E[7m, ri=\EM, rmkx=\E[?1l\E>, - rmso=\E[m, rmul=\E[m, + cr=\r, cub1=^H, cud1=\n, cuf1=\E[C, cuu1=\E[A, ed=\E[J, + el=\E[K, ht=^I, if=/usr/share/tabset/vt100, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, rev=\E[7m, + ri=\EM, rmkx=\E[?1l\E>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sgr0=\E[m, - smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, use=ansi+csr, + smkx=\E[?1h\E=, use=ansi+csr, use=ansi+cup, + use=ansi+sgrso, use=ansi+sgrul, use=vt100+pf1-pf4, # # (nwp512: this had :DE=^H:, which I think means --esr) nwp512|news|nwp514|news40|vt100-bm|nwp512-o|nwp514-o|news-o|news40-o|vt100-bm-o|old Sony VT100 emulator 40 lines, @@ -9121,14 +9600,14 @@ OTbs, OTpt, am, xenl, cols#80, lines#24, clear=\E[;H\E[2J$<20/>, cup=\E[%i%p1%d;%p2%dH, - cuu1=\E[A$<2/>, dl1=\E[M, ed=\E[J$<30/>, el=\E[K$<3/>, + cuu1=\E[A$<2/>, ed=\E[J$<30/>, el=\E[K$<3/>, flash=\E[?5h\0\0\0\0\0\0\0\0\0\0\0\0\0\E[?5l, - il1=\E[L, is2=\E[?5l\E[?1l\E>\E[?7h\E[?8h, kcub1=\E[D, - kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, - kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\E#W, khome=\E[H, - ri=\EM$<5/>, rmso=\E[m$<2/>, rmul=\E[m$<2/>, + is2=\E[?5l\E[?1l\E>\E[?7h\E[?8h, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf5=\EOT, kf6=\E#W, + khome=\E[H, ri=\EM$<5/>, rmso=\E[m$<2/>, rmul=\E[m$<2/>, rs2=\E7\E[r\E8\E[?5l\E[?1l\E>\E[?7h\E[?8h, smso=\E[7m$<2/>, smul=\E[4m$<2/>, use=ansi+local1, + use=ansi+idl1, use=vt100+pf1-pf4, # (news517: this had :TY=sjis:. --esr) nwp517|nwp-517|nwp-517 VT200 80 cols 30 rows, cols#80, lines#30, @@ -9137,12 +9616,11 @@ tsl=\E[1$}\E[;%df, use=dec+sl, use=vt220-base, # (news517-w: this had :TY=sjis:. --esr) nwp517-w|nwp-517-w|nwp-517 VT200 132 cols 50 rows, - eslok, hs, cols#132, lines#50, - OTi2=\E[2$~\n, dsl=\E[1$~, fsl=\E[0$}, + OTi2=\E[2$~\n, dsl=\E[1$~, is2=\E7\E[r\E8\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h, rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h, - tsl=\E[1$}\E[;%df, use=vt220-base, + tsl=\E[1$}\E[;%df, use=dec+sl, use=vt220-base, #### Common Desktop Environment # @@ -9153,26 +9631,21 @@ am, mir, msgr, xenl, xon, cols#80, it#8, lines#24, lm#0, ncv@, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, bold=\E[1m, cr=\r, cub1=^H, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, - dim=\E[2m, ech=\E[%p1%dX, el1=\E[1K, enacs=\E(B\E)0, - flash=\E[?5h$<200>\E[?5l, home=\E[H, ht=^I, hts=\EH, + bel=^G, bold=\E[1m, cr=\r, cub1=^H, cud1=\n, dch=\E[%p1%dP, + dch1=\E[P, dim=\E[2m, ech=\E[%p1%dX, el1=\E[1K, + enacs=\E(B\E)0, flash=\E[?5h$<200>\E[?5l, ht=^I, hts=\EH, ich=\E[%p1%d@, ind=\ED, is2=\E F\E>\E[?1l\E[?7h\E[?45l, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, - kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, - kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, - kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, - kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, - kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khlp=\E[28~, nel=\EE, ri=\EM, rmacs=^O, rmam=\E[?7l, - rmir=\E[4l, rmso=\E[22;27m, rmul=\E[24m, + rmir=\E[4l, rmso=\E[22;27m, sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5 %t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, - smso=\E[2;7m, smul=\E[4m, tbc=\E[3g, use=ansi+csr, - use=ansi+erase, use=ansi+idl, use=ansi+local, - use=ansi+sgr, use=decid+cpr, use=vt220+vtedit, - use=vt220+cvis, use=ecma+color, + smso=\E[2;7m, tbc=\E[3g, use=ecma+underline, + use=ansi+csr, use=ansi+cup, use=ansi+erase, use=ansi+idl, + use=ansi+local, use=ansi+sgr, use=decid+cpr, + use=ecma+color, use=vt220+cvis, use=vt220+sfkeys, + use=vt220+vtedit, use=xterm+r5+fkeys, ######## Non-Unix Consoles # @@ -9215,12 +9688,12 @@ mono-emx|stupid monochrome ANSI terminal with only one kind of emphasis, am, cols#80, it#8, lines#24, - clear=\E[H\E[2J$<50>, cup=\E[%i%p1%d;%p2%dH, el=\E[K, - home=\E[H, ht=^I, kb2=\E[G, kbs=^H, kcub1=\0K, kcud1=\0P, - kcuf1=\0M, kcuu1=\0H, kf0=\0D, kf1=\0;, kf2=\0<, kf3=\0=, - kf4=\0>, kf5=\0?, kf6=\0@, kf7=\0A, kf8=\0B, kf9=\0C, - khome=\0G, kich1=\0R, kll=\0O, knp=\0Q, kpp=\0I, nel=\r\n, - rev=\E[7m, sgr0=\E[0m, use=ansi+local1, + clear=\E[H\E[2J$<50>, el=\E[K, ht=^I, kb2=\E[G, kbs=^H, + kcub1=\0K, kcud1=\0P, kcuf1=\0M, kcuu1=\0H, kf0=\0D, kf1=\0;, + kf2=\0<, kf3=\0=, kf4=\0>, kf5=\0?, kf6=\0@, kf7=\0A, kf8=\0B, + kf9=\0C, khome=\0G, kich1=\0R, kll=\0O, knp=\0Q, kpp=\0I, + nel=\r\n, rev=\E[7m, sgr0=\E[0m, use=ansi+local1, + use=ansi+cup, #### Cygwin @@ -9290,23 +9763,19 @@ cygwin|ANSI emulation for Cygwin, am, hs, mir, msgr, xon, colors#8, it#8, pairs#64, - bel=^G, bold=\E[1m, cr=\r, cub=\E[%p1%dD, cub1=^H, - cup=\E[%i%p1%d;%p2%dH, el1=\E[1K, fsl=^G, home=\E[H, ht=^I, - ind=\n, invis=\E[8m, kb2=\E[G, kf1=\E[[A, kf10=\E[21~, - kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, - kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, - kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, - kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, - khome=\E[1~, kspd=^Z, nel=\r\n, op=\E[39;49m, rc=\E8, - rev=\E[7m, ri=\EM, rmpch=\E[10m, rmso=\E[27m, rmul=\E[24m, - rs1=\Ec\E]R, sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + bel=^G, bold=\E[1m, cr=\r, cub1=^H, el1=\E[1K, fsl=^G, ht=^I, + ind=\n, invis=\E[8m, kb2=\E[G, khome=\E[1~, kspd=^Z, + nel=\r\n, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, + rmpch=\E[10m, rs1=\Ec\E]R, sc=\E7, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p6%t;1%;%?%p7 %t;8%;%?%p9%t;11%;m, - sgr0=\E[0;10m, smpch=\E[11m, smso=\E[7m, smul=\E[4m, - tsl=\E];, use=ansi+arrows, use=ansi+erase, use=ansi+idc, - use=ansi+idl, use=ansi+local, use=ansi+rca2, - use=vt220+pcedit, use=vt102+enq, use=klone+acs, - use=xterm+alt47, + sgr0=\E[0;10m, smpch=\E[11m, tsl=\E];, + use=ecma+underline, use=ecma+standout, use=ansi+arrows, + use=ansi+cup, use=ansi+erase, use=ansi+idc, use=ansi+idl, + use=ansi+local, use=ansi+rca2, use=vt220+pcedit, + use=vt102+enq, use=klone+acs, use=linux+lockeys, + use=vt220+sfkeys, use=vt220+ufkeys, use=xterm+alt47, # I've supplied this so that you can help test new values and add other # features. Cheers, earnie_boyd@yahoo.com. @@ -9316,23 +9785,19 @@ # this list, but DOES cause problems so it has been removed cygwinDBG|Debug Version for Cygwin, am, eo, mir, msgr, xon, - cols#80, lines#24, ncv#3, - bel=^G, cr=\r, cup=\E[%i%p1%d;%p2%dH, dim=\E[2m, el1=\E[1K, - flash=\E[?5h$<200/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG, - ind=\n, kNXT=\E[6$, kPRV=\E[5$, kb2=\E[G, kcbt=\E[Z, - kf1=\E[[A, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, - kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, - kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[[B, - kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, - kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kspd=^Z, + cols#80, lines#24, + bel=^G, cr=\r, dim=\E[2m, el1=\E[1K, + flash=\E[?5h$<200/>\E[?5l, ind=\n, kNXT=\E[6$, + kPRV=\E[5$, kb2=\E[G, kcbt=\E[Z, khome=\E[1~, kspd=^Z, nel=\r\n, op=\E[39;49m, rc=\E8, ri=\EM, rs1=\Ec\E]R, sc=\E7, sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5 %t;2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;12%;m, - sgr0=\E[0;10m, vpa=\E[%i%p1%dd, use=ansi+arrows, + sgr0=\E[0;10m, use=ansi+arrows, use=ansi+cup, use=ansi+erase, use=ansi+idc, use=ansi+idl, - use=ansi+inittabs, use=ansi+local, use=ansi+sgrbold, - use=klone+acs, use=klone+color, use=vt220+pcedit, - use=vt220+cvis, use=vt102+enq, + use=ansi+inittabs, use=ansi+local, use=ansi+rca2, + use=ansi+sgrbold, use=klone+acs, use=klone+color, + use=linux+lockeys, use=vt102+enq, use=vt220+pcedit, + use=vt220+cvis, use=vt220+sfkeys, use=vt220+ufkeys, #### DJGPP @@ -9342,6 +9807,7 @@ # Oddly enough, while several combinations of modifiers are tabulated, there is # none for shifted cursor keys. # +# kf1-kf12: # F1 \E[[A # F2 \E[[B # F3 \E[[C @@ -9366,6 +9832,7 @@ # Right Arrow \E[C # Up Arrow \E[A # +# kf13-kf24: # Shift-F1 \E[25~ # Shift-F2 \E[26~ # Shift-F3 \E[27~ @@ -9379,6 +9846,7 @@ # Shift-F11 \E[35~ # Shift-F12 \E[36~ # +# kf25-kf36: # Ctrl-F1 \E[47~ # Ctrl-F2 \E[48~ # Ctrl-F3 \E[49~ @@ -9403,6 +9871,7 @@ # Ctrl-Right Arrow \E[40~ # Ctrl-Up Arrow \E[37~ # +# kf37-kf48: # Alt-F1 \E[59~ # Alt-F2 \E[60~ # Alt-F3 \E[61~ @@ -9416,6 +9885,7 @@ # Alt-F11 \E[79~ # Alt-F12 \E[80~ # +# ignore (conflicting): # Alt-Delete \E[65~ # Alt-Down Arrow \E[60~ # Alt-End \E[66~ @@ -9454,27 +9924,42 @@ # Alt-X \E[104~ # Alt-Y \E[105~ # Alt-Z \E[106~ -djgpp|ANSI emulation for DJGPP alpha, +djgpp|ANSI emulation for DJGPP 2.05, am, bce, msgr, xhp, xon, xt, colors#8, it#8, pairs#64, acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j \331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v \301w\302x\263y\363z\362{\343|\330}\234~\376, bel=^G, bold=\E[1m, cbt=\E[Z, civis=\E[1v, cnorm=\E[v, cr=\r, - cub1=^H, cup=\E[%i%p1%d;%p2%dH, cvvis=\E[2v, - dch=\E[%p1%dP, dch1=\E[P, ech=\E[%p1%dX, el1=\E[1K, - home=\E[H, hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, - ich1=\E[@, ind=\E[S, kf1=\E[[A, kf10=\E[21~, kf11=\E[23~, - kf12=\E[24~, kf2=\E[[B, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, - kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, - khome=\E[1~, nel=\r\n, op=\E[37;40m, ri=\E[T, rmso=\E[m, + cub1=^H, cvvis=\E[2v, dch=\E[%p1%dP, dch1=\E[P, + ech=\E[%p1%dX, el1=\E[1K, ht=^I, ich=\E[%p1%d@, ich1=\E[@, + ind=\E[S, kf13=\E[25~, kf14=\E[26~, kf15=\E[27~, + kf16=\E[28~, kf17=\E[29~, kf18=\E[30~, kf19=\E[31~, + kf20=\E[32~, kf21=\E[33~, kf22=\E[34~, kf23=\E[35~, + kf24=\E[36~, kf25=\E[47~, kf26=\E[48~, kf27=\E[49~, + kf28=\E[50~, kf29=\E[51~, kf30=\E[52~, kf31=\E[53~, + kf32=\E[54~, kf33=\E[55~, kf34=\E[56~, kf35=\E[57~, + kf36=\E[58~, kf37=\E[59~, kf38=\E[60~, kf39=\E[61~, + kf40=\E[62~, kf41=\E[63~, kf42=\E[64~, kf43=\E[65~, + kf44=\E[66~, kf45=\E[67~, kf46=\E[68~, kf48=\E[80~, + kf6=\E[17~, khome=\E[1~, nel=\r\n, op=\E[37;40m, ri=\E[T, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%e;25%;%? %p6%t;1%;%?%p7%t;8%;m, - sgr0=\E[m, smso=\E[7m, smul=\E[4m, vpa=\E[%i%p1%dd, - use=ansi+arrows, use=ansi+erase, use=ansi+idl, - use=ansi+local, use=ansi+sgr, use=vt220+pcedit, - use=ecma+index, + sgr0=\E[m, smul=\E[4m, alt_A=\E[82~, alt_B=\E[82~, + alt_C=\E[83~, alt_D=\E[84~, alt_E=\E[85~, alt_F=\E[86~, + alt_G=\E[87~, alt_H=\E[88~, alt_I=\E[89~, alt_J=\E[90~, + alt_K=\E[91~, alt_L=\E[92~, alt_M=\E[93~, alt_N=\E[94~, + alt_O=\E[95~, alt_P=\E[96~, alt_Q=\E[97~, alt_R=\E[98~, + alt_S=\E[99~, alt_T=\E[100~, alt_U=\E[101~, + alt_V=\E[102~, alt_W=\E[103~, alt_X=\E[104~, + alt_Y=\E[105~, alt_Z=\E[106~, kDC5=\E[43~, kDN5=\E[38~, + kEND5=\E[44~, kHOM5=\E[41~, kIC5=\E[42~, kLFT5=\E[39~, + kNXT5=\E[46~, kPRV5=\E[45~, kRIT5=\E[40~, kUP5=\E[37~, + use=ansi+arrows, use=ansi+cup, use=ansi+erase, + use=ansi+idl, use=ansi+local, use=ansi+rca2, + use=ansi+sgr, use=ansi+sgrso, use=ecma+index, + use=linux+lockeys, use=vt220+pcedit, use=vt220+ufkeys, djgpp203|entry for DJGPP 2.03, OTbs, am, @@ -9486,17 +9971,15 @@ OTbs, am, AX, colors#8, cols#80, it#8, lines#25, ncv#3, pairs#64, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[1v, - clear=\E[H\E[2J, cnorm=\E[v, cr=\r, - cup=\E[%i%p1%d;%p2%dH, cvvis=\E[2v, dch=\E[%p1%dP, - dch1=\E[P, ech=\E[%p1%dX, ed=\E[J, el=\E[K, home=\E[H, ht=^I, - ich=\E[%p1%d@, ich1=\E[@, ind=\E[S, invis=\E[8m, - kf0=\E[21~, kf1=\E[[A, kf10=\E[21~, kf2=\E[[B, kf3=\E[[C, - kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, - kf9=\E[20~, khome=\E[1~, kll=\E[4~, nel=\r\n, rev=\E[7m, - ri=\E[T, rmso=\E[m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, - sgr0=\E[m, smso=\E[7m, smul=\E[4m, use=ansi+arrows, - use=ansi+idl, use=ansi+local, use=vt220+pcedit, - use=ecma+index, + clear=\E[H\E[2J, cnorm=\E[v, cr=\r, cvvis=\E[2v, + dch=\E[%p1%dP, dch1=\E[P, ech=\E[%p1%dX, ed=\E[J, el=\E[K, + ht=^I, ich=\E[%p1%d@, ich1=\E[@, ind=\E[S, invis=\E[8m, + kf0=\E[21~, kf10=\E[21~, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kll=\E[4~, nel=\r\n, + rev=\E[7m, ri=\E[T, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr0=\E[m, smul=\E[4m, use=ansi+arrows, use=ansi+cup, + use=ansi+idl, use=ansi+local, use=ansi+sgrso, + use=linux+lockeys, use=vt220+pcedit, use=ecma+index, #### U/Win @@ -9510,16 +9993,15 @@ \316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u \264v\301w\302x\263y\363z\362{\343|\330}\234~\376, bel=^G, blink=\E[5m, bold=\E[1m, cr=\r, cub1=^H, cud1=\n, - cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dim=\E[2m, - ech=\E[%p1%dX, el1=\E[1K, home=\E[H, ht=^I, hts=\EH, - kdch1=^?, kend=\E[Y, kf1=\EOP, kf10=\EOY, kf11=\EOZ, - kf12=\EOA, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, - kf7=\EOV, kf8=\EOW, kf9=\EOX, kich1=\E[@, nel=\r\n, - op=\E[39;49m, rc=\E8, rev=\E[7m, rmacs=\E[10m, - rmpch=\E[10m, rmso=\E[27m, rmul=\E[m, rs1=\Ec\E]R, sc=\E7, - sgr0=\E[0;10m, smacs=\E[11m, smpch=\E[11m, smso=\E[7m, - smul=\E[4m, tbc=\E[3g, use=ansi+arrows, use=ansi+cpr, - use=ansi+erase, use=ansi+idc, use=klone+color, + cuf1=\E[C, cuu1=\E[A, dim=\E[2m, ech=\E[%p1%dX, el1=\E[1K, + ht=^I, hts=\EH, kdch1=^?, kend=\E[Y, kf10=\EOY, kf11=\EOZ, + kf12=\EOA, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, kf9=\EOX, + kich1=\E[@, nel=\r\n, op=\E[39;49m, rc=\E8, rev=\E[7m, + rmacs=\E[10m, rmpch=\E[10m, rs1=\Ec\E]R, sc=\E7, + sgr0=\E[0;10m, smacs=\E[11m, smpch=\E[11m, tbc=\E[3g, + use=ecma+standout, use=ansi+arrows, use=ansi+cpr, + use=ansi+cup, use=ansi+erase, use=ansi+idc, + use=ansi+sgrul, use=klone+color, use=vt100+pf1-pf4, use=vt220+cvis, #### Microsoft (miscellaneous) @@ -9558,10 +10040,11 @@ am, bw, msgr, cols#80, it#8, lines#25, bel=^G, clear=\E[2J, cr=\r, cub1=^H, cud1=\n, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, - home=\E[H, ht=^I, ind=\E[S, kbs=^H, kcub1=\E[D, kcud1=\E[V, - kcuf1=\E[C, kcuu1=\E[A, nel=\r\E[S, rc=\E[u, rev=\E[7m, - ri=\E[T, rmso=\E[m, sc=\E[s, sgr0=\E[0m, smso=\E[7m, + cuu1=\E[A, ed=\E[J, el=\E[K, ht=^I, ind=\E[S, kbs=^H, + kcub1=\E[D, kcud1=\E[V, kcuf1=\E[C, kcuu1=\E[A, nel=\r\E[S, + rc=\E[u, rev=\E[7m, ri=\E[T, sc=\E[s, sgr0=\E[0m, + use=ansi+cup, use=ansi+sgrso, + # From: jew@venus.sunquest.com # Date: 19 Feb 93 23:41:07 GMT # Here's a combination of ansi and vt100 termcap @@ -9576,12 +10059,12 @@ cuu1=\E[A$<2/>, ed=\E[J$<50/>, el=\E[K$<3/>, home=\E[H, ht=^I, hts=\EH$<2/>, ind=\ED$<5/>, is2=\E[1;24r\E[24;1H, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, - kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=\r\ED$<5/>, - rc=\E8, rev=\E[7m$<2/>, rf=/usr/share/tabset/vt100, - ri=\EM$<5/>, rmso=\E[m$<2/>, rmul=\E[m$<2/>, + nel=\r\ED$<5/>, rc=\E8, rev=\E[7m$<2/>, + rf=/usr/share/tabset/vt100, ri=\EM$<5/>, + rmso=\E[m$<2/>, rmul=\E[m$<2/>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, sgr0=\E[m$<2/>, smso=\E[7m$<2/>, smul=\E[4m$<2/>, - tbc=\E[3g$<2/>, + tbc=\E[3g$<2/>, use=vt100+pf1-pf4, # From: Federico Bianchi # This is the entry for the OpenNT terminal. @@ -9611,28 +10094,27 @@ acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j \331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v \301w\302x\263y\363z\362{\343|\330}\234~\376, - bel=^G, bold=\E[1m, clear=\E[2J, cr=\r, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, ed=\E[J, el=\E[K, home=\E[H, ht=^I, - ind=\E[S, kLFT=\EF\^, kRIT=\EF$, kcbt=\E[Z, kdch1=^?, - kend=\E[U, kf0=\EFA, kf1=\EF1, kf10=\EFA, kf11=\EFB, - kf12=\EFC, kf13=\EFD, kf14=\EFE, kf15=\EFF, kf16=\EFG, - kf17=\EFH, kf18=\EFI, kf19=\EFJ, kf2=\EF2, kf20=\EFK, - kf21=\EFL, kf22=\EFM, kf23=\EFN, kf24=\EFO, kf25=\EFP, - kf26=\EFQ, kf27=\EFR, kf28=\EFS, kf29=\EFT, kf3=\EF3, - kf30=\EFU, kf31=\EFV, kf32=\EFW, kf33=\EFX, kf34=\EFY, - kf35=\EFZ, kf36=\EFa, kf37=\EFb, kf38=\EFc, kf39=\EFd, - kf4=\EF4, kf40=\EFe, kf41=\EFf, kf42=\EFg, kf43=\EFh, - kf44=\EFi, kf45=\EFj, kf46=\EFk, kf47=\EFm, kf48=\EFn, - kf49=\EFo, kf5=\EF5, kf50=\EFp, kf51=\EFq, kf52=\EFr, - kf53=\EFs, kf54=\EFt, kf55=\EFu, kf56=\EFv, kf57=\EFw, - kf58=\EFx, kf59=\EFy, kf6=\EF6, kf60=\EFz, kf7=\EF7, - kf8=\EF8, kf9=\EF9, kich1=\E[L, kind=\EF+, kll=\E[U, - knp=\E[T, kpp=\E[S, kri=\EF-, ll=\E[U, nel=\r\n, op=\E[m, - rc=\E[u, rev=\E[7m, ri=\E[T, rmcup=\E[2b\E[u\r\E[K, - rmso=\E[m, rmul=\E[m, rs1=\Ec, sc=\E[s, sgr0=\E[0m, - smcup=\E[s\E[1b, smso=\E[7m, smul=\E[4m, use=ansi+arrows, - use=ansi+idl, use=ansi+local, use=ecma+index, - use=klone+color, + bel=^G, bold=\E[1m, clear=\E[2J, cr=\r, cud1=\n, ed=\E[J, + el=\E[K, ht=^I, ind=\E[S, kLFT=\EF\^, kRIT=\EF$, kcbt=\E[Z, + kdch1=^?, kend=\E[U, kf0=\EFA, kf1=\EF1, kf10=\EFA, + kf11=\EFB, kf12=\EFC, kf13=\EFD, kf14=\EFE, kf15=\EFF, + kf16=\EFG, kf17=\EFH, kf18=\EFI, kf19=\EFJ, kf2=\EF2, + kf20=\EFK, kf21=\EFL, kf22=\EFM, kf23=\EFN, kf24=\EFO, + kf25=\EFP, kf26=\EFQ, kf27=\EFR, kf28=\EFS, kf29=\EFT, + kf3=\EF3, kf30=\EFU, kf31=\EFV, kf32=\EFW, kf33=\EFX, + kf34=\EFY, kf35=\EFZ, kf36=\EFa, kf37=\EFb, kf38=\EFc, + kf39=\EFd, kf4=\EF4, kf40=\EFe, kf41=\EFf, kf42=\EFg, + kf43=\EFh, kf44=\EFi, kf45=\EFj, kf46=\EFk, kf47=\EFm, + kf48=\EFn, kf49=\EFo, kf5=\EF5, kf50=\EFp, kf51=\EFq, + kf52=\EFr, kf53=\EFs, kf54=\EFt, kf55=\EFu, kf56=\EFv, + kf57=\EFw, kf58=\EFx, kf59=\EFy, kf6=\EF6, kf60=\EFz, + kf7=\EF7, kf8=\EF8, kf9=\EF9, kich1=\E[L, kind=\EF+, + kll=\E[U, knp=\E[T, kpp=\E[S, kri=\EF-, ll=\E[U, nel=\r\n, + op=\E[m, rc=\E[u, rev=\E[7m, ri=\E[T, + rmcup=\E[2b\E[u\r\E[K, rs1=\Ec, sc=\E[s, sgr0=\E[0m, + smcup=\E[s\E[1b, use=ansi+arrows, use=ansi+cup, + use=ansi+idl, use=ansi+local, use=ansi+sgrso, + use=ansi+sgrul, use=ecma+index, use=klone+color, opennt-35|ntconsole-35|OpenNT-term35 compatible with color, lines#35, use=opennt, @@ -9710,9 +10192,8 @@ altos2|alt2|altos-2|Altos II, cols#80, it#8, lines#24, xmc#0, clear=\E[H\E[2J, cr=\r, cub1=^H, cud1=\E[1B, cuf1=\E[1C, - cup=\E[%i%p1%d;%p2%dH, cuu1=\E[1A, dch1=\E[P, dl1=\E[M, - ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, - if=/usr/share/tabset/vt100, il1=\E[L, ind=\n, + cuu1=\E[1A, dch1=\E[P, ed=\E[J, el=\E[K, ht=^I, ich1=\E[@, + if=/usr/share/tabset/vt100, ind=\n, is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, kDL=^Am\r, kEOL=^An\r, kcbt=^AK\r, kclr=^AL\r, kdch1=^AM\r, kel=^AN\r, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf32=^A`\r, @@ -9720,8 +10201,9 @@ kf38=^Af\r, kf39=^Ag\r, kf4=^AC\r, kf40=^Ah\r, kf41=^Ai\r, kf42=^Aj\r, kf43=^Ak\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=\E[f, kil1=^AJ\r, kind=^AO\r, - nel=\r\n, rmam=\E[?7l, rmso=\E[m, rmul=\E[m, sgr0=\E[m, - smam=\E[?7h, smso=\E[7m, smul=\E[4m, use=ansi+arrows, + nel=\r\n, rmam=\E[?7l, sgr0=\E[m, smam=\E[?7h, + use=ansi+arrows, use=ansi+cup, use=ansi+idl1, + use=ansi+sgrso, use=ansi+sgrul, # (altos3: had extension capabilities # :c0=^A`\r:c1=^Aa\r:c2=^Ab\r:c3=^Ac\r:\ @@ -9833,7 +10315,7 @@ # Due to severe 2621 braindamage, the only way to get the arrow keys to # transmit anything at all is to turn on the function key labels # with , and even then the user has to hold down shift! -# The default 2621 turns off the labels except when it has to to +# The default 2621 turns off the labels except when it has to, to # enable the function keys. If your installation prefers labels # on all the time, or off all the time (at the "expense" of the # function keys), use 2621-nl or 2621-wl. @@ -10205,18 +10687,18 @@ cols#80, lines#25, acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x \263, - bel=^G, cbt=\E[Z, clear=\E[2J\E[H, cr=\r, - cup=\E[%i%p1%d;%p2%dH, dch1=\E[P, dl1=\E[M, ed=\E[J, - el=\E[K, home=\E[H, ht=^I, ich1=\E[@, il1=\E[L, ind=\n, + bel=^G, cbt=\E[Z, clear=\E[2J\E[H, cr=\r, dch1=\E[P, ed=\E[J, + el=\E[K, ht=^I, ich1=\E[@, ind=\n, is2=\E[44"p\E[?7h\E[>10h\E[>12h\EP1;1|3/7F\E\\, kcbt=\E[Z, kend=\E[4~, kf1=\E[17~, kf10=\E[28~, kf2=\E[18~, kf3=\E[19~, kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, khome=\E[1~, knp=\E[6~, kpp=\E[5~, rmam=\E[?7l, rmsc=\E[>11l\EP1**x0/11;1/13\E[m\E\\, - rmso=\E[m, rmul=\E[m, sgr0=\E[m, smam=\E[?7h, - smsc=\E[>11h\EPO**x0/65;1/67\E\\$<250>, smso=\E[7m, - smul=\E[4m, xoffc=g, xonc=e, use=ansi+arrows, - use=ansi+local1, use=vt220+cvis, + sgr0=\E[m, smam=\E[?7h, + smsc=\E[>11h\EPO**x0/65;1/67\E\\$<250>, xoffc=g, + xonc=e, use=ansi+arrows, use=ansi+cup, use=ansi+idl1, + use=ansi+local1, use=ansi+sgrso, use=ansi+sgrul, + use=vt220+cvis, # # (hp2392: copied here from hpex -- esr) hp2392|239x series, @@ -10414,14 +10896,13 @@ gator|HP 9000 model 237 emulating AAA, bw, km, mir, ul, cols#128, it#8, lines#47, - bel=^G, cbt=\E[Z, cr=\r, cub1=^H, cud1=\n, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu1=\EM, dch=\E[%p1%dP$<4/>, - dch1=\E[P, dl=\E[%p1%dM$<1*/>, dl1=\E[M, home=\E[H, + bel=^G, cbt=\E[Z, cr=\r, cub1=^H, cud1=\n, cuf1=\E[C, cuu1=\EM, + dch=\E[%p1%dP$<4/>, dch1=\E[P, dl=\E[%p1%dM$<1*/>, hpa=\E[%i%p1%d`, ht=^I, ich=\E[%p1%d@$<4/>, ich1=\E[@, - il=\E[%p1%dL$<1*/>, il1=\E[L, kbs=^H, kcub1=^H, kcud1=\n, - nel=\r\n, rep=%p1%c\E[%p2%db$<1*/>, rev=\E[7m, rmso=\E[m, - rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, - use=ansi+erase, + il=\E[%p1%dL$<1*/>, kbs=^H, kcub1=^H, kcud1=\n, nel=\r\n, + rep=%p1%c\E[%p2%db$<1*/>, rev=\E[7m, sgr0=\E[m, + use=ansi+cup, use=ansi+erase, use=ansi+idl1, + use=ansi+sgrso, use=ansi+sgrul, gator-52|HP 9000 model 237 emulating VT52, cols#128, lines#47, use=vt52-basic, @@ -10446,9 +10927,8 @@ dku7003|Honeywell Bull DKU 7003 all features described, msgr, xmc#1, - blink=\E[5m, bold=\E[7m, dim=\E[2m, rev=\E[7m, rmso=\E[m, - rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, - use=dku7003-dumb, + blink=\E[5m, bold=\E[7m, dim=\E[2m, rev=\E[7m, sgr0=\E[m, + use=ansi+sgrso, use=ansi+sgrul, use=dku7003-dumb, #### Lear-Siegler (LSI adm) # @@ -10833,11 +11313,11 @@ dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl1=\E[M, ed=\E[J\E[r, el=\E[K\E[t, flash=\E$$<200/>\E$P, home=\E$B, ht=^I, il1=\E[L\E[t, ind=\n, khome=\E$A, nel=\r\n, rmcup=, - rmir=\E[4l, rmkx=\E[>13l, rmso=\E[m, rmul=\E[m, sgr0=\E[m, + rmir=\E[4l, rmkx=\E[>13l, rmso=\E[m, sgr0=\E[m, smcup=\E[>1l\E[>2l\E[>16l\E[4l\E[>9l\E[20l\E[>3l\E[>7h\E[>12 l\E[1Q, - smir=\E[4h, smkx=\E[>13h, smso=\E[2;7m, smul=\E[4m, - use=ansi+arrows, use=ansi+local, + smir=\E[4h, smkx=\E[>13h, smso=\E[2;7m, use=ansi+arrows, + use=ansi+local, use=ansi+sgrul, pt100w|pt200w|wrenw|fenixw|Prime pt100/pt200 in 132-column mode, cols#132, @@ -10917,15 +11397,14 @@ cuf1=\E[C$<2>, cup=\E[%i%p1%d;%p2%dH$<5>, cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I, hts=\EH, ind=\n, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, - kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, - rev=\E[7m$<2>, ri=\EM$<5>, rmam=\E[?7l, rmkx=\E[?1l\E>, - rmso=\E[m$<2>, rmul=\E[m$<2>, + kcuu1=\EOA, rev=\E[7m$<2>, ri=\EM$<5>, rmam=\E[?7l, + rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1 %;m$<2>, sgr0=\E[m$<2>, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, use=ansi+csr, - use=ansi+local, + use=ansi+local, use=vt100+pf1-pf4, qvt103-w|Qume qvt103 132 cols, cols#132, lines#24, @@ -11967,16 +12446,15 @@ cols#80, it#8, lines#24, acsc=, cbt=\E[Z, clear=\E[H\E[2J, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\ED, cuf1=\E[C, cup=\E[%i%p1%d;%p2%df, - cuu1=\EM, cvvis=\E[1Q, dch1=\E[P, dl1=\E[M, dsl=\Eg\Ef\r, - ed=\E[J, el=\E[K, flash=\E[5m$<200/>\E[m, home=\E[H, - hpa=\E[%i%p1%dG, ht=^I, il1=\E[L, + cuu1=\EM, cvvis=\E[1Q, dch1=\E[P, dsl=\Eg\Ef\r, ed=\E[J, + el=\E[K, flash=\E[5m$<200/>\E[m, home=\E[H, ht=^I, is2=\E<\E[?21l\E[19h\E[1Q\E[10l\E[7l\E[H\E[2J, kf1=\E?a, kf2=\E?b, kf3=\E?c, kf4=\E?d, kf5=\E?e, kf6=\E?f, kf7=\E?g, kf8=\E?h, kf9=\E?i, ri=\EM, rmacs=\E(B, - rmam=\E[?7h, rmcup=, rmir=\E[4l, rmso=\E[m, rmul=\E[m, - sgr0=\E[m, smacs=\E(B, smam=\E[?7l, - smcup=\E[?20l\E[?7h\E[1Q, smir=\E[4h, smso=\E[7m, - smul=\E[4m, vpa=\E[%i%p1%dd, use=ansi+arrows, + rmam=\E[?7h, rmcup=, rmir=\E[4l, sgr0=\E[m, smacs=\E(B, + smam=\E[?7l, smcup=\E[?20l\E[?7h\E[1Q, smir=\E[4h, + use=ansi+arrows, use=ansi+idl1, use=ansi+rca2, + use=ansi+sgrso, use=ansi+sgrul, tvi970-vb|TeleVideo 970 with visual bell, flash=\E[?5h\0\0\0\0\0\0\0\0\0\0\0\0\0\E[?5l, @@ -12136,15 +12614,15 @@ am, bw, mir, xenl, cols#80, lines#24, bel=^G, cbt=\E[Z, clear=\E[H\E[2J, cr=\r, cub1=^H, - cup=\E[%i%p1%d;%p2%dH, dch1=\E[P$<40>, dl1=\E[M, ed=\E[J, - el=\E[K, home=\E[H, ht=^I, il1=\E[L, ind=\n, + dch1=\E[P$<40>, ed=\E[J, el=\E[K, ht=^I, ind=\n, is2=\E[7s\E[2;3;4;20;?5;?6l\E[12;?7h\E[1Q\E[0;1(D\E[8s, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\E_A\E\\, kf2=\E_B\E\\, kf3=\E_C\E\\, kf4=\E_D\E\\, kf5=\E_E\E\\, kf6=\E_F\E\\, kf7=\E_G\E\\, kf8=\E_H\E\\, kf9=\E_I\E\\, khome=\E[H, ri=\EM, rmam=\E[?7l, rmir=\E[4l, - rmso=\E[m, rmul=\E[m, sgr0=\E[m, smam=\E[?7h, smir=\E[4h, - smso=\E[1m, smul=\E[4m, use=ansi+local1, + rmso=\E[m, sgr0=\E[m, smam=\E[?7h, smir=\E[4h, smso=\E[1m, + use=ansi+cup, use=ansi+idl1, use=ansi+local1, + use=ansi+sgrul, # some of the vi300s have older firmware that has the command # sequence for setting editing extent reversed. @@ -12188,9 +12666,9 @@ cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dsl=\EP2;1~\E\\, ed=\E[J, el=\E[K, fsl=\E\\, ind=\ED, is1=\E>\E[?3l\E[?4l\E[?7h\E[?8h\E[1;24r, rev=\E[7m, - ri=\EM, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, - sgr0=\E[m\017$<2>, smir=\E[4h, smso=\E[7m, smul=\E[4m, - tsl=\EP2~, use=ansi+idl1, use=decid+cpr, use=vt100+4bsd, + ri=\EM, rmir=\E[4l, sgr0=\E[m\017$<2>, smir=\E[4h, + tsl=\EP2~, use=ecma+underline, use=ecma+standout, + use=ansi+idl1, use=decid+cpr, use=vt100+4bsd, #### Wyse (wy) # @@ -12636,33 +13114,36 @@ am, km, mir, msgr, xenl, cols#80, it#8, lines#25, vt#3, acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx{{||}}~~, - bel=^G, cbt=\E[Z, civis=\E[?25l, clear=\E[H\E[J$<200>, - cnorm=\E[34h\E[?25h, cr=\r, cub=\E[%p1%dD$<1>, - cub1=\010$<1>, cud=\E[%p1%dB, cud1=\ED, - cuf=\E[%p1%dC$<1>, cuf1=\E[C$<1>, - cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, - cvvis=\E[34l\E[?25h, dim=\E[2m, ech=\E[%p1%dX, - ed=\E[J$<8*>, el=\E[K$<1>, el1=\E[1K$<1>, enacs=\E)0, - flash=\E[?5h$<30/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG, - ht=^I, ich=\E[%p1%d@, ind=\n$<1>, + bel=^G, cbt=\E[Z, clear=\E[H\E[J$<200>, cr=\r, + cub=\E[%p1%dD$<1>, cub1=\010$<1>, cud=\E[%p1%dB, + cud1=\ED, cuf=\E[%p1%dC$<1>, cuf1=\E[C$<1>, + cuu=\E[%p1%dA, cuu1=\EM, cvvis=\E[34l\E[?25h, dim=\E[2m, + ech=\E[%p1%dX, ed=\E[J$<8*>, el=\E[K$<1>, el1=\E[1K$<1>, + enacs=\E)0, flash=\E[?5h$<30/>\E[?5l, ht=^I, + ich=\E[%p1%d@, ind=\n$<1>, is2=\E7\E[1r\E8\E[2;3;4;13;20;34;39;36l\E[12;16;34h\E[?1;3;4 ;5;10;18l\E[?7;8;25h\E>\E[?5W\E(B\017\E[4i, kbs=^H, kcbt=\E[z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, - kcuu1=\EOA, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, - kf12=\E[24~, kf17=\E[K, kf18=\E[31~, kf19=\E[32~, kf2=\EOQ, + kcuu1=\EOA, kf17=\E[K, kf18=\E[31~, kf19=\E[32~, kf20=\E[33~, kf21=\E[34~, kf22=\E[35~, kf23=\E[1~, - kf24=\E[2~, kf3=\EOR, kf4=\EOS, kf5=\E[M, kf6=\E[17~, - kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, ll=\E[24E, mc0=\E[?19h, - nel=\EE, prot=\E[1"q, ri=\EM, rmacs=^O, rmam=\E[?7l, - rmir=\E[4l, rmkx=\E[?1l, rmso=\E[27m, rmul=\E[24m, + kf24=\E[2~, kf5=\E[M, ll=\E[24E, mc0=\E[?19h, nel=\EE, + prot=\E[1"q, ri=\EM, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, + rmkx=\E[?1l, rs2=\E[61"p\E[40h\E[?6l\E[1r\E[2;3;4;13;20;34;39;36l\E[12;16 ;34h\E[?1;3;4;5;10;18l\E[?7;8;25h\E>\E[?5W\E(B\017\E[24E \E[4i, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%O%t;7%;%?%p4%t;5%;%? %p5%t;2%;%?%p7%t;8%;m\E[%?%p8%t1%;"q%?%p9%t\016%e\017%;, sgr0=\E[m\017\E["q, smacs=^N, smam=\E[?7h, smir=\E[4h, - smkx=\E[?1h, vpa=\E[%i%p1%dd, use=ansi+csr, use=ansi+idl, - use=ansi+pp, use=ansi+sgrbold, + smkx=\E[?1h, use=ecma+underline, use=ecma+standout, + use=ansi+csr, use=ansi+cup, use=ansi+idl, use=ansi+pp, + use=ansi+rca2, use=ansi+sgrbold, use=vt100+pf1-pf4, + use=vt220+ufkeys, use=wyse+cvis, + +# http://www.bitsavers.org/pdf/wyse/WY-99/880411-02A_WY-99GT_User_Manual_198703.pdf +# "CSI 34 h" is WYULCURM, "Block cursor on" vs "Underline cursor on" +wyse+cvis|Wyse cursor-mode, + civis=\E[?25l, cnorm=\E[34h\E[?25h, # This is the american terminal. Here tabs work fine. # From: Francesco Potorti` , 24 Aug 1998 @@ -12820,33 +13301,31 @@ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, clear=\E[H\E[J$<30>, cr=\r, csr=\E[%i%p1%d;%p2%dr$<2>, cub1=^H, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP$<3*>, - dch1=\E[P$<3>, dim=\E[0t\E[2m, dl=\E[%p1%dM$<1*>, - dl1=\E[M, dsl=\E[>\,\001\001\E[>-\001\001, - ech=\E[%p1%dX, ed=\E[J$<30>, el=\E[K$<3>, el1=\E[1K$<3>, - enacs=\E)0, flash=\E[30h\E\,$<250/>\E[30l, fsl=^A, - home=\E[H, hpa=\E[%i%p1%dG, ich=\E[%p1%d@$<1*>, - il=\E[%p1%dL$<2*>, il1=\E[L$<2>, ind=\n$<2>, ip=$<1>, + dch=\E[%p1%dP$<3*>, dch1=\E[P$<3>, dim=\E[0t\E[2m, + dl=\E[%p1%dM$<1*>, dl1=\E[M, + dsl=\E[>\,\001\001\E[>-\001\001, ech=\E[%p1%dX, + ed=\E[J$<30>, el=\E[K$<3>, el1=\E[1K$<3>, enacs=\E)0, + flash=\E[30h\E\,$<250/>\E[30l, fsl=^A, hpa=\E[%i%p1%dG, + ich=\E[%p1%d@$<1*>, il=\E[%p1%dL$<2*>, il1=\E[L$<2>, + ind=\n$<2>, ip=$<1>, is1=\E[2;4;20;30l\E[?1;10l\E[12h\E[?7;8;25h, is2=\E>\E(B\E)0\017, is3=\E[m, kdl1=\E[M, kel=\E[K, - kf1=\E[?5i, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, - kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, - kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[?3i, - kf20=\E[34~, kf21=\E[35~, kf3=\E[2i, kf4=\E[@, kf5=\E[M, - kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, - khlp=\E[28~, kich1=\E[@, kil1=\E[L, knp=\E[6~, kpp=\E[5~, - kprt=\E[?5i, kslt=\E[4~, mc0=\E[0i, rc=\E8, rev=\E[1t\E[7m, - ri=\EM$<2>, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, - rmso=\E[m, rmul=\E[m, rs1=\E[13l\E[3l\E!p, - rs2=\E[35h\E[?3l$<80>, rs3=\E[?5l, sc=\E7, + kf1=\E[?5i, kf2=\E[?3i, kf21=\E[35~, kf3=\E[2i, kf4=\E[@, + kf5=\E[M, kfnd=\E[1~, khlp=\E[28~, kich1=\E[@, kil1=\E[L, + knp=\E[6~, kpp=\E[5~, kprt=\E[?5i, kslt=\E[4~, mc0=\E[0i, + rc=\E8, rev=\E[1t\E[7m, ri=\EM$<2>, rmacs=^O, rmam=\E[?7l, + rmir=\E[4l, rmkx=\E>, rmso=\E[m, rmul=\E[m, + rs1=\E[13l\E[3l\E!p, rs2=\E[35h\E[?3l$<80>, rs3=\E[?5l, + sc=\E7, sgr=%?%p5%t\E[0t%;%?%p3%p1%|%t\E[1t%;%?%p2%t\E[2t%;%?%p4%t \E[3t%;%?%p1%p2%p3%p4%p5%|%|%|%|%t\E[7m%e\E[m%;%?%p9%t \016%e\017%;, sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, smkx=\E[?1l\E[?7h\E=, smso=\E[1t\E[7m, smul=\E[2t\E[4m, - tsl=\E[>\,\001, use=ansi+arrows, use=ansi+local, - use=ansi+pp, use=ansi+tabs, use=decid+cpr, - use=vt220+cvis, use=vt220+keypad, + tsl=\E[>\,\001, use=ansi+arrows, use=ansi+cup, + use=ansi+local, use=ansi+pp, use=ansi+tabs, + use=decid+cpr, use=vt220+cvis, use=vt220+keypad, + use=vt220+sfkeys, use=vt220+ufkeys, # # This terminal description uses the non-hidden attribute mode # (with magic cookie). @@ -12895,13 +13374,9 @@ ht=\011$<1>, ich=\E[%p1%d@$<4*>, il=\E[%p1%dL$<5*>, il1=\E[L$<5>, ind=\n$<3>, ip=$<3>, is1=\E[62;1"p\E[?5W, is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25h$<16>, - is3=\E>\E(B\E)0\017\E[m, kf10=\E[21~, kf11=\E[23~, - kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, - kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, - kf20=\E[34~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, - kf9=\E[20~, khlp=\E[28~, khome=\E[26~, lf1=PF1, lf2=PF2, - lf3=PF3, lf4=PF4, mc0=\E[0i, ri=\EM$<3>, rmam=\E[?7l, - rmir=\E[4l, rmkx=\E>, rs1=\E[13l\E[3l\E!p, + is3=\E>\E(B\E)0\017\E[m, khlp=\E[28~, khome=\E[26~, + lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, mc0=\E[0i, ri=\EM$<3>, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, rs1=\E[13l\E[3l\E!p, rs2=\E[35h\E[?3l$<70>, rs3=\E[?5l, sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%? %p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, @@ -12910,7 +13385,7 @@ use=ansi+csr, use=ansi+inittabs, use=ansi+local, use=ansi+pp, use=ansi+sgrbold, use=decid+cpr, use=vt100+4bsd, use=vt220+vtedit, use=vt220+cvis, - use=vt220+keypad, + use=vt220+keypad, use=vt220+sfkeys, use=vt220+ufkeys, # # Wyse 85 with visual bell. wy85-vb|wyse85-vb|Wyse 85 with visible bell, @@ -12979,8 +13454,7 @@ wy185|wyse185|Wyse 185, hs, km, mir, xenl, xon, wsl#80, - civis=\E[?25l, clear=\E[H\E[J$<40>, - cnorm=\E[34h\E[?25h, csr=\E[%i%p1%d;%p2%dr$<20>, + clear=\E[H\E[J$<40>, csr=\E[%i%p1%d;%p2%dr$<20>, cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, cvvis=\E[?25h\E[34l, dch=\E[%p1%dP$<3>, dch1=\E[P$<3>, dim=\E[2m, dl=\E[%p1%dM$<2*>, dl1=\E[M$<2>, @@ -12990,23 +13464,20 @@ hpa=\E[%i%p1%d`, ich=\E[%p1%d@$<2>, il=\E[%p1%dL$<3*>, il1=\E[L$<3>, ind=\n$<2>, ip=$<4>, is1=\E[?5W, is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25h, - is3=\E>\E(B\E)0\017\E[m, kcbt=\E[Z, kf10=\E[21~, - kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, - kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, - kf19=\E[33~, kf20=\E[34~, kf6=\E[17~, kf7=\E[18~, - kf8=\E[19~, kf9=\E[20~, khlp=\E[28~, khome=\E[26~, lf1=PF1, - lf2=PF2, lf3=PF3, lf4=PF4, mc0=\E[0i, rc=\E8, ri=\EM$<2>, - rmam=\E[?7l, rmcup=\E[ R, rmir=\E[4l, rmkx=\E>, - rmso=\E[27m, rmul=\E[24m, - rs1=\E[13l\E[3l\E\\\E[63;1"p\E[!p, rs2=\E[35h\E[?3l, - rs3=\E[?5l\E[47h\E[40l\E[r, sc=\E7, + is3=\E>\E(B\E)0\017\E[m, kcbt=\E[Z, khlp=\E[28~, + khome=\E[26~, lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, mc0=\E[0i, + rc=\E8, ri=\EM$<2>, rmam=\E[?7l, rmcup=\E[ R, rmir=\E[4l, + rmkx=\E>, rs1=\E[13l\E[3l\E\\\E[63;1"p\E[!p, + rs2=\E[35h\E[?3l, rs3=\E[?5l\E[47h\E[40l\E[r, sc=\E7, sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%? %p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smam=\E[?7h, smcup=\E[ Q, smir=\E[4h, smkx=\E[?1l\E=, tsl=\E7\E[99;%i%p1%dH, vpa=\E[%i%p1%dd, - use=ansi+arrows, use=ansi+inittabs, use=ansi+local, - use=ansi+pp, use=ansi+sgrbold, use=decid+cpr, - use=vt100+4bsd, use=vt220+vtedit, use=vt220+keypad, + use=ecma+underline, use=ecma+standout, use=ansi+arrows, + use=ansi+inittabs, use=ansi+local, use=ansi+pp, + use=ansi+sgrbold, use=decid+cpr, use=vt100+4bsd, + use=vt220+vtedit, use=vt220+keypad, use=vt220+sfkeys, + use=vt220+ufkeys, use=wyse+cvis, # # Wyse 185 with 24 data lines and top status (terminal status) wy185-24|wyse185-24|Wyse 185 with 24 data lines, @@ -13154,8 +13625,7 @@ am, ccc, hs, mir, msgr, xenl, xon, colors#64, cols#80, lines#24, ncv#48, pairs#64, wsl#80, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, civis=\E[?25l, clear=\E[H\E[J$<40>, - cnorm=\E[34h\E[?25h, cr=\r, cub1=^H, cud1=\n, + bel=^G, clear=\E[H\E[J$<40>, cr=\r, cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH$<1>, cvvis=\E[?25h\E[34l, dch=\E[%p1%dP$<1*>, dch1=\E[P$<1>, dclk=\E[31h, dim=\E[2m, dl=\E[%p1%dM$<2*>, dl1=\E[M$<2>, dsl=\E[40l, @@ -13176,50 +13646,44 @@ oc=\E[60w\E[63;0w\E[66;1;4w\E[66;2;13w\E[66;3;16w\E[66;4;49w \E[66;5;51w\E[66;6;61w\E[66;7;64w, op=\E[m, ri=\EM$<2>, rmacs=^O, rmam=\E[?7l, rmclk=\E[31l, - rmcup=\E[ R, rmir=\E[4l, rmkx=\E>, rmso=\E[27m, - rmul=\E[24m, rs1=\E[13l\E[3l\E!p\E[?4i, - rs2=\E[35h\E[?3l$<8>, rs3=\E[?5l, setb=\E[62;%p1%dw, - setf=\E[61;%p1%dw, + rmcup=\E[ R, rmir=\E[4l, rmkx=\E>, + rs1=\E[13l\E[3l\E!p\E[?4i, rs2=\E[35h\E[?3l$<8>, + rs3=\E[?5l, setb=\E[62;%p1%dw, setf=\E[61;%p1%dw, sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%? %p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E[ Q, smir=\E[4h, smkx=\E[?1l\E=, tsl=\E[40l\E[40h\E7\E[99;%i%p1%dH, u0=\E[?38h\E8, u1=\E[?38l\E)0, u2=\E[92;52"p, u3=\E~B, u4=\E[92;76"p, - u5=\E%!1\E[90;1"p, vpa=\E[%i%p1%dd, use=ansi+csr, - use=ansi+inittabs, use=ansi+local, use=ansi+pp, - use=ansi+sgrbold, use=decid+cpr, + u5=\E%!1\E[90;1"p, vpa=\E[%i%p1%dd, use=ecma+underline, + use=ecma+standout, use=ansi+csr, use=ansi+inittabs, + use=ansi+local, use=ansi+pp, use=ansi+sgrbold, + use=decid+cpr, use=wyse+cvis, # # Function key set for the ASCII (wy-50 compatible) keyboard # This is the default 370. # wy370|wyse370|wy370-101k|Wyse 370 with 101 key keyboard, kcbt=\E[Z, kdch1=\EOQ, kdl1=\EOQ, kent=\EOM, kf1=\E[?4i, - kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, - kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf2=\E[?3i, - kf3=\E[2i, kf4=\E[@, kf5=\E[M, kf6=\E[17~, kf7=\E[18~, - kf8=\E[19~, kf9=\E[20~, kich1=\EOP, kil1=\EOP, knp=\E[U, - kpp=\E[V, use=ansi+arrows, use=wy370-nk, + kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, + kf2=\E[?3i, kf3=\E[2i, kf4=\E[@, kf5=\E[M, kich1=\EOP, + kil1=\EOP, knp=\E[U, kpp=\E[V, use=ansi+arrows, + use=vt220+ufkeys, use=wy370-nk, # # Function key set for the VT-320 (and wy85) compatible keyboard # wy370-105k|Wyse 370 with 105 key keyboard, - kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, - kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, - kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, kf6=\E[17~, - kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, - khlp=\E[28~, khome=\E[26~, lf1=PF1, lf2=PF2, lf3=PF3, - lf4=PF4, use=ansi+arrows, use=vt220+vtedit, use=wy370-nk, - use=vt220+keypad, + kfnd=\E[1~, khlp=\E[28~, khome=\E[26~, lf1=PF1, lf2=PF2, + lf3=PF3, lf4=PF4, use=ansi+arrows, use=vt220+vtedit, + use=wy370-nk, use=vt220+keypad, use=vt220+sfkeys, + use=vt220+ufkeys, # # Function key set for the PC compatible keyboard # wy370-EPC|Wyse 370 with 102 key keyboard, - kcbt=\E[Z, kend=\E[1~, kent=\EOM, kf1=\EOP, kf10=\E[21~, - kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, - kf5=\E[M, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, - kich1=\E[2~, knp=\E[U, kpp=\E[V, use=ansi+arrows, - use=wy370-nk, + kcbt=\E[Z, kend=\E[1~, kent=\EOM, kf5=\E[M, kich1=\E[2~, + knp=\E[U, kpp=\E[V, use=ansi+arrows, use=vt100+pf1-pf4, + use=vt220+ufkeys, use=wy370-nk, # # Wyse 370 with visual bell. wy370-vb|Wyse 370 with visible bell, @@ -13314,33 +13778,31 @@ am, hs, km, mir, xenl, xon, cols#80, it#8, lines#24, wsl#80, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, civis=\E[?25l, clear=\E[H\E[J$<40>, - cnorm=\E[34h\E[?25h, cr=\r, csr=\E[%i%p1%d;%p2%dr$<20>, - cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, + bel=^G, clear=\E[H\E[J$<40>, cr=\r, + csr=\E[%i%p1%d;%p2%dr$<20>, cub1=^H, cud1=\n, cvvis=\E[?25h\E[34l, dch=\E[%p1%dP$<3>, dch1=\E[P$<30>, dim=\E[2m, dl=\E[%p1%dM$<2*>, dl1=\E[M$<2>, dsl=\E[0$~, ech=\E[%p1%dX, ed=\E[J$<40>, el=\E[K, el1=\E[1K, - enacs=\E)0, fsl=\E[0$}, home=\E[H, hpa=\E[%i%p1%d`, + enacs=\E)0, fsl=\E[0$}, hpa=\E[%i%p1%d`, ich=\E[%p1%d@$<2>, il=\E[%p1%dL$<3*>, il1=\E[L$<3>, ind=\n$<2>, ip=$<4>, is1=\E[?5W, is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25;67h, is3=\E>\E(B\E)0\017\E[m, kcbt=\E[Z, ked=\E[1~, kel=\E[4~, - kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, - kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, - kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, kf6=\E[17~, - kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khlp=\E[28~, - khome=\E[26~, lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, mc0=\E[0i, - ri=\EM$<2>, rmacs=^O, rmam=\E[?7l, rmcup=\E[ R, rmir=\E[4l, - rmul=\E[24m, rs1=\E[13l\E[3l\E\\\E[63;1"p\E[!p, - rs2=\E[35h\E[?3l, rs3=\E[?5l\E[47h\E[40l\E[r, + khlp=\E[28~, khome=\E[26~, lf1=PF1, lf2=PF2, lf3=PF3, + lf4=PF4, mc0=\E[0i, ri=\EM$<2>, rmacs=^O, rmam=\E[?7l, + rmcup=\E[ R, rmir=\E[4l, + rs1=\E[13l\E[3l\E\\\E[63;1"p\E[!p, rs2=\E[35h\E[?3l, + rs3=\E[?5l\E[47h\E[40l\E[r, sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%? %p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E[ Q\E[?67;8h, smir=\E[4h, tsl=\E[2$~\E[1$}\E[%i%p1%d`, vpa=\E[%i%p1%dd, - use=ansi+arrows, use=ansi+csr, use=ansi+local, - use=ansi+pp, use=ansi+sgrbold, use=ansi+tabs, - use=decid+cpr, use=vt220+vtedit, use=vt220+keypad, + use=ecma+underline, use=ansi+arrows, use=ansi+csr, + use=ansi+cup, use=ansi+local, use=ansi+pp, + use=ansi+sgrbold, use=ansi+tabs, use=decid+cpr, + use=vt220+vtedit, use=vt220+keypad, use=vt220+sfkeys, + use=vt220+ufkeys, use=wyse+cvis, # # Wyse 520 with 24 data lines and status (terminal status) wy520-24|wyse520-24|Wyse 520 with 24 data lines, @@ -13373,9 +13835,8 @@ # to CTRL-C: stty intr '^c') for it to work since the # Delete key sends 7FH. wy520-epc|wyse520-epc|Wyse 520 with EPC keyboard, - kdch1=^?, kel=\E[4~, kend=\E[4~, kf0=\E[21~, kf1=\E[11~, - kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, khome=\E[H, - use=wy520, + kdch1=^?, kel=\E[4~, kend=\E[4~, kf0=\E[21~, khome=\E[H, + use=xterm+r5+fkeys, use=wy520, # # Wyse 520 with 24 data lines and status (terminal status) # with EPC keyboard. @@ -13555,6 +14016,7 @@ is2=\EO\Eq\EG\Ev\EJ\EY7\sK5\sMS\sKermit\s2.27\s+automatic \smargins\s3-17-85\n, use=msk227, + # MS-DOS Kermit 2.27 UCB 227.14 for the IBM PC # Automatic margins now default. Use ansi for highlights. # Define function keys. @@ -13566,8 +14028,9 @@ is2=\EO\Eq\EG\Ev\EJ\EY7\sK6\sMS\sKermit\s2.27\sUCB\s227.14 \sIBM\sPC\s3-17-85\n, kf0=\E0, kf1=\E1, kf2=\E2, kf3=\E3, kf4=\E4, kf5=\E5, kf6=\E6, - kf7=\E7, kf8=\E8, kf9=\E9, rev=\E[7m, rmso=\E[m, rmul=\E[m, - sgr0=\E[m, smso=\E[1m, smul=\E[4m, use=mskermit227, + kf7=\E7, kf8=\E8, kf9=\E9, rev=\E[7m, rmso=\E[m, sgr0=\E[m, + smso=\E[1m, use=ansi+sgrul, use=mskermit227, + # This was designed for a VT320 emulator, but it is probably a good start # at support for the VT320 itself. # Please send changes with explanations to bug-gnu-emacs@prep.ai.mit.edu. @@ -13577,26 +14040,24 @@ cols#80, it#8, lines#49, pb#9600, vt#3, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, cmdch=\E, cr=\r, cub1=^H, - cud1=\n, cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, - ech=\E[%p1%dX, + cud1=\n, dch=\E[%p1%dP, dch1=\E[P, ech=\E[%p1%dX, flash=\E[?5h$<100/>\E[?5l\E[?5h$<100/>\E[?5l\E[?5h$<100/>\E[ ?5l, - home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, - ind=\n, is2=\E>\E F\E[?1h\E[?7h\E[r\E[2$~, kbs=^H, - kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdl1=\E[3~, - kf0=\E[21~, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + ht=^I, hts=\EH, ich=\E[%p1%d@, ind=\n, + is2=\E>\E F\E[?1h\E[?7h\E[r\E[2$~, kbs=^H, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdl1=\E[3~, kf0=\E[21~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, nel=\r\n, rev=\E[7m, ri=\EM, rin=\E[%p1%dL, rmacs=\E(B, rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, - rmso=\E[27m, rmul=\E[24m, rs1=\E(B\E)B\E>\E\sF\E[4;20l\E[12h\E[?1;5;6;38;42l\E[?7;25h \E[4i\E[?4i\E[m\E[r\E[2$~, sgr0=\E[m, smacs=\E(0, smam=\E[?7h, smir=\E[4h, - smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, - tsl=\E[1$}\r\E[K, vpa=\E[%i%p1%dd, use=ansi+csr, - use=ansi+erase, use=ansi+idl, use=ansi+local, use=dec+sl, - use=vt220+cvis, + smkx=\E[?1h\E=, tbc=\E[3g, tsl=\E[1$}\r\E[K, + use=ecma+underline, use=ecma+standout, use=ansi+cup, + use=ansi+csr, use=ansi+erase, use=ansi+idl, + use=ansi+local, use=ansi+rca2, use=dec+sl, + use=vt100+pf1-pf4, use=vt220+cvis, # From: Joseph Gil 13 Dec 1991 # ACS capabilities from Philippe De Muyter 30 May 1996 @@ -13606,21 +14067,21 @@ cols#80, it#8, lines#24, vt#3, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[;H\E[2J, cr=\r, - cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, - dch1=\E[P, dsl=\E[2$~\r\E[1$}\E[K\E[$}, ed=\E[J, el=\E[K, - flash=\E[?5h$<100/>\E[?5l, fsl=\E[$}, home=\E[H, ht=^I, - hts=\EH, ich=\E[%p1%d@, il1=\E[L$<3/>, ind=\ED, + cub1=^H, cud1=\n, dch=\E[%p1%dP, dch1=\E[P, + dsl=\E[2$~\r\E[1$}\E[K\E[$}, ed=\E[J, el=\E[K, + flash=\E[?5h$<100/>\E[?5l, fsl=\E[$}, ht=^I, hts=\EH, + ich=\E[%p1%d@, il1=\E[L$<3/>, ind=\ED, is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, - kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, - kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, lf2=pf2, - lf3=pf3, lf4=pf4, nel=\r\ED, rev=\E[7m, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, + lf2=pf2, lf3=pf3, lf4=pf4, nel=\r\ED, rev=\E[7m, rf=/usr/share/tabset/vt100, ri=\EM, rmacs=^O, - rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, - rmul=\E[24m, rs1=\E[?3l, sgr0=\E[m, smacs=^N, smam=\E[?7h, - smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, - tbc=\E[3g, tsl=\E[2$~\E[1$}\E[1;%dH, use=ansi+csr, - use=ansi+idl, use=ansi+local, use=vt220+cvis, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rs1=\E[?3l, + sgr0=\E[m, smacs=^N, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1h\E=, tbc=\E[3g, tsl=\E[2$~\E[1$}\E[1;%dH, + use=ecma+underline, use=ecma+standout, use=ansi+csr, + use=ansi+cup, use=ansi+idl, use=ansi+local, + use=vt100+pf1-pf4, use=vt220+cvis, ######## NON-ANSI TERMINAL EMULATIONS # @@ -13659,7 +14120,7 @@ # ^V^K%p1%c%p2%c%p3%c%p4%c%p5%c -- scroll (p2,p3) to (p4,p5) down by p1 lines # ^V^L%p1%c%p2%c%p3%c -- clear p2 lines and p3 cols w/attr %p1 # ^V^M%p1%c%p2%c%p3%c%p4%c -- fill p3 lines & p4 cols w/char p2+attr %p1 -# (^V^L and ^V^M set the current attribute as a side-effect.) +# (^V^L and ^V^M set the current attribute as a side effect.) # ^V ^Y [...] -- repeat pattern. specifies the number of bytes # in the pattern, the number of times the pattern # should be repeated. If either value is 0, no-op. @@ -13754,7 +14215,7 @@ # This line: # cup=\376G%p2%c%p1%c # LOOKS like it will work, but sometimes only one of the two numbers is sent. -# See the terminfo (5) manpage commented regarding 'Terminals which use "%c"'. +# See the terminfo(5) man page commented regarding 'Terminals which use "%c"'. # # Alas, there is no cursor upline capability on this display. # @@ -13795,17 +14256,17 @@ att2300|sv80|AT&T 2300 Video Information Terminal 80 column mode, am, eo, mir, msgr, xon, cols#80, it#8, lines#24, - bel=^G, cr=\r, cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, - dch=\E[%p1%dP, dch1=\E[P, el1=\E[1K, home=\E[H, ht=^I, - ich=\E[%p1%d@, ind=\n, kcbt=\E[Z, kclr=\E[J, kdch1=\E[P, - kdl1=\E[M, kf1=\E[1r, kf10=\E[10r, kf11=\E[11r, - kf12=\E[12r, kf13=\E[13r, kf14=\E[14r, kf15=\E[15r, - kf16=\E[16r, kf2=\E[2r, kf3=\E[3r, kf4=\E[4r, kf5=\E[5r, - kf6=\E[6r, kf7=\E[7r, kf8=\E[8r, kf9=\E[9r, kich1=\E[@, - kil1=\E[L, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, rev=\E[7m, - rmir=\E[4l, rmso=\E[m, sgr0=\E[m, smir=\E[4h, smso=\E[7m, - use=ansi+arrows, use=ansi+cpr, use=ansi+erase, - use=ansi+idl, use=ansi+local, + bel=^G, cr=\r, cub1=^H, cud1=\n, dch=\E[%p1%dP, dch1=\E[P, + el1=\E[1K, ht=^I, ich=\E[%p1%d@, ind=\n, kcbt=\E[Z, + kclr=\E[J, kdch1=\E[P, kdl1=\E[M, kf1=\E[1r, kf10=\E[10r, + kf11=\E[11r, kf12=\E[12r, kf13=\E[13r, kf14=\E[14r, + kf15=\E[15r, kf16=\E[16r, kf2=\E[2r, kf3=\E[3r, kf4=\E[4r, + kf5=\E[5r, kf6=\E[6r, kf7=\E[7r, kf8=\E[8r, kf9=\E[9r, + kich1=\E[@, kil1=\E[L, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, + rev=\E[7m, rmir=\E[4l, sgr0=\E[m, smir=\E[4h, + use=ansi+arrows, use=ansi+cpr, use=ansi+cup, + use=ansi+erase, use=ansi+idl, use=ansi+local, + use=ansi+sgrso, att2350|AT&T 2350 Video Information Terminal 80 column mode, mc0@, mc4@, mc5@, use=att2300, @@ -13826,10 +14287,8 @@ cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80, acsc=++\,\,--..00``aaffgghhjjkkllmmnnooppqqrrssttuuvvwwxxyyz z{{||}}~~, - bel=^G, bold=\E[2;7m, cr=\r, cub1=^H, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, dch1=\E[P, dim=\E[2m, dl1=\E[M, - fsl=\E8, home=\E[H, ht=^I, ich1=\E[@, il1=\E[L, ind=\n, - is1=\E[?3l\E)0, + bel=^G, bold=\E[2;7m, cr=\r, cub1=^H, dch1=\E[P, dim=\E[2m, + fsl=\E8, ht=^I, ich1=\E[@, ind=\n, is1=\E[?3l\E)0, is3=\E[1;03q\s\s\sf1\s\s\s\s\s\s\s\s\s\s\s\EOP\E[2;03q\s\s \sf2\s\s\s\s\s\s\s\s\s\s\s\EOQ\E[3;03q\s\s\sf3\s\s\s\s \s\s\s\s\s\s\s\EOR\E[4;03q\s\s\sf4\s\s\s\s\s\s\s\s\s\s @@ -13837,9 +14296,8 @@ \s\s\sf6\s\s\s\s\s\s\s\s\s\s\s\EOU\E[7;03q\s\s\sf7\s\s \s\s\s\s\s\s\s\s\s\EOV\E[8;03q\s\s\sf8\s\s\s\s\s\s\s\s \s\s\s\EOW, - kclr=\E[2J, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, - kf6=\EOU, kf7=\EOV, kf8=\EOW, kll=\E[24;1H, ll=\E[24H, - nel=\r\n, + kclr=\E[2J, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, + kll=\E[24;1H, ll=\E[24H, nel=\r\n, pfx=\E[%p1%1d;%p2%l%2.2dq\s\s\sf%p1%1d\s\s\s\s\s\s\s\s\s\s \s%p2%s, pln=\E[%p1%d;00q%p2%:-16s, ri=\EM, rmacs=^O, @@ -13847,8 +14305,9 @@ sgr=\E[0%?%p1%p5%|%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1 %|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, tsl=\E7\E[25;%p1%{1}%+%dH, - use=ansi+arrows, use=ansi+csr, use=ansi+erase, - use=ansi+local1, use=ansi+sgrbold, + use=ansi+arrows, use=ansi+csr, use=ansi+cup, + use=ansi+erase, use=ansi+idl1, use=ansi+local1, + use=ansi+sgrbold, use=vt100+pf1-pf4, att4410v1-w|att5410v1-w|tty5410v1-w|AT&T 4410/5410 132 columns - version 1, cols#132, wsl#132, @@ -13872,18 +14331,18 @@ bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, clear=\E[H\E[J$<50>, cr=\r, cub1=^H, cud1=\n, cuf1=\E[C$<2>, cup=\E[%i%p1%d;%p2%dH$<5>, - cuu1=\E[A$<2>, dch1=\E[P, dl1=\E[M, ed=\E[J$<50>, - el=\E[K$<3>, el1=\E[1K$<3>, enacs=\E(B\E)0, home=\E[H, - ht=^I, hts=\EH, ich1=\E[@, il1=\E[L, ind=\n, kbs=^H, - kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, - rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, - rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, - rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + cuu1=\E[A$<2>, dch1=\E[P, ed=\E[J$<50>, el=\E[K$<3>, + el1=\E[1K$<3>, enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, + ich1=\E[@, ind=\n, kbs=^H, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, rev=\E[7m$<2>, ri=\EM$<5>, + rmacs=^O, rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m$<2>, + rmul=\E[m$<2>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 %;m%?%p9%t\016%e\017%;$<2>, sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, - use=ansi+csr, use=decid+cpr, use=vt100+fnkeys, + use=ansi+csr, use=ansi+idl1, use=decid+cpr, + use=vt100+fnkeys, # # Teletype Model 5420 -- A souped up 5410, with multiple windows, @@ -13991,12 +14450,10 @@ cols#80, lh#2, lines#24, lm#78, lw#8, nlab#8, wsl#55, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, cbt=\E[1Z, clear=\EH\EJ, cnorm=\E[11;0j, cr=\EG, cub1=^H, - cud1=\E[1B, cuf1=\E[1C, cup=\E[%i%p1%d;%p2%dH, - cuu1=\E[1A, cvvis=\E[11;1j, dch=\E[%p1%dP, dch1=\E[P, - ech=\E[%p1%ds\E[%p1%dD, ed=\E[0J, el=\E[0K, el1=\E[1K, - flash=\E[?5h$<200>\E[?5l, fsl=\E8, home=\E[H, - hpa=\E[%p1%{1}%+%dG, ich=\E[%p1%d@, ich1=\E[@, ind=\n, - indn=\E[%p1%dE, + cud1=\E[1B, cuf1=\E[1C, cuu1=\E[1A, cvvis=\E[11;1j, + dch=\E[%p1%dP, dch1=\E[P, ech=\E[%p1%ds\E[%p1%dD, + ed=\E[0J, el=\E[0K, el1=\E[1K, flash=\E[?5h$<200>\E[?5l, + fsl=\E8, ich=\E[%p1%d@, ich1=\E[@, ind=\n, indn=\E[%p1%dE, is1=\E[0;23r\Ex\Ey\E[2;0j\E[3;3j\E[4;0j\E[5;0j\E[6;0j\E[7;0j \E[8;0j\E[9;1j\E[10;0j\E[15;0j\E[16;1j\E[19;0j\E[20;1j \E[29;0j\E[1;24r, @@ -14015,10 +14472,10 @@ sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1 %|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;%?%p8%t\EV%;, sgr0=\E[m\017, smacs=^N, smkx=\E[19;1j, smln=\E~, - tsl=\E7\E[25;%p1%{8}%+%dH, vpa=\E[%p1%{1}%+%dd, - use=ansi+arrows, use=ansi+csr, use=ansi+idl, - use=ansi+inittabs, use=ansi+local, use=ansi+sgrdim, - use=decid+cpr, + tsl=\E7\E[25;%p1%{8}%+%dH, use=ansi+arrows, + use=ansi+csr, use=ansi+cup, use=ansi+idl, + use=ansi+inittabs, use=ansi+local, use=ansi+rca, + use=ansi+sgrdim, use=decid+cpr, att5420_2-w|AT&T 5420 model 2 in 132 column mode, cols#132, @@ -14031,9 +14488,8 @@ am, xon, cols#80, lines#24, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, blink=\E[5m, clear=\E[H\E[2J, cr=\r, - cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[1P, - dim=\E[2m, ed=\E[0J, el=\E[0K, home=\E[H, ich=\E[%p1%d@, + bel=^G, blink=\E[5m, clear=\E[H\E[2J, cr=\r, dch=\E[%p1%dP, + dch1=\E[1P, dim=\E[2m, ed=\E[0J, el=\E[0K, ich=\E[%p1%d@, ich1=\E[1@, il1=\E[1L, ind=\n, is1=\E[?3l, is2=\E)0\E?6l\E?5l, kclr=\E[%%, kcub1=\E@, kcud1=\EU, kcuf1=\EA, kcuu1=\ES, kent=\E[, kf1=\E[h, kf10=\E[m, @@ -14041,9 +14497,9 @@ kf18=\E[K, kf19=\E[L, kf2=\E[i, kf20=\E[E, kf21=\E[_, kf22=\E[M, kf23=\E[N, kf24=\E[O, kf3=\E[j, kf6=\E[k, kf7=\E[l, kf8=\E[f, kf9=\E[w, khome=\Ec, rc=\E8, rev=\E[7m, - rmacs=^O, rmso=\E[m, rmul=\E[m, sc=\E7, sgr0=\E[m\017, - smacs=^N, smso=\E[7m, smul=\E[4m, use=ansi+idl, - use=ansi+local, + rmacs=^O, sc=\E7, sgr0=\E[m\017, smacs=^N, use=ansi+cup, + use=ansi+idl, use=ansi+local, use=ansi+sgrso, + use=ansi+sgrul, att4418-w|att5418-w|AT&T 5418 132 cols, cols#132, @@ -14081,16 +14537,16 @@ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E3, bold=\E3, cbt=\EO, clear=\E[H\E[2J, cr=\r, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\EB, cuf1=\EC, - cup=\E[%i%p1%d;%p2%dH, cuu1=\EA, dch=\E[%p1%dP, dch1=\EP, - dim=\EW, dl=\E[%p1%dM, dl1=\EM, ed=\EJ, el=\Ez, home=\E[H, - ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E\^, il=\E[%p1%dL, - il1=\EL, ind=\n, is2=\E[20l\E[?7h, kclr=\EJ, kf1=\EOP, - kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=\EE, rev=\E}, ri=\ET, - rmacs=\E(B, rmso=\E~, rmul=\EZ, + cuu1=\EA, dch=\E[%p1%dP, dch1=\EP, dim=\EW, dl=\E[%p1%dM, + dl1=\EM, ed=\EJ, el=\Ez, ht=^I, hts=\EH, ich=\E[%p1%d@, + ich1=\E\^, il=\E[%p1%dL, il1=\EL, ind=\n, is2=\E[20l\E[?7h, + kclr=\EJ, nel=\EE, rev=\E}, ri=\ET, rmacs=\E(B, rmso=\E~, + rmul=\EZ, sgr=\EX\E~\EZ\E4\E(B%?%p1%p3%|%t\E}%;%?%p2%t\E\\%;%?%p4%p6%| %t\E3%;%?%p5%t\EW%;%?%p9%t\E(0%;, sgr0=\EX\E~\EZ\E4\E(B, smacs=\E(0, smso=\E}, smul=\E\\, - tbc=\EF, use=ansi+arrows, use=ansi+local, + tbc=\EF, use=ansi+arrows, use=ansi+cup, use=ansi+local, + use=vt100+pf1-pf4, att4424-1|tty4424-1|Teletype 4424 in display function group I, kclr@, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome@, @@ -14108,9 +14564,9 @@ bel=^G, clear=\E[2;H\E[J, cr=\r, cub1=^H, cud1=\n, cuf1=\E[C, cup=\E[%i%p1%2d;%p2%2dH\E[B, cuu1=\E[A, dch1=\EP, dl1=\EM, el=\E[K, ht=^I, ich1=\E\^, il1=\EL, ind=\n, ip=$<2/>, - is2=\E[m\E[2;24r, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, - nel=\r\n, ri=\ET, rmso=\E[m, rmul=\E[m, sgr0=\E[m, - smso=\E[7m, smul=\E[4m, use=ansi+arrows, + is2=\E[m\E[2;24r, nel=\r\n, ri=\ET, sgr0=\E[m, + use=ansi+arrows, use=ansi+sgrso, use=ansi+sgrul, + use=vt100+pf1-pf4, # The Teletype 5425 is really version 2 of the Teletype 5420. It # is quite similar, except for some minor differences. No page @@ -14127,8 +14583,8 @@ bold=\E[2;7m, cnorm=\E[12;0j, cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, cvvis=\E[12;1j, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, ech=\E[%p1%ds\E[%p1%dD, el1=\E[1K, - flash=\E[?5h$<200>\E[?5l, fsl=\E8, hpa=\E[%p1%{1}%+%dG, - ich=\E[%p1%d@, indn=\E[%p1%dE, is1=\E<\E[?3l$<100>, + flash=\E[?5h$<200>\E[?5l, fsl=\E8, ich=\E[%p1%d@, + indn=\E[%p1%dE, is1=\E<\E[?3l$<100>, is2=\E[m\017\E[1;2;3;4;6l\E[12;13;14;20l\E[?6;97;99l\E[?7h \E[4i\Ex\E[25;1j\212, is3=\E[?5l, kbeg=\Et, kcbt=\E[Z, kclr=\E[J, kdch1=\E[P, @@ -14145,9 +14601,9 @@ %|%t;7%;%?%p7%t;8%;m%?%p8%t\EV%;%?%p9%t\016%e\017%;, sgr0=\E[m\017, smam=\E[?7h, smir=\E[4h, smkx=\E[21;1j\E[25;4j\Eent\E~, smln=\E~, - tsl=\E7\E[25;%p1%{8}%+%dH, vpa=\E[%p1%{1}%+%dd, - use=ansi+arrows, use=ansi+csr, use=ansi+erase, - use=ansi+idl, use=ansi+inittabs, use=ansi+local, + tsl=\E7\E[25;%p1%{8}%+%dH, use=ansi+arrows, + use=ansi+csr, use=ansi+erase, use=ansi+idl, + use=ansi+inittabs, use=ansi+local, use=ansi+rca, use=ansi+sgrbold, use=decid+cpr, use=vt100+4bsd, att5425-nl|tty5425-nl|att4425-nl|AT&T 4425/5425 80 columns no labels, @@ -14164,17 +14620,17 @@ cols#80, lines#24, lm#48, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, bold=\E[5m, clear=\E[H\E[2J\E[1U\E[H\E[2J\E[1V, - cr=\r, cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\EP, - ed=\E[J, el=\E[0K, home=\E[H, hpa=\E[%p1%dG, ht=^I, hts=\E1, - ich=\E[%p1%d@, ich1=\E\^, il1=\EL, ind=\n, is1=\Ec\E[?7h, - is2=\E[m\E[1;24r, kbs=^H, kcbt=\EO, kclr=\E[2J, kf1=\EOP, - kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, - kf8=\EOW, khome=\E[H, kll=\E[24;1H, ll=\E[24H, nel=\r\n, - rc=\E8, rev=\E[7m, ri=\ET, rmacs=\E(B, rmam=\E[?7l, - rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l\E[2;0y, sc=\E7, - sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smso=\E[5m, - smul=\E[4m, tbc=\E[3g, vpa=\E[%p1%dd, use=ansi+idl, - use=ansi+local, use=ecma+index, use=vt52+arrows, + cr=\r, dch=\E[%p1%dP, dch1=\EP, ed=\E[J, el=\E[0K, + hpa=\E[%p1%dG, ht=^I, hts=\E1, ich=\E[%p1%d@, ich1=\E\^, + il1=\EL, ind=\n, is1=\Ec\E[?7h, is2=\E[m\E[1;24r, kbs=^H, + kcbt=\EO, kclr=\E[2J, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, + khome=\E[H, kll=\E[24;1H, ll=\E[24H, nel=\r\n, rc=\E8, + rev=\E[7m, ri=\ET, rmacs=\E(B, rmam=\E[?7l, rmso=\E[m, + rs2=\Ec\E[?3l\E[2;0y, sc=\E7, sgr0=\E[m\E(B, smacs=\E(0, + smam=\E[?7h, smso=\E[5m, tbc=\E[3g, vpa=\E[%p1%dd, + use=ansi+cup, use=ansi+idl, use=ansi+local, + use=ansi+sgrul, use=ecma+index, use=vt100+pf1-pf4, + use=vt52+arrows, # Terminfo entry for the AT&T 510 A Personal Terminal # Function keys 9 - 16 are available only after the @@ -14190,9 +14646,8 @@ acsc=+g\,h-f.e`bhrisjjkkllmmnnqqttuuvvwwxx{{||}}~~, bel=^G, blink=\E[5m, bold=\E[2;7m, civis=\E[11;0|, clear=\E[H\E[J, cnorm=\E[11;3|, cr=\r, cub1=^H, - cup=\E[%i%p1%d;%p2%dH, cvvis=\E[11;2|, dch=\E[%p1%dP, - dch1=\E[P, dim=\E[2m, ed=\E[0J, el=\E[0K, el1=\E[1K, - enacs=\E(B\E)1, ff=^L, home=\E[H, ind=\n, + cvvis=\E[11;2|, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + ed=\E[0J, el=\E[0K, el1=\E[1K, enacs=\E(B\E)1, ff=^L, ind=\n, is1=\E(B\E)1\E[2l, is3=\E[21;1|\212, kLFT=\E[u, kRIT=\E[v, kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOm, kf10=\EOd, kf11=\EOe, @@ -14200,13 +14655,12 @@ kf2=\EOV, kf3=\EOu, kf4=\ENj, kf5=\ENe, kf6=\ENf, kf7=\ENh, kf8=\E[H, kf9=\EOc, kind=\E[S, kri=\E[T, mc0=\E[0i, mc4=\E[?8i, mc5=\E[?4i, nel=\EE, pln=\E[%p1%dp%p2%:-16s, - rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, rmkx=\E[19;0|, - rmso=\E[m, rmul=\E[m, sc=\E7, + rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, rmkx=\E[19;0|, sc=\E7, sgr=\E[0%?%p5%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6 %|%t;7%;m%?%p9%t\016%e\017%;, - sgr0=\E[m\017, smacs=^N, smkx=\E[19;1|, smso=\E[7m, - smul=\E[4m, use=ansi+cpr, use=ansi+idl, use=ansi+local, - use=ansi+tabs, + sgr0=\E[m\017, smacs=^N, smkx=\E[19;1|, use=ansi+cpr, + use=ansi+cup, use=ansi+idl, use=ansi+local, + use=ansi+sgrso, use=ansi+sgrul, use=ansi+tabs, # Terminfo entry for the AT&T 510 D Personal Terminal # Function keys 9 through 16 are accessed by bringing up the @@ -14222,27 +14676,25 @@ cols#80, lh#2, lines#24, lm#48, lw#7, nlab#8, acsc=+g\,h-f.e`bhrisjjkkllmmnnqqttuuvvwwxx{{||}}~~, bel=^G, bold=\E[2;7m, clear=\E[H\E[J, cnorm=\E[11;3|, - cr=\r, cub1=^H, cup=\E[%i%p1%d;%p2%dH, cvvis=\E[11;2|, - dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, ed=\E[0J, el=\E[0K, - el1=\E[1K, enacs=\E(B\E)1, ff=^L, home=\E[H, - hpa=\E[%p1%{1}%+%dG, ich=\E[%p1%d@, ind=\n, - is1=\E(B\E)1\E[5;0|, is3=\E[21;1|\212, kLFT=\E[u, - kRIT=\E[v, kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, - kcuf1=\E[C, kcuu1=\E[A, kf1=\EOm, kf10=\EOd, kf11=\EOe, - kf12=\EOf, kf13=\EOg, kf14=\EOh, kf15=\EOi, kf16=\EOj, - kf2=\EOV, kf3=\EOu, kf4=\ENj, kf5=\ENe, kf6=\ENf, kf7=\ENh, - kf8=\E[H, kf9=\EOc, kind=\E[S, kri=\E[T, ll=\E#2, mc0=\E[0i, - mc4=\E[?8i, mc5=\E[?4i, mgc=\E:, nel=\EE, + cr=\r, cub1=^H, cvvis=\E[11;2|, dch=\E[%p1%dP, dch1=\E[P, + dim=\E[2m, ed=\E[0J, el=\E[0K, el1=\E[1K, enacs=\E(B\E)1, + ff=^L, ich=\E[%p1%d@, ind=\n, is1=\E(B\E)1\E[5;0|, + is3=\E[21;1|\212, kLFT=\E[u, kRIT=\E[v, kbs=^H, kcbt=\E[Z, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOm, + kf10=\EOd, kf11=\EOe, kf12=\EOf, kf13=\EOg, kf14=\EOh, + kf15=\EOi, kf16=\EOj, kf2=\EOV, kf3=\EOu, kf4=\ENj, kf5=\ENe, + kf6=\ENf, kf7=\ENh, kf8=\E[H, kf9=\EOc, kind=\E[S, kri=\E[T, + ll=\E#2, mc0=\E[0i, mc4=\E[?8i, mc5=\E[?4i, mgc=\E:, nel=\EE, pln=\E[%p1%dp%p2%:-16s, rc=\E8, ri=\EM, rmacs=^O, rmir=\E[4l, rmkx=\E[19;0|, rmln=\E<, rmxon=\E[29;1|, rs2=\E[5;0|, sc=\E7, sgr=\E[0%?%p5%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6 %|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smgl=\E4, smgr=\E5, smir=\E[4h, - smkx=\E[19;1|, smln=\E?, smxon=\E[29;0|, - vpa=\E[%p1%{1}%+%dd, use=ansi+cpr, use=ansi+idl, - use=ansi+local, use=ansi+rep, use=ansi+sgrbold, - use=ansi+tabs, use=ecma+index, + smkx=\E[19;1|, smln=\E?, smxon=\E[29;0|, use=ansi+cpr, + use=ansi+cup, use=ansi+idl, use=ansi+local, use=ansi+rep, + use=ansi+sgrbold, use=ansi+tabs, use=ecma+index, + use=ansi+rca, # (att500: I merged this with the att513 entry, att500 just used att513 -- esr) att500|att513|AT&T 513 using page mode, @@ -14250,11 +14702,9 @@ cols#80, lh#2, lines#24, lw#8, nlab#8, acsc=+g\,h-f.e`bhrisjjkkllmmnnqqttuuvvwwxx{{||}}~~, bel=^G, bold=\E[2;7m, cnorm=\E[11;0|, cr=\r, - csr=%i\E[%p1%d;%p2%dr, cub1=^H, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, cvvis=\E[11;1|, dch=\E[%p1%dP, - dch1=\E[P$<1>, dim=\E[2m, el1=\E[1K, enacs=\E(B\E)1, - home=\E[H, hpa=\E[%p1%{1}%+%dG, ich=\E[%p1%d@, ind=\n, - indn=\E[%p1%dE, + csr=%i\E[%p1%d;%p2%dr, cub1=^H, cud1=\n, cvvis=\E[11;1|, + dch=\E[%p1%dP, dch1=\E[P$<1>, dim=\E[2m, el1=\E[1K, + enacs=\E(B\E)1, ich=\E[%p1%d@, ind=\n, indn=\E[%p1%dE, is1=\E?\E[3;3|\E[10;0|\E[21;1|\212\E[6;1|\E[1{\E[?99l, kBEG=\ENB, kCAN=\EOW, kCMD=\EOU, kCPY=\END, kCRT=\EON, kDC=\ENF, kDL=\ENE, kEND=\ENN, kEOL=\EOA, kEXT=\EOK, @@ -14287,9 +14737,9 @@ sgr=\E[0%?%p1%p5%|%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1 %|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smir=\E[4h, - smkx=\E[19;1|\E[21;4|\Eent, smln=\E?, - vpa=\E[%p1%{1}%+%dd, use=ansi+arrows, use=ansi+erase, - use=ansi+idl, use=ansi+local, use=ansi+rep, + smkx=\E[19;1|\E[21;4|\Eent, smln=\E?, use=ansi+arrows, + use=ansi+cup, use=ansi+erase, use=ansi+idl, + use=ansi+local, use=ansi+rca, use=ansi+rep, use=ansi+sgrbold, use=ansi+tabs, use=decid+cpr, # 01-07-88: @@ -14340,12 +14790,11 @@ att5620-1|tty5620-1|dmd1|Teletype 5620 with old ROMs, am, xon, cols#88, it#8, lines#70, vt#3, - bel=^G, cr=\r, cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, - dch=\E[%p1%dP, dch1=\E[P, home=\E[H, ht=^I, ich=\E[%p1%d@, - ich1=\E[@, ind=\n, kclr=\E[2J, kll=\E[70;1H, nel=\r\n, - rc=\E8, ri=\E[T, rs1=\Ec, sc=\E7, use=ansi+arrows, - use=ansi+erase, use=ansi+idl, use=ansi+local1, - use=ecma+index, + bel=^G, cr=\r, cub1=^H, cud1=\n, dch=\E[%p1%dP, dch1=\E[P, + ht=^I, ich=\E[%p1%d@, ich1=\E[@, ind=\n, kclr=\E[2J, + kll=\E[70;1H, nel=\r\n, rc=\E8, ri=\E[T, rs1=\Ec, sc=\E7, + use=ansi+arrows, use=ansi+cup, use=ansi+erase, + use=ansi+idl, use=ansi+local1, use=ecma+index, # 5620 terminfo (2.0 or later ROMS with char attributes) # The following SET-UP modes are assumed for normal operation: @@ -14362,12 +14811,12 @@ att5620|dmd|tty5620|ttydmd|5620|AT&T 5620 terminal 88 columns, OTbs, am, msgr, npc, xon, cols#88, it#8, lines#70, - bel=^G, bold=\E[2m, cr=\r, cub1=^H, cup=\E[%i%p1%d;%p2%dH, - dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, home=\E[H, ht=^I, - ich=\E[%p1%d@, ich1=\E[@, ind=\E[S, kclr=\E[2J, - kll=\E[70;1H, nel=\n, pfx=\E[%p1%d;%p2%l%dq%p2%s, rc=\E8, - rev=\E[7m, ri=\E[T, rmso=\E[0m, rmul=\E[0m, rs1=\Ec, sc=\E7, - sgr0=\E[0m, smso=\E[7m, smul=\E[4m, use=ansi+arrows, + bel=^G, bold=\E[2m, cr=\r, cub1=^H, dch=\E[%p1%dP, dch1=\E[P, + dim=\E[2m, ht=^I, ich=\E[%p1%d@, ich1=\E[@, ind=\E[S, + kclr=\E[2J, kll=\E[70;1H, nel=\n, + pfx=\E[%p1%d;%p2%l%dq%p2%s, rc=\E8, rev=\E[7m, ri=\E[T, + rmso=\E[0m, rmul=\E[0m, rs1=\Ec, sc=\E7, sgr0=\E[0m, + smso=\E[7m, smul=\E[4m, use=ansi+arrows, use=ansi+cup, use=ansi+erase, use=ansi+idl, use=ansi+local1, use=ecma+index, @@ -14393,8 +14842,8 @@ cols#80, lines#24, lw#8, nlab#8, wsl#80, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, cr=\r, cub1=^H, - cup=\E[%i%p1%d;%p2%dH, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, - el1=\E[1K, fsl=\E8, ht=^I, il1=\E[L, ind=\n, invis=\E[8m, + cup=\E[%i%p1%d;%p2%dH, dim=\E[2m, dl=\E[%p1%dM, + el1=\E[1K, fsl=\E8, ht=^I, ind=\n, invis=\E[8m, is1=\E[8;0|\E[?\E[13;20l\E[?\E[12h, is2=\E[m\017, kLFT=\E[ A, kRIT=\E[ @, kcbt=\E[Z, kclr=\E[2J, kdch1=\E[P, kdl1=\E[M, kend=\E[24;1H, kf1=\EOc, kf10=\ENp, kf11=\ENq, @@ -14411,11 +14860,11 @@ mc5=\E[?5i, nel=\EE, pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, rev=\E[7m, - rmacs=^O, rmln=\E[2p, rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l, - sc=\E7, sgr0=\E[m\017, smacs=\E)0\016, smln=\E[p, - smso=\E[7m, smul=\E[4m, tsl=\E7\E[25;%i%p1%dx, + rmacs=^O, rmln=\E[2p, rs2=\Ec\E[?3l, sc=\E7, sgr0=\E[m\017, + smacs=\E)0\016, smln=\E[p, tsl=\E7\E[25;%i%p1%dx, use=ansi+arrows, use=ansi+cpr, use=ansi+erase, - use=ansi+idc, use=ansi+local1, + use=ansi+idc, use=ansi+idl1, use=ansi+local1, + use=ansi+sgrso, use=ansi+sgrul, att605-pc|AT&T 605 in pc term mode, acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x @@ -14576,21 +15025,21 @@ att630|AT&T 630 windowing terminal, OTbs, am, da, db, mir, msgr, npc, xon, cols#80, it#8, lines#60, lm#0, - bel=^G, blink=\E[5m, cbt=\E[Z, cr=\r, cub1=^H, - cup=\E[%i%p1%d;%p2%dH, dim=\E[2m, el1=\E[1K, home=\E[H, - ht=^I, ind=\ED, is2=\E[m, kcbt=\E[Z, kclr=\E[2J, kdch1=\E[P, - kdl1=\E[M, kent=\r, kf10=\ENp, kf11=\ENq, kf12=\ENr, - kf13=\ENs, kf14=\ENt, kf15=\ENu, kf16=\ENv, kf17=\ENw, - kf18=\ENx, kf19=\ENy, kf20=\ENz, kf21=\EN{, kf22=\EN|, - kf23=\EN}, kf24=\EN~, kf9=\ENo, kich1=\E[@, kil1=\E[L, - mc4=\E[?4i, mc5=\E[?5i, nel=\r\n, + bel=^G, blink=\E[5m, cbt=\E[Z, cr=\r, cub1=^H, dim=\E[2m, + el1=\E[1K, ht=^I, ind=\ED, is2=\E[m, kcbt=\E[Z, kclr=\E[2J, + kdch1=\E[P, kdl1=\E[M, kent=\r, kf10=\ENp, kf11=\ENq, + kf12=\ENr, kf13=\ENs, kf14=\ENt, kf15=\ENu, kf16=\ENv, + kf17=\ENw, kf18=\ENx, kf19=\ENy, kf20=\ENz, kf21=\EN{, + kf22=\EN|, kf23=\EN}, kf24=\EN~, kf9=\ENo, kich1=\E[@, + kil1=\E[L, mc4=\E[?4i, mc5=\E[?5i, nel=\r\n, pfx=\E[%p1%d;%p2%l%dq%p2%s, rc=\E8, rev=\E[7m, ri=\EM, - rmso=\E[m, rmul=\E[m, rs2=\Ec, sc=\E7, + rs2=\Ec, sc=\E7, sgr=\E[0%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%p4%|%t;7 %;m, - sgr0=\E[m, smso=\E[7m, smul=\E[4m, use=ansi+arrows, - use=ansi+cpr, use=ansi+erase, use=ansi+idc, use=ansi+idl, - use=ansi+local, use=ecma+index, + sgr0=\E[m, use=ansi+arrows, use=ansi+cpr, use=ansi+cup, + use=ansi+erase, use=ansi+idc, use=ansi+idl, + use=ansi+local, use=ansi+sgrso, use=ansi+sgrul, + use=ecma+index, att630-24|5630-24|5630DMD-24|630MTG-24|AT&T 630 windowing terminal 24 lines, lines#24, use=att630, @@ -14676,10 +15125,10 @@ am, eslok, hs, mir, msgr, xenl, xon, cols#80, lh#2, lines#24, lw#8, nlab#8, wsl#80, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, cr=\r, cub1=^H, cup=\E[%i%p1%d;%p2%dH, - cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, - el1=\E[1K, enacs=\E(B\E)0, flash=\E[?5h$<200>\E[?5l, - fln=4\,4, fsl=\E8, home=\E[H, ich=\E[%p1%d@, ind=\ED, + bel=^G, cr=\r, cub1=^H, cvvis=\E[?12;25h, dch=\E[%p1%dP, + dch1=\E[P, dim=\E[2m, el1=\E[1K, enacs=\E(B\E)0, + flash=\E[?5h$<200>\E[?5l, fln=4\,4, fsl=\E8, + ich=\E[%p1%d@, ind=\ED, is2=\E[50;4|\E[53;0|\E[8;0|\E[?4;13;15l\E[13;20l\E[?7h\E[12h \E(B\E)0\E[?31l\E[0m\017, is3=\E(B\E)0, kLFT=\E[ A, kRIT=\E[ @, kcbt=\E[Z, @@ -14697,13 +15146,14 @@ pfx=\E[%p1%d;%p2%l%02dq%?%p1%{9}%<%t\s\s\sF%p1%1d\s\s\s\s\s \s\s\s\s\s\s%;%p2%s, pln=\E[%p1%d;0;0;0q%p2%:-16.16s, ri=\EM, rmacs=^O, - rmir=\E[4l, rmln=\E[2p, rmso=\E[27m, rmul=\E[24m, - rmxon=\E[53;3|, rs1=\Ec\E[?3;5l\E[56;0|, + rmir=\E[4l, rmln=\E[2p, rmxon=\E[53;3|, + rs1=\Ec\E[?3;5l\E[56;0|, sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1 %|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smir=\E[4h, smln=\E[p, - smxon=\E[53;0|, tsl=\E7\E[99;%i%p1%dx, use=ansi+arrows, - use=ansi+csr, use=ansi+erase, use=ansi+idl, + smxon=\E[53;0|, tsl=\E7\E[99;%i%p1%dx, + use=ecma+underline, use=ecma+standout, use=ansi+arrows, + use=ansi+csr, use=ansi+cup, use=ansi+erase, use=ansi+idl, use=ansi+inittabs, use=ansi+local, use=ansi+rep, use=ansi+sgrbold, use=decid+cpr, use=dec+pp, use=att610+cvis0, @@ -14746,13 +15196,14 @@ %<%tq\s\s\sSYS\s\s\s\s\sF%p1%:-2d\s\s%e;0;3q%;%p2%s, pfxl=\E[%p1%d;%p2%l%02d;0;0q%p3%:-16.16s%p2%s, pln=\E[%p1%d;0;0;0q%p2%:-16.16s, ri=\EM, rmacs=^O, - rmam=\E[?7l, rmir=\E[4l, rmln=\E[?13h, rmso=\E[27m, - rmul=\E[24m, rmxon=\E[?21l, rs2=\Ec\E[?3l, + rmam=\E[?7l, rmir=\E[4l, rmln=\E[?13h, rmxon=\E[?21l, + rs2=\Ec\E[?3l, sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1 %|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, smln=\E[?13l, smxon=\E[?21h, swidm=\E#6, - tsl=\E7\E[;%i%p1%dx, use=ansi+arrows, use=ansi+csr, + tsl=\E7\E[;%i%p1%dx, use=ecma+underline, + use=ecma+standout, use=ansi+arrows, use=ansi+csr, use=ansi+cup, use=ansi+erase, use=ansi+idl, use=ansi+local, use=ansi+rep, use=ansi+sgrbold, use=decid+cpr, use=dec+pp, use=att610+cvis, @@ -14948,9 +15399,9 @@ kf3=\E[03s, kf4=\E[04s, kf5=\E[05s, kf6=\E[06s, krfr=\E[27s, mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, rmacs=\E[10m, rmam=\E[11;1j, rmir=\E[4l, rmso=\E[m, - rmul=\E[m, rs1=\Ec, sc=\E7, sgr0=\E[m, smacs=\E[11m, - smam=\E[11;0j, smir=\E[4h, smso=\E[1m, smul=\E[4m, - use=ansi+cpr, use=ansi+idl, use=ansi+local, + rs1=\Ec, sc=\E7, sgr0=\E[m, smacs=\E[11m, smam=\E[11;0j, + smir=\E[4h, smso=\E[1m, use=ansi+cpr, use=ansi+idl, + use=ansi+local, use=ansi+sgrul, # The following Terminfo entry describes functions which are supported by # the AT&T 5430/pt505 terminal software version 1. @@ -15214,8 +15665,7 @@ OTbs, am, km, mc5i, mir, xon, cols#80, bel=^G, clear=\E[H\E[J$<156>, cr=\r, cub1=^H, cud1=^K, - cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, ed=\E[J, - el=\E[K$<5>, home=\E[H, hpa=\E[%p1%{1}%+%dG, + dch=\E[%p1%dP, dch1=\E[P, ed=\E[J, el=\E[K$<5>, ich=\E[%p1%d@$<4*>, ich1=\E[@$<4>, il1=\E[L$<3>, ind=^K, is1=\E[m\E7\E[H\E9\E8, is3=\E[1Q\E[>20;30l\EP`+x~M\E\\, kcbt=\E[Z, kclr=\E[J, @@ -15228,14 +15678,11 @@ mc5=\E[v, mc5p=\E[%p1%dv, rc=\E8, rmkx=\EP`>y~[[J`8xy~[[A`4xy~[[D`6xy~[[C`2xy~[[B\E \\, - rmm=\E[>52l, sc=\E7, - sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1; - %;%?%p7%t8;%;m, - sgr0=\E[m, + rmm=\E[>52l, sc=\E7, sgr0=\E[m, smkx=\EP`>z~[[J`8xz~[[A`4xz~[[D`6xz~[[C`2xz~[[B\E \\, - smm=\E[>52h, vpa=\E[%p1%{1}%+%dd, use=ansi+arrows, - use=ansi+idl, use=ansi+inittabs, use=ansi+local, + smm=\E[>52h, use=ansi+arrows, use=ansi+cup, use=ansi+idl, + use=ansi+inittabs, use=ansi+local, use=ansi+rca, use=ansi+rep, use=ansi+sgrbold, aaa+rv|Ann Arbor Ambassador in reverse video, @@ -15287,13 +15734,12 @@ rmcup=\E[60;0;0;28p\E[28;1H\E[K, smcup=\E[H\E[J$<156>\E[28;0;0;28p, use=aaa+unk, aaa-30-s|aaa-s|Ann Arbor Ambassador/30 lines w/status, - eslok, hs, lines#29, dsl=\E7\E[60;0;0;30p\E[1;1H\E[K\E[H\E8\r\n\E[K, - fsl=\E[>51l, is2=\r\n\E[A\E7\E[60;1;0;30p\E8, + is2=\r\n\E[A\E7\E[60;1;0;30p\E8, rmcup=\E[60;1;0;30p\E[29;1H\E[K, smcup=\E[H\E[J$<156>\E[30;1;0;30p\E[30;1H\E[K, - tsl=\E[>51h\E[1;%p1%dH\E[2K, use=aaa+unk, + use=aaa+unk, use=guru+s, aaa-30-s-rv|aaa-s-rv|Ann Arbor Ambassador/30 lines+status+reverse video, use=aaa+rv, use=aaa-30-s, aaa-s-ctxt|aaa-30-s-ctxt|Ann Arbor Ambassador/30 lines+status+save context, @@ -15625,14 +16071,13 @@ OTbs, am, xenl, cols#80, lines#24, bel=^G, clear=\E[H\E[2J, cnorm=\E[V\E8, cub1=^H, - cup=\E[%i%p1%d;%p2%dH, cvvis=\E7\E[U, dch1=\E[P, - dl1=\E[M, ed=\E[J, el=\E[K, flash=\E[?5h$<200/>\E[?5l, - ich1=\E[@, il1=\E[L, + cup=\E[%i%p1%d;%p2%dH, cvvis=\E7\E[U, dch1=\E[P, ed=\E[J, + el=\E[K, flash=\E[?5h$<200/>\E[?5l, ich1=\E[@, is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[3g\E[>5g, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, - rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, - sgr0=\E[m, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7m, - smul=\E[4m, use=ansi+local1, + rmam=\E[?7l, rmkx=\E[?1l\E>, sgr0=\E[m, smam=\E[?7h, + smkx=\E[?1h\E=, use=ansi+idl1, use=ansi+local1, + use=ansi+sgrso, use=ansi+sgrul, # CIE Terminals CIT-101e from Geoff Kuenning via BRL # The following termcap entry was created from the Callan cd100 entry. The @@ -15646,13 +16091,12 @@ cols#80, it#8, lines#24, acsc=, cnorm=, csr=\E[%i%p1%2d;%p2%2dr, cup=\E[%i%p1%2d;%p2%2dH, cvvis=\E[?1l\E[?4l\E[?7h, - dch1=\E[P, dl1=\E[M, if=/usr/share/tabset/vt100, - il1=\E[L, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, - kf0=\EOT, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOm, + dch1=\E[P, if=/usr/share/tabset/vt100, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\EOT, kf5=\EOm, kf6=\EOl, kf7=\EOM, kf8=\EOn, rc=\E8, ri=\EM, rmacs=^O, - rmir=\E[4l, rmkx=\E>, rmso=\E[m, rmul=\E[m, sc=\E7, smacs=^N, - smir=\E[4h, smkx=\E=, smso=\E[7m, smul=\E[4m, - use=ansi+erase, use=ansi+local1, + rmir=\E[4l, rmkx=\E>, sc=\E7, smacs=^N, smir=\E[4h, smkx=\E=, + use=ansi+erase, use=ansi+idl1, use=ansi+local1, + use=ansi+sgrso, use=ansi+sgrul, use=vt100+pf1-pf4, # From: David S. Lawyer, June 1997: # The CIT 101-e was made in Japan in 1983-4 and imported by CIE @@ -15675,19 +16119,18 @@ am, eo, mir, msgr, xenl, xon, cols#80, lines#24, OTnl=\EM, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[1v, - cnorm=\E[0;3;4v, cr=\r, cub1=^H, cup=\E[%i%p1%d;%p2%dH, - cvvis=\E[3;5v, flash=\E[?5l$<200/>\E[?5h, home=\E[H, - hpa=\E[%i%p1%dG, ind=\n, + cnorm=\E[0;3;4v, cr=\r, cub1=^H, cvvis=\E[3;5v, + flash=\E[?5l$<200/>\E[?5h, hpa=\E[%i%p1%dG, ind=\n, is2=\E<\E>\E[?1l\E[?3l\E[?4l\E[?5h\E[?7h\E[?8h\E[3g\E[>5g\E( B\E[m\E[20l\E[1;24r\E[24;1H, kbs=^?, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, - kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=\EE, rev=\E[7m, - ri=\EM, rmcup=, rmso=\E[m, rmul=\E[m, rs1=\Ec\E[?7h\E[>5g, - sgr0=\E[m, smcup=\E[>5g\E[?7h\E[?5h, smso=\E[7m, - smul=\E[4m, u6=\E[%i%p1%d;%p2%dR, u8=\E[?6c, - use=ansi+enq, use=ansi+csr, use=ansi+erase, use=ansi+idc, + nel=\EE, rev=\E[7m, ri=\EM, rmcup=, rs1=\Ec\E[?7h\E[>5g, + sgr0=\E[m, smcup=\E[>5g\E[?7h\E[?5h, + u6=\E[%i%p1%d;%p2%dR, u8=\E[?6c, use=ansi+enq, + use=ansi+csr, use=ansi+cup, use=ansi+erase, use=ansi+idc, use=ansi+idl, use=ansi+inittabs, use=ansi+local, - use=ecma+index, + use=ansi+sgrso, use=ansi+sgrul, use=ecma+index, + use=vt100+pf1-pf4, cit101e-n|CIT-101e w/o am, am@, @@ -15716,20 +16159,19 @@ OTbs, OTpt, mir, msgr, xon, OTkn#10, cols#80, lines#64, vt#3, acsc=, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, - cr=\r, cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, cuu1=\EM, - dch1=\E[P, ed=\EJ, el=\EK, home=\E[H, ind=\n, is2=\E<\E)0, - kcbt=\E[Z, kdch1=\E[P, kdl1=\E[M, ked=\EJ, kel=\EK, kf0=\EOP, - kf1=\EOQ, kf2=\EOR, kf3=\EOS, kf4=\EOU, kf5=\EOV, kf6=\EOW, - kf7=\EOX, kf8=\EOY, kf9=\EOZ, khome=\E[H, kich1=\E[4h, - kil1=\E[L, krmir=\E[4l, lf0=PF1, lf1=PF2, lf2=PF3, lf3=PF4, - lf4=F15, lf5=F16, lf6=F17, lf7=F18, lf8=F19, lf9=F20, - ll=\E[64H, nel=\EE, rev=\E[7m, ri=\EM, rmacs=^O, rmam=\E[?7l, - rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + cr=\r, cub1=^H, cud1=\n, cuu1=\EM, dch1=\E[P, ed=\EJ, el=\EK, + ind=\n, is2=\E<\E)0, kcbt=\E[Z, kdch1=\E[P, kdl1=\E[M, + ked=\EJ, kel=\EK, kf0=\EOP, kf1=\EOQ, kf2=\EOR, kf3=\EOS, + kf4=\EOU, kf5=\EOV, kf6=\EOW, kf7=\EOX, kf8=\EOY, kf9=\EOZ, + khome=\E[H, kich1=\E[4h, kil1=\E[L, krmir=\E[4l, lf0=PF1, + lf1=PF2, lf2=PF3, lf3=PF4, lf4=F15, lf5=F16, lf6=F17, lf7=F18, + lf8=F19, lf9=F20, ll=\E[64H, nel=\EE, rev=\E[7m, ri=\EM, + rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rs1=\E<\E2\E[20l\E[?6l\E[r\E[m\E[q\E(B\017\E)0\E>, sgr0=\E[m, smacs=^N, smam=\E[?7h, smir=\E[4h, - smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, - use=ansi+apparrows, use=ansi+csr, use=ansi+idl, - use=ansi+inittabs, use=ansi+local, + smkx=\E[?1h\E=, use=ansi+apparrows, use=ansi+csr, + use=ansi+cup, use=ansi+idl, use=ansi+inittabs, + use=ansi+local, use=ansi+sgrso, use=ansi+sgrul, # C. Itoh printers begin here citoh|ci8510|8510|C. Itoh 8510a, @@ -15817,7 +16259,7 @@ # of the tab key to send an ESC. The real ESC key is positioned way out # in right field. # -# The termcap won't work in 132 column mode due to the way it it moves the +# The termcap won't work in 132 column mode due to the way it moves the # cursor. Termcap doesn't have the capability (as far as I could tell) to # handle the 721 in 132 column mode. # @@ -15867,9 +16309,8 @@ cols#80, lines#25, acsc=0_aaffggh jjkkllmmnnooqqssttuuvvwwxx, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[2J, cr=\r, - csr=\E[%i%p1%d;%p2%dr, cup=\E[%i%p1%d;%p2%dH, - dch=\E[%p1%dX, dch1=\E[X, dim=\E[2m, ed=\E[J, el=\E[K, - flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG, + csr=\E[%i%p1%d;%p2%dr, dch=\E[%p1%dX, dch1=\E[X, + dim=\E[2m, ed=\E[J, el=\E[K, flash=\E[?5h$<100/>\E[?5l, ht=^I, ind=\n, invis=\E[8m, is2=\E0;2m\E[1;25r\E[25;1H\E[?3l\E[?7h\E[?8h, ka1=\E[f, ka3=\EOQ, kb2=\EOP, kc1=\EOR, kc3=\EOS, kdch1=^?, @@ -15881,9 +16322,9 @@ lf9=A funcl0=A send, nel=\r\n, rev=\E[7m, rmacs=\E[3l, rmam=\E[?7l, rmkx=\E>, rmso=\E[0;2m, rmul=\E[0m, sgr0=\E[0;2m, smacs=\E3h, smam=\E?7h, smkx=\E=, - smso=\E[2;7m, smul=\E[4m, tbc=\E[3g, vpa=\E[%i%p1%dd, - use=ansi+arrows, use=ansi+idc, use=ansi+idl, - use=ansi+local, + smso=\E[2;7m, smul=\E[4m, tbc=\E[3g, use=ansi+arrows, + use=ansi+cup, use=ansi+idc, use=ansi+idl, use=ansi+local, + use=ansi+rca2, #### Human Designed Systems (Concept) # @@ -16273,9 +16714,9 @@ cols#80, lines#24, lm#0, acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, blink=\E[0;5m, bold=\E[0;1m, civis=\E[6+{, cnorm=\E[+{, - cr=\r, cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, - dsl=\E[2!w\r\n\E[!w, el1=\E[1K, fsl=\E[!w, home=\E[H, - hpa=\E[%i%p1%dG, ich=\E[%p1%d@, ind=\ED, invis=\E[0;8m, + cr=\r, dch=\E[%p1%dP, dch1=\E[P, dsl=\E[2!w\r\n\E[!w, + el1=\E[1K, fsl=\E[!w, ich=\E[%p1%d@, ind=\ED, + invis=\E[0;8m, is2=\E)0\017\E[m\E[=107;207h\E[90;3u\E[92;3u\E[43;1u\177\E$P \177\E[44;1u\177\E$Q\177\E[45;1u\177\E$R\177\E[46;1u \177\E$S\177\E[200;1u\177\E$A\177\E[201;1u\177\E$B\177 @@ -16300,10 +16741,10 @@ sgr=\E[0%?%p1%p6%O%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%O%t;7 %;%?%p7%t;8%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smir=\E[4h, smso=\E[0;1;7m, - smul=\E[0;4m, tsl=\E[2!w\E[%i%p1%dG, vpa=\E[%i%p1%dd, - use=ansi+arrows, use=ansi+csr, use=ansi+erase, - use=ansi+idl, use=ansi+inittabs, use=ansi+local, - use=ansi+pp, + smul=\E[0;4m, tsl=\E[2!w\E[%i%p1%dG, use=ansi+arrows, + use=ansi+csr, use=ansi+cup, use=ansi+erase, use=ansi+idl, + use=ansi+inittabs, use=ansi+local, use=ansi+pp, + use=ansi+rca2, # through included to specify padding needed in raw mode. # (avt-ns: added empty to suppress a tic warning --esr) @@ -16311,18 +16752,16 @@ OTbs, am, eo, mir, ul, xenl, xon, cols#80, lines#24, lm#192, acsc=, bel=^G, clear=\E[H\E[J$<38>, cnorm=\E[=119l, cr=\r, - cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, cvvis=\E[=119h, - dim=\E[1!{, dl=\E[%p1%dM$<4*>, dl1=\E[M$<4>, - ed=\E[J$<96>, el=\E[K$<6>, home=\E[H, - hpa=\E[%p1%{1}%+%dG, ht=\011$<4>, ich=\E[%p1%d@, + cub1=^H, cud1=\n, cvvis=\E[=119h, dim=\E[1!{, + dl=\E[%p1%dM$<4*>, dl1=\E[M$<4>, ed=\E[J$<96>, + el=\E[K$<6>, ht=\011$<4>, ich=\E[%p1%d@, il=\E[%p1%dL$<4*>, il1=\E[L$<4>, ind=\n$<8>, ip=$<4>, is1=\E[=103l\E[=205l, is2=\E[1*q\E[2!t\E[7!t\E[=4;101;119;122l\E[=107;118;207h\E)1 \E[1Q\EW\E[!y\E[!z\E>\E[0:0:32!r\E[0*w\E[w\E2\r\n\E[2;27 !t, - kdch1=\E\002\r, ked=\E\004\r, kf1=\EOP, kf2=\EOQ, kf3=\EOR, - kf4=\EOS, kich1=\E\001\r, kil1=\E\003\r, ll=\E[24H, - mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, + kdch1=\E\002\r, ked=\E\004\r, kich1=\E\001\r, + kil1=\E\003\r, ll=\E[24H, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, pfloc=\E[%p1%d;0u#%p2%s#, pfx=\E[%p1%d;1u#%p2%s#, prot=\E[99m, ri=\EM$<4>, rmacs=\016$<1>, rmcup=\E[w\E2\r\n, rmkx=\E[!z\E[0;2u, rmso=\E[7!{, @@ -16332,9 +16771,10 @@ \016%;$<1>, sgr0=\E[m\016$<1>, smacs=\017$<1>, smcup=\E[=4l\E[1;24w\E2\r, smkx=\E[1!z\E[0;3u, - vpa=\E[%p1%{1}%+%dd, use=ansi+arrows, use=ansi+csr, + use=ansi+arrows, use=ansi+csr, use=ansi+cup, use=ansi+idc1, use=ansi+inittabs, use=ansi+local, - use=ansi+rep, use=ansi+sgrbold, + use=ansi+rca, use=ansi+rep, use=ansi+sgrbold, + use=vt100+pf1-pf4, avt-rv-ns|Concept AVT in reverse video mode/no status line, flash=\E[=205l$<200>\E[=205h, is1=\E[=103l\E[=205h, @@ -16534,14 +16974,13 @@ use=dg+color8, dgmode+color8|Color info for Data General D220/D230C terminals in DG mode, - bce, - colors#8, ncv#16, pairs#64, op=\036Ad\036Bd, setab=\036B%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%| %;%{48}%+%c, setaf=\036A%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%| %;%{48}%+%c, setb=\036B%p1%{48}%+%c, setf=\036A%p1%{48}%+%c, + use=dg+color8, dgmode+color|Color info for Data General D470C terminals in DG mode, colors#16, pairs#0x100, @@ -16552,8 +16991,6 @@ use=dgmode+color8, dgunix+ccc|Configurable color info for DG D430C terminals in DG-UNIX mode, - bce, ccc, - colors#52, ncv#53, pairs#26, initp=\036RG0%p1%02X%p2%{255}%*%{1000}%/%02X%p3%{255}%* %{1000}%/%02X%p4%{255}%*%{1000}%/%02X%p5%{255}%* %{1000}%/%02X%p6%{255}%*%{1000}%/%02X%p7%{255}%* @@ -16561,7 +16998,7 @@ oc=\036RG01A00FF00000000\036RG01B00000000FF00 \036RG01C007F00000000\036RG01D000000007F00, op=\036RF4831A\036RF2E31B\036RF1D31C\036RF3F31D, - scp=\036RG2%p1%02X, + scp=\036RG2%p1%02X, use=dg+ccc, # Colors are in the order: normal, reverse, dim, dim + reverse. dg+ccc|Configurable color info for DG D430C terminals in DG mode, @@ -16611,10 +17048,10 @@ dg210|dg-ansi|Data General 210/211, am, cols#80, lines#24, - OTnl=\E[B, clear=\E[2J, cup=\E[%i%p1%d;%p2%dH, ed=\E[J, - el=\E[K, home=\E[H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, - kcuu1=\E[A, khome=\E[H, nel=\r\E[H\E[A\n, rmso=\E[0;m, - rmul=\E[0;m, smso=\E[7;m, smul=\E[4;m, use=ansi+local1, + OTnl=\E[B, clear=\E[2J, ed=\E[J, el=\E[K, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, + nel=\r\E[H\E[A\n, rmso=\E[0;m, rmul=\E[0;m, smso=\E[7;m, + smul=\E[4;m, use=ansi+cup, use=ansi+local1, # From: Peter N. Wan # courtesy of Carlos Rucalde of Vantage Software, Inc. @@ -16642,17 +17079,18 @@ OTbs, am, msgr, ul, cols#80, it#8, lines#24, OTnl=\ED, blink=\E[5m, clear=\E[2J, cub1=^H, - cup=\E[%i%p1%2d;%p2%2dH, dch1=\E[P, dim=\E[2m, dl1=\E[M, - ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, il1=\E[L, - ind=\E[S, is2=^^F@, kbs=\E[D, kf0=\E[001z, kf1=\E[002z, - kf2=\E[003z, kf3=\E[004z, kf4=\E[005z, kf5=\E[006z, - kf6=\E[007z, kf7=\E[008z, kf8=\E[009z, kf9=\E[00:z, lf0=f1, - lf1=f2, lf2=f3, lf3=f4, lf4=f5, lf5=f6, lf6=f7, lf7=f8, lf9=f10, - mc0=\E[i, rev=\E[7m, ri=\E[T, rmso=\E[m, rmul=\E[05, + cup=\E[%i%p1%2d;%p2%2dH, dch1=\E[P, dim=\E[2m, ed=\E[J, + el=\E[K, home=\E[H, ht=^I, ich1=\E[@, ind=\E[S, is2=^^F@, + kbs=\E[D, kf0=\E[001z, kf1=\E[002z, kf2=\E[003z, + kf3=\E[004z, kf4=\E[005z, kf5=\E[006z, kf6=\E[007z, + kf7=\E[008z, kf8=\E[009z, kf9=\E[00:z, lf0=f1, lf1=f2, + lf2=f3, lf3=f4, lf4=f5, lf5=f6, lf6=f7, lf7=f8, lf9=f10, + mc0=\E[i, rev=\E[7m, ri=\E[T, rmul=\E[05, sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%; %?%p1%p3%|%t;7%;m, - sgr0=\E(B\E[m, smso=\E[7m, smul=\E[4m, u8=\E[5n, u9=\E[0n, - use=ansi+arrows, use=ansi+cpr, use=ansi+local1, + sgr0=\E(B\E[m, smul=\E[4m, u8=\E[5n, u9=\E[0n, + use=ansi+arrows, use=ansi+cpr, use=ansi+idl1, + use=ansi+local1, use=ansi+sgrso, # From: Wayne Throop (not official) # Data General 605x @@ -16695,13 +17133,13 @@ am, bw, msgr, xon, cols#80, lines#24, bel=^G, blink=\E[5m, bold=\E[4;7m, clear=\E[2J, cr=\r, - cub1=^H, cup=\E[%i%p1%d;%p2%dH, dim=\E[2m, ed=\E[J, - el=\E[K, el1=\E[1K, home=\E[H, ind=\n, is1=\E[<0;<1;<4l, - ll=\E[H\E[A, nel=\n, rev=\E[7m, rmso=\E[m, rmul=\E[m, + cub1=^H, dim=\E[2m, ed=\E[J, el=\E[K, el1=\E[1K, ind=\n, + is1=\E[<0;<1;<4l, ll=\E[H\E[A, nel=\n, rev=\E[7m, + rmso=\E[m, sgr=\E[%?%p4%t5;%;%?%p2%p6%|%t4;%;%?%p1%p5%|%t2;%;%?%p1%p3%| %p6%|%t7;%;m, - sgr0=\E[m, smso=\E[2;7m, smul=\E[4m, use=ansi+local, - use=dgkeys+7b, + sgr0=\E[m, smso=\E[2;7m, use=ansi+cup, use=ansi+local, + use=ansi+sgrul, use=dgkeys+7b, # DASHER D210 series terminals in DG mode. # Like D200, but adds clear to end-of-screen and needs XON/XOFF. @@ -17174,9 +17612,9 @@ cols#80, lines#24, bel=^G, cr=\r, cub1=^H, cud1=\n, cuf1=\E[C, cup=\E[%i%p1%02d;%p2%02dH, cuu1=\E[A, ind=\n, kcub1=\E[D, - kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, - kf3=\EOR, kf4=\EOS, rmso=\E[m, rmul=\E[m, sgr0=\E[m, - smso=\E[7m, smul=\E[4m, use=ansi+erase, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, sgr0=\E[m, + use=ansi+erase, use=ansi+sgrso, use=ansi+sgrul, + use=vt100+pf1-pf4, cs10-w|Datamedia Color Scan 10 with 132 columns, cols#132, @@ -17260,8 +17698,8 @@ dm80|dmdt80|dt80|Datamedia dt80/1, clear=\E[2J\E[H, cuf1=\E[C, cup=%i\E[%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, - ri=\EM, rmso=\E[m, rmul=\E[m, sgr0=\E[m\017$<2>, - smso=\E[7m, smul=\E[4m, use=vt100+4bsd, + ri=\EM, sgr0=\E[m\017$<2>, use=ansi+sgrso, + use=ansi+sgrul, use=vt100+4bsd, # except in 132 column mode, where it needs a little padding. # This is still less padding than the VT100, and you can always turn on # the ^S/^Q handshaking, so you can use VT100 flavors for things like @@ -17394,8 +17832,8 @@ bel=^G, clear=\E[H\E[2J, cr=\r, cub1=^H, cup=\E[%i%p1%d;%p2%dH, ed=\E[J, el=\E[K, ind=\ED, is2=\E[H\E[2J, kcub1=^_, kcud1=^], kcuf1=^^, kcuu1=^\, - ri=\EM, rmso=\E[m, rmul=\E[m, sgr0=\E[m, smso=\E[7m, - smul=\E[4m, use=ansi+local1, + ri=\EM, sgr0=\E[m, use=ansi+local1, use=ansi+sgrso, + use=ansi+sgrul, #### Liberty Electronics (Freedom) # @@ -17429,7 +17867,7 @@ # code for the down cursor key. When kcud1 is defined in terminfo # as ^V, the Control Character Quoting capability (^V in insert mode) # is lost! It cannot be remapped in vi because it is necessary to enter -# a ^V to to quote the ^V that is being remapped!!! +# a ^V to, to quote the ^V that is being remapped!!! # # f110/f200 users will have to decide whether # to lose the down cursor key or the quoting capability. We will opt @@ -17498,15 +17936,14 @@ OTbs, cols#80, it#8, lines#24, clear=\E[H\E[2J$<10/>, cub1=^H, - cup=\E[%i%p1%2d;%p2%2dH, dch1=\E[P, dl1=\E[M, - ed=\E[J$<10/>, el=\E[K, ht=^I, - if=/usr/share/tabset/vt100, il1=\E[L, + cup=\E[%i%p1%2d;%p2%2dH, dch1=\E[P, ed=\E[J$<10/>, + el=\E[K, ht=^I, if=/usr/share/tabset/vt100, is2=\E<\E=\E[?3l\E[?7l\E(B\E[J\E7\E[;r\E8\E[m\E[q, - kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, - kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, ri=\EM, - rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, - rmul=\E[m, sgr0=\E[m, smam=\E[?7h, smir=\E[4h, - smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, use=ansi+local1, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, khome=\E[H, + ri=\EM, rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, sgr0=\E[m, + smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, use=ansi+idl1, + use=ansi+local1, use=ansi+sgrso, use=ansi+sgrul, + use=vt100+pf1-pf4, go140w|graphon go-140 in 132 column mode, am, @@ -17520,16 +17957,15 @@ OTbs, am, mir, xenl, cols#80, it#8, lines#25, vt#3, blink=\E[5m, bold=\E[1m, cub1=^H, cud1=\n, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, - home=\E[H, ht=^I, il1=\E[L, ind=\ED, - is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, kf1=\EOP, - kf2=\EOQ, kf3=\EOR, kf4=\EOS, rev=\E[7m, + cuu1=\E[A, dch1=\E[P, ht=^I, ind=\ED, + is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, rev=\E[7m, rf=/usr/share/tabset/vt100, ri=\EM, rmam=\E[?7l, rmcup=\E[!p\E[?7h\E[2;1;1#w, rmir=\E[4l, rmkx=\E>, - rmso=\E[27m, rmul=\E[24m, rs1=\E[!p\E[?7h\E[2;1;1#w, - sgr0=\E[m, smam=\E[?7h, smcup=\E[2;0#w\E[1;25r, - smir=\E[4h, smkx=\E=, smso=\E[7m, smul=\E[4m, - use=ansi+arrows, use=ansi+csr, use=ansi+erase, + rs1=\E[!p\E[?7h\E[2;1;1#w, sgr0=\E[m, smam=\E[?7h, + smcup=\E[2;0#w\E[1;25r, smir=\E[4h, smkx=\E=, + use=ecma+underline, use=ecma+standout, use=ansi+arrows, + use=ansi+csr, use=ansi+cup, use=ansi+erase, + use=ansi+idl1, use=vt100+pf1-pf4, #### Harris (Beehive) # @@ -17734,7 +18170,7 @@ # # They're now (1998) a subsidiary of General Electric, operating under the # marque "GEC-Marconi Hazeltine" and doing military avionics. Web page -# at . +# at . # # Since is blank, when you want to erase something you @@ -17859,13 +18295,12 @@ cuf1=\E[C$<2/>, cup=\E[%i%p1%d;%p2%dH$<5/>, cuu1=\E[A$<2/>, ed=\E[J$<50/>, el=\E[K$<3/>, home=\E[H, ht=^I, is2=\E[1;24r\E[24;1H, kbs=^H, kcub1=\EOD, - kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, - kf3=\EOR, kf4=\EOS, rev=\E[7m$<2/>, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, rev=\E[7m$<2/>, rf=/usr/share/tabset/vt100, ri=\EM$<5/>, rmkx=\E[?1l\E>, rmso=\E[m$<2/>, rmul=\E[m$<2/>, rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sgr0=\E[m$<2/>, smkx=\E[?1h\E=, smso=\E[7m$<2/>, - smul=\E[4m$<2/>, use=ansi+csr, + smul=\E[4m$<2/>, use=ansi+csr, use=vt100+pf1-pf4, #### IBM # @@ -17946,26 +18381,26 @@ cols#80, it#8, lines#25, acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x \263, - bel=^G, cr=\r, cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, - dch1=\E[P, ech=\E[%p1%dX, home=\E[H, hpa=\E[%i%p1%dG, - ind=\E[S, is2=\Ec, kcbt=\E[Z, kclr=\E[144q, kdch1=\E[P, - ked=\E[148q, kel=\E[142q, kend=\E[146q, kf1=\E[001q, - kf10=\E[010q, kf11=\E[011q, kf12=\E[012q, kf13=\E[013q, - kf14=\E[014q, kf15=\E[015q, kf16=\E[016q, kf17=\E[017q, - kf18=\E[018q, kf19=\E[019q, kf2=\E[002q, kf20=\E[020q, - kf21=\E[021q, kf22=\E[022q, kf23=\E[023q, kf24=\E[024q, - kf25=\E[025q, kf26=\E[026q, kf27=\E[027q, kf28=\E[028q, - kf29=\E[029q, kf3=\E[003q, kf30=\E[030q, kf31=\E[031q, - kf32=\E[032q, kf33=\E[033q, kf34=\E[034q, kf35=\E[035q, - kf36=\E[036q, kf4=\E[004q, kf5=\E[005q, kf6=\E[006q, - kf7=\E[007q, kf8=\E[008q, kf9=\E[009q, kich1=\E[139q, - kil1=\E[140q, kind=\E[151q, knp=\E[154q, kpp=\E[150q, - kri=\E[155q, krmir=\E[4l, ri=\E[T, rmir=\E[4l, rs2=\Ec, + bel=^G, cr=\r, cub1=^H, cud1=\n, dch1=\E[P, ech=\E[%p1%dX, + hpa=\E[%i%p1%dG, ind=\E[S, is2=\Ec, kcbt=\E[Z, + kclr=\E[144q, kdch1=\E[P, ked=\E[148q, kel=\E[142q, + kend=\E[146q, kf1=\E[001q, kf10=\E[010q, kf11=\E[011q, + kf12=\E[012q, kf13=\E[013q, kf14=\E[014q, kf15=\E[015q, + kf16=\E[016q, kf17=\E[017q, kf18=\E[018q, kf19=\E[019q, + kf2=\E[002q, kf20=\E[020q, kf21=\E[021q, kf22=\E[022q, + kf23=\E[023q, kf24=\E[024q, kf25=\E[025q, kf26=\E[026q, + kf27=\E[027q, kf28=\E[028q, kf29=\E[029q, kf3=\E[003q, + kf30=\E[030q, kf31=\E[031q, kf32=\E[032q, kf33=\E[033q, + kf34=\E[034q, kf35=\E[035q, kf36=\E[036q, kf4=\E[004q, + kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, kf8=\E[008q, + kf9=\E[009q, kich1=\E[139q, kil1=\E[140q, kind=\E[151q, + knp=\E[154q, kpp=\E[150q, kri=\E[155q, krmir=\E[4l, + ri=\E[T, rmir=\E[4l, rs2=\Ec, sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1 %;%?%p7%t;8%;m, - smir=\E[4h, use=ansi+arrows, use=ansi+erase, - use=ansi+idl, use=ansi+local, use=ansi+sgrbold, - use=ecma+index, + smir=\E[4h, use=ansi+arrows, use=ansi+cup, + use=ansi+erase, use=ansi+idl, use=ansi+local, + use=ansi+sgrbold, use=ecma+index, ibmaed|IBM Experimental display, OTbs, am, eo, msgr, @@ -18067,14 +18502,14 @@ am, xon, cols#80, lines#25, bel=^G, blink=\E[5m, bold=\E[1m, cr=\r, cub1=^H, cud1=\n, - cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, - dl1=\E[M, home=\E[H, ht=^I, ich1=\E[@, il1=\E[L, ind=\n, + cuf1=\E[C, cuu1=\E[A, dch1=\E[P, ht=^I, ich1=\E[@, ind=\n, invis=\E[8m, kf1=\E[001q, kf2=\E[002q, kf3=\E[003q, kf4=\E[004q, kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, kf8=\E[008q, kf9=\E[009q, knp=\E[153q, kpp=\E[159q, - ktbc=\E[010q, rev=\E[7m, rmir=\E6, rmso=\E[m, rmul=\E[m, - sgr0=\E[m, smir=\E6, smso=\E[7m, smul=\E[4m, - use=ansi+arrows, use=ansi+erase, use=ibm+color, + ktbc=\E[010q, rev=\E[7m, rmir=\E6, sgr0=\E[m, smir=\E6, + use=ansi+arrows, use=ansi+cup, use=ansi+erase, + use=ansi+idl1, use=ansi+sgrso, use=ansi+sgrul, + use=ibm+color, ibm-system1|system1|IBM system/1 computer, am, xt, @@ -18092,9 +18527,8 @@ acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x \263, bel=^G, cbt=\E[Z, clear=\E[H\E[J, cr=\r, cub1=^H, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, - ech=\E[%p1%dX, ed=\E[2J, el=\E[0K, home=\E[H, - hpa=\E[%i%p1%dG, ich=\E[%p1%d@, ind=\ED, is2=\Ec, + dch=\E[%p1%dP, dch1=\E[P, ech=\E[%p1%dX, ed=\E[2J, + el=\E[0K, hpa=\E[%i%p1%dG, ich=\E[%p1%d@, ind=\ED, is2=\Ec, kcbt=\E[Z, kclr=\E[144q, kdch1=\E[P, ked=\E[148q, kel=\E[142q, kend=\E[146q, kf1=\E[001q, kf10=\E[010q, kf11=\E[011q, kf12=\E[012q, kf13=\E[013q, kf14=\E[014q, @@ -18112,8 +18546,8 @@ sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1 %;%?%p7%t;8%;m%?%p9%t\E(0%e\E(B%;, smacs=\E(0, smir=\E[4h, tbc=\E[3g, use=ansi+arrows, - use=ansi+idl, use=ansi+local, use=ansi+sgrbold, - use=ecma+index, + use=ansi+cup, use=ansi+idl, use=ansi+local, + use=ansi+sgrbold, use=ecma+index, # "Megapel" refers to the display adapter, which was used with the IBM RT # aka IBM 6150. @@ -18135,8 +18569,8 @@ # # AIX entries. IBM ships these with AIX 3.2.5. -# -- added rc, sc based on manpage -TD -# -- added rmacs, smacs based on manpage -TD +# -- added rc, sc based on man page -TD +# -- added rmacs, smacs based on man page -TD # Note that we could use ibm+16color, but that is not how IBM defines this one. aixterm|IBM Aixterm Terminal Emulator, acsc=jjkkllmmnnqqttuuvvwwxx, bold=\E[1m, rc=\E8, ri@, @@ -18192,8 +18626,8 @@ cols#80, lines#25, bel=^G, clear=\E[2J, cr=\r, cub1=^H, cud1=\n, cuf1=\E[C, cup=\E[%i%p1%3d;%p2%3dH, cuu1=\E[A, - dch1=\E[4h\E[2Q\E[P\E[4l\E[0Q, dl1=\E[M, el=\E[N, - il1=\E[L, ind=\n, rmir=\E[4l\E[0Q, smir=\E[4h\E[2Q, + dch1=\E[4h\E[2Q\E[P\E[4l\E[0Q, el=\E[N, ind=\n, + rmir=\E[4l\E[0Q, smir=\E[4h\E[2Q, use=ansi+idl1, # (addrinfo: removed obsolete ":bc=^Z:" -- esr) addrinfo|cursor-addressable Infoton, @@ -18518,17 +18952,16 @@ am, bw, ul, cols#80, lines#24, xmc#0, bel=^G, cbt=\E[Z, clear=\E[H\E[2J, cr=\r, - cup=\E[%i%p1%d;%p2%dH, dch1=\E[P, dl1=\E[M, ed=\E[J, - el=\E[K, + cup=\E[%i%p1%d;%p2%dH, dch1=\E[P, ed=\E[J, el=\E[K, flash=\E[;;;;;;;;;2;;u$<200/>\E[;;;;;;;;;1;;u, - hpa=\E[%p1%{1}%+%dG, ht=^I, ich1=\E[@, il1=\E[L, ind=\E[S, - kbs=^H, kcub1=\ED\r, kcud1=\EB\r, kcuf1=\EC\r, kcuu1=\EA\r, + hpa=\E[%p1%{1}%+%dG, ht=^I, ich1=\E[@, ind=\E[S, kbs=^H, + kcub1=\ED\r, kcud1=\EB\r, kcuf1=\EC\r, kcuu1=\EA\r, kf0=\E@\r, kf1=\EP\r, kf2=\EQ\r, kf3=\ES\r, kf4=\ET\r, kf5=\EU\r, kf6=\EV\r, kf7=\EW\r, kf8=\EX\r, kf9=\EY\r, khome=\ER\r, lf0=REFRSH, lf1=DEL CH, lf2=TABSET, lf3=GOTO, lf4=+PAGE, lf5=+SRCH, lf6=-PAGE, lf7=-SRCH, lf8=LEFT, lf9=RIGHT, ri=\E[T, rmso=\E[2 D, rmul=\E[2 D, smso=\E[6 D, - smul=\E[18 D, use=ansi+local1, + smul=\E[18 D, use=ansi+idl1, use=ansi+local1, #### Kimtron (abm, kt) # @@ -18816,25 +19249,22 @@ cols#80, lines#24, vt#3, wsl#72, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[<4l, clear=^L, cnorm=\E[<4h, cr=\r, csr=\E[%i%p1%d;%p2%d%%v, cub1=^H, - cud1=\n, cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, - dsl=\E[%}\024, ech=\E[%p1%dX, ed=\E[J$<10>, el=\E[K, - fsl=^T, home=\E[H, hpa=\E[%i%p1%d`, ind=\n, - is2=\E[&p\E[<12l\E F, kclr=^L, kf1=\E[11~, kf10=\E[21~, - kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, - kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, - kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, - kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, nel=\r\n, prot=\E[32%{, - rc=\E[%z, rep=\E[%p2%db%p1%c, rev=\E[7m, ri=\E[L, - rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, + cud1=\n, dch=\E[%p1%dP, dch1=\E[P, dsl=\E[%}\024, + ech=\E[%p1%dX, ed=\E[J$<10>, el=\E[K, fsl=^T, + hpa=\E[%i%p1%d`, ind=\n, is2=\E[&p\E[<12l\E F, kclr=^L, + kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, + kf17=\E[31~, kf18=\E[32~, nel=\r\n, prot=\E[32%{, rc=\E[%z, + rep=\E[%p2%db%p1%c, rev=\E[7m, ri=\E[L, rmir=\E[4l, rs2=\E[&p\E[<12l\E\sF\E[3g\E[9;17;25;33;41;49;57;65;73 \sN, sc=\E[%y, sgr=\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p6%t;1%;m%? %p8%t\E[32%%{%;%?%p9%t\016%e\017%;, - sgr0=\E[0m\017, smir=\E[4h, smso=\E[7m, smul=\E[4m, - tsl=\E[%i%p1%d%%}, vpa=\E[%i%p1%dd, use=ansi+arrows, - use=ansi+idl, use=ansi+inittabs, use=ansi+local, - use=ansi+pp, + sgr0=\E[0m\017, smir=\E[4h, tsl=\E[%i%p1%d%%}, + vpa=\E[%i%p1%dd, use=ecma+underline, use=ecma+standout, + use=ansi+arrows, use=ansi+cup, use=ansi+idl, + use=ansi+inittabs, use=ansi+local, use=ansi+pp, + use=xterm+r5+fkeys, # p9-w: Prism-9 in 132 column mode # -------------------------------- @@ -19052,19 +19482,19 @@ mt4520-rv|micro-term 4520 reverse video, am, hs, msgr, xenl, xon, cols#80, it#8, lines#24, wsl#80, - bel=^G, cnorm=\E[0V\E8, cr=\r, cup=\E[%i%p1%d;%p2%dH, - cvvis=\E7\E[0U, dch=\E[%p1%dP, dch1=\E[P, - flash=\E[?5l$<200/>\E[?5h, fsl=\E[?5l\E[?5h, home=\E[H, - ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, ind=\ED, + bel=^G, cnorm=\E[0V\E8, cr=\r, cvvis=\E7\E[0U, + dch=\E[%p1%dP, dch1=\E[P, flash=\E[?5l$<200/>\E[?5h, + fsl=\E[?5l\E[?5h, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, + ind=\ED, is2=\E(B\E[2l\E>\E[20l\E[?3l\E[?5h\E[?7h\E[1;24r\E[24;1H\E[H \E[J, - kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, ll=\E[24;1H, nel=\EE, - rf=/usr/share/tabset/vt100, ri=\EM, rmam=\E[?7l, - rmso=\E[0m, rmul=\E[24m, + ll=\E[24;1H, nel=\EE, rf=/usr/share/tabset/vt100, ri=\EM, + rmam=\E[?7l, rmso=\E[0m, rs1=\E(B\E[2l\E>\E[20l\E[?3l\E[?5h\E[?7h\E[H\E[J, - sgr0=\E[m, smam=\E[?7h, smso=\E[7m, smul=\E[4m, tbc=\E[g, - tsl=\E[25;1H, use=ansi+arrows, use=ansi+csr, - use=ansi+erase, use=ansi+idl, use=ansi+local, + sgr0=\E[m, smam=\E[?7h, smso=\E[7m, tbc=\E[g, tsl=\E[25;1H, + use=ecma+underline, use=ansi+arrows, use=ansi+csr, + use=ansi+cup, use=ansi+erase, use=ansi+idl, + use=ansi+local, use=vt100+pf1-pf4, # Fri Aug 5 08:11:57 1983 # This entry works for the ergo 4000 with the following setups: @@ -19083,12 +19513,11 @@ ed=\E[0J$<15>, el=\E[0K$<13>, ht=^I, il1=\E[1L$<5*>, ind=\ED$<20*>, is2=\E<\E=\E[?1l\E[?4l\E[?5l\E[?7h\E[?8h$<300>, - kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, - kf2=\EOQ, kf3=\EOR, kf4=\EOS, lf1=pf1, lf2=pf2, lf3=pf3, - lf4=pf4, ri=\EM$<20*>, rmam=\E[?7l, rmir=\E[4l, - rmkx=\E=$<4>, rmso=\E[m$<20>, sgr0=\E[m$<20>, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, lf1=pf1, + lf2=pf2, lf3=pf3, lf4=pf4, ri=\EM$<20*>, rmam=\E[?7l, + rmir=\E[4l, rmkx=\E=$<4>, rmso=\E[m$<20>, sgr0=\E[m$<20>, smam=\E[?7m, smir=\E[4h$<6>, smkx=\E=$<4>, - smso=\E[7m$<20>, use=ansi+local1, + smso=\E[7m$<20>, use=ansi+local1, use=vt100+pf1-pf4, #### NCR # @@ -19252,17 +19681,13 @@ is2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$< 200>, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, - kf0=\EOy, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, - kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, - kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, - kf21=\E[31~, kf22=\E[32~, kf23=\E[33~, kf24=\E[34~, - kf25=\E[35~, kf26=\E[1~, kf27=\E[2~, kf28=\E[3~, - kf29=\E[4~, kf30=\E[5~, kf31=\E[6~, kf32=\E[7~, kf33=\E[8~, - kf34=\E[9~, kf35=\E[10~, kf5=\E[M, kf6=\E[17~, kf7=\E[18~, - kf8=\E[19~, kf9=\E[20~, khlp=\E[28~, krdo=\E[29~, mc0=\E[i, - mc4=\E[4i, mc5=\E[5i, nel=\EE, rc=\E8, ri=\EM$<5>, - rmacs=\017$<20>, rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, - rmso=\E[27m, rmul=\E[24m, + kf0=\EOy, kf21=\E[31~, kf22=\E[32~, kf23=\E[33~, + kf24=\E[34~, kf25=\E[35~, kf26=\E[1~, kf27=\E[2~, + kf28=\E[3~, kf29=\E[4~, kf30=\E[5~, kf31=\E[6~, kf32=\E[7~, + kf33=\E[8~, kf34=\E[9~, kf35=\E[10~, kf5=\E[M, khlp=\E[28~, + krdo=\E[29~, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, nel=\EE, rc=\E8, + ri=\EM$<5>, rmacs=\017$<20>, rmam=\E[?7l, rmir=\E[4l, + rmkx=\E[?1l\E>, rs2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$< 200>, sc=\E7, @@ -19270,9 +19695,10 @@ %;%?%p7%t;8%;m%?%p9%t\016%e\017%;$<20>, sgr0=\E[0m\017$<20>, smacs=\016$<20>, smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, tbc=\E[3g, - vpa=\E[%p1%dd$<40>, use=ansi+sgrbold, use=decid+cpr, + vpa=\E[%p1%dd$<40>, use=ecma+underline, + use=ecma+standout, use=ansi+sgrbold, use=decid+cpr, use=vt220+vtedit, use=vt220+cvis, use=vt220+keypad, - use=ncr260vt+sl, + use=ncr260vt+sl, use=vt220+sfkeys, use=vt220+ufkeys, ncr260vt200wan|NCR 2900/260 VT200 wide mode ANSI keyboard, cols#132, @@ -19310,17 +19736,13 @@ is2=\E[!p\E[?7;19;67h\E[?1;3;4l\E[1;0%w\E(B\E)0\017\E[2J\E[1 ;1H\E>$<200>, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, - kf0=\EOy, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, - kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, - kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, - kf21=\E[31~, kf22=\E[32~, kf23=\E[33~, kf24=\E[34~, - kf25=\E[35~, kf26=\E[1~, kf27=\E[2~, kf28=\E[3~, - kf29=\E[4~, kf30=\E[5~, kf31=\E[6~, kf32=\E[7~, kf33=\E[8~, - kf34=\E[9~, kf35=\E[10~, kf5=\E[M, kf6=\E[17~, kf7=\E[18~, - kf8=\E[19~, kf9=\E[20~, khlp=\E[28~, krdo=\E[29~, mc0=\E[i, - mc4=\E[4i, mc5=\E[5i, nel=\EE, rc=\E8, ri=\EM$<5>, - rmacs=\017$<20>, rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, - rmso=\E[27m, rmul=\E[24m, + kf0=\EOy, kf21=\E[31~, kf22=\E[32~, kf23=\E[33~, + kf24=\E[34~, kf25=\E[35~, kf26=\E[1~, kf27=\E[2~, + kf28=\E[3~, kf29=\E[4~, kf30=\E[5~, kf31=\E[6~, kf32=\E[7~, + kf33=\E[8~, kf34=\E[9~, kf35=\E[10~, kf5=\E[M, khlp=\E[28~, + krdo=\E[29~, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, nel=\EE, rc=\E8, + ri=\EM$<5>, rmacs=\017$<20>, rmam=\E[?7l, rmir=\E[4l, + rmkx=\E[?1l\E>, rs2=\E[!p\E[?7;19;67h\E[?1;3;4l\E[1;0%w\E(B\E)0\017\E[2J\E[1 ;1H\E>$<200>, sc=\E7, @@ -19328,9 +19750,10 @@ %;%?%p7%t;8%;m%?%p9%t\016%e\017%;$<20>, sgr0=\E[0m\017$<20>, smacs=\016$<20>, smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, tbc=\E[3g, - vpa=\E[%p1%dd$<40>, use=ansi+sgrbold, use=decid+cpr, + vpa=\E[%p1%dd$<40>, use=ecma+underline, + use=ecma+standout, use=ansi+sgrbold, use=decid+cpr, use=vt220+vtedit, use=vt220+cvis, use=vt220+keypad, - use=ncr260vt+sl, + use=ncr260vt+sl, use=vt220+sfkeys, use=vt220+ufkeys, ncr260vt300wan|NCR 2900/260 VT300 wide mode ANSI keyboard, cols#132, @@ -19380,16 +19803,14 @@ is2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`:\E`@\E~!\E"\Ee4\Ex@\E`9 \Ee7$<100>, kDC=\ER, kEND=\EY, kHOM=\E{, kNXT=\EK, kPRT=\E7, kPRV=\EJ, - kRIT=^L, ka1=^^, kb2=\EJ, kbs=^H, kc1=\ET, kc3=\EK, kcbt=\EI, - kcub1=^H, kcud1=\n, kcuf1=^L, kcuu1=^K, kdch1=\EW, kend=\ET, - kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, - kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, kf17=^A`\r, kf18=^Aa\r, - kf19=^Ab\r, kf2=^AA\r, kf20=^Ac\r, kf21=^Ad\r, kf22=^Ae\r, - kf23=^Af\r, kf24=^Ag\r, kf25=^Ah\r, kf26=^Ai\r, kf27=^Aj\r, - kf28=^Ak\r, kf29=^Al\r, kf3=^AB\r, kf30=^Am\r, kf31=^An\r, - kf32=^Ao\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, - kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\Eq, knp=\EK, kpp=\EJ, - kprt=\EP, mc0=\EP, mc4=^T, mc5=^R, + kRIT=^L, ka1=^^, kb2=\EJ, kc1=\ET, kc3=\EK, kcbt=\EI, kcub1=^H, + kcud1=\n, kcuf1=^L, kcuu1=^K, kdch1=\EW, kend=\ET, + kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, + kf17=^A`\r, kf18=^Aa\r, kf19=^Ab\r, kf20=^Ac\r, kf21=^Ad\r, + kf22=^Ae\r, kf23=^Af\r, kf24=^Ag\r, kf25=^Ah\r, kf26=^Ai\r, + kf27=^Aj\r, kf28=^Ak\r, kf29=^Al\r, kf30=^Am\r, kf31=^An\r, + kf32=^Ao\r, khome=^^, kich1=\Eq, knp=\EK, kpp=\EJ, kprt=\EP, + mc0=\EP, mc4=^T, mc5=^R, mrcup=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c$<10>, nel=\037$<5>, rev=\EG4, ri=\Ej$<5>, rmacs=\EH\003\EcB0, rmam=\Ed., rmir=\Er, rmso=\EG0, rmul=\EG0, rmxon=\Ec20, @@ -19404,7 +19825,8 @@ %t%{63}%e%p1%{15}%=%t%{56}%;\Edy%c11$<100>, sgr0=\EG0\EcB0\EcD$<15>, smacs=\EH\002\EcB1, smam=\Ed/, smir=\Eq, smso=\EGt, smul=\EG8, smxon=\Ec21, tbc=\E0, - use=ncr260vp+sl, + use=ncr260vp+sl, use=tvi920b+fn, use=ansi+arrows, + use=ansi+apparrows, ncr260wy325wpp|NCR 2900/260 Wyse 325 wide mode, cols#132, cup=\Ea%i%p1%dR%p2%dC$<30>, @@ -19597,10 +20019,10 @@ home=\E[H$<2>$<80>, il=\E[%p1%dL$<80>, il1=\E[B\E[L$<80>, ind=\ED, is2=\E[12h\E[?10l\E%/0n\E[P\031\E[?3l\E(B\E)0$<200>, - kLFT=\E[D, kRIT=\E[C, ka1=\E[H, kent=\r, kf1=\EOP, kf2=\EOQ, - kf3=\EOR, kf4=\EOS, mc0=\E[i$<100>, nel=\EE, rc=\E8, - rev=\E[7m$<30>, ri=\EM$<50>, rmacs=\017$<90>, - rmir=\E[4l$<80>, rmso=\E[0m$<30>, rmul=\E[0m$<30>, + kLFT=\E[D, kRIT=\E[C, ka1=\E[H, kent=\r, mc0=\E[i$<100>, + nel=\EE, rc=\E8, rev=\E[7m$<30>, ri=\EM$<50>, + rmacs=\017$<90>, rmir=\E[4l$<80>, rmso=\E[0m$<30>, + rmul=\E[0m$<30>, rs2=\Ec\E[12;31h\E[?3;4;5;10l\E[?6;7;19;25h\E[33;34l\E[0m\E( B\E)0\E%/0n\E[P\031$<200>, sc=\E7, @@ -19609,6 +20031,7 @@ sgr0=\017\E[0m$<120>, smacs=\016$<90>, smir=\E[4h$<80>, smso=\E[7m$<30>, smul=\E[4m$<30>, tbc=\E[3g$<40>, tsl=\E[>+1$<70>, use=decid+cpr, use=vt100+4bsd, + use=vt100+pf1-pf4, ncrvt100wan|NCRVT100WPP|ncrvt100wpp|NCR VT100 emulation of the 2900 terminal, cols#132, is2=\E[12h\E[?10l\E%/0n\E[P\031\E[?3h\E(B\E)0$<200>, @@ -19857,17 +20280,16 @@ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, civis=\ER, clear=^L, cnorm=\ES, cr=\r, csr=\EU%p1%{32}%+%c%p2%{32}%+%c, - cub1=^H, cud1=\E[B, cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, - dch1=\EM, dl=\E[%p1%dM, dl1=\EL, ed=\E[J, el=\E[K, fsl=\r, - home=\E[H, ht=^I, ich=\E[%p1%d@, ich1=\EO, il=\E[%p1%dL, + cub1=^H, dch=\E[%p1%dP, dch1=\EM, dl=\E[%p1%dM, dl1=\EL, + fsl=\r, ht=^I, ich=\E[%p1%d@, ich1=\EO, il=\E[%p1%dL, il1=\EN, ind=\n, indn=\E[%p1%dB, is2=\E[U 7\E[24;1H, khome=\E[H, rc=\EX, rev=\E[7m, rf=/usr/share/tabset/vt100, ri=\EI, rin=\E[%p1%dA, rmacs=\Ed, rmam=\E[?7l, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\EW, sgr0=\E[m, smacs=\EF, smam=\E[?7m, tsl=\E], uc=\EPB, - use=ansi+apparrows, use=ansi+local, use=ansi+sgrso, - use=ansi+sgrul, + use=ansi+apparrows, use=ansi+cup, use=ansi+erase, + use=ansi+local, use=ansi+sgrso, use=ansi+sgrul, #### Tandem # @@ -19914,17 +20336,18 @@ cols#80, lines#24, xmc#1, acsc=jjkkllmmnnqqttuuvvwwxx, bel=^G, clear=\E[H\E[2J, cr=\r, csr=\E[%p1%2d;%p2%2dr, cub1=^H, - cup=\010\E[%i%p1%d;%p2%dH, dch1=\E[P, dl1=\E[M, ed=\E[J, - el=\E[K, home=\E[H, ht=^I, ich1=\E[@, il1=\E[L, ind=\n, - is2=\E[?3l\E)0\E(B, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, - kcuu1=\E[A, kf1=\E[?3i, kf10=\E[?5i, kf2=\E[2i, kf3=\E[@, - kf4=\E[M, kf5=\E[17~, kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, - kf9=\E[21~, khome=\E[H, knp=\E[29~, kpp=\E[28~, lf1=f1, - lf2=f2, lf3=f3, lf4=f4, lf5=f5, lf6=f6, lf7=f7, lf8=f8, ri=\EM, - rmacs=^O, rmso=\E[m, rmul=\E[m, sgr0=\E[m, smacs=^N, - smso=\E[7m, smul=\E[4m, use=ansi+local1, use=vt220+cvis, + cup=\010\E[%i%p1%d;%p2%dH, dch1=\E[P, ed=\E[J, el=\E[K, + home=\E[H, ht=^I, ich1=\E[@, ind=\n, is2=\E[?3l\E)0\E(B, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\E[?3i, + kf10=\E[?5i, kf2=\E[2i, kf3=\E[@, kf4=\E[M, kf5=\E[17~, + kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, kf9=\E[21~, khome=\E[H, + knp=\E[29~, kpp=\E[28~, lf1=f1, lf2=f2, lf3=f3, lf4=f4, lf5=f5, + lf6=f6, lf7=f7, lf8=f8, ri=\EM, rmacs=^O, sgr0=\E[m, smacs=^N, + use=ansi+idl1, use=ansi+local1, use=ansi+sgrso, + use=ansi+sgrul, use=vt220+cvis, dt100w|dt-100w|Tandy DT-100 terminal (wide mode), cols#132, use=dt100, + dt110|Tandy DT-110 emulating ANSI, xon, cols#80, lines#24, @@ -19933,14 +20356,13 @@ cup=\010\E[%i%p1%d;%p2%dH, dch1=\E[0P, dl1=\E[0M, ed=\E[0J, el=\E[0K, enacs=\E(B\E)0, home=\E[H, ht=^I, ich1=\E[0@, il1=\E[0L, ind=\n, is2=\E[?3l\E)0\E(B, - kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kend=\E[K, - kf1=\E[1~, kf10=\E[10~, kf2=\E[2~, kf3=\E[3~, kf4=\E[4~, - kf5=\E[5~, kf6=\E[6~, kf7=\E[7~, kf8=\E[8~, kf9=\E[9~, - khome=\E[G, kich1=\E[@, knp=\E[26~, kpp=\E[25~, lf0=f1, - lf1=f2, lf2=f3, lf3=f4, lf4=f5, lf5=f6, lf6=f7, lf7=f8, lf8=f9, - lf9=f10, ri=\EM, rmacs=^O, rmso=\E[m, rmul=\E[m, sgr0=\E[m, - smacs=^N, smso=\E[7m, smul=\E[4m, use=ansi+local1, - use=vt220+cvis, + kend=\E[K, kf1=\E[1~, kf10=\E[10~, kf2=\E[2~, kf3=\E[3~, + kf4=\E[4~, kf5=\E[5~, kf6=\E[6~, kf7=\E[7~, kf8=\E[8~, + kf9=\E[9~, khome=\E[G, kich1=\E[@, knp=\E[26~, kpp=\E[25~, + lf0=f1, lf1=f2, lf2=f3, lf3=f4, lf4=f5, lf5=f6, lf6=f7, lf7=f8, + lf8=f9, lf9=f10, ri=\EM, rmacs=^O, sgr0=\E[m, smacs=^N, + use=ansi+cup, use=ansi+local1, use=ansi+sgrso, + use=ansi+sgrul, use=vt100+noapp, use=vt220+cvis, pt210|TRS-80 PT-210 printing terminal, hc, os, cols#80, @@ -20085,6 +20507,7 @@ is2=\037com\s33\r\n!sto\s9\,17\,25\,33\,41\,49\,57\,65\,73 \r, rmcup=\037com 33\r, smcup=!com 31\r, use=tek4025, + tek4105|Tektronix 4105, OTbs, am, mir, msgr, ul, xenl, xt, cols#79, it#8, lines#29, @@ -20136,22 +20559,22 @@ OTkn#8, cols#80, lines#30, vt#3, acsc=, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E%!0\ETD00\E%!1, cnorm=\E%!0\ETD10\E%!1, cr=\r, - cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, cuu1=\EM, - cvvis=\E%!0\ETD70\E%!1, dch=\E[%p1%dP, dch1=\E[P, - ech=\E[%p1%dX, home=\E[H, ind=\n, is2=\E%!1, kbs=^H, - kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOA, - kf1=\EOB, kf2=\EOC, kf3=\EOD, kf4=\EOP, kf5=\EOQ, kf6=\EOR, - kf7=\EOS, lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, lf5=F6, lf6=F8, - ll=\E[30;H, nel=\EE, rev=\E[7m, ri=\EM, rmacs=^O, - rmcup=\E%!0\ELBH=\E%!1, rmir=\E[4l, rmkx=\E[?1l\E>, - rmso=\E[m, rmul=\E[m, + cub1=^H, cud1=\n, cuu1=\EM, cvvis=\E%!0\ETD70\E%!1, + dch=\E[%p1%dP, dch1=\E[P, ech=\E[%p1%dX, ind=\n, is2=\E%!1, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf0=\EOA, kf1=\EOB, kf2=\EOC, kf3=\EOD, kf4=\EOP, kf5=\EOQ, + kf6=\EOR, kf7=\EOS, lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, + lf5=F6, lf6=F8, ll=\E[30;H, nel=\EE, rev=\E[7m, ri=\EM, + rmacs=^O, rmcup=\E%!0\ELBH=\E%!1, rmir=\E[4l, + rmkx=\E[?1l\E>, rs2=\030\E%!0\EKC\E\014\EKR0\EKF0\ENM0\ELBH=\ETF8000010F40 \ELI100\ELLA>\ELM0\EKE0\ENF1\EKS0\END0\E%!1\Ec\E[?3;5l \E[?7;8h\E[r\E[m\E>, sgr0=\E[m, smacs=^N, smcup=\E[?6l, smir=\E[4h, - smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, use=ansi+csr, + smkx=\E[?1h\E=, use=ansi+csr, use=ansi+cup, use=ansi+erase, use=ansi+idl, use=ansi+inittabs, - use=ansi+local, use=ecma+index, + use=ansi+local, use=ansi+sgrso, use=ansi+sgrul, + use=ecma+index, # Tektronix 4106/4107/4109 from BRL # The following setup modes are assumed for normal operation: @@ -20179,22 +20602,22 @@ cols#80, lines#32, vt#3, acsc=, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E%!0\ETD00\E%!1, cnorm=\E%!0\ETD10\E%!1, cr=\r, - cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, cuu1=\EM, - cvvis=\E%!0\ETD70\E%!1, dch=\E[%p1%dP, dch1=\E[P, - ech=\E[%p1%dX, home=\E[H, ind=\n, is2=\E%!1, kbs=^H, - kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOA, - kf1=\EOB, kf2=\EOC, kf3=\EOD, kf4=\EOP, kf5=\EOQ, kf6=\EOR, - kf7=\EOS, lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, lf5=F6, lf6=F8, - ll=\E[32;H, nel=\EE, rev=\E[7m, ri=\EM, rmacs=^O, - rmcup=\E%!0\ELBH=\E%!1, rmir=\E[4l, rmkx=\E[?1l\E>, - rmso=\E[m, rmul=\E[m, + cub1=^H, cud1=\n, cuu1=\EM, cvvis=\E%!0\ETD70\E%!1, + dch=\E[%p1%dP, dch1=\E[P, ech=\E[%p1%dX, ind=\n, is2=\E%!1, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf0=\EOA, kf1=\EOB, kf2=\EOC, kf3=\EOD, kf4=\EOP, kf5=\EOQ, + kf6=\EOR, kf7=\EOS, lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, + lf5=F6, lf6=F8, ll=\E[32;H, nel=\EE, rev=\E[7m, ri=\EM, + rmacs=^O, rmcup=\E%!0\ELBH=\E%!1, rmir=\E[4l, + rmkx=\E[?1l\E>, rmso=\E[m, rs1=\030\E%!0\EKC\E\014\EKR0\EKF0\ENM0\ELBH=\ETF8000010F40 \ELI100\ELLB0\ELM0\EKE0\ENF1\EKS0\END0\ERE0\E%!1\Ec\E[?3 ;5l\E[?7;8h\E[r\E[m\E>, sgr0=\E[m, smacs=^N, smcup=\E[?6l, smir=\E[4h, - smkx=\E[?1h\E=, smso=\E[7;42m, smul=\E[4m, use=ansi+csr, - use=ansi+erase, use=ansi+idl, use=ansi+inittabs, - use=ansi+local, use=ecma+index, + smkx=\E[?1h\E=, smso=\E[7;42m, use=ansi+csr, + use=ansi+cup, use=ansi+erase, use=ansi+idl, + use=ansi+inittabs, use=ansi+local, use=ansi+sgrul, + use=ecma+index, # Refer to: # TEK Programmer's Reference @@ -20263,14 +20686,15 @@ cols#80, lines#34, cbt=\E[Z, clear=\E[2J\E[0;0H, cub1=^H, cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\EM, dch1=\E[P, - dl1=\E[M, ed=\E[0J, el=\E[0K, ich1=\E[@, il1=\E[L, - ind=\E7\E[0;0H\E[M\E8, is2=\E3!1, ri=\E7\E[0;0H\E[L\E8, - rmso=\E[m, rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, + ed=\E[0J, el=\E[0K, ich1=\E[@, ind=\E7\E[0;0H\E[M\E8, + is2=\E3!1, ri=\E7\E[0;0H\E[L\E8, sgr0=\E[m, + use=ansi+idl1, use=ansi+sgrso, use=ansi+sgrul, tek4112-nd|Tektronix 4112 not in dialog area, OTns, cuu1=^K, use=tek4112, tek4112-5|Tektronix 4112 in 5 line dialog area, lines#5, use=tek4112, + # (tek4113: this used to have "", someone's mistake; # removed ", ", which had been commented out in 8.3. # Note, the !0 and !1 sequences in /// were @@ -20305,16 +20729,15 @@ cols#80, it#8, lines#34, cbt=\E[Z, clear=\E[H\E[2J, cnorm=\E%!0\ELBG8\E%!1\E[34;1H, - cup=\E[%i%p1%d;%p2%dH, cvvis=\E%!0\ELBB2\E%!1, - dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, - if=/usr/share/tabset/vt100, il1=\E[L, + cvvis=\E%!0\ELBB2\E%!1, dch1=\E[P, ed=\E[J, el=\E[K, ht=^I, + if=/usr/share/tabset/vt100, is2=\E%!0\E%\014\ELV0\EKA1\ELBB2\ENU@=\ELLB2\ELM0\ELV1\EKYA? \E%!1\E[<1l\E[?7h\E[?8h\E[34;1H\E[34B\E[m, kbs=^H, ri=\EM, rmam=\E[?7l, rmcup=\E%!0\ELBG8\E%!1\E[34;1H\E[J, rmir=\E[4l, - rmkx=\E>, rmso=\E[m, rmul=\E[m, sgr0=\E[m, smam=\E[?7h, - smcup=\E%!0\ELBB2\E%!1, smir=\E[4h, smkx=\E=, smso=\E[7m, - smul=\E[4m, use=ansi+local1, + rmkx=\E>, sgr0=\E[m, smam=\E[?7h, smcup=\E%!0\ELBB2\E%!1, + smir=\E[4h, smkx=\E=, use=ansi+cup, use=ansi+idl1, + use=ansi+local1, use=ansi+sgrso, use=ansi+sgrul, tek4115|Tektronix 4115 entry with more ANSI capabilities (new), am, xon, cols#80, lines#34, @@ -20350,17 +20773,16 @@ am, bw, mir, msgr, ul, xenl, cols#80, it#8, lines#32, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J$<156/>, - cub1=^H, cud1=\n, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, - cuu1=\EM, dch1=\E[P$<4/>, dl1=\E[M$<3/>, ed=\E[J, - el=\E[K$<5/>, home=\E[H, ht=^I, ich1=\E[@$<4/>, - il1=\E[L$<3/>, ind=\E[S, invis=\E[=6;<5, + cub1=^H, cud1=\n, cuf1=\E[C, cuu1=\EM, dch1=\E[P$<4/>, + dl1=\E[M$<3/>, ed=\E[J, el=\E[K$<5/>, ht=^I, + ich1=\E[@$<4/>, il1=\E[L$<3/>, ind=\E[S, invis=\E[=6;<5, is2=\E%!0\ELBP0\E%!1\E[H\E[2g\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8 C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[J, kcub1=\E[D, kcud1=\ED, kcuf1=\E[C, kcuu1=\EM, khome=\E[H, rev=\E[7m, ri=\E[T, - rmcup=\E[?6h\E%!0\ELBP0\E%!1\E[32;1f, rmso=\E[m, - rmul=\E[m, sgr0=\E[m, smcup=\E[?6l\E[H\E[J, smso=\E[7m, - smul=\E[4m, tbc=\E[1g, + rmcup=\E[?6h\E%!0\ELBP0\E%!1\E[32;1f, sgr0=\E[m, + smcup=\E[?6l\E[H\E[J, tbc=\E[1g, use=ansi+cup, + use=ansi+sgrso, use=ansi+sgrul, # From: Thu Oct 31 12:54:27 1985 # (tek4404: There was a "\!" in that I replaced with "\E!". @@ -20369,13 +20791,13 @@ OTbs, cols#80, it#8, lines#32, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cub1=^H, cud1=\n, - cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, - dl1=\E[1M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, hts=\E[2I, - il1=\E[1L, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, - rmcup=\E[1;1H\E[0J\E[?6h\E[?1l, rmir=\E[4l, - rmkx=\E[?1h, rmso=\E[27m, rmul=\E[m, sgr0=\E[m, + cuf1=\E[C, cuu1=\E[A, dch1=\E[P, dl1=\E[1M, ed=\E[J, el=\E[K, + ht=^I, hts=\E[2I, il1=\E[1L, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, rmcup=\E[1;1H\E[0J\E[?6h\E[?1l, + rmir=\E[4l, rmkx=\E[?1h, sgr0=\E[m, smcup=\E%\E!1\E[1;32r\E[?6l\E>, smir=\E[4h, - smkx=\E[?1l, smso=\E[7m, smul=\E[4m, use=ansi+csr, + smkx=\E[?1l, use=ecma+standout, use=ansi+csr, + use=ansi+cup, use=ansi+sgrul, # Some unknown person wrote: # I added the is string - straight Unix has ESC ; in the login @@ -20409,11 +20831,10 @@ colors#8, cols#80, it#8, lines#30, ncv#49, pairs#63, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[=7;<4m, cbt=\E[Z, - clear=\E[2J\E[H, cr=\r, cup=\E[%i%p1%d;%p2%dH, - dch1=\E[1P, dim=\E[=1;<6m, dl=\E[%p1%dM, dl1=\E[1M, - ech=\E%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0, - home=\E[H, ht=^I, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[1L, - ind=\ED, + clear=\E[2J\E[H, cr=\r, dch1=\E[1P, dim=\E[=1;<6m, + dl=\E[%p1%dM, dl1=\E[1M, ech=\E%p1%dX, ed=\E[J, el=\E[K, + el1=\E[1K, enacs=\E)0, ht=^I, ich=\E[%p1%d@, il=\E[%p1%dL, + il1=\E[1L, ind=\ED, initc=\E%%!0\ETF4%?%p1%{0}%=%t0%e%p1%{1}%=%t4%e%p1%{2}%=%t3 %e%p1%{3}%=%t5%e%p1%{4}%=%t2%e%p1%{5}%=%t6%e%p1%{6}%= %t7%e1%;%?%p2%{125}%<%t0%e%p2%{250}%<%tA2%e%p2%{375}%< @@ -20431,7 +20852,7 @@ oc=\E%!0\ETFB000001F4F4F42F40030F404A4C\E[m\014, kbs=^H, kcub1=\E[D, kcud1=\E[B, - kcuf1=\E[C, kcuu1=\E[A, rmacs=\E[10m, rmso=\E[m, rmul=\E[m, - sgr0=\E[m, smacs=\E[11m, smso=\E[7m, smul=\E[4m, - use=ansi+local1, + cnorm=\E[5l, cub1=^H, dch1=\E[P, ed=\E[J, el=\E[K, ht=^I, + ich1=\E[@, is2=\E>\E[m\014, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, rmacs=\E[10m, sgr0=\E[m, + smacs=\E[11m, use=ansi+cup, use=ansi+idl1, + use=ansi+local1, use=ansi+sgrso, use=ansi+sgrul, liswb|Apple Lisa console display (white on black), is2=\E>\E[0;7m\014, rmso=\E[0;7m, rmul=\E[0;7m, smso=\E[m, smul=\E[4m, use=lisa, @@ -20795,14 +21214,14 @@ OTbs, OTpt, am, xenl, xon, OTkn#4, cols#80, it#8, lines#24, vt#3, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cr=\r, - cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, ed=\E[J, el=\E[K, - home=\E[H, ht=^I, hts=\EH, ind=\n, kbs=^H, kcub1=\EOD, - kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOP, kf1=\EOQ, - kf2=\EOR, kf3=\EOS, lf0=F1, lf1=F2, lf2=F3, lf3=F4, rev=\E[7m, - ri=\EM, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + cub1=^H, cud1=\n, ed=\E[J, el=\E[K, ht=^I, hts=\EH, ind=\n, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf0=\EOP, kf1=\EOQ, kf2=\EOR, kf3=\EOS, lf0=F1, lf1=F2, lf2=F3, + lf3=F4, rev=\E[7m, ri=\EM, rmkx=\E[?1l\E>, rs1=\E>\E[?1l\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r, - sgr0=\E[m, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, - tbc=\E[3g, use=ansi+csr, use=ansi+local, + sgr0=\E[m, smkx=\E[?1h\E=, tbc=\E[3g, use=ansi+csr, + use=ansi+cup, use=ansi+local, use=ansi+sgrso, + use=ansi+sgrul, # Lisaterm in 132 column ("wide") mode. lisaterm-w|Apple Lisa with Lisaterm in 132 column mode, @@ -20894,15 +21313,14 @@ OTbs, am, bw, xenl, cols#80, lines#24, acsc=, bel=^G, blink=\E[7;2m, bold=\E[1m, cbt=\E[Z, - civis=\E[0 p, cnorm=\E[ p, cup=\E[%i%p1%d;%p2%dH, - dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, home=\E[H, - ich=\E[%p1%d@, ich1=\E[@, ind=\E[S, invis=\E[8m, + civis=\E[0 p, cnorm=\E[ p, dch=\E[%p1%dP, dch1=\E[P, + dim=\E[2m, ich=\E[%p1%d@, ich1=\E[@, ind=\E[S, invis=\E[8m, is2=\E[20l, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\E[9~, kf1=\E[0~, kf2=\E[1~, kf3=\E[2~, kf4=\E[3~, kf5=\E[4~, kf6=\E[5~, kf7=\E[6~, kf8=\E[7~, - kf9=\E[8~, rev=\E[7m, ri=\E[T, rmacs=^O, rmso=\E[m, - rmul=\E[m, rs1=\Ec, sgr0=\E[m, smacs=^N, smso=\E[7m, - smul=\E[4m, use=ansi+erase, use=ansi+idl, use=ansi+local, + kf9=\E[8~, rev=\E[7m, ri=\E[T, rmacs=^O, rs1=\Ec, sgr0=\E[m, + smacs=^N, use=ansi+cup, use=ansi+erase, use=ansi+idl, + use=ansi+local, use=ansi+sgrso, use=ansi+sgrul, use=ecma+index, # From: Hans Verkuil , 4 Dec 1995 @@ -20957,13 +21375,14 @@ kf8=\E[7~, kf9=\E[8~, khlp=\E[?~, khome=\E[44~, kll=\E[45~, kmous=\E[M, knp=\E[42~, kpp=\E[41~, nel=\EE, oc=\E[0m, rev=\E[7m, ri=\EM, rmcup=\E[?7h\E[r\E[J, rmkx=\E[?1l, - rmso=\E[21m, rmul=\E[24m, rs1=\Ec, + rmso=\E[21m, rs1=\Ec, rs2=\E[>?2;18l\E[>?26;?6;20;>?15;?7;>?22;>?8h, setab=\E[%?%p1%{8}%>%t%'F'%p1%+%d%e4%p1%d%;m, setaf=\E[%?%p1%{8}%>%t%'2'%p1%+%d%e3%p1%d%;m, sgr0=\E[0m\017\E[30;85;>15m, smcup=\E[?7h, smkx=\E[?1h, - smso=\E[1m, smul=\E[4m, use=ansi+arrows, use=ansi+erase, - use=ansi+local, use=ecma+index, + smso=\E[1m, smul=\E[4m, use=ecma+underline, + use=ansi+arrows, use=ansi+erase, use=ansi+local, + use=ecma+index, # MorphOS on Genesi Pegasos # By Pavel Fedin @@ -21068,24 +21487,22 @@ # See # https://web.archive.org/web/20120703021949/http://www.minix3.org/manpages/html4/console.html minix|minix console (v3), - NQ, acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j \331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v \301w\302x\263y\363z\362{\343|\330}\234~\376, - kdch1=^?, kend=\E[Y, kf0=\E[21~, kf1=\E[11~, kf10=\E[21~, + kdch1=^?, kend=\E[Y, kf0=\E[21~, kf10=\E[21~, kf11=\E[11;2~, kf12=\E[12;2~, kf13=\E[13;2~, kf14=\E[14;2~, kf15=\E[15;2~, kf16=\E[17;2~, - kf17=\E[18;2~, kf18=\E[19;2~, kf19=\E[20;2~, kf2=\E[12~, + kf17=\E[18;2~, kf18=\E[19;2~, kf19=\E[20;2~, kf20=\E[21;2~, kf21=\E[11;5~, kf22=\E[12;5~, kf23=\E[13;5~, kf24=\E[14;5~, kf25=\E[15;5~, kf26=\E[17;5~, kf27=\E[18;5~, kf28=\E[19;5~, - kf29=\E[20;5~, kf3=\E[13~, kf30=\E[21;5~, kf31=\E[11;6~, + kf29=\E[20;5~, kf30=\E[21;5~, kf31=\E[11;6~, kf32=\E[12;6~, kf33=\E[13;6~, kf34=\E[14;6~, kf35=\E[15;6~, kf36=\E[17;6~, kf37=\E[18;6~, - kf38=\E[19;6~, kf39=\E[20;6~, kf4=\E[14~, kf40=\E[21;6~, - kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, - kich1=\E[@, knp=\E[U, kpp=\E[V, lf0@, lf1@, lf2@, lf3@, lf4@, lf5@, - use=minix-3.0, + kf38=\E[19;6~, kf39=\E[20;6~, kf40=\E[21;6~, kich1=\E[@, + knp=\E[U, kpp=\E[V, lf0@, lf1@, lf2@, lf3@, lf4@, lf5@, + use=xterm+r5+fkeys, use=minix-3.0, minix-3.0|minix console (v3.0), use=ecma+color, use=minix-1.7, @@ -21102,12 +21519,12 @@ xon, NQ, cols#80, it#8, lines#25, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[0J, cr=\r, - cub1=^H, cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, - ed=\E[0J, el=\E[K, home=\E[H, ht=^I, ich=\E[%p1%d@, - ich1=\E[@, ind=\n, kf0=\E[Y, kf1=\E[V, kf2=\E[U, kf3=\E[T, - kf4=\E[S, kf5=\E[G, nel=\r\n, rev=\E[7m, ri=\EM, rmso=\E[0m, - rmul=\E[0m, sgr0=\E[0m, smso=\E[7m, smul=\E[4m, - use=ansi+arrows, use=ansi+idl, use=ansi+local, + cub1=^H, dch=\E[%p1%dP, dch1=\E[P, ed=\E[0J, el=\E[K, ht=^I, + ich=\E[%p1%d@, ich1=\E[@, ind=\n, kf0=\E[Y, kf1=\E[V, + kf2=\E[U, kf3=\E[T, kf4=\E[S, kf5=\E[G, nel=\r\n, rev=\E[7m, + ri=\EM, rmso=\E[0m, rmul=\E[0m, sgr0=\E[0m, smso=\E[7m, + smul=\E[4m, use=ansi+arrows, use=ansi+cup, use=ansi+idl, + use=ansi+local, # The linewrap option can be specified by editing /usr/include/minix/config.h # before recompiling the minix 1.5 kernel. @@ -21161,15 +21578,14 @@ cols#82, it#8, lines#25, bel=^G, blink=\E[5m, bold=\E[1m, clear=^]^_, cnorm=\E[?7h, cr=\r, cub1=^H, cud1=\n, cuf1=^X, cup=\E[%i%p1%d;%p2%dH, - cuu1=^Z, cvvis=\E[?7l, dch1=\E[1P, dl1=\E[M, ed=^_, el=^^, - home=^], ht=^I, if=/usr/share/tabset/vt100, il1=\E[L, - ind=\ED, + cuu1=^Z, cvvis=\E[?7l, dch1=\E[1P, ed=^_, el=^^, home=^], + ht=^I, if=/usr/share/tabset/vt100, ind=\ED, is2=\E>\E[?1h\E[?7h\E[?5l\017\E(B\E[m\E[20l\E[1;24r\E[24;1H, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, - kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, - kf7=\EOV, kf8=\EOW, nel=\r\ED, rev=\E[7m, ri=\E[T, - rmir=\E[4l, rmso=\E[m, rmul=\E[m, sgr0=\E[m, smir=\E[4h, - smso=\E[7m, smul=\E[4m, use=ansi+csr, + kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, nel=\r\ED, rev=\E[7m, + ri=\E[T, rmir=\E[4l, sgr0=\E[m, smir=\E[4h, use=ansi+csr, + use=ansi+idl1, use=ansi+sgrso, use=ansi+sgrul, + use=vt100+pf1-pf4, # basis from Peter Harrison, Computer Graphics Lab, San Francisco # ucbvax!ucsfmis!harrison ...uucp / ucbvax!ucsfmis!harrison@BERKELEY ...ARPA @@ -21221,18 +21637,17 @@ cols#80, it#8, lines#24, wsl#72, xmc#0, acsc=aaffggjjkkllmmnnooqqssttuuvvwwxx, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[<1h, cnorm=\E[<1l, cr=\r, - cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, - flash=^G, fsl=\n, home=\E[H, ht=^I, ind=\n, ip=$<7/>, - is1=\E:1}\Ec\E[?4l\E[12h, is2=\Ec\E[12h\E)0, + dch=\E[%p1%dP, dch1=\E[P, flash=^G, fsl=\n, ht=^I, ind=\n, + ip=$<7/>, is1=\E:1}\Ec\E[?4l\E[12h, is2=\Ec\E[12h\E)0, is3=\E[?3l, kclr=\E[2J, kdch1=\E[P, kdl1=\E[M, kf0=\EOp, kf1=\EOq, kf10=\EOp, kf2=\EOr, kf3=\EOs, kf4=\EOt, kf5=\EOu, kf6=\EOv, kf7=\EOw, kf8=\EOx, kf9=\EOy, kich1=\E[4h, kil1=\E[4l, knp=\EOn, kpp=\EOR, ll=\E[24;80H, mc0=\E[i, nel=\r\n, rev=\E[7m, ri=\EM, rmacs=^O, rmir=\E[4l, - rmso=\E[27m, rmul=\E[24m, rs1=\Ec\E[?4l\E[12h, - rs2=\Ec\E)0, sgr0=\E[m, smacs=^N, smir=\E[4h, smso=\E[7m, - smul=\E[4m, tsl=^_@A, use=ansi+arrows, use=ansi+cpr, - use=ansi+csr, use=ansi+erase, use=ansi+idl, + rs1=\Ec\E[?4l\E[12h, rs2=\Ec\E)0, sgr0=\E[m, smacs=^N, + smir=\E[4h, tsl=^_@A, use=ecma+underline, + use=ecma+standout, use=ansi+arrows, use=ansi+cpr, + use=ansi+csr, use=ansi+cup, use=ansi+erase, use=ansi+idl, use=ansi+local, # From: Alexandre Montaron , 18 Jun 1998, updated 19 Sep 2016 @@ -21310,15 +21725,13 @@ kf22=\EOP#, kf23@, kf24@, kf3=\EOs, kf4=\EOt, kf5=\EOu, kf6=\EOv, kf7=\EOw, kf8=\EOx, kf9=\EOy, khlp=\EOm, knp=\EOn, kpp=\EOR, krfr=\EOS, lf1@, lf2@, lf3@, lf4@, lf5@, lf6@, nel=\EE, - op@, rc=\E8, rep@, rev=\E[7m, ri=\EM, rmkx@, rmso=\E[27m, - rmul=\E[24m, + op@, rc=\E8, rep@, rev=\E[7m, ri=\EM, rmkx@, rs2=\036\E[12H\E[2M\E[H\E[L\E[12H\E[2M\E[H\E[L\E[12H\E[2M\E[ H\E[L\E[12H\E[2M\E[H\E[L\E[12H\E[2M\E[H\E[L\E[12H\E[2M \E[H\E[L\E[12H\E[2M\E[H\E[L\E[12H\E[2M\E[H\E[L\E[12H\E[2 M\E[H\E[L\E[12H\E[2M\E[H\E[L\E[12H\E[2M\E[H\E[L\E[12H\E[ 2M\E[H\E[J\E[m, sc=\E7, setab@, setaf@, setb@, setf@, sgr@, sgr0=\E[m, smkx@, - smso=\E[7m, smul=\E[4m, tsl=\037@%?%p1%{63}%<%t%p1%'A'%+%c%e\177%p1%{62}%-%Pa%?%ga %{1}%&%t\011%;%?%ga%{2}%&%t\011\011%;%?%ga%{4}%&%t\011 \011\011\011%;%?%ga%{07}%>%t\011\011\011\011\011\011 @@ -21339,7 +21752,7 @@ \365o\,\366o\,\372u\,\373u\,\374u\,\375y\,\377y\,\267.\, \327x\,\367/\,\261\E7\E[4m+\E8\E[C\,\,0\017%\016\,x|\,y \E7\E[4m<\E8\E[C\,z\E7\E[4m>\E8\E[C\,g\E7\E[4m+\E8\E[C, - use=minitel1b, + use=ecma+underline, use=ecma+standout, use=minitel1b, minitel1-nb|minitel 1 (40cols) noir & blanc sans couleurs avec bold et dim ..., colors@, pairs@, @@ -21455,8 +21868,8 @@ screen.minitel1b-80|screen.minitel2-80|screen.minitel12-80|Screen specific for minitel1b-80 minitel2-80 and minitel12-80, colors@, ncv@, pairs@, bold=\E[1m, kent=\EOM, kf13@, kf14@, kf15@, kf16@, kf17@, kf18@, - kf19@, kf20@, kf21@, kf22@, kf23@, kf24@, khlp=\EOm, op@, - rmul=\E[24m, setab@, setaf@, setb@, setf@, smul=\E[4m, + kf19@, kf20@, kf21@, kf22@, kf23@, kf24@, khlp=\EOm, op@, setab@, + setaf@, setb@, setf@, use=ecma+underline, use=screen.minitel1b, screen.minitel1-nb|Screen specific for minitel1-nb, @@ -21472,7 +21885,7 @@ # From: Alexandre Montaron, 29 Sep 2016 linux-m1|Linux Minitel 1 "like" Couleurs, - am, bw@, ccc, mir, msgr, xenl, + am, ccc, mir, msgr, xenl, it#8, ncv#16, acsc=a\261f\370g\361h\260j\274k\273l\311m\310n\316q\315t \314u\271v\312w\313x\272y\363z\362{\343|\252~\372, @@ -21484,20 +21897,14 @@ %{255}%&%02X, is2=\E]R\E]P3FFFF80\E[?8c, ka1=\EOw, ka3=\EOy, kb2=\E[G, kbs=^?, kc1=\EOq, kc3=\EOs, kcbt=\E^I, kclr=\E\r, - kdl1=\E\E[A, kent=\EOM, kf1=\E[[A, kf10=\E[21~, - kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, - kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, - kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, - kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, - khome=\E[1~, kil1=\E\E[B, kmous=\E[M, nel=\EE, - oc=\E]R\E]P3FFFF80, op=\E[39;49m, rev=\E[7m, ri=\EM, - rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmpch=\E[10m, - rmso=\E[27m, rs1=\Ec, rs3=\E[37;40m\E[8], sgr0=\E[m, - smacs=^N, smam=\E[?7h, smir=\E[4h, smpch=\E[11m, - smso=\E[7m, tbc=\E[3g, vpa=\E[%i%p1%dd, .VN=\E[?5l, - .VR=\E[?5h, .am@, .ich=\E[%p1%d@, .ich1=\E[@, .ll=\E[99H, - .rmcup=, .rmul=\E[24m, .smcup=\E]R\E]P3FFFF80\E[?8c, - .smul=\E[4m, + kdl1=\E\E[A, kent=\EOM, khome=\E[1~, kil1=\E\E[B, + kmous=\E[M, nel=\EE, oc=\E]R\E]P3FFFF80, op=\E[39;49m, + rev=\E[7m, ri=\EM, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, + rmpch=\E[10m, rs1=\Ec, rs3=\E[37;40m\E[8], sgr0=\E[m, + smacs=^N, smam=\E[?7h, smir=\E[4h, smpch=\E[11m, tbc=\E[3g, + .VN=\E[?5l, .VR=\E[?5h, .am@, .ich=\E[%p1%d@, .ich1=\E[@, + .ll=\E[99H, .rmcup=, .smcup=\E]R\E]P3FFFF80\E[?8c, + .smul=\E[4m, .use=ecma+underline, E3=\E[99H\E[2J\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n @@ -21506,10 +21913,12 @@ \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n, - use=ansi+arrows, use=ansi+csr, use=ansi+cup, - use=ansi+erase, use=ansi+idl, use=ansi+local1, - use=klone+color, use=vt220+pcedit, use=vt220+cvis, - use=linux+decid, + use=ecma+standout, use=ansi+arrows, use=ansi+csr, + use=ansi+cup, use=ansi+erase, use=ansi+idl, + use=ansi+local1, use=ansi+rca2, use=ansi+sgrso, + use=klone+color, use=linux+decid, use=linux+lockeys, + use=vt220+pcedit, use=vt220+cvis, use=vt220+sfkeys, + use=vt220+ufkeys, # 1. Using double-shapes for VT100 graphical chars (eg: mc). # 2. Native brown color corrected to good yellow color. @@ -21566,9 +21975,7 @@ screen.linux-m1|Linux m1 specific for screen, ncv@, - kclr=\E\r, kdl1=\E\E[A, kf13=\E[25~, kf14=\E[26~, - kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, - kf19=\E[33~, kf20=\E[34~, kil1=\E\E[B, rmul@, smul@, + kclr=\E\r, kdl1=\E\E[A, kil1=\E\E[B, rmul@, smul@, u8=\E[?1;2c, E3=\E[99H\E[2J\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n @@ -21579,6 +21986,7 @@ \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n, use=decid+cpr, use=xterm+x11mouse, use=screen, + use=vt220+sfkeys, screen.linux-m1b|Linux m1b specific for screen, colors@, pairs@, @@ -21592,33 +22000,33 @@ # Putty : putty-m1|Putty Minitel 1 "like" Couleurs, - dim@, kf1=\E[11~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, - kf5=\E[15~, rmul=\E[24m, smul=\E[4m, .E3=\E[300S, - use=xterm+alt47, use=putty+screen, use=xterm+sl-twm, - use=ecma+index, use=linux-m1, + dim@, .E3=\E[300S, use=ecma+underline, + use=xterm+r5+lockeys, use=xterm+alt47, + use=putty+screen, use=xterm+sl-twm, use=ecma+index, + use=linux-m1, putty-m1b|Putty Minitel 1B "like" Monochrome (Gris/Blanc/Noir), - dim@, kf1=\E[11~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, - kf5=\E[15~, rmul=\E[24m, smul=\E[4m, .E3=\E[300S, - use=xterm+alt47, use=putty+screen, use=xterm+sl-twm, - use=ecma+index, use=linux-m1b, + dim@, .E3=\E[300S, use=ecma+underline, + use=xterm+r5+lockeys, use=xterm+alt47, + use=putty+screen, use=xterm+sl-twm, use=ecma+index, + use=linux-m1b, putty-m2|Putty Minitel 2 "like" Couleurs (Vert/Blanc/Noir), acsc=``aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{ {||}}~~, - dim@, kf1=\E[11~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, - kf5=\E[15~, rmul=\E[24m, smul=\E[4m, .E3=\E[300S, - use=xterm+alt47, use=putty+screen, use=xterm+sl-twm, - use=ecma+index, use=linux-m2, + dim@, .E3=\E[300S, use=ecma+underline, + use=xterm+r5+lockeys, use=xterm+alt47, + use=putty+screen, use=xterm+sl-twm, use=ecma+index, + use=linux-m2, putty+screen|PuTTY with screen resizing extensions (building-block), .WS=\E[8;%p1%d;%p2%dt, Z0=\E[?3h, Z1=\E[?3l, putty-screen|PuTTY with screen resizing extensions, - WS=\E[8;%p1%d;%p2%dt, Z0=\E[?3h, Z1=\E[?3l, use=putty, + WS=\E[8;%p1%d;%p2%dt, use=putty+screen, use=putty, screen.putty-m1|Putty m1 specific for screen, - dim@, rmul=\E[24m, smul=\E[4m, E3@, use=screen.linux-m1, + dim@, E3@, use=ecma+underline, use=screen.linux-m1, screen.putty-m1b|Putty m1b specific for screen, colors@, pairs@, @@ -21780,10 +22188,10 @@ bel=^G, clear=\E[H\E[J$<150>, cr=\r, cub1=^H, cup=%i\E[%p1%d;%p2%dH, dl1=\E[M$<2*>, ed=\E[J$<150>, el=\E[K$<2>, ht=^I, il1=\E[L$<2*>, ind=\n$<280>, - kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, - kf2=\EOQ, kf3=\EOR, kf4=\EOS, lf1=PF1, lf2=PF2, lf3=PF3, - lf4=PF4, rmkx=\E>, rmso=\E[m, sgr0=\E[m, smkx=\E=, - smso=\E[7m, use=ansi+csr, use=ansi+local1, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, lf1=PF1, + lf2=PF2, lf3=PF3, lf4=PF4, rmkx=\E>, sgr0=\E[m, smkx=\E=, + use=ansi+csr, use=ansi+local1, use=ansi+sgrso, + use=vt100+pf1-pf4, bg1.25rv|BBN BitGraph 1.25 (reverse video), flash=\E[?5l$<200/>\E[?5h, is2=\E>\E[?5h\E[?7h, @@ -21798,8 +22206,8 @@ cup=%i\E[%p1%d;%p2%dH, dl1=\E[M$<2*>, ed=\E[J$<150>, el=\E[K$<2>, ht=^I, il1=\E[L$<2*>, ind=\n$<280>, kf1=\EP, kf2=\EQ, kf3=\ER, kf4=\ES, lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, - ll=\E[64;1H, rmam=\E[?7l, rmkx=\E>, rmso=\E[m, sgr0=\E[m, - smam=\E[?7h, smkx=\E=, smso=\E[7m, use=ansi+local1, + ll=\E[64;1H, rmam=\E[?7l, rmkx=\E>, sgr0=\E[m, smam=\E[?7h, + smkx=\E=, use=ansi+local1, use=ansi+sgrso, use=vt52+arrows, #### Bull (bq, dku, vip) @@ -21870,14 +22278,14 @@ # This entry covers the following terminals: # dku7102, tws2102, and tws models 2105 to 2112 tws-generic|dku7102|Bull Questar tws terminals, - am, eslok, hs, mir, msgr, xenl, xhp@, xon, + am, mir, msgr, xenl, xhp@, xon, cols#80, lines#24, wsl#80, acsc=``aaffggj)k\,l&m#n/ooppq*rrsst'u-v+w.x%yyzz{{||}}~~, bel=^G, blink=\E[0;5m, civis=\E[1r, clear=\E[2J, cnorm=\E[r, cr=\r, cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%df, dch=\E[%p1%dP, dch1=\E[P, dim=\E[0;2m, - dsl=\EPY99:98\E\\\E[0;98v\E[2J\E[v, fsl=\E[v, - home=\E[H, ht=\E[I, ind=\n, invis=\E[0;8m, + dsl=\EPY99:98\E\\\E[0;98v\E[2J\E[v, fsl=\E[v, ht=\E[I, + ind=\n, invis=\E[0;8m, is1=\E[?=h\Ec\E`\E[?>h\EPY99:98\E\\, is2=\E[5;>;12;18;?h\EPY99:98\E\\, smir=\E[4h, smso=\E[0;7m, smul=\E[0;4m, tsl=\EPY99:98\E\\\E[0;98v\E[2;7m, use=ansi+arrows, - use=ansi+erase, use=ansi+idl, use=ansi+inittabs, - use=ansi+local, use=ansi+sgrdim, + use=ansi+cup, use=ansi+erase, use=ansi+idl, + use=ansi+inittabs, use=ansi+local, use=ansi+sgrdim, + use=dec+sl, tws2102-sna|dku7102-sna|Bull Questar tws2102 for SNA, dsl=\E[0;98v\E[2J\E[v, fsl=\E[v, is3=\Eb, tsl=\E[0;98v, @@ -22000,23 +22409,21 @@ is2=\E[?2h\E[?3l\E[?5l\E[?7h\E[?8h\E>\E[?1l\E\sF\E[?42l\E[?4 l, is3=\E[0$}\E[?25h\E[2l\E[H\E[J, ka1=\EOw, ka3=\EOy, - kb2=\EOu, kc1=\EOq, kc3=\EOs, kf1=\EOP, kf10=\E[21~, - kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, - kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, - kf19=\E[33~, kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, - kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, - khlp=\E[28~, krdo=\E[29~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, - nel=\EE, rev=\E[7m, ri=\EM, rmacs=\E(B, rmam=\E[?7l, - rmcup=\E[?7h, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, - rmul=\E[24m, rs1=\E[!p, rs2=\E[?3l, s0ds=\E(B, s1ds=\E(0, + kb2=\EOu, kc1=\EOq, kc3=\EOs, khlp=\E[28~, krdo=\E[29~, + lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, nel=\EE, rev=\E[7m, ri=\EM, + rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?7h, rmir=\E[4l, + rmkx=\E[?1l\E>, rs1=\E[!p, rs2=\E[?3l, s0ds=\E(B, + s1ds=\E(0, sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1 %;m%?%p9%t\E(0%e\E(B%;, sgr0=\E[0m\E(B, smacs=\E(0, smam=\E[?7h, - smcup=\E[?7l\E[?1l\E(B, smir=\E[4h, smso=\E[7m, - smul=\E[4m, tsl=\E[1$}\E[2$~, use=ansi+enq, use=ansi+csr, + smcup=\E[?7l\E[?1l\E(B, smir=\E[4h, smul=\E[4m, + tsl=\E[1$}\E[2$~, use=ecma+underline, + use=ecma+standout, use=ansi+enq, use=ansi+csr, use=ansi+erase, use=ansi+idl, use=ansi+local, - use=ansi+pp, use=dec+sl, use=vt100+4bsd, use=vt220+cvis, - use=vt220+vtedit, + use=ansi+pp, use=dec+sl, use=vt100+4bsd, + use=vt100+pf1-pf4, use=vt220+cvis, use=vt220+vtedit, + use=vt220+sfkeys, use=vt220+ufkeys, bq300-rv|Bull VT320 reverse 80 columns, flash=\E[?5l$<50>\E[?5h, @@ -22469,11 +22876,10 @@ bel=^G, clear=\E[H\E[2J, cr=\r, cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, ed=\E[J, el=\E[K, ht=^I, ind=\n, is2=\E>\E[?3l\E[?4l\E[?5l\E[?20l\E[?7h\E[?8h, - kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, - kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, ri=\EM, - rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, - sgr0=\E[m, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7;31m, - smul=\E[4m, use=ansi+local, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, khome=\E[H, + ri=\EM, rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m, sgr0=\E[m, + smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7;31m, + use=ansi+local, use=ansi+sgrul, use=vt100+pf1-pf4, # DEC PRO-350 console (VT220-style). The 350 was DEC's attempt to produce # a PC differentiated from the IBM clones. It was a total, ludicrous, @@ -22534,8 +22940,7 @@ hc, cols#80, lines#66, bel=^G, cr=\r, cud1=\n, hd=\EK, ht=^I, hu=\EL, ind=\n, nel=\r\n, - rmso=\E[22m, rmul=\E[24m, sgr0=\E[m, smso=\E[1m, - smul=\E[4m, + rmso=\E[22m, sgr0=\E[m, smso=\E[1m, use=ecma+underline, ln03-w|DEC ln03 laser printer 132 cols, cols#132, kbs=^H, kcub1=^H, kcud1=\n, use=ln03, @@ -22567,13 +22972,13 @@ cup=\E[%i%p1%d;%p2%dH$<5/>, cuu1=\E[A$<2/>, ed=\E[J$<50/>, el=\E[K$<3/>, home=\E[H, ht=^I, ind=\ED$<5/>, is2=\E[1;24r\E[24;1H, kbs=^H, kcub1=\E[D, - kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, - kf3=\EOR, kf4=\EOS, rev=\E[7m$<2/>, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, rev=\E[7m$<2/>, rf=/usr/share/tabset/vt100, ri=\EM$<5/>, rmam=\E[7l, - rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m$<2/>, + rmkx=\E[?1l\E>, rmul=\E[m$<2/>, rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, - sgr0=\E[m$<2/>, smam=\E[7l, smkx=\E[?1h\E=, smso=\E[7m, - smul=\E[4m$<2/>, use=ansi+csr, + sgr0=\E[m$<2/>, smam=\E[7l, smkx=\E[?1h\E=, + smul=\E[4m$<2/>, use=ansi+csr, use=ansi+sgrso, + use=vt100+pf1-pf4, #### Evans & Sutherland # @@ -22644,15 +23049,16 @@ OTbs, am, mir, msgr, cols#80, it#8, lines#24, acsc=, bel=^G, clear=\E[2J, cnorm=\E[>4l, cr=\r, cub1=^H, - cud1=\E[1B, cuf1=\E[1C, cup=\E[%i%p1%d;%p2%dH, - cuu1=\E[1A, cvvis=\E[>4h, dch1=\E[1P, dl1=\E[1M$<1*>, - ed=\E[J, el=\E[K, home=\E[H, ht=^I, il1=\E[1L$<1*>, ind=\n, + cud1=\E[1B, cuf1=\E[1C, cuu1=\E[1A, cvvis=\E[>4h, + dch1=\E[1P, dl1=\E[1M$<1*>, ed=\E[J, el=\E[K, ht=^I, + il1=\E[1L$<1*>, ind=\n, is2=\E<\E[>1;2;3;4;5;6;7;8;9l\E[m\E[11m\E[?7h, kbs=^H, kcub1=\E[1D, kcud1=\E[1B, kcuf1=\E[1C, kcuu1=\E[1A, kf1=\EOS, kf2=\EOT, kf3=\EOU, kf4=\EOV, kf5=\EOW, kf6=\EOP, kf7=\EOQ, kf8=\EOR, khome=\E[H, lf6=blue, lf7=red, lf8=white, - ri=\EM, rmacs=\E[11m, rmam=\E[?7l, rmir=\E[4l, rmso=\E[m, - smacs=\E[10m, smam=\E[?7h, smir=\E[4h, smso=\E[7m, + ri=\EM, rmacs=\E[11m, rmam=\E[?7l, rmir=\E[4l, + smacs=\E[10m, smam=\E[?7h, smir=\E[4h, use=ansi+cup, + use=ansi+sgrso, h19-bs|Heathkit w/keypad shifted, rmkx=\Eu, smkx=\Et, use=h19-b, h19-us|h19us|h19-smul|Heathkit w/keypad shifted/underscore cursor, @@ -22758,18 +23164,19 @@ OTkn#10, cols#80, it#8, lines#24, OTbc=\ED, bel=^G, blink=\E[5m, bold=\E[2m, clear=\E[2J, cr=\r, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[1P, - dim=\E[2m, dsl=\E[>1l, ed=\E[J, el=\E[K, fsl=\E[u\E[>5l, - home=\E[H, ht=^I, hts=\EH, if=/usr/share/tabset/vt100, - ind=\ED, kclr=\E[J, ked=\E[J, kf0=\E[~, kf1=\EOS, kf2=\EOT, - kf3=\EOU, kf4=\EOV, kf5=\EOW, kf6=\EOP, kf7=\EOQ, kf8=\EOR, - kf9=\EOX, khome=\E[H, lf0=help, mc0=\E#7, nel=\r\ED, rc=\E[r, - rev=\E[7m, ri=\EM, rmcup=\E[?7h, rmso=\E[m, rmul=\E[m, + dch=\E[%p1%dP, dch1=\E[1P, dim=\E[2m, dsl=\E[>1l, ed=\E[J, + el=\E[K, fsl=\E[u\E[>5l, ht=^I, hts=\EH, + if=/usr/share/tabset/vt100, ind=\ED, kclr=\E[J, ked=\E[J, + kf0=\E[~, kf1=\EOS, kf2=\EOT, kf3=\EOU, kf4=\EOV, kf5=\EOW, + kf6=\EOP, kf7=\EOQ, kf8=\EOR, kf9=\EOX, khome=\E[H, lf0=help, + mc0=\E#7, nel=\r\ED, rc=\E[r, rev=\E[7m, ri=\EM, + rmcup=\E[?7h, rmso=\E[m, rs1=\E<\E[1;24r\E[24;1H\E[?7h\E[>4h\E[>1;2;3;5;6;7;8;9l\E[m \E[11m, - sc=\E[s, sgr0=\E[m, smcup=\E[?7l, smso=\E[7;2m, smul=\E[4m, - tbc=\E[3g, tsl=\E[s\E[>5;1h\E[25;%i%dH\E[1K, - use=ansi+apparrows, use=ansi+idl, use=ansi+local, + sc=\E[s, sgr0=\E[m, smcup=\E[?7l, smso=\E[7;2m, tbc=\E[3g, + tsl=\E[s\E[>5;1h\E[25;%i%dH\E[1K, use=ansi+apparrows, + use=ansi+cup, use=ansi+idl, use=ansi+local, + use=ansi+sgrul, z29a-kc-uc|h29a-kc-uc|Zenith z29 ANSI mode with keyclick and underscore cursor, rs1=\E<\E[1;24r\E[24;1H\E[?7h\E[>1;2;3;4;5;6;7;8;9l\E[m\E[11 @@ -22790,19 +23197,19 @@ acsc=0a``aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[1Z, civis=\E[>5h, clear=\E[2J\E[H, cnorm=\E[>5l, cr=\r, - csr=\E[%i%p1%d;%p2%dr, cub1=^H, cup=\E[%i%p1%d;%p2%dH, - dch=\E[%p1%dP, dch1=\E[1P, dim=\E[2m, dl=\E[%p1%dM, - dl1=\E[1M, dsl=\E[>1l, ed=\E[0J, el=\E[0K, el1=\E[1K, - fsl=\E[u, home=\E[H, il=\E[%p1%dL, il1=\E[1L, ind=\n, - is2=\E<\E[>1;3;5;6;7l\E[0m\E[2J, ka1=\EOw, ka3=\EOu, - kb2=\EOy, kc1=\EOq, kc3=\EOs, ked=\E[J, kf1=\EOS, kf2=\EOT, - kf3=\EOU, kf4=\EOV, kf5=\EOW, kf6=\EOP, kf7=\EOQ, kf8=\EOR, - kf9=\EOX, khlp=\E[~, ll=\E[24;1H, mc0=\E[?19h\E[i, rc=\E[u, - rev=\E[7m, rmacs=\E(B, rmir=\E[4l, rmkx=\E[>7l, rmso=\E[0m, - rmul=\E[0m, rs2=\E<\Ec\0, sc=\E[s, sgr0=\E[0m, smacs=\E(0, - smir=\E[4h, smkx=\E[>7h, smso=\E[7m, smul=\E[4m, + csr=\E[%i%p1%d;%p2%dr, cub1=^H, dch=\E[%p1%dP, + dch1=\E[1P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[1M, dsl=\E[>1l, + ed=\E[0J, el=\E[0K, el1=\E[1K, fsl=\E[u, il=\E[%p1%dL, + il1=\E[1L, ind=\n, is2=\E<\E[>1;3;5;6;7l\E[0m\E[2J, + ka1=\EOw, ka3=\EOu, kb2=\EOy, kc1=\EOq, kc3=\EOs, ked=\E[J, + kf1=\EOS, kf2=\EOT, kf3=\EOU, kf4=\EOV, kf5=\EOW, kf6=\EOP, + kf7=\EOQ, kf8=\EOR, kf9=\EOX, khlp=\E[~, ll=\E[24;1H, + mc0=\E[?19h\E[i, rc=\E[u, rev=\E[7m, rmacs=\E(B, + rmir=\E[4l, rmkx=\E[>7l, rmso=\E[0m, rmul=\E[0m, + rs2=\E<\Ec\0, sc=\E[s, sgr0=\E[0m, smacs=\E(0, smir=\E[4h, + smkx=\E[>7h, smso=\E[7m, smul=\E[4m, tsl=\E[s\E[>1h\E[25;%i%p1%dH, use=ansi+arrows, - use=ansi+local, use=ansi+pp, use=ansi+tabs, + use=ansi+cup, use=ansi+local, use=ansi+pp, use=ansi+tabs, # From: Brad Brahms z100|h100|z110|z-100|h-100|Heath/Zenith z-100 pc with color monitor, @@ -22921,13 +23328,12 @@ am, mir, cols#80, it#8, lines#24, clear=\E[H\E[2J, cnorm=\Ez56;2;0;0z\Ez73z\Ez4;1;1z, - cr=\r, cub1=^H, cud=\E[%p1%dB, cup=\E[%i%p1%d;%p2%dH, - cvvis=\Ez4;2;1z\Ez56;2;80;24z, dch1=\E[P, ed=\E[J, - el=\E[K, home=\E[H, ht=^I, ind=\ED, kf1=\EOP, kf2=\EOQ, - kf3=\EOR, kf4=\EOS, nel=\r\ED, rc=\E8, ri=\EM, rmdc=\E[4l, + cr=\r, cub1=^H, cvvis=\Ez4;2;1z\Ez56;2;80;24z, dch1=\E[P, + ht=^I, ind=\ED, nel=\r\ED, rc=\E8, ri=\EM, rmdc=\E[4l, rmir=\E[4l, sc=\E7, sgr0=\E[m, smdc=\E[4h, smir=\E[4h, - use=ansi+arrows, use=ansi+idl, use=ansi+local, - use=ansi+sgrso, + use=ansi+arrows, use=ansi+cup, use=ansi+erase, + use=ansi+idl, use=ansi+local, use=ansi+sgrso, + use=vt100+pf1-pf4, graphos-30|graphos III with 30 lines, lines#30, @@ -22992,15 +23398,13 @@ OTbs, OTpt, am, xenl, cols#80, it#8, lines#48, vt#3, OTnl=\n, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[;H\E[2J, - cr=\r, cub1=^H, cud1=\n, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, - cuu1=\E[A, ed=\E[J, el=\E[K, - flash=\E[?5h\E[0q\E[1;2q\E[?5l\E[0q\E[4;3q, - home=\E[H, ht=^I, is2=\E<\E[1;48r\E[0q\E[3;4q\E=\E[?1h, - kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, - kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, rev=\E[7m, ri=\EM, - rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, rs1=\E=\E[0q\E>, - sgr0=\E[m, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, - use=ansi+csr, + cr=\r, cub1=^H, cud1=\n, cuf1=\E[C, cuu1=\E[A, ed=\E[J, + el=\E[K, flash=\E[?5h\E[0q\E[1;2q\E[?5l\E[0q\E[4;3q, + ht=^I, is2=\E<\E[1;48r\E[0q\E[3;4q\E=\E[?1h, kbs=^H, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, rev=\E[7m, + ri=\EM, rmkx=\E[?1l\E>, rs1=\E=\E[0q\E>, sgr0=\E[m, + smkx=\E[?1h\E=, use=ansi+csr, use=ansi+cup, + use=ansi+sgrso, use=ansi+sgrul, use=vt100+pf1-pf4, #### Morrow Designs # @@ -23087,13 +23491,12 @@ hts=\EH, ind=\n, is2=\E)0, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\EOP, kf1=\EOQ, kf2=\EOR, kf3=\EOS, lf0=PF1, lf1=PF2, lf2=PF3, lf3=PF4, ll=\E[24;1H, - nel=\EE, rev=\E[7m, ri=\EM, rmacs=^O, rmkx=\E>, rmso=\E[m, - rmul=\E[m, + nel=\EE, rev=\E[7m, ri=\EM, rmacs=^O, rmkx=\E>, rs1=\E[1w\E[>37m\E[>39m\E[1v\E[20l\E[?3l\E[?6l\E[>5h\E[>6h \E[>7h\E[>8l\E[>9h\E[>10l\E[1;24r\E[m\E[q\E(B\017\E)0\E# 5\E>, - sgr0=\E[m, smacs=^N, smkx=\E=, smso=\E[7m, smul=\E[4m, - tbc=\E[3g, use=ansi+csr, use=ansi+local, + sgr0=\E[m, smacs=^N, smkx=\E=, tbc=\E[3g, use=ansi+csr, + use=ansi+local, use=ansi+sgrso, use=ansi+sgrul, # [TO DO: Check out: short forms of ho/cl and ll; reset (\Ec)]. rt6221-w|Ramtek 6221 160x48, @@ -23129,9 +23532,8 @@ hirez100|Selanar HiREZ-100, OTbs, OTpt, mir, msgr, xon, OTkn#4, cols#80, it#8, lines#48, vt#3, - acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cr=\r, cub=\E[%p1%dD, - cub1=^H, cud1=\n, cup=\E[%i%p1%d;%p2%dH, cuu1=\EM, - dch=\E[%p1%dP, dch1=\E[P, home=\E[H, ht=^I, hts=\EH, + acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cr=\r, cub1=^H, + cud1=\n, cuu1=\EM, dch=\E[%p1%dP, dch1=\E[P, ht=^I, hts=\EH, is2=\E<\E)0, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOP, kf1=\EOQ, kf2=\EOR, kf3=\EOS, lf0=PF1, lf1=PF2, lf2=PF3, lf3=PF4, ll=\E[48H, mc0=\E[i, @@ -23140,8 +23542,8 @@ rs1=\030\E2\E<\E[4i\E[?4i\E[12h\E[2;4;20l\E[?0;7h\E[?1;3;6;1 9l\E[r\E[m\E(B\017\E)0\E>, sc=\E7, sgr0=\E[m, smacs=^N, smkx=\E[?1h\E=, tbc=\E[3g, - use=ansi+erase, use=ansi+idl, use=ansi+local, - use=ansi+sgrso, use=ansi+sgrul, + use=ansi+cup, use=ansi+erase, use=ansi+idl, + use=ansi+local, use=ansi+sgrso, use=ansi+sgrul, hirez100-w|Selanar HiREZ-100 in 132-column mode, cols#132, use=hirez100, @@ -23154,9 +23556,9 @@ am, msgr, cols#80, it#8, lines#26, clear=\E[;H\E[2J$<50/>, cr=\r, cub1=^H, cud1=\n, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[K, home=\E[H, - ht=^I, ind=\n, kbs=^H, kcub1=^H, kcud1=\n, nel=\r\n, rev=^_\s, - rmso=^_!, rmul=^_#, sgr0=^_!, smso=^_\s, smul=^_", + cuu1=\E[A, el=\E[K, ht=^I, ind=\n, kbs=^H, kcub1=^H, kcud1=\n, + nel=\r\n, rev=^_\s, rmso=^_!, rmul=^_#, sgr0=^_!, smso=^_\s, + smul=^_", use=ansi+cup, #### Soroc # @@ -23278,14 +23680,14 @@ # https://ub.fnwi.uva.nl/computermuseum/tab13215g.html # This monochrome graphics terminal of TAB Products, California, is a DEC # VT52/VT100/VT132 compatible alphanumeric terminal (TAB 132/15), -# factory-fitted with additional hardware for Tektronix 4010 emulation. -# Also the terminal understands a selection of Tektronix 4027 commands. +# factory-fitted with additional hardware for Tektronix 4010 emulation. +# Also the terminal understands a selection of Tektronix 4027 commands. tab132|tab|tab132-15|tab 132/15, da, db, OTdN@, lm#96, - cup=\E[%i%p1%d;%p2%dH, dch1=\E[P, dl1=\E[M, il1=\E[L, + cup=\E[%i%p1%d;%p2%dH, dch1=\E[P, is2=\E[?7h\E[?3l\E[?5l, rmir=\E[4l, rmkx@, smir=\E[4h, - smkx@, use=decid+cpr, use=vt100+4bsd, + smkx@, use=ansi+idl1, use=decid+cpr, use=vt100+4bsd, tab132-w|tab132 in wide mode, cols#132, is2=\E[?7h\E[?3h\E[?5l, use=tab132, @@ -23340,7 +23742,7 @@ # "Teleray Arpa Special", officially designated as # "Teleray Arpa network model 10" with "Special feature 720". # This is the new (1981) fast microcode updating the older "arpa" proms -# (which gave meta-key and programmable-fxn keys). 720 is much much faster, +# (which gave meta-key and programmable-fxn keys). 720 is much, much faster, # converts the keypad to programmable function keys, and has other goodies. # Standout mode is still broken (magic cookie, etc) so is suppressed as no # programs handle such lossage properly. @@ -23364,13 +23766,12 @@ am, da, db, mir, xhp, xt, cols#80, lines#24, bel=^G, clear=\E[H\E[2J, cr=\r, cub1=^H, - cup=%i\E[%p1%d;%p2%df, dch1=\E[P, dl1=\E[M, ed=\E[0J, - el=\E[0K, home=\E[H, ht=^I, il1=\E[L, ind=\n, kf1=^Z1, - kf10=^Z0, kf2=^Z2, kf3=^Z3, kf4=^Z4, kf5=^Z5, kf6=^Z6, kf7=^Z7, - kf8=^Z8, kf9=^Z9, ri=\E[T, rmcup=\E[V\E[24;1f\E[?38h, - rmir=\E[4l, rmso=\E[m, rmul=\E[m, sgr0=\E[m, - smcup=\E[U\E[?38l, smir=\E[4h, smso=\E[7m, smul=\E[4m, - use=ansi+local1, + cup=%i\E[%p1%d;%p2%df, dch1=\E[P, ed=\E[0J, el=\E[0K, + home=\E[H, ht=^I, ind=\n, kf1=^Z1, kf10=^Z0, kf2=^Z2, kf3=^Z3, + kf4=^Z4, kf5=^Z5, kf6=^Z6, kf7=^Z7, kf8=^Z8, kf9=^Z9, ri=\E[T, + rmcup=\E[V\E[24;1f\E[?38h, rmir=\E[4l, sgr0=\E[m, + smcup=\E[U\E[?38l, smir=\E[4h, use=ansi+idl1, + use=ansi+local1, use=ansi+sgrso, use=ansi+sgrul, #### Texas Instruments (ti) # @@ -23410,15 +23811,14 @@ da, db, in, cbt=\E[Z, clear=\E[H\E[2J$<6>, dch=\E[%p1%dP$<250>, ech=\E[%p1%dX$<20>, ed=\E[J$<6>, el=\E[0K, - enacs=\E(B\E)0, ff=^L, flash=\E[?5h\E[?5l$<6>, - hpa=\E[%p1%{1}%+%dG, hts=\E[0W, ich=\E[%p1%d@$<250>, - il=\E[%p1%dL$<36>, ip=$<10>, is2=\E[1;24r\E[24;1H, - kcmd=\E[29~, kdch1=\E[P, kent=\n, kf1=\E[17~, kf10=\E[28~, - kf11=\E[29~, kf12=\E[31~, kf2=\E[18~, kf3=\E[19~, - kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, - kf9=\E[26~, khome=\E[H, kich1=\E[@, knp=\E[S, kpp=\E[T, - kprt=^X, prot=\E&, rmacs=\017$<2>, rs2=\E[!p, sgr@, - smacs=\016$<2>, vpa=\E[%p1%{1}%+%dd, use=vt220, + enacs=\E(B\E)0, ff=^L, flash=\E[?5h\E[?5l$<6>, hts=\E[0W, + ich=\E[%p1%d@$<250>, il=\E[%p1%dL$<36>, ip=$<10>, + is2=\E[1;24r\E[24;1H, kcmd=\E[29~, kdch1=\E[P, kent=\n, + kf1=\E[17~, kf10=\E[28~, kf11=\E[29~, kf12=\E[31~, + kf2=\E[18~, kf3=\E[19~, kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, + kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, khome=\E[H, kich1=\E[@, + knp=\E[S, kpp=\E[T, kprt=^X, prot=\E&, rmacs=\017$<2>, + rs2=\E[!p, sgr@, smacs=\016$<2>, use=ansi+rca, use=vt220, # # Texas Instruments 916 VDT 8 bit control mode # @@ -23444,25 +23844,25 @@ cols#80, it#8, lines#24, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[2J\E[H, cr=\r, csr=%i\E[%p1%d;%p2%dr, cup=%i\E[%p1%d;%p2%dH, - cvvis=\E[?31h, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, - hts=\EH, il1=\E[L, ind=\ED, kbs=^H, kcub1=\E[D, kcud1=\E[B, - kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, kf1=\EOP, kf2=\EOQ, - kf3=\EOR, kf4=\EOS, kf5=\E[16~, kf6=\E[17~, kf7=\E[18~, + cvvis=\E[?31h, ed=\E[J, el=\E[K, home=\E[H, ht=^I, hts=\EH, + ind=\ED, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kdch1=\E[P, kf5=\E[16~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kich1=\E[@, rc=\E8, rev=\E[7m, - ri=\EM, rmso=\E[m, rmul=\E[m, sc=\E7, sgr0=\E[m, smso=\E[7m, - smul=\E[4m, tbc=\E[3g, use=ansi+local1, use=vt220+cvis, + ri=\EM, sc=\E7, sgr0=\E[m, tbc=\E[3g, use=ansi+idl1, + use=ansi+local1, use=ansi+sgrso, use=ansi+sgrul, + use=vt100+pf1-pf4, use=vt220+cvis, ti924-8|Texas Instruments 924 VDT 8859/1 8 bit CTRL, am, xon, cols#80, it#8, lines#24, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[2J\E[H, cr=\r, csr=%i\E[%p1%d;%p2%dr, cup=%i\E[%p1%d;%p2%dH, - cvvis=\E[?31h, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, - hts=\EH, il1=\E[L, ind=\ED, kbs=^H, kcub1=\E[D, kcud1=\E[B, - kcuf1=\E[C, kcuu1=\E[A, kdch1=\233P, kf1=\217P, kf2=\217Q, - kf3=\217R, kf4=\217S, kf5=\23316~, kf6=\23317~, - kf7=\23318~, kf8=\23319~, kf9=\23320~, kich1=\233@, rc=\E8, - rev=\E[7m, ri=\EM, rmso=\E[m, rmul=\E[m, sc=\E7, sgr0=\E[m, - smso=\E[7m, smul=\E[4m, tbc=\E[3g, use=ansi+local1, + cvvis=\E[?31h, ed=\E[J, el=\E[K, home=\E[H, ht=^I, hts=\EH, + ind=\ED, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kdch1=\233P, kf1=\217P, kf2=\217Q, kf3=\217R, + kf4=\217S, kf5=\23316~, kf6=\23317~, kf7=\23318~, + kf8=\23319~, kf9=\23320~, kich1=\233@, rc=\E8, rev=\E[7m, + ri=\EM, sc=\E7, sgr0=\E[m, tbc=\E[3g, use=ansi+idl1, + use=ansi+local1, use=ansi+sgrso, use=ansi+sgrul, use=vt220+cvis, ti924w|Texas Instruments 924 VDT 7 bit - 132 column mode, cols#132, use=ti924, @@ -23489,14 +23889,14 @@ am, bce, eo, xenl, xon, colors#8, cols#80, it#8, lines#25, pairs#64, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[2J\E[H, - cr=\r, csr=\E[%i%p1%d;%p2%dr, cub1=^H, - cup=\E[%i%p1%d;%p2%dH, dch1=\E[P, dl1=\E[M, ed=\E[J, - el=\E[K, home=\E[H, ht=^I, ich1=\E[@, il1=\E[L, ind=\E[S, - kend=\E[F, kf0=\E[V, kf1=\E[M, kf2=\E[N, kf3=\E[O, kf4=\E[P, - kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, knp=\E[G, - kpp=\E[I, op=\E[37;40m, ri=\E[T, rmso=\E[m, rmul=\E[m, - setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[m, - smso=\E[7m, smul=\E[4m, use=ansi+arrows, use=ansi+local1, + cr=\r, csr=\E[%i%p1%d;%p2%dr, cub1=^H, dch1=\E[P, ed=\E[J, + el=\E[K, ht=^I, ich1=\E[@, ind=\E[S, kend=\E[F, kf0=\E[V, + kf1=\E[M, kf2=\E[N, kf3=\E[O, kf4=\E[P, kf5=\E[Q, kf6=\E[R, + kf7=\E[S, kf8=\E[T, kf9=\E[U, knp=\E[G, kpp=\E[I, + op=\E[37;40m, ri=\E[T, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, sgr0=\E[m, use=ansi+arrows, + use=ansi+cup, use=ansi+idl1, use=ansi+local1, + use=ansi+sgrso, use=ansi+sgrul, # # 928 VDT 7 bit control mode # @@ -23599,20 +23999,19 @@ cols#80, lines#25, acsc=``a1fxgqh0jYk?lZm@nEooppqDrrsstCu4vAwBx3yyzz{{||}}~~, bel=^G, civis=\E[=C, clear=\E[2J\E[H, cnorm=\E[=1C, cr=\r, - cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, - dim=\E[2m, dl=\E[%p1%dM, dl1=\E[1M, ech=\E[%p1%dX, ed=\E[J, - el=\E[K, home=\E[H, hpa=\E[%i%p1%dG, ich=\E[%p1%d@, + dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, + dl1=\E[1M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, ich=\E[%p1%d@, ich1=\E[1@, il=\E[%p1%dL, il1=\E[1L, ind=\E[S, invis=\E[9m, - is2=\E[0;10;39m, kcbt=^], kdch1=\E[P, kend=\E[Y, kf1=\EOP, - kf10=\EOY, kf11=\EOZ, kf12=\EOA, kf2=\EOQ, kf3=\EOR, - kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, kf9=\EOX, - kich1=\E[@, knp=\E[U, kpp=\E[V, krmir=\E0, nel=\r\E[S, - rc=\E8, ri=\E[T, rmacs=\E[10m, sc=\E7, + is2=\E[0;10;39m, kcbt=^], kdch1=\E[P, kend=\E[Y, kf10=\EOY, + kf11=\EOZ, kf12=\EOA, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, + kf9=\EOX, kich1=\E[@, knp=\E[U, kpp=\E[V, krmir=\E0, + nel=\r\E[S, rc=\E8, ri=\E[T, rmacs=\E[10m, sc=\E7, sgr=\E[10m\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p5%t; 2%;%?%p6%t;1%;%?%p9%t;12%e;10%;%?%p7%t;9%;m, - sgr0=\E[0;10m, smacs=\E[12m, vpa=\E[%i%p1%dd, - use=ansi+arrows, use=ansi+inittabs, use=ansi+local, - use=ansi+sgrbold, use=ecma+index, use=klone+color, + sgr0=\E[0;10m, smacs=\E[12m, use=ansi+arrows, + use=ansi+cup, use=ansi+inittabs, use=ansi+local, + use=ansi+rca2, use=ansi+sgrbold, use=ecma+index, + use=klone+color, use=vt100+pf1-pf4, # (pc6300plus: removed ":KM=/usr/lib/ua/kmap.s5:"; renamed BO/EE/CI/CV -- esr) pc6300plus|AT&T 6300 plus, @@ -23625,9 +24024,9 @@ ich1=\E[1@, il1=\E[1L, ind=\n, invis=\E[9m, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOc, kf10=\EOu, kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, kf6=\EOh, - kf7=\EOi, kf8=\EOj, kf9=\EOk, nel=\r\n, rev=\E[7m, rmso=\E[m, - rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, tbc=\E[3g, - use=ansi+local1, + kf7=\EOi, kf8=\EOj, kf9=\EOk, nel=\r\n, rev=\E[7m, sgr0=\E[m, + tbc=\E[3g, use=ansi+local1, use=ansi+sgrso, + use=ansi+sgrul, # From: Benjamin C. W. Sittler # @@ -23674,7 +24073,7 @@ # programs expecting VT100 graphics will usually be disappointed. For this # reason I have disabled the smacs/rmacs sequences, but they could easily be # re-enabled. Here are the relevant control sequences (from the ESCAPE(7) -# manpage), should you wish to do so: +# man page), should you wish to do so: # # SGR10 - Select font 0 - ESC [ 10 m or SO # SGR11 - Select font 1 - ESC [ 11 m or SI @@ -23750,25 +24149,24 @@ am, xon, cols#80, it#8, lines#24, bel=^G, blink=\E[9m, bold=\E[1m, cbt=\E^I, civis=\E[=1C, - clear=\E[2J\E[H, cnorm=\E[=0C, cr=\r, cub1=^H, - cup=\E[%i%p1%d;%p2%dH, dch1=\E[P, dim=\E[2m, ed=\E[0J, - el=\E[0K, home=\E[H, ich1=\E[@, ind=\n, invis=\E[9m, - is1=\017\E[=1w, kBEG=\ENB, kCAN=\EOW, kCPY=\END, kCRT=\EON, - kDC=\ENF, kDL=\ENE, kEND=\ENN, kEOL=\EOA, kFND=\EOX, - kHLP=\EOM, kHOM=\ENM, kIC=\ENJ, kLFT=\ENK, kMOV=\ENC, - kNXT=\ENH, kOPT=\EOR, kPRV=\ENG, kRDO=\EOT, kRIT=\ENL, - kRPL=\EOY, kSAV=\EOO, kUND=\EOS, kbeg=\ENb, kcan=\EOw, - kcbt=\E[Z, kclo=\EOV, kclr=\E[J, kcmd=\EOu, kcpy=\ENd, - kcrt=\EOn, kdch1=\ENf, ked=\E[J, kel=\EOa, kend=\E0, - kext=\EOk, kf1=\EOc, kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, - kf6=\EOh, kf7=\EOi, kf8=\EOj, kfnd=\EOx, khlp=\EOm, - kich1=\ENj, kind=\E[B, kmov=\ENc, kmrk=\ENi, knp=\E[U, - knxt=\ENh, kopn=\EOv, kopt=\EOr, kpp=\E[V, kprt=\EOz, - kprv=\ENg, krdo=\EOt, kref=\EOb, krfr=\ENa, kri=\E[A, - krpl=\EOy, krst=\EOB, ksav=\EOo, kslt=\ENI, kund=\EOs, - nel=\EE, rev=\E[7m, ri=\EM, rmso=\E[m, rmul=\E[m, - sgr0=\E[0;10m, smso=\E[7m, smul=\E[4m, use=ansi+arrows, - use=ansi+idl, use=ansi+local, + clear=\E[2J\E[H, cnorm=\E[=0C, cr=\r, cub1=^H, dch1=\E[P, + dim=\E[2m, ed=\E[0J, el=\E[0K, ich1=\E[@, ind=\n, + invis=\E[9m, is1=\017\E[=1w, kBEG=\ENB, kCAN=\EOW, + kCPY=\END, kCRT=\EON, kDC=\ENF, kDL=\ENE, kEND=\ENN, + kEOL=\EOA, kFND=\EOX, kHLP=\EOM, kHOM=\ENM, kIC=\ENJ, + kLFT=\ENK, kMOV=\ENC, kNXT=\ENH, kOPT=\EOR, kPRV=\ENG, + kRDO=\EOT, kRIT=\ENL, kRPL=\EOY, kSAV=\EOO, kUND=\EOS, + kbeg=\ENb, kcan=\EOw, kcbt=\E[Z, kclo=\EOV, kclr=\E[J, + kcmd=\EOu, kcpy=\ENd, kcrt=\EOn, kdch1=\ENf, ked=\E[J, + kel=\EOa, kend=\E0, kext=\EOk, kf1=\EOc, kf2=\EOd, kf3=\EOe, + kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, kfnd=\EOx, + khlp=\EOm, kich1=\ENj, kind=\E[B, kmov=\ENc, kmrk=\ENi, + knp=\E[U, knxt=\ENh, kopn=\EOv, kopt=\EOr, kpp=\E[V, + kprt=\EOz, kprv=\ENg, krdo=\EOt, kref=\EOb, krfr=\ENa, + kri=\E[A, krpl=\EOy, krst=\EOB, ksav=\EOo, kslt=\ENI, + kund=\EOs, nel=\EE, rev=\E[7m, ri=\EM, sgr0=\E[0;10m, + use=ansi+arrows, use=ansi+cup, use=ansi+idl, + use=ansi+local, use=ansi+sgrso, use=ansi+sgrul, #### Convergent Technology # @@ -23865,10 +24263,10 @@ OTbs, km, mir, cols#80, it#8, lines#24, clear=\E[2J, cub1=^H, cup=\E[%i%p1%d;%p2%dH, dch1=\E[P, - dl1=\E[M, ed=\E[J, el=\E[K, ht=^I, il1=\E[L, - is2=\EGc\EGb\EGw, kbs=^H, kcub1=\EOD, kcud1=\EOB, - kcuf1=\EOC, kcuu1=\EOA, rmir=\E[4l, rmso=\E[m, rmul=\EGau, - smir=\E[4h, smso=\E[7m, smul=\EGu, use=ansi+local1, + ed=\E[J, el=\E[K, ht=^I, is2=\EGc\EGb\EGw, kbs=^H, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, rmir=\E[4l, + rmul=\EGau, smir=\E[4h, smul=\EGu, use=ansi+idl1, + use=ansi+local1, use=ansi+sgrso, masscomp1|masscomp large screen version 1, cols#104, lines#36, use=masscomp, masscomp2|masscomp large screen version 2, @@ -23883,7 +24281,7 @@ cols#128, lines#57, bel=^G, clear=^L, cr=\r, cub1=^H, cud1=\n, cuu1=^K, ht=^I, ind=\n, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, - kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + use=vt100+pf1-pf4, #### Other consoles # The following is a version of the ibm-pc entry distributed with PC/IX, @@ -23897,8 +24295,8 @@ am, bw, eo, cols#80, lines#24, clear=\Ec, cub1=^H, cup=\E[%i%p1%2d;%p2%2dH, ed=\E[J, - el=\E[K, home=\E[H, rmso=\E[m, rmul=\E[m, sgr0=\E[m, - smso=\E[7m, smul=\E[4m, use=ansi+local1, + el=\E[K, home=\E[H, sgr0=\E[m, use=ansi+local1, + use=ansi+sgrso, use=ansi+sgrul, # (ibmpcx: this entry used to be known as ibmx. # It formerly included the following extension capabilities: @@ -23914,11 +24312,11 @@ ibmpcx|xenix|ibmx|IBM PC xenix console display, OTbs, am, msgr, cols#80, lines#25, - clear=^L, cub1=^H, cup=\E[%p1%d;%p2%dH, dch1=\E[P, - dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ich1=\E[@, il1=\E[L, - kend=\E[d, kf1=\E[K, kf2=\E[L, kf3=\E[M, kf4=\E[N, - khome=\E[Y, knp=\E[e, kpp=\E[Z, use=ansi+arrows, - use=ansi+local1, use=klone+acs, use=klone+sgr8, + clear=^L, cub1=^H, cup=\E[%p1%d;%p2%dH, dch1=\E[P, ed=\E[J, + el=\E[K, home=\E[H, ich1=\E[@, kend=\E[d, kf1=\E[K, kf2=\E[L, + kf3=\E[M, kf4=\E[N, khome=\E[Y, knp=\E[e, kpp=\E[Z, + use=ansi+arrows, use=ansi+idl1, use=ansi+local1, + use=klone+acs, use=klone+sgr8, ######## OTHER OBSOLETE TYPES # @@ -23995,16 +24393,15 @@ acsc=++\,\,--..``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyz z{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, cr=\r, cub1=^H, cud1=\n, - cup=\E[%i%p1%d;%p2%dH, dch=\E[%p1%dP, dch1=\E[P, - home=\E[H, ht=^I, ich=\E[%p1%d@, ich1=\E[@, ind=\n, is2=\E[m, - kcbt=^R^I, kf1=\E[0s, kf2=\E[24s, kf3=\E[1s, kf4=\E[23s, - kf5=\E[2s, kf6=\E[22s, kf7=\E[3s, kf8=\E[21s, mc4=\E[4i, - mc5=\E[5i, op=\E[?;m, rev=\E[7m, ri=\E[L, rmacs=\E[10m, - rs1=\Ec, setb=\E[?;%p1%dm, + dch=\E[%p1%dP, dch1=\E[P, ht=^I, ich=\E[%p1%d@, ich1=\E[@, + ind=\n, is2=\E[m, kcbt=^R^I, kf1=\E[0s, kf2=\E[24s, + kf3=\E[1s, kf4=\E[23s, kf5=\E[2s, kf6=\E[22s, kf7=\E[3s, + kf8=\E[21s, mc4=\E[4i, mc5=\E[5i, op=\E[?;m, rev=\E[7m, + ri=\E[L, rmacs=\E[10m, rs1=\Ec, setb=\E[?;%p1%dm, setf=\E[?%?%p1%{0}%=%t0%e%p1%{1}%=%t2%e%p1%{1}%-%d%;m, sgr0=\E[m\E[10m, smacs=\E[11m, smso=\E[1m, smul=\E[4m, - use=ansi+arrows, use=ansi+erase, use=ansi+idl, - use=ansi+local, + use=ansi+arrows, use=ansi+cup, use=ansi+erase, + use=ansi+idl, use=ansi+local, # From: 29 Oct 85 05:40:18 GMT # MS-Kermit with Heath-19 emulation mode enabled @@ -24028,11 +24425,11 @@ ed=\E[J$<50/>, el=\E[K$<3/>, home=\E[H, ht=^I, ich1=\E[1@$<7/>, il1=\E[1L$<9/>, is2=\E[1;24r\E[24;1H, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, - kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=\r\n, - rev=\E[7m$<2/>, rf=/usr/share/tabset/vt100, + nel=\r\n, rev=\E[7m$<2/>, rf=/usr/share/tabset/vt100, ri=\EM$<5/>, rmkx=\E>\E[?1l, rmso=\E[m$<2/>, rmul=\E[m$<2/>, rs1=\E>, sgr0=\E[m$<2/>, smkx=\E=\E[?1h, smso=\E[7m$<2/>, smul=\E[4m$<2/>, use=ansi+csr, + use=vt100+pf1-pf4, # From: Rick Thomas # (xtalk: I added / based on the init string. @@ -24202,10 +24599,10 @@ bel=^G, clear=\E[1;1H\E[2J, cnorm=\E[>12h, cr=\r, cub1=^H, cud1=\n, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, cvvis=\E[>12l, ed=\E[J, el=\E[K, ht=^I, ind=\ED, kcub1=\E[D, - kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, - kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, - ri=\EM, rmacs=\E[m, rmso=\E[m, rmul=\E[m, sgr0=\E[m, - smacs=\E[1m, smso=\E[7m, smul=\E[4m, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf5=\EOT, kf6=\EOU, + kf7=\EOV, kf8=\EOW, ri=\EM, rmacs=\E[m, sgr0=\E[m, + smacs=\E[1m, use=ansi+sgrso, use=ansi+sgrul, + use=vt100+pf1-pf4, digilog|digilog 333, OTbs, cols#80, lines#16, @@ -24325,14 +24722,14 @@ v3220|LANPAR Vision II model 3220/3221/3222, OTbs, am, mir, xenl, cols#80, it#8, lines#24, - cub1=^H, cup=\E[%i%p1%d;%p2%dH, dch1=\E[P, dl1=\E[M, ht=^I, - il1=\E[L, is2=\E>\E[?3l\E[?7h\E[?8h\E[p, kcub1=\E[D, - kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\E[1~, kf1=\E[2~, - kf2=\E[3~, kf3=\E[4~, kf4=\E[5~, kf5=\E[6~, kf6=\E[OP, - kf7=\E[OQ, kf8=\E[OR, kf9=\E[OS, khome=\E[H, ri=\EM, - rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, rmso=\E[m, rmul=\E[m, - sgr0=\E[m, smam=\E[?7h, smir=\E[4h, smkx=\E=, smso=\E[7m, - smul=\E[4m, use=ansi+erase, use=ansi+local1, + cub1=^H, cup=\E[%i%p1%d;%p2%dH, dch1=\E[P, ht=^I, + is2=\E>\E[?3l\E[?7h\E[?8h\E[p, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kf0=\E[1~, kf1=\E[2~, kf2=\E[3~, + kf3=\E[4~, kf4=\E[5~, kf5=\E[6~, kf6=\E[OP, kf7=\E[OQ, + kf8=\E[OR, kf9=\E[OS, khome=\E[H, ri=\EM, rmam=\E[?7l, + rmir=\E[4l, rmkx=\E>, sgr0=\E[m, smam=\E[?7h, smir=\E[4h, + smkx=\E=, use=ansi+erase, use=ansi+idl1, use=ansi+local1, + use=ansi+sgrso, use=ansi+sgrul, ######## ICH/ICH1 VERSUS RMIR/SMIR # # Some non-curses applications get confused if both ich/ich1 and rmir/smir @@ -25121,7 +25518,7 @@ # SGR 39/49 reset the terminal's foreground and background colors to their # "default". # -# XT is harder, since screen's manpage does not give more details. For that, +# XT is harder, since screen's man page does not give more details. For that, # we must read screen's source-code. For example, when XT is set, screen # assumes # @@ -26061,7 +26458,7 @@ # * add mgterm, from NetBSD -TD # * add alias sun-cgsix for sun-ss5 as per NetBSD # * change cons25w to use rs2 for reset rather than rs1 -TD -# * add rc/sc to aixterm based on manpage -TD +# * add rc/sc to aixterm based on man page -TD # # 2000/5/13 # * remove ncv from xterm-16color, xterm-256color @@ -26100,7 +26497,7 @@ # * rename cygwin to cygwinB19, adapt newer entry from Earnie Boyd -TD # # 2000-12-16 -# * improved scoansi, based on SCO man-page, and testing console, +# * improved scoansi, based on SCO man page, and testing console, # scoterm with tack -TD # # 2001-01-27 @@ -27510,4 +27907,95 @@ # + modify xgterm to work around line-drawing bug -TD # + use CSI 3J in vte-2017 (report by Sven Joachim) # +# 2024-05-25 +# + review/update iTerm2 for 3.5.0 -TD +# +# 2024-07-27 +# + modify wezterm, omitting its broken left/right margin feature (report +# by Thayne McCombs) -TD +# +# 2024-08-17 +# + review/update foot for 1.18.1 -TD +# + add a note about DomTerm 3.2.0 -TD +# +# 2024-09-07 +# + update comments -TD +# +# 2024-10-05 +# + use xterm+alt+title in wezterm -TD +# + update comments -TD +# +# 2024-10-26 +# + update ms-terminal -TD +# + add ms-terminal-direct -TD +# +# 2024-11-02 +# + add extended-keys for djgpp 2.05 -TD +# +# 2024-12-28 +# + add ghostty -TD +# +# 2025-01-04 +# + cleanup use-clauses -TD +# + add linux+lockeys, xterm+r5+lockeys, xterm+r5+fkeys -TD +# + add vt220+ufkeys, vt220+sfkeys +# +# 2025-02-03 +# + add note for ghostty 1.1.0 -TD +# +# 2025-02-08 +# + update st (report by Alexander Kashpir) -TD +# +# 2025-02-15 +# + minor fixes to comments (report by Sven Joachim) -TD +# +# 2025-03-01 +# + add color to vt525 (Branden Robinson) +# + add vt520-w and vt525-w (Branden Robinson) +# +# 2025-03-29 +# + add XM/xm to ms-terminal, to enable mouse with experimental Windows +# driver -TD +# +# 2025-04-03 +# + add sclp -TD +# + add op to vt525 -TD +# +# 2025-04-05 +# + update contour -TD +# +# 2025-04-12 +# + add pangoterm -TD +# + add kf1 to kf5 to sclp (report by Werner Fink) +# + add vt100+pf1-pf4 -TD +# +# 2025-04-26 +# + add illumos, sun-16color, sun-256color, sun-direct -TD +# + add wyse+cvis -TD +# +# 2025-05-03 +# + update/correct some of the rv/xr strings, checked with tack -TD +# + use ansi+rca in sclp -TD +# + use vt220+pcedit in sclp (Werner Fink) +# + move some building blocks from illumos to sun-color, based on +# illumos source-history -TD +# + improve use-clauses: ansi+cup, ansi+idl1, ansi+rca, ansi+rca2, +# ansi+sgrso, ansi+sgrul -TD +# + add ecma+standout, ecma+underline -TD +# + add rv code for alacritty -TD +# + add rv/xr codes for contour, foot, ghostty, iterm2, kitty, konsole, +# vscode, vte, wezterm -TD +# +# 2025-05-10 +# + add rv/xr codes for domterm, mintty, mlterm -TD +# + add xr code for putty -TD +# + update teraterm to 5.0 -TD +# + add rlogin-color -TD +# +# 2025-05-17 +# + use bracketed+paste in nsterm, rlogin-color, screen, terminology -TD +# +# 2025-07-19 +# + add xterm+keypad to pccon+base -TD +# ######## SHANTIH! SHANTIH! SHANTIH! diff --git a/contrib/ncurses/mk-1st.awk b/contrib/ncurses/mk-1st.awk --- a/contrib/ncurses/mk-1st.awk +++ b/contrib/ncurses/mk-1st.awk @@ -1,6 +1,6 @@ -# $Id: mk-1st.awk,v 1.125 2023/04/22 15:49:59 tom Exp $ +# $Id: mk-1st.awk,v 1.131 2025/10/04 20:34:43 Branden.Robinson Exp $ ############################################################################## -# Copyright 2018-2021,2023 Thomas E. Dickey # +# Copyright 2018-2024,2025 Thomas E. Dickey # # Copyright 1998-2016,2017 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -32,36 +32,35 @@ # # Generate list of objects for a given model library # Variables: -# name (library name, e.g., "ncurses", "panel", "forms", "menus") +# name (library name, e.g., "ncurses", "panel", "form", "menu") # traces ("all" or "DEBUG", to control whether tracing is compiled in) # MODEL (e.g., "DEBUG", uppercase; toupper is not portable) # CXX_MODEL (e.g., "DEBUG", uppercase) # LIB_SUFFIX (e.g., "", "w", "t", "tw") -# USE_LIB_SUFFIX (e.g., "", "w", "t", "tw") +# ABI_SUFFIX (e.g., "", "w", "t", "tw") # model (directory into which we compile, e.g., "obj") # prefix (e.g., "lib", for Unix-style libraries) # suffix (e.g., "_g.a", for debug libraries) +# o (object suffix) (e.g., ".o") # subset ("none", "base", "base+ext_funcs" or "termlib", etc.) # driver ("yes" or "no", depends on --enable-term-driver) # ShlibVer ("rel", "abi" or "auto", to augment DoLinks variable) -# ShlibVerInfix ("yes" or "no", determines location of version #) +# ShlibVerInfix ("yes" or "no", determines location of version #) # SymLink ("ln -s", etc) # TermlibRoot ("tinfo" or other root for libterm.so) -# TermlibSuffix (".so" or other suffix for libterm.so) +# TermlibSuffix (".so" or other suffix for libterm.so) # ReLink ("yes", or "no", flag to rebuild shared libs on install) # ReRanlib ("yes", or "no", flag to rerun ranlib for installing static) # DoLinks ("yes", "reverse" or "no", flag to add symbolic links) # rmSoLocs ("yes" or "no", flag to add extra clean target) # ldconfig (path for this tool, if used) -# make_phony ("yes" if the make-program accepts ".PHONY" directive. +# make_phony ("yes" if the make-program accepts ".PHONY" directive. # overwrite ("yes" or "no", flag to add link to libcurses.a # depend (optional dependencies for all objects, e.g, ncurses_cfg.h) # host (cross-compile host, if any) -# libtool_version (libtool "-version-info" or "-version-number") +# libtool_version (libtool "-version-info" or "-version-number") # # Notes: -# CLIXs nawk does not like underscores in command-line variable names. -# Mixed-case variable names are ok. # HP-UX requires shared libraries to have executable permissions. # function is_ticlib() { @@ -253,9 +252,9 @@ } function install_dll(directory,filename) { src_name = sprintf("../lib/%s", filename); - dst_name = sprintf("$(DESTDIR)%s/%s", directory, filename); + dst_name = sprintf("%s/%s", directory, filename); printf "\t@echo installing %s as %s\n", src_name, dst_name - if ( directory == "$(bindir)" ) { + if ( directory == "$(BINDIR)" ) { program = "$(INSTALL) -m 755"; } else { program = "$(INSTALL_LIB)"; @@ -270,10 +269,10 @@ return index(check,value); } function trim_suffix(value) { - if (USE_LIB_SUFFIX != "" && length(value) > length(USE_LIB_SUFFIX)) { - check = substr(value, 1 + length(value) - length(USE_LIB_SUFFIX)); - if (check == USE_LIB_SUFFIX) { - value = substr(value, 1, length(value) - length(USE_LIB_SUFFIX)); + if (ABI_SUFFIX != "" && length(value) > length(ABI_SUFFIX)) { + check = substr(value, 1 + length(value) - length(ABI_SUFFIX)); + if (check == ABI_SUFFIX) { + value = substr(value, 1, length(value) - length(ABI_SUFFIX)); } } return value; @@ -308,7 +307,7 @@ printf "# MODEL: %s\n", MODEL printf "# CXX_MODEL: %s\n", CXX_MODEL printf "# LIB_SUFFIX: %s\n", LIB_SUFFIX - printf "# USE_LIB_SUFFIX: %s\n", USE_LIB_SUFFIX + printf "# ABI_SUFFIX: %s\n", ABI_SUFFIX printf "# model: %s\n", model printf "# prefix: %s\n", prefix printf "# suffix: %s\n", suffix @@ -368,10 +367,8 @@ found = 2; } if ( $2 == "c++" ) { - CC_NAME="CXX" CC_FLAG="CXXFLAGS" } else { - CC_NAME="CC" CC_FLAG="CFLAGS" } } @@ -403,14 +400,14 @@ if ( ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw" || ShlibVer == "msvcdll") { - dst_dirs = "$(DESTDIR)$(bindir) $(DESTDIR)$(libdir)"; + dst_dirs = "$(BINDIR) $(LIBDIR)"; printf "install.%s :: %s $(LIBRARIES)\n", name, dst_dirs - install_dll("$(bindir)",end_name); - install_dll("$(libdir)",imp_name); + install_dll("$(BINDIR)",end_name); + install_dll("$(LIBDIR)",imp_name); } else { - lib_dir = "$(DESTDIR)$(libdir)"; + lib_dir = "$(LIBDIR)"; printf "install.%s :: %s/%s\n", name, lib_dir, end_name print "" if ( ReLink == "yes" ) { @@ -430,13 +427,13 @@ } ovr_name = sprintf("%scurses%s.a", curses_prefix, suffix) printf "\t@echo linking %s to %s\n", imp_name, ovr_name - printf "\tcd $(DESTDIR)$(libdir) && (" + printf "\tcd $(LIBDIR) && (" symlink(imp_name, ovr_name) printf ")\n" } else { ovr_name = sprintf("libcurses%s", suffix) printf "\t@echo linking %s to %s\n", end_name, ovr_name - printf "\tcd $(DESTDIR)$(libdir) && (" + printf "\tcd $(LIBDIR) && (" symlink(end_name, ovr_name) printf ")\n" } @@ -450,19 +447,19 @@ printf "uninstall.%s ::\n", name if ( ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw" || ShlibVer == "msvcdll") { - printf "\t@echo uninstalling $(DESTDIR)$(bindir)/%s\n", end_name - printf "\t-@rm -f $(DESTDIR)$(bindir)/%s\n", end_name + printf "\t@echo uninstalling $(BINDIR)/%s\n", end_name + printf "\t-@rm -f $(BINDIR)/%s\n", end_name - printf "\t@echo uninstalling $(DESTDIR)$(libdir)/%s\n", imp_name - printf "\t-@rm -f $(DESTDIR)$(libdir)/%s\n", imp_name + printf "\t@echo uninstalling $(LIBDIR)/%s\n", imp_name + printf "\t-@rm -f $(LIBDIR)/%s\n", imp_name } else { - printf "\t@echo uninstalling $(DESTDIR)$(libdir)/%s\n", end_name - removelinks("$(DESTDIR)$(libdir)") + printf "\t@echo uninstalling $(LIBDIR)/%s\n", end_name + removelinks("$(LIBDIR)") if ( overwrite == "yes" && name == "ncurses" ) { ovr_name = sprintf("libcurses%s", suffix) - printf "\t-@rm -f $(DESTDIR)$(libdir)/%s\n", ovr_name + printf "\t-@rm -f $(LIBDIR)/%s\n", ovr_name } } if ( rmSoLocs == "yes" ) { @@ -475,12 +472,12 @@ else if ( MODEL == "LIBTOOL" ) { end_name = lib_name; - use_name = trim_suffix(TermlibRoot) USE_LIB_SUFFIX + use_name = trim_suffix(TermlibRoot) ABI_SUFFIX printf "../lib/%s : \\\n", lib_name if ( (name != use_name ) && ( index(name, "++") == 0 ) && ( index(name, "tic") == 1 || index(name, "ncurses") == 1 ) ) { printf "\t\t../lib/lib%s.la \\\n", use_name; if ( index(name, "tic") == 1 && index(TermlibRoot, "ncurses") != 1 ) { - printf "\t\t../lib/lib%s%s.la \\\n", "ncurses", USE_LIB_SUFFIX; + printf "\t\t../lib/lib%s%s.la \\\n", "ncurses", ABI_SUFFIX; } } printf "\t\t$(%s_OBJS)\n", OBJS @@ -491,7 +488,7 @@ } else { which_list = "SHLIB_LIST"; } - printf "\tcd ../lib && $(LIBTOOL_LINK) $(%s) $(%s) \\\n", CC_NAME, CC_FLAG; + printf "\tcd ../lib && $(LIBTOOL_LINK) $(%s) \\\n", CC_FLAG; printf "\t\t-o %s $(%s_OBJS:$o=.lo) \\\n", lib_name, OBJS; printf "\t\t-rpath $(libdir) \\\n"; printf "\t\t%s $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(%s) $(LDFLAGS)\n", libtool_version, which_list; @@ -503,8 +500,8 @@ print "install \\" print "install.libs \\" printf "install.%s :: \\\n", trim_suffix(name); - printf "\t\t$(DESTDIR)$(libdir) \\\n"; - use_name = TermlibRoot USE_LIB_SUFFIX + printf "\t\t$(LIBDIR) \\\n"; + use_name = TermlibRoot ABI_SUFFIX if ( (name != use_name ) && ( index(name, "++") == 0 ) && ( index(name, "tic") == 1 || index(name, "ncurses") == 1 ) ) { if ( trim_suffix(TermlibRoot) != trim_suffix(name) ) { printf "\t\tinstall.%s \\\n", trim_suffix(TermlibRoot); @@ -514,14 +511,14 @@ } } printf "\t\t../lib/%s\n", lib_name - printf "\t@echo installing ../lib/%s as $(DESTDIR)$(libdir)/%s\n", lib_name, lib_name - printf "\tcd ../lib; $(LIBTOOL_INSTALL) $(INSTALL) %s $(DESTDIR)$(libdir)\n", lib_name + printf "\t@echo installing ../lib/%s as $(LIBDIR)/%s\n", lib_name, lib_name + printf "\tcd ../lib; $(LIBTOOL_INSTALL) $(INSTALL) %s $(LIBDIR)\n", lib_name print "" print "uninstall \\" print "uninstall.libs \\" printf "uninstall.%s ::\n", trim_suffix(name) - printf "\t@echo uninstalling $(DESTDIR)$(libdir)/%s\n", lib_name - printf "\t-@$(LIBTOOL_UNINSTALL) rm -f $(DESTDIR)$(libdir)/%s\n", lib_name + printf "\t@echo uninstalling $(LIBDIR)/%s\n", lib_name + printf "\t-@$(LIBTOOL_UNINSTALL) rm -f $(LIBDIR)/%s\n", lib_name } else { @@ -542,41 +539,41 @@ print "" print "install \\" print "install.libs \\" - printf "install.%s :: $(DESTDIR)$(libdir) ../lib/%s\n", name, lib_name - printf "\t@echo installing ../lib/%s as $(DESTDIR)$(libdir)/%s\n", lib_name, lib_name - printf "\t$(INSTALL_DATA) ../lib/%s $(DESTDIR)$(libdir)/%s\n", lib_name, lib_name + printf "install.%s :: $(LIBDIR) ../lib/%s\n", name, lib_name + printf "\t@echo installing ../lib/%s as $(LIBDIR)/%s\n", lib_name, lib_name + printf "\t$(INSTALL_DATA) ../lib/%s $(LIBDIR)/%s\n", lib_name, lib_name if ( overwrite == "yes" && lib_name == "libncurses.a" ) { printf "\t@echo linking libcurses.a to libncurses.a\n" - printf "\t-@rm -f $(DESTDIR)$(libdir)/libcurses.a\n" - printf "\t(cd $(DESTDIR)$(libdir) && " + printf "\t-@rm -f $(LIBDIR)/libcurses.a\n" + printf "\t(cd $(LIBDIR) && " symlink("libncurses.a", "libcurses.a") printf ")\n" } if ( ReRanlib == "yes" ) { - printf "\t$(RANLIB) $(DESTDIR)$(libdir)/%s\n", lib_name + printf "\t$(RANLIB) $(LIBDIR)/%s\n", lib_name } if ( host == "vxworks" ) { - printf "\t@echo installing ../lib/lib%s$o as $(DESTDIR)$(libdir)/lib%s$o\n", name, name - printf "\t$(INSTALL_DATA) ../lib/lib%s$o $(DESTDIR)$(libdir)/lib%s$o\n", name, name + printf "\t@echo installing ../lib/lib%s$o as $(LIBDIR)/lib%s$o\n", name, name + printf "\t$(INSTALL_DATA) ../lib/lib%s$o $(LIBDIR)/lib%s$o\n", name, name } print "" print "uninstall \\" print "uninstall.libs \\" printf "uninstall.%s ::\n", name - printf "\t@echo uninstalling $(DESTDIR)$(libdir)/%s\n", lib_name - printf "\t-@rm -f $(DESTDIR)$(libdir)/%s\n", lib_name + printf "\t@echo uninstalling $(LIBDIR)/%s\n", lib_name + printf "\t-@rm -f $(LIBDIR)/%s\n", lib_name if ( overwrite == "yes" && lib_name == "libncurses.a" ) { printf "\t@echo linking libcurses.a to libncurses.a\n" - printf "\t-@rm -f $(DESTDIR)$(libdir)/libcurses.a\n" + printf "\t-@rm -f $(LIBDIR)/libcurses.a\n" } if ( host == "vxworks" ) { - printf "\t@echo uninstalling $(DESTDIR)$(libdir)/lib%s$o\n", name - printf "\t-@rm -f $(DESTDIR)$(libdir)/lib%s$o\n", name + printf "\t@echo uninstalling $(LIBDIR)/lib%s$o\n", name + printf "\t-@rm -f $(LIBDIR)/lib%s$o\n", name } } print "" diff --git a/contrib/ncurses/ncurses/Makefile.in b/contrib/ncurses/ncurses/Makefile.in --- a/contrib/ncurses/ncurses/Makefile.in +++ b/contrib/ncurses/ncurses/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.184 2024/01/19 12:00:00 tom Exp $ +# $Id: Makefile.in,v 1.194 2025/10/25 17:29:43 tom Exp $ ############################################################################## -# Copyright 2018-2022,2024 Thomas E. Dickey # +# Copyright 2018-2024,2025 Thomas E. Dickey # # Copyright 1998-2017,2018 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -50,14 +50,14 @@ VPATH = @srcdir@ THIS = Makefile -TOP_MFLAGS = @cf_cv_makeflags@ DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)" @SET_MAKE@ +@SET_DESTDIR@ +TOP_MFLAGS = DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)" x = @EXEEXT@ o = .@OBJEXT@ MODEL = @DFT_LWR_MODEL@ -DESTDIR = @DESTDIR@ top_srcdir = @top_srcdir@ srcdir = @srcdir@ prefix = @prefix@ @@ -69,7 +69,9 @@ datadir = @datadir@ includesubdir = @includesubdir@ -INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) +INCLUDEDIR = $(DESTDIR)$(includedir@MERGE_PREFIX@)$(includesubdir) +BINDIR = $(DESTDIR)$(bindir@MERGE_PREFIX@) +LIBDIR = $(DESTDIR)$(libdir@MERGE_PREFIX@) PACKAGE = @PACKAGE@ @@ -190,7 +192,6 @@ $(INCDIR)/nc_string.h \ $(INCDIR)/nc_termios.h \ $(INCDIR)/nc_tparm.h \ - $(INCDIR)/nc_win32.h \ $(INCDIR)/term_entry.h \ $(srcdir)/curses.priv.h \ $(srcdir)/new_pair.h \ @@ -206,6 +207,7 @@ hashmap$x \ lib_mvcur$x \ link_test$x \ + report_ctype$x \ report_hashing$x LOCAL_LIBDIR = @top_builddir@/lib @@ -235,8 +237,8 @@ sources: $(AUTO_SRC) -$(DESTDIR)$(bindir) \ -$(DESTDIR)$(libdir) : +$(BINDIR) \ +$(LIBDIR) : mkdir -p $@ ../lib : ; mkdir $@ @@ -258,17 +260,23 @@ $(tinfo)/make_keys.c \ ./names.c $(BUILD_CC) -o $@ $(BUILD_CPPFLAGS) $(BUILD_CCFLAGS) $(tinfo)/make_keys.c $(BUILD_LDFLAGS) $(BUILD_LIBS) + @./$@ "-?" + @echo "... made $@" make_hash$(BUILD_EXEEXT) : \ build.priv.h \ $(tinfo)/make_hash.c \ ../include/hashsize.h $(BUILD_CC) -o $@ $(BUILD_CPPFLAGS) $(BUILD_CCFLAGS) $(tinfo)/make_hash.c $(BUILD_LDFLAGS) $(BUILD_LIBS) + @./$@ "-?" + @echo "... made $@" report_offsets$(BUILD_EXEEXT) : \ $(srcdir)/curses.priv.h \ $(srcdir)/report_offsets.c $(BUILD_CC) -o $@ $(BUILD_CPPFLAGS) $(BUILD_CCFLAGS) $(srcdir)/report_offsets.c $(BUILD_LDFLAGS) $(BUILD_LIBS) + @./$@ "-?" + @echo "... made $@" ./report_offsets$(BUILD_EXEEXT) ./expanded.c : $(srcdir)/curses.priv.h $(serial)/MKexpanded.sh @@ -314,6 +322,7 @@ -rm -f $(AUTO_SRC) -rm -f make_keys$(BUILD_EXEEXT) -rm -f make_hash$(BUILD_EXEEXT) + -rm -f report_ctype$(BUILD_EXEEXT) -rm -f report_offsets$(BUILD_EXEEXT) -rm -rf .libs *.dSYM *.map @@ -323,7 +332,9 @@ realclean :: distclean # These rules are used to allow "make -n" to work on a clean directory-tree +../include/curses.h \ ../include/hashsize.h \ +../include/ncurses_def.h \ ../include/parametrized.h \ ../include/term.h : ( cd ../include && $(MAKE) $(TOP_MFLAGS) ) @@ -355,10 +366,17 @@ ../@DFT_OBJ_SUBDIR@/dump_entry$o: ( cd ../progs && $(MAKE) ../@DFT_OBJ_SUBDIR@/dump_entry$o ) +report_ctype$x : \ + $(srcdir)/curses.priv.h \ + $(srcdir)/report_ctype.c $(TEST_DEPS) + @ECHO_LD@ $(CC) -o $@ $(CFLAGS_DEFAULT) $(srcdir)/report_ctype.c $(TEST_LDFLAGS) + @echo "... made $@" + ./report_ctype$x + report_hashing$x : \ $(srcdir)/curses.priv.h \ $(srcdir)/report_hashing.c $(TEST_DEPS) - @ECHO_LD@ $(CC) -o $@ $(CFLAGS_DEFAULT) report_hashing.c $(TEST_LDFLAGS) + @ECHO_LD@ $(CC) -o $@ $(CFLAGS_DEFAULT) $(srcdir)/report_hashing.c $(TEST_LDFLAGS) # Verify that each header-file can be compiled without including another. @MAKE_PHONY@.PHONY : check_headers diff --git a/contrib/ncurses/ncurses/base/MKkeyname.awk b/contrib/ncurses/ncurses/base/MKkeyname.awk --- a/contrib/ncurses/ncurses/base/MKkeyname.awk +++ b/contrib/ncurses/ncurses/base/MKkeyname.awk @@ -1,6 +1,6 @@ -# $Id: MKkeyname.awk,v 1.51 2020/02/02 23:34:34 tom Exp $ +# $Id: MKkeyname.awk,v 1.53 2024/12/07 21:09:39 tom Exp $ ############################################################################## -# Copyright 2020 Thomas E. Dickey # +# Copyright 2020,2024 Thomas E. Dickey # # Copyright 1998-2016,2017 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -59,7 +59,7 @@ if (bigstrings) { printf "\t{ -1, 0 }};\n" print "" - print "static const char key_names[] = "names";" + print "static const char key_names[] ="names";" } else { printf "\t{ 0, 0 }};\n" } @@ -72,7 +72,7 @@ print "safe_keyname (SCREEN *sp, int c)" print "{" print " char name[20];" - print " NCURSES_CONST char *result = 0;" + print " NCURSES_CONST char *result = NULL;" print "" print " if (c == -1) {" print " result = \"-1\";" @@ -86,7 +86,7 @@ print " }" print " }" } else { - print " for (i = 0; _nc_key_names[i].name != 0; i++) {" + print " for (i = 0; _nc_key_names[i].name != NULL; i++) {" print " if (_nc_key_names[i].code == c) {" print " result = (NCURSES_CONST char *)_nc_key_names[i].name;" print " break;" @@ -94,12 +94,12 @@ print " }" } print "" - print " if (result == 0 && (c >= 0 && c < SIZEOF_TABLE)) {" - print " if (MyTable == 0)" + print " if (result == NULL && (c >= 0 && c < SIZEOF_TABLE)) {" + print " if (MyTable == NULL)" print " MyTable = typeCalloc(char *, SIZEOF_TABLE);" print "" - print " if (MyTable != 0) {" - print " int m_prefix = (sp == 0 || sp->_use_meta);" + print " if (MyTable != NULL) {" + print " int m_prefix = (sp == NULL || sp->_use_meta);" print "" print " /* if sense of meta() changed, discard cached data */" print " if (MyInit != (m_prefix + 1)) {" @@ -112,7 +112,7 @@ print " }" print "" print " /* create and cache result as needed */" - print " if (MyTable[c] == 0) {" + print " if (MyTable[c] == NULL) {" print " int cc = c;" print " char *p = name;" print "#define P_LIMIT (sizeof(name) - (size_t) (p - name))" @@ -132,22 +132,22 @@ print " result = MyTable[c];" print " }" print "#if NCURSES_EXT_FUNCS && NCURSES_XNAMES" - print " } else if (result == 0 && HasTerminal(sp)) {" + print " } else if (result == NULL && HasTerminal(sp)) {" print " int j, k;" print " char * bound;" print " TERMTYPE2 *tp = &TerminalType(TerminalOf(sp));" print " unsigned save_trace = _nc_tracing;" print "" print " _nc_tracing = 0; /* prevent recursion via keybound() */" - print " for (j = 0; (bound = NCURSES_SP_NAME(keybound)(NCURSES_SP_ARGx c, j)) != 0; ++j) {" + print " for (j = 0; (bound = NCURSES_SP_NAME(keybound)(NCURSES_SP_ARGx c, j)) != NULL; ++j) {" print " for(k = STRCOUNT; k < (int) NUM_STRINGS(tp); k++) {" - print " if (tp->Strings[k] != 0 && !strcmp(bound, tp->Strings[k])) {" + print " if (tp->Strings[k] != NULL && !strcmp(bound, tp->Strings[k])) {" print " result = ExtStrname(tp, k, strnames);" print " break;" print " }" print " }" print " free(bound);" - print " if (result != 0)" + print " if (result != NULL)" print " break;" print " }" print " _nc_tracing = save_trace;" @@ -166,7 +166,7 @@ print "#if NO_LEAKS" print "void _nc_keyname_leaks(void)" print "{" - print " if (MyTable != 0) {" + print " if (MyTable != NULL) {" print " int j;" print " for (j = 0; j < SIZEOF_TABLE; ++j) {" print " FreeIfNeeded(MyTable[j]);" diff --git a/contrib/ncurses/ncurses/base/MKlib_gen.sh b/contrib/ncurses/ncurses/base/MKlib_gen.sh --- a/contrib/ncurses/ncurses/base/MKlib_gen.sh +++ b/contrib/ncurses/ncurses/base/MKlib_gen.sh @@ -2,10 +2,10 @@ # # MKlib_gen.sh -- generate sources from curses.h macro definitions # -# ($Id: MKlib_gen.sh,v 1.73 2022/10/01 13:14:20 tom Exp $) +# ($Id: MKlib_gen.sh,v 1.79 2025/02/23 01:55:06 tom Exp $) # ############################################################################## -# Copyright 2018-2021,2022 Thomas E. Dickey # +# Copyright 2018-2024,2025 Thomas E. Dickey # # Copyright 1998-2016,2017 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -188,6 +188,10 @@ cat >$ED4 <$ED4 <" print "" + print "#if USE_STDBOOL_H" + print "#include " + print "#endif" + print "" print "#undef NCURSES_NOMACROS /* _this_ file uses macros */" print "#define NCURSES_NOMACROS 1" print "" @@ -464,8 +474,11 @@ } END { if ( "$USE" != "generated" ) { - print "int main(void)" - print "{" + print "static int link_test(int code)" + print "{" + print " switch(code)" + print " {" + casenum = 1; for (n = 1; n < start; ++n) { value = calls[n]; if ( value !~ /P_POUNDC/ ) { @@ -473,20 +486,37 @@ sub(/^[0-9a-zA-Z_]+ /,"",value); sub(/^[*][ \t]*/,"",value); gsub("struct[ \t]*[0-9a-zA-Z_]+[ \t]*[*]","",value); + arg_l = index(value, "("); + arg_r = index(value, ")"); + if ( arg_l > 0 && arg_r > arg_l + 1 ) { + args = substr(value, arg_l + 1, arg_r - arg_l - 1); + gsub(/[0-9a-zA-Z_]+[ \t]*[*][ \t]*[0-9a-zA-Z_]+/,"NULL",args); + gsub(/ (bool|int|short|attr_t|chtype|wchar_t|NCURSES_BOOL|NCURSES_OUTC|NCURSES_OUTC_sp|va_list) /," ",args); + value = substr(value,0,arg_l) args substr(value,arg_r); + } gsub(/[0-9a-zA-Z_]+[ \t]*[*][ \t]*/,"",value); gsub(/ (const) /," ",value); - gsub(/ (int|short|attr_t|chtype|wchar_t|NCURSES_BOOL|NCURSES_OUTC|NCURSES_OUTC_sp|va_list) /," ",value); + gsub(/ (bool|int|short|attr_t|chtype|wchar_t|NCURSES_BOOL|NCURSES_OUTC|NCURSES_OUTC_sp|va_list) /," ",value); gsub(/ void /,"",value); sub(/^/,"call_",value); gsub(/ (a[0-9]|z) /, " 0 ", value); gsub(/ int[ \t]*[(][^)]+[)][(][^)]+[)]/, "0", value); - printf "\t%s;\n", value; + if ( index(value, "call_NCURSES_SP_NAME") > 0 ) { + sub("0","NULL", value); + } + printf " case %d: %s; break;\n", casenum++, value; } else { + if ( index(value, "call_NCURSES_SP_NAME") > 0 ) { + printf "/* FIXME %s */\n", value; + sub("0","NULL", value); + } print value; } } - print " return 0;" - print "}" + print " default: return 0; /* case did not exist */" + print " }" + print " return 1; /* case exists */" + print "}" } } EOF1 @@ -527,3 +557,34 @@ -e '/#ident/d' \ -e '/#line/d' \ | sed -f $ED4 + +# a simple test-driver checks one or all of the linkages +if test "$USE" = "implemented" +then +cat <<"EOF" +int main(int argc, char *argv[]) +{ + int n; + int rc; + if (argc > 1) + { + rc = !link_test(atoi(argv[1])); + } + else + { + rc = 0; + for (n = 1; ; ++n) + { + printf("TEST %d\n", n); + fflush(stdout); + if (!link_test(n)) + { + rc = 1; + break; + } + } + } + return rc; +} +EOF +fi diff --git a/contrib/ncurses/ncurses/base/MKunctrl.awk b/contrib/ncurses/ncurses/base/MKunctrl.awk --- a/contrib/ncurses/ncurses/base/MKunctrl.awk +++ b/contrib/ncurses/ncurses/base/MKunctrl.awk @@ -1,4 +1,4 @@ -# $Id: MKunctrl.awk,v 1.30 2024/02/03 21:09:14 tom Exp $ +# $Id: MKunctrl.awk,v 1.31 2024/12/07 21:06:39 tom Exp $ ############################################################################## # Copyright 2020,2024 Thomas E. Dickey # # Copyright 1998-2012,2017 Free Software Foundation, Inc. # @@ -135,7 +135,7 @@ print "" if (bigstrings) { - print "static const char unctrl_blob[] = "blob";" + print "static const char unctrl_blob[] ="blob";" print "" stringname = "unctrl_blob + unctrl" } else { @@ -147,7 +147,7 @@ print "\t(void) sp;" print "\tif (check >= 0 && check < (int)SIZEOF(unctrl_table)) {" print "#if NCURSES_EXT_FUNCS" - print "\t\tif ((sp != 0)" + print "\t\tif ((sp != NULL)" print "\t\t && (sp->_legacy_coding > 1)" print "\t\t && (check >= 128)" print "\t\t && (check < 160))" @@ -156,7 +156,7 @@ print "\t\tif ((check >= 160)" print "\t\t && (check < 256)" print "\t\t && !_nc_unicode_locale()" - print "\t\t && ((sp != 0)" + print "\t\t && ((sp != NULL)" print "\t\t && ((sp->_legacy_coding > 0)" print "\t\t || (sp->_legacy_coding == 0" print "\t\t && isprint(check)))))" @@ -165,7 +165,7 @@ print "#endif /* NCURSES_EXT_FUNCS */" printf "\t\t\tresult = %s_table[check];\n", stringname; print "\t} else {" - print "\t\tresult = 0;" + print "\t\tresult = NULL;" print "\t}" print "\treturn (NCURSES_CONST char *)result;" print "}" diff --git a/contrib/ncurses/ncurses/base/define_key.c b/contrib/ncurses/ncurses/base/define_key.c --- a/contrib/ncurses/ncurses/base/define_key.c +++ b/contrib/ncurses/ncurses/base/define_key.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2009,2014 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -34,7 +34,7 @@ #include -MODULE_ID("$Id: define_key.c,v 1.22 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: define_key.c,v 1.24 2025/12/27 12:41:23 tom Exp $") NCURSES_EXPORT(int) NCURSES_SP_NAME(define_key) (NCURSES_SP_DCLx const char *str, int keycode) @@ -42,24 +42,24 @@ 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)) { + if (SP_PARM == NULL || !HasTInfoTerminal(SP_PARM)) { code = ERR; } else if (keycode > 0) { unsigned ukey = (unsigned) keycode; -#ifdef USE_TERM_DRIVER +#if 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) { + if (str != NULL) { 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 (str != NULL) { if (NCURSES_SP_NAME(key_defined) (NCURSES_SP_ARGx str) == 0) { if (_nc_add_to_try(&(SP_PARM->_keytry), str, ukey) == OK) { code = OK; diff --git a/contrib/ncurses/ncurses/base/key_defined.c b/contrib/ncurses/ncurses/base/key_defined.c --- a/contrib/ncurses/ncurses/base/key_defined.c +++ b/contrib/ncurses/ncurses/base/key_defined.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2023 Thomas E. Dickey * + * Copyright 2020-2023,2024 Thomas E. Dickey * * Copyright 2003-2006,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -34,7 +34,7 @@ #include #include -MODULE_ID("$Id: key_defined.c,v 1.11 2023/06/24 15:36:32 tom Exp $") +MODULE_ID("$Id: key_defined.c,v 1.12 2024/12/07 21:24:18 tom Exp $") static int find_definition(TRIES * tree, const char *str) @@ -43,9 +43,9 @@ int result = OK; if (VALID_STRING(str) && *str != '\0') { - for (ptr = tree; ptr != 0; ptr = ptr->sibling) { + for (ptr = tree; ptr != NULL; ptr = ptr->sibling) { if (UChar(*str) == UChar(ptr->ch)) { - if (str[1] == '\0' && ptr->child != 0) { + if (str[1] == '\0' && ptr->child != NULL) { result = ERR; } else if ((result = find_definition(ptr->child, str + 1)) == OK) { @@ -72,7 +72,7 @@ int code = ERR; T((T_CALLED("key_defined(%p, %s)"), (void *) SP_PARM, _nc_visbuf(str))); - if (SP_PARM != 0 && str != 0) { + if (SP_PARM != NULL && str != NULL) { code = find_definition(SP_PARM->_keytry, str); } diff --git a/contrib/ncurses/ncurses/base/keybound.c b/contrib/ncurses/ncurses/base/keybound.c --- a/contrib/ncurses/ncurses/base/keybound.c +++ b/contrib/ncurses/ncurses/base/keybound.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1999-2009,2011 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -34,7 +34,7 @@ #include -MODULE_ID("$Id: keybound.c,v 1.12 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: keybound.c,v 1.13 2024/12/07 21:24:18 tom Exp $") /* * Returns the count'th string definition which is associated with the @@ -43,10 +43,10 @@ NCURSES_EXPORT(char *) NCURSES_SP_NAME(keybound) (NCURSES_SP_DCLx int code, int count) { - char *result = 0; + char *result = NULL; T((T_CALLED("keybound(%p, %d,%d)"), (void *) SP_PARM, code, count)); - if (SP_PARM != 0 && code >= 0) { + if (SP_PARM != NULL && code >= 0) { result = _nc_expand_try(SP_PARM->_keytry, (unsigned) code, &count, diff --git a/contrib/ncurses/ncurses/base/keyok.c b/contrib/ncurses/ncurses/base/keyok.c --- a/contrib/ncurses/ncurses/base/keyok.c +++ b/contrib/ncurses/ncurses/base/keyok.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2020,2021 Thomas E. Dickey * + * Copyright 2019-2024,2025 Thomas E. Dickey * * Copyright 1998-2012,2014 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -34,7 +34,7 @@ #include -MODULE_ID("$Id: keyok.c,v 1.17 2021/06/17 21:26:02 tom Exp $") +MODULE_ID("$Id: keyok.c,v 1.19 2025/12/27 12:41:23 tom Exp $") /* * Enable (or disable) ncurses' interpretation of a keycode by adding (or @@ -53,7 +53,7 @@ if (HasTerminal(SP_PARM)) { T((T_CALLED("keyok(%p, %d,%d)"), (void *) SP_PARM, c, flag)); -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER code = CallDriver_2(sp, td_kyOk, c, flag); #else if (c >= 0) { @@ -63,7 +63,7 @@ if (flag) { while ((s = _nc_expand_try(SP_PARM->_key_ok, - ch, &count, (size_t) 0)) != 0) { + ch, &count, (size_t) 0)) != NULL) { if (_nc_remove_key(&(SP_PARM->_key_ok), ch)) { code = _nc_add_to_try(&(SP_PARM->_keytry), s, ch); free(s); @@ -76,7 +76,7 @@ } } else { while ((s = _nc_expand_try(SP_PARM->_keytry, - ch, &count, (size_t) 0)) != 0) { + ch, &count, (size_t) 0)) != NULL) { if (_nc_remove_key(&(SP_PARM->_keytry), ch)) { code = _nc_add_to_try(&(SP_PARM->_key_ok), s, ch); free(s); diff --git a/contrib/ncurses/ncurses/base/legacy_coding.c b/contrib/ncurses/ncurses/base/legacy_coding.c --- a/contrib/ncurses/ncurses/base/legacy_coding.c +++ b/contrib/ncurses/ncurses/base/legacy_coding.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 2005,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -34,7 +34,7 @@ #include -MODULE_ID("$Id: legacy_coding.c,v 1.6 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: legacy_coding.c,v 1.7 2024/12/07 20:00:48 tom Exp $") NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (NCURSES_SP_DCLx int level) @@ -42,7 +42,7 @@ int result = ERR; T((T_CALLED("use_legacy_coding(%p,%d)"), (void *) SP_PARM, level)); - if (level >= 0 && level <= 2 && SP_PARM != 0) { + if (level >= 0 && level <= 2 && SP_PARM != NULL) { result = SP_PARM->_legacy_coding; SP_PARM->_legacy_coding = level; } diff --git a/contrib/ncurses/ncurses/base/lib_addch.c b/contrib/ncurses/ncurses/base/lib_addch.c --- a/contrib/ncurses/ncurses/base/lib_addch.c +++ b/contrib/ncurses/ncurses/base/lib_addch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2021,2022 Thomas E. Dickey * + * Copyright 2019-2022,2024 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -37,7 +37,7 @@ #include #include -MODULE_ID("$Id: lib_addch.c,v 1.141 2022/06/12 15:16:41 tom Exp $") +MODULE_ID("$Id: lib_addch.c,v 1.144 2024/12/07 17:18:07 tom Exp $") static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT); @@ -118,7 +118,7 @@ #endif static bool -newline_forces_scroll(WINDOW *win, NCURSES_SIZE_T *ypos) +newline_forces_scroll(const WINDOW *win, NCURSES_SIZE_T *ypos) { bool result = FALSE; @@ -451,14 +451,14 @@ if ((AttrOf(ch) & A_ALTCHARSET) || ( #if USE_WIDEC_SUPPORT - (sp != 0 && sp->_legacy_coding) && + (sp != NULL && sp->_legacy_coding) && #endif s[1] == 0 ) || ( - (isprint((int) t) && !iscntrl((int) t)) + (isprint(UChar(t)) && !iscntrl(UChar(t))) #if USE_WIDEC_SUPPORT - || ((sp == 0 || !sp->_legacy_coding) && + || ((sp == NULL || !sp->_legacy_coding) && (WINDOW_EXT(win, addch_used) || !_nc_is_charable(CharOf(ch)))) #endif diff --git a/contrib/ncurses/ncurses/base/lib_addstr.c b/contrib/ncurses/ncurses/base/lib_addstr.c --- a/contrib/ncurses/ncurses/base/lib_addstr.c +++ b/contrib/ncurses/ncurses/base/lib_addstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2022,2023 Thomas E. Dickey * + * Copyright 2019-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -45,7 +45,7 @@ #include -MODULE_ID("$Id: lib_addstr.c,v 1.62 2023/11/21 21:47:23 tom Exp $") +MODULE_ID("$Id: lib_addstr.c,v 1.65 2025/02/20 08:53:36 tom Exp $") NCURSES_EXPORT(int) waddnstr(WINDOW *win, const char *astr, int n) @@ -55,8 +55,8 @@ T((T_CALLED("waddnstr(%p,%s,%d)"), (void *) win, _nc_visbufn(astr, n), n)); - if (win && (str != 0) && (n != 0)) { - bool explicit = (n > 0); + if (win != NULL && str != NULL) { + bool explicit = (n >= 0); TR(TRACE_VIRTPUT | TRACE_ATTRS, ("... current %s", _traceattr(WINDOW_ATTRS(win)))); @@ -123,7 +123,7 @@ _nc_wchstrlen(const cchar_t *s) { int result = 0; - if (s != 0) { + if (s != NULL) { while (CharOf(s[result]) != L'\0') { result++; } @@ -230,8 +230,8 @@ T((T_CALLED("waddnwstr(%p,%s,%d)"), (void *) win, _nc_viswbufn(str, n), n)); - if (win && (str != 0) && (n != 0)) { - bool explicit = (n > 0); + if (win != NULL && str != NULL) { + bool explicit = (n >= 0); TR(TRACE_VIRTPUT | TRACE_ATTRS, ("... current %s", _traceattr(WINDOW_ATTRS(win)))); diff --git a/contrib/ncurses/ncurses/base/lib_beep.c b/contrib/ncurses/ncurses/base/lib_beep.c --- a/contrib/ncurses/ncurses/base/lib_beep.c +++ b/contrib/ncurses/ncurses/base/lib_beep.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2013,2014 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -47,7 +47,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_beep.c,v 1.18 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_beep.c,v 1.21 2025/12/27 12:41:23 tom Exp $") /* * beep() @@ -64,12 +64,12 @@ T((T_CALLED("beep(%p)"), (void *) SP_PARM)); -#ifdef USE_TERM_DRIVER - if (SP_PARM != 0) +#if USE_TERM_DRIVER + if (SP_PARM != NULL) res = CallDriver_1(SP_PARM, td_doBeepOrFlash, TRUE); #else /* FIXME: should make sure that we are not in altchar mode */ - if (cur_term == 0) { + if (cur_term == NULL) { res = ERR; } else if (bell) { res = NCURSES_PUTP2_FLUSH("bell", bell); diff --git a/contrib/ncurses/ncurses/base/lib_bkgd.c b/contrib/ncurses/ncurses/base/lib_bkgd.c --- a/contrib/ncurses/ncurses/base/lib_bkgd.c +++ b/contrib/ncurses/ncurses/base/lib_bkgd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2021,2024 Thomas E. Dickey * * Copyright 1998-2014,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -37,7 +37,7 @@ #include -MODULE_ID("$Id: lib_bkgd.c,v 1.63 2021/05/08 14:58:12 tom Exp $") +MODULE_ID("$Id: lib_bkgd.c,v 1.64 2024/12/07 20:00:48 tom Exp $") static const NCURSES_CH_T blank = NewChar(BLANK_TEXT); @@ -136,7 +136,7 @@ #define TraceChar(c) _tracechar(CharOf(c)) #endif - if (SP == 0) { + if (SP == NULL) { ; } else if (win) { NCURSES_CH_T new_bkgd = CHDEREF(ch); diff --git a/contrib/ncurses/ncurses/base/lib_chgat.c b/contrib/ncurses/ncurses/base/lib_chgat.c --- a/contrib/ncurses/ncurses/base/lib_chgat.c +++ b/contrib/ncurses/ncurses/base/lib_chgat.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020-2015,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -43,7 +43,7 @@ #include -MODULE_ID("$Id: lib_chgat.c,v 1.13 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_chgat.c,v 1.15 2025/02/15 20:53:36 tom Exp $") NCURSES_EXPORT(int) wchgat(WINDOW *win, @@ -62,7 +62,8 @@ color_pair)); set_extended_pair(opts, color_pair); - if (win) { + if (win != NULL + && color_pair >= 0) { struct ldat *line = &(win->_line[win->_cury]); int i; diff --git a/contrib/ncurses/ncurses/base/lib_color.c b/contrib/ncurses/ncurses/base/lib_color.c --- a/contrib/ncurses/ncurses/base/lib_color.c +++ b/contrib/ncurses/ncurses/base/lib_color.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -49,9 +49,9 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_color.c,v 1.150 2023/09/16 16:39:15 tom Exp $") +MODULE_ID("$Id: lib_color.c,v 1.157 2025/12/27 12:31:03 tom Exp $") -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER #define CanChange InfoOf(SP_PARM).canchange #define DefaultPalette InfoOf(SP_PARM).defaultPalette #define HasColor InfoOf(SP_PARM).hascolor @@ -69,7 +69,7 @@ #define UseHlsPalette (hue_lightness_saturation) #endif -#ifndef USE_TERM_DRIVER +#if !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 @@ -132,7 +132,7 @@ DATA( 0, 50, 100), /* COLOR_WHITE */ }; -#ifdef USE_TERM_DRIVER +#if 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 @@ -146,20 +146,20 @@ static int default_fg(NCURSES_SP_DCL0) { - return (SP_PARM != 0) ? SP_PARM->_default_fg : COLOR_WHITE; + return (SP_PARM != NULL) ? SP_PARM->_default_fg : COLOR_WHITE; } static int default_bg(NCURSES_SP_DCL0) { - return SP_PARM != 0 ? SP_PARM->_default_bg : COLOR_BLACK; + return SP_PARM != NULL ? SP_PARM->_default_bg : COLOR_BLACK; } #else #define default_fg(sp) COLOR_WHITE #define default_bg(sp) COLOR_BLACK #endif -#ifndef USE_TERM_DRIVER +#if !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 @@ -181,7 +181,7 @@ static void set_background_color(NCURSES_SP_DCLx int bg, NCURSES_SP_OUTC outc) { -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER CallDriver_3(SP_PARM, td_color, FALSE, bg, outc); #else if (set_a_background) { @@ -201,7 +201,7 @@ static void set_foreground_color(NCURSES_SP_DCLx int fg, NCURSES_SP_OUTC outc) { -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER CallDriver_3(SP_PARM, td_color, TRUE, fg, outc); #else if (set_a_foreground) { @@ -248,7 +248,7 @@ static bool init_direct_colors(NCURSES_SP_DCL0) { - static NCURSES_CONST char name[] = "RGB"; + static NCURSES_CONST char name[] = UserCap(RGB); rgb_bits_t *result = &(SP_PARM->_direct_color); @@ -273,7 +273,7 @@ result->bits.red = UChar(n); result->bits.green = UChar(n); result->bits.blue = UChar(n); - } else if ((s = tigetstr(name)) != 0 && VALID_STRING(s)) { + } else if ((s = tigetstr(name)) != NULL && VALID_STRING(s)) { int red = n; int green = n; int blue = width - (2 * n); @@ -306,13 +306,13 @@ static bool reset_color_pair(NCURSES_SP_DCL0) { -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER return CallDriver(SP_PARM, td_rescol); #else bool result = FALSE; (void) SP_PARM; - if (orig_pair != 0) { + if (orig_pair != NULL) { (void) NCURSES_PUTP2("orig_pair", orig_pair); result = TRUE; } @@ -336,10 +336,10 @@ if (reset_color_pair(NCURSES_SP_ARG)) result = TRUE; -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER result = CallDriver(SP_PARM, td_rescolors); #else - if (orig_colors != 0) { + if (orig_colors != NULL) { NCURSES_PUTP2("orig_colors", orig_colors); result = TRUE; } @@ -362,7 +362,7 @@ T((T_CALLED("start_color(%p)"), (void *) SP_PARM)); - if (SP_PARM == 0) { + if (SP_PARM == NULL) { result = ERR; } else if (SP_PARM->_coloron) { result = OK; @@ -393,7 +393,9 @@ * 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 (maxcolors < maxpairs) { + SP_PARM->_pair_limit += (1 + (2 * maxcolors)); + } #if !NCURSES_EXT_COLORS SP_PARM->_pair_limit = limit_PAIRS(SP_PARM->_pair_limit); #endif @@ -406,12 +408,12 @@ #endif ReservePairs(SP_PARM, 16); - if (SP_PARM->_color_pairs != 0) { + if (SP_PARM->_color_pairs != NULL) { 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) { + if (SP_PARM->_color_table != NULL) { MakeColorPair(SP_PARM->_color_pairs[0], default_fg(NCURSES_SP_ARG), default_bg(NCURSES_SP_ARG)); @@ -425,7 +427,7 @@ COLORS, COLOR_PAIRS)); SP_PARM->_coloron = 1; - } else if (SP_PARM->_color_pairs != 0) { + } else if (SP_PARM->_color_pairs != NULL) { FreeAndNull(SP_PARM->_color_pairs); } } @@ -526,13 +528,13 @@ if (have > sp->_pair_limit) have = sp->_pair_limit; - if (sp->_color_pairs == 0) { + if (sp->_color_pairs == NULL) { TYPE_CALLOC(colorpair_t, have, sp->_color_pairs); } else if (have > sp->_pair_alloc) { -#if NCURSES_EXT_COLORS +#if NCURSES_EXT_COLORS && NCURSES_EXT_FUNCS colorpair_t *next; - if ((next = typeCalloc(colorpair_t, have)) == 0) + if ((next = typeCalloc(colorpair_t, have)) == NULL) _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); @@ -540,13 +542,13 @@ sp->_color_pairs = next; #else TYPE_REALLOC(colorpair_t, have, sp->_color_pairs); - if (sp->_color_pairs != 0) { + if (sp->_color_pairs != NULL) { memset(sp->_color_pairs + sp->_pair_alloc, 0, sizeof(colorpair_t) * (size_t) (have - sp->_pair_alloc)); } #endif } - if (sp->_color_pairs != 0) { + if (sp->_color_pairs != NULL) { sp->_pair_alloc = have; } } @@ -656,7 +658,7 @@ if (GET_SCREEN_PAIR(sp) == pair) SET_SCREEN_PAIR(sp, (int) (~0)); /* force attribute update */ -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER CallDriver_3(sp, td_initpair, pair, f, b); #else if (initialize_pair && InPalette(f) && InPalette(b)) { @@ -713,7 +715,7 @@ color, r, g, b)); - if (sp == 0 || sp->_direct_color.value) + if (sp == NULL || sp->_direct_color.value) returnCode(result); maxcolors = MaxColors; @@ -739,7 +741,7 @@ sp->_color_table[color].blue = b; } -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER CallDriver_4(sp, td_initcolor, color, r, g, b); #else NCURSES_PUTP2("initialize_color", @@ -776,7 +778,7 @@ NCURSES_EXPORT(bool) NCURSES_SP_NAME(can_change_color) (NCURSES_SP_DCL) { - int result = FALSE; + bool result = FALSE; T((T_CALLED("can_change_color(%p)"), (void *) SP_PARM)); @@ -784,7 +786,7 @@ result = TRUE; } - returnCode(result); + returnBool(result); } #if NCURSES_SP_FUNCS @@ -798,12 +800,12 @@ NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_colors) (NCURSES_SP_DCL0) { - int code = FALSE; + bool code = FALSE; (void) SP_PARM; T((T_CALLED("has_colors(%p)"), (void *) SP_PARM)); if (HasTerminal(SP_PARM)) { -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER code = HasColor; #else code = ((VALID_NUMERIC(max_colors) && VALID_NUMERIC(max_pairs) @@ -814,7 +816,7 @@ || set_color_pair)) ? TRUE : FALSE); #endif } - returnCode(code); + returnBool(code); } #if NCURSES_SP_FUNCS @@ -837,7 +839,7 @@ (void *) g, (void *) b)); - if (sp != 0) { + if (sp != NULL) { int maxcolors = MaxColors; if (color >= 0 && OkColorHi(color) && sp->_coloron) { @@ -991,7 +993,7 @@ int reverse, NCURSES_SP_OUTC outc) { -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER CallDriver_4(SP_PARM, td_docolor, old_pair, pair, reverse, outc); #else int fg = COLOR_DEFAULT; @@ -1008,14 +1010,14 @@ TIPARM_1(set_color_pair, pair), 1, outc); return; - } else if (SP_PARM != 0) { + } else if (SP_PARM != NULL) { if (_nc_pair_content(SP_PARM, pair, &fg, &bg) == ERR) return; } } if (old_pair >= 0 - && SP_PARM != 0 + && SP_PARM != NULL && _nc_pair_content(SP_PARM, old_pair, &old_fg, &old_bg) != ERR) { if ((isDefaultColor(fg) && !isDefaultColor(old_fg)) || (isDefaultColor(bg) && !isDefaultColor(old_bg))) { @@ -1081,7 +1083,7 @@ } #endif -#if NCURSES_EXT_COLORS +#if NCURSES_EXT_COLORS && NCURSES_EXT_FUNCS NCURSES_EXPORT(int) NCURSES_SP_NAME(init_extended_pair) (NCURSES_SP_DCLx int pair, int f, int b) { @@ -1115,11 +1117,11 @@ NCURSES_EXPORT(void) NCURSES_SP_NAME(reset_color_pairs) (NCURSES_SP_DCL0) { - if (SP_PARM != 0) { + if (SP_PARM != NULL) { if (SP_PARM->_color_pairs) { _nc_free_ordered_pairs(SP_PARM); free(SP_PARM->_color_pairs); - SP_PARM->_color_pairs = 0; + SP_PARM->_color_pairs = NULL; SP_PARM->_pair_alloc = 0; ReservePairs(SP_PARM, 16); clearok(CurScreen(SP_PARM), TRUE); diff --git a/contrib/ncurses/ncurses/base/lib_colorset.c b/contrib/ncurses/ncurses/base/lib_colorset.c --- a/contrib/ncurses/ncurses/base/lib_colorset.c +++ b/contrib/ncurses/ncurses/base/lib_colorset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2014,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -42,7 +42,7 @@ #include #include -MODULE_ID("$Id: lib_colorset.c,v 1.16 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_colorset.c,v 1.17 2024/12/07 20:00:48 tom Exp $") NCURSES_EXPORT(int) wcolor_set(WINDOW *win, NCURSES_PAIRS_T pair_arg, void *opts) @@ -53,7 +53,7 @@ T((T_CALLED("wcolor_set(%p,%d)"), (void *) win, color_pair)); set_extended_pair(opts, color_pair); if (win - && (SP != 0) + && (SP != NULL) && (color_pair >= 0) && (color_pair < SP->_pair_limit)) { TR(TRACE_ATTRS, ("... current %ld", (long) GET_WINDOW_PAIR(win))); diff --git a/contrib/ncurses/ncurses/base/lib_delch.c b/contrib/ncurses/ncurses/base/lib_delch.c --- a/contrib/ncurses/ncurses/base/lib_delch.c +++ b/contrib/ncurses/ncurses/base/lib_delch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2001,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -41,7 +41,7 @@ #include -MODULE_ID("$Id: lib_delch.c,v 1.14 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_delch.c,v 1.16 2024/10/19 21:20:46 tom Exp $") NCURSES_EXPORT(int) wdelch(WINDOW *win) @@ -54,8 +54,8 @@ 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; + NCURSES_CH_T *temp1 = &(line->text[win->_curx]); + const NCURSES_CH_T *temp2 = temp1 + 1; CHANGED_TO_EOL(line, win->_curx, win->_maxx); while (temp1 < end) diff --git a/contrib/ncurses/ncurses/base/lib_delwin.c b/contrib/ncurses/ncurses/base/lib_delwin.c --- a/contrib/ncurses/ncurses/base/lib_delwin.c +++ b/contrib/ncurses/ncurses/base/lib_delwin.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2021,2023 Thomas E. Dickey * + * Copyright 2020-2023,2024 Thomas E. Dickey * * Copyright 1998-2008,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -43,30 +43,31 @@ #include -MODULE_ID("$Id: lib_delwin.c,v 1.25 2023/10/21 11:12:44 tom Exp $") +MODULE_ID("$Id: lib_delwin.c,v 1.29 2024/12/07 17:28:13 tom Exp $") static bool -cannot_delete(WINDOW *win) +cannot_delete(const WINDOW *win) { bool result = TRUE; + bool found = FALSE; + SCREEN *scan; + WINDOWLIST *p; - if (IS_PAD(win)) { - result = FALSE; - } else { - WINDOWLIST *p; -#if NCURSES_SP_FUNCS && defined(USE_SP_WINDOWLIST) - SCREEN *sp = _nc_screen_of(win); -#endif - - for (each_window(SP_PARM, p)) { + for (each_screen(scan)) { + for (each_window(scan, p)) { if (&(p->win) == win) { result = FALSE; + found = TRUE; + break; } else if (IS_SUBWIN(&(p->win)) && p->win._parent == win) { result = TRUE; + found = TRUE; break; } } + if (found) + break; } return result; } @@ -79,7 +80,7 @@ T((T_CALLED("delwin(%p)"), (void *) win)); if (_nc_try_global(curses) == 0) { - if (win == 0 + if (win == NULL || cannot_delete(win)) { result = ERR; } else if (IS_PAD(win)) { @@ -91,7 +92,7 @@ #endif if (IS_SUBWIN(win)) { touchwin(win->_parent); - } else if (CurScreen(SP_PARM) != 0) { + } else if (CurScreen(SP_PARM) != NULL) { touchwin(CurScreen(SP_PARM)); } result = _nc_freewin(win); diff --git a/contrib/ncurses/ncurses/base/lib_dft_fgbg.c b/contrib/ncurses/ncurses/base/lib_dft_fgbg.c --- a/contrib/ncurses/ncurses/base/lib_dft_fgbg.c +++ b/contrib/ncurses/ncurses/base/lib_dft_fgbg.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2014,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,7 +38,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_dft_fgbg.c,v 1.31 2021/04/03 22:27:18 tom Exp $") +MODULE_ID("$Id: lib_dft_fgbg.c,v 1.34 2025/12/27 12:28:45 tom Exp $") /* * Modify the behavior of color-pair 0 so that the library doesn't assume that @@ -69,17 +69,17 @@ 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 + if (SP_PARM != NULL) { +#if 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->_has_sgr_39_49 = (tigetflag(UserCap(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) { + if (SP_PARM->_color_pairs != NULL) { bool save = SP_PARM->_default_color; SP_PARM->_assumed_color = TRUE; SP_PARM->_default_color = TRUE; diff --git a/contrib/ncurses/ncurses/base/lib_driver.c b/contrib/ncurses/ncurses/base/lib_driver.c --- a/contrib/ncurses/ncurses/base/lib_driver.c +++ b/contrib/ncurses/ncurses/base/lib_driver.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 2009-2012,2014 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -34,51 +34,7 @@ #include -MODULE_ID("$Id: lib_driver.c,v 1.9 2020/08/29 19:53:35 tom Exp $") - -#ifndef EXP_WIN32_DRIVER -typedef struct DriverEntry { - const char *name; - TERM_DRIVER *driver; -} DRIVER_ENTRY; - -static DRIVER_ENTRY DriverTable[] = -{ -#ifdef _WIN32 - {"win32console", &_nc_WIN_DRIVER}, -#endif - {"tinfo", &_nc_TINFO_DRIVER} /* must be last */ -}; - -NCURSES_EXPORT(int) -_nc_get_driver(TERMINAL_CONTROL_BLOCK * TCB, const char *name, int *errret) -{ - int code = ERR; - size_t i; - TERM_DRIVER *res = (TERM_DRIVER *) 0; - TERM_DRIVER *use = 0; - - T((T_CALLED("_nc_get_driver(%p, %s, %p)"), - (void *) TCB, NonNull(name), (void *) errret)); - - assert(TCB != 0); - - for (i = 0; i < SIZEOF(DriverTable); i++) { - res = DriverTable[i].driver; - if (strcmp(DriverTable[i].name, res->td_name(TCB)) == 0) { - if (res->td_CanHandle(TCB, name, errret)) { - use = res; - break; - } - } - } - if (use != 0) { - TCB->drv = use; - code = OK; - } - returnCode(code); -} -#endif /* !EXP_WIN32_DRIVER */ +MODULE_ID("$Id: lib_driver.c,v 1.12 2025/10/18 19:20:33 tom Exp $") NCURSES_EXPORT(int) NCURSES_SP_NAME(has_key) (SCREEN *sp, int keycode) @@ -98,7 +54,7 @@ { int code = ERR; - if (0 != TerminalOf(sp)) + if (NULL != TerminalOf(sp)) code = CallDriver_2(sp, td_print, data, len); return (code); } diff --git a/contrib/ncurses/ncurses/base/lib_echo.c b/contrib/ncurses/ncurses/base/lib_echo.c --- a/contrib/ncurses/ncurses/base/lib_echo.c +++ b/contrib/ncurses/ncurses/base/lib_echo.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2023 Thomas E. Dickey * + * Copyright 2020-2023,2024 Thomas E. Dickey * * Copyright 1998-2000,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -45,13 +45,13 @@ #include -MODULE_ID("$Id: lib_echo.c,v 1.10 2023/04/29 18:57:12 tom Exp $") +MODULE_ID("$Id: lib_echo.c,v 1.11 2024/12/07 20:00:48 tom Exp $") NCURSES_EXPORT(int) NCURSES_SP_NAME(echo) (NCURSES_SP_DCL0) { T((T_CALLED("echo(%p)"), (void *) SP_PARM)); - if (0 == SP_PARM) + if (NULL == SP_PARM) returnCode(ERR); IsEcho(SP_PARM) = TRUE; returnCode(OK); @@ -69,7 +69,7 @@ NCURSES_SP_NAME(noecho) (NCURSES_SP_DCL0) { T((T_CALLED("noecho(%p)"), (void *) SP_PARM)); - if (0 == SP_PARM) + if (NULL == SP_PARM) returnCode(ERR); IsEcho(SP_PARM) = FALSE; returnCode(OK); diff --git a/contrib/ncurses/ncurses/base/lib_endwin.c b/contrib/ncurses/ncurses/base/lib_endwin.c --- a/contrib/ncurses/ncurses/base/lib_endwin.c +++ b/contrib/ncurses/ncurses/base/lib_endwin.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2023 Thomas E. Dickey * + * Copyright 2020-2023,2025 Thomas E. Dickey * * Copyright 1998-2014,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -43,7 +43,7 @@ #include -MODULE_ID("$Id: lib_endwin.c,v 1.28 2023/11/11 21:27:32 tom Exp $") +MODULE_ID("$Id: lib_endwin.c,v 1.29 2025/12/27 12:41:23 tom Exp $") NCURSES_EXPORT(int) NCURSES_SP_NAME(endwin) (NCURSES_SP_DCL0) @@ -54,7 +54,7 @@ if (SP_PARM != NULL) { if (SP_PARM->_endwin != ewSuspend) { -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER TERMINAL_CONTROL_BLOCK *TCB = TCBOf(SP_PARM); SP_PARM->_endwin = ewSuspend; diff --git a/contrib/ncurses/ncurses/base/lib_erase.c b/contrib/ncurses/ncurses/base/lib_erase.c --- a/contrib/ncurses/ncurses/base/lib_erase.c +++ b/contrib/ncurses/ncurses/base/lib_erase.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2022 Thomas E. Dickey * + * Copyright 2020-2022,2024 Thomas E. Dickey * * Copyright 1998-2009,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -42,7 +42,7 @@ #include -MODULE_ID("$Id: lib_erase.c,v 1.20 2022/09/03 21:40:27 tom Exp $") +MODULE_ID("$Id: lib_erase.c,v 1.21 2024/12/07 20:00:48 tom Exp $") NCURSES_EXPORT(int) werase(WINDOW *win) @@ -71,7 +71,7 @@ */ if_WIDEC({ if (isWidecExt(start[0])) { - int x = (win->_parent != 0) ? (win->_begx) : 0; + int x = (win->_parent != NULL) ? (win->_begx) : 0; while (x-- > 0) { if (isWidecBase(start[-1])) { --start; diff --git a/contrib/ncurses/ncurses/base/lib_flash.c b/contrib/ncurses/ncurses/base/lib_flash.c --- a/contrib/ncurses/ncurses/base/lib_flash.c +++ b/contrib/ncurses/ncurses/base/lib_flash.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2013,2014 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -47,7 +47,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_flash.c,v 1.15 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_flash.c,v 1.17 2025/12/27 12:41:23 tom Exp $") /* * flash() @@ -63,8 +63,8 @@ int res = ERR; T((T_CALLED("flash(%p)"), (void *) SP_PARM)); -#ifdef USE_TERM_DRIVER - if (SP_PARM != 0) +#if USE_TERM_DRIVER + if (SP_PARM != NULL) res = CallDriver_1(SP_PARM, td_doBeepOrFlash, FALSE); #else if (HasTerminal(SP_PARM)) { diff --git a/contrib/ncurses/ncurses/base/lib_freeall.c b/contrib/ncurses/ncurses/base/lib_freeall.c --- a/contrib/ncurses/ncurses/base/lib_freeall.c +++ b/contrib/ncurses/ncurses/base/lib_freeall.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2021,2024 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,7 +40,7 @@ extern int malloc_errfd; /* FIXME */ #endif -MODULE_ID("$Id: lib_freeall.c,v 1.76 2021/11/06 21:52:49 tom Exp $") +MODULE_ID("$Id: lib_freeall.c,v 1.78 2024/12/07 18:00:11 tom Exp $") /* * Free all ncurses data. This is used for testing only (there's no practical @@ -54,11 +54,11 @@ T((T_CALLED("_nc_freeall()"))); #if NO_LEAKS _nc_globals.leak_checking = TRUE; - if (SP_PARM != 0) { - if (SP_PARM->_oldnum_list != 0) { + if (SP_PARM != NULL) { + if (SP_PARM->_oldnum_list != NULL) { FreeAndNull(SP_PARM->_oldnum_list); } - if (SP_PARM->_panelHook.destroy != 0) { + if (SP_PARM->_panelHook.destroy != NULL) { SP_PARM->_panelHook.destroy(SP_PARM->_panelHook.stdscr_pseudo_panel); } #if NCURSES_EXT_COLORS @@ -66,10 +66,10 @@ #endif } #endif - if (SP_PARM != 0) { + if (SP_PARM != NULL) { _nc_lock_global(curses); - while (WindowList(SP_PARM) != 0) { + while (WindowList(SP_PARM) != NULL) { WINDOWLIST *p, *q; bool deleted = FALSE; @@ -87,7 +87,7 @@ #endif for (each_window(SP_PARM, q)) { - WINDOW *q_win = &(q->win); + const WINDOW *q_win = &(q->win); #ifndef USE_SP_WINDOWLIST if (q->screen != SP_PARM) @@ -119,7 +119,7 @@ _nc_unlock_global(curses); } - (void) _nc_printf_string(0, empty_va); + (void) _nc_printf_string(NULL, empty_va); #ifdef TRACE (void) _nc_trace_buf(-1, (size_t) 0); #endif diff --git a/contrib/ncurses/ncurses/base/lib_getch.c b/contrib/ncurses/ncurses/base/lib_getch.c --- a/contrib/ncurses/ncurses/base/lib_getch.c +++ b/contrib/ncurses/ncurses/base/lib_getch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2015,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -44,7 +44,7 @@ #define NEED_KEY_EVENT #include -MODULE_ID("$Id: lib_getch.c,v 1.146 2023/04/29 18:57:12 tom Exp $") +MODULE_ID("$Id: lib_getch.c,v 1.154 2025/12/27 12:28:45 tom Exp $") #include @@ -134,17 +134,6 @@ 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. */ @@ -153,22 +142,16 @@ { int rc; -#ifdef USE_TERM_DRIVER +#if 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 USE_NAMED_PIPES || defined(_NC_WINDOWS_NATIVE) /* 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 */ @@ -179,7 +162,7 @@ } else # endif { -# if defined(EXP_WIN32_DRIVER) +# if USE_NAMED_PIPES rc = _nc_console_testmouse(sp, _nc_console_handle(sp->_ifd), delay @@ -289,7 +272,7 @@ n = 1; } else #endif -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER if ((sp->_mouse_type == M_TERM_DRIVER) && (sp->_drv_mouse_head < sp->_drv_mouse_tail)) { sp->_mouse_event(sp); @@ -305,9 +288,9 @@ } else #endif { /* Can block... */ -#if defined(USE_TERM_DRIVER) +#if USE_TERM_DRIVER int buf; -# if defined(EXP_WIN32_DRIVER) +# if USE_NAMED_PIPES || defined(_NC_WINDOWS_NATIVE) if (NC_ISATTY(sp->_ifd) && IsTermInfoOnConsole(sp) && IsCbreak(sp)) { _nc_set_read_thread(TRUE); n = _nc_console_read(sp, @@ -315,23 +298,17 @@ &buf); _nc_set_read_thread(FALSE); } else -# elif defined(_NC_WINDOWS) - if (NC_ISATTY(sp->_ifd) && IsTermInfoOnConsole(sp) && IsCbreak(sp)) - n = _nc_mingw_console_read(sp, - _nc_get_handle(sp->_ifd), - &buf); - else -# endif /* EXP_WIN32_DRIVER */ +# endif /* USE_NAMED_PIPES */ n = CallDriver_1(sp, td_read, &buf); ch = buf; #else /* !USE_TERM_DRIVER */ -#if defined(EXP_WIN32_DRIVER) +#if USE_NAMED_PIPES int buf; #endif unsigned char c2 = 0; _nc_set_read_thread(TRUE); -#if defined(EXP_WIN32_DRIVER) +#if USE_NAMED_PIPES n = _nc_console_read(sp, _nc_console_handle(sp->_ifd), &buf); @@ -414,7 +391,7 @@ SCREEN *sp = _nc_screen_of(win); int rc; - if (sp != 0) { + if (sp != NULL) { #ifdef USE_PTHREADS if (_nc_use_pthreads && sp != CURRENT_SCREEN) { SCREEN *save_SP; @@ -457,7 +434,7 @@ *result = 0; sp = _nc_screen_of(win); - if (win == 0 || sp == 0) { + if (win == NULL || sp == NULL) { returnCode(ERR); } @@ -513,7 +490,7 @@ recur_wrefresh(win); - if (win->_notimeout || (win->_delay >= 0) || (IsCbreak(sp) > 1)) { + if ((win->_delay >= 0) || (IsCbreak(sp) > 1)) { if (head == -1) { /* fifo is empty */ int delay; diff --git a/contrib/ncurses/ncurses/base/lib_getstr.c b/contrib/ncurses/ncurses/base/lib_getstr.c --- a/contrib/ncurses/ncurses/base/lib_getstr.c +++ b/contrib/ncurses/ncurses/base/lib_getstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2021,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2011,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -42,14 +42,14 @@ #define NEED_KEY_EVENT #include -MODULE_ID("$Id: lib_getstr.c,v 1.39 2023/04/29 19:00:17 tom Exp $") +MODULE_ID("$Id: lib_getstr.c,v 1.42 2025/01/19 00:51:54 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) +WipeOut(WINDOW *win, int y, int x, const char *first, char *last, int echoed) { if (last > first) { *--last = '\0'; @@ -81,11 +81,11 @@ TTY_FLAGS save_flags; char erasec; char killc; - char *oldstr; + const char *oldstr; int ch; int y, x; - T((T_CALLED("wgetnstr(%p,%p,%d)"), (void *) win, (void *) str, maxlen)); + T((T_CALLED("wgetnstr_events(%p,%p,%d)"), (void *) win, (void *) str, maxlen)); if (!win || !str) returnCode(ERR); @@ -195,7 +195,7 @@ if (ch == ERR) returnCode(ch); - T(("wgetnstr returns %s", _nc_visbuf(oldstr))); + T(("wgetnstr_events returns %s", _nc_visbuf(oldstr))); #ifdef KEY_EVENT if (ch == KEY_EVENT) diff --git a/contrib/ncurses/ncurses/base/lib_initscr.c b/contrib/ncurses/ncurses/base/lib_initscr.c --- a/contrib/ncurses/ncurses/base/lib_initscr.c +++ b/contrib/ncurses/ncurses/base/lib_initscr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 2019-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -46,7 +46,7 @@ #include /* needed for ISC */ #endif -MODULE_ID("$Id: lib_initscr.c,v 1.48 2020/09/07 14:26:48 tom Exp $") +MODULE_ID("$Id: lib_initscr.c,v 1.52 2025/03/09 00:49:14 tom Exp $") NCURSES_EXPORT(WINDOW *) initscr(void) @@ -70,7 +70,8 @@ (void) VALID_TERM_ENV(env, "unknown"); if ((name = strdup(env)) == NULL) { - fprintf(stderr, "Error opening allocating $TERM.\n"); + fprintf(stderr, "ncurses: cannot allocate %d bytes of" + "memory for $TERM; exiting\n", (int) strlen(env)); ExitProgram(EXIT_FAILURE); } #ifdef __CYGWIN__ @@ -90,8 +91,9 @@ } } #endif - if (newterm(name, stdout, stdin) == 0) { - fprintf(stderr, "Error opening terminal: %s.\n", name); + if (newterm(name, stdout, stdin) == NULL) { + fprintf(stderr, "ncurses: cannot initialize terminal type" + " ($TERM=\"%s\"); exiting\n", name); ExitProgram(EXIT_FAILURE); } diff --git a/contrib/ncurses/ncurses/base/lib_insch.c b/contrib/ncurses/ncurses/base/lib_insch.c --- a/contrib/ncurses/ncurses/base/lib_insch.c +++ b/contrib/ncurses/ncurses/base/lib_insch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2013,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -44,7 +44,7 @@ #include #include -MODULE_ID("$Id: lib_insch.c,v 1.37 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_insch.c,v 1.39 2024/12/07 17:40:33 tom Exp $") /* * Insert the given character, updating the current location to simplify @@ -85,12 +85,12 @@ #endif (isprint(ch8) || (ChAttrOf(ch) & A_ALTCHARSET) || - (sp != 0 && sp->_legacy_coding && !iscntrl(ch8)))) { + (sp != NULL && 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; + const NCURSES_CH_T *temp2 = temp1 - 1; SetChar2(wch, ch); @@ -151,7 +151,7 @@ T((T_CALLED("winsch(%p, %s)"), (void *) win, _tracechtype(c))); - if (win != 0) { + if (win != NULL) { NCURSES_SIZE_T oy = win->_cury; NCURSES_SIZE_T ox = win->_curx; diff --git a/contrib/ncurses/ncurses/base/lib_insnstr.c b/contrib/ncurses/ncurses/base/lib_insnstr.c --- a/contrib/ncurses/ncurses/base/lib_insnstr.c +++ b/contrib/ncurses/ncurses/base/lib_insnstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2023,2024 Thomas E. Dickey * * Copyright 2004-2009,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -41,7 +41,7 @@ #include #include -MODULE_ID("$Id: lib_insnstr.c,v 1.10 2023/11/21 21:58:03 tom Exp $") +MODULE_ID("$Id: lib_insnstr.c,v 1.11 2024/12/07 20:00:48 tom Exp $") NCURSES_EXPORT(int) winsnstr(WINDOW *win, const char *s, int n) @@ -51,7 +51,7 @@ T((T_CALLED("winsnstr(%p,%s,%d)"), (void *) win, _nc_visbufn(s, n), n)); - if (win != 0 && str != 0 && n != 0) { + if (win != NULL && str != NULL && n != 0) { SCREEN *sp = _nc_screen_of(win); #if USE_WIDEC_SUPPORT /* @@ -64,7 +64,7 @@ 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) { + if (buffer != NULL) { mbstate_t state; size_t n3; init_mb(state); diff --git a/contrib/ncurses/ncurses/base/lib_instr.c b/contrib/ncurses/ncurses/base/lib_instr.c --- a/contrib/ncurses/ncurses/base/lib_instr.c +++ b/contrib/ncurses/ncurses/base/lib_instr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2021,2023 Thomas E. Dickey * + * Copyright 2020-2023,2024 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -42,7 +42,7 @@ #include -MODULE_ID("$Id: lib_instr.c,v 1.26 2023/06/03 12:37:04 tom Exp $") +MODULE_ID("$Id: lib_instr.c,v 1.28 2024/12/07 17:53:39 tom Exp $") NCURSES_EXPORT(int) winnstr(WINDOW *win, char *str, int n) @@ -63,7 +63,7 @@ for (; i < n;) { #if USE_WIDEC_SUPPORT - cchar_t *cell = &(text[col]); + const cchar_t *cell = &(text[col]); attr_t attrs; NCURSES_PAIRS_T pair; char *tmp; @@ -72,17 +72,17 @@ wchar_t *wch; int n2; - n2 = getcchar(cell, 0, 0, 0, 0); + n2 = getcchar(cell, NULL, NULL, NULL, NULL); if (n2 > 0 - && (wch = typeCalloc(wchar_t, (unsigned) n2 + 1)) != 0) { + && (wch = typeCalloc(wchar_t, (unsigned) n2 + 1)) != NULL) { bool done = FALSE; - if (getcchar(cell, wch, &attrs, &pair, 0) == OK) { + if (getcchar(cell, wch, &attrs, &pair, NULL) == OK) { mbstate_t state; size_t n3; init_mb(state); - n3 = wcstombs(0, wch, (size_t) 0); + n3 = wcstombs(NULL, wch, (size_t) 0); if (!isEILSEQ(n3) && (n3 != 0) && (n3 <= MB_LEN_MAX)) { size_t need = n3 + 10 + (size_t) i; int have = (int) n3 + i; @@ -90,7 +90,7 @@ /* check for loop-done as well as overflow */ if (have > n || (int) need <= 0) { done = TRUE; - } else if ((tmp = typeCalloc(char, need)) == 0) { + } else if ((tmp = typeCalloc(char, need)) == NULL) { done = TRUE; } else { size_t i3; diff --git a/contrib/ncurses/ncurses/base/lib_mouse.c b/contrib/ncurses/ncurses/base/lib_mouse.c --- a/contrib/ncurses/ncurses/base/lib_mouse.c +++ b/contrib/ncurses/ncurses/base/lib_mouse.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2023,2024 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -44,7 +44,7 @@ * sysmouse (FreeBSD) * special-purpose mouse interface for OS/2 EMX. * - * Notes for implementors of new mouse-interface methods: + * Notes for implementers 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 @@ -70,7 +70,6 @@ */ #ifdef __EMX__ -# include # define INCL_DOS # define INCL_VIO # define INCL_KBD @@ -85,7 +84,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_mouse.c,v 1.200 2024/02/17 21:13:01 tom Exp $") +MODULE_ID("$Id: lib_mouse.c,v 1.219 2025/12/30 17:23:24 tom Exp $") #include @@ -380,7 +379,7 @@ } #endif /* USE_SYSMOUSE */ -#if !defined(USE_TERM_DRIVER) || defined(EXP_WIN32_DRIVER) +#if !defined(_NC_WINDOWS_NATIVE) || USE_NAMED_PIPES #define xterm_kmous "\033[M" static void @@ -388,10 +387,10 @@ { sp->_mouse_type = M_XTERM; sp->_mouse_format = MF_X10; - sp->_mouse_xtermcap = tigetstr("XM"); + sp->_mouse_xtermcap = tigetstr(UserCap(XM)); if (VALID_STRING(sp->_mouse_xtermcap)) { char *code = strstr(sp->_mouse_xtermcap, "[?"); - if (code != 0) { + if (code != NULL) { code += 2; while ((*code >= '0') && (*code <= '9')) { char *next = code; @@ -417,7 +416,7 @@ } } } else { - int code = tigetnum("XM"); + int code = tigetnum(UserCap(XM)); switch (code) { #ifdef EXP_XTERM_1005 case 1005: @@ -440,7 +439,7 @@ #endif static void -enable_xterm_mouse(SCREEN *sp, int enable) +enable_xterm_mouse(SCREEN *sp, bool enable) { TPUTS_TRACE(enable ? "xterm mouse initialization" @@ -453,11 +452,11 @@ sp->_mouse_active = enable; } -#if defined(USE_TERM_DRIVER) +#if USE_TERM_DRIVER static void -enable_win32_mouse(SCREEN *sp, int enable) +enable_win32_mouse(SCREEN *sp, bool enable) { -#if defined(EXP_WIN32_DRIVER) +#if USE_NAMED_PIPES enable_xterm_mouse(sp, enable); #else sp->_mouse_active = enable; @@ -483,9 +482,9 @@ 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, "|:"); + if (list != NULL) { + if (env != NULL) { + result = _nc_name_match(list, env, "|:") ? TRUE : FALSE; } } else { /* GPM checks the beginning of the $TERM variable to decide if it @@ -495,7 +494,7 @@ * capability. Perhaps that works for someone. If so, they can * set the environment variable (above). */ - if (env != 0 && strstr(env, "linux") != 0) { + if (env != NULL && strstr(env, "linux") != NULL) { result = TRUE; } } @@ -507,7 +506,7 @@ static void unload_gpm_library(SCREEN *sp) { - if (sp->_dlopen_gpm != 0) { + if (sp->_dlopen_gpm != NULL) { T(("unload GPM library")); sp->_mouse_gpm_loaded = FALSE; sp->_mouse_fd = -1; @@ -522,25 +521,25 @@ /* * If we already had a successful dlopen, reuse it. */ - if (sp->_dlopen_gpm != 0) { + if (sp->_dlopen_gpm != NULL) { sp->_mouse_gpm_found = TRUE; sp->_mouse_gpm_loaded = TRUE; - } else if ((sp->_dlopen_gpm = dlopen(LIBGPM_SONAME, my_RTLD)) != 0) { + } else if ((sp->_dlopen_gpm = dlopen(LIBGPM_SONAME, my_RTLD)) != NULL) { #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 (GET_DLSYM(gpm_fd) == NULL || + GET_DLSYM(Gpm_Open) == NULL || + GET_DLSYM(Gpm_Close) == NULL || + GET_DLSYM(Gpm_GetEvent) == NULL) { #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; + sp->_dlopen_gpm = NULL; } else { sp->_mouse_gpm_found = TRUE; sp->_mouse_gpm_loaded = TRUE; @@ -754,14 +753,15 @@ } #endif /* USE_SYSMOUSE */ -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER CallDriver(sp, td_initmouse); #endif -#if !defined(USE_TERM_DRIVER) || defined(EXP_WIN32_DRIVER) +#if !defined(_NC_WINDOWS_NATIVE) || USE_NAMED_PIPES /* 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) { + } else if (SP_TERMTYPE term_names != NULL + && strstr(SP_TERMTYPE term_names, "xterm") != NULL) { if (_nc_add_to_try(&(sp->_keytry), xterm_kmous, KEY_MOUSE) == OK) init_xterm_mouse(sp); } @@ -778,7 +778,7 @@ T((T_CALLED("_nc_mouse_init(%p)"), (void *) sp)); - if (sp != 0) { + if (sp != NULL) { if (!sp->_mouse_initialized) { int i; @@ -786,7 +786,7 @@ TR(MY_TRACE, ("set _mouse_initialized")); - sp->_mouse_eventp = FirstEV(sp); + sp->_mouse_readp = sp->_mouse_writep = FirstEV(sp); for (i = 0; i < EV_MAX; i++) Invalidate(sp->_mouse_events + i); @@ -796,7 +796,7 @@ } result = sp->_mouse_initialized; } - returnCode(result); + returnBool(result); } /* @@ -806,7 +806,7 @@ static bool _nc_mouse_event(SCREEN *sp) { - MEVENT *eventp = sp->_mouse_eventp; + MEVENT *eventp = sp->_mouse_writep; bool result = FALSE; (void) eventp; @@ -874,7 +874,7 @@ eventp->z = 0; /* bump the next-free pointer into the circular list */ - sp->_mouse_eventp = NEXT(eventp); + sp->_mouse_writep = NEXT(eventp); result = TRUE; break; } @@ -899,13 +899,13 @@ } /* bump the next-free pointer into the circular list */ - sp->_mouse_eventp = eventp = NEXT(eventp); + sp->_mouse_writep = eventp = NEXT(eventp); result = TRUE; } break; #endif /* USE_SYSMOUSE */ -#ifdef USE_TERM_DRIVER +#if 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]; @@ -921,7 +921,7 @@ } /* bump the next-free pointer into the circular list */ - sp->_mouse_eventp = eventp = NEXT(eventp); + sp->_mouse_writep = eventp = NEXT(eventp); result = TRUE; } break; @@ -984,7 +984,12 @@ } break; case 2: - PRESS_POSITION(3); + if (wheel) { + /* Ignore this event as it is not a true press of the button */ + eventp->bstate = REPORT_MOUSE_POSITION; + } else { + PRESS_POSITION(3); + } break; default: /* @@ -1114,7 +1119,7 @@ sp->_ifd, #endif kbuf + grabbed, (size_t) (MAX_KBUF - (int) grabbed)); - if (res == -1) + if (res < 0) break; } _nc_set_read_thread(FALSE); @@ -1162,7 +1167,7 @@ sp->_ifd, #endif (kbuf + grabbed), (size_t) 1); - if (res == -1) + if (res < 0) break; grabbed += (size_t) res; if (grabbed > 1) { @@ -1219,7 +1224,7 @@ } SGR_DATA; static bool -read_SGR(SCREEN *sp, SGR_DATA * result) +read_SGR(const SCREEN *sp, SGR_DATA * result) { char kbuf[80]; /* bigger than any possible mouse response */ int grabbed = 0; @@ -1240,7 +1245,7 @@ sp->_ifd, #endif (kbuf + grabbed), (size_t) 1); - if (res == -1) + if (res < 0) break; if ((grabbed + MAX_KBUF) >= (int) sizeof(kbuf)) { result->nerror++; @@ -1355,9 +1360,9 @@ /* mouse report received in the keyboard stream -- parse its info */ { bool result = FALSE; - MEVENT *eventp = sp->_mouse_eventp; + MEVENT *eventp = sp->_mouse_writep; - TR(MY_TRACE, ("_nc_mouse_inline() called")); + TR(MY_TRACE, (T_CALLED("_nc_mouse_inline(%p)"), (void *) sp)); if (sp->_mouse_type == M_XTERM) { switch (sp->_mouse_format) { @@ -1380,7 +1385,7 @@ (long) IndexEV(sp, eventp))); /* bump the next-free pointer into the circular list */ - sp->_mouse_eventp = NEXT(eventp); + sp->_mouse_writep = NEXT(eventp); if (!result) { /* If this event is from a wheel-mouse, treat it like position @@ -1400,11 +1405,11 @@ } } - return (result); + returnCode(result); } static void -mouse_activate(SCREEN *sp, int on) +mouse_activate(SCREEN *sp, bool on) { T((T_CALLED("mouse_activate(%p,%s)"), (void *) SP_PARM, on ? "on" : "off")); @@ -1422,7 +1427,7 @@ #if NCURSES_EXT_FUNCS NCURSES_SP_NAME(keyok) (NCURSES_SP_ARGx KEY_MOUSE, on); #endif - enable_xterm_mouse(sp, 1); + enable_xterm_mouse(sp, TRUE); break; #if USE_GPM_SUPPORT case M_GPM: @@ -1438,7 +1443,7 @@ sp->_mouse_active = TRUE; break; #endif -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER case M_TERM_DRIVER: enable_win32_mouse(sp, TRUE); break; @@ -1462,7 +1467,7 @@ switch (sp->_mouse_type) { case M_XTERM: - enable_xterm_mouse(sp, 0); + enable_xterm_mouse(sp, FALSE); break; #if USE_GPM_SUPPORT case M_GPM: @@ -1475,7 +1480,7 @@ sp->_mouse_active = FALSE; break; #endif -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER case M_TERM_DRIVER: enable_win32_mouse(sp, FALSE); break; @@ -1501,7 +1506,7 @@ _nc_mouse_parse(SCREEN *sp, int runcount) /* parse a run of atomic mouse events into a gesture */ { - MEVENT *eventp = sp->_mouse_eventp; + MEVENT *eventp = sp->_mouse_writep; MEVENT *next, *ep; MEVENT *first_valid = NULL; MEVENT *first_invalid = NULL; @@ -1510,7 +1515,14 @@ bool merge; bool endLoop; - TR(MY_TRACE, ("_nc_mouse_parse(%d) called", runcount)); + TR(MY_TRACE, (T_CALLED("_nc_mouse_parse(%d)"), runcount)); + + if (!sp->_maxclick + && sp->_mouse_readp != NULL + && ValidEvent(sp->_mouse_readp) + && ((sp->_mouse_readp->bstate & sp->_mouse_mask) != 0)) { + returnCode(1); + } /* * When we enter this routine, the event list next-free pointer @@ -1723,7 +1735,7 @@ if (first_invalid == NULL) { first_invalid = eventp; } - sp->_mouse_eventp = first_invalid; + sp->_mouse_writep = first_invalid; #ifdef TRACE if (first_valid != NULL) { @@ -1746,7 +1758,7 @@ /* after all this, do we have a valid event? */ ep = PREV(first_invalid); - return ValidEvent(ep) && ((ep->bstate & sp->_mouse_mask) != 0); + returnCode(ValidEvent(ep) && ((ep->bstate & sp->_mouse_mask) != 0)); } static void @@ -1772,7 +1784,7 @@ mouse_activate(sp, FALSE); break; #endif -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER case M_TERM_DRIVER: mouse_activate(sp, FALSE); break; @@ -1809,7 +1821,7 @@ break; #endif -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER case M_TERM_DRIVER: mouse_activate(sp, TRUE); break; @@ -1830,36 +1842,34 @@ NCURSES_SP_NAME(getmouse) (NCURSES_SP_DCLx MEVENT * aevent) { int result = ERR; - MEVENT *eventp; + MEVENT *readp; T((T_CALLED("getmouse(%p,%p)"), (void *) SP_PARM, (void *) aevent)); - if ((aevent != 0) && - (SP_PARM != 0) && + if ((aevent != NULL) && + (SP_PARM != NULL) && (SP_PARM->_mouse_type != M_NONE) && - (eventp = SP_PARM->_mouse_eventp) != 0) { - /* compute the current-event pointer */ - MEVENT *prev = PREV(eventp); - + (readp = SP_PARM->_mouse_readp) != NULL) { /* * 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); + while (readp != SP_PARM->_mouse_writep && + (!ValidEvent(readp) || !(readp->bstate & SP_PARM->_mouse_mask2))) { + Invalidate(readp); + readp = NEXT(readp); } - if (ValidEvent(prev)) { + if (readp != SP_PARM->_mouse_writep && ValidEvent(readp)) { /* copy the event we find there */ - *aevent = *prev; + *aevent = *readp; TR(TRACE_IEVENT, ("getmouse: returning event %s from slot %ld", - _nc_tracemouse(SP_PARM, prev), - (long) IndexEV(SP_PARM, prev))); + _nc_tracemouse(SP_PARM, readp), + (long) IndexEV(SP_PARM, readp))); - Invalidate(prev); /* so the queue slot becomes free */ - SP_PARM->_mouse_eventp = prev; + Invalidate(readp); /* so the queue slot becomes free */ + SP_PARM->_mouse_readp = NEXT(readp); result = OK; } else { /* Reset the provided event */ @@ -1890,15 +1900,15 @@ T((T_CALLED("ungetmouse(%p,%p)"), (void *) SP_PARM, (void *) aevent)); - if (aevent != 0 && - SP_PARM != 0 && - (eventp = SP_PARM->_mouse_eventp) != 0) { + if (aevent != NULL && + SP_PARM != NULL && + (eventp = SP_PARM->_mouse_writep) != NULL) { /* 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); + SP_PARM->_mouse_writep = NEXT(eventp); /* push back the notification event on the keyboard queue */ result = NCURSES_SP_NAME(ungetch) (NCURSES_SP_ARGx KEY_MOUSE); @@ -1926,7 +1936,7 @@ (unsigned long) newmask, (void *) oldmask)); - if (SP_PARM != 0) { + if (SP_PARM != NULL) { if (oldmask) *oldmask = SP_PARM->_mouse_mask; @@ -1988,7 +1998,7 @@ T((T_CALLED("wenclose(%p,%d,%d)"), (const void *) win, y, x)); - if (win != 0) { + if (win != NULL) { y -= win->_yoffset; if (IS_PAD(win)) { if (win->_pad._pad_y >= 0 && @@ -2020,7 +2030,7 @@ T((T_CALLED("mouseinterval(%p,%d)"), (void *) SP_PARM, maxclick)); - if (SP_PARM != 0) { + if (SP_PARM != NULL) { oldval = SP_PARM->_maxclick; if (maxclick >= 0) SP_PARM->_maxclick = maxclick; @@ -2042,9 +2052,9 @@ /* This may be used by other routines to ask for the existence of mouse support */ NCURSES_EXPORT(bool) -_nc_has_mouse(SCREEN *sp) +_nc_has_mouse(const SCREEN *sp) { - return (((0 == sp) || (sp->_mouse_type == M_NONE)) ? FALSE : TRUE); + return (((NULL == sp) || (sp->_mouse_type == M_NONE)) ? FALSE : TRUE); } NCURSES_EXPORT(bool) diff --git a/contrib/ncurses/ncurses/base/lib_mvwin.c b/contrib/ncurses/ncurses/base/lib_mvwin.c --- a/contrib/ncurses/ncurses/base/lib_mvwin.c +++ b/contrib/ncurses/ncurses/base/lib_mvwin.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -43,13 +43,13 @@ #include -MODULE_ID("$Id: lib_mvwin.c,v 1.20 2021/10/23 18:57:41 tom Exp $") +MODULE_ID("$Id: lib_mvwin.c,v 1.21 2024/07/27 19:23:59 tom Exp $") NCURSES_EXPORT(int) mvwin(WINDOW *win, int by, int bx) { #if NCURSES_SP_FUNCS - SCREEN *sp = _nc_screen_of(win); + const SCREEN *sp = _nc_screen_of(win); #endif T((T_CALLED("mvwin(%p,%d,%d)"), (void *) win, by, bx)); diff --git a/contrib/ncurses/ncurses/base/lib_newterm.c b/contrib/ncurses/ncurses/base/lib_newterm.c --- a/contrib/ncurses/ncurses/base/lib_newterm.c +++ b/contrib/ncurses/ncurses/base/lib_newterm.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2022 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -49,9 +49,9 @@ #include -MODULE_ID("$Id: lib_newterm.c,v 1.104 2022/07/09 18:58:58 tom Exp $") +MODULE_ID("$Id: lib_newterm.c,v 1.110 2025/12/27 12:28:45 tom Exp $") -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER #define NumLabels InfoOf(SP_PARM).numlabels #else #define NumLabels num_labels @@ -88,7 +88,7 @@ buf.c_oflag &= (unsigned) ~(ONLCR); #elif HAVE_SGTTY_H buf.sg_flags &= ~(ECHO | CRMOD); -#elif defined(EXP_WIN32_DRIVER) +#elif USE_NAMED_PIPES buf.dwFlagIn = CONMODE_IN_DEFAULT; buf.dwFlagOut = CONMODE_OUT_DEFAULT | VT_FLAG_OUT; if (WINCONSOLE.isTermInfoConsole) { @@ -175,12 +175,12 @@ FILE *ifp) { int errret; - SCREEN *result = 0; + SCREEN *result = NULL; SCREEN *current; TERMINAL *its_term; FILE *_ofp = ofp ? ofp : stdout; FILE *_ifp = ifp ? ifp : stdin; - TERMINAL *new_term = 0; + TERMINAL *new_term = NULL; START_TRACE(); T((T_CALLED("newterm(%p, \"%s\", %p,%p)"), @@ -190,8 +190,8 @@ (void *) ifp)); #if NCURSES_SP_FUNCS - assert(SP_PARM != 0); - if (SP_PARM == 0) + assert(SP_PARM != NULL); + if (SP_PARM == NULL) returnSP(SP_PARM); #endif @@ -199,9 +199,9 @@ _nc_lock_global(curses); current = CURRENT_SCREEN; - its_term = (current ? current->_term : 0); + its_term = (current ? current->_term : NULL); -#if defined(EXP_WIN32_DRIVER) +#if USE_NAMED_PIPES _setmode(fileno(_ifp), _O_BINARY); _setmode(fileno(_ofp), _O_BINARY); #endif @@ -212,11 +212,11 @@ TINFO_SETUP_TERM(&new_term, name, fileno(_ofp), &errret, FALSE) != ERR) { int slk_format; - int filter_mode; + bool filter_mode; - _nc_set_screen(0); -#ifdef USE_TERM_DRIVER - assert(new_term != 0); + _nc_set_screen(NULL); +#if USE_TERM_DRIVER + assert(new_term != NULL); #endif #if NCURSES_SP_FUNCS @@ -241,19 +241,19 @@ filter_mode, slk_format) == ERR) { _nc_set_screen(current); - result = 0; + result = NULL; } else { int value; int cols; -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER TERMINAL_CONTROL_BLOCK *TCB; #elif !NCURSES_SP_FUNCS _nc_set_screen(CURRENT_SCREEN); #endif - assert(SP_PARM != 0); + assert(SP_PARM != NULL); cols = *(ptrCols(SP_PARM)); -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER _nc_set_screen(SP_PARM); TCB = (TERMINAL_CONTROL_BLOCK *) new_term; TCB->csp = SP_PARM; @@ -271,7 +271,7 @@ if (current) current->_term = its_term; -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER SP_PARM->_term = new_term; #else new_term = SP_PARM->_term; @@ -279,6 +279,7 @@ /* allow user to set maximum escape delay from the environment */ if ((value = _nc_getenv_num("ESCDELAY")) >= 0) { + value = Min(value, MAX_DELAY_MSECS); #if NCURSES_EXT_FUNCS NCURSES_SP_NAME(set_escdelay) (NCURSES_SP_ARGx value); #else @@ -300,7 +301,7 @@ SP_PARM->_use_meta = FALSE; #endif SP_PARM->_endwin = ewInitial; -#ifndef USE_TERM_DRIVER +#if !USE_TERM_DRIVER /* * Check whether we can optimize scrolling under dumb terminals in * case we do not have any of these capabilities, scrolling @@ -317,10 +318,10 @@ NCURSES_SP_NAME(baudrate) (NCURSES_SP_ARG); /* sets a field in the screen structure */ - SP_PARM->_keytry = 0; + SP_PARM->_keytry = NULL; /* compute movement costs so we can do better move optimization */ -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER TCBOf(SP_PARM)->drv->td_scinit(SP_PARM); #else /* ! USE_TERM_DRIVER */ /* @@ -332,7 +333,7 @@ * 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)) +#define SGR0_TEST(mode) (mode != NULL) && (exit_attribute_mode == NULL || 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 diff --git a/contrib/ncurses/ncurses/base/lib_newwin.c b/contrib/ncurses/ncurses/base/lib_newwin.c --- a/contrib/ncurses/ncurses/base/lib_newwin.c +++ b/contrib/ncurses/ncurses/base/lib_newwin.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -44,18 +44,18 @@ #include #include -MODULE_ID("$Id: lib_newwin.c,v 1.76 2021/10/23 18:53:38 tom Exp $") +MODULE_ID("$Id: lib_newwin.c,v 1.79 2024/12/14 23:50:18 tom Exp $") #define window_is(name) ((sp)->_##name == win) #if USE_REENTRANT #define remove_window(name) \ - sp->_##name = 0 + sp->_##name = NULL #else #define remove_window(name) \ - sp->_##name = 0; \ + sp->_##name = NULL; \ if (win == name) \ - name = 0 + name = NULL #endif static void @@ -64,7 +64,7 @@ SCREEN *sp; #ifdef USE_SP_WINDOWLIST - if ((sp = _nc_screen_of(win)) != 0) { + if ((sp = _nc_screen_of(win)) != NULL) { if (window_is(curscr)) { remove_window(curscr); } else if (window_is(stdscr)) { @@ -99,17 +99,17 @@ T((T_CALLED("_nc_freewin(%p)"), (void *) win)); - if (win != 0) { + if (win != NULL) { if (_nc_nonsp_try_global(curses) == 0) { WINDOWLIST *p, *q; - q = 0; + q = NULL; for (each_window(sp, p)) { if (&(p->win) == win) { remove_window_from_screen(win); - if (q == 0) + if (q == NULL) WindowList(sp) = p->next; else q->next = p->next; @@ -150,8 +150,8 @@ || begx < 0 || num_lines < 0 || num_columns < 0 - || SP_PARM == 0) - returnWin(0); + || SP_PARM == NULL) + returnWin(NULL); if (num_lines == 0) num_lines = SP_PARM->_lines_avail - begy; @@ -160,14 +160,14 @@ win = NCURSES_SP_NAME(_nc_makenew) (NCURSES_SP_ARGx num_lines, num_columns, begy, begx, 0); - if (win == 0) - returnWin(0); + if (win == NULL) + returnWin(NULL); for (i = 0; i < num_lines; i++) { win->_line[i].text = typeCalloc(NCURSES_CH_T, (unsigned) num_columns); - if (win->_line[i].text == 0) { + if (win->_line[i].text == NULL) { (void) _nc_freewin(win); - returnWin(0); + returnWin(NULL); } for (ptr = win->_line[i].text; ptr < win->_line[i].text + num_columns; @@ -207,11 +207,14 @@ /* * 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 + if (begy < 0 + || begx < 0 + || orig == NULL + || num_lines < 0 + || num_columns < 0 + || begy + num_lines > orig->_maxy + 1 || begx + num_columns > orig->_maxx + 1) - returnWin(0); + returnWin(NULL); if (num_lines == 0) num_lines = orig->_maxy + 1 - begy; @@ -225,8 +228,8 @@ 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); + if (win == NULL) + returnWin(NULL); win->_pary = begy; win->_parx = begx; @@ -244,10 +247,10 @@ NCURSES_EXPORT(WINDOW *) subwin(WINDOW *w, int l, int c, int y, int x) { - WINDOW *result = 0; + WINDOW *result = NULL; T((T_CALLED("subwin(%p, %d, %d, %d, %d)"), (void *) w, l, c, y, x)); - if (w != 0) { + if (w != NULL) { T(("parent has begy = %ld, begx = %ld", (long) w->_begy, (long) w->_begx)); result = derwin(w, l, c, y - w->_begy, x - w->_begx); @@ -255,13 +258,6 @@ 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, @@ -278,20 +274,20 @@ 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 (SP_PARM == NULL) + returnWin(NULL); - if (!dimension_limit(num_lines) || !dimension_limit(num_columns)) - returnWin(0); + if (!OK_DIMENSION(num_lines) || !OK_DIMENSION(num_columns)) + returnWin(NULL); - if ((wp = typeCalloc(WINDOWLIST, 1)) == 0) - returnWin(0); + if ((wp = typeCalloc(WINDOWLIST, 1)) == NULL) + returnWin(NULL); win = &(wp->win); - if ((win->_line = typeCalloc(struct ldat, ((unsigned) num_lines))) == 0) { + if ((win->_line = typeCalloc(struct ldat, ((unsigned) num_lines))) == NULL) { free(wp); - returnWin(0); + returnWin(NULL); } _nc_nonsp_lock_global(curses); @@ -322,7 +318,7 @@ win->_sync = 0; win->_parx = -1; win->_pary = -1; - win->_parent = 0; + win->_parent = NULL; win->_regtop = 0; win->_regbottom = (NCURSES_SIZE_T) (num_lines - 1); @@ -389,18 +385,18 @@ NCURSES_EXPORT(WINDOW *) _nc_curscr_of(SCREEN *sp) { - return (sp == 0) ? NULL : CurScreen(sp); + return (sp == NULL) ? NULL : CurScreen(sp); } NCURSES_EXPORT(WINDOW *) _nc_newscr_of(SCREEN *sp) { - return (sp == 0) ? NULL : NewScreen(sp); + return (sp == NULL) ? NULL : NewScreen(sp); } NCURSES_EXPORT(WINDOW *) _nc_stdscr_of(SCREEN *sp) { - return (sp == 0) ? NULL : StdScreen(sp); + return (sp == NULL) ? NULL : StdScreen(sp); } #endif diff --git a/contrib/ncurses/ncurses/base/lib_nl.c b/contrib/ncurses/ncurses/base/lib_nl.c --- a/contrib/ncurses/ncurses/base/lib_nl.c +++ b/contrib/ncurses/ncurses/base/lib_nl.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2023 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2000,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -45,17 +45,13 @@ #include -MODULE_ID("$Id: lib_nl.c,v 1.14 2023/04/29 18:51:49 tom Exp $") - -#ifdef __EMX__ -#include -#endif +MODULE_ID("$Id: lib_nl.c,v 1.16 2025/06/21 14:27:02 tom Exp $") NCURSES_EXPORT(int) NCURSES_SP_NAME(nl) (NCURSES_SP_DCL0) { T((T_CALLED("nl(%p)"), (void *) SP_PARM)); - if (0 == SP_PARM) + if (NULL == SP_PARM) returnCode(ERR); IsNl(SP_PARM) = TRUE; #ifdef __EMX__ @@ -77,7 +73,7 @@ NCURSES_SP_NAME(nonl) (NCURSES_SP_DCL0) { T((T_CALLED("nonl(%p)"), (void *) SP_PARM)); - if (0 == SP_PARM) + if (NULL == SP_PARM) returnCode(ERR); IsNl(SP_PARM) = FALSE; #ifdef __EMX__ diff --git a/contrib/ncurses/ncurses/base/lib_overlay.c b/contrib/ncurses/ncurses/base/lib_overlay.c --- a/contrib/ncurses/ncurses/base/lib_overlay.c +++ b/contrib/ncurses/ncurses/base/lib_overlay.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2023 Thomas E. Dickey * + * Copyright 2020-2023,2024 Thomas E. Dickey * * Copyright 1998-2013,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -41,7 +41,7 @@ #include -MODULE_ID("$Id: lib_overlay.c,v 1.34 2023/09/16 16:39:07 tom Exp $") +MODULE_ID("$Id: lib_overlay.c,v 1.35 2024/12/07 20:03:37 tom Exp $") static int overlap(const WINDOW *const src, WINDOW *const dst, int const flag) @@ -50,7 +50,7 @@ T((T_CALLED("overlap(%p,%p,%d)"), (const void *) src, (void *) dst, flag)); - if (src != 0 && dst != 0) { + if (src != NULL && dst != NULL) { int sx1, sy1, sx2, sy2; int dx1, dy1, dx2, dy2; @@ -146,8 +146,8 @@ dminrow, dmincol, dmaxrow, dmaxcol, over)); - if (src != 0 - && dst != 0 + if (src != NULL + && dst != NULL && dmaxrow >= dminrow && dmaxcol >= dmincol) { attr_t bk; diff --git a/contrib/ncurses/ncurses/base/lib_pad.c b/contrib/ncurses/ncurses/base/lib_pad.c --- a/contrib/ncurses/ncurses/base/lib_pad.c +++ b/contrib/ncurses/ncurses/base/lib_pad.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2010,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -43,7 +43,7 @@ #include -MODULE_ID("$Id: lib_pad.c,v 1.50 2021/10/23 22:57:27 tom Exp $") +MODULE_ID("$Id: lib_pad.c,v 1.52 2024/12/07 17:44:59 tom Exp $") NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(newpad) (NCURSES_SP_DCLx int l, int c) @@ -55,17 +55,17 @@ T((T_CALLED("newpad(%p,%d, %d)"), (void *) SP_PARM, l, c)); if (l <= 0 || c <= 0) - returnWin(0); + returnWin(NULL); win = NCURSES_SP_NAME(_nc_makenew) (NCURSES_SP_ARGx l, c, 0, 0, _ISPAD); if (win == NULL) - returnWin(0); + returnWin(NULL); 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) { + if ((win->_line[i].text = typeCalloc(NCURSES_CH_T, ((size_t) c))) == NULL) { (void) _nc_freewin(win); - returnWin(0); + returnWin(NULL); } for (ptr = win->_line[i].text; ptr < win->_line[i].text + c; ptr++) SetChar(*ptr, BLANK_TEXT, BLANK_ATTR); @@ -92,7 +92,7 @@ if (orig) { if (!IS_PAD(orig) || ((win = derwin(orig, l, c, begy, begx)) == NULL)) - returnWin(0); + returnWin(NULL); } returnWin(win); } @@ -143,7 +143,7 @@ T((T_CALLED("pnoutrefresh(%p, %d, %d, %d, %d, %d, %d)"), (void *) win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol)); - if (win == 0) + if (win == NULL) returnCode(ERR); if (!IS_PAD(win)) @@ -197,8 +197,8 @@ #endif /* TRACE */ #if USE_SCROLL_HINTS if (win->_pad._pad_y >= 0) { - displaced = pminrow - win->_pad._pad_y - - (sminrow - win->_pad._pad_top); + displaced = ((pminrow - win->_pad._pad_y) - + (sminrow - win->_pad._pad_top)); T(("pad being shifted by %d line(s)", displaced)); } else displaced = 0; @@ -331,7 +331,7 @@ { T((T_CALLED("pechochar(%p, %s)"), (void *) pad, _tracechtype(ch))); - if (pad == 0) + if (pad == NULL) returnCode(ERR); if (!IS_PAD(pad)) diff --git a/contrib/ncurses/ncurses/base/lib_printw.c b/contrib/ncurses/ncurses/base/lib_printw.c --- a/contrib/ncurses/ncurses/base/lib_printw.c +++ b/contrib/ncurses/ncurses/base/lib_printw.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 2018-2020,2024 Thomas E. Dickey * * Copyright 1998-2012,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,7 +40,7 @@ #include -MODULE_ID("$Id: lib_printw.c,v 1.28 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_printw.c,v 1.30 2024/12/07 17:44:59 tom Exp $") NCURSES_EXPORT(int) printw(const char *fmt, ...) @@ -133,7 +133,7 @@ NCURSES_EXPORT(int) vwprintw(WINDOW *win, const char *fmt, va_list argp) { - char *buf; + const char *buf; int code = ERR; #if NCURSES_SP_FUNCS SCREEN *sp = _nc_screen_of(win); @@ -142,7 +142,7 @@ 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) { + if (buf != NULL) { code = waddstr(win, buf); } returnCode(code); @@ -151,7 +151,7 @@ NCURSES_EXPORT(int) vw_printw(WINDOW *win, const char *fmt, va_list argp) { - char *buf; + const char *buf; int code = ERR; #if NCURSES_SP_FUNCS SCREEN *sp = _nc_screen_of(win); @@ -160,7 +160,7 @@ 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) { + if (buf != NULL) { code = waddstr(win, buf); } returnCode(code); diff --git a/contrib/ncurses/ncurses/base/lib_redrawln.c b/contrib/ncurses/ncurses/base/lib_redrawln.c --- a/contrib/ncurses/ncurses/base/lib_redrawln.c +++ b/contrib/ncurses/ncurses/base/lib_redrawln.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,7 +40,7 @@ #include -MODULE_ID("$Id: lib_redrawln.c,v 1.18 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_redrawln.c,v 1.19 2024/12/07 20:03:37 tom Exp $") NCURSES_EXPORT(int) wredrawln(WINDOW *win, int beg, int num) @@ -52,7 +52,7 @@ T((T_CALLED("wredrawln(%p,%d,%d)"), (void *) win, beg, num)); - if (win == 0) + if (win == NULL) returnCode(ERR); sp = _nc_screen_of(win); diff --git a/contrib/ncurses/ncurses/base/lib_refresh.c b/contrib/ncurses/ncurses/base/lib_refresh.c --- a/contrib/ncurses/ncurses/base/lib_refresh.c +++ b/contrib/ncurses/ncurses/base/lib_refresh.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2021,2023 Thomas E. Dickey * + * Copyright 2020-2023,2024 Thomas E. Dickey * * Copyright 1998-2010,2011 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -43,7 +43,7 @@ #include -MODULE_ID("$Id: lib_refresh.c,v 1.48 2023/05/27 20:13:10 tom Exp $") +MODULE_ID("$Id: lib_refresh.c,v 1.49 2024/09/22 20:17:40 tom Exp $") NCURSES_EXPORT(int) wrefresh(WINDOW *win) @@ -55,7 +55,7 @@ T((T_CALLED("wrefresh(%p)"), (void *) win)); - if (win == 0) { + if (SP_PARM == NULL || win == NULL) { code = ERR; } else if (win == CurScreen(SP_PARM)) { CurScreen(SP_PARM)->_clear = TRUE; @@ -92,7 +92,7 @@ T((T_CALLED("wnoutrefresh(%p)"), (void *) win)); - if (win == NULL) + if (SP_PARM == NULL || win == NULL) returnCode(ERR); /* diff --git a/contrib/ncurses/ncurses/base/lib_restart.c b/contrib/ncurses/ncurses/base/lib_restart.c --- a/contrib/ncurses/ncurses/base/lib_restart.c +++ b/contrib/ncurses/ncurses/base/lib_restart.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2023 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2012,2015 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -42,7 +42,7 @@ #include -MODULE_ID("$Id: lib_restart.c,v 1.18 2023/04/29 19:01:25 tom Exp $") +MODULE_ID("$Id: lib_restart.c,v 1.21 2025/12/27 12:41:23 tom Exp $") NCURSES_EXPORT(int) NCURSES_SP_NAME(restartterm) (NCURSES_SP_DCLx @@ -51,8 +51,8 @@ int *errret) { int result; -#ifdef USE_TERM_DRIVER - TERMINAL *new_term = 0; +#if USE_TERM_DRIVER + TERMINAL *new_term = NULL; #endif START_TRACE(); @@ -64,10 +64,10 @@ if (TINFO_SETUP_TERM(&new_term, termp, filenum, errret, FALSE) != OK) { result = ERR; - } else if (SP_PARM != 0) { + } else if (SP_PARM != NULL) { TTY_FLAGS save_flags = SP_PARM->_tty_flags; -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER SP_PARM->_term = new_term; #endif if (save_flags._echo) { diff --git a/contrib/ncurses/ncurses/base/lib_screen.c b/contrib/ncurses/ncurses/base/lib_screen.c --- a/contrib/ncurses/ncurses/base/lib_screen.c +++ b/contrib/ncurses/ncurses/base/lib_screen.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2021,2023 Thomas E. Dickey * + * Copyright 2019-2024,2025 Thomas E. Dickey * * Copyright 1998-2017,2018 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -42,7 +42,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_screen.c,v 1.105 2023/04/28 20:58:54 tom Exp $") +MODULE_ID("$Id: lib_screen.c,v 1.113 2025/12/27 12:28:45 tom Exp $") #define MAX_SIZE 0x3fff /* 16k is big enough for a window or pad */ @@ -58,7 +58,7 @@ #define ARG_SLIMIT(name) /* nothing */ #endif -#define CUR_SLIMIT _nc_SLIMIT(limit - (size_t) (target - base)) +#define CUR_SLIMIT _nc_SLIMIT(limit - (size_t) (target + 1 - base)) #define TOP_SLIMIT _nc_SLIMIT(sizeof(buffer)) /* @@ -172,7 +172,7 @@ char *result = malloc(limit); char *buffer; - if (result != 0) { + if (result != NULL) { int ch = 0; size_t used = 0; @@ -182,9 +182,9 @@ if (used + 2 >= limit) { limit += 1024; buffer = realloc(result, limit); - if (buffer == 0) { + if (buffer == NULL) { free(result); - result = 0; + result = NULL; break; } result = buffer; @@ -201,7 +201,7 @@ TR(TRACE_IEVENT, ("READ:%s", result)); } else if (used == 0) { free(result); - result = 0; + result = NULL; } } return result; @@ -222,7 +222,6 @@ source++; found = FALSE; } else if (found) { - size_t n; char *next = source; if (source[0] == GUTTER) { @@ -241,6 +240,8 @@ *target |= pair; *color = value; } else { + size_t n; + while (isalnum(UChar(*next))) { ++next; } @@ -304,8 +305,8 @@ if (limit) { *target = 0; while (limit-- > 0) { - char *find = strchr(digits, *source++); - int ch = (find != 0) ? (int) (find - digits) : -1; + const char *find = strchr(digits, *source++); + int ch = (find != NULL) ? (int) (find - digits) : -1; *target *= base; if (ch >= 0 && ch < base) { *target += ch; @@ -337,7 +338,7 @@ #if NCURSES_WIDECHAR static char * -decode_cchar(char *source, cchar_t *fillin, cchar_t *target) +decode_cchar(char *source, const cchar_t *fillin, cchar_t *target) { int color; attr_t attr = fillin->attr; @@ -382,18 +383,18 @@ memset(win, 0, sizeof(WINDOW)); for (;;) { - char *name; + const char *name; char *value; char *txt = read_txt(fp); - if (txt == 0) + if (txt == NULL) break; if (!strcmp(txt, "rows:")) { free(txt); code = OK; break; } - if ((value = strchr(txt, '=')) == 0) { + if ((value = strchr(txt, '=')) == NULL) { free(txt); continue; } @@ -505,8 +506,8 @@ T((T_CALLED("getwin(%p)"), (void *) filep)); - if (filep == 0) { - returnWin(0); + if (filep == NULL) { + returnWin(NULL); } /* @@ -514,7 +515,7 @@ * screen-dump, or new-format. */ if (read_block(&tmp, (size_t) 4, filep) < 0) { - returnWin(0); + returnWin(NULL); } /* * If this is a new-format file, and we do not support it, give up. @@ -523,9 +524,9 @@ #if NCURSES_EXT_PUTWIN if (read_win(&tmp, filep) < 0) #endif - returnWin(0); + returnWin(NULL); } else if (read_block(((char *) &tmp) + 4, sizeof(WINDOW) - 4, filep) < 0) { - returnWin(0); + returnWin(NULL); } else { old_format = TRUE; } @@ -537,7 +538,7 @@ tmp._maxy > MAX_SIZE || tmp._maxx == 0 || tmp._maxx > MAX_SIZE) { - returnWin(0); + returnWin(NULL); } if (IS_PAD(&tmp)) { @@ -555,7 +556,7 @@ * fields, because the window hierarchy within which they * made sense is probably gone. */ - if (nwin != 0) { + if (nwin != NULL) { int n; size_t linesize = sizeof(NCURSES_CH_T) * (size_t) (tmp._maxx + 1); @@ -593,13 +594,13 @@ for (n = 0; n <= nwin->_maxy; n++) { if (read_block(nwin->_line[n].text, linesize, filep) < 0) { delwin(nwin); - returnWin(0); + returnWin(NULL); } } } #if NCURSES_EXT_PUTWIN else { - char *txt = 0; + char *txt = NULL; bool success = TRUE; NCURSES_CH_T prior = blank; @@ -608,7 +609,7 @@ long row; char *next; - if ((txt = read_txt(filep)) == 0) { + if ((txt = read_txt(filep)) == NULL) { T(("...failed to read string for row %d", n + 1)); success = FALSE; break; @@ -627,13 +628,13 @@ break; } free(txt); - txt = 0; + txt = NULL; } if (!success) { free(txt); delwin(nwin); - returnWin(0); + returnWin(NULL); } } #endif @@ -797,7 +798,7 @@ T((T_CALLED("putwin(%p,%p)"), (void *) win, (void *) filep)); #if NCURSES_EXT_PUTWIN - if (win != 0) { + if (win != NULL) { const char *version = curses_version(); char buffer[1024]; NCURSES_CH_T last_cell; @@ -916,7 +917,7 @@ * 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) { + if (win != NULL) { size_t len = (size_t) (win->_maxx + 1); int y; @@ -942,7 +943,7 @@ * Replace a window covering the whole screen, i.e., newscr or curscr. */ static WINDOW * -replace_window(WINDOW *target, FILE *source) +replace_window(const WINDOW *target, FILE *source) { WINDOW *result = getwin(source); #if NCURSES_EXT_FUNCS @@ -959,26 +960,28 @@ } } #endif - delwin(target); return result; } NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_restore) (NCURSES_SP_DCLx const char *file) { - FILE *fp = 0; + FILE *fp = NULL; 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 (SP_PARM != NULL + && _nc_access(file, R_OK) >= 0 + && (fp = safe_fopen(file, BIN_R)) != NULL) { + WINDOW *my_newscr = replace_window(NewScreen(SP_PARM), fp); + (void) fclose(fp); + if (my_newscr != NULL) { + delwin(NewScreen(SP_PARM)); + NewScreen(SP_PARM) = my_newscr; #if !USE_REENTRANT - newscr = NewScreen(SP_PARM); + newscr = my_newscr; #endif - (void) fclose(fp); - if (NewScreen(SP_PARM) != 0) { code = OK; } } @@ -997,12 +1000,12 @@ scr_dump(const char *file) { int result; - FILE *fp = 0; + FILE *fp = NULL; T((T_CALLED("scr_dump(%s)"), _nc_visbuf(file))); if (_nc_access(file, W_OK) < 0 - || (fp = safe_fopen(file, BIN_W)) == 0) { + || (fp = safe_fopen(file, BIN_W)) == NULL) { result = ERR; } else { (void) putwin(newscr, fp); @@ -1019,23 +1022,25 @@ T((T_CALLED("scr_init(%p,%s)"), (void *) SP_PARM, _nc_visbuf(file))); - if (SP_PARM != 0 && -#ifdef USE_TERM_DRIVER + if (SP_PARM != NULL && +#if USE_TERM_DRIVER InfoOf(SP_PARM).caninit #else !(exit_ca_mode && non_rev_rmcup) #endif ) { - FILE *fp = 0; + FILE *fp = NULL; if (_nc_access(file, R_OK) >= 0 - && (fp = safe_fopen(file, BIN_R)) != 0) { - CurScreen(SP_PARM) = replace_window(CurScreen(SP_PARM), fp); + && (fp = safe_fopen(file, BIN_R)) != NULL) { + WINDOW *my_curscr = replace_window(CurScreen(SP_PARM), fp); + (void) fclose(fp); + if (my_curscr != NULL) { + delwin(CurScreen(SP_PARM)); + CurScreen(SP_PARM) = my_curscr; #if !USE_REENTRANT - curscr = CurScreen(SP_PARM); + curscr = my_curscr; #endif - (void) fclose(fp); - if (CurScreen(SP_PARM) != 0) { code = OK; } } @@ -1058,13 +1063,14 @@ T((T_CALLED("scr_set(%p,%s)"), (void *) SP_PARM, _nc_visbuf(file))); - if (NCURSES_SP_NAME(scr_init) (NCURSES_SP_ARGx file) == OK) { + if (SP_PARM != NULL + && 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) { + if (NewScreen(SP_PARM) != NULL) { code = OK; } } diff --git a/contrib/ncurses/ncurses/base/lib_set_term.c b/contrib/ncurses/ncurses/base/lib_set_term.c --- a/contrib/ncurses/ncurses/base/lib_set_term.c +++ b/contrib/ncurses/ncurses/base/lib_set_term.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -57,9 +57,9 @@ #undef CUR #define CUR SP_TERMTYPE -MODULE_ID("$Id: lib_set_term.c,v 1.184 2022/12/10 21:34:12 tom Exp $") +MODULE_ID("$Id: lib_set_term.c,v 1.199 2025/12/27 12:28:45 tom Exp $") -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER #define MaxColors InfoOf(sp).maxcolors #define NumLabels InfoOf(sp).numlabels #else @@ -81,7 +81,7 @@ _nc_set_screen(screenp); newSP = screenp; - if (newSP != 0) { + if (newSP != NULL) { TINFO_SET_CURTERM(newSP, newSP->_term); #if !USE_REENTRANT curscr = CurScreen(newSP); @@ -91,11 +91,11 @@ COLOR_PAIRS = newSP->_pair_count; #endif } else { - TINFO_SET_CURTERM(oldSP, 0); + TINFO_SET_CURTERM(oldSP, NULL); #if !USE_REENTRANT - curscr = 0; - newscr = 0; - stdscr = 0; + curscr = NULL; + newscr = NULL; + stdscr = NULL; COLORS = 0; COLOR_PAIRS = 0; #endif @@ -110,7 +110,7 @@ static void _nc_free_keytry(TRIES * kt) { - if (kt != 0) { + if (kt != NULL) { _nc_free_keytry(kt->child); _nc_free_keytry(kt->sibling); free(kt); @@ -120,7 +120,7 @@ static bool delink_screen(SCREEN *sp) { - SCREEN *last = 0; + SCREEN *last = NULL; SCREEN *temp; bool result = FALSE; @@ -160,7 +160,7 @@ rop++) { if (rop->win) { (void) delwin(rop->win); - rop->win = 0; + rop->win = NULL; } } } @@ -174,9 +174,9 @@ } } - if (sp->_slk != 0) { + if (sp->_slk != NULL) { - if (sp->_slk->ent != 0) { + if (sp->_slk->ent != NULL) { int i; for (i = 0; i < sp->_slk->labcnt; ++i) { @@ -186,14 +186,14 @@ free(sp->_slk->ent); } free(sp->_slk); - sp->_slk = 0; + sp->_slk = NULL; } _nc_free_keytry(sp->_keytry); - sp->_keytry = 0; + sp->_keytry = NULL; _nc_free_keytry(sp->_key_ok); - sp->_key_ok = 0; + sp->_key_ok = NULL; FreeIfNeeded(sp->_current_attr); @@ -217,9 +217,9 @@ } #if USE_GPM_SUPPORT #ifdef HAVE_LIBDL - if (sp->_dlopen_gpm != 0) { + if (sp->_dlopen_gpm != NULL) { dlclose(sp->_dlopen_gpm); - sp->_dlopen_gpm = 0; + sp->_dlopen_gpm = NULL; } #endif #endif /* USE_GPM_SUPPORT */ @@ -232,17 +232,17 @@ */ if (is_current) { #if !USE_REENTRANT - curscr = 0; - newscr = 0; - stdscr = 0; + curscr = NULL; + newscr = NULL; + stdscr = NULL; COLORS = 0; COLOR_PAIRS = 0; #endif - _nc_set_screen(0); + _nc_set_screen(NULL); #if USE_WIDEC_SUPPORT - if (SP == 0) { + if (SP == NULL) { FreeIfNeeded(_nc_wacs); - _nc_wacs = 0; + _nc_wacs = NULL; } #endif } else { @@ -303,7 +303,7 @@ } #endif -#define ReturnScreenError() do { _nc_set_screen(0); \ +#define ReturnScreenError() do { _nc_set_screen(NULL); \ returnCode(ERR); } while (0) /* OS-independent screen initializations */ @@ -315,26 +315,29 @@ int slines, int scolumns, FILE *output, - int filtered, + bool filtered, int slk_format) { -#ifndef USE_TERM_DRIVER +#if !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 +#if !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() ! */ + /* CURRENT_SCREEN is reset in newterm() */ + if (CURRENT_SCREEN) + returnCode(ERR); #if NCURSES_SP_FUNCS - assert(spp != 0); + if (spp == NULL) + returnCode(ERR); sp = *spp; if (!sp) { @@ -357,13 +360,13 @@ sp->_next_screen = _nc_screen_chain; _nc_screen_chain = sp; - if ((sp->_current_attr = typeCalloc(NCURSES_CH_T, 1)) == 0) { + if ((sp->_current_attr = typeCalloc(NCURSES_CH_T, 1)) == NULL) { ReturnScreenError(); } #else if (!_nc_alloc_screen() - || ((SP->_acs_map = typeCalloc(chtype, ACS_LEN)) == 0) - || ((SP->_screen_acs_map = typeCalloc(bool, ACS_LEN)) == 0)) { + || ((SP->_acs_map = typeCalloc(chtype, ACS_LEN)) == NULL) + || ((SP->_screen_acs_map = typeCalloc(bool, ACS_LEN)) == NULL)) { returnCode(ERR); } @@ -373,7 +376,7 @@ sp->_next_screen = _nc_screen_chain; _nc_screen_chain = sp; - if ((sp->_current_attr = typeCalloc(NCURSES_CH_T, 1)) == 0) { + if ((sp->_current_attr = typeCalloc(NCURSES_CH_T, 1)) == NULL) { returnCode(ERR); } #endif @@ -383,12 +386,16 @@ */ _nc_set_screen(sp); sp->_term = cur_term; -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER TCBOf(sp)->csp = sp; _nc_get_screensize(sp, sp->_term, &slines, &scolumns); #else _nc_get_screensize(sp, &slines, &scolumns); #endif + if (scolumns < 0) + scolumns = 0; + if (slines < 0) + slines = 0; SET_LINES(slines); SET_COLS(scolumns); @@ -401,7 +408,7 @@ if (filtered) { slines = 1; SET_LINES(slines); -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER CallDriver(sp, td_setfilter); #else /* *INDENT-EQLS* */ @@ -420,12 +427,7 @@ #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) +#if USE_NAMED_PIPES T(("setting output mode to binary")); fflush(output); _setmode(fileno(output), _O_BINARY); @@ -437,12 +439,12 @@ fflush(output); sp->_ofd = output ? fileno(output) : -1; sp->_ofp = output; -#if defined(EXP_WIN32_DRIVER) +#if USE_NAMED_PIPES 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) + if ((sp->out_buffer = malloc(sp->out_limit)) == NULL) sp->out_limit = 0; sp->out_inuse = 0; @@ -455,7 +457,7 @@ /* * Set our assumption of the terminal's default foreground and background - * colors. The curs_color man-page states that we can assume that the + * 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 @@ -484,7 +486,7 @@ * Allow those assumed/default color assumptions to be overridden at * runtime: */ - if ((env = getenv("NCURSES_ASSUMED_COLORS")) != 0) { + if ((env = getenv("NCURSES_ASSUMED_COLORS")) != NULL) { int fg, bg; char sep1, sep2; int count = sscanf(env, "%d%c%d%c", &fg, &sep1, &bg, &sep2); @@ -551,7 +553,7 @@ if (NCURSES_SP_NAME(has_colors) (NCURSES_SP_ARG)) { sp->_ok_attributes |= A_COLOR; } -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER _nc_cookie_init(sp); #else #if USE_XMC_SUPPORT @@ -560,7 +562,7 @@ * in the environment, reset the support-flag. */ if (magic_cookie_glitch >= 0) { - if (getenv("NCURSES_NO_MAGIC_COOKIE") != 0) { + if (getenv("NCURSES_NO_MAGIC_COOKIE") != NULL) { support_cookies = FALSE; } } @@ -638,10 +640,10 @@ NCURSES_SP_NAME(_nc_init_acs) (NCURSES_SP_ARG); #if USE_WIDEC_SUPPORT sp->_screen_unicode = _nc_unicode_locale(); - if (_nc_wacs == 0) { + if (_nc_wacs == NULL) { _nc_init_wacs(); } - if (_nc_wacs == 0) { + if (_nc_wacs == NULL) { ReturnScreenError(); } @@ -649,7 +651,7 @@ && _nc_locale_breaks_acs(sp->_term)); #endif env = _nc_get_locale(); - sp->_legacy_coding = ((env == 0) + sp->_legacy_coding = ((env == NULL) || !strcmp(env, "C") || !strcmp(env, "POSIX")); T(("legacy-coding %d", sp->_legacy_coding)); @@ -657,19 +659,19 @@ sp->_nc_sp_idcok = TRUE; sp->_nc_sp_idlok = FALSE; - sp->oldhash = 0; - sp->newhash = 0; + sp->oldhash = NULL; + sp->newhash = NULL; T(("creating newscr")); NewScreen(sp) = NCURSES_SP_NAME(newwin) (NCURSES_SP_ARGx slines, scolumns, 0, 0); - if (NewScreen(sp) == 0) { + if (NewScreen(sp) == NULL) { ReturnScreenError(); } T(("creating curscr")); CurScreen(sp) = NCURSES_SP_NAME(newwin) (NCURSES_SP_ARGx slines, scolumns, 0, 0); - if (CurScreen(sp) == 0) { + if (CurScreen(sp) == NULL) { ReturnScreenError(); } #if !USE_REENTRANT @@ -688,8 +690,8 @@ * 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 && +#if !USE_TERM_DRIVER + if (cur_term != NULL && !memcmp(&cur_term->Ottyb, &null_TTY, sizeof(TTY))) #endif { @@ -755,7 +757,7 @@ 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) { + scolumns, 0, 0)) == NULL) { ReturnScreenError(); } SET_LINES(sp->_lines_avail); @@ -771,10 +773,10 @@ _nc_setupscreen(int slines GCC_UNUSED, int scolumns GCC_UNUSED, FILE *output, - int filtered, + bool filtered, int slk_format) { - SCREEN *sp = 0; + SCREEN *sp = NULL; int rc = NCURSES_SP_NAME(_nc_setupscreen) (&sp, slines, scolumns, @@ -782,7 +784,7 @@ filtered, slk_format); if (rc != OK) - _nc_set_screen(0); + _nc_set_screen(NULL); return rc; } #endif @@ -805,13 +807,13 @@ TR_FUNC_ARG(0, init))); #if NCURSES_SP_FUNCS - if (SP_PARM != 0 && SP_PARM->_prescreen) + if (SP_PARM != NULL && SP_PARM->_prescreen) #endif { if (line == 0) { code = OK; } else { - if (safe_ripoff_sp == 0) { + if (safe_ripoff_sp == NULL) { safe_ripoff_sp = safe_ripoff_stack; } if (safe_ripoff_sp < safe_ripoff_stack + N_RIPS) { diff --git a/contrib/ncurses/ncurses/base/lib_slk.c b/contrib/ncurses/ncurses/base/lib_slk.c --- a/contrib/ncurses/ncurses/base/lib_slk.c +++ b/contrib/ncurses/ncurses/base/lib_slk.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2022 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2010,2011 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -48,9 +48,9 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_slk.c,v 1.50 2022/08/20 18:29:22 tom Exp $") +MODULE_ID("$Id: lib_slk.c,v 1.52 2025/12/27 12:41:23 tom Exp $") -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER #define NumLabels InfoOf(SP_PARM).numlabels #define NoColorVideo InfoOf(SP_PARM).nocolorvideo #define LabelWidth InfoOf(SP_PARM).labelwidth @@ -68,7 +68,7 @@ static int slk_failed(NCURSES_SP_DCL0) { - if ((0 != SP_PARM) && SP_PARM->_slk) { + if ((NULL != SP_PARM) && SP_PARM->_slk) { FreeIfNeeded(SP_PARM->_slk->ent); free(SP_PARM->_slk); SP_PARM->_slk = (SLK *) 0; @@ -148,7 +148,7 @@ assert(stwin); sp = _nc_screen_of(stwin); - if (0 == sp) + if (NULL == sp) returnCode(ERR); assert(TerminalOf(SP_PARM)); @@ -157,7 +157,7 @@ if (SP_PARM->_slk) { /* we did this already, so simply return */ returnCode(OK); - } else if ((SP_PARM->_slk = typeCalloc(SLK, 1)) == 0) + } else if ((SP_PARM->_slk = typeCalloc(SLK, 1)) == NULL) returnCode(ERR); if (!SP_PARM->slk_format) @@ -196,13 +196,13 @@ 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) + SP_PARM->_slk->ent[i].ent_text = (char *) _nc_doalloc(NULL, used); + if (SP_PARM->_slk->ent[i].ent_text == NULL) 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) + SP_PARM->_slk->ent[i].form_text = (char *) _nc_doalloc(NULL, used); + if (SP_PARM->_slk->ent[i].form_text == NULL) returnCode(slk_failed(NCURSES_SP_ARG)); if (used > 1) { @@ -235,7 +235,7 @@ { T((T_CALLED("slk_restore(%p)"), (void *) SP_PARM)); - if (0 == SP_PARM) + if (NULL == SP_PARM) returnCode(ERR); if (SP_PARM->_slk == NULL) returnCode(ERR); diff --git a/contrib/ncurses/ncurses/base/lib_slkatr_set.c b/contrib/ncurses/ncurses/base/lib_slkatr_set.c --- a/contrib/ncurses/ncurses/base/lib_slkatr_set.c +++ b/contrib/ncurses/ncurses/base/lib_slkatr_set.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2014,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -39,7 +39,7 @@ */ #include -MODULE_ID("$Id: lib_slkatr_set.c,v 1.17 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_slkatr_set.c,v 1.18 2024/12/07 20:03:37 tom Exp $") NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set) (NCURSES_SP_DCLx @@ -56,8 +56,8 @@ color_pair)); set_extended_pair(opts, color_pair); - if (SP_PARM != 0 - && SP_PARM->_slk != 0 + if (SP_PARM != NULL + && SP_PARM->_slk != NULL && color_pair >= 0 && color_pair < SP_PARM->_pair_limit) { TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP_PARM->_slk->attr)))); diff --git a/contrib/ncurses/ncurses/base/lib_slkatrof.c b/contrib/ncurses/ncurses/base/lib_slkatrof.c --- a/contrib/ncurses/ncurses/base/lib_slkatrof.c +++ b/contrib/ncurses/ncurses/base/lib_slkatrof.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2005,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -39,14 +39,14 @@ */ #include -MODULE_ID("$Id: lib_slkatrof.c,v 1.12 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_slkatrof.c,v 1.13 2024/12/07 20:03:37 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) { + if (SP_PARM != NULL && SP_PARM->_slk != NULL) { TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP_PARM->_slk->attr)))); RemAttr(SP_PARM->_slk->attr, attr); if ((attr & A_COLOR) != 0) { diff --git a/contrib/ncurses/ncurses/base/lib_slkatron.c b/contrib/ncurses/ncurses/base/lib_slkatron.c --- a/contrib/ncurses/ncurses/base/lib_slkatron.c +++ b/contrib/ncurses/ncurses/base/lib_slkatron.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -39,14 +39,14 @@ */ #include -MODULE_ID("$Id: lib_slkatron.c,v 1.13 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_slkatron.c,v 1.14 2024/12/07 20:03:37 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) { + if (SP_PARM != NULL && SP_PARM->_slk != NULL) { TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP_PARM->_slk->attr)))); AddAttr(SP_PARM->_slk->attr, attr); if ((attr & A_COLOR) != 0) { diff --git a/contrib/ncurses/ncurses/base/lib_slkatrset.c b/contrib/ncurses/ncurses/base/lib_slkatrset.c --- a/contrib/ncurses/ncurses/base/lib_slkatrset.c +++ b/contrib/ncurses/ncurses/base/lib_slkatrset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2005,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -39,14 +39,14 @@ */ #include -MODULE_ID("$Id: lib_slkatrset.c,v 1.11 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_slkatrset.c,v 1.12 2024/12/07 20:03:37 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) { + if (SP_PARM != NULL && SP_PARM->_slk != NULL) { SetAttr(SP_PARM->_slk->attr, attr); returnCode(OK); } else diff --git a/contrib/ncurses/ncurses/base/lib_slkattr.c b/contrib/ncurses/ncurses/base/lib_slkattr.c --- a/contrib/ncurses/ncurses/base/lib_slkattr.c +++ b/contrib/ncurses/ncurses/base/lib_slkattr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -39,14 +39,14 @@ */ #include -MODULE_ID("$Id: lib_slkattr.c,v 1.12 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_slkattr.c,v 1.13 2024/12/07 20:03:37 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) { + if (SP_PARM != NULL && SP_PARM->_slk != NULL) { attr_t result = AttrOf(SP_PARM->_slk->attr) & ALL_BUT_COLOR; int pair = GetPair(SP_PARM->_slk->attr); diff --git a/contrib/ncurses/ncurses/base/lib_slkclear.c b/contrib/ncurses/ncurses/base/lib_slkclear.c --- a/contrib/ncurses/ncurses/base/lib_slkclear.c +++ b/contrib/ncurses/ncurses/base/lib_slkclear.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2007,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -41,7 +41,7 @@ */ #include -MODULE_ID("$Id: lib_slkclear.c,v 1.15 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_slkclear.c,v 1.16 2024/12/07 20:03:37 tom Exp $") NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_clear) (NCURSES_SP_DCL0) @@ -50,7 +50,7 @@ T((T_CALLED("slk_clear(%p)"), (void *) SP_PARM)); - if (SP_PARM != 0 && SP_PARM->_slk != 0) { + if (SP_PARM != NULL && SP_PARM->_slk != NULL) { SP_PARM->_slk->hidden = TRUE; /* For simulated SLK's it looks much more natural to inherit those attributes from the standard screen */ diff --git a/contrib/ncurses/ncurses/base/lib_slkcolor.c b/contrib/ncurses/ncurses/base/lib_slkcolor.c --- a/contrib/ncurses/ncurses/base/lib_slkcolor.c +++ b/contrib/ncurses/ncurses/base/lib_slkcolor.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2018-2020,2024 Thomas E. Dickey * * Copyright 1998-2014,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -39,7 +39,7 @@ */ #include -MODULE_ID("$Id: lib_slkcolor.c,v 1.20 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_slkcolor.c,v 1.21 2024/12/07 20:03:37 tom Exp $") static int _nc_slk_color(SCREEN *sp, int pair_arg) @@ -48,8 +48,8 @@ T((T_CALLED("slk_color(%p,%d)"), (void *) sp, pair_arg)); - if (sp != 0 - && sp->_slk != 0 + if (sp != NULL + && sp->_slk != NULL && pair_arg >= 0 && pair_arg < sp->_pair_limit) { TR(TRACE_ATTRS, ("... current is %s", _tracech_t(CHREF(sp->_slk->attr)))); diff --git a/contrib/ncurses/ncurses/base/lib_slklab.c b/contrib/ncurses/ncurses/base/lib_slklab.c --- a/contrib/ncurses/ncurses/base/lib_slklab.c +++ b/contrib/ncurses/ncurses/base/lib_slklab.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2003,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -41,15 +41,15 @@ */ #include -MODULE_ID("$Id: lib_slklab.c,v 1.11 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_slklab.c,v 1.12 2024/12/07 20:03:37 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); + if (SP_PARM == NULL || SP_PARM->_slk == NULL || n < 1 || n > SP_PARM->_slk->labcnt) + returnPtr(NULL); returnPtr(SP_PARM->_slk->ent[n - 1].ent_text); } diff --git a/contrib/ncurses/ncurses/base/lib_slkrefr.c b/contrib/ncurses/ncurses/base/lib_slkrefr.c --- a/contrib/ncurses/ncurses/base/lib_slkrefr.c +++ b/contrib/ncurses/ncurses/base/lib_slkrefr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2013,2014 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -44,9 +44,9 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_slkrefr.c,v 1.32 2021/09/04 10:54:35 tom Exp $") +MODULE_ID("$Id: lib_slkrefr.c,v 1.35 2025/12/27 12:41:23 tom Exp $") -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER #define NumLabels InfoOf(SP_PARM).numlabels #else #define NumLabels num_labels @@ -58,7 +58,7 @@ static void slk_paint_info(WINDOW *win) { - SCREEN *sp = _nc_screen_of(win); + const SCREEN *sp = _nc_screen_of(win); if (win && sp && (sp->slk_format == 4)) { int i; @@ -83,7 +83,7 @@ SLK *slk; int numlab; - if (sp == 0) + if (sp == NULL) return; slk = sp->_slk; @@ -97,7 +97,7 @@ if (slk->dirty || slk->ent[i].dirty) { if (slk->ent[i].visible) { if (numlab > 0 && SLK_STDFMT(fmt)) { -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER CallDriver_2(sp, td_hwlabel, i + 1, slk->ent[i].form_text); #else if (i < num_labels) { @@ -125,7 +125,7 @@ slk->dirty = FALSE; if (numlab > 0) { -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER CallDriver_1(sp, td_hwlabelOnOff, slk->hidden ? FALSE : TRUE); #else if (slk->hidden) { @@ -145,7 +145,7 @@ { T((T_CALLED("slk_noutrefresh(%p)"), (void *) SP_PARM)); - if (SP_PARM == 0 || SP_PARM->_slk == 0) + if (SP_PARM == NULL || SP_PARM->_slk == NULL) returnCode(ERR); if (SP_PARM->_slk->hidden) returnCode(OK); @@ -170,7 +170,7 @@ { T((T_CALLED("slk_refresh(%p)"), (void *) SP_PARM)); - if (SP_PARM == 0 || SP_PARM->_slk == 0) + if (SP_PARM == NULL || SP_PARM->_slk == NULL) returnCode(ERR); if (SP_PARM->_slk->hidden) returnCode(OK); diff --git a/contrib/ncurses/ncurses/base/lib_slkset.c b/contrib/ncurses/ncurses/base/lib_slkset.c --- a/contrib/ncurses/ncurses/base/lib_slkset.c +++ b/contrib/ncurses/ncurses/base/lib_slkset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 2019-2020,2024 Thomas E. Dickey * * Copyright 1998-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -45,7 +45,7 @@ #endif #endif -MODULE_ID("$Id: lib_slkset.c,v 1.26 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_slkset.c,v 1.27 2024/12/07 20:03:37 tom Exp $") NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_set) (NCURSES_SP_DCLx int i, const char *astr, int format) @@ -60,14 +60,14 @@ T((T_CALLED("slk_set(%p, %d, \"%s\", %d)"), (void *) SP_PARM, i, str, format)); - if (SP_PARM == 0 - || (slk = SP_PARM->_slk) == 0 + if (SP_PARM == NULL + || (slk = SP_PARM->_slk) == NULL || i < 1 || i > slk->labcnt || format < 0 || format > 2) returnCode(ERR); - if (str == 0) + if (str == NULL) str = ""; --i; /* Adjust numbering of labels */ @@ -84,7 +84,7 @@ size_t need; init_mb(state); - need = mbrtowc(0, p, strlen(p), &state); + need = mbrtowc(NULL, p, strlen(p), &state); if (need == (size_t) -1) break; mbrtowc(&wc, p, need, &state); @@ -107,14 +107,14 @@ #endif FreeIfNeeded(slk->ent[i].ent_text); - if ((slk->ent[i].ent_text = strdup(str)) == 0) + if ((slk->ent[i].ent_text = strdup(str)) == NULL) 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) + ) == NULL) returnCode(ERR); switch (format) { diff --git a/contrib/ncurses/ncurses/base/lib_slktouch.c b/contrib/ncurses/ncurses/base/lib_slktouch.c --- a/contrib/ncurses/ncurses/base/lib_slktouch.c +++ b/contrib/ncurses/ncurses/base/lib_slktouch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2000,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -39,14 +39,14 @@ */ #include -MODULE_ID("$Id: lib_slktouch.c,v 1.9 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_slktouch.c,v 1.10 2024/12/07 20:03:37 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) + if (SP_PARM == NULL || SP_PARM->_slk == NULL) returnCode(ERR); SP_PARM->_slk->dirty = TRUE; diff --git a/contrib/ncurses/ncurses/base/lib_touch.c b/contrib/ncurses/ncurses/base/lib_touch.c --- a/contrib/ncurses/ncurses/base/lib_touch.c +++ b/contrib/ncurses/ncurses/base/lib_touch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -44,7 +44,7 @@ #include -MODULE_ID("$Id: lib_touch.c,v 1.16 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_touch.c,v 1.17 2024/11/23 19:17:05 tom Exp $") #undef is_linetouched @@ -55,10 +55,10 @@ /* XSI doesn't define any error, and gcc ultimately made it impossible */ if (!win || (line > win->_maxy) || (line < 0)) { - returnCode(FALSE); + returnBool(FALSE); } - returnCode(win->_line[line].firstchar != _NOCHANGE ? TRUE : FALSE); + returnBool(win->_line[line].firstchar != _NOCHANGE ? TRUE : FALSE); } NCURSES_EXPORT(bool) @@ -71,9 +71,9 @@ for (i = 0; i <= win->_maxy; i++) if (win->_line[i].firstchar != _NOCHANGE) - returnCode(TRUE); + returnBool(TRUE); } - returnCode(FALSE); + returnBool(FALSE); } NCURSES_EXPORT(int) diff --git a/contrib/ncurses/ncurses/base/lib_ungetch.c b/contrib/ncurses/ncurses/base/lib_ungetch.c --- a/contrib/ncurses/ncurses/base/lib_ungetch.c +++ b/contrib/ncurses/ncurses/base/lib_ungetch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -43,7 +43,7 @@ #include -MODULE_ID("$Id: lib_ungetch.c,v 1.17 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_ungetch.c,v 1.18 2024/12/07 20:03:37 tom Exp $") #include @@ -65,7 +65,7 @@ T((T_CALLED("ungetch(%p,%s)"), (void *) sp, _nc_tracechar(sp, ch))); - if (sp != 0 && tail >= 0) { + if (sp != NULL && tail >= 0) { if (head < 0) { head = 0; t_inc(); diff --git a/contrib/ncurses/ncurses/base/lib_wattron.c b/contrib/ncurses/ncurses/base/lib_wattron.c --- a/contrib/ncurses/ncurses/base/lib_wattron.c +++ b/contrib/ncurses/ncurses/base/lib_wattron.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2022 Thomas E. Dickey * + * Copyright 2020-2022,2024 Thomas E. Dickey * * Copyright 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -43,13 +43,13 @@ #include #include -MODULE_ID("$Id: lib_wattron.c,v 1.13 2022/04/15 22:34:38 tom Exp $") +MODULE_ID("$Id: lib_wattron.c,v 1.14 2024/12/07 20:03:37 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) { + if (win != NULL) { T(("... current %s (%d)", _traceattr(WINDOW_ATTRS(win)), GET_WINDOW_PAIR(win))); diff --git a/contrib/ncurses/ncurses/base/lib_winch.c b/contrib/ncurses/ncurses/base/lib_winch.c --- a/contrib/ncurses/ncurses/base/lib_winch.c +++ b/contrib/ncurses/ncurses/base/lib_winch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,13 +40,13 @@ #include -MODULE_ID("$Id: lib_winch.c,v 1.9 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_winch.c,v 1.10 2024/12/07 20:03:37 tom Exp $") NCURSES_EXPORT(chtype) winch(WINDOW *win) { T((T_CALLED("winch(%p)"), (void *) win)); - if (win != 0) { + if (win != NULL) { returnChtype((chtype) CharOf(win->_line[win->_cury].text[win->_curx]) | AttrOf(win->_line[win->_cury].text[win->_curx])); } else { diff --git a/contrib/ncurses/ncurses/base/lib_window.c b/contrib/ncurses/ncurses/base/lib_window.c --- a/contrib/ncurses/ncurses/base/lib_window.c +++ b/contrib/ncurses/ncurses/base/lib_window.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2010,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,7 +40,7 @@ #include -MODULE_ID("$Id: lib_window.c,v 1.32 2021/10/23 23:06:24 tom Exp $") +MODULE_ID("$Id: lib_window.c,v 1.33 2024/12/07 20:03:37 tom Exp $") NCURSES_EXPORT(void) _nc_synchook(WINDOW *win) @@ -61,8 +61,8 @@ T((T_CALLED("mvderwin(%p,%d,%d)"), (void *) win, y, x)); - if (win != 0 - && (orig = win->_parent) != 0 + if (win != NULL + && (orig = win->_parent) != NULL && (x >= 0 && y >= 0) && (x + getmaxx(win) <= getmaxx(orig)) && (y + getmaxy(win) <= getmaxy(orig))) { @@ -178,11 +178,11 @@ dupwin(WINDOW *win) /* make an exact duplicate of the given window */ { - WINDOW *nwin = 0; + WINDOW *nwin = NULL; T((T_CALLED("dupwin(%p)"), (void *) win)); - if (win != 0) { + if (win != NULL) { #if NCURSES_SP_FUNCS SCREEN *sp = _nc_screen_of(win); #endif @@ -199,7 +199,7 @@ win->_begx); } - if (nwin != 0) { + if (nwin != NULL) { int i; size_t linesize; diff --git a/contrib/ncurses/ncurses/base/nc_panel.c b/contrib/ncurses/ncurses/base/nc_panel.c --- a/contrib/ncurses/ncurses/base/nc_panel.c +++ b/contrib/ncurses/ncurses/base/nc_panel.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2000,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include -MODULE_ID("$Id: nc_panel.c,v 1.6 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: nc_panel.c,v 1.7 2024/12/07 20:03:37 tom Exp $") NCURSES_EXPORT(struct panelhook *) NCURSES_SP_NAME(_nc_panelhook) (NCURSES_SP_DCL0) @@ -42,7 +42,7 @@ ? &(SP_PARM->_panelHook) : (CURRENT_SCREEN ? &(CURRENT_SCREEN->_panelHook) - : 0)); + : NULL)); } #if NCURSES_SP_FUNCS diff --git a/contrib/ncurses/ncurses/base/new_pair.c b/contrib/ncurses/ncurses/base/new_pair.c --- a/contrib/ncurses/ncurses/base/new_pair.c +++ b/contrib/ncurses/ncurses/base/new_pair.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -43,7 +43,7 @@ #define CUR SP_TERMTYPE #endif -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER #define MaxColors InfoOf(SP_PARM).maxcolors #else #define MaxColors max_colors @@ -61,7 +61,7 @@ #endif -MODULE_ID("$Id: new_pair.c,v 1.23 2021/08/16 22:11:26 tom Exp $") +MODULE_ID("$Id: new_pair.c,v 1.27 2025/12/27 12:41:23 tom Exp $") #if NCURSES_EXT_COLORS @@ -148,10 +148,10 @@ find.fg = fg; find.bg = bg; - if (sp != 0) { + if (sp != NULL) { void *pp; - if ((pp = tfind(&find, &sp->_ordered_pairs, compare_data)) != 0) { - colorpair_t *temp = *(colorpair_t **) pp; + if ((pp = tfind(&find, &sp->_ordered_pairs, compare_data)) != NULL) { + const colorpair_t *temp = *(colorpair_t **) pp; result = (int) (temp - sp->_color_pairs); } } @@ -193,7 +193,7 @@ * pair table. */ NCURSES_EXPORT(void) -_nc_reset_color_pair(SCREEN *sp, int pair, colorpair_t * next) +_nc_reset_color_pair(SCREEN *sp, int pair, const colorpair_t * next) { colorpair_t *last; @@ -252,8 +252,8 @@ { int n; for (n = 0; n < length; ++n) { - void *find = tfind(source + n, &sp->_ordered_pairs, compare_data); - if (find != 0) { + const void *find = tfind(source + n, &sp->_ordered_pairs, compare_data); + if (find != NULL) { tdelete(source + n, &sp->_ordered_pairs, compare_data); tsearch(target + n, &sp->_ordered_pairs, compare_data); } @@ -266,7 +266,7 @@ int pair; T((T_CALLED("alloc_pair(%d,%d)"), fg, bg)); - if (SP_PARM == 0) { + if (SP_PARM == NULL) { pair = -1; } else if ((pair = _nc_find_color_pair(SP_PARM, fg, bg)) < 0) { /* @@ -291,7 +291,7 @@ 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) { + if (SP_PARM->_color_pairs == NULL) { pair = -1; } else { found = TRUE; diff --git a/contrib/ncurses/ncurses/base/resizeterm.c b/contrib/ncurses/ncurses/base/resizeterm.c --- a/contrib/ncurses/ncurses/base/resizeterm.c +++ b/contrib/ncurses/ncurses/base/resizeterm.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2021,2024 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2015,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -46,7 +46,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: resizeterm.c,v 1.53 2024/04/20 21:54:14 tom Exp $") +MODULE_ID("$Id: resizeterm.c,v 1.61 2025/12/27 12:28:45 tom Exp $") /* * If we're trying to be reentrant, do not want any local statics. @@ -103,8 +103,9 @@ 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 + returnBool(ToLines > 0 && ToCols > 0 + && SP_PARM != NULL && (ToLines != screen_lines(SP_PARM) || ToCols != screen_columns(SP_PARM))); } @@ -122,10 +123,10 @@ static ripoff_t * ripped_window(WINDOW *win) { - ripoff_t *result = 0; + ripoff_t *result = NULL; ripoff_t *rop; - if (win != 0) { + if (win != NULL) { #ifdef USE_SP_RIPOFF SCREEN *sp = _nc_screen_of(win); #endif @@ -148,7 +149,7 @@ { int result = 0; - if (win != 0) { + if (win != NULL) { ripoff_t *rop; #ifdef USE_SP_RIPOFF @@ -174,7 +175,7 @@ { int depth = 0; - if (cmp != 0) { + if (cmp != NULL) { #ifdef USE_SP_WINDOWLIST SCREEN *sp = _nc_screen_of(cmp); #endif @@ -199,9 +200,9 @@ { int depth = 0; - if (cmp != 0) { + if (cmp != NULL) { WINDOW *tst; - while ((tst = cmp->_parent) != 0) { + while ((tst = cmp->_parent) != NULL) { ++depth; cmp = tst; } @@ -219,17 +220,17 @@ 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); + const 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)" : "", + (rop != NULL) ? " (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 (rop != NULL && rop->line < 0) { /* * If it is a ripped-off window at the bottom of the screen, simply * move it to the same relative position. @@ -343,7 +344,7 @@ } /* - * This function reallocates NCURSES window structures, with no side-effects + * This function reallocates NCURSES window structures, with no side effects * such as ungetch(). */ NCURSES_EXPORT(int) @@ -354,10 +355,10 @@ 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))); + (SP_PARM == NULL) ? -1 : screen_lines(SP_PARM), + (SP_PARM == NULL) ? -1 : screen_columns(SP_PARM))); - if (SP_PARM == 0 || ToLines <= 0 || ToCols <= 0) { + if (SP_PARM == NULL || ToLines <= 0 || ToCols <= 0) { returnCode(ERR); } @@ -406,7 +407,7 @@ screen_lines(SP_PARM) = (NCURSES_SIZE_T) ToLines; screen_columns(SP_PARM) = (NCURSES_SIZE_T) ToCols; -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER CallDriver_2(SP_PARM, td_setsize, ToLines, ToCols); #else lines = (NCURSES_INT2) ToLines; @@ -473,18 +474,18 @@ 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))); + (SP_PARM == NULL) ? -1 : screen_lines(SP_PARM), + (SP_PARM == NULL) ? -1 : screen_columns(SP_PARM))); - if (SP_PARM != 0 && ToLines > 0 && ToCols > 0) { + if (SP_PARM != NULL && 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 + bool slk_visible = (SP_PARM != NULL + && SP_PARM->_slk != NULL && !(SP_PARM->_slk->hidden)); if (slk_visible) { @@ -505,7 +506,7 @@ */ for (each_ripoff(rop)) { if (rop->win != StdScreen(SP_PARM) - && rop->win != 0 + && rop->win != NULL && rop->line < 0) { if (rop->hook != _nc_slk_initialize) { diff --git a/contrib/ncurses/ncurses/base/safe_sprintf.c b/contrib/ncurses/ncurses/base/safe_sprintf.c --- a/contrib/ncurses/ncurses/base/safe_sprintf.c +++ b/contrib/ncurses/ncurses/base/safe_sprintf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2021,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2012,2013 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -34,7 +34,7 @@ #include #include -MODULE_ID("$Id: safe_sprintf.c,v 1.37 2023/09/30 10:42:42 tom Exp $") +MODULE_ID("$Id: safe_sprintf.c,v 1.39 2025/02/20 01:07:05 tom Exp $") #if USE_SAFE_SPRINTF @@ -60,12 +60,12 @@ size_t fmt_len; char fmt_arg[BUFSIZ]; - if (fmt == 0 || *fmt == '\0') + if (fmt == NULL || *fmt == '\0') return 0; fmt_len = strlen(fmt) + 1; - if ((format = typeMalloc(char, fmt_len)) == 0) + if ((format = typeMalloc(char, fmt_len)) == NULL) return -1; - if ((buffer = typeMalloc(char, length)) == 0) { + if ((buffer = typeMalloc(char, length)) == NULL) { free(format); return -1; } @@ -114,7 +114,7 @@ _nc_SLIMIT(sizeof(fmt_arg)) "%d", ival); fmt_len += strlen(fmt_arg); - if ((format = _nc_doalloc(format, fmt_len)) == 0) { + if ((format = _nc_doalloc(format, fmt_len)) == NULL) { free(buffer); return -1; } @@ -162,7 +162,7 @@ if (prec > (int) length) { length = length + (size_t) prec; buffer = typeRealloc(char, length, buffer); - if (buffer == 0) { + if (buffer == NULL) { free(format); return -1; } @@ -262,10 +262,9 @@ if (my_buffer != NULL) { # if HAVE_VSNPRINTF - /* SUSv2, 1997 */ - int used; - do { + /* SUSv2, 1997 */ + int used; va_list ap2; begin_va_copy(ap2, ap); diff --git a/contrib/ncurses/ncurses/base/tries.c b/contrib/ncurses/ncurses/base/tries.c --- a/contrib/ncurses/ncurses/base/tries.c +++ b/contrib/ncurses/ncurses/base/tries.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2023 Thomas E. Dickey * + * Copyright 2020-2023,2024 Thomas E. Dickey * * Copyright 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -41,7 +41,7 @@ #include #include -MODULE_ID("$Id: tries.c,v 1.32 2023/06/24 15:36:23 tom Exp $") +MODULE_ID("$Id: tries.c,v 1.33 2024/12/07 21:24:18 tom Exp $") /* * Expand a keycode into the string that it corresponds to, returning null if @@ -51,12 +51,12 @@ _nc_expand_try(TRIES * tree, unsigned code, int *count, size_t len) { TRIES *ptr = tree; - char *result = 0; + char *result = NULL; if (code != 0) { - while (ptr != 0) { + while (ptr != NULL) { if ((result = _nc_expand_try(ptr->child, code, count, len + 1)) - != 0) { + != NULL) { break; } if (ptr->value == code) { @@ -69,8 +69,8 @@ ptr = ptr->sibling; } } - if (result != 0) { - if (ptr != 0 && (result[len] = (char) ptr->ch) == 0) + if (result != NULL) { + if (ptr != NULL && (result[len] = (char) ptr->ch) == 0) *((unsigned char *) (result + len)) = 128; #ifdef TRACE if (len == 0 && USE_TRACEF(TRACE_MAXIMUM)) { @@ -96,7 +96,7 @@ if (code == 0) returnCode(FALSE); - while (*tree != 0) { + while (*tree != NULL) { if (_nc_remove_key(&(*tree)->child, code)) { returnCode(TRUE); } @@ -128,11 +128,11 @@ if (!VALID_STRING(string) || *string == 0) returnCode(FALSE); - while (*tree != 0) { + while (*tree != NULL) { if (UChar((*tree)->ch) == UChar(*string)) { if (string[1] != 0) returnCode(_nc_remove_string(&(*tree)->child, string + 1)); - if ((*tree)->child == 0) { + if ((*tree)->child == NULL) { TRIES *to_free = *tree; *tree = (*tree)->sibling; free(to_free); diff --git a/contrib/ncurses/ncurses/base/vsscanf.c b/contrib/ncurses/ncurses/base/vsscanf.c --- a/contrib/ncurses/ncurses/base/vsscanf.c +++ b/contrib/ncurses/ncurses/base/vsscanf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2023 Thomas E. Dickey * + * Copyright 2020-2023,2025 Thomas E. Dickey * * Copyright 1998-2004,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -39,7 +39,7 @@ #if !HAVE_VSSCANF -MODULE_ID("$Id: vsscanf.c,v 1.22 2023/09/23 18:48:57 tom Exp $") +MODULE_ID("$Id: vsscanf.c,v 1.23 2025/02/20 01:08:11 tom Exp $") #if !(HAVE_VFSCANF || HAVE__DOSCAN) @@ -215,7 +215,7 @@ int eaten; void *pointer; - if (my_fmt != 0) { + if (my_fmt != NULL) { /* * Split the original format into chunks, adding a "%n" to the end * of each (except of course if it used %n), and use that @@ -229,7 +229,7 @@ state = sUnknown; chunk = cUnknown; other = oUnknown; - pointer = 0; + pointer = NULL; for (n = 0; format[n] != 0 && state != sFinal; ++n) { my_fmt[n] = format[n]; switch (state) { diff --git a/contrib/ncurses/ncurses/base/wresize.c b/contrib/ncurses/ncurses/base/wresize.c --- a/contrib/ncurses/ncurses/base/wresize.c +++ b/contrib/ncurses/ncurses/base/wresize.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2021,2023 Thomas E. Dickey * + * Copyright 2019-2023,2024 Thomas E. Dickey * * Copyright 1998-2010,2011 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -34,7 +34,7 @@ #include -MODULE_ID("$Id: wresize.c,v 1.43 2023/10/21 11:13:03 tom Exp $") +MODULE_ID("$Id: wresize.c,v 1.45 2024/12/07 18:08:56 tom Exp $") static int cleanup_lines(struct ldat *data, int length) @@ -109,7 +109,7 @@ { int col, row, size_x, size_y; struct ldat *pline; - struct ldat *new_lines = 0; + struct ldat *new_lines = NULL; #ifdef TRACE T((T_CALLED("wresize(%p,%d,%d)"), (void *) win, ToLines, ToCols)); @@ -125,9 +125,11 @@ } #endif - if (!win || --ToLines < 0 || --ToCols < 0) + if (!win || !OK_DIMENSION(ToLines) || !OK_DIMENSION(ToCols)) returnCode(ERR); + ToLines--; + ToCols--; size_x = win->_maxx; size_y = win->_maxy; @@ -147,7 +149,7 @@ } pline = win->_parent->_line; } else { - pline = 0; + pline = NULL; } /* @@ -156,7 +158,7 @@ * (at least temporarily) the array pointing to the individual lines. */ new_lines = typeCalloc(struct ldat, (unsigned) (ToLines + 1)); - if (new_lines == 0) + if (new_lines == NULL) returnCode(ERR); /* @@ -173,7 +175,7 @@ if (row <= size_y) { if (ToCols != size_x) { s = typeMalloc(NCURSES_CH_T, (unsigned) ToCols + 1); - if (s == 0) + if (s == NULL) returnCode(cleanup_lines(new_lines, row)); for (col = 0; col <= ToCols; ++col) { bool valid = (col <= size_x); @@ -193,15 +195,15 @@ } } else { s = typeMalloc(NCURSES_CH_T, (unsigned) ToCols + 1); - if (s == 0) + if (s == NULL) 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) { + } else if (pline != NULL && pline[win->_pary + row].text != NULL) { s = &pline[win->_pary + row].text[win->_parx]; } else { - s = 0; + s = NULL; } if_USE_SCROLL_HINTS(new_lines[row].oldindex = row); diff --git a/contrib/ncurses/ncurses/build.priv.h b/contrib/ncurses/ncurses/build.priv.h --- a/contrib/ncurses/ncurses/build.priv.h +++ b/contrib/ncurses/ncurses/build.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 2019-2020,2024 Thomas E. Dickey * * Copyright 2010,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -32,7 +32,7 @@ ****************************************************************************/ /* - * $Id: build.priv.h,v 1.12 2020/02/02 23:34:34 tom Exp $ + * $Id: build.priv.h,v 1.13 2024/12/14 22:32:09 tom Exp $ * * build.priv.h * @@ -78,7 +78,7 @@ #define EXIT_FAILURE 1 #endif -#define FreeAndNull(p) do { free(p); p = 0; } while (0) +#define FreeAndNull(p) do { free(p); p = NULL; } while (0) #define UChar(c) ((unsigned char)(c)) #define SIZEOF(v) (sizeof(v) / sizeof(v[0])) diff --git a/contrib/ncurses/ncurses/curses.priv.h b/contrib/ncurses/ncurses/curses.priv.h --- a/contrib/ncurses/ncurses/curses.priv.h +++ b/contrib/ncurses/ncurses/curses.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2023,2024 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2017,2018 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -35,7 +35,7 @@ ****************************************************************************/ /* - * $Id: curses.priv.h,v 1.687 2024/04/23 22:28:25 tom Exp $ + * $Id: curses.priv.h,v 1.741 2025/12/27 21:46:04 tom Exp $ * * curses.priv.h * @@ -59,7 +59,7 @@ #if USE_RCS_IDS #define MODULE_ID(id) static const char Ident[] = id; #else -#define MODULE_ID(id) /*nothing*/ +#define MODULE_ID(id) /* nothing */ #endif #include /* for offsetof */ @@ -88,11 +88,20 @@ #endif /* Some Windows related defines */ + #undef _NC_WINDOWS -#if (defined(_WIN32) || defined(_WIN64)) +#if (defined(_WIN32) || defined(_WIN64__) || defined(__MSYS__)) #define _NC_WINDOWS -#else -#undef EXP_WIN32_DRIVER +#endif + +#undef _NC_CYGWIN +#if (defined(__MSYS__) || defined(__CYGWIN__)) +#define _NC_CYGWIN +#endif + +#undef _NC_WINDOWS_NATIVE +#if (defined(_WIN32) || defined(_WIN64)) +#define _NC_WINDOWS_NATIVE #endif #undef _NC_MINGW @@ -197,7 +206,7 @@ * 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) +#if defined(_NC_WINDOWS_NATIVE) || defined(__DJGPP__) # ifdef NCURSES_PATHSEP # undef NCURSES_PATHSEP # endif @@ -222,6 +231,15 @@ 0) #endif +/* + * The stricmp() function is in MSVCRT, and cannot be called or linked from + * Cygwin runtime-dependent binaries currently. Use the POSIX strcaseccmp() + * function instead which is pretty much the same. + */ +#if defined(_NC_CYGWIN) +#define stricmp(s1, s2) strcasecmp(s1, s2) +#endif + /* * Not all platforms have memmove; some have an equivalent bcopy. (Some may * have neither). @@ -293,7 +311,7 @@ /* * Options for terminal drivers, etc... */ -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER #define NO_TERMINAL "unknown" #define USE_SP_RIPOFF 1 #define USE_SP_TERMTYPE 1 @@ -347,6 +365,12 @@ #define VT_ACSC "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~" +/* + * To make them easier to find, user-defined capabilities used within ncurses + * should be tagged with this macro: + */ +#define UserCap(name) #name + /* * Structure for palette tables */ @@ -379,6 +403,38 @@ #undef KEY_EVENT /* reduce compiler-warnings with Visual 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 + +#include /* defines TERMIOS via term.h */ + +#if USE_TERM_DRIVER +#if defined(TERMIOS) +#undef USE_NAMED_PIPES +#define USE_NAMED_PIPES 0 +#undef USE_WIN32CON_DRIVER +#elif defined(_NC_WINDOWS) +#include +#endif /* TERMIOS */ +#endif /* USE_TERM_DRIVER */ + +#ifndef FixupPathname +#define FixupPathname(path) /* nothing */ +#define FixupPathname2(path,buffer) /* nothing */ +#endif + typedef struct { int red, green, blue; /* what color_content() returns */ @@ -422,11 +478,10 @@ #include -#include #include -#define IsPreScreen(sp) (((sp) != 0) && sp->_prescreen) -#define HasTerminal(sp) (((sp) != 0) && (0 != ((sp)->_term))) +#define IsPreScreen(sp) (((sp) != NULL) && sp->_prescreen) +#define HasTerminal(sp) (((sp) != NULL) && (NULL != ((sp)->_term))) #define IsValidScreen(sp) (HasTerminal(sp) && !IsPreScreen(sp)) #if USE_REENTRANT @@ -790,7 +845,7 @@ #if USE_SYSMOUSE ,M_SYSMOUSE /* FreeBSD sysmouse on console */ #endif -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER ,M_TERM_DRIVER /* Win32 console, etc */ #endif } MouseType; @@ -876,6 +931,12 @@ */ #define MAX_DELAY_MSECS 30000 +/* + * Limit screen dimensions read from environment variables. + */ +#define MAX_ENV_LINES 512 +#define MAX_ENV_COLUMNS 512 + /* * 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 @@ -890,13 +951,16 @@ * 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. + * + * The leading "./" is used in _nc_to_dospath() to decide whether to prefix + * the converted path with the MinGW32 base directory. */ #if MIXEDCASE_FILENAMES -#define LEAF_FMT "%c" -#define LEAF_LEN 1 +#define LEAF_FMT "./%c" +#define LEAF_LEN 3 #else -#define LEAF_FMT "%02x" -#define LEAF_LEN 2 +#define LEAF_FMT "./%02x" +#define LEAF_LEN 4 #endif /* @@ -910,7 +974,7 @@ #define TRACEMSE_MAX (80 + (5 * 10) + (32 * 15)) #define TRACEMSE_FMT "id %2d at (%2d, %2d, %2d) state %4lx = {" /* } */ -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER struct DriverTCB; /* Terminal Control Block forward declaration */ #define INIT_TERM_DRIVER() _nc_globals.term_driver = _nc_get_driver #else @@ -1101,7 +1165,8 @@ 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 */ + MEVENT *_mouse_readp; /* read pointer into event queue */ + MEVENT *_mouse_writep; /* write pointer into event queue */ /* * These are data that support the proper handling of the panel stack on an @@ -1187,7 +1252,7 @@ int _sysmouse_new_buttons; #endif -#if defined(USE_TERM_DRIVER) || defined(EXP_WIN32_DRIVER) +#if USE_TERM_DRIVER || USE_NAMED_PIPES MEVENT _drv_mouse_fifo[FIFO_SIZE]; int _drv_mouse_head; int _drv_mouse_tail; @@ -1265,7 +1330,7 @@ #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 +#define SP_INIT_WINDOWLIST(sp) WindowList(sp) = NULL #else #define SP_INIT_WINDOWLIST(sp) /* nothing */ #endif @@ -1282,7 +1347,7 @@ sp->_cursor = -1; \ SP_INIT_WINDOWLIST(sp); \ sp->_outch = NCURSES_OUTC_FUNC; \ - sp->jump = 0 \ + sp->jump = NULL \ /* usually in */ #ifndef UCHAR_MAX @@ -1376,6 +1441,12 @@ #define NulColor /* nothing */ #endif +#if NCURSES_RGB_COLORS +#define NulDirect , 0 +#else +#define NulDirect /* nothing */ +#endif + #if CCHARW_MAX > 6 #define NulChar 0,0,0,0,0 #elif CCHARW_MAX > 5 @@ -1397,7 +1468,7 @@ #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 NewChar2(c,a) { a, { c, NulChar } NulColor NulDirect } #define NewChar(ch) NewChar2(ChCharOf(ch), ChAttrOf(ch)) #if CCHARW_MAX > 1 @@ -1427,7 +1498,7 @@ #define PUTC(ch) do { if(!isWidecExt(ch)) { \ if (Charable(ch)) { \ TR_PUTC(CharOf(ch)); \ - NCURSES_OUTC_FUNC (NCURSES_SP_ARGx CharOf(ch)); \ + NCURSES_OUTC_FUNC (NCURSES_SP_ARGx (int) CharOf(ch)); \ COUNT_OUTCHARS(1); \ } else { \ for (PUTC_i = 0; PUTC_i < CCHARW_MAX; ++PUTC_i) { \ @@ -1440,15 +1511,19 @@ 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)); \ + NCURSES_OUTC_FUNC (NCURSES_SP_ARGx (int) CharOf(ch)); \ } \ break; \ - } else { \ + } else if (PUTC_n > 1 || !is8bits(PUTC_ch)) { \ 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]); \ } \ + } else { \ + PUTC_buf[0] = (char) PUTC_ch; \ + TR_PUTC(PUTC_buf[0]); \ + NCURSES_OUTC_FUNC (NCURSES_SP_ARGx PUTC_buf[0]); \ } \ } \ COUNT_OUTCHARS(PUTC_i); \ @@ -1520,10 +1595,12 @@ #define CHANGED -1 #define LEGALYX(w, y, x) \ - ((w) != 0 && \ + ((w) != NULL && \ ((x) >= 0 && (x) <= (w)->_maxx && \ (y) >= 0 && (y) <= (w)->_maxy)) +#define OK_DIMENSION(n) ((NCURSES_SIZE_T)(n) == (n) && (n) > 0) + #define CHANGED_CELL(line,col) \ if (line->firstchar == _NOCHANGE) \ line->firstchar = line->lastchar = (NCURSES_SIZE_T) (col); \ @@ -1551,12 +1628,12 @@ #include #include -#define FreeIfNeeded(p) if ((p) != 0) free(p) +#define FreeIfNeeded(p) if ((p) != NULL) 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) +#define FreeAndNull(p) do { free(p); p = NULL; } while (0) #ifdef EXP_OOM_TESTING extern NCURSES_EXPORT(void *) _nc_oom_malloc(size_t size); @@ -1578,21 +1655,21 @@ #define TYPE_MALLOC(type, size, name) \ do { \ name = typeMalloc(type, size); \ - if (name == 0) \ + if (name == NULL) \ _nc_err_abort(MSG_NO_MEMORY); \ } while (0) #define TYPE_CALLOC(type, size, name) \ do { \ name = typeCalloc(type, size); \ - if (name == 0) \ + if (name == NULL) \ _nc_err_abort(MSG_NO_MEMORY); \ } while (0) #define TYPE_REALLOC(type, size, name) \ do { \ name = typeRealloc(type, size, name); \ - if (name == 0) \ + if (name == NULL) \ _nc_err_abort(MSG_NO_MEMORY); \ } while (0) @@ -1624,8 +1701,8 @@ /* * 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_screen(p) p = _nc_screen_chain; p != NULL; p = (p)->_next_screen +#define each_window(sp,p) p = WindowList(sp); p != NULL; p = (p)->next #define each_ripoff(p) p = safe_ripoff_stack; (p - safe_ripoff_stack) < N_RIPS; ++p /* @@ -1637,8 +1714,8 @@ #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') +#define NonNull(s) ((s) != NULL ? s : "") +#define NonEmpty(s) ((s) != NULL && *(s) != '\0') #ifdef TRACE @@ -1705,7 +1782,7 @@ #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(bool) _nc_retrace_bool (bool); 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 *); @@ -1830,20 +1907,20 @@ TR(TRACE_ATTRS, ("new attribute is %s", _traceattr((S))));} #define DelCharCost(sp,count) \ - ((parm_dch != 0) \ + ((parm_dch != NULL) \ ? sp->_dch_cost \ - : ((delete_character != 0) \ + : ((delete_character != NULL) \ ? (sp->_dch1_cost * count) \ - : INFINITY)) + : NC_INFINITY)) #define InsCharCost(sp,count) \ - ((parm_ich != 0) \ + ((parm_ich != NULL) \ ? sp->_ich_cost \ : ((enter_insert_mode && exit_insert_mode) \ ? sp->_smir_cost + sp->_rmir_cost + (sp->_ip_cost * count) \ - : ((insert_character != 0) \ + : ((insert_character != NULL) \ ? ((sp->_ich1_cost + sp->_ip_cost) * count) \ - : INFINITY))) + : NC_INFINITY))) #if USE_XMC_SUPPORT #define UpdateAttrs(sp,c) if (!SameAttrOf(SCREEN_ATTRS(sp), c)) { \ @@ -1864,21 +1941,6 @@ } #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 @@ -1928,7 +1990,7 @@ #endif #define save_ttytype(termp) \ - if (TerminalType(termp).term_names != 0) { \ + if (TerminalType(termp).term_names != NULL) { \ _nc_STRNCPY(ttytype, \ TerminalType(termp).term_names, \ NAMESIZE - 1); \ @@ -1936,7 +1998,7 @@ } #if !NCURSES_WCWIDTH_GRAPHICS -extern NCURSES_EXPORT(int) _nc_wacs_width(unsigned); +extern NCURSES_EXPORT(int) _nc_wacs_width(wchar_t); #else #define _nc_wacs_width(ch) wcwidth(ch) #endif @@ -2006,7 +2068,7 @@ extern NCURSES_EXPORT(void) _nc_change_pair(SCREEN *, int); #define ReservePairs(sp,want) \ - if ((sp->_color_pairs == 0) || (want >= sp->_pair_alloc)) \ + if ((sp->_color_pairs == NULL) || (want >= sp->_pair_alloc)) \ _nc_reserve_pairs(sp, want) /* lib_getch.c */ @@ -2015,8 +2077,12 @@ /* lib_insch.c */ extern NCURSES_EXPORT(int) _nc_insert_ch(SCREEN *, WINDOW *, chtype); +/* lib_mouse.c */ +extern NCURSES_EXPORT(bool) _nc_has_mouse (const SCREEN *); + /* lib_mvcur.c */ -#define INFINITY 1000000 /* cost: too high to use */ +#define NC_INFINITY 1000000 /* cost: too high to use */ +#define BAUDBYTE 9 /* 9 = 7 bits + 1 parity + 1 stop */ extern NCURSES_EXPORT(int) _nc_mvcur(int yold, int xold, int ynew, int xnew); @@ -2030,16 +2096,9 @@ 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(bool) _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); @@ -2049,7 +2108,7 @@ extern NCURSES_EXPORT(void) _nc_forget_prescr(void); #else #define _nc_find_prescr() _nc_prescreen.allocated -#define _nc_forget_prescr() _nc_prescreen.allocated = 0 +#define _nc_forget_prescr() _nc_prescreen.allocated = NULL #endif /* lib_set_term.c */ @@ -2133,7 +2192,7 @@ 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_keypad (SCREEN *, bool); extern NCURSES_EXPORT(int) _nc_ospeed (int); extern NCURSES_EXPORT(int) _nc_outch (int); extern NCURSES_EXPORT(int) _nc_putchar (int); @@ -2141,13 +2200,13 @@ 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(int) _nc_setupscreen (int, int, FILE *, bool, int); +extern NCURSES_EXPORT(int) _nc_timed_wait (const SCREEN *, int, int, int * EVENTLIST_2nd(_nc_eventlist *)); extern NCURSES_EXPORT(int) _nc_trans_string (char *, const char *); 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_free_entry (ENTRY *, const TERMTYPE2 *); extern NCURSES_EXPORT(void) _nc_freeall (void); extern NCURSES_EXPORT(void) _nc_hash_map (void); extern NCURSES_EXPORT(void) _nc_init_keytry (SCREEN *); @@ -2232,7 +2291,7 @@ */ #if USE_WIDEC_SUPPORT -#if defined(_NC_WINDOWS) && !defined(_NC_MSC) && !defined(EXP_WIN32_DRIVER) +#if defined(_NC_WINDOWS_NATIVE) && !defined(_NC_MSC) && !USE_NAMED_PIPES /* * MinGW has wide-character functions, but they do not work correctly. */ @@ -2246,13 +2305,7 @@ extern int __MINGW_NOTHROW _nc_mblen(const char *, size_t); #define mblen(s,n) _nc_mblen(s, n) -#endif /* _NC_WINDOWS && !_NC_MSC */ - -#if defined(_NC_WINDOWS) || defined(_NC_MINGW) -/* see wcwidth.c */ -extern NCURSES_EXPORT(int) mk_wcwidth(wchar_t); -#define wcwidth(ucs) _nc_wcwidth(ucs) -#endif +#endif /* _NC_WINDOWS_NATIVE && !_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)) @@ -2283,7 +2336,7 @@ #define USE_SETBUF_0 0 -#define NC_OUTPUT(sp) ((sp != 0 && sp->_ofp != 0) ? sp->_ofp : stdout) +#define NC_OUTPUT(sp) ((sp != NULL && sp->_ofp != NULL) ? sp->_ofp : stdout) /* * On systems with a broken linker, define 'SP' as a function to force the @@ -2301,7 +2354,7 @@ /* 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_alloc_screen() ((SP = _nc_alloc_screen_sp()) != NULL) #define _nc_set_screen(sp) SP = sp #endif @@ -2357,14 +2410,14 @@ #define SetSafeOutcWrapper(outc) \ SCREEN* sp = CURRENT_SCREEN; \ struct screen outc_wrapper; \ - if (sp==0) { \ + if (sp == NULL) { \ sp = &outc_wrapper; \ memset(sp,0,sizeof(struct screen)); \ sp->_outch = _nc_outc_wrapper; \ }\ sp->jump = outc -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER typedef struct _termInfo { @@ -2461,7 +2514,7 @@ * Entrypoints which are actually provided in the terminal driver, which would * be an sp-name otherwise. */ -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER #define TINFO_HAS_KEY _nc_tinfo_has_key #define TINFO_DOUPDATE _nc_tinfo_doupdate #define TINFO_MVCUR _nc_tinfo_mvcur @@ -2474,14 +2527,23 @@ #define TINFO_MVCUR NCURSES_SP_NAME(_nc_mvcur) #endif -#if defined(EXP_WIN32_DRIVER) -#include +#ifdef _NC_WINDOWS +#if USE_WIDEC_SUPPORT +#include +#endif +#include +#include +#elif defined(_NC_WINDOWS_NATIVE) +#include +#include +#elif defined(__EMX__) +#include #endif /* * Entrypoints using an extra parameter with the terminal driver. */ -#ifdef USE_TERM_DRIVER +#if 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) \ @@ -2500,33 +2562,46 @@ _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 +#if USE_TERM_DRIVER 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) +#ifdef TERMIOS +#define USE_WINCONMODE 0 +#elif defined(USE_WIN32CON_DRIVER) +#define USE_WINCONMODE 1 +extern NCURSES_EXPORT(int) _nc_console_setmode(void* handle, const ConsoleMode* arg); +extern NCURSES_EXPORT(int) _nc_console_getmode(void* handle, ConsoleMode* arg); +extern NCURSES_EXPORT(bool) _nc_console_checkinit(bool assumeTermInfo); +extern NCURSES_EXPORT(void*) _nc_console_fd2handle(int fd); +extern NCURSES_EXPORT(WORD) _nc_console_MapColor(bool fore, int color); +extern NCURSES_EXPORT(int) _nc_console_flush(void* handle); +extern NCURSES_EXPORT(bool) _nc_console_get_SBI(void); +extern NCURSES_EXPORT(HANDLE) _nc_console_handle(int fd); +extern NCURSES_EXPORT(int) _nc_console_isatty(int fd); +extern NCURSES_EXPORT(bool) _nc_console_keyExist(int keycode); +extern NCURSES_EXPORT(int) _nc_console_keyok(int keycode, int flag); +extern NCURSES_EXPORT(int) _nc_console_read(SCREEN *sp, HANDLE fd, int *buf); +extern NCURSES_EXPORT(bool) _nc_console_restore(void); +extern NCURSES_EXPORT(void) _nc_console_selectActiveHandle(void); +extern NCURSES_EXPORT(void) _nc_console_set_scrollback(bool normal, CONSOLE_SCREEN_BUFFER_INFO * info); +extern NCURSES_EXPORT(void) _nc_console_size(int *Lines, int *Cols); +extern NCURSES_EXPORT(int) _nc_console_test(int fd); +extern NCURSES_EXPORT(int) _nc_console_testmouse(const SCREEN *sp, HANDLE fd, int delay EVENTLIST_2nd(_nc_eventlist*)); +extern NCURSES_EXPORT(int) _nc_console_twait(const SCREEN *sp, HANDLE hdl,int mode,int msec,int *left EVENTLIST_2nd(_nc_eventlist * evl)); +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 + +#else +#error unsupported driver configuration +#endif /* USE_WIN32CON_DRIVER */ + +#if USE_TERM_DRIVER && defined(USE_WIN32CON_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 @@ -2539,20 +2614,20 @@ && (value = ttyname(fd)) != NULL \ && strncmp(value, "/dev/pts/", 9)) -#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) +#if USE_TERM_DRIVER +# define IsTermInfo(sp) ((TCBOf(sp) != NULL) && ((TCBOf(sp)->drv != NULL)) && ((TCBOf(sp)->drv->isTerminfo))) +# define HasTInfoTerminal(sp) ((NULL != TerminalOf(sp)) && IsTermInfo(sp)) +# if USE_NAMED_PIPES # 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)) +# define IsTermInfoOnConsole(sp) (IsTermInfo(sp) && _nc_console_test(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 HasTInfoTerminal(sp) (NULL != TerminalOf(sp)) +# if USE_NAMED_PIPES # define IsTermInfoOnConsole(sp) _nc_console_test(TerminalOf(sp)->Filedes) # else # define IsTermInfoOnConsole(sp) FALSE @@ -2599,7 +2674,7 @@ 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_setupscreen)(SCREEN**, int, int, FILE *, bool, 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); @@ -2654,6 +2729,22 @@ extern NCURSES_EXPORT(int) _nc_conv_to_utf32(unsigned *, const char *, unsigned); #endif +#ifdef _NC_WINDOWS +#if USE_WIDEC_SUPPORT +#define write_screen WriteConsoleOutputW +#define read_screen ReadConsoleOutputW +#define read_keycode ReadConsoleInputW +#define KeyEventChar KeyEvent.uChar.UnicodeChar +#define CharInfoChar Char.UnicodeChar +#else +#define write_screen WriteConsoleOutput +#define read_screen ReadConsoleOutput +#define read_keycode ReadConsoleInput +#define KeyEventChar KeyEvent.uChar.AsciiChar +#define CharInfoChar Char.AsciiChar +#endif +#endif /* _NC_WINDOWS */ + #ifdef __cplusplus } #endif diff --git a/contrib/ncurses/ncurses/llib-lncurses b/contrib/ncurses/ncurses/llib-lncurses --- a/contrib/ncurses/ncurses/llib-lncurses +++ b/contrib/ncurses/ncurses/llib-lncurses @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2022,2023 Thomas E. Dickey * + * Copyright 2019-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -1475,7 +1475,7 @@ #undef _nc_has_mouse NCURSES_BOOL _nc_has_mouse( - SCREEN *sp) + const SCREEN *sp) { return(*(NCURSES_BOOL *)0); } #undef has_mouse_sp @@ -2032,7 +2032,7 @@ int slines, int scolumns, FILE *output, - int filtered, + NCURSES_BOOL filtered, int slk_format) { return(*(int *)0); } @@ -2041,7 +2041,7 @@ int slines, int scolumns, FILE *output, - int filtered, + NCURSES_BOOL filtered, int slk_format) { return(*(int *)0); } @@ -2801,6 +2801,12 @@ const char *path) { return(*(NCURSES_BOOL *)0); } +#undef _nc_is_path_found +NCURSES_BOOL _nc_is_path_found( + const char *path, + struct stat *sb) + { return(*(NCURSES_BOOL *)0); } + #undef _nc_env_access int _nc_env_access(void) { return(*(int *)0); } @@ -2994,7 +3000,7 @@ #undef _nc_free_entry void _nc_free_entry( ENTRY *headp, - TERMTYPE *tterm) + const TERMTYPE *tterm) { /* void */ } #undef _nc_free_entries @@ -3339,7 +3345,7 @@ #undef _nc_keypad int _nc_keypad( SCREEN *sp, - int flag) + NCURSES_BOOL flag) { return(*(int *)0); } /* ./tinfo/lib_raw.c */ @@ -3525,8 +3531,8 @@ { return(*(char **)0); } #undef _nc_unicode_locale -int _nc_unicode_locale(void) - { return(*(int *)0); } +NCURSES_BOOL _nc_unicode_locale(void) + { return(*(NCURSES_BOOL *)0); } #undef _nc_locale_breaks_acs int _nc_locale_breaks_acs( @@ -3848,7 +3854,7 @@ #undef _nc_retrace_bool NCURSES_BOOL _nc_retrace_bool( - int code) + NCURSES_BOOL code) { return(*(NCURSES_BOOL *)0); } #undef _nc_retrace_char @@ -4054,7 +4060,7 @@ #undef _nc_timed_wait int _nc_timed_wait( - SCREEN *sp, + const SCREEN *sp, int mode, int milliseconds, int *timeleft) diff --git a/contrib/ncurses/ncurses/llib-lncursest b/contrib/ncurses/ncurses/llib-lncursest --- a/contrib/ncurses/ncurses/llib-lncursest +++ b/contrib/ncurses/ncurses/llib-lncursest @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2022,2023 Thomas E. Dickey * + * Copyright 2019-2024,2025 Thomas E. Dickey * * Copyright 2008-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -1484,7 +1484,7 @@ #undef _nc_has_mouse NCURSES_BOOL _nc_has_mouse( - SCREEN *sp) + const SCREEN *sp) { return(*(NCURSES_BOOL *)0); } #undef has_mouse_sp @@ -2041,7 +2041,7 @@ int slines, int scolumns, FILE *output, - int filtered, + NCURSES_BOOL filtered, int slk_format) { return(*(int *)0); } @@ -2050,7 +2050,7 @@ int slines, int scolumns, FILE *output, - int filtered, + NCURSES_BOOL filtered, int slk_format) { return(*(int *)0); } @@ -2810,6 +2810,12 @@ const char *path) { return(*(NCURSES_BOOL *)0); } +#undef _nc_is_path_found +NCURSES_BOOL _nc_is_path_found( + const char *path, + struct stat *sb) + { return(*(NCURSES_BOOL *)0); } + #undef _nc_env_access int _nc_env_access(void) { return(*(int *)0); } @@ -3008,7 +3014,7 @@ #undef _nc_free_entry void _nc_free_entry( ENTRY *headp, - TERMTYPE *tterm) + const TERMTYPE *tterm) { /* void */ } #undef _nc_free_entries @@ -3394,7 +3400,7 @@ #undef _nc_keypad int _nc_keypad( SCREEN *sp, - int flag) + NCURSES_BOOL flag) { return(*(int *)0); } /* ./tinfo/lib_raw.c */ @@ -3602,8 +3608,8 @@ { return(*(char **)0); } #undef _nc_unicode_locale -int _nc_unicode_locale(void) - { return(*(int *)0); } +NCURSES_BOOL _nc_unicode_locale(void) + { return(*(NCURSES_BOOL *)0); } #undef _nc_locale_breaks_acs int _nc_locale_breaks_acs( @@ -3947,7 +3953,7 @@ #undef _nc_retrace_bool NCURSES_BOOL _nc_retrace_bool( - int code) + NCURSES_BOOL code) { return(*(NCURSES_BOOL *)0); } #undef _nc_retrace_char @@ -4164,7 +4170,7 @@ #undef _nc_timed_wait int _nc_timed_wait( - SCREEN *sp, + const SCREEN *sp, int mode, int milliseconds, int *timeleft) diff --git a/contrib/ncurses/ncurses/llib-lncursestw b/contrib/ncurses/ncurses/llib-lncursestw --- a/contrib/ncurses/ncurses/llib-lncursestw +++ b/contrib/ncurses/ncurses/llib-lncursestw @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 2009-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -1857,6 +1857,12 @@ const wchar_t *z) { return(*(int *)0); } +#undef winwstr +int winwstr( + WINDOW *a1, + wchar_t *z) + { return(*(int *)0); } + #undef mouse_trafo NCURSES_BOOL mouse_trafo( int *a1, @@ -2065,7 +2071,7 @@ #undef _nc_has_mouse NCURSES_BOOL _nc_has_mouse( - SCREEN *sp) + const SCREEN *sp) { return(*(NCURSES_BOOL *)0); } #undef has_mouse_sp @@ -2622,7 +2628,7 @@ int slines, int scolumns, FILE *output, - int filtered, + NCURSES_BOOL filtered, int slk_format) { return(*(int *)0); } @@ -2631,7 +2637,7 @@ int slines, int scolumns, FILE *output, - int filtered, + NCURSES_BOOL filtered, int slk_format) { return(*(int *)0); } @@ -3347,12 +3353,6 @@ int n) { return(*(int *)0); } -#undef winwstr -int winwstr( - WINDOW *win, - wchar_t *wstr) - { return(*(int *)0); } - /* ./widechar/lib_key_name.c */ #undef key_name @@ -3581,7 +3581,7 @@ void _nc_reset_color_pair( SCREEN *sp, int pair, - colorpair_t *next) + const colorpair_t *next) { /* void */ } #undef _nc_set_color_pair @@ -3749,6 +3749,12 @@ const char *path) { return(*(NCURSES_BOOL *)0); } +#undef _nc_is_path_found +NCURSES_BOOL _nc_is_path_found( + const char *path, + struct stat *sb) + { return(*(NCURSES_BOOL *)0); } + #undef _nc_env_access int _nc_env_access(void) { return(*(int *)0); } @@ -3959,7 +3965,7 @@ #undef _nc_free_entry void _nc_free_entry( ENTRY *headp, - TERMTYPE2 *tterm) + const TERMTYPE2 *tterm) { /* void */ } #undef _nc_free_entries @@ -4355,7 +4361,7 @@ #undef _nc_keypad int _nc_keypad( SCREEN *sp, - int flag) + NCURSES_BOOL flag) { return(*(int *)0); } /* ./tinfo/lib_raw.c */ @@ -4563,8 +4569,8 @@ { return(*(char **)0); } #undef _nc_unicode_locale -int _nc_unicode_locale(void) - { return(*(int *)0); } +NCURSES_BOOL _nc_unicode_locale(void) + { return(*(NCURSES_BOOL *)0); } #undef _nc_locale_breaks_acs int _nc_locale_breaks_acs( @@ -4908,7 +4914,7 @@ #undef _nc_retrace_bool NCURSES_BOOL _nc_retrace_bool( - int code) + NCURSES_BOOL code) { return(*(NCURSES_BOOL *)0); } #undef _nc_retrace_char @@ -5136,7 +5142,7 @@ #undef _nc_timed_wait int _nc_timed_wait( - SCREEN *sp, + const SCREEN *sp, int mode, int milliseconds, int *timeleft) diff --git a/contrib/ncurses/ncurses/llib-lncursesw b/contrib/ncurses/ncurses/llib-lncursesw --- a/contrib/ncurses/ncurses/llib-lncursesw +++ b/contrib/ncurses/ncurses/llib-lncursesw @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 2001-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -1854,6 +1854,12 @@ const wchar_t *z) { return(*(int *)0); } +#undef winwstr +int winwstr( + WINDOW *a1, + wchar_t *z) + { return(*(int *)0); } + #undef mouse_trafo NCURSES_BOOL mouse_trafo( int *a1, @@ -2056,7 +2062,7 @@ #undef _nc_has_mouse NCURSES_BOOL _nc_has_mouse( - SCREEN *sp) + const SCREEN *sp) { return(*(NCURSES_BOOL *)0); } #undef has_mouse_sp @@ -2613,7 +2619,7 @@ int slines, int scolumns, FILE *output, - int filtered, + NCURSES_BOOL filtered, int slk_format) { return(*(int *)0); } @@ -2622,7 +2628,7 @@ int slines, int scolumns, FILE *output, - int filtered, + NCURSES_BOOL filtered, int slk_format) { return(*(int *)0); } @@ -3338,12 +3344,6 @@ int n) { return(*(int *)0); } -#undef winwstr -int winwstr( - WINDOW *win, - wchar_t *wstr) - { return(*(int *)0); } - /* ./widechar/lib_key_name.c */ #undef key_name @@ -3572,7 +3572,7 @@ void _nc_reset_color_pair( SCREEN *sp, int pair, - colorpair_t *next) + const colorpair_t *next) { /* void */ } #undef _nc_set_color_pair @@ -3740,6 +3740,12 @@ const char *path) { return(*(NCURSES_BOOL *)0); } +#undef _nc_is_path_found +NCURSES_BOOL _nc_is_path_found( + const char *path, + struct stat *sb) + { return(*(NCURSES_BOOL *)0); } + #undef _nc_env_access int _nc_env_access(void) { return(*(int *)0); } @@ -3945,7 +3951,7 @@ #undef _nc_free_entry void _nc_free_entry( ENTRY *headp, - TERMTYPE2 *tterm) + const TERMTYPE2 *tterm) { /* void */ } #undef _nc_free_entries @@ -4300,7 +4306,7 @@ #undef _nc_keypad int _nc_keypad( SCREEN *sp, - int flag) + NCURSES_BOOL flag) { return(*(int *)0); } /* ./tinfo/lib_raw.c */ @@ -4486,8 +4492,8 @@ { return(*(char **)0); } #undef _nc_unicode_locale -int _nc_unicode_locale(void) - { return(*(int *)0); } +NCURSES_BOOL _nc_unicode_locale(void) + { return(*(NCURSES_BOOL *)0); } #undef _nc_locale_breaks_acs int _nc_locale_breaks_acs( @@ -4809,7 +4815,7 @@ #undef _nc_retrace_bool NCURSES_BOOL _nc_retrace_bool( - int code) + NCURSES_BOOL code) { return(*(NCURSES_BOOL *)0); } #undef _nc_retrace_char @@ -5026,7 +5032,7 @@ #undef _nc_timed_wait int _nc_timed_wait( - SCREEN *sp, + const SCREEN *sp, int mode, int milliseconds, int *timeleft) diff --git a/contrib/ncurses/ncurses/llib-ltinfo b/contrib/ncurses/ncurses/llib-ltinfo --- a/contrib/ncurses/ncurses/llib-ltinfo +++ b/contrib/ncurses/ncurses/llib-ltinfo @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2022,2023 Thomas E. Dickey * + * Copyright 2019-2024,2025 Thomas E. Dickey * * Copyright 2012-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -72,6 +72,12 @@ const char *path) { return(*(NCURSES_BOOL *)0); } +#undef _nc_is_path_found +NCURSES_BOOL _nc_is_path_found( + const char *path, + struct stat *sb) + { return(*(NCURSES_BOOL *)0); } + #undef _nc_env_access int _nc_env_access(void) { return(*(int *)0); } @@ -265,7 +271,7 @@ #undef _nc_free_entry void _nc_free_entry( ENTRY *headp, - TERMTYPE *tterm) + const TERMTYPE *tterm) { /* void */ } #undef _nc_free_entries @@ -610,7 +616,7 @@ #undef _nc_keypad int _nc_keypad( SCREEN *sp, - int flag) + NCURSES_BOOL flag) { return(*(int *)0); } /* ./tinfo/lib_raw.c */ @@ -796,8 +802,8 @@ { return(*(char **)0); } #undef _nc_unicode_locale -int _nc_unicode_locale(void) - { return(*(int *)0); } +NCURSES_BOOL _nc_unicode_locale(void) + { return(*(NCURSES_BOOL *)0); } #undef _nc_locale_breaks_acs int _nc_locale_breaks_acs( @@ -1119,7 +1125,7 @@ #undef _nc_retrace_bool NCURSES_BOOL _nc_retrace_bool( - int code) + NCURSES_BOOL code) { return(*(NCURSES_BOOL *)0); } #undef _nc_retrace_char @@ -1325,7 +1331,7 @@ #undef _nc_timed_wait int _nc_timed_wait( - SCREEN *sp, + const SCREEN *sp, int mode, int milliseconds, int *timeleft) diff --git a/contrib/ncurses/ncurses/llib-ltinfot b/contrib/ncurses/ncurses/llib-ltinfot --- a/contrib/ncurses/ncurses/llib-ltinfot +++ b/contrib/ncurses/ncurses/llib-ltinfot @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2022,2023 Thomas E. Dickey * + * Copyright 2019-2024,2025 Thomas E. Dickey * * Copyright 2013-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -72,6 +72,12 @@ const char *path) { return(*(NCURSES_BOOL *)0); } +#undef _nc_is_path_found +NCURSES_BOOL _nc_is_path_found( + const char *path, + struct stat *sb) + { return(*(NCURSES_BOOL *)0); } + #undef _nc_env_access int _nc_env_access(void) { return(*(int *)0); } @@ -270,7 +276,7 @@ #undef _nc_free_entry void _nc_free_entry( ENTRY *headp, - TERMTYPE *tterm) + const TERMTYPE *tterm) { /* void */ } #undef _nc_free_entries @@ -656,7 +662,7 @@ #undef _nc_keypad int _nc_keypad( SCREEN *sp, - int flag) + NCURSES_BOOL flag) { return(*(int *)0); } /* ./tinfo/lib_raw.c */ @@ -864,8 +870,8 @@ { return(*(char **)0); } #undef _nc_unicode_locale -int _nc_unicode_locale(void) - { return(*(int *)0); } +NCURSES_BOOL _nc_unicode_locale(void) + { return(*(NCURSES_BOOL *)0); } #undef _nc_locale_breaks_acs int _nc_locale_breaks_acs( @@ -1209,7 +1215,7 @@ #undef _nc_retrace_bool NCURSES_BOOL _nc_retrace_bool( - int code) + NCURSES_BOOL code) { return(*(NCURSES_BOOL *)0); } #undef _nc_retrace_char @@ -1426,7 +1432,7 @@ #undef _nc_timed_wait int _nc_timed_wait( - SCREEN *sp, + const SCREEN *sp, int mode, int milliseconds, int *timeleft) diff --git a/contrib/ncurses/ncurses/llib-ltinfotw b/contrib/ncurses/ncurses/llib-ltinfotw --- a/contrib/ncurses/ncurses/llib-ltinfotw +++ b/contrib/ncurses/ncurses/llib-ltinfotw @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 2012-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -72,6 +72,12 @@ const char *path) { return(*(NCURSES_BOOL *)0); } +#undef _nc_is_path_found +NCURSES_BOOL _nc_is_path_found( + const char *path, + struct stat *sb) + { return(*(NCURSES_BOOL *)0); } + #undef _nc_env_access int _nc_env_access(void) { return(*(int *)0); } @@ -282,7 +288,7 @@ #undef _nc_free_entry void _nc_free_entry( ENTRY *headp, - TERMTYPE2 *tterm) + const TERMTYPE2 *tterm) { /* void */ } #undef _nc_free_entries @@ -678,7 +684,7 @@ #undef _nc_keypad int _nc_keypad( SCREEN *sp, - int flag) + NCURSES_BOOL flag) { return(*(int *)0); } /* ./tinfo/lib_raw.c */ @@ -886,8 +892,8 @@ { return(*(char **)0); } #undef _nc_unicode_locale -int _nc_unicode_locale(void) - { return(*(int *)0); } +NCURSES_BOOL _nc_unicode_locale(void) + { return(*(NCURSES_BOOL *)0); } #undef _nc_locale_breaks_acs int _nc_locale_breaks_acs( @@ -1231,7 +1237,7 @@ #undef _nc_retrace_bool NCURSES_BOOL _nc_retrace_bool( - int code) + NCURSES_BOOL code) { return(*(NCURSES_BOOL *)0); } #undef _nc_retrace_char @@ -1459,7 +1465,7 @@ #undef _nc_timed_wait int _nc_timed_wait( - SCREEN *sp, + const SCREEN *sp, int mode, int milliseconds, int *timeleft) diff --git a/contrib/ncurses/ncurses/llib-ltinfow b/contrib/ncurses/ncurses/llib-ltinfow --- a/contrib/ncurses/ncurses/llib-ltinfow +++ b/contrib/ncurses/ncurses/llib-ltinfow @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 2012-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -72,6 +72,12 @@ const char *path) { return(*(NCURSES_BOOL *)0); } +#undef _nc_is_path_found +NCURSES_BOOL _nc_is_path_found( + const char *path, + struct stat *sb) + { return(*(NCURSES_BOOL *)0); } + #undef _nc_env_access int _nc_env_access(void) { return(*(int *)0); } @@ -277,7 +283,7 @@ #undef _nc_free_entry void _nc_free_entry( ENTRY *headp, - TERMTYPE2 *tterm) + const TERMTYPE2 *tterm) { /* void */ } #undef _nc_free_entries @@ -632,7 +638,7 @@ #undef _nc_keypad int _nc_keypad( SCREEN *sp, - int flag) + NCURSES_BOOL flag) { return(*(int *)0); } /* ./tinfo/lib_raw.c */ @@ -818,8 +824,8 @@ { return(*(char **)0); } #undef _nc_unicode_locale -int _nc_unicode_locale(void) - { return(*(int *)0); } +NCURSES_BOOL _nc_unicode_locale(void) + { return(*(NCURSES_BOOL *)0); } #undef _nc_locale_breaks_acs int _nc_locale_breaks_acs( @@ -1141,7 +1147,7 @@ #undef _nc_retrace_bool NCURSES_BOOL _nc_retrace_bool( - int code) + NCURSES_BOOL code) { return(*(NCURSES_BOOL *)0); } #undef _nc_retrace_char @@ -1358,7 +1364,7 @@ #undef _nc_timed_wait int _nc_timed_wait( - SCREEN *sp, + const SCREEN *sp, int mode, int milliseconds, int *timeleft) diff --git a/contrib/ncurses/ncurses/modules b/contrib/ncurses/ncurses/modules --- a/contrib/ncurses/ncurses/modules +++ b/contrib/ncurses/ncurses/modules @@ -1,6 +1,6 @@ -# $Id: modules,v 1.127 2020/09/12 17:58:12 tom Exp $ +# $Id: modules,v 1.133 2025/12/30 15:13:55 tom Exp $ ############################################################################## -# Copyright 2019,2020 Thomas E. Dickey # +# Copyright 2019-2020,2025 Thomas E. Dickey # # Copyright 1998-2013,2017 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -235,13 +235,25 @@ @ port_drivers lib_driver lib $(base) $(HEADER_DEPS) +# MSYS2, using termios +@ port_msys2 +gettimeofday lib $(win32con) $(HEADER_DEPS) +lib_win32util lib $(tinfo) $(HEADER_DEPS) +wcwidth lib $(win32con) $(HEADER_DEPS) +widechars lib $(wide) $(HEADER_DEPS) + +# MinGW, using Console API @ port_win32con gettimeofday lib $(win32con) $(HEADER_DEPS) +lib_win32con lib $(tinfo) $(HEADER_DEPS) +lib_win32util lib $(tinfo) $(HEADER_DEPS) wcwidth lib $(win32con) $(HEADER_DEPS) widechars lib $(wide) $(HEADER_DEPS) -win_driver lib $(win32con) $(HEADER_DEPS) +win32_driver lib $(win32con) $(HEADER_DEPS) +# MinGW-W64, using Console API and named pipes @ port_win32 +gettimeofday lib $(win32con) $(HEADER_DEPS) lib_win32con lib $(tinfo) $(HEADER_DEPS) lib_win32util lib $(tinfo) $(HEADER_DEPS) wcwidth lib $(win32con) $(HEADER_DEPS) diff --git a/contrib/ncurses/ncurses/new_pair.h b/contrib/ncurses/ncurses/new_pair.h --- a/contrib/ncurses/ncurses/new_pair.h +++ b/contrib/ncurses/ncurses/new_pair.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2021,2024 Thomas E. Dickey * * Copyright 2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -34,7 +34,7 @@ /* * 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 $ + * $Id: new_pair.h,v 1.16 2024/12/07 17:27:35 tom Exp $ */ #ifndef NEW_PAIR_H @@ -111,12 +111,12 @@ * 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) + ((sp != NULL) && (pair >= 0) && (pair < sp->_pair_limit) && sp->_coloron) -#if NCURSES_EXT_COLORS +#if NCURSES_EXT_FUNCS && 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_reset_color_pair(SCREEN*, int, const colorpair_t*); extern NCURSES_EXPORT(void) _nc_set_color_pair(SCREEN*, int, int); #else #define _nc_free_ordered_pairs(sp) /* nothing */ diff --git a/contrib/ncurses/ncurses/report_hashing.c b/contrib/ncurses/ncurses/report_ctype.c copy from contrib/ncurses/ncurses/report_hashing.c copy to contrib/ncurses/ncurses/report_ctype.c --- a/contrib/ncurses/ncurses/report_hashing.c +++ b/contrib/ncurses/ncurses/report_ctype.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2025 Thomas E. Dickey * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,43 +31,74 @@ ****************************************************************************/ #include -#include -MODULE_ID("$Id: report_hashing.c,v 1.3 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: report_ctype.c,v 1.1 2025/10/25 19:21:11 tom Exp $") + +#include +#include +#include + +#if HAVE_LANGINFO_CODESET +#include +#endif + +#define PER_LINE 32 static void -check_names(const char *name, NCURSES_CONST char *const *table, int termcap) +report(char *locale) { - int errs = 0; - int n; - struct name_table_entry const *entry_ptr; - const HashValue *hash_table = _nc_get_hash_table(termcap); - - printf("%s:\n", name); - for (n = 0; table[n] != NULL; ++n) { - entry_ptr = _nc_find_entry(table[n], hash_table); - if (entry_ptr == 0) { - printf(" %s\n", table[n]); - errs++; + int ch; + wint_t wch; + char *dot; + printf("Locale \"%s\"", locale); + if (setlocale(LC_CTYPE, locale) != NULL) { +#if HAVE_LANGINFO_CODESET + char *codeset = nl_langinfo(CODESET); + if (codeset != NULL) { + printf("\nCodeset \"%s\"", codeset); + } +#endif + for (ch = 0; ch < 256; ++ch) { + int code = '?'; + wch = ch; + if (isprint(ch) && iswprint(wch)) + code = '='; + if (!isprint(ch) && iswprint(wch)) + code = '+'; + if (isprint(ch) && !iswprint(wch)) + code = '-'; + if ((ch & (PER_LINE - 1)) == 0) + printf("\n%02X: ", ch); + putchar(code); } + putchar('\n'); + } else { + fprintf(stderr, "Cannot set locale\n"); + } + if ((dot = strchr(locale, '.')) != NULL) { + *dot = '\0'; + report(locale); } - if (errs) - printf("%d errors\n", errs); } int -main(void) +main(int argc, char *argv[]) { -#define CHECK_TI(name) check_names(#name, name, 0) -#define CHECK_TC(name) check_names(#name, name, 1) - - CHECK_TI(boolnames); - CHECK_TI(numnames); - CHECK_TI(strnames); - - CHECK_TC(boolcodes); - CHECK_TC(numcodes); - CHECK_TC(strcodes); - + if (argc > 1) { + int n; + for (n = 1; n < argc; ++n) { + report(argv[n]); + } + } else { + static char empty[1]; + char *locale = getenv("LC_CTYPE"); + if (locale == NULL) + locale = getenv("LC_ALL"); + if (locale == NULL) + locale = getenv("LANG"); + if (locale == NULL) + locale = empty; + report(locale); + } return EXIT_SUCCESS; } diff --git a/contrib/ncurses/ncurses/report_hashing.c b/contrib/ncurses/ncurses/report_hashing.c --- a/contrib/ncurses/ncurses/report_hashing.c +++ b/contrib/ncurses/ncurses/report_hashing.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2025 Thomas E. Dickey * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -33,7 +33,7 @@ #include #include -MODULE_ID("$Id: report_hashing.c,v 1.3 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: report_hashing.c,v 1.4 2025/02/20 01:02:09 tom Exp $") static void check_names(const char *name, NCURSES_CONST char *const *table, int termcap) @@ -46,7 +46,7 @@ printf("%s:\n", name); for (n = 0; table[n] != NULL; ++n) { entry_ptr = _nc_find_entry(table[n], hash_table); - if (entry_ptr == 0) { + if (entry_ptr == NULL) { printf(" %s\n", table[n]); errs++; } diff --git a/contrib/ncurses/ncurses/report_offsets.c b/contrib/ncurses/ncurses/report_offsets.c --- a/contrib/ncurses/ncurses/report_offsets.c +++ b/contrib/ncurses/ncurses/report_offsets.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2023,2024 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -34,10 +34,10 @@ #define NEW_PAIR_INTERNAL 1 #include -MODULE_ID("$Id: report_offsets.c,v 1.28 2024/02/24 15:59:09 tom Exp $") +MODULE_ID("$Id: report_offsets.c,v 1.32 2025/12/27 12:34:03 tom Exp $") #define show_size(type) \ - flag = 0; \ + flag = NULL; \ last = 0; \ printf("%5lu " #type "\n", (unsigned long)sizeof(type)) #define show_name(name) \ @@ -48,7 +48,7 @@ printf("?? incorrect order for " #type "." #member "\n"); \ printf("%5lu %c " #type "." #member "\n", next, flag ? *flag : ' '); \ last = next; \ - flag = 0 + flag = NULL #if NCURSES_WIDECHAR && NCURSES_EXT_COLORS #define show_COLORS(type,member) { flag = "c"; show_offset(type,member); } @@ -56,7 +56,7 @@ #define show_COLORS(type,member) /* nothing */ #endif -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER #define show_DRIVER(type,member) { flag = "d"; show_offset(type,member); } #else #define show_DRIVER(type,member) /* nothing */ @@ -102,11 +102,14 @@ #endif int -main(void) +main(int argc, char *argv[]) { - const char *flag = 0; + const char *flag = NULL; unsigned long last, next; + if (argc == 2 && !strcmp(argv[1], "-?")) + return EXIT_SUCCESS; + printf("Size/offsets of data structures:\n"); show_size(attr_t); @@ -183,7 +186,9 @@ show_REENTR(SCREEN, _ttytype); show_SPFUNC(SCREEN, use_tioctl); show_WIDECH(SCREEN, _screen_acs_fix); +#if NCURSES_EXT_FUNCS && NCURSES_EXT_COLORS show_COLORS(SCREEN, _ordered_pairs); +#endif show_TRACES(SCREEN, tracechr_buf); printf("\n"); diff --git a/contrib/ncurses/ncurses/term.priv.h b/contrib/ncurses/ncurses/term.priv.h --- a/contrib/ncurses/ncurses/term.priv.h +++ b/contrib/ncurses/ncurses/term.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2021-2023,2024 Thomas E. Dickey * + * Copyright 2021-2024,2025 Thomas E. Dickey * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /* - * $Id: term.priv.h,v 1.13 2024/03/02 20:43:06 tom Exp $ + * $Id: term.priv.h,v 1.14 2025/12/27 12:41:23 tom Exp $ * * term.priv.h * @@ -176,7 +176,7 @@ #include /* dbdLAST */ -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER struct DriverTCB; /* Terminal Control Block forward declaration */ #endif @@ -228,7 +228,7 @@ int count_tparm; #endif /* HAVE_TSEARCH */ -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER int (*term_driver)(struct DriverTCB*, const char*, int*); #endif diff --git a/contrib/ncurses/ncurses/tinfo/MKcaptab.awk b/contrib/ncurses/ncurses/tinfo/MKcaptab.awk --- a/contrib/ncurses/ncurses/tinfo/MKcaptab.awk +++ b/contrib/ncurses/ncurses/tinfo/MKcaptab.awk @@ -1,5 +1,5 @@ ############################################################################## -# Copyright 2020 Thomas E. Dickey # +# Copyright 2020,2024 Thomas E. Dickey # # Copyright 1998-2006,2007 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -26,7 +26,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: MKcaptab.awk,v 1.21 2020/02/02 23:34:34 tom Exp $ +# $Id: MKcaptab.awk,v 1.22 2024/12/07 20:52:55 tom Exp $ function add_string(text) { if (text != "IGNORE") { offsets[num_strings] = offset; @@ -53,7 +53,7 @@ printf "/* generated by MKcaptab.awk %s(%d) */\n", tablename, bigstrings; print "" if (bigstrings) { - printf "static struct alias *_nc_%s_table = 0;\n", tablename; + printf "static struct alias *_nc_%s_table = NULL;\n", tablename; print ""; printf "static const char %s_text[] = \"\\\n", tablename; } else { diff --git a/contrib/ncurses/ncurses/tinfo/MKcaptab.sh b/contrib/ncurses/ncurses/tinfo/MKcaptab.sh --- a/contrib/ncurses/ncurses/tinfo/MKcaptab.sh +++ b/contrib/ncurses/ncurses/tinfo/MKcaptab.sh @@ -1,6 +1,6 @@ #!/bin/sh ############################################################################## -# Copyright 2019-2020,2023 Thomas E. Dickey # +# Copyright 2019-2023,2024 Thomas E. Dickey # # Copyright 2007-2010,2011 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -27,13 +27,13 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: MKcaptab.sh,v 1.20 2023/04/22 15:12:57 tom Exp $ +# $Id: MKcaptab.sh,v 1.22 2024/12/07 21:30:44 tom Exp $ if test $# != 0 then AWK="$1"; shift 1 else - AWK=awk + AWK="awk" fi if test $# != 0 @@ -71,12 +71,12 @@ /* *INDENT-OFF* */ EOF -cat "$@" |./make_hash 1 info $OPT1 -cat "$@" |./make_hash 3 cap $OPT1 +cat "$@" |./make_hash 1 info "$OPT1" +cat "$@" |./make_hash 3 cap "$OPT1" -cat "$@" |$AWK -f $OPT2 bigstrings=$OPT1 tablename=capalias +cat "$@" |$AWK -f "$OPT2" bigstrings="$OPT1" tablename=capalias -cat "$@" |$AWK -f $OPT2 bigstrings=$OPT1 tablename=infoalias +cat "$@" |$AWK -f "$OPT2" bigstrings="$OPT1" tablename=infoalias cat <&2 - TERMINFO=`pwd`/$tmp_info - export TERMINFO + rm -rf "$tmp_info" + mkdir -p "$tmp_info" - TERMINFO_DIRS=$TERMINFO:$terminfo_dir - export TERMINFO_DIRS - - "$tic_path" -x "$terminfo_src" >&2 + "$tic_path" -o $tmp_info -x "$terminfo_src" >&2 else tmp_info= fi @@ -87,6 +84,8 @@ if [ "$*" ] then + opt_info= + [ -n "$tmp_info" ] && opt_info="-A $tmp_info" cat < @@ -95,7 +94,7 @@ for x in "$@" do echo "/* $x */" - "$infocmp_path" -E "$x" | sed -e 's/\/NCURSES_INT2/g' + "$infocmp_path" -x $opt_info -E "$x" | sed -e 's/[ ]short[ ]/ NCURSES_INT2 /g' done cat <&2 - rm -rf $tmp_info + rm -rf "$tmp_info" fi diff --git a/contrib/ncurses/ncurses/tinfo/MKkeys_list.sh b/contrib/ncurses/ncurses/tinfo/MKkeys_list.sh --- a/contrib/ncurses/ncurses/tinfo/MKkeys_list.sh +++ b/contrib/ncurses/ncurses/tinfo/MKkeys_list.sh @@ -1,7 +1,7 @@ #! /bin/sh -# $Id: MKkeys_list.sh,v 1.9 2024/01/19 12:26:30 tom Exp $ +# $Id: MKkeys_list.sh,v 1.10 2025/06/14 16:03:56 tom Exp $ ############################################################################## -# Copyright 2019-2022,2024 Thomas E. Dickey # +# Copyright 2019-2024,2025 Thomas E. Dickey # # Copyright 2001-2003,2017 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -35,27 +35,27 @@ # # Extract function-key names from the Caps file # -: ${AWK-awk} -: ${USE_SIGWINCH-0} -if test $# != 0 -then - DATA="$*" -else - DATA=../../include/Caps -fi +: "${AWK-awk}" +: "${USE_SIGWINCH-0}" data=data$$ +tabs='s/[ ][ ]*/ /g' trap 'rm -f $data; exit 1' 1 2 3 15 trap 'rm -f $data' 0 -cat $DATA | sed -e 's/[ ][ ]*/ /g' >$data +if [ $# != 0 ] +then + sed -e "$tabs" "$@" >$data +else + sed -e "$tabs" ../../include/Caps >$data +fi cat < #include +#include #ifndef USE_ROOT_ACCESS -#if HAVE_SETFSUID +#if HAVE_SETFSUID && HAVE_SYS_FSUID_H #include #else #include +#undef HAVE_SETFSUID +#define HAVE_SETFSUID 0 /* workaround for misconfigured system */ #endif #endif @@ -52,7 +55,7 @@ #include -MODULE_ID("$Id: access.c,v 1.37 2023/06/24 21:55:09 tom Exp $") +MODULE_ID("$Id: access.c,v 1.50 2025/12/27 16:50:06 tom Exp $") #define LOWERCASE(c) ((isalpha(UChar(c)) && isupper(UChar(c))) ? tolower(UChar(c)) : (c)) @@ -62,6 +65,108 @@ # define ACCESS access #endif +#if USE_DOS_PATHS +#define IsPathDelim(pp) (*(pp) == '/' || *(pp) == '\\') +#define UsesDrive(pp) (isalpha(UChar((pp)[0])) && (pp)[1] == ':') +#define IsRelative(pp) (*(pp) == '.' && ((*(pp+1) == '.' && IsPathDelim(pp+2)) || IsPathDelim(pp+1))) + +static char * +last_delim(const char *path) +{ + char *result = NULL; + char *check; + if ((check = strrchr(path, '\\')) != NULL) + result = check; + if ((check = strrchr(path, '/')) != NULL) { + if ((check - path) > (result - path)) + result = check; + } + return result; +} + +/* + * MinGW32 uses an environment variable to point to the directory containing + * its executables, without a registry setting to help. + */ +static const char * +msystem_base(void) +{ + const char *result = NULL; + char *env; + + if ((env = getenv("MSYSTEM")) != NULL + && !strcmp(env, "MINGW32") + && (env = getenv("WD")) != NULL + && UsesDrive(env)) { + result = env; + } + return result; +} + +/* + * For MinGW32, convert POSIX pathnames to DOS syntax, allowing use of stat() + * and access(). + */ +NCURSES_EXPORT(const char *) +_nc_to_dospath(const char *path, char *buffer) +{ + if (UsesDrive(path) || IsRelative(path)) { + if ((strlen(path) < PATH_MAX) && (strpbrk(path, "/") != NULL)) { + char ch; + char *ptr = buffer; + while ((ch = (*ptr++ = *path++)) != '\0') { + if (ch == '/') + ptr[-1] = '\\'; + } + path = buffer; + } + } else if (last_delim(path) != NULL) { + const char *env; + char *ptr; + char *last; + size_t needed = PATH_MAX - strlen(path) - 3; + + if ((env = msystem_base()) != NULL + && strlen(env) < needed + && strcpy(buffer, env) != NULL + && (last = last_delim(buffer)) != NULL) { + char ch; + + *last = '\0'; + + /* + * If that was a trailing "\", eat more until we actually + * trim the last leaf, which corresponds to the directory + * containing MSYS executables. + */ + while (last != NULL && last[1] == '\0') { + if ((last = last_delim(buffer)) != NULL) { + *last = '\0'; + } + } + if (last != NULL) { + if (!strncmp(path, "/usr", 4)) + path += 4; + if (IsPathDelim(path)) { + while ((last = last_delim(buffer)) != NULL && last[1] == '\0') + *last = '\0'; + ptr = buffer + strlen(buffer); + } else { + ptr = buffer + strlen(buffer); + *ptr++ = '\\'; + } + while ((ch = (*ptr++ = *path++)) != '\0') { + if (ch == '/') + ptr[-1] = '\\'; + } + path = buffer; + } + } + } + return path; +} +#endif + NCURSES_EXPORT(char *) _nc_rootname(char *path) { @@ -70,7 +175,7 @@ static char *temp; char *s; - if ((temp = strdup(result)) != 0) + if ((temp = strdup(result)) != NULL) result = temp; #if !MIXEDCASE_FILENAMES for (s = result; *s != '\0'; ++s) { @@ -78,7 +183,7 @@ } #endif #if defined(PROG_EXT) - if ((s = strrchr(result, '.')) != 0) { + if ((s = strrchr(result, '.')) != NULL) { if (!strcmp(s, PROG_EXT)) *s = '\0'; } @@ -94,10 +199,10 @@ _nc_is_abs_path(const char *path) { #if defined(__EMX__) || defined(__DJGPP__) -#define is_pathname(s) ((((s) != 0) && ((s)[0] == '/')) \ +#define is_pathname(s) ((((s) != NULL) && ((s)[0] == '/')) \ || (((s)[0] != 0) && ((s)[1] == ':'))) #else -#define is_pathname(s) ((s) != 0 && (s)[0] == '/') +#define is_pathname(s) ((s) != NULL && (s)[0] == '/') #endif return is_pathname(path); } @@ -110,10 +215,10 @@ { const char *test = strrchr(path, '/'); #ifdef __EMX__ - if (test == 0) + if (test == NULL) test = strrchr(path, '\\'); #endif - if (test == 0) + if (test == NULL) test = path; else test++; @@ -131,7 +236,10 @@ { int result; - if (path == 0) { + FixupPathname(path); + + if (path == NULL) { + errno = ENOENT; result = -1; } else if (ACCESS(path, mode) < 0) { if ((mode & W_OK) != 0 @@ -142,7 +250,7 @@ _nc_STRCPY(head, path, sizeof(head)); leaf = _nc_basename(head); - if (leaf == 0) + if (leaf == NULL) leaf = head; *leaf = '\0'; if (head == leaf) @@ -150,6 +258,7 @@ result = ACCESS(head, R_OK | W_OK | X_OK); } else { + errno = EPERM; result = -1; } } else { @@ -164,7 +273,7 @@ bool result = FALSE; struct stat sb; - if (stat(path, &sb) == 0 + if (_nc_is_path_found(path, &sb) && S_ISDIR(sb.st_mode)) { result = TRUE; } @@ -177,13 +286,26 @@ bool result = FALSE; struct stat sb; - if (stat(path, &sb) == 0 + if (_nc_is_path_found(path, &sb) && S_ISREG(sb.st_mode)) { result = TRUE; } return result; } +NCURSES_EXPORT(bool) +_nc_is_path_found(const char *path, struct stat * sb) +{ + bool result = FALSE; + + FixupPathname(path); + + if (stat(path, sb) == 0) { + result = TRUE; + } + return result; +} + #if HAVE_GETEUID && HAVE_GETEGID #define is_posix_elevated() \ (getuid() != geteuid() \ @@ -247,6 +369,29 @@ } #ifndef USE_ROOT_ACCESS +static int +is_a_file(int fd) +{ + int result = FALSE; + if (fd >= 0) { + struct stat sb; + if (fstat(fd, &sb) == 0) { + switch (sb.st_mode & S_IFMT) { + case S_IFBLK: + case S_IFCHR: + case S_IFDIR: + /* disallow devices and directories */ + break; + default: + /* allow regular files, fifos and sockets */ + result = TRUE; + break; + } + } + } + return result; +} + /* * Limit privileges if possible; otherwise disallow access for updating files. */ @@ -254,15 +399,24 @@ _nc_safe_fopen(const char *path, const char *mode) { FILE *result = NULL; + #if HAVE_SETFSUID lower_privileges(); + FixupPathname(path); result = fopen(path, mode); resume_elevation(); #else + FixupPathname(path); if (!is_elevated() || *mode == 'r') { result = fopen(path, mode); } #endif + if (result != NULL) { + if (!is_a_file(fileno(result))) { + fclose(result); + result = NULL; + } + } return result; } @@ -272,13 +426,21 @@ int result = -1; #if HAVE_SETFSUID lower_privileges(); + FixupPathname(path); result = open(path, flags, mode); resume_elevation(); #else + FixupPathname(path); if (!is_elevated() || (flags & O_RDONLY)) { result = open(path, flags, mode); } #endif + if (result >= 0) { + if (!is_a_file(result)) { + close(result); + result = -1; + } + } return result; } #endif /* USE_ROOT_ACCESS */ diff --git a/contrib/ncurses/ncurses/tinfo/add_tries.c b/contrib/ncurses/ncurses/tinfo/add_tries.c --- a/contrib/ncurses/ncurses/tinfo/add_tries.c +++ b/contrib/ncurses/ncurses/tinfo/add_tries.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2020,2023 Thomas E. Dickey * + * Copyright 2019-2023,2024 Thomas E. Dickey * * Copyright 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -41,7 +41,7 @@ #include #include -MODULE_ID("$Id: add_tries.c,v 1.13 2023/06/24 15:36:13 tom Exp $") +MODULE_ID("$Id: add_tries.c,v 1.14 2024/12/07 20:04:23 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)) @@ -57,14 +57,14 @@ if (!VALID_STRING(str) || *txt == '\0' || code == 0) returnCode(ERR); - if ((*tree) != 0) { + if ((*tree) != NULL) { ptr = savedptr = (*tree); for (;;) { unsigned char cmp = *txt; while (!CMP_TRY(ptr->ch, cmp) - && ptr->sibling != 0) + && ptr->sibling != NULL) ptr = ptr->sibling; if (CMP_TRY(ptr->ch, cmp)) { @@ -72,12 +72,12 @@ ptr->value = (unsigned short) code; returnCode(OK); } - if (ptr->child != 0) + if (ptr->child != NULL) ptr = ptr->child; else break; } else { - if ((ptr->sibling = typeCalloc(TRIES, 1)) == 0) { + if ((ptr->sibling = typeCalloc(TRIES, 1)) == NULL) { returnCode(ERR); } @@ -91,7 +91,7 @@ } else { /* (*tree) == 0 :: First sequence to be added */ savedptr = ptr = (*tree) = typeCalloc(TRIES, 1); - if (ptr == 0) { + if (ptr == NULL) { returnCode(ERR); } @@ -106,8 +106,8 @@ ptr = ptr->child; - if (ptr == 0) { - while ((ptr = savedptr) != 0) { + if (ptr == NULL) { + while ((ptr = savedptr) != NULL) { savedptr = ptr->child; free(ptr); } diff --git a/contrib/ncurses/ncurses/tinfo/alloc_entry.c b/contrib/ncurses/ncurses/tinfo/alloc_entry.c --- a/contrib/ncurses/ncurses/tinfo/alloc_entry.c +++ b/contrib/ncurses/ncurses/tinfo/alloc_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2013,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -48,7 +48,7 @@ #include -MODULE_ID("$Id: alloc_entry.c,v 1.79 2023/09/15 08:16:12 tom Exp $") +MODULE_ID("$Id: alloc_entry.c,v 1.83 2025/02/16 17:57:12 tom Exp $") #define ABSENT_OFFSET -1 #define CANCELLED_OFFSET -2 @@ -104,7 +104,7 @@ NCURSES_EXPORT(char *) _nc_save_str(const char *string) { - char *result = 0; + char *result = NULL; size_t old_next_free = next_free; if (stringbuf != NULL) { @@ -140,7 +140,7 @@ /* copy the string parts to allocated storage, preserving pointers to it */ { int offsets[MAX_ENTRY_SIZE / sizeof(short)]; - int useoffsets[MAX_USES]; + int useoffsets[HARD_MAX_USES]; unsigned i, n; unsigned nuses; TERMTYPE2 *tp; @@ -164,7 +164,7 @@ } for (i = 0; i < nuses; i++) { - if (ep->uses[i].name == 0) { + if (ep->uses[i].name == NULL) { ep->uses[i].name = _nc_save_str(ep->uses[i].name); } } @@ -187,14 +187,17 @@ } for (i = 0; i < nuses; i++) { - if (ep->uses[i].name == 0) + if (ep->uses[i].name == NULL) 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); + if (stringbuf == NULL) + (void) memset(tp->str_table, 0, next_free); + else + (void) memcpy(tp->str_table, stringbuf, next_free); tp->term_names = tp->str_table + n; for_each_string(i, &(ep->tterm)) { @@ -234,7 +237,7 @@ for (i = 0; i < nuses; i++) { if (useoffsets[i] == ABSENT_OFFSET) { - ep->uses[i].name = 0; + ep->uses[i].name = NULL; } else { ep->uses[i].name = strdup(tp->str_table + useoffsets[i]); } @@ -255,7 +258,7 @@ #endif unsigned i; - if (source == 0 || from == 0 || target == 0 || to == 0) + if (source == NULL || from == NULL || target == NULL || to == NULL) return; #if NCURSES_XNAMES @@ -357,6 +360,8 @@ } #endif for_each_boolean(i, from) { + if (i >= NUM_BOOLEANS(to)) + break; if (to->Booleans[i] != (NCURSES_SBOOL) CANCELLED_BOOLEAN) { int mergebool = from->Booleans[i]; @@ -368,6 +373,8 @@ } for_each_number(i, from) { + if (i >= NUM_NUMBERS(to)) + break; if (to->Numbers[i] != CANCELLED_NUMERIC) { int mergenum = from->Numbers[i]; @@ -384,6 +391,8 @@ * we ever want to deallocate entries. */ for_each_string(i, from) { + if (i >= NUM_STRINGS(to)) + break; if (to->Strings[i] != CANCELLED_STRING) { char *mergestring = from->Strings[i]; diff --git a/contrib/ncurses/ncurses/tinfo/alloc_ttype.c b/contrib/ncurses/ncurses/tinfo/alloc_ttype.c --- a/contrib/ncurses/ncurses/tinfo/alloc_ttype.c +++ b/contrib/ncurses/ncurses/tinfo/alloc_ttype.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1999-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -43,7 +43,7 @@ #include -MODULE_ID("$Id: alloc_ttype.c,v 1.51 2023/09/09 23:15:53 tom Exp $") +MODULE_ID("$Id: alloc_ttype.c,v 1.55 2025/02/16 18:31:37 tom Exp $") #if NCURSES_XNAMES /* @@ -181,7 +181,7 @@ * Returns the first index in ext_Names[] for the given token-type */ static unsigned -_nc_first_ext_name(TERMTYPE2 *tp, int token_type) +_nc_first_ext_name(const TERMTYPE2 *tp, int token_type) { unsigned first; @@ -206,7 +206,7 @@ * Returns the last index in ext_Names[] for the given token-type */ static unsigned -_nc_last_ext_name(TERMTYPE2 *tp, int token_type) +_nc_last_ext_name(const TERMTYPE2 *tp, int token_type) { unsigned last; @@ -229,15 +229,17 @@ * Lookup an entry from extended-names, returning -1 if not found */ static int -_nc_find_ext_name(TERMTYPE2 *tp, char *name, int token_type) +_nc_find_ext_name(const TERMTYPE2 *tp, const 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); + if (name != NULL) { + 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; + for (j = first; j < last; j++) { + if (!strcmp(name, tp->ext_Names[j])) { + return (int) j; + } } } return -1; @@ -248,7 +250,7 @@ * (e.g., Booleans[]). */ static int -_nc_ext_data_index(TERMTYPE2 *tp, int n, int token_type) +_nc_ext_data_index(const TERMTYPE2 *tp, int n, int token_type) { switch (token_type) { case BOOLEAN: @@ -271,7 +273,7 @@ * data. */ static bool -_nc_del_ext_name(TERMTYPE2 *tp, char *name, int token_type) +_nc_del_ext_name(TERMTYPE2 *tp, const char *name, int token_type) { int first; @@ -381,9 +383,12 @@ NonNull(to->term_names), NonNull(from->term_names))); for (j = first; j < last;) { - char *name = to->ext_Names[j]; + char *name; int j_str = to->num_Strings - first - to->ext_Strings; + if ((j + j_str) > NUM_STRINGS(to)) + break; + name = to->ext_Names[j]; 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) @@ -532,8 +537,8 @@ char *new_table; size_t new_table_size; #if NCURSES_EXT_NUMBERS - short *oldptr = 0; - int *newptr = 0; + short *oldptr = NULL; + int *newptr = NULL; #endif DEBUG(2, (T_CALLED("copy_termtype(dst=%p, src=%p, mode=%d)"), (void *) @@ -594,7 +599,7 @@ TYPE_MALLOC(int, NUM_NUMBERS(dst), newptr); dst->Numbers = newptr; } - if ((mode == srcINT) && (oldptr != 0)) { + if ((mode == srcINT) && (oldptr != NULL)) { DEBUG(2, ("...copy int ->short")); for (i = 0; i < NUM_NUMBERS(dst); ++i) { if (src->Numbers[i] > MAX_OF_TYPE(short)) { @@ -603,7 +608,7 @@ oldptr[i] = (short) src->Numbers[i]; } } - } else if ((mode == dstINT) && (newptr != 0)) { + } else if ((mode == dstINT) && (newptr != NULL)) { DEBUG(2, ("...copy short ->int")); for (i = 0; i < NUM_NUMBERS(dst); ++i) { newptr[i] = ((const short *) (src->Numbers))[i]; @@ -672,7 +677,7 @@ } } } else { - dst->ext_Names = 0; + dst->ext_Names = NULL; } #endif (void) new_table_size; diff --git a/contrib/ncurses/ncurses/tinfo/captoinfo.c b/contrib/ncurses/ncurses/tinfo/captoinfo.c --- a/contrib/ncurses/ncurses/tinfo/captoinfo.c +++ b/contrib/ncurses/ncurses/tinfo/captoinfo.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -98,7 +98,7 @@ #include #include -MODULE_ID("$Id: captoinfo.c,v 1.102 2021/09/04 10:29:15 tom Exp $") +MODULE_ID("$Id: captoinfo.c,v 1.109 2025/11/23 20:22:38 tom Exp $") #if 0 #define DEBUG_THIS(p) DEBUG(9, p) @@ -124,7 +124,7 @@ init_string(void) /* initialize 'my_string', 'my_length' */ { - if (my_string == 0) + if (my_string == NULL) TYPE_MALLOC(char, my_length = 256, my_string); *my_string = '\0'; @@ -138,7 +138,7 @@ 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) + if (my_string == NULL) _nc_err_abort(MSG_NO_MEMORY); d = my_string + have; } @@ -247,24 +247,24 @@ } static void -getparm(int parm, int n) -/* push n copies of param on the terminfo stack if not already there */ +getparam(int parameter, int n) +/* push n copies of parameter on the terminfo stack if not already there */ { int nn; if (seenr) { - if (parm == 1) - parm = 2; - else if (parm == 2) - parm = 1; + if (parameter == 1) + parameter = 2; + else if (parameter == 2) + parameter = 1; } for (nn = 0; nn < n; ++nn) { dp = save_string(dp, "%p"); - dp = save_char(dp, '0' + parm); + dp = save_char(dp, '0' + parameter); } - if (onstack == parm) { + if (onstack == parameter) { if (n > 1) { _nc_warning("string may not be optimal"); dp = save_string(dp, "%Pa"); @@ -277,13 +277,13 @@ if (onstack != 0) push(); - onstack = parm; + onstack = parameter; - if (seenn && parm < 3) { + if (seenn && parameter < 3) { dp = save_string(dp, "%{96}%^"); } - if (seenm && parm < 3) { + if (seenm && parameter < 3) { dp = save_string(dp, "%{127}%^"); } } @@ -313,8 +313,8 @@ dp = init_string(); /* skip the initial padding (if we haven't been told not to) */ - capstart = 0; - if (s == 0) + capstart = NULL; + if (s == NULL) s = ""; if (parameterized >= 0 && isdigit(UChar(*s))) for (capstart = s; *s != '\0'; s++) @@ -353,20 +353,20 @@ break; case '6': case 'B': - getparm(param, 1); + getparam(param, 1); dp = save_string(dp, "%{10}%/%{16}%*"); - getparm(param, 1); + getparam(param, 1); dp = save_string(dp, "%{10}%m%+"); break; case '8': case 'D': - getparm(param, 2); + getparam(param, 2); dp = save_string(dp, "%{2}%*%-"); break; case '>': /* %?%{x}%>%t%{y}%+%; */ if (s[0] && s[1]) { - getparm(param, 2); + getparam(param, 2); dp = save_string(dp, "%?"); s += cvtchar(s); dp = save_string(dp, "%>%t"); @@ -385,9 +385,9 @@ int l; l = 2; if (*s != '=') - getparm(param, 1); + getparam(param, 1); if (s[1] == 'p') { - getparm(param + s[2] - '@', 1); + getparam(param + s[2] - '@', 1); if (param != onstack) { pop(); param--; @@ -423,12 +423,12 @@ s += l; break; } - getparm(param, 1); + getparam(param, 1); s += cvtchar(s); dp = save_string(dp, "%+"); break; case '+': - getparm(param, 1); + getparam(param, 1); s += cvtchar(s); dp = save_string(dp, "%+%c"); pop(); @@ -436,22 +436,22 @@ case 's': #ifdef WATERLOO s += cvtchar(s); - getparm(param, 1); + getparam(param, 1); dp = save_string(dp, "%-"); #else - getparm(param, 1); + getparam(param, 1); dp = save_string(dp, "%s"); pop(); #endif /* WATERLOO */ break; case '-': s += cvtchar(s); - getparm(param, 1); + getparam(param, 1); dp = save_string(dp, "%-%c"); pop(); break; case '.': - getparm(param, 1); + getparam(param, 1); dp = save_string(dp, "%c"); pop(); break; @@ -467,18 +467,18 @@ goto invalid; case '2': see02: - getparm(param, 1); + getparam(param, 1); dp = save_string(dp, "%2d"); pop(); break; case '3': see03: - getparm(param, 1); + getparam(param, 1); dp = save_string(dp, "%3d"); pop(); break; case 'd': - getparm(param, 1); + getparam(param, 1); dp = save_string(dp, "%d"); pop(); break; @@ -535,8 +535,7 @@ static int bcd_expression(const char *str) { - /* leave this non-const for HPUX */ - static char fmt[] = "%%p%c%%{10}%%/%%{16}%%*%%p%c%%{10}%%m%%+"; + static const char fmt[] = "%%p%c%%{10}%%/%%{16}%%*%%p%c%%{10}%%m%%+"; int len = 0; char ch1, ch2; @@ -550,7 +549,7 @@ char buffer[80]; int tst; _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) fmt, ch1, ch2); - tst = strlen(buffer) - 1; + tst = (int) strlen(buffer) - 1; assert(len == tst); } #endif @@ -620,7 +619,7 @@ { int seenone = 0, seentwo = 0, saw_m = 0, saw_n = 0; const char *padding; - const char *trimmed = 0; + const char *trimmed = NULL; int in0, in1, in2; char ch1 = 0, ch2 = 0; char *bufptr = init_string(); @@ -656,9 +655,9 @@ for (; !syntax_error && *str && - ((trimmed == 0) || (str < trimmed)); str++) { + ((trimmed == NULL) || (str < trimmed)); str++) { int c1, c2; - char *cp = 0; + char *cp = NULL; if (str[0] == '^') { if (str[1] == '\0' || (str + 1) == trimmed) { @@ -744,7 +743,7 @@ ++myfix; } } - } else if (strchr("E\\nrtbf", xx1) == 0) { + } else if (strchr("E\\nrtbf", xx1) == NULL) { switch (xx1) { case 'e': xx1 = 'E'; @@ -815,7 +814,7 @@ && ((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) + if ((str = strstr(str, ";m")) == NULL) break; /* cannot happen */ ++str; if (in2 == 48) { @@ -981,8 +980,8 @@ * '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') + assert(str != NULL); + if (str == NULL || *str == '\0') break; } /* endwhile (*str) */ @@ -1029,7 +1028,7 @@ char buf[BUFSIZ]; ++curr_line; - if (fgets(buf, sizeof(buf), stdin) == 0) + if (fgets(buf, sizeof(buf), stdin) == NULL) break; buf[strlen(buf) - 1] = '\0'; _nc_set_source(buf); @@ -1051,7 +1050,7 @@ NCURSES_EXPORT(void) _nc_captoinfo_leaks(void) { - if (my_string != 0) { + if (my_string != NULL) { FreeAndNull(my_string); } my_length = 0; diff --git a/contrib/ncurses/ncurses/tinfo/comp_error.c b/contrib/ncurses/ncurses/tinfo/comp_error.c --- a/contrib/ncurses/ncurses/tinfo/comp_error.c +++ b/contrib/ncurses/ncurses/tinfo/comp_error.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2020,2023 Thomas E. Dickey * + * Copyright 2019-2023,2024 Thomas E. Dickey * * Copyright 1998-2012,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -42,7 +42,7 @@ #include -MODULE_ID("$Id: comp_error.c,v 1.44 2023/06/15 20:27:02 tom Exp $") +MODULE_ID("$Id: comp_error.c,v 1.45 2024/12/07 20:04:23 tom Exp $") NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings = FALSE; NCURSES_EXPORT_VAR(int) _nc_curr_line = 0; /* current line # in input */ @@ -75,9 +75,9 @@ _nc_set_type(const char *const name) { #define MY_SIZE (size_t) MAX_NAME_SIZE - if (TermType == 0) + if (TermType == NULL) TermType = typeMalloc(char, MY_SIZE + 1); - if (TermType != 0) { + if (TermType != NULL) { TermType[0] = '\0'; if (name) { _nc_STRNCAT(TermType, name, MY_SIZE, MY_SIZE); @@ -89,13 +89,13 @@ _nc_get_type(char *name) { #if NO_LEAKS - if (name == 0 && TermType != 0) { + if (name == NULL && TermType != NULL) { FreeAndNull(TermType); return; } #endif - if (name != 0) - _nc_STRCPY(name, TermType != 0 ? TermType : "", MAX_NAME_SIZE); + if (name != NULL) + _nc_STRCPY(name, TermType != NULL ? TermType : "", MAX_NAME_SIZE); } static NCURSES_INLINE void @@ -106,7 +106,7 @@ 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') + if (TermType != NULL && TermType[0] != '\0') fprintf(stderr, ", terminal '%s'", TermType); fputc(':', stderr); fputc(' ', stderr); diff --git a/contrib/ncurses/ncurses/tinfo/comp_expand.c b/contrib/ncurses/ncurses/tinfo/comp_expand.c --- a/contrib/ncurses/ncurses/tinfo/comp_expand.c +++ b/contrib/ncurses/ncurses/tinfo/comp_expand.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2021,2023 Thomas E. Dickey * + * Copyright 2020-2023,2024 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -36,7 +36,7 @@ #include #include -MODULE_ID("$Id: comp_expand.c,v 1.35 2023/04/28 20:59:06 tom Exp $") +MODULE_ID("$Id: comp_expand.c,v 1.37 2024/12/07 21:12:53 tom Exp $") #if 0 #define DEBUG_THIS(p) DEBUG(9, p) @@ -73,18 +73,18 @@ int offset; } fixups[MAX_TC_FIXUPS]; - if (srcp == 0) { + if (srcp == NULL) { #if NO_LEAKS - if (buffer != 0) { + if (buffer != NULL) { FreeAndNull(buffer); length = 0; } #endif - return 0; + return NULL; } - if (buffer == 0 || need > length) { - if ((buffer = typeRealloc(char, length = need, buffer)) == 0) - return 0; + if (buffer == NULL || need > length) { + if ((buffer = typeRealloc(char, length = need, buffer)) == NULL) + return NULL; } DEBUG_THIS(("_nc_tic_expand %s:%s:%s", @@ -124,12 +124,12 @@ case 1: if (str[0] == L_BRACE && isdigit(UChar(str[1]))) { - char *dst = 0; + char *dst = NULL; long value = strtol(str + 1, &dst, 0); - if (dst != 0 + if (dst != NULL && *dst == R_BRACE && value < 127 - && isprint((int) value)) { + && isprint(UChar(value))) { ch = (int) value; buffer[bufp++] = S_QUOTE; if (ch == '\\' diff --git a/contrib/ncurses/ncurses/tinfo/comp_hash.c b/contrib/ncurses/ncurses/tinfo/comp_hash.c --- a/contrib/ncurses/ncurses/tinfo/comp_hash.c +++ b/contrib/ncurses/ncurses/tinfo/comp_hash.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2020,2023 Thomas E. Dickey * + * Copyright 2019-2023,2024 Thomas E. Dickey * * Copyright 1998-2008,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -45,7 +45,7 @@ #include #include -MODULE_ID("$Id: comp_hash.c,v 1.55 2023/06/24 13:29:43 tom Exp $") +MODULE_ID("$Id: comp_hash.c,v 1.56 2024/12/07 20:05:08 tom Exp $") /* * Finds the entry for the given string in the hash table if present. @@ -58,7 +58,7 @@ 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 *ptr = NULL; struct name_table_entry const *real_table; hashvalue = data->hash_of(string); @@ -71,7 +71,7 @@ ptr = real_table + data->table_data[hashvalue]; while (!data->compare_names(ptr->nte_name, string)) { if (ptr->nte_link < 0) { - ptr = 0; + ptr = NULL; break; } ptr = real_table + (ptr->nte_link @@ -108,7 +108,7 @@ while (ptr->nte_type != type || !data->compare_names(ptr->nte_name, string)) { if (ptr->nte_link < 0) { - ptr = 0; + ptr = NULL; break; } ptr = table + (ptr->nte_link + data->table_data[data->table_size]); @@ -125,7 +125,7 @@ { const HashData *data = _nc_get_hash_user(); int hashvalue; - struct user_table_entry const *ptr = 0; + struct user_table_entry const *ptr = NULL; struct user_table_entry const *real_table; hashvalue = data->hash_of(string); @@ -138,7 +138,7 @@ ptr = real_table + data->table_data[hashvalue]; while (!data->compare_names(ptr->ute_name, string)) { if (ptr->ute_link < 0) { - ptr = 0; + ptr = NULL; break; } ptr = real_table + (ptr->ute_link diff --git a/contrib/ncurses/ncurses/tinfo/comp_parse.c b/contrib/ncurses/ncurses/tinfo/comp_parse.c --- a/contrib/ncurses/ncurses/tinfo/comp_parse.c +++ b/contrib/ncurses/ncurses/tinfo/comp_parse.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2023,2024 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -48,7 +48,7 @@ #include -MODULE_ID("$Id: comp_parse.c,v 1.134 2024/02/10 15:52:11 tom Exp $") +MODULE_ID("$Id: comp_parse.c,v 1.141 2025/12/27 12:33:34 tom Exp $") static void sanity_check2(TERMTYPE2 *, bool); NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype2) (TERMTYPE2 *, bool) = sanity_check2; @@ -64,13 +64,13 @@ DEBUG(2, (T_CALLED("enqueue(ep=%p)"), (void *) ep)); newp = _nc_copy_entry(ep); - if (newp == 0) + if (newp == NULL) _nc_err_abort(MSG_NO_MEMORY); newp->last = _nc_tail; _nc_tail = newp; - newp->next = 0; + newp->next = NULL; if (newp->last) newp->last->next = newp; DEBUG(2, (T_RETURN(""))); @@ -81,7 +81,7 @@ static char * force_bar(char *dst, char *src) { - if (strchr(src, '|') == 0) { + if (strchr(src, '|') == NULL) { size_t len = strlen(src); if (len > MAX_NAME_SIZE) len = MAX_NAME_SIZE; @@ -91,7 +91,7 @@ } return src; } -#define ForceBar(dst, src) ((strchr(src, '|') == 0) ? force_bar(dst, src) : src) +#define ForceBar(dst, src) ((strchr(src, '|') == NULL) ? force_bar(dst, src) : src) #if NCURSES_USE_TERMCAP && NCURSES_XNAMES static char * @@ -99,7 +99,7 @@ { char *bar = strchr(name, '|'); - if (bar != 0 && (bar - name) == 2) + if (bar != NULL && (bar - name) == 2) name = bar + 1; return name; @@ -109,7 +109,9 @@ static bool check_collisions(char *n1, char *n2, int counter) { - char *pstart, *qstart, *pend, *qend; + const char *pstart; + const char *qstart; + char *pend, *qend; char nc1[NAMEBUFFER_SIZE]; char nc2[NAMEBUFFER_SIZE]; @@ -150,7 +152,7 @@ name_ending(char *name) { if (*name == '\0') { - name = 0; + name = NULL; } else { while (*name != '\0' && *name != '|') ++name; @@ -401,7 +403,7 @@ _nc_resolve_uses2(bool fullresolve, bool literal) /* try to resolve all use capabilities */ { - ENTRY *qp, *rp, *lastread = 0; + ENTRY *qp, *rp, *lastread = NULL; bool keepgoing; unsigned i, j; int total_unresolved, multiples; @@ -450,7 +452,7 @@ char *lookfor = qp->uses[i].name; long lookline = qp->uses[i].line; - if (lookfor == 0) + if (lookfor == NULL) continue; foundit = FALSE; @@ -516,7 +518,7 @@ _nc_curr_line = (int) lookline; _nc_warning("resolution of use=%s failed", lookfor); - qp->uses[i].link = 0; + qp->uses[i].link = NULL; } } } @@ -536,12 +538,18 @@ */ if (fullresolve) { do { + bool attempts; + bool progress; ENTRY merged; + attempts = FALSE; + progress = FALSE; keepgoing = FALSE; for_entry_list(qp) { if (qp->nuses > 0) { + attempts = TRUE; + DEBUG(2, ("%s: attempting merge of %d entries", _nc_first_name(qp->tterm.term_names), qp->nuses)); @@ -597,16 +605,34 @@ #endif qp->tterm = merged.tterm; _nc_wrap_entry(qp, TRUE); + progress = TRUE; /* - * We know every entry is resolvable because name resolution - * didn't bomb. So go back for another pass. + * Every entry should be resolvable because name resolution + * did not fail. Continue if we have just made a change, + * or another entry may be changeable. */ /* FALLTHRU */ incomplete: keepgoing = TRUE; } } + + /* + * If we went all the way through the list without making any + * changes, while there were remaining use-linkages, something went + * wrong. Give up. + */ + if (!progress && attempts) { + for_entry_list(qp) { + for (i = 0; i < qp->nuses; ++i) { + _nc_warning("problem with use=%s", qp->uses[i].name); + } + } + _nc_warning("merge failed, infinite loop"); + DEBUG(2, (T_RETURN("false"))); + return FALSE; + } } while (keepgoing); @@ -640,6 +666,9 @@ TerminalType(&fake_tm) = qp->tterm; _nc_set_screen(&fake_sp); set_curterm(&fake_tm); +#if USE_TERM_DRIVER + ((TERMINAL_CONTROL_BLOCK *) (CurTerm))->drv = &_nc_TINFO_DRIVER; +#endif _nc_check_termtype2(&qp->tterm, literal); @@ -756,7 +785,7 @@ _nc_names_leaks(); _nc_codes_leaks(); #endif - _nc_tic_expand(0, FALSE, 0); + _nc_tic_expand(NULL, FALSE, 0); T((T_RETURN(""))); } diff --git a/contrib/ncurses/ncurses/tinfo/comp_scan.c b/contrib/ncurses/ncurses/tinfo/comp_scan.c --- a/contrib/ncurses/ncurses/tinfo/comp_scan.c +++ b/contrib/ncurses/ncurses/tinfo/comp_scan.c @@ -1,5 +1,5 @@ /**************************************************************************** -,* Copyright 2020-2022,2023 Thomas E. Dickey * + * Copyright 2020-2023,2024 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -53,7 +53,7 @@ #include #include -MODULE_ID("$Id: comp_scan.c,v 1.122 2023/05/27 20:13:10 tom Exp $") +MODULE_ID("$Id: comp_scan.c,v 1.126 2024/12/07 21:17:54 tom Exp $") /* * Maximum length of string capability we'll accept before raising an error. @@ -63,7 +63,7 @@ #define iswhite(ch) (ch == ' ' || ch == '\t') -NCURSES_EXPORT_VAR (int) _nc_syntax = 0; /* termcap or terminfo? */ +NCURSES_EXPORT_VAR (int) _nc_syntax = SYN_TERMINFO; /* 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 */ @@ -72,7 +72,7 @@ NCURSES_EXPORT_VAR (struct token) _nc_curr_token = { - 0, 0, 0 + NULL, 0, NULL }; /***************************************************************************** @@ -118,12 +118,12 @@ (T_CALLED("_nc_reset_input(fp=%p, buf=%p)"), (void *) fp, buf)); pushtype = NO_PUSHBACK; - if (pushname != 0) + if (pushname != NULL) pushname[0] = '\0'; yyin = fp; bufstart = bufptr = buf; _nc_curr_file_pos = 0L; - if (fp != 0) + if (fp != NULL) _nc_curr_line = 0; _nc_curr_col = 0; @@ -199,18 +199,18 @@ int the_char; if (!yyin) { - if (result != 0) { + if (result != NULL) { FreeAndNull(result); FreeAndNull(pushname); - bufptr = 0; - bufstart = 0; + bufptr = NULL; + bufstart = NULL; 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') + if (bufptr == NULL || *bufptr == '\0') return (EOF); if (*bufptr == '\n') { _nc_curr_line++; @@ -229,12 +229,12 @@ do { size_t used = 0; - bufstart = 0; + bufstart = NULL; do { if (used + (LEXBUFSIZ / 4) >= allocated) { allocated += (allocated + LEXBUFSIZ); result = typeRealloc(char, allocated, result); - if (result == 0) + if (result == NULL) return (EOF); if (bufstart) bufstart = result; @@ -256,7 +256,7 @@ if (used != 0) _nc_STRCAT(result, "\n", allocated); } - if ((bufptr = bufstart) != 0) { + if ((bufptr = bufstart) != NULL) { used = strlen(bufptr); if (used == 0) return (EOF); @@ -409,12 +409,12 @@ if (pushtype != NO_PUSHBACK) { int retval = pushtype; - _nc_set_type(pushname != 0 ? pushname : ""); + _nc_set_type(pushname != NULL ? pushname : ""); DEBUG(3, ("pushed-back token: `%s', class %d", _nc_curr_token.tk_name, pushtype)); pushtype = NO_PUSHBACK; - if (pushname != 0) + if (pushname != NULL) pushname[0] = '\0'; /* currtok wasn't altered by _nc_push_token() */ @@ -423,11 +423,11 @@ } if (end_of_stream()) { - yyin = 0; + yyin = NULL; (void) next_char(); /* frees its allocated memory */ - if (tok_buf != 0) { + if (tok_buf != NULL) { if (_nc_curr_token.tk_name == tok_buf) - _nc_curr_token.tk_name = 0; + _nc_curr_token.tk_name = NULL; } DEBUG(3, (T_RETURN("%d"), EOF)); return (EOF); @@ -441,7 +441,7 @@ } ch = eat_escaped_newline(ch); - _nc_curr_token.tk_valstring = 0; + _nc_curr_token.tk_valstring = NULL; #ifdef TRACE old_line = _nc_curr_line; @@ -477,7 +477,7 @@ #if NCURSES_EXT_FUNCS && !(ch == '.' && _nc_disable_period) #endif - && ((strchr) (terminfo_punct, (char) ch) == 0)) { + && ((strchr) (terminfo_punct, (char) ch) == NULL)) { if (!silent) _nc_warning("Illegal character (expected alphanumeric or %s) - '%s'", terminfo_punct, unctrl(UChar(ch))); @@ -485,7 +485,7 @@ goto start_token; } - if (tok_buf == 0) + if (tok_buf == NULL) tok_buf = typeMalloc(char, TOK_BUF_SIZE); #ifdef TRACE @@ -501,14 +501,14 @@ _nc_start_line = _nc_curr_line; _nc_syntax = ERR; - after_name = 0; - after_list = 0; + after_name = NULL; + after_list = NULL; 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) + if (after_name == NULL) after_name = tok_ptr; } else if (ch == ':' && last_char(0) != ',') { _nc_syntax = SYN_TERMCAP; @@ -521,7 +521,7 @@ * If we did not see a '|', then we found a name with no * aliases or description. */ - if (after_name == 0) + if (after_name == NULL) break; /* * We saw a comma, but are not entirely sure this is @@ -553,7 +553,7 @@ ; } if (islower(UChar(*s))) { - char *name = s; + const char *name = s; while (isalnum(UChar(*s))) { ++s; } @@ -616,7 +616,7 @@ * for following warning messages. If there's no '|', then there * is no description. */ - if (after_name != 0) { + if (after_name != NULL) { ch = *after_name; *after_name = '\0'; _nc_set_type(tok_buf); @@ -627,11 +627,11 @@ * Compute the boundary between the aliases and the description * field for syntax-checking purposes. */ - if (after_list != 0) { + if (after_list != NULL) { if (!silent) { if (*after_list == '\0' || strchr("|", after_list[1]) != NULL) { _nc_warning("empty longname field"); - } else if (strchr(after_list, ' ') == 0) { + } else if (strchr(after_list, ' ') == NULL) { _nc_warning("older tic versions may treat the description field as an alias"); } } @@ -807,7 +807,7 @@ type = _nc_get_token(silent); DEBUG(3, ("token: `%s', class %d", - ((_nc_curr_token.tk_name != 0) + ((_nc_curr_token.tk_name != NULL) ? _nc_curr_token.tk_name : ""), type)); @@ -1025,12 +1025,12 @@ * _nc_get_token() touches. */ pushtype = tokclass; - if (pushname == 0) + if (pushname == NULL) 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 != NULL) ? _nc_curr_token.tk_name : ""), pushtype)); @@ -1055,10 +1055,10 @@ NCURSES_EXPORT(void) _nc_comp_scan_leaks(void) { - if (pushname != 0) { + if (pushname != NULL) { FreeAndNull(pushname); } - if (tok_buf != 0) { + if (tok_buf != NULL) { FreeAndNull(tok_buf); } } diff --git a/contrib/ncurses/ncurses/tinfo/db_iterator.c b/contrib/ncurses/ncurses/tinfo/db_iterator.c --- a/contrib/ncurses/ncurses/tinfo/db_iterator.c +++ b/contrib/ncurses/ncurses/tinfo/db_iterator.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 2006-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -44,7 +44,7 @@ #include #endif -MODULE_ID("$Id: db_iterator.c,v 1.50 2023/06/24 21:52:32 tom Exp $") +MODULE_ID("$Id: db_iterator.c,v 1.54 2025/12/25 18:19:46 tom Exp $") #define HaveTicDirectory _nc_globals.have_tic_directory #define KeepTicDirectory _nc_globals.keep_tic_directory @@ -75,7 +75,7 @@ if (quick_prefix(name)) { result = TRUE; - } else if (stat(name, sb) == 0 + } else if (_nc_is_path_found(name, sb) && (S_ISDIR(sb->st_mode) || (S_ISREG(sb->st_mode) && sb->st_size))) { result = TRUE; @@ -84,7 +84,7 @@ 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) { + if (_nc_is_path_found(temp, sb) && S_ISREG(sb->st_mode) && sb->st_size) { result = TRUE; } } @@ -124,15 +124,15 @@ if (which < dbdLAST) { char *value; - char *cached_value = my_vars[which].value; + const char *cached_value = my_vars[which].value; bool same_value; - if ((value = getenv(name)) != 0) { + if ((value = getenv(name)) != NULL) { value = strdup(value); } - same_value = ((value == 0 && cached_value == 0) || - (value != 0 && - cached_value != 0 && + same_value = ((value == NULL && cached_value == NULL) || + (value != NULL && + cached_value != NULL && strcmp(value, cached_value) == 0)); /* Set variable name to enable checks in cache_expired(). */ @@ -153,7 +153,7 @@ static char * cache_getenv(const char *name, DBDIRS which) { - char *result = 0; + char *result = NULL; (void) update_getenv(name, which); if (which < dbdLAST) { @@ -185,7 +185,7 @@ } else { DBDIRS n; for (n = (DBDIRS) 0; n < dbdLAST; ++n) { - if (my_vars[n].name != 0 + if (my_vars[n].name != NULL && update_getenv(my_vars[n].name, n)) { result = TRUE; break; @@ -225,7 +225,7 @@ } else if (HaveTicDirectory == 0) { if (use_terminfo_vars()) { const char *envp; - if ((envp = getenv("TERMINFO")) != 0) + if ((envp = getenv("TERMINFO")) != NULL) return _nc_tic_dir(envp); } } @@ -251,7 +251,7 @@ NCURSES_EXPORT(void) _nc_last_db(void) { - if (my_blob != 0 && cache_expired()) { + if (my_blob != NULL && cache_expired()) { free_cache(); } } @@ -268,14 +268,14 @@ (void) offset; if ((int) *state < my_size - && my_list != 0 - && my_list[*state] != 0) { + && my_list != NULL + && my_list[*state] != NULL) { result = my_list[*state]; (*state)++; } else { - result = 0; + result = NULL; } - if (result != 0) { + if (result != NULL) { T(("_nc_next_db %d %s", *state, result)); } return result; @@ -293,7 +293,7 @@ /* build a blob containing all of the strings we will use for a lookup * table. */ - if (my_blob == 0 || (cache_has_expired = cache_expired())) { + if (my_blob == NULL || (cache_has_expired = cache_expired())) { size_t blobsize = 0; const char *values[dbdLAST]; struct stat *my_stat; @@ -303,7 +303,7 @@ free_cache(); for (j = 0; j < dbdLAST; ++j) - values[j] = 0; + values[j] = NULL; /* * This is the first item in the list, and is used only when tic is @@ -335,22 +335,22 @@ #if NCURSES_USE_TERMCAP values[dbdEnvOnce2] = cache_getenv("TERMCAP", dbdEnvOnce2); /* only use $TERMCAP if it is an absolute path */ - if (values[dbdEnvOnce2] != 0 + if (values[dbdEnvOnce2] != NULL && *values[dbdEnvOnce2] != '/') { - values[dbdEnvOnce2] = 0; + values[dbdEnvOnce2] = NULL; } values[dbdEnvList2] = cache_getenv("TERMPATH", dbdEnvList2); #endif /* NCURSES_USE_TERMCAP */ } for (j = 0; j < dbdLAST; ++j) { - if (values[j] == 0) + if (values[j] == NULL) values[j] = ""; blobsize += 2 + strlen(values[j]); } my_blob = malloc(blobsize); - if (my_blob != 0) { + if (my_blob != NULL) { *my_blob = '\0'; for (j = 0; j < dbdLAST; ++j) { add_to_blob(values[j], blobsize); @@ -366,7 +366,7 @@ } my_list = typeCalloc(char *, blobsize); my_stat = typeCalloc(struct stat, blobsize); - if (my_list != 0 && my_stat != 0) { + if (my_list != NULL && my_stat != NULL) { int k = 0; my_list[k++] = my_blob; for (j = 0; my_blob[j] != '\0'; ++j) { @@ -381,11 +381,11 @@ /* * Eliminate duplicates from the list. */ - for (j = 0; my_list[j] != 0; ++j) { + for (j = 0; my_list[j] != NULL; ++j) { #ifdef TERMINFO if (*my_list[j] == '\0') { char *my_copy = strdup(TERMINFO); - if (my_copy != 0) + if (my_copy != NULL) my_list[j] = my_copy; } #endif @@ -394,7 +394,7 @@ 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) { + while ((my_list[j] = my_list[j + 1]) != NULL) { ++j; } j = k; @@ -407,7 +407,7 @@ * Eliminate non-existent databases, and those that happen to * be symlinked to another location. */ - for (j = 0; my_list[j] != 0; ++j) { + for (j = 0; my_list[j] != NULL; ++j) { bool found = check_existence(my_list[j], &my_stat[j]); #if HAVE_LINK if (found) { @@ -423,7 +423,7 @@ if (!found) { T(("not found %s", my_list[j])); k = j; - while ((my_list[k] = my_list[k + 1]) != 0) { + while ((my_list[k] = my_list[k + 1]) != NULL) { ++k; } --j; @@ -446,14 +446,14 @@ { DBDIRS which; - if (my_blob != 0) + if (my_blob != NULL) FreeAndNull(my_blob); - if (my_list != 0) + if (my_list != NULL) FreeAndNull(my_list); for (which = 0; (int) which < dbdLAST; ++which) { - my_vars[which].name = 0; + my_vars[which].name = NULL; FreeIfNeeded(my_vars[which].value); - my_vars[which].value = 0; + my_vars[which].value = NULL; } update_tic_dir(NULL); } diff --git a/contrib/ncurses/ncurses/tinfo/doalloc.c b/contrib/ncurses/ncurses/tinfo/doalloc.c --- a/contrib/ncurses/ncurses/tinfo/doalloc.c +++ b/contrib/ncurses/ncurses/tinfo/doalloc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2002,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,7 +40,7 @@ #include -MODULE_ID("$Id: doalloc.c,v 1.14 2021/04/24 23:43:39 tom Exp $") +MODULE_ID("$Id: doalloc.c,v 1.15 2024/12/07 20:05:08 tom Exp $") void * _nc_doalloc(void *oldp, size_t amount) @@ -51,7 +51,7 @@ if (amount == 0) { free(oldp); newp = NULL; - } else if ((newp = realloc(oldp, amount)) == 0) { + } else if ((newp = realloc(oldp, amount)) == NULL) { free(oldp); errno = ENOMEM; /* just in case 'free' reset */ } diff --git a/contrib/ncurses/ncurses/tinfo/entries.c b/contrib/ncurses/ncurses/tinfo/entries.c --- a/contrib/ncurses/ncurses/tinfo/entries.c +++ b/contrib/ncurses/ncurses/tinfo/entries.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2022,2023 Thomas E. Dickey * + * Copyright 2019-2023,2024 Thomas E. Dickey * * Copyright 2006-2012,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,7 +38,7 @@ #include -MODULE_ID("$Id: entries.c,v 1.35 2023/05/27 20:13:10 tom Exp $") +MODULE_ID("$Id: entries.c,v 1.39 2024/12/14 23:48:20 tom Exp $") /**************************************************************************** * @@ -61,8 +61,8 @@ * _nc_head _nc_tail */ -NCURSES_EXPORT_VAR(ENTRY *) _nc_head = 0; -NCURSES_EXPORT_VAR(ENTRY *) _nc_tail = 0; +NCURSES_EXPORT_VAR(ENTRY *) _nc_head = NULL; +NCURSES_EXPORT_VAR(ENTRY *) _nc_tail = NULL; static ENTRY * _nc_delink_entry(ENTRY * headp, const TERMTYPE2 *const tterm) @@ -70,12 +70,12 @@ { ENTRY *ep, *last; - for (last = 0, ep = headp; ep != 0; last = ep, ep = ep->next) { + for (last = NULL, ep = headp; ep != NULL; last = ep, ep = ep->next) { if (&(ep->tterm) == tterm) { - if (last != 0) { + if (last != NULL) { last->next = ep->next; } - if (ep->next != 0) { + if (ep->next != NULL) { ep->next->last = last; } if (ep == _nc_head) { @@ -91,12 +91,12 @@ } NCURSES_EXPORT(void) -_nc_free_entry(ENTRY * headp, TERMTYPE2 *tterm) +_nc_free_entry(ENTRY * headp, const TERMTYPE2 *tterm) /* free the allocated storage consumed by the given list entry */ { ENTRY *ep; - if ((ep = _nc_delink_entry(headp, tterm)) != 0) { + if ((ep = _nc_delink_entry(headp, tterm)) != NULL) { free(ep); } } @@ -107,7 +107,7 @@ { (void) headp; /* unused - _nc_head is altered here! */ - while (_nc_head != 0) { + while (_nc_head != NULL) { _nc_free_termtype2(&(_nc_head->tterm)); } } @@ -133,7 +133,7 @@ { PRESCREEN_LIST *p; pthread_t id = GetThreadID(); - for (p = _nc_prescreen.allocated; p != 0; p = p->next) { + for (p = _nc_prescreen.allocated; p != NULL; p = p->next) { if (p->id == id && p->sp != CURRENT_SCREEN) { FreeAndNull(p->sp); } @@ -141,7 +141,7 @@ } _nc_unlock_global(screen); #endif - if (TerminalOf(CURRENT_SCREEN) != 0) { + if (TerminalOf(CURRENT_SCREEN) != NULL) { del_curterm(TerminalOf(CURRENT_SCREEN)); } _nc_forget_prescr(); @@ -149,8 +149,8 @@ _nc_comp_captab_leaks(); _nc_comp_userdefs_leaks(); _nc_free_entries(_nc_head); - _nc_get_type(0); - _nc_first_name(0); + _nc_get_type(NULL); + _nc_first_name(NULL); _nc_db_iterator_leaks(); _nc_keyname_leaks(); #if BROKEN_LINKER || USE_REENTRANT @@ -160,7 +160,7 @@ #endif _nc_comp_error_leaks(); - if ((s = _nc_home_terminfo()) != 0) + if ((s = _nc_home_terminfo()) != NULL) free(s); #ifdef TRACE diff --git a/contrib/ncurses/ncurses/tinfo/getenv_num.c b/contrib/ncurses/ncurses/tinfo/getenv_num.c --- a/contrib/ncurses/ncurses/tinfo/getenv_num.c +++ b/contrib/ncurses/ncurses/tinfo/getenv_num.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2012,2013 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -37,16 +37,16 @@ #include -MODULE_ID("$Id: getenv_num.c,v 1.8 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: getenv_num.c,v 1.11 2025/02/20 01:02:09 tom Exp $") NCURSES_EXPORT(int) _nc_getenv_num(const char *name) { - char *dst = 0; - char *src = getenv(name); + char *dst = NULL; + const char *src = getenv(name); long value; - if ((src == 0) + if ((src == NULL) || (value = strtol(src, &dst, 0)) < 0 || (dst == src) || (*dst != '\0') @@ -59,7 +59,7 @@ NCURSES_EXPORT(void) _nc_setenv_num(const char *name, int value) { - if (name != 0 && value >= 0) { + if (name != NULL && value >= 0) { char buffer[128]; #if HAVE_SETENV _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) "%d", value); @@ -67,7 +67,7 @@ #elif HAVE_PUTENV char *s; _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) "%s=%d", name, value); - if ((s = strdup(buffer)) != 0) + if ((s = strdup(buffer)) != NULL) putenv(s); #else #error expected setenv/putenv functions diff --git a/contrib/ncurses/ncurses/tinfo/hashed_db.c b/contrib/ncurses/ncurses/tinfo/hashed_db.c --- a/contrib/ncurses/ncurses/tinfo/hashed_db.c +++ b/contrib/ncurses/ncurses/tinfo/hashed_db.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 2019-2024,2025 Thomas E. Dickey * * Copyright 2006-2011,2013 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -37,7 +37,7 @@ #if USE_HASHED_DB -MODULE_ID("$Id: hashed_db.c,v 1.19 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: hashed_db.c,v 1.22 2025/01/11 23:52:18 tom Exp $") #if HASHED_DB_API >= 2 static DBC *cursor; @@ -55,7 +55,7 @@ static void cleanup(void) { - while (connections != 0) { + while (connections != NULL) { _nc_db_close(connections->db); } } @@ -63,10 +63,10 @@ static DB * find_connection(const char *path, bool modify) { - DB *result = 0; + DB *result = NULL; MYCONN *p; - for (p = connections; p != 0; p = p->next) { + for (p = connections; p != NULL; p = p->next) { if (!strcmp(p->path, path) && p->modify == modify) { result = p->db; break; @@ -81,9 +81,9 @@ { MYCONN *p, *q; - for (p = connections, q = 0; p != 0; q = p, p = p->next) { + for (p = connections, q = NULL; p != NULL; q = p, p = p->next) { if (p->db == db) { - if (q != 0) + if (q != NULL) q->next = p->next; else connections = p->next; @@ -94,22 +94,25 @@ } } -static void +static bool make_connection(DB * db, const char *path, bool modify) { + bool code = FALSE; MYCONN *p = typeCalloc(MYCONN, 1); - if (p != 0) { - p->db = db; + if (p != NULL) { p->path = strdup(path); - p->modify = modify; - if (p->path != 0) { + if (p->path != NULL) { + p->db = db; + p->modify = modify; p->next = connections; connections = p; + code = TRUE; } else { free(p); } } + return code; } /* @@ -118,13 +121,13 @@ NCURSES_EXPORT(DB *) _nc_db_open(const char *path, bool modify) { - DB *result = 0; + DB *result = NULL; int code; - if (connections == 0) + if (connections == NULL) atexit(cleanup); - if ((result = find_connection(path, modify)) == 0) { + if ((result = find_connection(path, modify)) == NULL) { #if HASHED_DB_API >= 4 db_create(&result, NULL, 0); @@ -135,7 +138,7 @@ DB_HASH, modify ? DB_CREATE : DB_RDONLY, 0644)) != 0) { - result = 0; + result = NULL; } #elif HASHED_DB_API >= 3 db_create(&result, NULL, 0); @@ -145,7 +148,7 @@ DB_HASH, modify ? DB_CREATE : DB_RDONLY, 0644)) != 0) { - result = 0; + result = NULL; } #elif HASHED_DB_API >= 2 if ((code = db_open(path, @@ -155,22 +158,24 @@ (DB_ENV *) 0, (DB_INFO *) 0, &result)) != 0) { - result = 0; + result = NULL; } #else if ((result = dbopen(path, modify ? (O_CREAT | O_RDWR) : O_RDONLY, 0644, DB_HASH, - NULL)) == 0) { + NULL)) == NULL) { code = errno; + } else { + code = 0; } #endif - if (result != 0) { - make_connection(result, path, modify); + if (result != NULL && make_connection(result, path, modify)) { T(("opened %s", path)); } else { - T(("cannot open %s: %s", path, strerror(code))); + T(("cannot open %s: (errno %d) %s", path, code, strerror(code))); + errno = code; } } return result; diff --git a/contrib/ncurses/ncurses/tinfo/home_terminfo.c b/contrib/ncurses/ncurses/tinfo/home_terminfo.c --- a/contrib/ncurses/ncurses/tinfo/home_terminfo.c +++ b/contrib/ncurses/ncurses/tinfo/home_terminfo.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2012,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,7 +38,7 @@ #include #include -MODULE_ID("$Id: home_terminfo.c,v 1.17 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: home_terminfo.c,v 1.19 2024/12/07 18:14:49 tom Exp $") /* ncurses extension...fall back on user's private directory */ @@ -47,14 +47,14 @@ NCURSES_EXPORT(char *) _nc_home_terminfo(void) { - char *result = 0; + char *result = NULL; #if USE_HOME_TERMINFO if (use_terminfo_vars()) { - if (MyBuffer == 0) { - char *home; + if (MyBuffer == NULL) { + const char *home; - if ((home = getenv("HOME")) != 0) { + if ((home = getenv("HOME")) != NULL) { size_t want = (strlen(home) + sizeof(PRIVATE_INFO)); TYPE_MALLOC(char, want, MyBuffer); _nc_SPRINTF(MyBuffer, _nc_SLIMIT(want) PRIVATE_INFO, home); diff --git a/contrib/ncurses/ncurses/tinfo/init_keytry.c b/contrib/ncurses/ncurses/tinfo/init_keytry.c --- a/contrib/ncurses/ncurses/tinfo/init_keytry.c +++ b/contrib/ncurses/ncurses/tinfo/init_keytry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2023 Thomas E. Dickey * + * Copyright 2020-2023,2024 Thomas E. Dickey * * Copyright 1999-2010,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -30,7 +30,7 @@ #include #include /* struct tinfo_fkeys */ -MODULE_ID("$Id: init_keytry.c,v 1.20 2023/09/16 12:55:01 tom Exp $") +MODULE_ID("$Id: init_keytry.c,v 1.22 2024/12/07 18:14:49 tom Exp $") /* ** _nc_init_keytry() @@ -74,7 +74,7 @@ * mouse_activate() (which will call keyok()) are first called. */ - if (sp != 0) { + if (sp != NULL) { unsigned n; for (n = 0; _nc_tinfo_fkeys[n].code; n++) { @@ -94,8 +94,8 @@ 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 + const char *value = tp->Strings[n]; + if (name != NULL && *name == 'k' && VALID_STRING(value) && NCURSES_SP_NAME(key_defined) (NCURSES_SP_ARGx diff --git a/contrib/ncurses/ncurses/tinfo/lib_acs.c b/contrib/ncurses/ncurses/tinfo/lib_acs.c --- a/contrib/ncurses/ncurses/tinfo/lib_acs.c +++ b/contrib/ncurses/ncurses/tinfo/lib_acs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2014,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,14 +40,14 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_acs.c,v 1.50 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_acs.c,v 1.54 2025/12/27 12:33: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) + if (MyBuffer == NULL) MyBuffer = typeCalloc(chtype, ACS_LEN); return MyBuffer; } @@ -59,14 +59,14 @@ }; #endif -#ifdef USE_TERM_DRIVER +#if 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 : + map = (SP_PARM != NULL) ? SP_PARM->_acs_map : #if BROKEN_LINKER || USE_REENTRANT _nc_prescreen.real_acs_map #else @@ -81,7 +81,7 @@ 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; + chtype *real_map = SP_PARM != NULL ? SP_PARM->_acs_map : fake_map; int j; T(("initializing ACS map")); @@ -166,7 +166,7 @@ real_map['Y'] = '|'; /* vertical line */ real_map['E'] = '+'; /* large plus or crossover */ -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER CallDriver_2(SP_PARM, td_initacs, real_map, fake_map); #else if (ena_acs != NULL) { @@ -183,7 +183,7 @@ * * test/blue.c uses this feature. */ -#define PCH_KLUDGE(a,b) (a != 0 && b != 0 && !strcmp(a,b)) +#define PCH_KLUDGE(a,b) (a != NULL && b != NULL && !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; @@ -191,7 +191,7 @@ if (real_map[i] == 0) { real_map[i] = (chtype) i; if (real_map != fake_map) { - if (SP != 0) + if (SP != NULL) SP->_screen_acs_map[i] = TRUE; } } @@ -210,7 +210,7 @@ (int) i, _tracechar(UChar(acs_chars[i])), _tracechtype(real_map[UChar(acs_chars[i])]))); - if (SP != 0) { + if (SP != NULL) { SP->_screen_acs_map[UChar(acs_chars[i])] = TRUE; } } @@ -258,7 +258,7 @@ #if !NCURSES_WCWIDTH_GRAPHICS NCURSES_EXPORT(int) -_nc_wacs_width(unsigned ch) +_nc_wacs_width(wchar_t ch) { int result; switch (ch) { @@ -318,7 +318,7 @@ result = 1; break; default: - result = wcwidth(ch); + result = wcwidth((wchar_t) ch); break; } return result; diff --git a/contrib/ncurses/ncurses/tinfo/lib_baudrate.c b/contrib/ncurses/ncurses/tinfo/lib_baudrate.c --- a/contrib/ncurses/ncurses/tinfo/lib_baudrate.c +++ b/contrib/ncurses/ncurses/tinfo/lib_baudrate.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -84,7 +84,7 @@ #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 $") +MODULE_ID("$Id: lib_baudrate.c,v 1.50 2025/12/23 09:21:42 tom Exp $") /* * int @@ -99,7 +99,7 @@ int actual_speed; /* the actual speed */ }; -#if !defined(EXP_WIN32_DRIVER) +#if !defined(USE_WIN32CON_DRIVER) #define DATA(number) { B##number, number } static struct speed const speeds[] = @@ -189,12 +189,12 @@ #endif #endif }; -#endif /* !EXP_WIN32_DRIVER */ +#endif /* !USE_NAMED_PIPES */ NCURSES_EXPORT(int) _nc_baudrate(int OSpeed) { -#if defined(EXP_WIN32_DRIVER) +#if defined(USE_WIN32CON_DRIVER) /* On Windows this is a noop */ (void) OSpeed; return (OK); @@ -237,14 +237,14 @@ #endif } return (result); -#endif /* !EXP_WIN32_DRIVER */ +#endif /* !USE_NAMED_PIPES */ } NCURSES_EXPORT(int) _nc_ospeed(int BaudRate) { int result = 1; -#if defined(EXP_WIN32_DRIVER) +#if defined(USE_WIN32CON_DRIVER) (void) BaudRate; #else if (BaudRate >= 0) { @@ -268,7 +268,8 @@ T((T_CALLED("baudrate(%p)"), (void *) SP_PARM)); -#if defined(EXP_WIN32_DRIVER) +#if defined(USE_WIN32CON_DRIVER) + (void) SP_PARM; result = OK; #else /* @@ -279,7 +280,7 @@ #ifdef TRACE if (IsValidTIScreen(SP_PARM) && !NC_ISATTY(fileno((SP_PARM && SP_PARM->_ofp) ? SP_PARM->_ofp : stdout)) - && getenv("BAUDRATE") != 0) { + && getenv("BAUDRATE") != NULL) { int ret; if ((ret = _nc_getenv_num("BAUDRATE")) <= 0) ret = 9600; @@ -304,7 +305,7 @@ } else { result = ERR; } -#endif /* !EXP_WIN32_DRIVER */ +#endif /* !USE_NAMED_PIPES */ returnCode(result); } diff --git a/contrib/ncurses/ncurses/tinfo/lib_cur_term.c b/contrib/ncurses/ncurses/tinfo/lib_cur_term.c --- a/contrib/ncurses/ncurses/tinfo/lib_cur_term.c +++ b/contrib/ncurses/ncurses/tinfo/lib_cur_term.c @@ -1,5 +1,5 @@ /**************************************************************************** -,* Copyright 2020-2021,2022 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -41,7 +41,7 @@ #include /* ospeed */ #include /* VALID_STRING */ -MODULE_ID("$Id: lib_cur_term.c,v 1.49 2022/05/28 17:56:55 tom Exp $") +MODULE_ID("$Id: lib_cur_term.c,v 1.53 2025/12/27 12:41:23 tom Exp $") #undef CUR #define CUR TerminalType(termp). @@ -51,7 +51,7 @@ NCURSES_EXPORT(TERMINAL *) NCURSES_SP_NAME(_nc_get_cur_term) (NCURSES_SP_DCL0) { - return ((0 != TerminalOf(SP_PARM)) ? TerminalOf(SP_PARM) : CurTerm); + return ((NULL != TerminalOf(SP_PARM)) ? TerminalOf(SP_PARM) : CurTerm); } #if NCURSES_SP_FUNCS @@ -74,7 +74,7 @@ } #else -NCURSES_EXPORT_VAR(TERMINAL *) cur_term = 0; +NCURSES_EXPORT_VAR(TERMINAL *) cur_term = NULL; #endif NCURSES_EXPORT(TERMINAL *) @@ -93,8 +93,8 @@ #else cur_term = termp; #endif - if (termp != 0) { -#ifdef USE_TERM_DRIVER + if (termp != NULL) { +#if USE_TERM_DRIVER TERMINAL_CONTROL_BLOCK *TCB = (TERMINAL_CONTROL_BLOCK *) termp; ospeed = (NCURSES_OSPEED) _nc_ospeed(termp->_baudrate); if (TCB->drv && @@ -134,8 +134,8 @@ T((T_CALLED("del_curterm(%p, %p)"), (void *) SP_PARM, (void *) termp)); - if (termp != 0) { -#ifdef USE_TERM_DRIVER + if (termp != NULL) { +#if USE_TERM_DRIVER TERMINAL_CONTROL_BLOCK *TCB = (TERMINAL_CONTROL_BLOCK *) termp; #endif TERMINAL *cur = ( @@ -155,15 +155,15 @@ #endif _nc_free_termtype2(&TerminalType(termp)); if (termp == cur) - NCURSES_SP_NAME(set_curterm) (NCURSES_SP_ARGx 0); + NCURSES_SP_NAME(set_curterm) (NCURSES_SP_ARGx NULL); FreeIfNeeded(termp->_termname); #if USE_HOME_TERMINFO - if (_nc_globals.home_terminfo != 0) { + if (_nc_globals.home_terminfo != NULL) { FreeAndNull(_nc_globals.home_terminfo); } #endif -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER if (TCB->drv) TCB->drv->td_release(TCB); #endif diff --git a/contrib/ncurses/ncurses/tinfo/lib_data.c b/contrib/ncurses/ncurses/tinfo/lib_data.c --- a/contrib/ncurses/ncurses/tinfo/lib_data.c +++ b/contrib/ncurses/ncurses/tinfo/lib_data.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2024 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -43,7 +43,7 @@ #include -MODULE_ID("$Id: lib_data.c,v 1.89 2024/02/24 18:11:38 tom Exp $") +MODULE_ID("$Id: lib_data.c,v 1.95 2025/12/27 12:33:34 tom Exp $") /* * OS/2's native linker complains if we don't initialize public data when @@ -53,25 +53,25 @@ NCURSES_EXPORT(WINDOW *) NCURSES_PUBLIC_VAR(stdscr) (void) { - return CURRENT_SCREEN ? StdScreen(CURRENT_SCREEN) : 0; + return CURRENT_SCREEN ? StdScreen(CURRENT_SCREEN) : NULL; } NCURSES_EXPORT(WINDOW *) NCURSES_PUBLIC_VAR(curscr) (void) { - return CURRENT_SCREEN ? CurScreen(CURRENT_SCREEN) : 0; + return CURRENT_SCREEN ? CurScreen(CURRENT_SCREEN) : NULL; } NCURSES_EXPORT(WINDOW *) NCURSES_PUBLIC_VAR(newscr) (void) { - return CURRENT_SCREEN ? NewScreen(CURRENT_SCREEN) : 0; + return CURRENT_SCREEN ? NewScreen(CURRENT_SCREEN) : NULL; } #else -NCURSES_EXPORT_VAR(WINDOW *) stdscr = 0; -NCURSES_EXPORT_VAR(WINDOW *) curscr = 0; -NCURSES_EXPORT_VAR(WINDOW *) newscr = 0; +NCURSES_EXPORT_VAR(WINDOW *) stdscr = NULL; +NCURSES_EXPORT_VAR(WINDOW *) curscr = NULL; +NCURSES_EXPORT_VAR(WINDOW *) newscr = NULL; #endif -NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain = 0; +NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain = NULL; /* * The variable 'SP' will be defined as a function on systems that cannot link @@ -97,7 +97,7 @@ { my_screen = _nc_alloc_screen_sp(); T(("_nc_alloc_screen_sp %p", my_screen)); - return (my_screen != 0); + return (my_screen != NULL); } NCURSES_EXPORT(void) @@ -129,7 +129,7 @@ FALSE, /* have_tic_directory */ FALSE, /* keep_tic_directory */ - 0, /* tic_directory */ + NULL, /* tic_directory */ NULL, /* dbi_list */ 0, /* dbi_size */ @@ -150,19 +150,19 @@ 0, /* tgetent_sequence */ 0, /* terminal_count */ - 0, /* dbd_blob */ - 0, /* dbd_list */ + NULL, /* dbd_blob */ + NULL, /* dbd_list */ 0, /* dbd_size */ 0, /* dbd_time */ - { { 0, 0 } }, /* dbd_vars */ + { { NULL, NULL } }, /* dbd_vars */ #if HAVE_TSEARCH NULL, /* cached_tparm */ 0, /* count_tparm */ #endif /* HAVE_TSEARCH */ -#ifdef USE_TERM_DRIVER - 0, /* term_driver */ +#if USE_TERM_DRIVER + NULL, /* term_driver */ #endif #ifndef USE_SP_WINDOWLIST @@ -188,7 +188,7 @@ 0, /* nested_tracef */ 0, /* use_pthreads */ #if USE_PTHREADS_EINTR - 0, /* read_thread */ + (pthread_t) 0, /* read_thread */ #endif #endif #if USE_WIDEC_SUPPORT @@ -230,7 +230,7 @@ #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_0 { NULL,0,NULL } #define RIPOFF_0s { RIPOFF_0 } NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen = { @@ -258,7 +258,7 @@ }, NULL, /* saved_tty */ FALSE, /* use_tioctl */ - 0, /* _outch */ + NULL, /* _outch */ #ifndef USE_SP_RIPOFF RIPOFF_0s, /* ripoff */ NULL, /* rsp */ @@ -272,7 +272,7 @@ 0, /* COLS */ 8, /* TABSIZE */ 1000, /* ESCDELAY */ - 0, /* cur_term */ + NULL, /* cur_term */ #endif #ifdef TRACE #if BROKEN_LINKER || USE_REENTRANT @@ -291,9 +291,9 @@ NCURSES_EXPORT(SCREEN *) _nc_screen_of(WINDOW *win) { - SCREEN *sp = 0; + SCREEN *sp = NULL; - if (win != 0) { + if (win != NULL) { sp = WINDOW_EXT(win, screen); } return (sp); diff --git a/contrib/ncurses/ncurses/tinfo/lib_has_cap.c b/contrib/ncurses/ncurses/tinfo/lib_has_cap.c --- a/contrib/ncurses/ncurses/tinfo/lib_has_cap.c +++ b/contrib/ncurses/ncurses/tinfo/lib_has_cap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2009,2013 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -47,7 +47,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_has_cap.c,v 1.11 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_has_cap.c,v 1.12 2024/11/23 19:17:15 tom Exp $") NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_ic) (NCURSES_SP_DCL0) @@ -62,7 +62,7 @@ && (delete_character || parm_dch)) ? TRUE : FALSE; } - returnCode(code); + returnBool(code); } #if NCURSES_SP_FUNCS @@ -83,7 +83,7 @@ && (delete_line || parm_delete_line)) ? TRUE : FALSE; } - returnCode(code); + returnBool(code); } #if NCURSES_SP_FUNCS diff --git a/contrib/ncurses/ncurses/tinfo/lib_kernel.c b/contrib/ncurses/ncurses/tinfo/lib_kernel.c --- a/contrib/ncurses/ncurses/tinfo/lib_kernel.c +++ b/contrib/ncurses/ncurses/tinfo/lib_kernel.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2022,2023 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -49,7 +49,7 @@ #include -MODULE_ID("$Id: lib_kernel.c,v 1.36 2023/06/10 13:29:06 tom Exp $") +MODULE_ID("$Id: lib_kernel.c,v 1.40 2025/12/23 09:09:50 tom Exp $") #ifdef TERMIOS static int @@ -89,12 +89,12 @@ T((T_CALLED("erasechar(%p)"), (void *) SP_PARM)); - if (termp != 0) { + if (termp != NULL) { #ifdef TERMIOS result = termp->Ottyb.c_cc[VERASE]; if (result == _nc_vdisable()) result = ERR; -#elif defined(EXP_WIN32_DRIVER) +#elif defined(USE_WIN32CON_DRIVER) result = ERR; #else result = termp->Ottyb.sg_erase; @@ -126,12 +126,12 @@ T((T_CALLED("killchar(%p)"), (void *) SP_PARM)); - if (termp != 0) { + if (termp != NULL) { #ifdef TERMIOS result = termp->Ottyb.c_cc[VKILL]; if (result == _nc_vdisable()) result = ERR; -#elif defined(EXP_WIN32_DRIVER) +#elif defined(USE_WIN32CON_DRIVER) result = ERR; #else result = termp->Ottyb.sg_kill; @@ -151,12 +151,12 @@ static void flush_input(int fd) { -#ifdef TERMIOS +#if defined(TERMIOS) tcflush(fd, TCIFLUSH); #else /* !TERMIOS */ errno = 0; do { -#if defined(EXP_WIN32_DRIVER) +#if defined(USE_WIN32CON_DRIVER) _nc_console_flush(_nc_console_fd2handle(fd)); #else ioctl(fd, TIOCFLUSH, 0); @@ -177,7 +177,7 @@ { T((T_CALLED("flushinp(%p)"), (void *) SP_PARM)); - if (SP_PARM != 0) { + if (SP_PARM != NULL) { if (NC_ISATTY(SP_PARM->_ifd)) flush_input(SP_PARM->_ifd); else if (NC_ISATTY(SP_PARM->_ofd)) diff --git a/contrib/ncurses/ncurses/tinfo/lib_napms.c b/contrib/ncurses/ncurses/tinfo/lib_napms.c --- a/contrib/ncurses/ncurses/tinfo/lib_napms.c +++ b/contrib/ncurses/ncurses/tinfo/lib_napms.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2023 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2014,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -52,7 +52,7 @@ #endif #endif -MODULE_ID("$Id: lib_napms.c,v 1.28 2023/09/16 16:09:33 tom Exp $") +MODULE_ID("$Id: lib_napms.c,v 1.33 2025/12/27 12:33:34 tom Exp $") NCURSES_EXPORT(int) NCURSES_SP_NAME(napms) (NCURSES_SP_DCLx int ms) @@ -62,7 +62,7 @@ if (ms > MAX_DELAY_MSECS) ms = MAX_DELAY_MSECS; -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER CallDriver_1(SP_PARM, td_nap, ms); #else /* !USE_TERM_DRIVER */ #if NCURSES_SP_FUNCS @@ -78,10 +78,10 @@ request = remaining; } } -#elif defined(_NC_WINDOWS) +#elif defined(USE_WIN32CON_DRIVER) Sleep((DWORD) ms); #else - _nc_timed_wait(0, 0, ms, (int *) 0 EVENTLIST_2nd(0)); + _nc_timed_wait(NULL, 0, ms, (int *) 0 EVENTLIST_2nd(NULL)); #endif #endif /* !USE_TERM_DRIVER */ diff --git a/contrib/ncurses/ncurses/tinfo/lib_options.c b/contrib/ncurses/ncurses/tinfo/lib_options.c --- a/contrib/ncurses/ncurses/tinfo/lib_options.c +++ b/contrib/ncurses/ncurses/tinfo/lib_options.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2021,2023 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2014,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -47,7 +47,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_options.c,v 1.83 2023/04/29 18:56:12 tom Exp $") +MODULE_ID("$Id: lib_options.c,v 1.86 2025/12/27 12:41:23 tom Exp $") NCURSES_EXPORT(int) idlok(WINDOW *win, bool flag) @@ -57,8 +57,8 @@ if (win) { SCREEN *sp = _nc_screen_of(win); - if (sp != 0 -#ifdef USE_TERM_DRIVER + if (sp != NULL +#if USE_TERM_DRIVER && IsTermInfo(sp) #endif ) { @@ -158,16 +158,16 @@ meta(WINDOW *win GCC_UNUSED, bool flag) { int result = ERR; - SCREEN *sp = (win == 0) ? CURRENT_SCREEN : _nc_screen_of(win); + SCREEN *sp = (win == NULL) ? 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) { + if (sp != NULL) { sp->_use_meta = flag; -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER if (IsTermInfo(sp)) { if (flag) { NCURSES_PUTP2("meta_on", meta_on); @@ -195,12 +195,12 @@ int code = ERR; T((T_CALLED("curs_set(%p,%d)"), (void *) SP_PARM, vis)); - if (SP_PARM != 0 && vis >= 0 && vis <= 2) { + if (SP_PARM != NULL && vis >= 0 && vis <= 2) { int cursor = SP_PARM->_cursor; if (vis == cursor) { code = cursor; } else { -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER code = CallDriver_1(SP_PARM, td_cursorSet, vis); #else if (IsValidTIScreen(SP_PARM)) { @@ -269,7 +269,7 @@ static int has_key_internal(int keycode, TRIES * tp) { - if (tp == 0) + if (tp == NULL) return (FALSE); else if (tp->value == keycode) return (TRUE); @@ -278,7 +278,7 @@ || has_key_internal(keycode, tp->sibling)); } -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER NCURSES_EXPORT(int) TINFO_HAS_KEY(SCREEN *sp, int keycode) { @@ -290,7 +290,7 @@ 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); + returnCode(SP != NULL ? has_key_internal(keycode, SP_PARM->_keytry) : FALSE); } #if NCURSES_SP_FUNCS @@ -330,11 +330,11 @@ * the terminal state _before_ switching modes. */ NCURSES_EXPORT(int) -_nc_keypad(SCREEN *sp, int flag) +_nc_keypad(SCREEN *sp, bool flag) { int rc = ERR; - if (sp != 0) { + if (sp != NULL) { #ifdef USE_PTHREADS /* * We might have this situation in a multithreaded application that @@ -354,7 +354,7 @@ } else #endif { -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER rc = CallDriver_1(sp, td_kpad, flag); if (rc == OK) sp->_keypad_on = flag; diff --git a/contrib/ncurses/ncurses/tinfo/lib_print.c b/contrib/ncurses/ncurses/tinfo/lib_print.c --- a/contrib/ncurses/ncurses/tinfo/lib_print.c +++ b/contrib/ncurses/ncurses/tinfo/lib_print.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2021,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,14 +40,15 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_print.c,v 1.31 2023/06/10 12:44:41 tom Exp $") +MODULE_ID("$Id: lib_print.c,v 1.35 2025/12/27 12:41:23 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; + char *mybuf = NULL; + const char *switchon; size_t onsize, offsize; size_t need; @@ -71,8 +72,8 @@ need = onsize + (size_t) len + offsize; - if (switchon == 0 - || (mybuf = typeMalloc(char, need + 1)) == 0) { + if (switchon == NULL + || (mybuf = typeMalloc(char, need + 1)) == NULL) { free(mybuf); errno = ENOMEM; return (ERR); @@ -97,14 +98,14 @@ * kernel will ship the contiguous clist items from the last write * immediately. */ -#ifndef _NC_WINDOWS +#ifndef _NC_WINDOWS_NATIVE (void) sleep(0); #endif free(mybuf); return (result); } -#if NCURSES_SP_FUNCS && !defined(USE_TERM_DRIVER) +#if NCURSES_SP_FUNCS && !USE_TERM_DRIVER NCURSES_EXPORT(int) mcprint(char *data, int len) { diff --git a/contrib/ncurses/ncurses/tinfo/lib_raw.c b/contrib/ncurses/ncurses/tinfo/lib_raw.c --- a/contrib/ncurses/ncurses/tinfo/lib_raw.c +++ b/contrib/ncurses/ncurses/tinfo/lib_raw.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2023,2024 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -50,14 +50,13 @@ #include -MODULE_ID("$Id: lib_raw.c,v 1.30 2024/03/30 15:54:17 tom Exp $") +MODULE_ID("$Id: lib_raw.c,v 1.35 2025/12/23 09:22:35 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 */ @@ -85,7 +84,7 @@ TERMINAL *termp; T((T_CALLED("raw(%p)"), (void *) SP_PARM)); - if ((termp = TerminalOf(SP_PARM)) != 0) { + if ((termp = TerminalOf(SP_PARM)) != NULL) { TTY buf; BEFORE("raw"); @@ -97,7 +96,7 @@ buf.c_iflag &= (unsigned) ~(COOKED_INPUT); buf.c_cc[VMIN] = 1; buf.c_cc[VTIME] = 0; -#elif defined(EXP_WIN32_DRIVER) +#elif defined(USE_WIN32CON_DRIVER) buf.dwFlagIn &= (unsigned long) ~CONMODE_NORAW; #else buf.sg_flags |= RAW; @@ -141,7 +140,7 @@ TERMINAL *termp; T((T_CALLED("cbreak(%p)"), (void *) SP_PARM)); - if ((termp = TerminalOf(SP_PARM)) != 0) { + if ((termp = TerminalOf(SP_PARM)) != NULL) { TTY buf; BEFORE("cbreak"); @@ -153,7 +152,7 @@ buf.c_iflag &= (unsigned) ~ICRNL; buf.c_cc[VMIN] = 1; buf.c_cc[VTIME] = 0; -#elif defined(EXP_WIN32_DRIVER) +#elif defined(USE_WIN32CON_DRIVER) buf.dwFlagIn |= CONMODE_NORAW; buf.dwFlagIn &= (unsigned long) ~CONMODE_NOCBREAK; #else @@ -179,17 +178,13 @@ } #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) { + if ((termp = TerminalOf(SP_PARM)) != NULL) { TTY buf; int result; @@ -224,7 +219,7 @@ TERMINAL *termp; T((T_CALLED("noraw(%p)"), (void *) SP_PARM)); - if ((termp = TerminalOf(SP_PARM)) != 0) { + if ((termp = TerminalOf(SP_PARM)) != NULL) { TTY buf; BEFORE("noraw"); @@ -235,7 +230,7 @@ buf.c_lflag |= ISIG | ICANON | (termp->Ottyb.c_lflag & IEXTEN); buf.c_iflag |= COOKED_INPUT; -#elif defined(EXP_WIN32_DRIVER) +#elif defined(USE_WIN32CON_DRIVER) buf.dwFlagIn |= CONMODE_NORAW; #else buf.sg_flags &= ~(RAW | CBREAK); @@ -279,7 +274,7 @@ TERMINAL *termp; T((T_CALLED("nocbreak(%p)"), (void *) SP_PARM)); - if ((termp = TerminalOf(SP_PARM)) != 0) { + if ((termp = TerminalOf(SP_PARM)) != NULL) { TTY buf; BEFORE("nocbreak"); @@ -289,7 +284,7 @@ #ifdef TERMIOS buf.c_lflag |= ICANON; buf.c_iflag |= ICRNL; -#elif defined(EXP_WIN32_DRIVER) +#elif defined(USE_WIN32CON_DRIVER) buf.dwFlagIn |= (CONMODE_NOCBREAK | CONMODE_NORAW); #else buf.sg_flags &= ~CBREAK; @@ -320,7 +315,7 @@ TERMINAL *termp; T((T_CALLED("noqiflush(%p)"), (void *) SP_PARM)); - if ((termp = TerminalOf(SP_PARM)) != 0) { + if ((termp = TerminalOf(SP_PARM)) != NULL) { TTY buf; int result; @@ -349,11 +344,7 @@ #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. + * This call does the same thing as the qiflush()/noqiflush() pair. */ NCURSES_EXPORT(int) NCURSES_SP_NAME(intrflush) (NCURSES_SP_DCLx WINDOW *win GCC_UNUSED, bool flag) @@ -362,10 +353,10 @@ TERMINAL *termp; T((T_CALLED("intrflush(%p,%d)"), (void *) SP_PARM, flag)); - if (SP_PARM == 0) + if (SP_PARM == NULL) returnCode(ERR); - if ((termp = TerminalOf(SP_PARM)) != 0) { + if ((termp = TerminalOf(SP_PARM)) != NULL) { TTY buf; BEFORE("intrflush"); diff --git a/contrib/ncurses/ncurses/tinfo/lib_setup.c b/contrib/ncurses/ncurses/tinfo/lib_setup.c --- a/contrib/ncurses/ncurses/tinfo/lib_setup.c +++ b/contrib/ncurses/ncurses/tinfo/lib_setup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2023,2024 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -49,7 +49,7 @@ #include #endif -MODULE_ID("$Id: lib_setup.c,v 1.240 2024/04/20 17:04:05 tom Exp $") +MODULE_ID("$Id: lib_setup.c,v 1.252 2025/12/27 12:33:34 tom Exp $") /**************************************************************************** * @@ -115,12 +115,12 @@ #if NCURSES_SP_FUNCS if (CURRENT_SCREEN) { TERMINAL *termp = TerminalOf(CURRENT_SCREEN); - if (termp != 0) { + if (termp != NULL) { result = TerminalType(termp).term_names; } } #else - if (cur_term != 0) { + if (cur_term != NULL) { result = TerminalType(cur_term).term_names; } #endif @@ -272,7 +272,7 @@ } #endif -#if !(defined(USE_TERM_DRIVER) || defined(EXP_WIN32_DRIVER)) +#if !(USE_TERM_DRIVER || USE_NAMED_PIPES) static void _nc_default_screensize(TERMINAL *termp, int *linep, int *colp) { @@ -320,7 +320,7 @@ } static bool -get_position(TERMINAL *termp, int fd, int *row, int *col) +get_position(const TERMINAL *termp, int fd, int *row, int *col) { bool result = FALSE; size_t need = strlen(user7); @@ -334,7 +334,6 @@ char *s; char cc; const char *skipped; - int scanned; s = memset(buf, '\0', sizeof(buf)); do { @@ -350,7 +349,7 @@ cc = '\0'; if (skipped != buf && *skipped != '\0' - && (scanned = sscanf(skip_csi(buf), "%d;%d%c", &y, &x, &cc)) == 3 + && sscanf(skip_csi(buf), "%d;%d%c", &y, &x, &cc) == 3 && (cc == 'R')) { *row = y; *col = x; @@ -362,10 +361,10 @@ } static bool -set_position(NCURSES_SP_DCLx TERMINAL *termp, int row, int col) +set_position(NCURSES_SP_DCLx const TERMINAL *termp, int row, int col) { bool result; - char *actual = TIPARM_2(cursor_address, row, col); + const char *actual = TIPARM_2(cursor_address, row, col); T((T_CALLED("set_position %d,%d)"), row, col)); #if NCURSES_SP_FUNCS result = (NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "set_position", @@ -455,28 +454,28 @@ #else /* !USE_CHECK_SIZE */ #define _nc_check_screensize(sp, termp, linep, colp) /* nothing */ #endif -#endif /* !(defined(USE_TERM_DRIVER) || defined(EXP_WIN32_DRIVER)) */ +#endif /* !(USE_TERM_DRIVER || USE_NAMED_PIPES) */ NCURSES_EXPORT(void) _nc_get_screensize(SCREEN *sp, -#ifdef USE_TERM_DRIVER +#if 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 +#if USE_TERM_DRIVER TERMINAL_CONTROL_BLOCK *TCB; int my_tabsize; - assert(termp != 0 && linep != 0 && colp != 0); + assert(termp != NULL && linep != NULL && colp != NULL); TCB = (TERMINAL_CONTROL_BLOCK *) termp; my_tabsize = TCB->info.tabsize; TCB->drv->td_size(TCB, linep, colp); #if USE_REENTRANT - if (sp != 0) { + if (sp != NULL) { sp->_TABSIZE = my_tabsize; } #else @@ -491,7 +490,7 @@ bool useTioctl = _nc_prescreen.use_tioctl; T((T_CALLED("_nc_get_screensize (%p)"), (void *) sp)); -#ifdef EXP_WIN32_DRIVER +#if USE_NAMED_PIPES /* If we are here, then Windows console is used in terminfo mode. We need to figure out the size using the console API */ @@ -534,7 +533,7 @@ errno = 0; do { if (ioctl(cur_term->Filedes, IOCTL_WINSIZE, &size) >= 0) { - *linep = ((sp != 0 && sp->_filtered) + *linep = ((sp != NULL && sp->_filtered) ? 1 : WINSIZE_ROWS(size)); *colp = WINSIZE_COLS(size); @@ -554,7 +553,8 @@ /* * If environment variables are used, update them. */ - if ((sp == 0 || !sp->_filtered) && _nc_getenv_num("LINES") > 0) { + if ((sp == NULL || !sp->_filtered) && + _nc_getenv_num("LINES") > 0) { _nc_setenv_num("LINES", *linep); } if (_nc_getenv_num("COLUMNS") > 0) { @@ -569,11 +569,11 @@ * variable. */ if ((value = _nc_getenv_num("LINES")) > 0) { - *linep = value; + *linep = Min(value, MAX_ENV_LINES); T(("screen size: environment LINES = %d", *linep)); } if ((value = _nc_getenv_num("COLUMNS")) > 0) { - *colp = value; + *colp = Min(value, MAX_ENV_COLUMNS); T(("screen size: environment COLUMNS = %d", *colp)); } @@ -606,7 +606,7 @@ my_tabsize = 8; #if USE_REENTRANT - if (sp != 0) + if (sp != NULL) sp->_TABSIZE = my_tabsize; #else TABSIZE = my_tabsize; @@ -623,11 +623,11 @@ int new_lines; int new_cols; -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER int old_lines; int old_cols; - assert(sp != 0); + assert(sp != NULL); CallDriver_2(sp, td_getsize, &old_lines, &old_cols); @@ -637,17 +637,17 @@ int old_cols = columns; #endif - if (sp != 0) { + if (sp != NULL) { 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 (sp->_resize != NULL) { 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)) { + } else if (sp->_sig_winch && (sp->_ungetch != NULL)) { sp->_ungetch(SP_PARM, KEY_RESIZE); /* so application can know this */ } sp->_sig_winch = FALSE; @@ -709,7 +709,7 @@ * 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) { + if ((tmp = getenv("CC")) != NULL && strlen(tmp) == 1) { unsigned i; char CC = *tmp; @@ -737,7 +737,7 @@ * 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); + env = setlocale(LC_CTYPE, NULL); #else if (((env = getenv("LANG")) != 0 && *env != '\0') || ((env = getenv("LC_CTYPE")) != 0 && *env != '\0') @@ -752,24 +752,24 @@ /* * Check if we are running in a UTF-8 locale. */ -NCURSES_EXPORT(int) +NCURSES_EXPORT(bool) _nc_unicode_locale(void) { static bool initialized = FALSE; - static int result = 0; + static bool result = FALSE; if (!initialized) { -#if defined(_NC_WINDOWS) && USE_WIDEC_SUPPORT - result = 1; +#if defined(_NC_WINDOWS_NATIVE) && USE_WIDEC_SUPPORT + result = TRUE; #elif HAVE_LANGINFO_CODESET char *env = nl_langinfo(CODESET); - result = !strcmp(env, "UTF-8"); + result = !strcmp(env, "UTF-8") ? TRUE : FALSE; 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; + if (env != NULL) { + if (strstr(env, ".UTF-8") != NULL) { + result = TRUE; T(("_nc_unicode_locale(%s) ->%d", env, result)); } } @@ -779,8 +779,8 @@ return result; } -#define CONTROL_N(s) ((s) != 0 && strstr(s, "\016") != 0) -#define CONTROL_O(s) ((s) != 0 && strstr(s, "\017") != 0) +#define CONTROL_N(s) ((s) != NULL && strstr(s, "\016") != NULL) +#define CONTROL_O(s) ((s) != NULL && strstr(s, "\017") != NULL) /* * Check for known broken cases where a UTF-8 locale breaks the alternate @@ -795,17 +795,17 @@ int result = 0; T((T_CALLED("_nc_locale_breaks_acs:%d"), result)); - if (getenv(env_name) != 0) { + if (getenv(env_name) != NULL) { result = _nc_getenv_num(env_name); - } else if ((value = tigetnum("U8")) >= 0) { + } else if ((value = tigetnum(UserCap(U8))) >= 0) { result = value; /* use extension feature */ - } else if ((env = getenv("TERM")) != 0) { + } else if ((env = getenv("TERM")) != NULL) { 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) { + } else if (strstr(env, "screen") != NULL + && ((env = getenv("TERMCAP")) != NULL + && strstr(env, "screen") != NULL) + && strstr(env, "hhII00") != NULL) { if (CONTROL_N(enter_alt_charset_mode) || CONTROL_O(enter_alt_charset_mode) || CONTROL_N(set_attributes) || @@ -824,21 +824,21 @@ int *errret, int reuse) { -#ifdef USE_TERM_DRIVER - TERMINAL_CONTROL_BLOCK *TCB = 0; +#if USE_TERM_DRIVER + TERMINAL_CONTROL_BLOCK *TCB = NULL; #endif TERMINAL *termp; - SCREEN *sp = 0; + SCREEN *sp = NULL; char *myname; int code = ERR; START_TRACE(); -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER T((T_CALLED("_nc_setupterm_ex(%p,%s,%d,%p)"), (void *) tp, _nc_visbuf(tname), Filedes, (void *) errret)); - if (tp == 0) { + if (tp == NULL) { ret_error0(TGETENT_ERR, "Invalid parameter, internal error.\n"); } else @@ -848,14 +848,14 @@ T((T_CALLED("setupterm(%s,%d,%p)"), _nc_visbuf(tname), Filedes, (void *) errret)); #endif - if (tname == 0) { + if (tname == NULL) { tname = getenv("TERM"); -#if defined(EXP_WIN32_DRIVER) +#if USE_NAMED_PIPES 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) +#elif USE_TERM_DRIVER if (!NonEmpty(tname)) tname = "unknown"; #else @@ -881,7 +881,7 @@ */ if (Filedes == STDOUT_FILENO && !NC_ISATTY(Filedes)) Filedes = STDERR_FILENO; -#if defined(EXP_WIN32_DRIVER) +#if USE_NAMED_PIPES if (Filedes != STDERR_FILENO && NC_ISATTY(Filedes)) _setmode(Filedes, _O_BINARY); #endif @@ -903,28 +903,28 @@ * properly with this feature). */ if (reuse - && (termp != 0) + && (termp != NULL) && termp->Filedes == Filedes - && termp->_termname != 0 + && termp->_termname != NULL && !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 +#if USE_TERM_DRIVER TCB = (TERMINAL_CONTROL_BLOCK *) termp; #endif } else { -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER TERMINAL_CONTROL_BLOCK *my_tcb; - termp = 0; - if ((my_tcb = typeCalloc(TERMINAL_CONTROL_BLOCK, 1)) != 0) + termp = NULL; + if ((my_tcb = typeCalloc(TERMINAL_CONTROL_BLOCK, 1)) != NULL) termp = &(my_tcb->term); #else int status; termp = typeCalloc(TERMINAL, 1); #endif - if (termp == 0) { + if (termp == NULL) { ret_error1(TGETENT_ERR, "Not enough memory to create terminal structure.\n", myname, free(myname)); @@ -948,7 +948,7 @@ #endif /* HAVE_SYSCONF */ T(("using %d for getstr limit", _nc_globals.getstr_limit)); -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER INIT_TERM_DRIVER(); /* * _nc_get_driver() will call td_CanHandle() for each driver, and win_driver @@ -1027,7 +1027,7 @@ #endif } -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER *tp = termp; NCURSES_SP_NAME(set_curterm) (sp, termp); TCB->drv->td_init(TCB); @@ -1043,7 +1043,7 @@ if (errret) *errret = TGETENT_YES; -#ifndef USE_TERM_DRIVER +#if !USE_TERM_DRIVER if (generic_type) { /* * BSD 4.3's termcap contains mis-typed "gn" for wy99. Do a sanity @@ -1076,10 +1076,10 @@ NCURSES_EXPORT(SCREEN *) _nc_find_prescr(void) { - SCREEN *result = 0; + SCREEN *result = NULL; PRESCREEN_LIST *p; pthread_t id = GetThreadID(); - for (p = _nc_prescreen.allocated; p != 0; p = p->next) { + for (p = _nc_prescreen.allocated; p != NULL; p = p->next) { if (p->id == id) { result = p->sp; break; @@ -1099,7 +1099,7 @@ 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) { + for (p = _nc_prescreen.allocated, q = NULL; p != NULL; q = p, p = p->next) { if (p->id == id) { if (q) { q->next = p->next; @@ -1130,13 +1130,13 @@ T((T_CALLED("new_prescr()"))); _nc_lock_global(screen); - if ((sp = _nc_find_prescr()) == 0) { + if ((sp = _nc_find_prescr()) == NULL) { sp = _nc_alloc_screen_sp(); T(("_nc_alloc_screen_sp %p", (void *) sp)); - if (sp != 0) { + if (sp != NULL) { #ifdef USE_PTHREADS PRESCREEN_LIST *p = typeCalloc(PRESCREEN_LIST, 1); - if (p != 0) { + if (p != NULL) { p->id = GetThreadID(); p->sp = sp; p->next = _nc_prescreen.allocated; @@ -1152,7 +1152,7 @@ sp->_no_padding = _nc_prescreen._no_padding; #endif sp->slk_format = 0; - sp->_slk = 0; + sp->_slk = NULL; sp->_prescreen = TRUE; SP_PRE_INIT(sp); #if USE_REENTRANT @@ -1168,7 +1168,7 @@ } #endif -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER /* * This entrypoint is called from tgetent() to allow a special case of reusing * the same TERMINAL data (see comment). @@ -1180,14 +1180,14 @@ int reuse) { int rc = ERR; - TERMINAL *termp = 0; + TERMINAL *termp = NULL; _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) { + if (NCURSES_SP_NAME(set_curterm) (CURRENT_SCREEN_PRE, termp) != NULL) { rc = OK; } } diff --git a/contrib/ncurses/ncurses/tinfo/lib_termcap.c b/contrib/ncurses/ncurses/tinfo/lib_termcap.c --- a/contrib/ncurses/ncurses/tinfo/lib_termcap.c +++ b/contrib/ncurses/ncurses/tinfo/lib_termcap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -51,10 +51,10 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_termcap.c,v 1.89 2023/05/27 20:13:10 tom Exp $") +MODULE_ID("$Id: lib_termcap.c,v 1.96 2025/12/27 12:33:34 tom Exp $") -NCURSES_EXPORT_VAR(char *) UP = 0; -NCURSES_EXPORT_VAR(char *) BC = 0; +NCURSES_EXPORT_VAR(char *) UP = NULL; +NCURSES_EXPORT_VAR(char *) BC = NULL; #ifdef FREEBSD_NATIVE extern char _nc_termcap[]; /* buffer to copy out */ @@ -100,8 +100,8 @@ int rc = ERR; int n; bool found_cache = FALSE; -#ifdef USE_TERM_DRIVER - TERMINAL *termp = 0; +#if USE_TERM_DRIVER + TERMINAL *termp = NULL; #endif START_TRACE(); @@ -109,8 +109,8 @@ TINFO_SETUP_TERM(&termp, name, STDOUT_FILENO, &rc, TRUE); -#ifdef USE_TERM_DRIVER - if (termp == 0 || +#if USE_TERM_DRIVER + if (termp == NULL || !((TERMINAL_CONTROL_BLOCK *) termp)->drv->isTerminfo) returnCode(rc); #endif @@ -131,18 +131,18 @@ bool same_result = (MyCache[n].last_used && MyCache[n].last_bufp == bufp); if (same_result) { CacheInx = n; - if (FIX_SGR0 != 0) { + if (FIX_SGR0 != NULL) { 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; + if (LAST_TRM != NULL && LAST_TRM != TerminalOf(SP_PARM)) { + const 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; + LAST_TRM = NULL; CacheInx = n; } found_cache = TRUE; @@ -163,13 +163,13 @@ LAST_TRM = TerminalOf(SP_PARM); LAST_SEQ = ++CacheSeq; } else { - LAST_TRM = 0; + LAST_TRM = NULL; } PC = 0; - UP = 0; - BC = 0; - FIX_SGR0 = 0; /* don't free it - application may still use */ + UP = NULL; + BC = NULL; + FIX_SGR0 = NULL; /* don't free it - application may still use */ if (rc == 1) { @@ -186,19 +186,19 @@ BC = backspace_if_not_bs; if ((FIX_SGR0 = _nc_trim_sgr0(&TerminalType(TerminalOf(SP_PARM)))) - != 0) { + != NULL) { if (!strcmp(FIX_SGR0, exit_attribute_mode)) { if (FIX_SGR0 != exit_attribute_mode) { free(FIX_SGR0); } - FIX_SGR0 = 0; + FIX_SGR0 = NULL; } } LAST_BUF = bufp; LAST_USE = TRUE; SetNoPadding(SP_PARM); - (void) NCURSES_SP_NAME(baudrate) (NCURSES_SP_ARG); /* sets ospeed as a side-effect */ + (void) NCURSES_SP_NAME(baudrate) (NCURSES_SP_ARG); /* sets ospeed as a side effect */ /* LINT_PREPRO #if 0*/ @@ -262,7 +262,7 @@ int j = -1; entry_ptr = _nc_find_type_entry(id, BOOLEAN, TRUE); - if (entry_ptr != 0) { + if (entry_ptr != NULL) { j = entry_ptr->nte_index; } #if NCURSES_XNAMES @@ -308,13 +308,15 @@ int result = ABSENT_NUMERIC; T((T_CALLED("tgetnum(%p, %s)"), (void *) SP_PARM, id)); + assert(result < 0); + 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) { + if (entry_ptr != NULL) { j = entry_ptr->nte_index; } #if NCURSES_XNAMES @@ -366,7 +368,7 @@ int j = -1; entry_ptr = _nc_find_type_entry(id, STRING, TRUE); - if (entry_ptr != 0) { + if (entry_ptr != NULL) { j = entry_ptr->nte_index; } #if NCURSES_XNAMES @@ -387,12 +389,12 @@ /* setupterm forces canceled strings to null */ if (VALID_STRING(result)) { if (result == exit_attribute_mode - && FIX_SGR0 != 0) { + && FIX_SGR0 != NULL) { result = FIX_SGR0; TR(TRACE_DATABASE, ("altered to : %s", _nc_visbuf(result))); } - if (area != 0 - && *area != 0) { + if (area != NULL + && *area != NULL) { _nc_STRCPY(*area, result, 1024); result = *area; *area += strlen(*area) + 1; @@ -417,13 +419,13 @@ NCURSES_EXPORT(void) _nc_tgetent_leak(const TERMINAL *const termp) { - if (termp != 0) { + if (termp != NULL) { int num; for (CacheInx = 0; CacheInx < TGETENT_MAX; ++CacheInx) { if (LAST_TRM == termp) { FreeAndNull(FIX_SGR0); - if (LAST_TRM != 0) { - LAST_TRM = 0; + if (LAST_TRM != NULL) { + LAST_TRM = NULL; } break; } @@ -436,7 +438,7 @@ { int num; for (CacheInx = 0; CacheInx < TGETENT_MAX; ++CacheInx) { - if (LAST_TRM != 0) { + if (LAST_TRM != NULL) { del_curterm(LAST_TRM); _nc_tgetent_leak(LAST_TRM); } diff --git a/contrib/ncurses/ncurses/tinfo/lib_termname.c b/contrib/ncurses/ncurses/tinfo/lib_termname.c --- a/contrib/ncurses/ncurses/tinfo/lib_termname.c +++ b/contrib/ncurses/ncurses/tinfo/lib_termname.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2003,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -29,21 +29,21 @@ #include -MODULE_ID("$Id: lib_termname.c,v 1.13 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_termname.c,v 1.15 2025/01/12 00:41:56 tom Exp $") NCURSES_EXPORT(char *) NCURSES_SP_NAME(termname) (NCURSES_SP_DCL0) { - char *name = 0; + char *name = NULL; T((T_CALLED("termname(%p)"), (void *) SP_PARM)); #if NCURSES_SP_FUNCS - if (TerminalOf(SP_PARM) != 0) { + if (TerminalOf(SP_PARM) != NULL) { name = TerminalOf(SP_PARM)->_termname; } #else - if (cur_term != 0) + if (cur_term != NULL) name = cur_term->_termname; #endif diff --git a/contrib/ncurses/ncurses/tinfo/lib_tgoto.c b/contrib/ncurses/ncurses/tinfo/lib_tgoto.c --- a/contrib/ncurses/ncurses/tinfo/lib_tgoto.c +++ b/contrib/ncurses/ncurses/tinfo/lib_tgoto.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2023 Thomas E. Dickey * + * Copyright 2018-2023,2025 Thomas E. Dickey * * Copyright 2000-2008,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -36,7 +36,7 @@ #include #include -MODULE_ID("$Id: lib_tgoto.c,v 1.23 2023/04/16 17:19:40 tom Exp $") +MODULE_ID("$Id: lib_tgoto.c,v 1.24 2025/01/12 00:41:56 tom Exp $") #if !PURE_TERMINFO static bool @@ -44,7 +44,7 @@ { bool result = TRUE; - if (string == 0 || *string == '\0') { + if (string == NULL || *string == '\0') { result = FALSE; /* tparm() handles empty strings */ } else { while ((*string != '\0') && result) { @@ -89,13 +89,13 @@ while (*string != 0) { if ((used + need) > length) { length += (used + need); - if ((result = typeRealloc(char, length, result)) == 0) { + if ((result = typeRealloc(char, length, result)) == NULL) { length = 0; break; } } if (*string == '%') { - const char *fmt = 0; + const char *fmt = NULL; switch (*++string) { case '\0': @@ -122,7 +122,7 @@ * and \r, but I don't see that it could work -TD */ if (*value == 0) { - if (BC != 0) { + if (BC != NULL) { *value += 1; need_BC = TRUE; } else { @@ -166,11 +166,11 @@ *value -= 2 * (*value % 16); break; } - if (fmt != 0) { + if (fmt != NULL) { _nc_SPRINTF(result + used, _nc_SLIMIT(length - used) fmt, *value++); used += strlen(result + used); - fmt = 0; + fmt = NULL; } if (value - param > 2) { value = param + 2; @@ -181,7 +181,7 @@ } string++; } - if (result != 0) { + if (result != NULL) { if (need_BC) { _nc_STRCPY(result + used, BC, length - used); used += strlen(BC); diff --git a/contrib/ncurses/ncurses/tinfo/lib_ti.c b/contrib/ncurses/ncurses/tinfo/lib_ti.c --- a/contrib/ncurses/ncurses/tinfo/lib_ti.c +++ b/contrib/ncurses/ncurses/tinfo/lib_ti.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -37,7 +37,7 @@ #include -MODULE_ID("$Id: lib_ti.c,v 1.34 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_ti.c,v 1.36 2025/11/23 18:58:04 tom Exp $") #if 0 static bool @@ -56,6 +56,7 @@ int result = ABSENT_BOOLEAN; T((T_CALLED("tigetflag(%p, %s)"), (void *) SP_PARM, str)); + assert(result < 0); if (HasTInfoTerminal(SP_PARM)) { TERMTYPE2 *tp = &TerminalType(TerminalOf(SP_PARM)); @@ -63,7 +64,7 @@ int j = -1; entry_ptr = _nc_find_type_entry(str, BOOLEAN, FALSE); - if (entry_ptr != 0) { + if (entry_ptr != NULL) { j = entry_ptr->nte_index; } #if NCURSES_XNAMES @@ -101,6 +102,7 @@ int result = CANCELLED_NUMERIC; /* Solaris returns a -1 on error */ T((T_CALLED("tigetnum(%p, %s)"), (void *) SP_PARM, str)); + assert(result < 0); if (HasTInfoTerminal(SP_PARM)) { TERMTYPE2 *tp = &TerminalType(TerminalOf(SP_PARM)); @@ -108,7 +110,7 @@ int j = -1; entry_ptr = _nc_find_type_entry(str, NUMBER, FALSE); - if (entry_ptr != 0) { + if (entry_ptr != NULL) { j = entry_ptr->nte_index; } #if NCURSES_XNAMES @@ -155,7 +157,7 @@ int j = -1; entry_ptr = _nc_find_type_entry(str, STRING, FALSE); - if (entry_ptr != 0) { + if (entry_ptr != NULL) { j = entry_ptr->nte_index; } #if NCURSES_XNAMES diff --git a/contrib/ncurses/ncurses/tinfo/lib_tparm.c b/contrib/ncurses/ncurses/tinfo/lib_tparm.c --- a/contrib/ncurses/ncurses/tinfo/lib_tparm.c +++ b/contrib/ncurses/ncurses/tinfo/lib_tparm.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2021,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -53,7 +53,7 @@ #include #include -MODULE_ID("$Id: lib_tparm.c,v 1.153 2023/11/04 19:28:41 tom Exp $") +MODULE_ID("$Id: lib_tparm.c,v 1.157 2025/02/15 15:20:16 tom Exp $") /* * char * @@ -87,7 +87,7 @@ * The ':' is used to avoid making %+ or %- * patterns (see below). * - * %p[1-9] push ith parm + * %p[1-9] push ith param * %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() @@ -102,7 +102,7 @@ * %= %> %< logical operations: push(pop() op pop()) * %A %O logical and & or operations for conditionals * %! %~ unary operations push(op pop()) - * %i add 1 to first two parms (for ANSI terminals) + * %i add 1 to first two params (for ANSI terminals) * * %? expr %t thenpart %e elsepart %; * if-then-else, %e elsepart is optional. @@ -343,7 +343,7 @@ #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 != NULL) \ ? TPS(stack)[TPS(stack_ptr)].data.str \ : dummy) \ : (tparm_error(tps, "spop: stack underflow"), \ @@ -361,7 +361,7 @@ parse_format(const char *s, char *format, int *len) { *len = 0; - if (format != 0) { + if (format != NULL) { bool done = FALSE; bool allowminus = FALSE; bool dot = FALSE; @@ -475,13 +475,13 @@ int level = -1; const char *cp = string; - if (cp == 0) + if (cp == NULL) 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) + if (TPS(fmt_buff) == NULL) return 0; } @@ -616,14 +616,14 @@ void *ft; result->format = string; - if ((ft = tfind(result, &MyCache, cmp_format)) != 0) { + if ((ft = tfind(result, &MyCache, cmp_format)) != NULL) { 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) + if (TPS(fmt_buff) == NULL) return ERR; } } else @@ -637,7 +637,7 @@ result->num_parsed = _nc_tparm_analyze(term, string, result->p_is_s, &(result->num_popped)); - if (TPS(fmt_buff) == 0) { + if (TPS(fmt_buff) == NULL) { TR(TRACE_CALLS, ("%s: error in analysis", TPS(tname))); rc = ERR; } else { @@ -654,10 +654,10 @@ result->tparm_type |= (1 << n); } #if HAVE_TSEARCH - if ((fs = typeCalloc(TPARM_DATA, 1)) != 0) { + if ((fs = typeCalloc(TPARM_DATA, 1)) != NULL) { *fs = *result; - if ((fs->format = strdup(string)) != 0) { - if (tsearch(fs, &MyCache, cmp_format) != 0) { + if ((fs->format = strdup(string)) != NULL) { + if (tsearch(fs, &MyCache, cmp_format) != NULL) { ++MyCount; } else { free(fs); @@ -690,9 +690,9 @@ int i; for (i = 0; i < data->num_actual; i++) { - if (data->p_is_s[i] != 0) { + if (data->p_is_s[i] != NULL) { char *value = va_arg(ap, char *); - if (value == 0) + if (value == NULL) value = dummy; data->p_is_s[i] = value; data->param[i] = 0; @@ -740,7 +740,7 @@ if (USE_TRACEF(TRACE_CALLS)) { int i; for (i = 0; i < data->num_actual; i++) { - if (data->p_is_s[i] != 0) { + if (data->p_is_s[i] != NULL) { 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) { @@ -1003,12 +1003,12 @@ */ if (!incremented_two) { incremented_two = TRUE; - if (data->p_is_s[0] == 0) { + if (data->p_is_s[0] == NULL) { data->param[0]++; if (termcap_hack) TPS(stack)[0].data.num = (int) data->param[0]; } - if (data->p_is_s[1] == 0) { + if (data->p_is_s[1] == NULL) { data->param[1]++; if (termcap_hack) TPS(stack)[1].data.num = (int) data->param[1]; @@ -1099,7 +1099,7 @@ * are parameterized accept only numeric parameters. */ static bool -check_string_caps(TPARM_DATA *data, const char *string) +check_string_caps(const TPARM_DATA *data, const char *string) { bool result = FALSE; @@ -1126,13 +1126,13 @@ #endif #if NCURSES_XNAMES else { - char *check; + const char *check; - check = tigetstr("Cs"); + check = tigetstr(UserCap(Cs)); if (CHECK_CAP(check)) want_type = 1; /* style #1 */ - check = tigetstr("Ms"); + check = tigetstr(UserCap(Ms)); if (CHECK_CAP(check)) want_type = 3; /* storage unit #1, content #2 */ } @@ -1354,13 +1354,13 @@ } #if NCURSES_XNAMES else { - char *check; + const char *check; - check = tigetstr("xm"); + check = tigetstr(UserCap(xm)); if (CHECK_CAP(check)) { needed = 3; } - check = tigetstr("S0"); + check = tigetstr(UserCap(S0)); if (CHECK_CAP(check)) { needed = 0; /* used in screen-base */ } diff --git a/contrib/ncurses/ncurses/tinfo/lib_tputs.c b/contrib/ncurses/ncurses/tinfo/lib_tputs.c --- a/contrib/ncurses/ncurses/tinfo/lib_tputs.c +++ b/contrib/ncurses/ncurses/tinfo/lib_tputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -52,7 +52,7 @@ #include /* ospeed */ #include -MODULE_ID("$Id: lib_tputs.c,v 1.111 2023/09/16 16:05:15 tom Exp $") +MODULE_ID("$Id: lib_tputs.c,v 1.116 2025/01/12 00:41:56 tom Exp $") NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */ NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */ @@ -63,7 +63,7 @@ NCURSES_EXPORT(void) _nc_set_no_padding(SCREEN *sp) { - bool no_padding = (getenv("NCURSES_NO_PADDING") != 0); + bool no_padding = (getenv("NCURSES_NO_PADDING") != NULL); if (sp) sp->_no_padding = no_padding; @@ -124,7 +124,7 @@ 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) { + if (SP_PARM != NULL && SP_PARM->_ofd >= 0) { TR(TRACE_CHARPUT, ("ofd:%d inuse:%lu buffer:%p", SP_PARM->_ofd, (unsigned long) SP_PARM->out_inuse, @@ -149,15 +149,17 @@ break; /* an error we can not recover from */ } } - } else if (SP_PARM->out_buffer == 0) { - TR(TRACE_CHARPUT, ("flushing stdout")); + } else if (SP_PARM->out_buffer == NULL) { + TR(TRACE_CHARPUT, ("flushing stdout/stderr")); fflush(stdout); + fflush(stderr); } } else { - TR(TRACE_CHARPUT, ("flushing stdout")); + TR(TRACE_CHARPUT, ("flushing stdout/stderr")); fflush(stdout); + fflush(stderr); } - if (SP_PARM != 0) + if (SP_PARM != NULL) SP_PARM->out_inuse = 0; returnVoid; } @@ -178,8 +180,8 @@ COUNT_OUTCHARS(1); if (HasTInfoTerminal(SP_PARM) - && SP_PARM != 0) { - if (SP_PARM->out_buffer != 0) { + && SP_PARM != NULL) { + if (SP_PARM->out_buffer != NULL) { 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; @@ -257,7 +259,7 @@ { int rc = ERR; - if (string != 0) { + if (string != NULL) { TPUTS_TRACE(name); rc = NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx string, 1, NCURSES_SP_NAME(_nc_outch)); @@ -312,12 +314,12 @@ if (!VALID_STRING(string)) return ERR; - if (SP_PARM != 0 && HasTInfoTerminal(SP_PARM)) { + if (SP_PARM != NULL && HasTInfoTerminal(SP_PARM)) { if ( #if NCURSES_SP_FUNCS - (SP_PARM != 0 && SP_PARM->_term == 0) + (SP_PARM != NULL && SP_PARM->_term == NULL) #else - cur_term == 0 + cur_term == NULL #endif ) { always_delay = FALSE; @@ -442,7 +444,7 @@ NCURSES_EXPORT(int) _nc_outc_wrapper(SCREEN *sp, int c) { - if (0 == sp) { + if (NULL == sp) { return fputc(c, stdout); } else { return sp->jump(c); diff --git a/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c b/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c --- a/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c +++ b/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -42,7 +42,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_ttyflags.c,v 1.36 2020/09/05 22:54:47 tom Exp $") +MODULE_ID("$Id: lib_ttyflags.c,v 1.40 2025/12/27 12:33:34 tom Exp $") NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_DCLx TTY * buf) @@ -50,12 +50,12 @@ TERMINAL *termp = TerminalOf(SP_PARM); int result = OK; - if (buf == 0 || termp == 0) { + if (buf == NULL || termp == NULL) { result = ERR; } else { -#ifdef USE_TERM_DRIVER - if (SP_PARM != 0) { +#if USE_TERM_DRIVER + if (SP_PARM != NULL) { result = CallDriver_2(SP_PARM, td_sgmode, FALSE, buf); } else { result = ERR; @@ -75,7 +75,7 @@ termp ? termp->Filedes : -1, _nc_trace_ttymode(buf))); } - if (result == ERR && buf != 0) + if (result == ERR && buf != NULL) memset(buf, 0, sizeof(*buf)); return (result); @@ -94,15 +94,15 @@ { int result = OK; - if (buf == 0 || SP_PARM == 0) { + if (buf == NULL || SP_PARM == NULL) { result = ERR; } else { TERMINAL *termp = TerminalOf(SP_PARM); - if (0 == termp) { + if (NULL == termp) { result = ERR; } else { -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER result = CallDriver_2(SP_PARM, td_sgmode, TRUE, buf); #else for (;;) { @@ -113,7 +113,7 @@ ) { if (errno == EINTR) continue; - if ((errno == ENOTTY) && (SP_PARM != 0)) + if ((errno == ENOTTY) && (SP_PARM != NULL)) SP_PARM->_notty = TRUE; result = ERR; } @@ -145,8 +145,8 @@ T((T_CALLED("def_shell_mode(%p) ->term %p"), (void *) SP_PARM, (void *) termp)); - if (termp != 0) { -#ifdef USE_TERM_DRIVER + if (termp != NULL) { +#if USE_TERM_DRIVER rc = CallDriver_2(SP_PARM, td_mode, FALSE, TRUE); #else /* @@ -156,7 +156,7 @@ #ifdef TERMIOS if (termp->Ottyb.c_oflag & OFLAGS_TABS) tab = back_tab = NULL; -#elif defined(EXP_WIN32_DRIVER) +#elif USE_NAMED_PIPES /* noop */ #else if (termp->Ottyb.sg_flags & XTABS) @@ -185,8 +185,8 @@ T((T_CALLED("def_prog_mode(%p) ->term %p"), (void *) SP_PARM, (void *) termp)); - if (termp != 0) { -#ifdef USE_TERM_DRIVER + if (termp != NULL) { +#if USE_TERM_DRIVER rc = CallDriver_2(SP_PARM, td_mode, TRUE, TRUE); #else /* @@ -195,7 +195,7 @@ if (_nc_get_tty_mode(&termp->Nttyb) == OK) { #ifdef TERMIOS termp->Nttyb.c_oflag &= (unsigned) (~OFLAGS_TABS); -#elif defined(EXP_WIN32_DRIVER) +#elif USE_NAMED_PIPES /* noop */ #else termp->Nttyb.sg_flags &= (unsigned) (~XTABS); @@ -223,8 +223,8 @@ T((T_CALLED("reset_prog_mode(%p) ->term %p"), (void *) SP_PARM, (void *) termp)); - if (termp != 0) { -#ifdef USE_TERM_DRIVER + if (termp != NULL) { +#if USE_TERM_DRIVER rc = CallDriver_2(SP_PARM, td_mode, TRUE, FALSE); #else if (_nc_set_tty_mode(&termp->Nttyb) == OK) { @@ -256,8 +256,8 @@ T((T_CALLED("reset_shell_mode(%p) ->term %p"), (void *) SP_PARM, (void *) termp)); - if (termp != 0) { -#ifdef USE_TERM_DRIVER + if (termp != NULL) { +#if USE_TERM_DRIVER rc = CallDriver_2(SP_PARM, td_mode, FALSE, FALSE); #else if (SP_PARM) { @@ -281,12 +281,12 @@ static TTY * saved_tty(NCURSES_SP_DCL0) { - TTY *result = 0; + TTY *result = NULL; - if (SP_PARM != 0) { + if (SP_PARM != NULL) { result = (TTY *) & (SP_PARM->_saved_tty); } else { - if (_nc_prescreen.saved_tty == 0) { + if (_nc_prescreen.saved_tty == NULL) { _nc_prescreen.saved_tty = typeCalloc(TTY, 1); } result = _nc_prescreen.saved_tty; diff --git a/contrib/ncurses/ncurses/tinfo/lib_win32con.c b/contrib/ncurses/ncurses/tinfo/lib_win32con.c --- a/contrib/ncurses/ncurses/tinfo/lib_win32con.c +++ b/contrib/ncurses/ncurses/tinfo/lib_win32con.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2021,2023 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -36,70 +36,65 @@ * TODO - GetMousePos(POINT * result) from ntconio.c */ +#define TTY int /* FIXME: TTY originalMode */ #include +#include -MODULE_ID("$Id: lib_win32con.c,v 1.14 2023/08/05 20:44:38 tom Exp $") - -#ifdef _NC_WINDOWS - -#ifdef _NC_MINGW -#include -#else -#include +#ifndef _O_BINARY +#define _O_BINARY 0 /* FIXME: not defined in MSYS2 base */ #endif -#include +MODULE_ID("$Id: lib_win32con.c,v 1.50 2025/12/27 21:49:45 tom Exp $") -#if USE_WIDEC_SUPPORT -#define write_screen WriteConsoleOutputW -#define read_screen ReadConsoleOutputW -#else -#define write_screen WriteConsoleOutput -#define read_screen ReadConsoleOutput -#endif +#if defined(_NC_WINDOWS) + +#define CONTROL_PRESSED (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED) static bool read_screen_data(void); #define GenMap(vKey,key) MAKELONG(key, vKey) +/* *INDENT-OFF* */ static const LONG keylist[] = { - GenMap(VK_PRIOR, KEY_PPAGE), - GenMap(VK_NEXT, KEY_NPAGE), - GenMap(VK_END, KEY_END), - GenMap(VK_HOME, KEY_HOME), - GenMap(VK_LEFT, KEY_LEFT), - GenMap(VK_UP, KEY_UP), - GenMap(VK_RIGHT, KEY_RIGHT), - GenMap(VK_DOWN, KEY_DOWN), + GenMap(VK_PRIOR, KEY_PPAGE), + GenMap(VK_NEXT, KEY_NPAGE), + GenMap(VK_END, KEY_END), + GenMap(VK_HOME, KEY_HOME), + GenMap(VK_LEFT, KEY_LEFT), + GenMap(VK_UP, KEY_UP), + GenMap(VK_RIGHT, KEY_RIGHT), + GenMap(VK_DOWN, KEY_DOWN), GenMap(VK_DELETE, KEY_DC), GenMap(VK_INSERT, KEY_IC) }; static const LONG ansi_keys[] = { - GenMap(VK_PRIOR, 'I'), - GenMap(VK_NEXT, 'Q'), - GenMap(VK_END, 'O'), - GenMap(VK_HOME, 'H'), - GenMap(VK_LEFT, 'K'), - GenMap(VK_UP, 'H'), - GenMap(VK_RIGHT, 'M'), - GenMap(VK_DOWN, 'P'), + GenMap(VK_PRIOR, 'I'), + GenMap(VK_NEXT, 'Q'), + GenMap(VK_END, 'O'), + GenMap(VK_HOME, 'H'), + GenMap(VK_LEFT, 'K'), + GenMap(VK_UP, 'H'), + GenMap(VK_RIGHT, 'M'), + GenMap(VK_DOWN, 'P'), GenMap(VK_DELETE, 'S'), GenMap(VK_INSERT, 'R') }; +/* *INDENT-ON* */ #define array_length(a) (sizeof(a)/sizeof(a[0])) #define N_INI ((int)array_length(keylist)) #define FKEYS 24 #define MAPSIZE (FKEYS + N_INI) +static bool console_initialized = FALSE; + /* A process can only have a single console, so it is safe to maintain all the information about it in a single static structure. */ NCURSES_EXPORT_VAR(ConsoleInfo) _nc_CONSOLE; -static bool console_initialized = FALSE; -#define EnsureInit() (void)(console_initialized ? TRUE : _nc_console_checkinit(TRUE, TRUE)) +#define EnsureInit() (void)(console_initialized ? TRUE : _nc_console_checkinit(USE_NAMED_PIPES)) #define REQUIRED_MAX_V (DWORD)10 #define REQUIRED_MIN_V (DWORD)0 @@ -119,10 +114,10 @@ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&osvi); - T(("GetVersionEx returnedMajor=%ld, Minor=%ld, Build=%ld", - osvi.dwMajorVersion, - osvi.dwMinorVersion, - osvi.dwBuildNumber)); + T(("GetVersionEx returnedMajor=%lu, Minor=%lu, Build=%lu", + (unsigned long) osvi.dwMajorVersion, + (unsigned long) osvi.dwMinorVersion, + (unsigned long) osvi.dwBuildNumber)); if (osvi.dwMajorVersion >= REQUIRED_MAX_V) { if (osvi.dwMajorVersion == REQUIRED_MAX_V) { if (((osvi.dwMinorVersion == REQUIRED_MIN_V) && @@ -222,13 +217,15 @@ T(("lib_win32con:validateHandle %d -> WINCONSOLE.hdl", fd)); } else if (hdl == WINCONSOLE.out) { T(("lib_win32con:validateHandle %d -> WINCONSOLE.out", fd)); + } else if (hdl == GetStdHandle(STD_INPUT_HANDLE)) { + T(("lib_win32con:validateHandle %d -> STD_INPUT_HANDLE", fd)); + if (!WINCONSOLE.isTermInfoConsole && WINCONSOLE.progMode) { + hdl = WINCONSOLE.inp; + } } else { T(("lib_win32con:validateHandle %d maps to unknown HANDLE", fd)); hdl = INVALID_HANDLE_VALUE; } -#if 1 - assert(hdl != INVALID_HANDLE_VALUE); -#endif if (hdl != INVALID_HANDLE_VALUE) { if (hdl != WINCONSOLE.inp && (!WINCONSOLE.isTermInfoConsole && WINCONSOLE.progMode)) { if (hdl == WINCONSOLE.out && hdl != WINCONSOLE.hdl) { @@ -240,6 +237,7 @@ return hdl; } +#if defined(_NC_WINDOWS) && USE_WINCONMODE NCURSES_EXPORT(int) _nc_console_setmode(HANDLE hdl, const TTY * arg) { @@ -259,36 +257,20 @@ T(("lib_win32con:_nc_console_setmode %s", _nc_trace_ttymode(arg))); if (hdl == WINCONSOLE.inp) { dwFlag = arg->dwFlagIn | ENABLE_MOUSE_INPUT | VT_FLAG_IN; - if (WINCONSOLE.isTermInfoConsole) - dwFlag |= (VT_FLAG_IN); - else - dwFlag &= (DWORD) ~ (VT_FLAG_IN); TRCTTYIN(dwFlag); SetConsoleMode(hdl, dwFlag); alt = OutHandle(); dwFlag = arg->dwFlagOut; - if (WINCONSOLE.isTermInfoConsole) - dwFlag |= (VT_FLAG_OUT); - else - dwFlag |= (VT_FLAG_OUT); TRCTTYOUT(dwFlag); SetConsoleMode(alt, dwFlag); } else { dwFlag = arg->dwFlagOut; - if (WINCONSOLE.isTermInfoConsole) - dwFlag |= (VT_FLAG_OUT); - else - dwFlag |= (VT_FLAG_OUT); TRCTTYOUT(dwFlag); SetConsoleMode(hdl, dwFlag); alt = WINCONSOLE.inp; dwFlag = arg->dwFlagIn | ENABLE_MOUSE_INPUT; - if (WINCONSOLE.isTermInfoConsole) - dwFlag |= (VT_FLAG_IN); - else - dwFlag &= (DWORD) ~ (VT_FLAG_IN); TRCTTYIN(dwFlag); SetConsoleMode(alt, dwFlag); T(("effective mode set %s", _nc_trace_ttymode(&TRCTTY))); @@ -330,6 +312,7 @@ T(("lib_win32con:_nc_console_getmode %s", _nc_trace_ttymode(arg))); return (code); } +#endif /* defined(_NC_WINDOWS) && USE_WINCONMODE */ NCURSES_EXPORT(int) _nc_console_flush(HANDLE hdl) @@ -404,7 +387,7 @@ return result; } -#if 0 +#if defined(_NC_WINDOWS) static bool restore_original_screen(void) { @@ -426,7 +409,7 @@ bufferCoord, &save_region)) { result = TRUE; - mvcur(-1, -1, LINES - 2, 0); + SetConsoleCursorPosition(WINCONSOLE.hdl, WINCONSOLE.save_SBI.dwCursorPosition); T(("... restore original screen contents ok %dx%d (%d,%d - %d,%d)", WINCONSOLE.save_size.Y, WINCONSOLE.save_size.X, @@ -455,11 +438,13 @@ want = (size_t) (WINCONSOLE.save_size.X * WINCONSOLE.save_size.Y); - if ((WINCONSOLE.save_screen = malloc(want * sizeof(CHAR_INFO))) != 0) { - bufferCoord.X = (SHORT) (WINCONSOLE.window_only ? - WINCONSOLE.SBI.srWindow.Left : 0); - bufferCoord.Y = (SHORT) (WINCONSOLE.window_only ? - WINCONSOLE.SBI.srWindow.Top : 0); + if ((WINCONSOLE.save_screen = malloc(want * sizeof(CHAR_INFO))) != NULL) { + bufferCoord.X = (SHORT) (WINCONSOLE.window_only + ? WINCONSOLE.SBI.srWindow.Left + : 0); + bufferCoord.Y = (SHORT) (WINCONSOLE.window_only + ? WINCONSOLE.SBI.srWindow.Top + : 0); T(("... reading console %s %dx%d into %d,%d - %d,%d at %d,%d", WINCONSOLE.window_only ? "window" : "buffer", @@ -617,7 +602,7 @@ static int Adjust(int milliseconds, int diff) { - if (milliseconds != INFINITY) { + if (milliseconds != NC_INFINITY) { milliseconds -= diff; if (milliseconds < 0) milliseconds = 0; @@ -632,7 +617,7 @@ RIGHTMOST_BUTTON_PRESSED) static mmask_t -decode_mouse(SCREEN *sp, int mask) +decode_mouse(const SCREEN *sp, int mask) { mmask_t result = 0; @@ -668,7 +653,9 @@ return result; } -#define AdjustY() (WINCONSOLE.buffered ? 0 : (int) WINCONSOLE.SBI.srWindow.Top) +#define AdjustY() (WINCONSOLE.buffered \ + ? 0 \ + : (int) WINCONSOLE.SBI.srWindow.Top) static bool handle_mouse(SCREEN *sp, MOUSE_EVENT_RECORD mer) @@ -828,7 +815,7 @@ NCURSES_EXPORT(int) _nc_console_twait( - SCREEN *sp, + const SCREEN *sp, HANDLE hdl, int mode, int milliseconds, @@ -837,7 +824,7 @@ { INPUT_RECORD inp_rec; BOOL b; - DWORD nRead = 0, rc = (DWORD) (-1); + DWORD nRead = 0, rc = WAIT_FAILED; int code = 0; FILETIME fstart; FILETIME fend; @@ -848,9 +835,10 @@ (void) evl; /* TODO: implement wgetch-events */ #endif -#define IGNORE_CTRL_KEYS (SHIFT_PRESSED|LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED| \ - LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED) -#define CONSUME() ReadConsoleInput(hdl, &inp_rec, 1, &nRead) +#define IGNORE_CTRL_KEYS (SHIFT_PRESSED | \ + LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED | \ + LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED) +#define CONSUME() read_keycode(hdl, &inp_rec, 1, &nRead) assert(sp); @@ -858,7 +846,7 @@ hdl, milliseconds, mode)); if (milliseconds < 0) - milliseconds = INFINITY; + milliseconds = NC_INFINITY; memset(&inp_rec, 0, sizeof(inp_rec)); @@ -881,14 +869,13 @@ T(("twait:err GetNumberOfConsoleInputEvents")); } if (isNoDelay && b) { - T(("twait: Events Available: %ld", nRead)); + T(("twait: Events Available: %lu", (unsigned long) nRead)); if (nRead == 0) { code = 0; goto end; } else { DWORD n = 0; - INPUT_RECORD *pInpRec = - TypeAlloca(INPUT_RECORD, nRead); + MakeArray(pInpRec, INPUT_RECORD, nRead); if (pInpRec != NULL) { DWORD i; BOOL f; @@ -927,13 +914,13 @@ switch (inp_rec.EventType) { case KEY_EVENT: if (mode & TW_INPUT) { - WORD vk = - inp_rec.Event.KeyEvent.wVirtualKeyCode; - char ch = - inp_rec.Event.KeyEvent.uChar.AsciiChar; + WORD vk = inp_rec.Event.KeyEvent.wVirtualKeyCode; + WORD ch = inp_rec.Event.KeyEventChar; + T(("twait:event KEY_EVENT")); T(("twait vk=%d, ch=%d, keydown=%d", vk, ch, inp_rec.Event.KeyEvent.bKeyDown)); + if (inp_rec.Event.KeyEvent.bKeyDown) { T(("twait:event KeyDown")); if (!WINCONSOLE.isTermInfoConsole && @@ -964,7 +951,7 @@ continue; /* e.g., FOCUS_EVENT */ default: - T(("twait:event Tyoe %d", inp_rec.EventType)); + T(("twait:event Type %d", inp_rec.EventType)); CONSUME(); _nc_console_selectActiveHandle(); continue; @@ -986,7 +973,7 @@ end: TR(TRACE_IEVENT, ("end twait: returned %d (%lu), remaining time %d msec", - code, GetLastError(), milliseconds)); + code, (unsigned long) GetLastError(), milliseconds)); if (timeleft) *timeleft = milliseconds; @@ -996,7 +983,7 @@ NCURSES_EXPORT(int) _nc_console_testmouse( - SCREEN *sp, + const SCREEN *sp, HANDLE hdl, int delay EVENTLIST_2nd(_nc_eventlist * evl)) @@ -1037,7 +1024,7 @@ T((T_CALLED("lib_win32con::_nc_console_read(%p)"), sp)); - while ((b = ReadConsoleInput(hdl, &inp_rec, 1, &nRead))) { + while ((b = read_keycode(hdl, &inp_rec, 1, &nRead))) { if (b && nRead > 0) { if (rc < 0) rc = 0; @@ -1045,7 +1032,7 @@ if (inp_rec.EventType == KEY_EVENT) { if (!inp_rec.Event.KeyEvent.bKeyDown) continue; - *buf = (int) inp_rec.Event.KeyEvent.uChar.AsciiChar; + *buf = (int) inp_rec.Event.KeyEventChar; vk = inp_rec.Event.KeyEvent.wVirtualKeyCode; /* * There are 24 virtual function-keys, and typically @@ -1068,6 +1055,16 @@ ungetch('\0'); *buf = AnsiKey(vk); } + } else if (vk == VK_BACK) { + if (!(inp_rec.Event.KeyEvent.dwControlKeyState + & (SHIFT_PRESSED | CONTROL_PRESSED))) { + *buf = KEY_BACKSPACE; + } + } else if (vk == VK_TAB) { + if ((inp_rec.Event.KeyEvent.dwControlKeyState + & (SHIFT_PRESSED | CONTROL_PRESSED))) { + *buf = KEY_BTAB; + } } break; } else if (inp_rec.EventType == MOUSE_EVENT) { @@ -1083,6 +1080,7 @@ returnCode(rc); } +#if USE_TERM_DRIVER && (USE_NAMED_PIPES || defined(USE_WIN32CON_DRIVER)) /* Our replacement for the systems _isatty to include also a test for mintty. This is called from the NC_ISATTY macro defined in curses.priv.h @@ -1098,7 +1096,7 @@ int result = 0; T((T_CALLED("lib_win32con::_nc_console_isatty(%d"), fd)); - if (_isatty(fd)) + if (isatty(fd)) result = 1; #ifdef _NC_CHECK_MINTTY else { @@ -1114,137 +1112,155 @@ #endif returnCode(result); } +#endif /* USE_TERM_DRIVER && (USE_NAMED_PIPES || defined(USE_WIN32CON_DRIVER)) */ +#if USE_WINCONMODE NCURSES_EXPORT(bool) -_nc_console_checkinit(bool initFlag, bool assumeTermInfo) +_nc_console_checkinit(bool assumeTermInfo) { bool res = FALSE; - T((T_CALLED("lib_win32con::_nc_console_checkinit(initFlag=%d, assumeTermInfo=%d)"), - initFlag, assumeTermInfo)); - - if (!initFlag) { - res = console_initialized; - } else { - /* initialize once, or not at all */ - if (!console_initialized) { - int i; - DWORD num_buttons; - WORD a; - BOOL buffered = FALSE; - BOOL b; - - START_TRACE(); - WINCONSOLE.isTermInfoConsole = assumeTermInfo; - - WINCONSOLE.map = (LPDWORD) malloc(sizeof(DWORD) * MAPSIZE); - WINCONSOLE.rmap = (LPDWORD) malloc(sizeof(DWORD) * MAPSIZE); - WINCONSOLE.ansi_map = (LPDWORD) malloc(sizeof(DWORD) * MAPSIZE); - - for (i = 0; i < (N_INI + FKEYS); i++) { - if (i < N_INI) { - WINCONSOLE.rmap[i] = WINCONSOLE.map[i] = - (DWORD) keylist[i]; - WINCONSOLE.ansi_map[i] = (DWORD) ansi_keys[i]; - } else { - WINCONSOLE.rmap[i] = WINCONSOLE.map[i] = - (DWORD) GenMap((VK_F1 + (i - N_INI)), - (KEY_F(1) + (i - N_INI))); - WINCONSOLE.ansi_map[i] = - (DWORD) GenMap((VK_F1 + (i - N_INI)), - (';' + (i - N_INI))); - } - } - qsort(WINCONSOLE.ansi_map, - (size_t) (MAPSIZE), - sizeof(keylist[0]), - keycompare); - qsort(WINCONSOLE.map, - (size_t) (MAPSIZE), - sizeof(keylist[0]), - keycompare); - qsort(WINCONSOLE.rmap, - (size_t) (MAPSIZE), - sizeof(keylist[0]), - rkeycompare); - - if (GetNumberOfConsoleMouseButtons(&num_buttons)) { - WINCONSOLE.numButtons = (int) num_buttons; + T((T_CALLED("lib_win32con::_nc_console_checkinit(assumeTermInfo=%d)"), + assumeTermInfo)); + + /* initialize once, or not at all */ + if (!console_initialized) { + int i; + DWORD num_buttons; + WORD a; + BOOL buffered = FALSE; + BOOL b; + + START_TRACE(); + WINCONSOLE.isTermInfoConsole = assumeTermInfo; + + WINCONSOLE.map = (LPDWORD) malloc(sizeof(DWORD) * MAPSIZE); + WINCONSOLE.rmap = (LPDWORD) malloc(sizeof(DWORD) * MAPSIZE); + WINCONSOLE.ansi_map = (LPDWORD) malloc(sizeof(DWORD) * MAPSIZE); + + for (i = 0; i < (N_INI + FKEYS); i++) { + if (i < N_INI) { + WINCONSOLE.rmap[i] = WINCONSOLE.map[i] = + (DWORD) keylist[i]; + WINCONSOLE.ansi_map[i] = (DWORD) ansi_keys[i]; } else { - WINCONSOLE.numButtons = 1; + WINCONSOLE.rmap[i] = WINCONSOLE.map[i] = + (DWORD) GenMap((VK_F1 + (i - N_INI)), + (KEY_F(1) + (i - N_INI))); + WINCONSOLE.ansi_map[i] = + (DWORD) GenMap((VK_F1 + (i - N_INI)), + (';' + (i - N_INI))); } + } + qsort(WINCONSOLE.ansi_map, + (size_t) (MAPSIZE), + sizeof(keylist[0]), + keycompare); + qsort(WINCONSOLE.map, + (size_t) (MAPSIZE), + sizeof(keylist[0]), + keycompare); + qsort(WINCONSOLE.rmap, + (size_t) (MAPSIZE), + sizeof(keylist[0]), + rkeycompare); + + if (GetNumberOfConsoleMouseButtons(&num_buttons)) { + WINCONSOLE.numButtons = (int) num_buttons; + } else { + WINCONSOLE.numButtons = 1; + } - a = _nc_console_MapColor(true, COLOR_WHITE) | - _nc_console_MapColor(false, COLOR_BLACK); - for (i = 0; i < CON_NUMPAIRS; i++) - WINCONSOLE.pairs[i] = a; + a = _nc_console_MapColor(true, COLOR_WHITE) | + _nc_console_MapColor(false, COLOR_BLACK); + for (i = 0; i < CON_NUMPAIRS; i++) + WINCONSOLE.pairs[i] = a; #define SaveConsoleMode(handle, value) \ - GetConsoleMode(WINCONSOLE.handle, &WINCONSOLE.originalMode.value) + GetConsoleMode(WINCONSOLE.handle, &WINCONSOLE.originalMode.value) - if (WINCONSOLE.isTermInfoConsole) { - WINCONSOLE.inp = GetStdHandle(STD_INPUT_HANDLE); - WINCONSOLE.out = GetStdHandle(STD_OUTPUT_HANDLE); - WINCONSOLE.hdl = WINCONSOLE.out; + if (WINCONSOLE.isTermInfoConsole) { + WINCONSOLE.inp = GetStdHandle(STD_INPUT_HANDLE); + WINCONSOLE.out = GetStdHandle(STD_OUTPUT_HANDLE); + WINCONSOLE.hdl = WINCONSOLE.out; + + SaveConsoleMode(inp, dwFlagIn); + SaveConsoleMode(out, dwFlagOut); - SaveConsoleMode(inp, dwFlagIn); - SaveConsoleMode(out, dwFlagOut); + } else { + b = AllocConsole(); + + if (!b) + b = AttachConsole(ATTACH_PARENT_PROCESS); + + WINCONSOLE.inp = GetDirectHandle("CONIN$", FILE_SHARE_READ); + WINCONSOLE.out = GetDirectHandle("CONOUT$", FILE_SHARE_WRITE); + SaveConsoleMode(inp, dwFlagIn); + SaveConsoleMode(out, dwFlagOut); + + if (getenv("NCGDB") || getenv("NCURSES_CONSOLE2")) { + WINCONSOLE.hdl = WINCONSOLE.out; + buffered = FALSE; + T(("... will not buffer console")); } else { - b = AllocConsole(); - - if (!b) - b = AttachConsole(ATTACH_PARENT_PROCESS); - - WINCONSOLE.inp = GetDirectHandle("CONIN$", FILE_SHARE_READ); - WINCONSOLE.out = GetDirectHandle("CONOUT$", FILE_SHARE_WRITE); - - SaveConsoleMode(inp, dwFlagIn); - SaveConsoleMode(out, dwFlagOut); - - if (getenv("NCGDB") || getenv("NCURSES_CONSOLE2")) { - WINCONSOLE.hdl = WINCONSOLE.out; - T(("... will not buffer console")); - } else { - T(("... creating console buffer")); - WINCONSOLE.hdl = - CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, - CONSOLE_TEXTMODE_BUFFER, - NULL); - buffered = TRUE; - } + T(("... creating console buffer")); + WINCONSOLE.hdl = + CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + CONSOLE_TEXTMODE_BUFFER, + NULL); + buffered = TRUE; } + } - /* We set binary I/O even when using the console - driver to cover the situation, that the - TERM variable is set to #win32con, but actually - Windows supports virtual terminal processing. - So if terminfo functions are used in this setup, - they actually may work. - */ - _setmode(fileno(stdin), _O_BINARY); - _setmode(fileno(stdout), _O_BINARY); - - if (WINCONSOLE.hdl != INVALID_HANDLE_VALUE) { - WINCONSOLE.buffered = buffered; - _nc_console_get_SBI(); - WINCONSOLE.save_SBI = WINCONSOLE.SBI; - if (!buffered) { - save_original_screen(); - _nc_console_set_scrollback(FALSE, &WINCONSOLE.SBI); - } - GetConsoleCursorInfo(WINCONSOLE.hdl, &WINCONSOLE.save_CI); - T(("... initial cursor is %svisible, %d%%", - (WINCONSOLE.save_CI.bVisible ? "" : "not-"), - (int) WINCONSOLE.save_CI.dwSize)); + /* We set binary I/O even when using the console + driver to cover the situation, that the + TERM variable is set to #win32con, but actually + Windows supports virtual terminal processing. + So if terminfo functions are used in this setup, + they actually may work. + */ + _setmode(fileno(stdin), _O_BINARY); + _setmode(fileno(stdout), _O_BINARY); + + if (WINCONSOLE.hdl != INVALID_HANDLE_VALUE) { + WINCONSOLE.buffered = buffered; + _nc_console_get_SBI(); + WINCONSOLE.save_SBI = WINCONSOLE.SBI; + if (!buffered) { + save_original_screen(); + _nc_console_set_scrollback(FALSE, &WINCONSOLE.SBI); } + GetConsoleCursorInfo(WINCONSOLE.hdl, &WINCONSOLE.save_CI); + T(("... initial cursor is %svisible, %d%%", + (WINCONSOLE.save_CI.bVisible ? "" : "not-"), + (int) WINCONSOLE.save_CI.dwSize)); + } + + WINCONSOLE.initialized = TRUE; + console_initialized = TRUE; + } + res = (WINCONSOLE.hdl != INVALID_HANDLE_VALUE); + returnBool(res); +} +#endif /* USE_WINCONMODE */ + +NCURSES_EXPORT(bool) +_nc_console_restore(void) +{ + bool res = FALSE; - WINCONSOLE.initialized = TRUE; - console_initialized = TRUE; + T((T_CALLED("lib_win32con::_nc_console_restore"))); + if (WINCONSOLE.hdl != INVALID_HANDLE_VALUE) { + res = TRUE; + if (!WINCONSOLE.buffered) { + _nc_console_set_scrollback(TRUE, &WINCONSOLE.save_SBI); + if (!restore_original_screen()) + res = FALSE; } - res = (WINCONSOLE.hdl != INVALID_HANDLE_VALUE); + SetConsoleCursorInfo(WINCONSOLE.hdl, &WINCONSOLE.save_CI); } returnBool(res); } diff --git a/contrib/ncurses/ncurses/tinfo/lib_win32util.c b/contrib/ncurses/ncurses/tinfo/lib_win32util.c --- a/contrib/ncurses/ncurses/tinfo/lib_win32util.c +++ b/contrib/ncurses/ncurses/tinfo/lib_win32util.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2021,2023 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,16 +33,15 @@ ****************************************************************************/ #include +#include -MODULE_ID("$Id: lib_win32util.c,v 1.4 2023/06/17 17:19:06 tom Exp $") +MODULE_ID("$Id: lib_win32util.c,v 1.7 2025/06/28 16:58:13 tom Exp $") -#ifdef _NC_WINDOWS -#include +#ifdef _NC_WINDOWS_NATIVE #ifdef _NC_CHECK_MINTTY #define PSAPI_VERSION 2 #include -#include #define array_length(a) (sizeof(a)/sizeof(a[0])) @@ -131,4 +130,4 @@ } #endif // HAVE_GETTIMEOFDAY == 2 -#endif // _NC_WINDOWS +#endif // _NC_WINDOWS_NATIVE diff --git a/contrib/ncurses/ncurses/tinfo/make_hash.c b/contrib/ncurses/ncurses/tinfo/make_hash.c --- a/contrib/ncurses/ncurses/tinfo/make_hash.c +++ b/contrib/ncurses/ncurses/tinfo/make_hash.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2024 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 2009-2013,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -44,7 +44,7 @@ #include -MODULE_ID("$Id: make_hash.c,v 1.34 2024/03/02 19:35:40 tom Exp $") +MODULE_ID("$Id: make_hash.c,v 1.37 2025/10/18 15:39:43 tom Exp $") /* * _nc_make_hash_table() @@ -79,7 +79,7 @@ { size_t need = strlen(s) + 1; char *result = malloc(need); - if (result == 0) + if (result == NULL) failed("strmalloc"); _nc_STRCPY(result, s, need); return result; @@ -153,7 +153,7 @@ count_columns(char **list) { int result = 0; - if (list != 0) { + if (list != NULL) { while (*list++) { ++result; } @@ -168,17 +168,17 @@ int col = 0; - if (buffer == 0) { + if (buffer == NULL) { free(list); - list = 0; - return 0; + list = NULL; + return NULL; } if (*buffer != '#') { - if (list == 0) { + if (list == NULL) { list = typeCalloc(char *, (MAX_COLUMNS + 1)); - if (list == 0) - return (0); + if (list == NULL) + return (NULL); } while (*buffer != '\0') { char *s; @@ -205,7 +205,7 @@ break; } } - return col ? list : 0; + return col ? list : NULL; } #define SetType(n,t) \ @@ -247,9 +247,8 @@ main(int argc, char **argv) { unsigned tablesize = CAPTABSIZE; - struct user_table_entry *name_table = typeCalloc(struct - user_table_entry, tablesize); - HashValue *hash_table = typeCalloc(HashValue, HASHTABSIZE); + struct user_table_entry *name_table; + HashValue *hash_table; const char *root_name; int column = 0; int bigstring = 0; @@ -264,6 +263,12 @@ short NumCount = 0; short StrCount = 0; + if (argc == 2 && !strcmp(argv[1], "-?")) + return EXIT_SUCCESS; + + name_table = typeCalloc(struct user_table_entry, tablesize); + hash_table = typeCalloc(HashValue, HASHTABSIZE); + /* The first argument is the column-number (starting with 0). * The second is the root name of the tables to generate. */ @@ -272,8 +277,8 @@ || (column >= MAX_COLUMNS) || *(root_name = argv[2]) == 0 || (bigstring = atoi(argv[3])) < 0 - || name_table == 0 - || hash_table == 0) { + || name_table == NULL + || hash_table == NULL) { fprintf(stderr, "usage: make_hash column root_name bigstring\n"); exit(EXIT_FAILURE); } @@ -291,7 +296,7 @@ else buffer[sizeof(buffer) - 2] = '\0'; list = parse_columns(buffer); - if (list == 0) /* blank or comment */ + if (list == NULL) /* blank or comment */ continue; if (is_user) { if (strcmp(list[0], "userdef")) @@ -382,15 +387,15 @@ printf("\t%d,%d,", name_table[n].ute_argc, name_table[n].ute_args); - printf("\t%3d, %3d %s%c\n", + printf("\t%3d, %3d %s%s\n", name_table[n].ute_index, name_table[n].ute_link, R_BRACE, - n < tablesize - 1 ? ',' : ' '); + n < tablesize - 1 ? "," : ""); len += (int) strlen(name_table[n].ute_name) + 1; } printf("%s;\n\n", R_BRACE); - printf("static struct %s_table_entry *_nc_%s_table = 0;\n\n", + printf("static struct %s_table_entry *_nc_%s_table = NULL;\n\n", table_name, root_name); } else { @@ -407,11 +412,11 @@ printf("\t%d,%d,", name_table[n].ute_argc, name_table[n].ute_args); - printf("\t%3d, %3d %s%c\n", + printf("\t%3d, %3d %s%s\n", name_table[n].ute_index, name_table[n].ute_link, R_BRACE, - n < tablesize - 1 ? ',' : ' '); + n < tablesize - 1 ? "," : ""); } printf("%s;\n\n", R_BRACE); } @@ -439,7 +444,7 @@ free((void *) name_table[n].ute_name); } free(name_table); - parse_columns(0); + parse_columns(NULL); return EXIT_SUCCESS; } diff --git a/contrib/ncurses/ncurses/tinfo/make_keys.c b/contrib/ncurses/ncurses/tinfo/make_keys.c --- a/contrib/ncurses/ncurses/tinfo/make_keys.c +++ b/contrib/ncurses/ncurses/tinfo/make_keys.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2011,2015 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,7 +40,7 @@ #define USE_TERMLIB 1 #include -MODULE_ID("$Id: make_keys.c,v 1.23 2021/08/18 20:55:25 tom Exp $") +MODULE_ID("$Id: make_keys.c,v 1.25 2025/10/18 15:41:07 tom Exp $") #include @@ -51,10 +51,10 @@ if (result == 0) { unsigned n; - for (n = 0; strnames[n] != 0; n++) { + for (n = 0; strnames[n] != NULL; n++) { ++result; } - for (n = 0; strfnames[n] != 0; n++) { + for (n = 0; strfnames[n] != NULL; n++) { ++result; } } @@ -66,14 +66,14 @@ { unsigned n; bool found = FALSE; - for (n = 0; strnames[n] != 0; n++) { + for (n = 0; strnames[n] != NULL; n++) { if (!strcmp(name, strnames[n])) { found = TRUE; break; } } if (!found) { - for (n = 0; strfnames[n] != 0; n++) { + for (n = 0; strfnames[n] != NULL; n++) { if (!strcmp(name, strfnames[n])) { found = TRUE; break; @@ -93,7 +93,7 @@ unsigned maxlen = 16; int scanned; - while (fgets(buffer, (int) sizeof(buffer), ifp) != 0) { + while (fgets(buffer, (int) sizeof(buffer), ifp) != NULL) { if (*buffer == '#') continue; @@ -119,7 +119,7 @@ static void write_list(FILE *ofp, const char **list) { - while (*list != 0) + while (*list != NULL) fprintf(ofp, "%s\n", *list++); } @@ -139,22 +139,25 @@ "static", "#endif", "const struct tinfo_fkeys _nc_tinfo_fkeys[] = {", - 0 + NULL }; static const char *suffix[] = { "\t{ 0, 0} };", "", "#endif /* _INIT_KEYTRY_H */", - 0 + NULL }; + if (argc == 2 && !strcmp(argv[1], "-?")) + return EXIT_SUCCESS; + write_list(stdout, prefix); if (argc > 1) { int n; for (n = 1; n < argc; n++) { FILE *fp = fopen(argv[n], "r"); - if (fp != 0) { + if (fp != NULL) { make_keys(fp, stdout); fclose(fp); } diff --git a/contrib/ncurses/ncurses/tinfo/name_match.c b/contrib/ncurses/ncurses/tinfo/name_match.c --- a/contrib/ncurses/ncurses/tinfo/name_match.c +++ b/contrib/ncurses/ncurses/tinfo/name_match.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2013,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -34,7 +34,7 @@ #include #include -MODULE_ID("$Id: name_match.c,v 1.25 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: name_match.c,v 1.27 2025/01/12 00:41:56 tom Exp $") #define FirstName _nc_globals.first_name @@ -44,7 +44,7 @@ { if ((_nc_syntax == SYN_TERMCAP) && _nc_user_definable) { const char *bar = strchr(name, '|'); - if (bar != 0 && (bar - name) == 2) + if (bar != NULL && (bar - name) == 2) name = bar + 1; } return name; @@ -60,17 +60,17 @@ _nc_first_name(const char *const sp) { #if NO_LEAKS - if (sp == 0) { - if (FirstName != 0) { + if (sp == NULL) { + if (FirstName != NULL) { FreeAndNull(FirstName); } } else #endif { - if (FirstName == 0) + if (FirstName == NULL) FirstName = typeMalloc(char, MAX_NAME_SIZE + 1); - if (FirstName != 0) { + if (FirstName != NULL) { unsigned n; const char *src = sp; #if NCURSES_USE_TERMCAP && NCURSES_XNAMES @@ -95,7 +95,7 @@ { const char *s; - if ((s = namelst) != 0) { + if ((s = namelst) != NULL) { while (*s != '\0') { const char *d, *t; int code, found; diff --git a/contrib/ncurses/ncurses/tinfo/obsolete.c b/contrib/ncurses/ncurses/tinfo/obsolete.c --- a/contrib/ncurses/ncurses/tinfo/obsolete.c +++ b/contrib/ncurses/ncurses/tinfo/obsolete.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2023 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 2013-2014,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -37,7 +37,7 @@ #include -MODULE_ID("$Id: obsolete.c,v 1.11 2023/10/21 15:38:47 tom Exp $") +MODULE_ID("$Id: obsolete.c,v 1.13 2025/02/20 01:12:11 tom Exp $") /* * Obsolete entrypoint retained for binary compatibility. @@ -64,11 +64,11 @@ NCURSES_EXPORT(char *) _nc_strdup(const char *s) { - char *result = 0; - if (s != 0) { + char *result = NULL; + if (s != NULL) { size_t need = strlen(s); result = malloc(need + 1); - if (result != 0) { + if (result != NULL) { _nc_STRCPY(result, s, need); } } @@ -126,7 +126,7 @@ rc = 0; } - if (target != 0) { + if (target != NULL) { switch (rc) { case 1: target[0] = CH(0); @@ -225,7 +225,7 @@ } } - if (target != 0) { + if (target != NULL) { int shift = 0; *target = 0; for (j = 1; j < rc; j++) { diff --git a/contrib/ncurses/ncurses/tinfo/parse_entry.c b/contrib/ncurses/ncurses/tinfo/parse_entry.c --- a/contrib/ncurses/ncurses/tinfo/parse_entry.c +++ b/contrib/ncurses/ncurses/tinfo/parse_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -48,7 +48,7 @@ #include #include -MODULE_ID("$Id: parse_entry.c,v 1.108 2023/04/24 22:32:33 tom Exp $") +MODULE_ID("$Id: parse_entry.c,v 1.117 2025/11/23 20:25:15 tom Exp $") #ifdef LINT static short const parametrized[] = @@ -204,7 +204,7 @@ { struct user_table_entry const *entry = _nc_find_user_entry(name); bool result = TRUE; - if ((entry != 0) && (token_type != CANCEL)) { + if ((entry != NULL) && (token_type != CANCEL)) { int have_type = (1 << token_type); if (!(entry->ute_type & have_type)) { if (!silent) @@ -332,7 +332,7 @@ entryp->tterm.str_table = entryp->tterm.term_names = _nc_save_str(ptr); - if (entryp->tterm.str_table == 0) + if (entryp->tterm.str_table == NULL) returnDB(ERR); DEBUG(2, ("Starting '%s'", ptr)); @@ -350,7 +350,7 @@ _nc_set_type(name); /* check for overly-long names and aliases */ - for (base = entryp->tterm.term_names; (ptr = strchr(base, '|')) != 0; + for (base = entryp->tterm.term_names; (ptr = strchr(base, '|')) != NULL; base = ptr + 1) { if (ptr - base > MAX_ALIAS) { _nc_warning("%s `%.*s' may be too long", @@ -379,10 +379,15 @@ _nc_warning("invalid name for use-clause \"%s\"", _nc_curr_token.tk_valstring); continue; - } else if (entryp->nuses >= MAX_USES) { + } else if (entryp->nuses >= HARD_MAX_USES) { _nc_warning("too many use-clauses, ignored \"%s\"", _nc_curr_token.tk_valstring); continue; + } else if (entryp->nuses >= WARN_MAX_USES) { + _nc_warning("possibly too many use-clauses (%d vs %d), \"%s\"", + entryp->nuses, + WARN_MAX_USES, + _nc_curr_token.tk_valstring); } if ((saved = _nc_save_str(_nc_curr_token.tk_valstring)) != NULL) { entryp->uses[entryp->nuses].name = saved; @@ -395,7 +400,7 @@ } else { /* normal token lookup */ entry_ptr = _nc_find_entry(_nc_curr_token.tk_name, - _nc_get_hash_table(_nc_syntax)); + _nc_get_hash_table(_nc_syntax == SYN_TERMCAP)); /* * Our kluge to handle aliasing. The reason it is done @@ -459,7 +464,7 @@ 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) { + token_type)) != NULL) { if (_nc_tracing >= DEBUG_LEVEL(1)) { _nc_warning("extended capability '%s'", _nc_curr_token.tk_name); @@ -487,8 +492,8 @@ */ if (!strcmp("ma", _nc_curr_token.tk_name)) { entry_ptr = _nc_find_type_entry("ma", NUMBER, - _nc_syntax != 0); - assert(entry_ptr != 0); + _nc_syntax != SYN_TERMINFO); + assert(entry_ptr != NULL); } } else if (entry_ptr->nte_type != token_type) { /* @@ -505,15 +510,15 @@ && !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); + _nc_syntax != SYN_TERMINFO); + assert(entry_ptr != NULL); } 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); + _nc_syntax != SYN_TERMINFO); + assert(entry_ptr != NULL); } else if (token_type == BOOLEAN && entry_ptr->nte_type == STRING) { @@ -549,7 +554,8 @@ case CANCEL: switch (entry_ptr->nte_type) { case BOOLEAN: - entryp->tterm.Booleans[entry_ptr->nte_index] = CANCELLED_BOOLEAN; + entryp->tterm.Booleans[entry_ptr->nte_index] = + (NCURSES_SBOOL) CANCELLED_BOOLEAN; break; case NUMBER: @@ -629,7 +635,7 @@ * have picked up defaults via translation. */ for (i = 0; i < entryp->nuses; i++) { - if (entryp->uses[i].name != 0 + if (entryp->uses[i].name != NULL && !strchr(entryp->uses[i].name, '+')) has_base_entry = TRUE; } @@ -695,9 +701,9 @@ } static void -append_acs0(string_desc * dst, int code, char *src, size_t off) +append_acs0(string_desc * dst, int code, const char *src, size_t off) { - if (src != 0 && off < strlen(src)) { + if (src != NULL && off < strlen(src)) { char temp[3]; temp[0] = (char) code; temp[1] = src[off]; @@ -707,7 +713,7 @@ } static void -append_acs(string_desc * dst, int code, char *src) +append_acs(string_desc * dst, int code, const char *src) { if (VALID_STRING(src) && strlen(src) == 1) { append_acs0(dst, code, src, 0); @@ -929,15 +935,15 @@ /* we're going to use this for a special case later */ dp = strchr(other_non_function_keys, 'i'); - foundim = (dp != 0) && (dp[1] == 'm'); + foundim = (dp != NULL) && (dp[1] == 'm'); /* look at each comma-separated capability in the ko string... */ for (base = other_non_function_keys; - (cp = strchr(base, ',')) != 0; + (cp = strchr(base, ',')) != NULL; base = cp + 1) { size_t len = (unsigned) (cp - base); size_t n; - assoc const *ap = 0; + assoc const *ap = NULL; for (n = 0; n < SIZEOF(ko_xlate); ++n) { if (len == strlen(ko_xlate[n].from) @@ -946,7 +952,7 @@ break; } } - if (ap == 0) { + if (ap == NULL) { _nc_warning("unknown capability `%.*s' in ko string", (int) len, base); continue; @@ -985,6 +991,8 @@ bp = tp->Strings[from_ptr->nte_index]; if (VALID_STRING(bp)) { for (dp = buf2; *bp; bp++) { + if ((size_t) (dp - buf2) >= (sizeof(buf2) - sizeof(TERMTYPE2))) + break; if (bp[0] == '$' && bp[1] == '<') { while (*bp && *bp != '>') { ++bp; @@ -1143,7 +1151,7 @@ return NOTFOUND; } - for (count = 0; names[count] != 0; count++) { + for (count = 0; names[count] != NULL; count++) { if (!strcmp(names[count], find)) { struct name_table_entry const *entry_ptr = _nc_get_table(FALSE); while (entry_ptr->nte_type != state diff --git a/contrib/ncurses/ncurses/tinfo/read_entry.c b/contrib/ncurses/ncurses/tinfo/read_entry.c --- a/contrib/ncurses/ncurses/tinfo/read_entry.c +++ b/contrib/ncurses/ncurses/tinfo/read_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -42,7 +42,7 @@ #include -MODULE_ID("$Id: read_entry.c,v 1.171 2023/09/16 16:30:34 tom Exp $") +MODULE_ID("$Id: read_entry.c,v 1.175 2025/01/11 23:52:18 tom Exp $") #define MyNumber(n) (short) LOW_MSB(n) @@ -51,7 +51,7 @@ #if NCURSES_USE_DATABASE #if NCURSES_EXT_NUMBERS static size_t -convert_16bits(char *buf, NCURSES_INT2 *Numbers, int count) +convert_16bits(const char *buf, NCURSES_INT2 *Numbers, int count) { int i; size_t j; @@ -77,7 +77,7 @@ } static size_t -convert_32bits(char *buf, NCURSES_INT2 *Numbers, int count) +convert_32bits(const char *buf, NCURSES_INT2 *Numbers, int count) { int i; size_t j; @@ -98,7 +98,7 @@ } #else static size_t -convert_32bits(char *buf, NCURSES_INT2 *Numbers, int count) +convert_32bits(const char *buf, NCURSES_INT2 *Numbers, int count) { int i, j; unsigned char ch; @@ -122,7 +122,7 @@ } static size_t -convert_16bits(char *buf, NCURSES_INT2 *Numbers, int count) +convert_16bits(const char *buf, NCURSES_INT2 *Numbers, int count) { int i; for (i = 0; i < count; i++) { @@ -195,7 +195,7 @@ } static int -fake_read(char *src, int *offset, int limit, char *dst, unsigned want) +fake_read(const char *src, int *offset, int limit, char *dst, unsigned want) { int have = (limit - *offset); @@ -237,11 +237,11 @@ tp->ext_Numbers = 0; tp->ext_Strings = 0; #endif - if (tp->Booleans == 0) + if (tp->Booleans == NULL) TYPE_MALLOC(NCURSES_SBOOL, BOOLCOUNT, tp->Booleans); - if (tp->Numbers == 0) + if (tp->Numbers == NULL) TYPE_MALLOC(NCURSES_INT2, NUMCOUNT, tp->Numbers); - if (tp->Strings == 0) + if (tp->Strings == NULL) TYPE_MALLOC(char *, STRCOUNT, tp->Strings); for_each_boolean(i, tp) @@ -285,7 +285,7 @@ char buf[MAX_ENTRY_SIZE + 2]; char *string_table; unsigned want, have; - size_t (*convert_numbers) (char *, NCURSES_INT2 *, int); + size_t (*convert_numbers) (const char *, NCURSES_INT2 *, int); int size_of_numbers; int max_entry_size = MAX_ENTRY_SIZE; @@ -346,7 +346,7 @@ 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) { + || (string_table = typeMalloc(char, want)) == NULL) { returnDB(TGETENT_NO); } @@ -483,7 +483,7 @@ if (ext_str_limit) { ptr->ext_str_table = typeMalloc(char, (size_t) ext_str_limit); - if (ptr->ext_str_table == 0) { + if (ptr->ext_str_table == NULL) { returnDB(TGETENT_NO); } if (Read(ptr->ext_str_table, (unsigned) ext_str_limit) != ext_str_limit) { @@ -582,11 +582,11 @@ _nc_read_file_entry(const char *const filename, TERMTYPE2 *ptr) /* return 1 if read, 0 if not found or garbled */ { - FILE *fp = 0; + FILE *fp = NULL; int code; if (_nc_access(filename, R_OK) < 0 - || (fp = safe_fopen(filename, BIN_R)) == 0) { + || (fp = safe_fopen(filename, BIN_R)) == NULL) { TR(TRACE_DATABASE, ("cannot open terminfo %s (errno=%d)", filename, errno)); code = TGETENT_NO; } else { @@ -728,7 +728,7 @@ static int decode_quickdump(char *target, const char *source) { - char *base = target; + const char *base = target; int result = 0; if (!strncmp(source, "b64:", (size_t) 4)) { @@ -797,13 +797,13 @@ } else #if USE_HASHED_DB if (make_db_filename(filename, limit, path) - && (capdbp = _nc_db_open(filename, FALSE)) != 0) { + && (capdbp = _nc_db_open(filename, FALSE)) != NULL) { DBT key, data; int reccnt = 0; char *save = strdup(name); - if (save == 0) + if (save == NULL) returnDB(code); memset(&key, 0, sizeof(key)); @@ -881,7 +881,7 @@ { int code = TGETENT_NO; - if (name == 0) + if (name == NULL) return _nc_read_entry2("", filename, tp); _nc_SPRINTF(filename, _nc_SLIMIT(PATH_MAX) @@ -891,7 +891,7 @@ || strcmp(name, ".") == 0 || strcmp(name, "..") == 0 || _nc_pathlast(name) != 0 - || strchr(name, NCURSES_PATHSEP) != 0) { + || strchr(name, NCURSES_PATHSEP) != NULL) { TR(TRACE_DATABASE, ("illegal or missing entry name '%s'", name)); } else { #if NCURSES_USE_DATABASE @@ -901,7 +901,7 @@ _nc_first_db(&state, &offset); code = TGETENT_ERR; - while ((path = _nc_next_db(&state, &offset)) != 0) { + while ((path = _nc_next_db(&state, &offset)) != NULL) { code = _nc_read_tic_entry(filename, PATH_MAX, path, name, tp); if (code == TGETENT_YES) { _nc_last_db(); diff --git a/contrib/ncurses/ncurses/tinfo/read_termcap.c b/contrib/ncurses/ncurses/tinfo/read_termcap.c --- a/contrib/ncurses/ncurses/tinfo/read_termcap.c +++ b/contrib/ncurses/ncurses/tinfo/read_termcap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2021,2023 Thomas E. Dickey * + * Copyright 2018-2023,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -57,7 +57,7 @@ #include #include -MODULE_ID("$Id: read_termcap.c,v 1.104 2023/06/24 21:53:16 tom Exp $") +MODULE_ID("$Id: read_termcap.c,v 1.107 2025/12/25 18:20:22 tom Exp $") #if !PURE_TERMINFO @@ -72,7 +72,7 @@ { const char *result; - if (!use_terminfo_vars() || (result = getenv("TERMPATH")) == 0) + if (!use_terminfo_vars() || (result = getenv("TERMPATH")) == NULL) result = TERMPATH; TR(TRACE_DATABASE, ("TERMPATH is %s", result)); return result; @@ -275,7 +275,7 @@ { register char *r_end, *rp; int myfd = FALSE; - char *record = 0; + char *record = NULL; int tc_not_resolved; int current; int lineno; @@ -291,7 +291,7 @@ * 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) { + if ((record = DOALLOC(topreclen + BFRAG)) == NULL) { errno = ENOMEM; return (TC_SYS_ERR); } @@ -305,7 +305,7 @@ /* * Allocate first chunk of memory. */ - if ((record = DOALLOC(BFRAG)) == 0) { + if ((record = DOALLOC(BFRAG)) == NULL) { errno = ENOMEM; return (TC_SYS_ERR); } @@ -315,7 +315,7 @@ /* * Loop through database array until finding the record. */ - for (current = in_array; db_array[current] != 0; current++) { + for (current = in_array; db_array[current] != NULL; current++) { int eof = FALSE; /* @@ -408,7 +408,7 @@ pos = (unsigned) (rp - record); newsize = (size_t) (r_end - record + BFRAG); record = DOALLOC(newsize); - if (record == 0) { + if (record == NULL) { if (myfd) (void) close(fd); errno = ENOMEM; @@ -464,7 +464,7 @@ register int newilen; unsigned ilen; int diff, iret, tclen, oline; - char *icap = 0, *scan, *tc, *tcstart, *tcend; + char *icap = NULL, *scan, *tc, *tcstart, *tcend; /* * Loop invariants: @@ -477,7 +477,7 @@ scan = record; tc_not_resolved = FALSE; for (;;) { - if ((tc = _nc_cgetcap(scan, "tc", '=')) == 0) { + if ((tc = _nc_cgetcap(scan, "tc", '=')) == NULL) { break; } @@ -548,7 +548,7 @@ tcpos = (unsigned) (tcstart - record); tcposend = (unsigned) (tcend - record); record = DOALLOC(newsize); - if (record == 0) { + if (record == NULL) { if (myfd) (void) close(fd); free(icap); @@ -586,7 +586,7 @@ (void) close(fd); *len = (unsigned) (rp - record - 1); /* don't count NUL */ if (r_end > rp) { - if ((record = DOALLOC((size_t) (rp - record))) == 0) { + if ((record = DOALLOC((size_t) (rp - record))) == NULL) { errno = ENOMEM; return (TC_SYS_ERR); } @@ -720,7 +720,7 @@ int ch; bool found = FALSE; char *s, *base; - char *tok = 0; + char *tok = NULL; *endp = TRUE; for (s = base = *srcp; *s != '\0';) { @@ -749,7 +749,7 @@ } /* malformed entry may end without a ':' */ - if (tok == 0 && found) { + if (tok == NULL && found) { tok = base; } @@ -768,7 +768,7 @@ continue; } if (--len == 0) { - dst = 0; + dst = NULL; break; } *dst++ = (char) ch; @@ -813,13 +813,13 @@ 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) { + if ((termpath = get_termpath()) != NULL) { _nc_safe_strcat(&desc, termpath); } else { char temp[PBUFSIZ]; temp[0] = 0; - if ((home = getenv("HOME")) != 0 && *home != '\0' - && strchr(home, ' ') == 0 + if ((home = getenv("HOME")) != NULL && *home != '\0' + && strchr(home, ' ') == NULL && strlen(home) < sizeof(temp) - 10) { /* setup path */ _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "%s/", home); /* $HOME first */ @@ -850,7 +850,7 @@ } } } - *fname = 0; /* mark end of vector */ + *fname = NULL; /* mark end of vector */ #if !HAVE_BSD_CGETENT (void) _nc_cgetset(0); #endif @@ -875,7 +875,7 @@ pd = bp; ps = dummy; - while (!endflag && (tok = get_tc_token(&ps, &endflag)) != 0) { + while (!endflag && (tok = get_tc_token(&ps, &endflag)) != NULL) { bool ignore = FALSE; for (n = 1; n < count; n++) { @@ -889,7 +889,7 @@ if (ignore != TRUE) { list[count++] = tok; pd = copy_tc_token(pd, tok, (size_t) (TBUFSIZ - (2 + pd - bp))); - if (pd == 0) { + if (pd == NULL) { i = -1; break; } @@ -901,7 +901,7 @@ FreeIfNeeded(dummy); FreeIfNeeded(the_source); - the_source = 0; + the_source = NULL; /* 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 @@ -917,10 +917,10 @@ if (_nc_access(temp, R_OK) == 0) { _nc_safe_strcpy(&desc, pathvec[i]); } - if ((the_source = strdup(temp)) != 0) + if ((the_source = strdup(temp)) != NULL) *sourcename = the_source; #else - if ((the_source = strdup(pathvec[i])) != 0) + if ((the_source = strdup(pathvec[i])) != NULL) *sourcename = the_source; #endif } @@ -941,7 +941,7 @@ add_tc(char *termpaths[], char *path, int count) { char *save = strchr(path, NCURSES_PATHSEP); - if (save != 0) + if (save != NULL) *save = '\0'; if (count < MAXPATHS && _nc_access(path, R_OK) == 0) { @@ -949,7 +949,7 @@ TR(TRACE_DATABASE, ("Adding termpath %s", path)); } termpaths[count] = 0; - if (save != 0) + if (save != NULL) *save = NCURSES_PATHSEP; return count; } @@ -966,7 +966,7 @@ #endif #if USE_GETCAP char *p, tc[TBUFSIZ]; - char *tc_buf = 0; + char *tc_buf = NULL; #define MY_SIZE sizeof(tc) - 1 int status; static char *source; @@ -982,7 +982,7 @@ return TGETENT_NO; } - if (use_terminfo_vars() && (p = getenv("TERMCAP")) != 0 + if (use_terminfo_vars() && (p = getenv("TERMCAP")) != NULL && !_nc_is_abs_path(p) && _nc_name_match(p, tn, "|:")) { /* TERMCAP holds a termcap entry */ tc_buf = strdup(p); @@ -996,7 +996,7 @@ _nc_set_source(source); tc_buf = tc; } - if (tc_buf == 0) + if (tc_buf == NULL) return (TGETENT_ERR); _nc_read_entry_source((FILE *) 0, tc_buf, FALSE, TRUE, NULLHOOK); if (tc_buf != tc) @@ -1034,20 +1034,20 @@ int j, k; bool use_buffer = FALSE; bool normal = TRUE; - char *tc_buf = 0; + char *tc_buf = NULL; char pathbuf[PATH_MAX]; - char *copied = 0; + char *copied = NULL; char *cp; struct stat test_stat[MAXPATHS]; - termpaths[filecount] = 0; - if (use_terminfo_vars() && (tc = getenv("TERMCAP")) != 0) { + termpaths[filecount] = NULL; + if (use_terminfo_vars() && (tc = getenv("TERMCAP")) != NULL) { 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); + use_buffer = (tc_buf != NULL); normal = FALSE; } } @@ -1055,7 +1055,7 @@ if (normal) { /* normal case */ char envhome[PATH_MAX], *h; - if ((copied = strdup(get_termpath())) != 0) { + if ((copied = strdup(get_termpath())) != NULL) { for (cp = copied; *cp; cp++) { if (*cp == NCURSES_PATHSEP) *cp = '\0'; @@ -1085,7 +1085,7 @@ #if HAVE_LINK for (j = 0; j < filecount; j++) { bool omit = FALSE; - if (stat(termpaths[j], &test_stat[j]) != 0 + if (!_nc_is_path_found(termpaths[j], &test_stat[j]) || !S_ISREG(test_stat[j].st_mode)) { omit = TRUE; } else { @@ -1140,11 +1140,11 @@ } } } - if (copied != 0) + if (copied != NULL) free(copied); #endif /* USE_GETCAP */ - if (_nc_head == 0) + if (_nc_head == NULL) return (TGETENT_ERR); /* resolve all use references */ @@ -1153,7 +1153,7 @@ /* find a terminal matching tn, if we can */ #if USE_GETCAP_CACHE - if (getcwd(cwd_buf, sizeof(cwd_buf)) != 0) { + if (getcwd(cwd_buf, sizeof(cwd_buf)) != NULL) { _nc_set_writedir((char *) 0); /* note: this does a chdir */ #endif for_entry_list(ep) { diff --git a/contrib/ncurses/ncurses/tinfo/strings.c b/contrib/ncurses/ncurses/tinfo/strings.c --- a/contrib/ncurses/ncurses/tinfo/strings.c +++ b/contrib/ncurses/ncurses/tinfo/strings.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2023 Thomas E. Dickey * + * Copyright 2020-2023,2024 Thomas E. Dickey * * Copyright 2000-2012,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,7 +38,7 @@ #include #include -MODULE_ID("$Id: strings.c,v 1.11 2023/05/27 20:13:10 tom Exp $") +MODULE_ID("$Id: strings.c,v 1.12 2024/12/07 21:24:18 tom Exp $") /**************************************************************************** * Useful string functions (especially for mvcur) @@ -71,12 +71,12 @@ NCURSES_EXPORT(string_desc *) _nc_str_init(string_desc * dst, char *src, size_t len) { - if (dst != 0) { + if (dst != NULL) { dst->s_head = src; dst->s_tail = src; dst->s_size = len - 1; dst->s_init = dst->s_size; - if (src != 0) + if (src != NULL) *src = 0; } return dst; @@ -88,7 +88,7 @@ NCURSES_EXPORT(string_desc *) _nc_str_null(string_desc * dst, size_t len) { - return _nc_str_init(dst, 0, len); + return _nc_str_init(dst, NULL, len); } /* @@ -111,7 +111,7 @@ size_t len = strlen(src); if (len < dst->s_size) { - if (dst->s_tail != 0) { + if (dst->s_tail != NULL) { _nc_STRCPY(dst->s_tail, src, dst->s_size); dst->s_tail += len; } @@ -132,7 +132,7 @@ size_t len = strlen(src); if (len < dst->s_size) { - if (dst->s_head != 0) { + if (dst->s_head != NULL) { _nc_STRCPY(dst->s_head, src, dst->s_size); dst->s_tail = dst->s_head + len; } diff --git a/contrib/ncurses/ncurses/tinfo/tinfo_driver.c b/contrib/ncurses/ncurses/tinfo/tinfo_driver.c --- a/contrib/ncurses/ncurses/tinfo/tinfo_driver.c +++ b/contrib/ncurses/ncurses/tinfo/tinfo_driver.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 2008-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -52,7 +52,7 @@ # endif #endif -MODULE_ID("$Id: tinfo_driver.c,v 1.74 2023/09/16 10:44:33 tom Exp $") +MODULE_ID("$Id: tinfo_driver.c,v 1.88 2025/12/27 12:33:34 tom Exp $") /* * SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS, @@ -94,8 +94,8 @@ #endif #define TCBMAGIC NCDRV_MAGIC(NCDRV_TINFO) -#define AssertTCB() assert(TCB!=0 && TCB->magic==TCBMAGIC) -#define SetSP() assert(TCB->csp!=0); sp = TCB->csp; (void) sp +#define AssertTCB() assert(TCB != NULL && TCB->magic == TCBMAGIC) +#define SetSP() assert(TCB->csp != NULL); sp = TCB->csp; (void) sp /* * This routine needs to do all the work to make curscr look @@ -123,7 +123,7 @@ if (GET_TTY(termp->Filedes, &termp->Nttyb) == OK) { #ifdef TERMIOS termp->Nttyb.c_oflag &= (unsigned) (~OFLAGS_TABS); -#elif defined(EXP_WIN32_DRIVER) +#elif defined(USE_WIN32CON_DRIVER) /* noop */ #else termp->Nttyb.sg_flags &= (unsigned) (~XTABS); @@ -135,7 +135,7 @@ #else /* !USE_OLD_TTY */ #ifdef TERMIOS my_ospeed = (NCURSES_OSPEED) cfgetospeed(&(termp->Nttyb)); -#elif defined(EXP_WIN32_DRIVER) +#elif defined(USE_WIN32CON_DRIVER) /* noop */ my_ospeed = 0; #else @@ -161,9 +161,10 @@ SCREEN *sp; START_TRACE(); - T((T_CALLED("tinfo::drv_CanHandle(%p)"), (void *) TCB)); + T((T_CALLED("tinfo::drv_CanHandle(%p,%s,%p)"), + (void *) TCB, NonNull(tname), (void *) errret)); - assert(TCB != 0 && tname != 0); + assert(TCB != NULL && tname != NULL); termp = (TERMINAL *) TCB; sp = TCB->csp; TCB->magic = TCBMAGIC; @@ -215,7 +216,7 @@ * _nc_setupscreen(). Do it now anyway, so we can initialize the * baudrate. */ - if (sp == 0 && NC_ISATTY(termp->Filedes)) { + if (sp == NULL && NC_ISATTY(termp->Filedes)) { get_baudrate(termp); } #if NCURSES_EXT_NUMBERS @@ -323,15 +324,15 @@ AssertTCB(); SetSP(); - if (sp != 0 && orig_pair && orig_colors && (initialize_pair != 0)) { + if (sp != NULL && orig_pair && orig_colors && (initialize_pair != NULL)) { #if NCURSES_EXT_FUNCS sp->_default_color = isDefaultColor(fg) || isDefaultColor(bg); sp->_has_sgr_39_49 = (NCURSES_SP_NAME(tigetflag) (NCURSES_SP_ARGx - "AX") + UserCap(AX)) == TRUE); sp->_default_fg = isDefaultColor(fg) ? COLOR_DEFAULT : fg; sp->_default_bg = isDefaultColor(bg) ? COLOR_DEFAULT : bg; - if (sp->_color_pairs != 0) { + if (sp->_color_pairs != NULL) { bool save = sp->_default_color; sp->_default_color = TRUE; NCURSES_SP_NAME(init_pair) (NCURSES_SP_ARGx @@ -391,7 +392,7 @@ AssertTCB(); SetSP(); - if (orig_pair != 0) { + if (orig_pair != NULL) { NCURSES_PUTP2("orig_pair", orig_pair); result = TRUE; } @@ -407,7 +408,7 @@ AssertTCB(); SetSP(); - if (orig_colors != 0) { + if (orig_colors != NULL) { NCURSES_PUTP2("orig_colors", orig_colors); result = TRUE; } @@ -432,7 +433,7 @@ useTioctl = _nc_prescreen.use_tioctl; } -#ifdef EXP_WIN32_DRIVER +#ifdef USE_WIN32CON_DRIVER /* If we are here, then Windows console is used in terminfo mode. We need to figure out the size using the console API */ @@ -470,7 +471,7 @@ errno = 0; do { if (ioctl(termp->Filedes, IOCTL_WINSIZE, &size) >= 0) { - *linep = ((sp != 0 && sp->_filtered) + *linep = ((sp != NULL && sp->_filtered) ? 1 : WINSIZE_ROWS(size)); *colp = WINSIZE_COLS(size); @@ -489,7 +490,8 @@ /* * If environment variables are used, update them. */ - if ((sp == 0 || !sp->_filtered) && _nc_getenv_num("LINES") > 0) { + if ((sp == NULL || !sp->_filtered) + && _nc_getenv_num("LINES") > 0) { _nc_setenv_num("LINES", *linep); } if (_nc_getenv_num("COLUMNS") > 0) { @@ -504,11 +506,11 @@ * variable. */ if ((value = _nc_getenv_num("LINES")) > 0) { - *linep = value; + *linep = Min(value, MAX_ENV_LINES); T(("screen size: environment LINES = %d", *linep)); } if ((value = _nc_getenv_num("COLUMNS")) > 0) { - *colp = value; + *colp = Min(value, MAX_ENV_COLUMNS); T(("screen size: environment COLUMNS = %d", *colp)); } } @@ -545,7 +547,7 @@ drv_getsize(TERMINAL_CONTROL_BLOCK * TCB, int *l, int *c) { AssertTCB(); - assert(l != 0 && c != 0); + assert(l != NULL && c != NULL); *l = lines; *c = columns; return OK; @@ -604,6 +606,8 @@ AssertTCB(); sp = TCB->csp; + T((T_CALLED("tinfo:drv_mode(%p,%d,%d)"), (void *) sp, progFlag, defFlag)); + if (progFlag) /* prog mode */ { if (defFlag) { @@ -614,7 +618,7 @@ if ((drv_sgmode(TCB, FALSE, &(_term->Nttyb)) == OK)) { #ifdef TERMIOS _term->Nttyb.c_oflag &= (unsigned) ~OFLAGS_TABS; -#elif defined(EXP_WIN32_DRIVER) +#elif defined(USE_WIN32CON_DRIVER) /* noop */ #else _term->Nttyb.sg_flags &= (unsigned) ~XTABS; @@ -628,6 +632,10 @@ if (sp->_keypad_on) _nc_keypad(sp, TRUE); } +#if defined(USE_WIN32CON_DRIVER) + if (!WINCONSOLE.buffered) + _nc_console_set_scrollback(FALSE, &WINCONSOLE.SBI); +#endif code = OK; } } @@ -641,7 +649,7 @@ #ifdef TERMIOS if (_term->Ottyb.c_oflag & OFLAGS_TABS) tab = back_tab = NULL; -#elif defined(EXP_WIN32_DRIVER) +#elif defined(USE_WIN32CON_DRIVER) /* noop */ #else if (_term->Ottyb.sg_flags & XTABS) @@ -656,9 +664,13 @@ NCURSES_SP_NAME(_nc_flush) (sp); } code = drv_sgmode(TCB, TRUE, &(_term->Ottyb)); +#if defined(USE_WIN32CON_DRIVER) + if (!_nc_console_restore()) + code = ERR; +#endif } } - return (code); + returnCode(code); } static void @@ -676,7 +688,7 @@ { } -# define SGR0_TEST(mode) (mode != 0) && (exit_attribute_mode == 0 || strcmp(mode, exit_attribute_mode)) +# define SGR0_TEST(mode) (mode != NULL) && (exit_attribute_mode == NULL || strcmp(mode, exit_attribute_mode)) static void drv_screen_init(SCREEN *sp) @@ -791,7 +803,7 @@ default_fg(SCREEN *sp) { #if NCURSES_EXT_FUNCS - return (sp != 0) ? sp->_default_fg : COLOR_WHITE; + return (sp != NULL) ? sp->_default_fg : COLOR_WHITE; #else return COLOR_WHITE; #endif @@ -801,7 +813,7 @@ default_bg(SCREEN *sp) { #if NCURSES_EXT_FUNCS - return sp != 0 ? sp->_default_bg : COLOR_BLACK; + return sp != NULL ? sp->_default_bg : COLOR_BLACK; #else return COLOR_BLACK; #endif @@ -833,7 +845,7 @@ int old_fg, old_bg; AssertTCB(); - if (sp == 0) + if (sp == NULL) return; if (pair < 0 || pair >= COLOR_PAIRS) { @@ -844,13 +856,13 @@ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx TIPARM_1(set_color_pair, pair), 1, outc); return; - } else if (sp != 0) { + } else if (sp != NULL) { _nc_pair_content(SP_PARM, pair, &fg, &bg); } } if (old_pair >= 0 - && sp != 0 + && sp != NULL && _nc_pair_content(SP_PARM, old_pair, &old_fg, &old_bg) != ERR) { if ((isDefaultColor(fg) && !isDefaultColor(old_fg)) || (isDefaultColor(bg) && !isDefaultColor(old_bg))) { @@ -907,7 +919,7 @@ init_xterm_mouse(SCREEN *sp) { sp->_mouse_type = M_XTERM; - sp->_mouse_xtermcap = NCURSES_SP_NAME(tigetstr) (NCURSES_SP_ARGx "XM"); + sp->_mouse_xtermcap = NCURSES_SP_NAME(tigetstr) (NCURSES_SP_ARGx UserCap(XM)); if (!VALID_STRING(sp->_mouse_xtermcap)) sp->_mouse_xtermcap = "\033[?1000%?%p1%{1}%=%th%el%;"; } @@ -921,10 +933,10 @@ SetSP(); /* we know how to recognize mouse events under "xterm" */ - if (sp != 0) { + if (sp != NULL) { if (NonEmpty(key_mouse)) { init_xterm_mouse(sp); - } else if (strstr(SP_TERMTYPE term_names, "xterm") != 0) { + } else if (strstr(SP_TERMTYPE term_names, "xterm") != NULL) { if (_nc_add_to_try(&(sp->_keytry), xterm_kmous, KEY_MOUSE) == OK) init_xterm_mouse(sp); } @@ -949,7 +961,7 @@ } else #endif { -#ifdef EXP_WIN32_DRIVER +#if defined(USE_WIN32CON_DRIVER) rc = _nc_console_testmouse(sp, _nc_console_handle(sp->_ifd), delay @@ -1076,7 +1088,7 @@ SCREEN *sp = TCB->csp; AssertTCB(); - assert(sp != 0); + assert(sp != NULL); if (ena_acs != NULL) { NCURSES_PUTP2("ena_acs", ena_acs); } @@ -1091,7 +1103,7 @@ * * test/blue.c uses this feature. */ -#define PCH_KLUDGE(a,b) (a != 0 && b != 0 && !strcmp(a,b)) +#define PCH_KLUDGE(a,b) (a != NULL && b != NULL && !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; @@ -1099,7 +1111,7 @@ if (real_map[i] == 0) { real_map[i] = (chtype) i; if (real_map != fake_map) { - if (sp != 0) + if (sp != NULL) sp->_screen_acs_map[i] = TRUE; } } @@ -1118,7 +1130,7 @@ (int) i, _tracechar(UChar(acs_chars[i])), _tracechtype(real_map[UChar(acs_chars[i])]))); - if (sp != 0) { + if (sp != NULL) { sp->_screen_acs_map[UChar(acs_chars[i])] = TRUE; } } @@ -1163,7 +1175,7 @@ bool support_cookies = USE_XMC_SUPPORT; TERMINAL_CONTROL_BLOCK *TCB = (TERMINAL_CONTROL_BLOCK *) (sp->_term); - if (sp == 0 || !ENSURE_TINFO(sp)) + if (sp == NULL || !ENSURE_TINFO(sp)) return; #if USE_XMC_SUPPORT @@ -1172,7 +1184,7 @@ * in the environment, reset the support-flag. */ if (magic_cookie_glitch >= 0) { - if (getenv("NCURSES_NO_MAGIC_COOKIE") != 0) { + if (getenv("NCURSES_NO_MAGIC_COOKIE") != NULL) { support_cookies = FALSE; } } @@ -1258,7 +1270,7 @@ AssertTCB(); SetSP(); -#ifdef EXP_WIN32_DRIVER +#if defined(USE_WIN32CON_DRIVER) return _nc_console_twait(sp, _nc_console_handle(sp->_ifd), mode, @@ -1274,7 +1286,7 @@ { SCREEN *sp; int n; -#ifndef EXP_WIN32_DRIVER +#if !defined(USE_WIN32CON_DRIVER) unsigned char c2 = 0; #endif @@ -1283,7 +1295,7 @@ SetSP(); _nc_set_read_thread(TRUE); -#ifdef EXP_WIN32_DRIVER +#if defined(USE_WIN32CON_DRIVER) n = _nc_console_read(sp, _nc_console_handle(sp->_ifd), buf); @@ -1291,7 +1303,7 @@ n = (int) read(sp->_ifd, &c2, (size_t) 1); #endif _nc_set_read_thread(FALSE); -#ifndef EXP_WIN32_DRIVER +#if !defined(USE_WIN32CON_DRIVER) *buf = (int) c2; #endif return n; @@ -1310,10 +1322,10 @@ request = remaining; } } -#elif defined(EXP_WIN32_DRIVER) +#elif defined(USE_WIN32CON_DRIVER) Sleep((DWORD) ms); #else - _nc_timed_wait(0, 0, ms, (int *) 0 EVENTLIST_2nd(0)); + _nc_timed_wait(NULL, 0, ms, (int *) 0 EVENTLIST_2nd(NULL)); #endif return OK; } @@ -1380,7 +1392,7 @@ unsigned ch = (unsigned) c; if (flag) { while ((s = _nc_expand_try(sp->_key_ok, - ch, &count, (size_t) 0)) != 0) { + ch, &count, (size_t) 0)) != NULL) { if (_nc_remove_key(&(sp->_key_ok), ch)) { code = _nc_add_to_try(&(sp->_keytry), s, ch); free(s); @@ -1393,7 +1405,7 @@ } } else { while ((s = _nc_expand_try(sp->_keytry, - ch, &count, (size_t) 0)) != 0) { + ch, &count, (size_t) 0)) != NULL) { if (_nc_remove_key(&(sp->_keytry), ch)) { code = _nc_add_to_try(&(sp->_key_ok), s, ch); free(s); @@ -1420,7 +1432,7 @@ T((T_CALLED("tinfo:drv_cursorSet(%p,%d)"), (void *) SP_PARM, vis)); - if (SP_PARM != 0 && IsTermInfo(SP_PARM)) { + if (SP_PARM != NULL && IsTermInfo(SP_PARM)) { switch (vis) { case 2: code = NCURSES_PUTP2_FLUSH("cursor_visible", cursor_visible); @@ -1490,7 +1502,7 @@ drv_cursorSet /* cursorSet */ }; -#ifdef EXP_WIN32_DRIVER +#if USE_TERM_DRIVER /* * The terminfo driver is mandatory and must always be present. * So this is the natural place for the driver initialisation @@ -1504,7 +1516,7 @@ static DRIVER_ENTRY DriverTable[] = { -#ifdef _NC_WINDOWS +#ifdef USE_WIN32CON_DRIVER {"win32console", &_nc_WIN_DRIVER}, #endif {"tinfo", &_nc_TINFO_DRIVER} /* must be last */ @@ -1516,30 +1528,31 @@ int code = ERR; size_t i; TERM_DRIVER *res = (TERM_DRIVER *) 0; - TERM_DRIVER *use = 0; + TERM_DRIVER *use = NULL; T((T_CALLED("_nc_get_driver(%p, %s, %p)"), (void *) TCB, NonNull(name), (void *) errret)); - assert(TCB != 0); + assert(TCB != NULL); for (i = 0; i < SIZEOF(DriverTable); i++) { res = DriverTable[i].driver; -#ifdef _NC_WINDOWS +#if defined(USE_WIN32CON_DRIVER) if ((i + 1) == SIZEOF(DriverTable)) { /* For Windows >= 10.0.17763 Windows Console interface implements virtual Terminal functionality. If on Windows td_CanHandle returned FALSE although the terminal name is empty, we default to ms-terminal as tinfo TERM type. */ - if (name == 0 || *name == 0 || (strcmp(name, "unknown") == 0)) { - name = MS_TERMINAL; + if (name == NULL || *name == 0 || (strcmp(name, "unknown") == 0)) { + name = DEFAULT_TERM_ENV; T(("Set TERM=%s", name)); } } #endif if (strcmp(DriverTable[i].name, res->td_name(TCB)) == 0) { if (res->td_CanHandle(TCB, name, errret)) { + T(("matched driver %s with TERM=%s", DriverTable[i].name, name)); use = res; break; } @@ -1551,4 +1564,4 @@ } returnCode(code); } -#endif /* EXP_WIN32_DRIVER */ +#endif /* USE_TERM_DRIVER */ diff --git a/contrib/ncurses/ncurses/tinfo/trim_sgr0.c b/contrib/ncurses/ncurses/tinfo/trim_sgr0.c --- a/contrib/ncurses/ncurses/tinfo/trim_sgr0.c +++ b/contrib/ncurses/ncurses/tinfo/trim_sgr0.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2021,2023 Thomas E. Dickey * + * Copyright 2020-2023,2024 Thomas E. Dickey * * Copyright 2005-2012,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -37,22 +37,91 @@ #include -MODULE_ID("$Id: trim_sgr0.c,v 1.22 2023/09/23 18:47:56 tom Exp $") +MODULE_ID("$Id: trim_sgr0.c,v 1.27 2024/12/21 20:15:26 tom Exp $") #undef CUR #define CUR tp-> +/* + * Skip a padding token, e.g., "<5>", "<5.1>", "<5/>", "<5*>", or "<5/>". + * If the pattern does not match, return null. + */ static char * -set_attribute_9(TERMTYPE2 *tp, int flag) +skip_padding(char *value) +{ + char *result = NULL; + if (*value++ == '$' && *value++ == '<') { + int ch; + int state = 0; /* 1=integer, 2=decimal, 3=fraction */ + while ((ch = UChar(*value++)) != '\0') { + if (ch == '*' || ch == '/') { + if (!state) + break; + } else if (ch == '>') { + if (state) + result = value; + break; + } else if (ch == '.') { + if (state < 2) { + state = 2; + } else { + break; /* a single decimal point is allowed */ + } + } else if (isdigit(ch)) { + if (state < 2) { + state = 1; + } else if (state == 2) { + state = 3; + } else { + break; /* only a single digit after decimal point */ + } + } else { + break; + } + } + } + return result; +} + +static void +strip_padding(char *value) +{ + char *s = value; + char ch; + + while ((ch = *s) != '\0') { + if (ch == '\\') { + if (*++s == '\0') + break; + ++s; + } else { + char *d = NULL; + if (ch == '$') + d = skip_padding(s); + if (d != NULL) { + char *t = s; + while ((*t++ = *d++) != '\0') ; + } else { + ++s; + } + } + } +} + +static char * +set_attribute_9(const 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)) + if (PRESENT(value)) { result = strdup(value); - else - result = 0; + if (result != NULL) + strip_padding(result); + } else { + result = NULL; + } return result; } @@ -60,7 +129,7 @@ is_csi(const char *s) { int result = 0; - if (s != 0) { + if (s != NULL) { if (UChar(s[0]) == CSI_CHR) result = 1; else if (s[0] == ESC_CHR && s[1] == L_BLOCK) @@ -99,9 +168,9 @@ * to the end of the s-string. */ static bool -rewrite_sgr(char *s, char *attr) +rewrite_sgr(char *s, const char *attr) { - if (s != 0) { + if (s != NULL) { if (PRESENT(attr)) { size_t len_s = strlen(s); size_t len_a = strlen(attr); @@ -125,7 +194,7 @@ similar_sgr(char *a, char *b) { bool result = FALSE; - if (a != 0 && b != 0) { + if (a != NULL && b != NULL) { int csi_a = is_csi(a); int csi_b = is_csi(b); size_t len_a; @@ -237,12 +306,10 @@ 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))); @@ -255,12 +322,17 @@ FreeIfNeeded(off); } else if (similar_sgr(off, end) && !similar_sgr(off, on)) { + bool found = FALSE; + size_t i, j; + 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)) { + size_t k; + TR(TRACE_DATABASE, ("scan for rmacs %s", _nc_visbuf(exit_alt_charset_mode))); j = strlen(off); k = strlen(exit_alt_charset_mode); @@ -297,7 +369,7 @@ } } if (!found - && (tmp = strstr(end, off)) != 0 + && (tmp = strstr(end, off)) != NULL && strcmp(end, off) != 0) { i = (size_t) (tmp - end); j = strlen(off); diff --git a/contrib/ncurses/ncurses/tinfo/write_entry.c b/contrib/ncurses/ncurses/tinfo/write_entry.c --- a/contrib/ncurses/ncurses/tinfo/write_entry.c +++ b/contrib/ncurses/ncurses/tinfo/write_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2023,2024 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -42,7 +42,7 @@ #include -MODULE_ID("$Id: write_entry.c,v 1.132 2024/04/20 17:58:51 tom Exp $") +MODULE_ID("$Id: write_entry.c,v 1.144 2025/12/28 00:33:30 tom Exp $") #if 1 #define TRACE_OUT(p) DEBUG(2, p) @@ -71,7 +71,7 @@ #if !USE_HASHED_DB static void -write_file(char *filename, TERMTYPE2 *tp) +write_file(const char *filename, TERMTYPE2 *tp) { char buffer[MAX_ENTRY_SIZE]; unsigned limit = sizeof(buffer); @@ -82,21 +82,25 @@ } else { FILE *fp = ((_nc_access(filename, W_OK) == 0) ? safe_fopen(filename, BIN_W) - : 0); + : NULL); size_t actual; - if (fp == 0) { - perror(filename); - _nc_syserr_abort("cannot open %s/%s", _nc_tic_dir(0), filename); + if (fp == NULL) { + _nc_syserr_abort("cannot open %s/%s: (errno %d) %s", + _nc_tic_dir(NULL), + filename, + errno, + strerror(errno)); } 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_syserr_abort("error writing %s/%s: (errno %d) %s", _nc_tic_dir(NULL), filename, + myerr, strerror(myerr)); } else { _nc_syserr_abort("error writing %s/%s: %u bytes vs actual %lu", @@ -125,15 +129,19 @@ static const char dirnames[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; static bool verified[sizeof(dirnames)]; - char dir[sizeof(LEAF_FMT)]; - char *s = 0; + const char *s = NULL; - if (code == 0 || (s = (strchr) (dirnames, code)) == 0) { - _nc_err_abort("Illegal terminfo subdirectory \"" LEAF_FMT "\"", code); + if (code == 0 || (s = (strchr) (dirnames, code)) == NULL) { + _nc_err_abort("Illegal terminfo subdirectory \"" LEAF_FMT "\"", UChar(code)); } else if (!verified[s - dirnames]) { - _nc_SPRINTF(dir, _nc_SLIMIT(sizeof(dir)) LEAF_FMT, code); + char dir[sizeof(LEAF_FMT)]; + _nc_SPRINTF(dir, _nc_SLIMIT(sizeof(dir)) LEAF_FMT, UChar(code)); if (make_db_root(dir) < 0) { - _nc_err_abort("%s/%s: permission denied", _nc_tic_dir(NULL), dir); + _nc_err_abort("%s/%s: (errno %d) %s", + _nc_tic_dir(NULL), + dir, + errno, + strerror(errno)); } else { verified[s - dirnames] = TRUE; } @@ -153,8 +161,12 @@ rc = 0; } } else { - if ((strlen(top) + strlen(src) + 6) <= limit) { - _nc_SPRINTF(dst, _nc_SLIMIT(limit) "%s/%s", top, src); + size_t len_top = strlen(top); + size_t len_src = strlen(src); + if ((len_top + len_src + 6) <= limit) { + _nc_SPRINTF(dst, _nc_SLIMIT(limit) "%.*s/%.*s", + (int) len_top, top, + (int) len_src, src); rc = 0; } } @@ -186,6 +198,7 @@ int rc; char fullpath[PATH_MAX]; + FixupPathname(path); if ((rc = make_db_path(fullpath, path, sizeof(fullpath))) == 0) { #if USE_HASHED_DB DB *capdbp; @@ -198,15 +211,17 @@ #else struct stat statbuf; - if ((rc = stat(path, &statbuf)) == -1) { + rc = 0; + if (!_nc_is_path_found(path, &statbuf)) { rc = mkdir(path -#ifndef _NC_WINDOWS +#ifndef _NC_WINDOWS_NATIVE ,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))) { + errno = ENOTDIR; rc = -1; /* not a directory */ } #endif @@ -244,8 +259,10 @@ } } if (!success) { - _nc_err_abort("%s: permission denied (errno %d)", - destination, errno); + _nc_err_abort("%s: (errno %d) %s", + destination, + errno, + strerror(errno)); } } @@ -256,6 +273,7 @@ #if USE_HASHED_DB make_db_path(actual, destination, sizeof(actual)); #else + FixupPathname2(destination, actual); if (chdir(_nc_tic_dir(destination)) < 0 || getcwd(actual, sizeof(actual)) == NULL) _nc_err_abort("%s: not a directory", destination); @@ -431,7 +449,7 @@ * so warn the user. */ if (start_time > 0 && - stat(filename, &statbuf) >= 0 + _nc_is_path_found(filename, &statbuf) && statbuf.st_mtime >= start_time) { #if HAVE_LINK && !USE_SYMLINKS /* @@ -455,7 +473,7 @@ write_file(filename, tp); if (start_time == 0) { - if (stat(filename, &statbuf) == -1 + if (!_nc_is_path_found(filename, &statbuf) || (start_time = statbuf.st_mtime) == 0) { _nc_syserr_abort("error obtaining time from %s/%s", _nc_tic_dir(NULL), filename); @@ -480,14 +498,14 @@ check_writeable(ptr[0]); _nc_SPRINTF(linkname, _nc_SLIMIT(sizeof(linkname)) - LEAF_FMT "/%.*s", ptr[0], + LEAF_FMT "/%.*s", UChar(ptr[0]), (int) sizeof(linkname) - (2 + LEAF_LEN), ptr); if (strcmp(filename, linkname) == 0) { _nc_warning("self-synonym ignored"); } #if !LINK_TOUCHES - else if (stat(linkname, &statbuf) >= 0 && + else if (_nc_is_path_found(linkname, &statbuf) && statbuf.st_mtime < start_time) { _nc_warning("alias %s multiply defined.", ptr); } @@ -552,7 +570,7 @@ fake_write(char *dst, unsigned *offset, size_t limit, - char *src, + const char *src, size_t want, size_t size) { @@ -658,7 +676,7 @@ #if NCURSES_XNAMES static unsigned -extended_Booleans(TERMTYPE2 *tp) +extended_Booleans(const TERMTYPE2 *tp) { unsigned result = 0; unsigned i; @@ -671,7 +689,7 @@ } static unsigned -extended_Numbers(TERMTYPE2 *tp) +extended_Numbers(const TERMTYPE2 *tp) { unsigned result = 0; unsigned i; @@ -684,7 +702,7 @@ } static unsigned -extended_Strings(TERMTYPE2 *tp) +extended_Strings(const TERMTYPE2 *tp) { unsigned short result = 0; unsigned short i; @@ -701,7 +719,7 @@ * clause - discard the unneeded data. */ static bool -extended_object(TERMTYPE2 *tp) +extended_object(const TERMTYPE2 *tp) { bool result = FALSE; diff --git a/contrib/ncurses/ncurses/trace/lib_trace.c b/contrib/ncurses/ncurses/trace/lib_trace.c --- a/contrib/ncurses/ncurses/trace/lib_trace.c +++ b/contrib/ncurses/ncurses/trace/lib_trace.c @@ -48,7 +48,7 @@ #include -MODULE_ID("$Id: lib_trace.c,v 1.106 2024/02/24 18:28:19 tom Exp $") +MODULE_ID("$Id: lib_trace.c,v 1.109 2024/12/07 21:02:00 tom Exp $") NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */ @@ -135,7 +135,7 @@ Locked(result = _nc_tracing); - if ((MyFP == 0) && tracelevel) { + if ((MyFP == NULL) && tracelevel) { MyInit = TRUE; if (MyFD >= 0) { MyFP = fdopen(MyFD, BIN_W); @@ -149,7 +149,7 @@ #define SAFE_MODE (O_CREAT | O_EXCL | O_RDWR) if (_nc_access(myFile, W_OK) < 0 || (MyFD = safe_open3(myFile, SAFE_MODE, 0600)) < 0 - || (MyFP = fdopen(MyFD, BIN_W)) == 0) { + || (MyFP = fdopen(MyFD, BIN_W)) == NULL) { ; /* EMPTY */ } } @@ -158,7 +158,7 @@ * 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 (MyFP != NULL) { #if HAVE_SETVBUF /* ANSI */ (void) setvbuf(MyFP, (char *) 0, _IOLBF, (size_t) 0); #elif HAVE_SETBUF /* POSIX */ @@ -188,10 +188,10 @@ _tracef("- DEBUG_LEVEL(%u)", tracelevel >> TRACE_SHIFT); } } else if (tracelevel == 0) { - if (MyFP != 0) { + if (MyFP != NULL) { MyFD = dup(MyFD); /* allow reopen of same file */ fclose(MyFP); - MyFP = 0; + MyFP = NULL; } Locked(_nc_tracing = tracelevel); } else if (_nc_tracing != tracelevel) { @@ -226,7 +226,7 @@ #ifdef TRACE /* verbose-trace in the command-line utilities relies on this */ - if (fp == 0 && !MyInit && _nc_tracing >= DEBUG_LEVEL(1)) + if (fp == NULL && !MyInit && _nc_tracing >= DEBUG_LEVEL(1)) fp = stderr; #endif @@ -246,7 +246,7 @@ } } - if (doit != 0 && fp != 0) { + if (doit != 0 && fp != NULL) { #ifdef USE_PTHREADS /* * TRACE_ICALLS is "really" needed to show normal use with threaded @@ -261,7 +261,7 @@ if ((pthread_self)) # endif fprintf(fp, "%#" PRIxPTR ":", -#ifdef _NC_WINDOWS +#ifdef _NC_WINDOWS_NATIVE CASTxPTR(pthread_self().p) #else CASTxPTR(pthread_self()) @@ -295,8 +295,8 @@ } /* Trace 'bool' return-values */ -NCURSES_EXPORT(NCURSES_BOOL) -_nc_retrace_bool(int code) +NCURSES_EXPORT(bool) +_nc_retrace_bool(bool code) { T((T_RETURN("%s"), code ? "TRUE" : "FALSE")); return code; diff --git a/contrib/ncurses/ncurses/trace/lib_traceatr.c b/contrib/ncurses/ncurses/trace/lib_traceatr.c --- a/contrib/ncurses/ncurses/trace/lib_traceatr.c +++ b/contrib/ncurses/ncurses/trace/lib_traceatr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2024 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2017,2018 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -44,7 +44,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_traceatr.c,v 1.96 2024/02/04 00:11:35 tom Exp $") +MODULE_ID("$Id: lib_traceatr.c,v 1.101 2025/11/16 16:08:54 tom Exp $") #define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name)) @@ -126,7 +126,7 @@ #undef DATA char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ); - if (result != 0) { + if (result != NULL) { size_t n; unsigned save_nc_tracing = _nc_tracing; @@ -167,7 +167,7 @@ } } if (ChAttrOf(newmode) == A_NORMAL) { - if (result != 0 && result[1] != '\0') + if (result != NULL && result[1] != '\0') (void) _nc_trace_bufcat(bufnum, "|"); (void) _nc_trace_bufcat(bufnum, "A_NORMAL"); } @@ -248,14 +248,14 @@ }; #undef DATA - const char *result = 0; + const char *result = NULL; #if NCURSES_SP_FUNCS (void) sp; #endif - if (SP_PARM != 0 && (attr & A_ALTCHARSET) && (acs_chars != 0)) { + if (SP_PARM != NULL && (attr & A_ALTCHARSET) && (acs_chars != NULL)) { char *cp; - char *found = 0; + const char *found = NULL; for (cp = acs_chars; cp[0] && cp[1]; cp += 2) { if (ChCharOf(UChar(cp[1])) == ChCharOf(ch)) { @@ -264,7 +264,7 @@ } } - if (found != 0) { + if (found != NULL) { size_t n; ch = ChCharOf(UChar(*found)); @@ -284,12 +284,12 @@ { char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ); - if (result != 0) { + if (result != NULL) { 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) { + if ((found = _nc_altcharset_name(attr, ch)) != NULL) { (void) _nc_trace_bufcat(bufnum, found); attr &= ~A_ALTCHARSET; } else @@ -328,13 +328,13 @@ { char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ); - if (result != 0) { + if (result != NULL) { _nc_STRCPY(result, l_brace, TRACE_BUF_SIZE(bufnum)); - if (ch != 0) { + if (ch != NULL) { const char *found; attr_t attr = AttrOfD(ch); - if ((found = _nc_altcharset_name(attr, (chtype) CharOfD(ch))) != 0) { + if ((found = _nc_altcharset_name(attr, (chtype) CharOfD(ch))) != NULL) { (void) _nc_trace_bufcat(bufnum, found); attr &= ~A_ALTCHARSET; } else if (isWidecExt(CHDEREF(ch))) { @@ -363,7 +363,7 @@ UChar(ch->chars[PUTC_i]))); } break; - } else if (ch->chars[PUTC_i] > assume_unicode) { + } else if ((int) ch->chars[PUTC_i] > assume_unicode) { char temp[80]; _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "{%d:\\u%04lx}", @@ -371,7 +371,7 @@ (unsigned long) ch->chars[PUTC_i]); (void) _nc_trace_bufcat(bufnum, temp); attr &= ~A_CHARTEXT; /* ignore WidecExt(ch) */ - } else { + } else if (PUTC_n > 1 || !is8bits(ch->chars[PUTC_i])) { for (n = 0; n < PUTC_n; n++) { if (n) (void) _nc_trace_bufcat(bufnum, ", "); @@ -379,6 +379,11 @@ _nc_tracechar(CURRENT_SCREEN, UChar(PUTC_buf[n]))); } + } else { + char temp[2]; + temp[0] = (char) ch->chars[PUTC_i]; + temp[1] = 0; + (void) _nc_trace_bufcat(bufnum, temp); } } (void) _nc_trace_bufcat(bufnum, " }"); diff --git a/contrib/ncurses/ncurses/trace/lib_tracebits.c b/contrib/ncurses/ncurses/trace/lib_tracebits.c --- a/contrib/ncurses/ncurses/trace/lib_tracebits.c +++ b/contrib/ncurses/ncurses/trace/lib_tracebits.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 2019-2024,2025 Thomas E. Dickey * * Copyright 1998-2012,2015 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -35,16 +35,12 @@ #include -MODULE_ID("$Id: lib_tracebits.c,v 1.31 2020/11/14 23:38:11 tom Exp $") +MODULE_ID("$Id: lib_tracebits.c,v 1.37 2025/12/23 09:23:38 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 @@ -72,21 +68,21 @@ #ifdef TRACE -#if defined(EXP_WIN32_DRIVER) +#if defined(USE_WIN32CON_DRIVER) #define BITNAMELEN 36 #else #define BITNAMELEN 8 #endif typedef struct { - unsigned int val; + unsigned long 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) +lookup_bits(char *buf, const BITNAMES * table, const char *label, unsigned long val) { const BITNAMES *sp; @@ -172,7 +168,7 @@ 8 + sizeof(cflags) + 8 + sizeof(lflags) + 8); - if (buf != 0) { + if (buf != NULL) { if (tty->c_iflag & ALLIN) lookup_bits(buf, iflags, "iflags", tty->c_iflag); @@ -218,7 +214,7 @@ if (tty->c_lflag & ALLLOCAL) lookup_bits(buf, lflags, "lflags", tty->c_lflag); } -#elif defined(EXP_WIN32_DRIVER) +#elif defined(USE_WIN32CON_DRIVER) #define DATA(name) { name, { #name } } static const BITNAMES dwFlagsOut[] = { @@ -244,7 +240,7 @@ buf = _nc_trace_buf(0, 8 + sizeof(dwFlagsOut) + 8 + sizeof(dwFlagsIn)); - if (buf != 0) { + if (buf != NULL) { lookup_bits(buf, dwFlagsIn, "dwIn", tty->dwFlagIn); lookup_bits(buf, dwFlagsOut, "dwOut", tty->dwFlagOut); } @@ -284,7 +280,7 @@ buf = _nc_trace_buf(0, 8 + sizeof(cflags)); - if (buf != 0) { + if (buf != NULL) { if (tty->sg_flags & ALLCTRL) { lookup_bits(buf, cflags, "cflags", tty->sg_flags); } diff --git a/contrib/ncurses/ncurses/trace/lib_tracechr.c b/contrib/ncurses/ncurses/trace/lib_tracechr.c --- a/contrib/ncurses/ncurses/trace/lib_tracechr.c +++ b/contrib/ncurses/ncurses/trace/lib_tracechr.c @@ -40,7 +40,7 @@ #include -MODULE_ID("$Id: lib_tracechr.c,v 1.24 2024/02/04 00:11:35 tom Exp $") +MODULE_ID("$Id: lib_tracechr.c,v 1.26 2024/12/07 21:02:00 tom Exp $") #ifdef TRACE @@ -50,16 +50,16 @@ _nc_tracechar(SCREEN *sp, int ch) { NCURSES_CONST char *name; - char *MyBuffer = ((sp != 0) + char *MyBuffer = ((sp != NULL) ? sp->tracechr_buf : _nc_globals.tracechr_buf); if ((ch > KEY_MIN && !_nc_unicode_locale()) || ch < 0) { name = safe_keyname(SP_PARM, ch); - if (name == 0 || *name == '\0') + if (name == NULL || *name == '\0') name = "NULL"; _nc_SPRINTF(MyBuffer, _nc_SLIMIT(MyBufSize) - "'%.30s' = \\x%02x", name, ch); + "'%.30s' = \\x%02x", name, UChar(ch)); } else if (!is8bits(ch) || (_nc_unicode_locale() && !is7bits(ch)) || !isprint(UChar(ch))) { @@ -72,7 +72,7 @@ "\\x%02x", ch); } else { name = safe_unctrl(SP_PARM, (chtype) ch); - if (name == 0 || *name == 0) + if (name == NULL || *name == 0) name = "null"; /* shouldn't happen */ _nc_SPRINTF(MyBuffer, _nc_SLIMIT(MyBufSize) "'%.30s' = \\x%02x", name, ch); diff --git a/contrib/ncurses/ncurses/trace/lib_tracedmp.c b/contrib/ncurses/ncurses/trace/lib_tracedmp.c --- a/contrib/ncurses/ncurses/trace/lib_tracedmp.c +++ b/contrib/ncurses/ncurses/trace/lib_tracedmp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2023 Thomas E. Dickey * + * Copyright 2020-2023,2024 Thomas E. Dickey * * Copyright 1998-2012,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,7 +40,7 @@ #include #include -MODULE_ID("$Id: lib_tracedmp.c,v 1.37 2023/06/24 15:49:45 tom Exp $") +MODULE_ID("$Id: lib_tracedmp.c,v 1.38 2024/12/07 20:06:49 tom Exp $") #ifdef TRACE @@ -72,7 +72,7 @@ my_length = (unsigned) (2 * (width + 1)); my_buffer = typeRealloc(char, my_length, my_buffer); } - if (my_buffer == 0) + if (my_buffer == NULL) return; for (n = 0; n <= win->_maxy; ++n) { @@ -177,7 +177,7 @@ } #if NO_LEAKS free(my_buffer); - my_buffer = 0; + my_buffer = NULL; my_length = 0; #endif } diff --git a/contrib/ncurses/ncurses/trace/lib_tracemse.c b/contrib/ncurses/ncurses/trace/lib_tracemse.c --- a/contrib/ncurses/ncurses/trace/lib_tracemse.c +++ b/contrib/ncurses/ncurses/trace/lib_tracemse.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2012,2014 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -39,7 +39,7 @@ #include -MODULE_ID("$Id: lib_tracemse.c,v 1.23 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_tracemse.c,v 1.24 2024/12/07 20:06:49 tom Exp $") #ifdef TRACE @@ -117,9 +117,9 @@ NCURSES_EXPORT(char *) _nc_tracemouse(SCREEN *sp, MEVENT const *ep) { - char *result = 0; + char *result = NULL; - if (sp != 0) { + if (sp != NULL) { _nc_SPRINTF(my_buffer, _nc_SLIMIT(sizeof(my_buffer)) TRACEMSE_FMT, ep->id, @@ -138,7 +138,7 @@ NCURSES_EXPORT(mmask_t) _nc_retrace_mmask_t(SCREEN *sp, mmask_t code) { - if (sp != 0) { + if (sp != NULL) { *my_buffer = '\0'; T((T_RETURN("{%s}"), _nc_trace_mmask_t(sp, code))); } else { diff --git a/contrib/ncurses/ncurses/trace/trace_buf.c b/contrib/ncurses/ncurses/trace/trace_buf.c --- a/contrib/ncurses/ncurses/trace/trace_buf.c +++ b/contrib/ncurses/ncurses/trace/trace_buf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2023 Thomas E. Dickey * + * Copyright 2020-2023,2024 Thomas E. Dickey * * Copyright 1998-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -36,7 +36,7 @@ #include -MODULE_ID("$Id: trace_buf.c,v 1.22 2023/06/24 13:37:25 tom Exp $") +MODULE_ID("$Id: trace_buf.c,v 1.23 2024/12/07 21:24:18 tom Exp $") #ifdef TRACE @@ -46,22 +46,22 @@ static char * _nc_trace_alloc(int bufnum, size_t want) { - char *result = 0; + char *result = NULL; if (bufnum >= 0) { if ((size_t) (bufnum + 1) > MySize) { size_t need = (size_t) (bufnum + 1) * 2; - if ((MyList = typeRealloc(TRACEBUF, need, MyList)) != 0) { + if ((MyList = typeRealloc(TRACEBUF, need, MyList)) != NULL) { while (need > MySize) - MyList[MySize++].text = 0; + MyList[MySize++].text = NULL; } } - if (MyList != 0) { - if (MyList[bufnum].text == 0 + if (MyList != NULL) { + if (MyList[bufnum].text == NULL || want > MyList[bufnum].size) { MyList[bufnum].text = typeRealloc(char, want, MyList[bufnum].text); - if (MyList[bufnum].text != 0) + if (MyList[bufnum].text != NULL) MyList[bufnum].size = want; } result = MyList[bufnum].text; @@ -72,12 +72,12 @@ if (MySize) { if (MyList) { while (MySize--) { - if (MyList[MySize].text != 0) { + if (MyList[MySize].text != NULL) { free(MyList[MySize].text); } } free(MyList); - MyList = 0; + MyList = NULL; } MySize = 0; } @@ -93,7 +93,7 @@ _nc_trace_buf(int bufnum, size_t want) { char *result = _nc_trace_alloc(bufnum, want); - if (result != 0) + if (result != NULL) *result = '\0'; return result; } @@ -109,12 +109,12 @@ if (value == NULL) value = ""; buffer = _nc_trace_alloc(bufnum, (size_t) 0); - if (buffer != 0) { + if (buffer != NULL) { size_t have = strlen(buffer); size_t need = strlen(value) + have; buffer = _nc_trace_alloc(bufnum, 1 + need); - if (buffer != 0) + if (buffer != NULL) _nc_STRCPY(buffer + have, value, need); } diff --git a/contrib/ncurses/ncurses/trace/trace_tries.c b/contrib/ncurses/ncurses/trace/trace_tries.c --- a/contrib/ncurses/ncurses/trace/trace_tries.c +++ b/contrib/ncurses/ncurses/trace/trace_tries.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1999-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -36,7 +36,7 @@ #include -MODULE_ID("$Id: trace_tries.c,v 1.18 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: trace_tries.c,v 1.19 2024/12/07 21:24:18 tom Exp $") #ifdef TRACE #define my_buffer _nc_globals.tracetry_buf @@ -50,8 +50,8 @@ my_buffer = (unsigned char *) _nc_doalloc(my_buffer, my_length); } - if (my_buffer != 0) { - while (tree != 0) { + if (my_buffer != NULL) { + while (tree != NULL) { if ((my_buffer[level] = tree->ch) == 0) my_buffer[level] = 128; my_buffer[level + 1] = 0; @@ -69,7 +69,7 @@ NCURSES_EXPORT(void) _nc_trace_tries(TRIES * tree) { - if ((my_buffer = typeMalloc(unsigned char, my_length = 80)) != 0) { + if ((my_buffer = typeMalloc(unsigned char, my_length = 80)) != NULL) { _tracef("BEGIN tries %p", (void *) tree); recur_tries(tree, 0); _tracef(". . . tries %p", (void *) tree); diff --git a/contrib/ncurses/ncurses/trace/varargs.c b/contrib/ncurses/ncurses/trace/varargs.c --- a/contrib/ncurses/ncurses/trace/varargs.c +++ b/contrib/ncurses/ncurses/trace/varargs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2023 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 2001-2008,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -35,7 +35,7 @@ #include -MODULE_ID("$Id: varargs.c,v 1.13 2023/06/24 13:41:46 tom Exp $") +MODULE_ID("$Id: varargs.c,v 1.16 2025/02/15 15:22:14 tom Exp $") #ifdef TRACE @@ -60,35 +60,35 @@ _nc_varargs(const char *fmt, va_list ap) { char buffer[BUFSIZ]; - const char *param; + const char *value; int n; - if (fmt == 0 || *fmt == '\0') + if (fmt == NULL || *fmt == '\0') return NULL; if (MyLength == 0) MyBuffer = typeMalloc(char, MyLength = BUFSIZ); - if (MyBuffer == 0) + if (MyBuffer == NULL) return NULL; *MyBuffer = '\0'; while (*fmt != '\0') { if (*fmt == '%') { - char *pval = 0; /* avoid const-cast */ + const char *pval = NULL; /* 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 param[MAX_PARMS]; + int params = 0; ARGTYPE used = atUnknown; while (*++fmt != '\0' && !done) { if (*fmt == '*') { VA_INT(int); - if (parms < MAX_PARMS) - parm[parms++] = atInteger; + if (params < MAX_PARMS) + param[params++] = atInteger; } else if (isalpha(UChar(*fmt))) { done = TRUE; switch (*fmt) { @@ -141,11 +141,11 @@ } 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; + if (used != atUnknown && params < MAX_PARMS) { + param[params++] = used; + for (n = 0; n < params; ++n) { + used = param[n]; + value = buffer; switch (used) { case atInteger: _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) @@ -160,19 +160,19 @@ "%p", pval); break; case atString: - param = _nc_visbuf2(1, sval); + value = _nc_visbuf2(1, sval); break; case atUnknown: default: _nc_STRCPY(buffer, "?", sizeof(buffer)); break; } - MyLength += strlen(param) + 2; + MyLength += strlen(value) + 2; MyBuffer = typeRealloc(char, MyLength, MyBuffer); - if (MyBuffer != 0) { + if (MyBuffer != NULL) { _nc_SPRINTF(MyBuffer + strlen(MyBuffer), _nc_SLIMIT(MyLength - strlen(MyBuffer)) - ", %s", param); + ", %s", value); } } } diff --git a/contrib/ncurses/ncurses/trace/visbuf.c b/contrib/ncurses/ncurses/trace/visbuf.c --- a/contrib/ncurses/ncurses/trace/visbuf.c +++ b/contrib/ncurses/ncurses/trace/visbuf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2021,2023 Thomas E. Dickey * + * Copyright 2019-2023,2024 Thomas E. Dickey * * Copyright 2001-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -43,7 +43,7 @@ #include #include -MODULE_ID("$Id: visbuf.c,v 1.54 2023/05/27 20:13:10 tom Exp $") +MODULE_ID("$Id: visbuf.c,v 1.56 2024/12/07 21:12:53 tom Exp $") #define NUM_VISBUFS 4 @@ -72,7 +72,7 @@ } else if (c == '"' || c == '\\') { *tp++ = '\\'; *tp++ = (char) c; - } else if (is7bits((int) c) && (isgraph((int) c) || c == ' ')) { + } else if (is7bits(UChar(c)) && (isgraph(UChar(c)) || c == ' ')) { *tp++ = (char) c; } else if (c == '\n') { *tp++ = '\\'; @@ -109,11 +109,11 @@ static const char * _nc_visbuf2n(int bufnum, const char *buf, int len) { - const char *vbuf = 0; + const char *vbuf = NULL; char *tp; int count; - if (buf == 0) + if (buf == NULL) return ("(null)"); if (buf == CANCELLED_STRING) return ("(cancelled)"); @@ -140,7 +140,7 @@ } } #endif - if (tp != 0) { + if (tp != NULL) { int c; *tp++ = D_QUOTE; @@ -196,7 +196,7 @@ char *tp; int count; - if (buf == 0) + if (buf == NULL) return ("(null)"); if (len < 0) @@ -212,7 +212,7 @@ vbuf = tp = mybuf[bufnum]; } #endif - if (tp != 0) { + if (tp != NULL) { wchar_t c; *tp++ = D_QUOTE; @@ -267,12 +267,12 @@ } if (mylen < ++n) { mylen = n + 80; - if (mybuf != 0) + if (mybuf != NULL) mybuf = typeRealloc(wchar_t, mylen, mybuf); else mybuf = typeMalloc(wchar_t, mylen); } - if (mybuf != 0) { + if (mybuf != NULL) { for (n = 0; buf[n] != 0; ++n) { mybuf[n] = (wchar_t) buf[n]; } @@ -289,7 +289,7 @@ { char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ); - if (result != 0) { + if (result != NULL) { int first = 0; #if USE_WIDEC_SUPPORT @@ -317,7 +317,7 @@ for (j = first; j <= last; ++j) { const char *found = _nc_altcharset_name(attr, (chtype) CharOf(buf[j])); - if (found != 0) { + if (found != NULL) { (void) _nc_trace_bufcat(bufnum, found); attr &= ~A_ALTCHARSET; } else diff --git a/contrib/ncurses/ncurses/tty/MKexpanded.sh b/contrib/ncurses/ncurses/tty/MKexpanded.sh --- a/contrib/ncurses/ncurses/tty/MKexpanded.sh +++ b/contrib/ncurses/ncurses/tty/MKexpanded.sh @@ -1,6 +1,6 @@ #! /bin/sh ############################################################################## -# Copyright 2019-2020,2021 Thomas E. Dickey # +# Copyright 2019-2021,2024 Thomas E. Dickey # # Copyright 1998-2015,2017 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -30,7 +30,7 @@ # # Author: Thomas E. Dickey, 1997-on # -# $Id: MKexpanded.sh,v 1.24 2022/02/05 17:27:18 tom Exp $ +# $Id: MKexpanded.sh,v 1.25 2024/12/07 20:48:46 tom Exp $ # # Script to generate 'expanded.c', a dummy source that contains functions # corresponding to complex macros used in this library. By making functions, @@ -127,7 +127,12 @@ EOF $preprocessor $TMP 2>/dev/null | \ - sed -e '1,/^IGNORE$/d' -e 's/^@/#/' -e 's/^#[ ]*if_/#if /' -e "s,$TMP,expanded.c," + sed -e '1,/^IGNORE$/d' \ + -e 's/^@/#/' \ + -e 's/^#[ ]*if_/#if /' \ + -e "s,$TMP,expanded.c," \ + -e 's/[ ][ ]*$//' \ + -e '/^#[ ]*[0-9]/d' cat < -MODULE_ID("$Id: hardscroll.c,v 1.58 2023/09/09 16:04:08 Nicholas.Marriott Exp $") +MODULE_ID("$Id: hardscroll.c,v 1.61 2025/02/15 15:12:54 tom Exp $") #if defined(SCROLLDEBUG) || defined(HASHDEBUG) @@ -169,7 +169,7 @@ 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 */ + _nc_oldnums = NULL; /* obsolete: keep for ABI compat */ # if USE_HASHMAP # define oldnums(sp) (sp)->_oldnum_list @@ -196,7 +196,7 @@ /* get enough storage */ assert(OLDNUM_SIZE(SP_PARM) >= 0); assert(screen_lines(SP_PARM) > 0); - if ((oldnums(SP_PARM) == 0) + if ((oldnums(SP_PARM) == NULL) || (OLDNUM_SIZE(SP_PARM) < screen_lines(SP_PARM))) { int need_lines = ((OLDNUM_SIZE(SP_PARM) < screen_lines(SP_PARM)) ? screen_lines(SP_PARM) @@ -308,11 +308,11 @@ /* dump the state of the real and virtual oldnum fields */ { if (USE_TRACEF(TRACE_UPDATE | TRACE_MOVE)) { - char *buf = 0; + char *buf = NULL; size_t want = ((size_t) screen_lines(SP_PARM) + 1) * 4; (void) SP_PARM; - if ((buf = typeMalloc(char, want)) != 0) { + if ((buf = typeMalloc(char, want)) != NULL) { int n; *buf = '\0'; @@ -371,7 +371,7 @@ do { oldnums[n++] = atoi(st); } while - ((st = strtok((char *) NULL, " ")) != 0); + ((st = strtok((char *) NULL, " ")) != NULL); /* display it */ (void) fputs("Initial input:\n", stderr); diff --git a/contrib/ncurses/ncurses/tty/hashmap.c b/contrib/ncurses/ncurses/tty/hashmap.c --- a/contrib/ncurses/ncurses/tty/hashmap.c +++ b/contrib/ncurses/ncurses/tty/hashmap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2020,2023 Thomas E. Dickey * + * Copyright 2019-2024,2025 Thomas E. Dickey * * Copyright 1998-2015,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -74,7 +74,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: hashmap.c,v 1.71 2023/09/16 16:28:53 tom Exp $") +MODULE_ID("$Id: hashmap.c,v 1.75 2025/07/26 19:48:34 tom Exp $") #ifdef HASHDEBUG @@ -120,15 +120,14 @@ static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT); static NCURSES_INLINE unsigned long -hash(SCREEN *sp, NCURSES_CH_T *text) +hash(SCREEN *sp, const 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++; + NCURSES_CH_T ch = *text++; result += (result << 5) + (unsigned long) HASH_VAL(ch); } return result; @@ -312,10 +311,10 @@ } } else { /* re-hash all */ - if (oldhash(SP_PARM) == 0) + if (oldhash(SP_PARM) == NULL) oldhash(SP_PARM) = typeCalloc(unsigned long, (size_t) screen_lines(SP_PARM)); - if (newhash(SP_PARM) == 0) + if (newhash(SP_PARM) == NULL) newhash(SP_PARM) = typeCalloc(unsigned long, (size_t) screen_lines(SP_PARM)); if (!oldhash(SP_PARM) || !newhash(SP_PARM)) { @@ -504,7 +503,8 @@ for (n = 0; n < screen_lines(sp); n++) { reallines[n] = n; oldnums[n] = _NEWINDEX; - CharOf(oldtext[n][0]) = CharOf(newtext[n][0]) = '.'; + SetChar(oldtext[n][0], '.', A_NORMAL); + SetChar(newtext[n][0], '.', A_NORMAL); } if (NC_ISATTY(fileno(stdin))) @@ -533,27 +533,27 @@ do { oldnums[n++] = atoi(st); } while - ((st = strtok((char *) NULL, " ")) != 0); + ((st = strtok((char *) NULL, " ")) != NULL); break; case 'n': /* use following letters as text of new lines */ for (n = 0; n < screen_lines(sp); n++) - CharOf(newtext[n][0]) = '.'; + SetChar(newtext[n][0], '.', A_NORMAL); for (n = 0; n < screen_lines(sp); n++) if (line[n + 1] == '\n') break; else - CharOf(newtext[n][0]) = line[n + 1]; + SetChar(newtext[n][0], line[n + 1], A_NORMAL); break; case 'o': /* use following letters as text of old lines */ for (n = 0; n < screen_lines(sp); n++) - CharOf(oldtext[n][0]) = '.'; + SetChar(oldtext[n][0], '.', A_NORMAL); for (n = 0; n < screen_lines(sp); n++) if (line[n + 1] == '\n') break; else - CharOf(oldtext[n][0]) = line[n + 1]; + SetChar(oldtext[n][0], line[n + 1], A_NORMAL); break; case 'd': /* dump state of test arrays */ diff --git a/contrib/ncurses/ncurses/tty/lib_mvcur.c b/contrib/ncurses/ncurses/tty/lib_mvcur.c --- a/contrib/ncurses/ncurses/tty/lib_mvcur.c +++ b/contrib/ncurses/ncurses/tty/lib_mvcur.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -160,7 +160,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_mvcur.c,v 1.161 2023/09/16 16:29:02 tom Exp $") +MODULE_ID("$Id: lib_mvcur.c,v 1.167 2025/12/27 12:34:03 tom Exp $") #define WANT_CHAR(sp, y, x) NewScreen(sp)->_line[y].text[x] /* desired state */ @@ -222,8 +222,8 @@ 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); + if (cap == NULL) + return (NC_INFINITY); else { const char *cp; float cum_cost = 0.0; @@ -287,7 +287,7 @@ /* 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) + if (cost != NC_INFINITY) cost = (cost + SP_PARM->_char_padding - 1) / SP_PARM->_char_padding; return cost; } @@ -364,14 +364,14 @@ 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 + if (getenv("NCURSES_NO_HARD_TABS") == NULL && 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; + SP_PARM->_ht_cost = NC_INFINITY; + SP_PARM->_cbt_cost = NC_INFINITY; } #endif /* USE_HARD_TABS */ SP_PARM->_cub1_cost = CostOf(cursor_left, 0); @@ -461,12 +461,12 @@ * 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) { + if (save_cursor != NULL + && enter_ca_mode != NULL + && strstr(enter_ca_mode, save_cursor) != NULL) { T(("...suppressed sc/rc capability due to conflict with smcup/rmcup")); - save_cursor = 0; - restore_cursor = 0; + save_cursor = NULL; + restore_cursor = NULL; } /* @@ -543,12 +543,12 @@ if (_nc_safe_strcat(target, src)) { total += num; } else { - total = INFINITY; + total = NC_INFINITY; break; } } } else { - total = INFINITY; + total = NC_INFINITY; } return total; } @@ -578,9 +578,9 @@ (void) _nc_str_copy(&save, target); if (to_y != from_y) { - vcost = INFINITY; + vcost = NC_INFINITY; - if (row_address != 0 + if (row_address != NULL && _nc_safe_strcat(target, TIPARM_1(row_address, to_y))) { vcost = SP_PARM->_vpa_cost; } @@ -617,8 +617,8 @@ } } - if (vcost == INFINITY) - return (INFINITY); + if (vcost == NC_INFINITY) + return (NC_INFINITY); } save = *target; @@ -627,7 +627,7 @@ char str[OPT_SIZE]; string_desc check; - hcost = INFINITY; + hcost = NC_INFINITY; if (column_address && _nc_safe_strcat(_nc_str_copy(target, &save), @@ -658,7 +658,7 @@ 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) + if (lhcost == NC_INFINITY) break; } @@ -751,7 +751,7 @@ lhcost = repeated_append(&check, lhcost, SP_PARM->_cbt_cost, 1, back_tab); - if (lhcost == INFINITY) + if (lhcost == NC_INFINITY) break; } @@ -770,8 +770,8 @@ } } - if (hcost == INFINITY) - return (INFINITY); + if (hcost == NC_INFINITY) + return (NC_INFINITY); } return (vcost + hcost); @@ -798,7 +798,7 @@ { string_desc result; char buffer[OPT_SIZE]; - int tactic = 0, newcost, usecost = INFINITY; + int tactic = 0, newcost, usecost = NC_INFINITY; int t5_cr_cost; #if defined(MAIN) || defined(NCURSES_TEST) @@ -846,7 +846,7 @@ && ((newcost = relative_move(NCURSES_SP_ARGx NullResult, yold, xold, - ynew, xnew, ovw)) != INFINITY) + ynew, xnew, ovw)) != NC_INFINITY) && newcost < usecost) { tactic = 1; usecost = newcost; @@ -857,7 +857,7 @@ && ((newcost = relative_move(NCURSES_SP_ARGx NullResult, yold, 0, - ynew, xnew, ovw)) != INFINITY) + ynew, xnew, ovw)) != NC_INFINITY) && SP_PARM->_cr_cost + newcost < usecost) { tactic = 2; usecost = SP_PARM->_cr_cost + newcost; @@ -868,7 +868,7 @@ && ((newcost = relative_move(NCURSES_SP_ARGx NullResult, 0, 0, - ynew, xnew, ovw)) != INFINITY) + ynew, xnew, ovw)) != NC_INFINITY) && SP_PARM->_home_cost + newcost < usecost) { tactic = 3; usecost = SP_PARM->_home_cost + newcost; @@ -879,7 +879,7 @@ && ((newcost = relative_move(NCURSES_SP_ARGx NullResult, screen_lines(SP_PARM) - 1, 0, - ynew, xnew, ovw)) != INFINITY) + ynew, xnew, ovw)) != NC_INFINITY) && SP_PARM->_ll_cost + newcost < usecost) { tactic = 4; usecost = SP_PARM->_ll_cost + newcost; @@ -895,7 +895,7 @@ && ((newcost = relative_move(NCURSES_SP_ARGx NullResult, yold - 1, screen_columns(SP_PARM) - 1, - ynew, xnew, ovw)) != INFINITY) + ynew, xnew, ovw)) != NC_INFINITY) && t5_cr_cost + SP_PARM->_cub1_cost + newcost < usecost) { tactic = 5; usecost = t5_cr_cost + SP_PARM->_cub1_cost + newcost; @@ -948,15 +948,15 @@ nonlocal: #if defined(MAIN) || defined(NCURSES_TEST) gettimeofday(&after, NULL); - diff = after.tv_usec - before.tv_usec - + (after.tv_sec - before.tv_sec) * 1000000; + diff = (float) (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) { + if (usecost != NC_INFINITY) { TR(TRACE_MOVE, ("mvcur tactic %d", tactic)); TPUTS_TRACE("mvcur"); NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx @@ -984,7 +984,7 @@ 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) { + if (SP_PARM == NULL) { code = ERR; } else if (yold == ynew && xold == xnew) { code = OK; @@ -1079,7 +1079,7 @@ * 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)) + if ((SP_PARM != NULL) && (SP_PARM->_endwin == ewInitial)) NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); return rc; } @@ -1093,7 +1093,7 @@ } #endif -#if defined(USE_TERM_DRIVER) +#if USE_TERM_DRIVER /* * The terminal driver does not support the external "mvcur()". */ @@ -1106,7 +1106,7 @@ ynew, xnew, NCURSES_SP_NAME(_nc_outch), TRUE); - if ((SP_PARM != 0) && (SP_PARM->_endwin == ewInitial)) + if ((SP_PARM != NULL) && (SP_PARM->_endwin == ewInitial)) NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); return rc; @@ -1227,7 +1227,7 @@ if (fputs("> ", stdout) == EOF) break; - if (fgets(buf, sizeof(buf), stdin) == 0) + if (fgets(buf, sizeof(buf), stdin) == NULL) break; #define PUTS(s) (void) puts(s) @@ -1307,7 +1307,7 @@ } 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); + dump_entry(&TerminalType(cur_term), FALSE, TRUE, 0, NULL); putchar('\n'); } else if (buf[0] == 'o') { if (_nc_optimize_enable & OPTIMIZE_MVCUR) { @@ -1338,7 +1338,7 @@ * is winning. */ else if (sscanf(buf, "t %d", &n) == 1) { - float cumtime = 0.0, perchar; + double cumtime = 0.0, perchar; int speeds[] = {2400, 9600, 14400, 19200, 28800, 38400, 0}; @@ -1384,14 +1384,14 @@ * transmission both. Transmission time is an estimate * assuming 9 bits/char, 8 bits + 1 stop bit. */ - float totalest = cumtime + xmits * 9 * 1e6 / speeds[i]; + double totalest = cumtime + (double) 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; + double overhead = speeds[i] * perchar / 1e6; (void) printf("%6d bps: %3.2f char-xmits overhead; total estimated time %15.2f\n", diff --git a/contrib/ncurses/ncurses/tty/lib_tstp.c b/contrib/ncurses/ncurses/tty/lib_tstp.c --- a/contrib/ncurses/ncurses/tty/lib_tstp.c +++ b/contrib/ncurses/ncurses/tty/lib_tstp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2021,2022 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2014,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -43,7 +43,7 @@ #include -MODULE_ID("$Id: lib_tstp.c,v 1.54 2022/12/24 22:22:10 tom Exp $") +MODULE_ID("$Id: lib_tstp.c,v 1.59 2025/02/15 14:52:13 tom Exp $") #if defined(SIGTSTP) && (HAVE_SIGACTION || HAVE_SIGVEC) #define USE_SIGTSTP 1 @@ -159,7 +159,7 @@ * * Don't do this if we're not in curses - */ - if (sp != 0 && (sp->_endwin == ewRunning)) + if (sp != NULL && (sp->_endwin == ewRunning)) #if HAVE_TCGETPGRP if (tcgetpgrp(STDIN_FILENO) == getpgrp()) #endif @@ -269,7 +269,7 @@ { SCREEN *scan; for (each_screen(scan)) { - if (scan->_ofp != 0 + if (scan->_ofp != NULL && NC_ISATTY(fileno(scan->_ofp))) { scan->_outch = NCURSES_SP_NAME(_nc_outch); } @@ -294,7 +294,7 @@ # endif _nc_globals.read_thread = pthread_self(); } else { - _nc_globals.read_thread = 0; + _nc_globals.read_thread = (pthread_t) 0; } _nc_unlock_global(curses); } @@ -310,7 +310,7 @@ 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; + _nc_globals.read_thread = (pthread_t) 0; } # endif } @@ -367,8 +367,8 @@ result = FALSE; } #endif - T(("CatchIfDefault - will %scatch %s", - result ? "" : "not ", signal_name(sig))); + T(("CatchIfDefault - will%s catch %s", + result ? "" : " not", signal_name(sig))); return result; } diff --git a/contrib/ncurses/ncurses/tty/lib_twait.c b/contrib/ncurses/ncurses/tty/lib_twait.c --- a/contrib/ncurses/ncurses/tty/lib_twait.c +++ b/contrib/ncurses/ncurses/tty/lib_twait.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2015,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -76,7 +76,7 @@ #endif #undef CUR -MODULE_ID("$Id: lib_twait.c,v 1.81 2023/09/16 16:30:40 tom Exp $") +MODULE_ID("$Id: lib_twait.c,v 1.85 2025/03/01 17:07:19 tom Exp $") /* * Returns an elapsed time, in milliseconds (if possible). @@ -120,7 +120,7 @@ { int event_delay = -1; - if (evl != 0) { + if (evl != NULL) { int n; for (n = 0; n < evl->count; ++n) { @@ -168,7 +168,7 @@ * descriptors. */ NCURSES_EXPORT(int) -_nc_timed_wait(SCREEN *sp MAYBE_UNUSED, +_nc_timed_wait(const SCREEN *sp MAYBE_UNUSED, int mode MAYBE_UNUSED, int milliseconds, int *timeleft @@ -242,7 +242,7 @@ if ((mode & TW_EVENT) && evl) { if (fds == fd_list) fds = typeMalloc(struct pollfd, MIN_FDS + evl->count); - if (fds == 0) + if (fds == NULL) return TW_NONE; } #endif @@ -273,7 +273,7 @@ } #endif - result = poll(fds, (size_t) count, milliseconds); + result = (int) poll(fds, (size_t) count, milliseconds); #ifdef NCURSES_WGETCH_EVENTS if ((mode & TW_EVENT) && evl) { diff --git a/contrib/ncurses/ncurses/tty/lib_vidattr.c b/contrib/ncurses/ncurses/tty/lib_vidattr.c --- a/contrib/ncurses/ncurses/tty/lib_vidattr.c +++ b/contrib/ncurses/ncurses/tty/lib_vidattr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2014,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -70,7 +70,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_vidattr.c,v 1.79 2023/04/28 20:59:26 tom Exp $") +MODULE_ID("$Id: lib_vidattr.c,v 1.81 2025/12/27 12:41:23 tom Exp $") #define doPut(mode) \ TPUTS_TRACE(#mode); \ @@ -114,9 +114,9 @@ attr_t turn_on, turn_off; int pair; bool reverse = FALSE; - bool can_color = (SP_PARM == 0 || SP_PARM->_coloron); + bool can_color = (SP_PARM == NULL || SP_PARM->_coloron); #if NCURSES_EXT_FUNCS - bool fix_pair0 = (SP_PARM != 0 && SP_PARM->_coloron && !SP_PARM->_default_color); + bool fix_pair0 = (SP_PARM != NULL && SP_PARM->_coloron && !SP_PARM->_default_color); #else #define fix_pair0 FALSE #endif @@ -134,7 +134,7 @@ TR(TRACE_ATTRS, ("previous attribute was %s", _traceattr(PreviousAttr))); - if ((SP_PARM != 0) + if ((SP_PARM != NULL) && (magic_cookie_glitch > 0)) { #if USE_XMC_SUPPORT static const chtype table[] = @@ -380,7 +380,7 @@ T((T_CALLED("termattrs(%p)"), (void *) SP_PARM)); if (HasTerminal(SP_PARM)) { -#ifdef USE_TERM_DRIVER +#if USE_TERM_DRIVER attrs = CallDriver(SP_PARM, td_conattr); #else /* ! USE_TERM_DRIVER */ diff --git a/contrib/ncurses/ncurses/tty/tty_update.c b/contrib/ncurses/ncurses/tty/tty_update.c --- a/contrib/ncurses/ncurses/tty/tty_update.c +++ b/contrib/ncurses/ncurses/tty/tty_update.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2023,2024 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -85,7 +85,13 @@ #include -MODULE_ID("$Id: tty_update.c,v 1.316 2024/02/04 00:09:34 tom Exp $") +#if USE_WIDEC_SUPPORT +#if HAVE_WCTYPE_H +#include +#endif +#endif + +MODULE_ID("$Id: tty_update.c,v 1.323 2025/12/27 12:34:03 tom Exp $") /* * This define controls the line-breakout optimization. Every once in a @@ -211,7 +217,7 @@ } #if !NCURSES_WCWIDTH_GRAPHICS -#define is_wacs_value(ch) (_nc_wacs_width(ch) == 1 && wcwidth(ch) > 1) +#define is_wacs_value(ch) (_nc_wacs_width((wchar_t) ch) == 1 && wcwidth(ch) > 1) #endif /* !NCURSES_WCWIDTH_GRAPHICS */ static NCURSES_INLINE void @@ -256,13 +262,15 @@ * not checked. */ if (is8bits(CharOf(CHDEREF(ch))) - && (!is7bits(CharOf(CHDEREF(ch))) && _nc_unicode_locale()) && (isprint(CharOf(CHDEREF(ch))) +#if USE_WIDEC_SUPPORT + || iswprint((wint_t) CharOf(CHDEREF(ch))) +#endif || (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 != NULL && SP_PARM->_acs_map[CharOfD(ch)] != 0) || (CharOfD(ch) >= 128))))) { ; @@ -275,7 +283,7 @@ #endif if ((AttrOf(attr) & A_ALTCHARSET) - && SP_PARM->_acs_map != 0 + && SP_PARM->_acs_map != NULL && ((CharOfD(ch) < ACS_LEN) #if !NCURSES_WCWIDTH_GRAPHICS || is_wacs_value(CharOfD(ch)) @@ -283,7 +291,7 @@ )) { int c8; my_ch = CHDEREF(ch); /* work around const param */ - c8 = CharOf(my_ch); + c8 = (int) CharOf(my_ch); #if USE_WIDEC_SUPPORT /* * This is crude & ugly, but works most of the time. It checks if the @@ -331,7 +339,7 @@ * drawing flavors are integrated. */ if (AttrOf(attr) & A_ALTCHARSET) { - int j = CharOfD(ch); + int j = (int) CharOfD(ch); chtype temp = UChar(SP_PARM->_acs_map[j]); if (temp != 0) { @@ -621,7 +629,7 @@ } else { return 1; /* cursor stays in the middle */ } - } else if (repeat_char != 0 && + } else if (repeat_char != NULL && #if BSD_TPUTS !isdigit(UChar(CharOf(ntext0))) && #endif @@ -643,7 +651,7 @@ UpdateAttrs(SP_PARM, ntext0); temp = ntext0; if ((AttrOf(temp) & A_ALTCHARSET) && - SP_PARM->_acs_map != 0 && + SP_PARM->_acs_map != NULL && (SP_PARM->_acs_map[CharOf(temp)] & A_CHARTEXT) != 0) { SetChar(temp, (SP_PARM->_acs_map[CharOf(ntext0)] & A_CHARTEXT), @@ -745,7 +753,7 @@ _nc_lock_global(update); - if (SP_PARM == 0) { + if (SP_PARM == NULL) { _nc_unlock_global(update); returnCode(ERR); } @@ -762,7 +770,7 @@ if (SP_PARM == CURRENT_SCREEN) { #endif #define SyncScreens(internal,exported) \ - if (internal == 0) internal = exported; \ + if (internal == NULL) internal = exported; \ if (internal != exported) exported = internal SyncScreens(CurScreen(SP_PARM), curscr); @@ -773,9 +781,9 @@ #endif #endif /* !USE_REENTRANT */ - if (CurScreen(SP_PARM) == 0 - || NewScreen(SP_PARM) == 0 - || StdScreen(SP_PARM) == 0) { + if (CurScreen(SP_PARM) == NULL + || NewScreen(SP_PARM) == NULL + || StdScreen(SP_PARM) == NULL) { _nc_unlock_global(update); returnCode(ERR); } @@ -1091,7 +1099,7 @@ returnCode(OK); } -#if NCURSES_SP_FUNCS && !defined(USE_TERM_DRIVER) +#if NCURSES_SP_FUNCS && !USE_TERM_DRIVER NCURSES_EXPORT(int) doupdate(void) { @@ -1132,7 +1140,7 @@ ClrUpdate(NCURSES_SP_DCL0) { TR(TRACE_UPDATE, (T_CALLED("ClrUpdate"))); - if (0 != SP_PARM) { + if (NULL != SP_PARM) { int i; NCURSES_CH_T blank = ClrBlank(NCURSES_SP_ARGx StdScreen(SP_PARM)); int nonempty = Min(screen_lines(SP_PARM), @@ -1159,7 +1167,7 @@ static void ClrToEOL(NCURSES_SP_DCLx NCURSES_CH_T blank, int needclear) { - if (CurScreen(SP_PARM) != 0 + if (CurScreen(SP_PARM) != NULL && SP_PARM->_cursrow >= 0) { int j; @@ -2223,7 +2231,7 @@ NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_screen_wrap) (NCURSES_SP_DCL0) { - if (SP_PARM != 0) { + if (SP_PARM != NULL) { UpdateAttrs(SP_PARM, normal); #if NCURSES_EXT_FUNCS @@ -2265,7 +2273,7 @@ NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_do_xmc_glitch) (NCURSES_SP_DCLx attr_t previous) { - if (SP_PARM != 0) { + if (SP_PARM != NULL) { attr_t chg = XMC_CHANGES(previous ^ AttrOf(SCREEN_ATTRS(SP_PARM))); while (chg != 0) { diff --git a/contrib/ncurses/ncurses/wcwidth.h b/contrib/ncurses/ncurses/wcwidth.h --- a/contrib/ncurses/ncurses/wcwidth.h +++ b/contrib/ncurses/ncurses/wcwidth.h @@ -1,4 +1,57 @@ +/* $Id: wcwidth.h,v 1.10 2025/10/31 23:10:59 tom Exp $ */ + /* + * Copyright 2002-2024,2025 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + *----------------------------------------------------------------------------- + * This is an updated version of Markus Kuhn's implementation of wcwidth. + * + * Originally added to xterm in 2000 (patch #141), there were a couple of + * updates from Kuhn until 2005 (patch #202), renaming entrypoints and applying + * data from Unicode.org (e.g., 3.2, 4.0, 4.1.0). The Unicode data is + * transformed into tables in this file by a script "uniset" written by Kuhn. + * + * While Kuhn implemented the original CJK variant, it was unused by xterm + * until Jungshik Shin used it in 2002 to implement the -cjk_width command-line + * option. + * + * Kuhn added a check for the vertical forms block (double-width) in 2007; + * other updates were derived from the Unicode.org data (release 5.0). + * + * Since then, additional updates have been made: + * + data-type fixes + * + new Unicode releases (6.2.0, 9.0.0, etc), + * + additional special symbol blocks have been added to the special cases. + * + soft-hyphen behavior has been made configurable. + * + added table shows when a character is not part of Unicode. + * + * Kuhn's original header follows giving the design information: + *----------------------------------------------------------------------------- * This is an implementation of wcwidth() and wcswidth() (defined in * IEEE Std 1002.1-2001) for Unicode. * @@ -50,52 +103,73 @@ * * http://www.unicode.org/unicode/reports/tr11/ * - * Markus Kuhn -- 2007-05-26 (Unicode 5.0) + * Markus Kuhn -- 2007-05-25 (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" { +#ifdef TEST_DRIVER +#include +#include /* EXIT_SUCCESS, etc. */ +#include /* getopt() */ +#include /* strncmp() */ +#include /* setlocale() */ +#include /* this module */ #endif #include #include #include +#include struct interval { - int first; - int last; + unsigned long first; + unsigned long last; }; +static int use_latin1 = 1; + /* 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; +static int +bisearch(unsigned long ucs, const struct interval *table, int max) +{ + + if (ucs >= table[0].first && ucs <= table[max].last) { + int min = 0; + + while (max >= min) { + int mid; + + mid = (min + max) / 2; + if (ucs > table[mid].last) + min = mid + 1; + else if (ucs < table[mid].first) + max = mid - 1; + else + return 1; + } + } - 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; } +/* + * Provide a way to change the behavior of soft-hyphen. + */ +void +mk_wcwidth_init(int mode) +{ + use_latin1 = (mode == 0); +} /* The following two functions define the column width of an ISO 10646 * character as follows: @@ -109,7 +183,10 @@ * 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. + * - A few spacing combining marks have a column width of 0. + * + * - SOFT HYPHEN (U+00AD) has a column width of 1 in Latin-1, 0 in Unicode. + * An initialization function is used to switch between the two. * * - Other format characters (general category code Cf in the Unicode * database) and ZERO WIDTH SPACE (U+200B) have a column width of 0. @@ -117,133 +194,606 @@ * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF) * have a column width of 0. * + * - Hangul Jamo Extended-B medial vowels and final consonants for old + * Korean (U+D7B0-U+D7FF) 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. + * Report #11 have a column width of 2. In that report, some codes + * were unassigned. Characters in these blocks use a column width of 1: + * 4DC0..4DFF; Yijing Hexagram Symbols + * A960..A97F; Hangul Jamo Extended-A * * - All remaining characters (including all printable * ISO 8859-1 and WGL4 characters, Unicode control characters, * etc.) have a column width of 1. * + * - Codes which do not correspond to a Unicode character 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) +NCURSES_EXPORT(int) +mk_wcwidth(uint32_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" */ + unsigned long cmp = (unsigned long) ucs; + + /* sorted list of non-overlapping intervals of formatting characters */ + /* generated by + * uniset +cat=Cf -00AD -0600-0605 -061C -06DD -070F c + */ + /* *INDENT-OFF* */ + /* generated by run-uniset_ctl 1.2 */ + static const struct interval formatting[] = { + { 0x0890, 0x0891 }, { 0x08E2, 0x08E2 }, { 0x180E, 0x180E }, + { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x2060, 0x2064 }, + { 0x2066, 0x206F }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB }, + { 0x110BD, 0x110BD }, { 0x110CD, 0x110CD }, { 0x13430, 0x1343F }, + { 0x1BCA0, 0x1BCA3 }, { 0x1D173, 0x1D17A }, { 0xE0001, 0xE0001 }, + { 0xE0020, 0xE007F } + }; + /* *INDENT-ON* */ + + /* sorted list of non-overlapping intervals of non-spacing characters */ + /* generated by + * uniset +cat=Me +cat=Mn +0600-0605 +061C +06DD +070F +1160-11FF +D7B0-D7C6 +D7CB-D7FB c + */ + /* *INDENT-OFF* */ + /* generated by run-uniset 1.10 */ 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 }, + { 0x0300, 0x036F }, { 0x0483, 0x0489 }, { 0x0591, 0x05BD }, + { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, { 0x05C4, 0x05C5 }, + { 0x05C7, 0x05C7 }, { 0x0600, 0x0605 }, { 0x0610, 0x061A }, + { 0x061C, 0x061C }, { 0x064B, 0x065F }, { 0x0670, 0x0670 }, + { 0x06D6, 0x06DD }, { 0x06DF, 0x06E4 }, { 0x06E7, 0x06E8 }, + { 0x06EA, 0x06ED }, { 0x070F, 0x070F }, { 0x0711, 0x0711 }, + { 0x0730, 0x074A }, { 0x07A6, 0x07B0 }, { 0x07EB, 0x07F3 }, + { 0x07FD, 0x07FD }, { 0x0816, 0x0819 }, { 0x081B, 0x0823 }, + { 0x0825, 0x0827 }, { 0x0829, 0x082D }, { 0x0859, 0x085B }, + { 0x0897, 0x089F }, { 0x08CA, 0x08E1 }, { 0x08E3, 0x0902 }, + { 0x093A, 0x093A }, { 0x093C, 0x093C }, { 0x0941, 0x0948 }, + { 0x094D, 0x094D }, { 0x0951, 0x0957 }, { 0x0962, 0x0963 }, + { 0x0981, 0x0981 }, { 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, + { 0x09CD, 0x09CD }, { 0x09E2, 0x09E3 }, { 0x09FE, 0x09FE }, + { 0x0A01, 0x0A02 }, { 0x0A3C, 0x0A3C }, { 0x0A41, 0x0A42 }, + { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, { 0x0A51, 0x0A51 }, + { 0x0A70, 0x0A71 }, { 0x0A75, 0x0A75 }, { 0x0A81, 0x0A82 }, + { 0x0ABC, 0x0ABC }, { 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, + { 0x0ACD, 0x0ACD }, { 0x0AE2, 0x0AE3 }, { 0x0AFA, 0x0AFF }, + { 0x0B01, 0x0B01 }, { 0x0B3C, 0x0B3C }, { 0x0B3F, 0x0B3F }, + { 0x0B41, 0x0B44 }, { 0x0B4D, 0x0B4D }, { 0x0B55, 0x0B56 }, + { 0x0B62, 0x0B63 }, { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 }, + { 0x0BCD, 0x0BCD }, { 0x0C00, 0x0C00 }, { 0x0C04, 0x0C04 }, + { 0x0C3C, 0x0C3C }, { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 }, + { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, { 0x0C62, 0x0C63 }, + { 0x0C81, 0x0C81 }, { 0x0CBC, 0x0CBC }, { 0x0CBF, 0x0CBF }, + { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD }, { 0x0CE2, 0x0CE3 }, + { 0x0D00, 0x0D01 }, { 0x0D3B, 0x0D3C }, { 0x0D41, 0x0D44 }, + { 0x0D4D, 0x0D4D }, { 0x0D62, 0x0D63 }, { 0x0D81, 0x0D81 }, { 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 }, + { 0x0EB1, 0x0EB1 }, { 0x0EB4, 0x0EBC }, { 0x0EC8, 0x0ECE }, + { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, { 0x0F37, 0x0F37 }, + { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, { 0x0F80, 0x0F84 }, + { 0x0F86, 0x0F87 }, { 0x0F8D, 0x0F97 }, { 0x0F99, 0x0FBC }, + { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, { 0x1032, 0x1037 }, + { 0x1039, 0x103A }, { 0x103D, 0x103E }, { 0x1058, 0x1059 }, + { 0x105E, 0x1060 }, { 0x1071, 0x1074 }, { 0x1082, 0x1082 }, + { 0x1085, 0x1086 }, { 0x108D, 0x108D }, { 0x109D, 0x109D }, + { 0x1160, 0x11FF }, { 0x135D, 0x135F }, { 0x1712, 0x1714 }, + { 0x1732, 0x1733 }, { 0x1752, 0x1753 }, { 0x1772, 0x1773 }, + { 0x17B4, 0x17B5 }, { 0x17B7, 0x17BD }, { 0x17C6, 0x17C6 }, + { 0x17C9, 0x17D3 }, { 0x17DD, 0x17DD }, { 0x180B, 0x180D }, + { 0x180F, 0x180F }, { 0x1885, 0x1886 }, { 0x18A9, 0x18A9 }, + { 0x1920, 0x1922 }, { 0x1927, 0x1928 }, { 0x1932, 0x1932 }, + { 0x1939, 0x193B }, { 0x1A17, 0x1A18 }, { 0x1A1B, 0x1A1B }, + { 0x1A56, 0x1A56 }, { 0x1A58, 0x1A5E }, { 0x1A60, 0x1A60 }, + { 0x1A62, 0x1A62 }, { 0x1A65, 0x1A6C }, { 0x1A73, 0x1A7C }, + { 0x1A7F, 0x1A7F }, { 0x1AB0, 0x1ADD }, { 0x1AE0, 0x1AEB }, + { 0x1B00, 0x1B03 }, { 0x1B34, 0x1B34 }, { 0x1B36, 0x1B3A }, + { 0x1B3C, 0x1B3C }, { 0x1B42, 0x1B42 }, { 0x1B6B, 0x1B73 }, + { 0x1B80, 0x1B81 }, { 0x1BA2, 0x1BA5 }, { 0x1BA8, 0x1BA9 }, + { 0x1BAB, 0x1BAD }, { 0x1BE6, 0x1BE6 }, { 0x1BE8, 0x1BE9 }, + { 0x1BED, 0x1BED }, { 0x1BEF, 0x1BF1 }, { 0x1C2C, 0x1C33 }, + { 0x1C36, 0x1C37 }, { 0x1CD0, 0x1CD2 }, { 0x1CD4, 0x1CE0 }, + { 0x1CE2, 0x1CE8 }, { 0x1CED, 0x1CED }, { 0x1CF4, 0x1CF4 }, + { 0x1CF8, 0x1CF9 }, { 0x1DC0, 0x1DFF }, { 0x20D0, 0x20F0 }, + { 0x2CEF, 0x2CF1 }, { 0x2D7F, 0x2D7F }, { 0x2DE0, 0x2DFF }, + { 0x302A, 0x302D }, { 0x3099, 0x309A }, { 0xA66F, 0xA672 }, + { 0xA674, 0xA67D }, { 0xA69E, 0xA69F }, { 0xA6F0, 0xA6F1 }, + { 0xA802, 0xA802 }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B }, + { 0xA825, 0xA826 }, { 0xA82C, 0xA82C }, { 0xA8C4, 0xA8C5 }, + { 0xA8E0, 0xA8F1 }, { 0xA8FF, 0xA8FF }, { 0xA926, 0xA92D }, + { 0xA947, 0xA951 }, { 0xA980, 0xA982 }, { 0xA9B3, 0xA9B3 }, + { 0xA9B6, 0xA9B9 }, { 0xA9BC, 0xA9BD }, { 0xA9E5, 0xA9E5 }, + { 0xAA29, 0xAA2E }, { 0xAA31, 0xAA32 }, { 0xAA35, 0xAA36 }, + { 0xAA43, 0xAA43 }, { 0xAA4C, 0xAA4C }, { 0xAA7C, 0xAA7C }, + { 0xAAB0, 0xAAB0 }, { 0xAAB2, 0xAAB4 }, { 0xAAB7, 0xAAB8 }, + { 0xAABE, 0xAABF }, { 0xAAC1, 0xAAC1 }, { 0xAAEC, 0xAAED }, + { 0xAAF6, 0xAAF6 }, { 0xABE5, 0xABE5 }, { 0xABE8, 0xABE8 }, + { 0xABED, 0xABED }, { 0xD7B0, 0xD7C6 }, { 0xD7CB, 0xD7FB }, + { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F }, { 0xFE20, 0xFE2F }, + { 0x101FD, 0x101FD }, { 0x102E0, 0x102E0 }, { 0x10376, 0x1037A }, { 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 } + { 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x10AE5, 0x10AE6 }, + { 0x10D24, 0x10D27 }, { 0x10D69, 0x10D6D }, { 0x10EAB, 0x10EAC }, + { 0x10EFA, 0x10EFF }, { 0x10F46, 0x10F50 }, { 0x10F82, 0x10F85 }, + { 0x11001, 0x11001 }, { 0x11038, 0x11046 }, { 0x11070, 0x11070 }, + { 0x11073, 0x11074 }, { 0x1107F, 0x11081 }, { 0x110B3, 0x110B6 }, + { 0x110B9, 0x110BA }, { 0x110C2, 0x110C2 }, { 0x11100, 0x11102 }, + { 0x11127, 0x1112B }, { 0x1112D, 0x11134 }, { 0x11173, 0x11173 }, + { 0x11180, 0x11181 }, { 0x111B6, 0x111BE }, { 0x111C9, 0x111CC }, + { 0x111CF, 0x111CF }, { 0x1122F, 0x11231 }, { 0x11234, 0x11234 }, + { 0x11236, 0x11237 }, { 0x1123E, 0x1123E }, { 0x11241, 0x11241 }, + { 0x112DF, 0x112DF }, { 0x112E3, 0x112EA }, { 0x11300, 0x11301 }, + { 0x1133B, 0x1133C }, { 0x11340, 0x11340 }, { 0x11366, 0x1136C }, + { 0x11370, 0x11374 }, { 0x113BB, 0x113C0 }, { 0x113CE, 0x113CE }, + { 0x113D0, 0x113D0 }, { 0x113D2, 0x113D2 }, { 0x113E1, 0x113E2 }, + { 0x11438, 0x1143F }, { 0x11442, 0x11444 }, { 0x11446, 0x11446 }, + { 0x1145E, 0x1145E }, { 0x114B3, 0x114B8 }, { 0x114BA, 0x114BA }, + { 0x114BF, 0x114C0 }, { 0x114C2, 0x114C3 }, { 0x115B2, 0x115B5 }, + { 0x115BC, 0x115BD }, { 0x115BF, 0x115C0 }, { 0x115DC, 0x115DD }, + { 0x11633, 0x1163A }, { 0x1163D, 0x1163D }, { 0x1163F, 0x11640 }, + { 0x116AB, 0x116AB }, { 0x116AD, 0x116AD }, { 0x116B0, 0x116B5 }, + { 0x116B7, 0x116B7 }, { 0x1171D, 0x1171D }, { 0x1171F, 0x1171F }, + { 0x11722, 0x11725 }, { 0x11727, 0x1172B }, { 0x1182F, 0x11837 }, + { 0x11839, 0x1183A }, { 0x1193B, 0x1193C }, { 0x1193E, 0x1193E }, + { 0x11943, 0x11943 }, { 0x119D4, 0x119D7 }, { 0x119DA, 0x119DB }, + { 0x119E0, 0x119E0 }, { 0x11A01, 0x11A0A }, { 0x11A33, 0x11A38 }, + { 0x11A3B, 0x11A3E }, { 0x11A47, 0x11A47 }, { 0x11A51, 0x11A56 }, + { 0x11A59, 0x11A5B }, { 0x11A8A, 0x11A96 }, { 0x11A98, 0x11A99 }, + { 0x11B60, 0x11B60 }, { 0x11B62, 0x11B64 }, { 0x11B66, 0x11B66 }, + { 0x11C30, 0x11C36 }, { 0x11C38, 0x11C3D }, { 0x11C3F, 0x11C3F }, + { 0x11C92, 0x11CA7 }, { 0x11CAA, 0x11CB0 }, { 0x11CB2, 0x11CB3 }, + { 0x11CB5, 0x11CB6 }, { 0x11D31, 0x11D36 }, { 0x11D3A, 0x11D3A }, + { 0x11D3C, 0x11D3D }, { 0x11D3F, 0x11D45 }, { 0x11D47, 0x11D47 }, + { 0x11D90, 0x11D91 }, { 0x11D95, 0x11D95 }, { 0x11D97, 0x11D97 }, + { 0x11EF3, 0x11EF4 }, { 0x11F00, 0x11F01 }, { 0x11F36, 0x11F3A }, + { 0x11F40, 0x11F40 }, { 0x11F42, 0x11F42 }, { 0x11F5A, 0x11F5A }, + { 0x13440, 0x13440 }, { 0x13447, 0x13455 }, { 0x1611E, 0x16129 }, + { 0x1612D, 0x1612F }, { 0x16AF0, 0x16AF4 }, { 0x16B30, 0x16B36 }, + { 0x16F4F, 0x16F4F }, { 0x16F8F, 0x16F92 }, { 0x16FE4, 0x16FE4 }, + { 0x1BC9D, 0x1BC9E }, { 0x1CF00, 0x1CF2D }, { 0x1CF30, 0x1CF46 }, + { 0x1D167, 0x1D169 }, { 0x1D17B, 0x1D182 }, { 0x1D185, 0x1D18B }, + { 0x1D1AA, 0x1D1AD }, { 0x1D242, 0x1D244 }, { 0x1DA00, 0x1DA36 }, + { 0x1DA3B, 0x1DA6C }, { 0x1DA75, 0x1DA75 }, { 0x1DA84, 0x1DA84 }, + { 0x1DA9B, 0x1DA9F }, { 0x1DAA1, 0x1DAAF }, { 0x1E000, 0x1E006 }, + { 0x1E008, 0x1E018 }, { 0x1E01B, 0x1E021 }, { 0x1E023, 0x1E024 }, + { 0x1E026, 0x1E02A }, { 0x1E08F, 0x1E08F }, { 0x1E130, 0x1E136 }, + { 0x1E2AE, 0x1E2AE }, { 0x1E2EC, 0x1E2EF }, { 0x1E4EC, 0x1E4EF }, + { 0x1E5EE, 0x1E5EF }, { 0x1E6E3, 0x1E6E3 }, { 0x1E6E6, 0x1E6E6 }, + { 0x1E6EE, 0x1E6EF }, { 0x1E6F5, 0x1E6F5 }, { 0x1E8D0, 0x1E8D6 }, + { 0x1E944, 0x1E94A }, { 0xE0100, 0xE01EF } }; + /* *INDENT-ON* */ - /* test for 8-bit control characters */ - if (ucs == 0) - return 0; - if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) - return -1; + /* sorted list of non-overlapping intervals of non-characters */ + /* generated by + * uniset +0000..DFFF -4e00..9fd5 +F900..10FFFD unknown +2028..2029 c + */ + /* *INDENT-OFF* */ + /* generated by run-uniset_unk 1.7 */ + static const struct interval unknowns[] = { + { 0x0378, 0x0379 }, { 0x0380, 0x0383 }, { 0x038B, 0x038B }, + { 0x038D, 0x038D }, { 0x03A2, 0x03A2 }, { 0x0530, 0x0530 }, + { 0x0557, 0x0558 }, { 0x058B, 0x058C }, { 0x0590, 0x0590 }, + { 0x05C8, 0x05CF }, { 0x05EB, 0x05EE }, { 0x05F5, 0x05FF }, + { 0x070E, 0x070E }, { 0x074B, 0x074C }, { 0x07B2, 0x07BF }, + { 0x07FB, 0x07FC }, { 0x082E, 0x082F }, { 0x083F, 0x083F }, + { 0x085C, 0x085D }, { 0x085F, 0x085F }, { 0x086B, 0x086F }, + { 0x0892, 0x0896 }, { 0x0984, 0x0984 }, { 0x098D, 0x098E }, + { 0x0991, 0x0992 }, { 0x09A9, 0x09A9 }, { 0x09B1, 0x09B1 }, + { 0x09B3, 0x09B5 }, { 0x09BA, 0x09BB }, { 0x09C5, 0x09C6 }, + { 0x09C9, 0x09CA }, { 0x09CF, 0x09D6 }, { 0x09D8, 0x09DB }, + { 0x09DE, 0x09DE }, { 0x09E4, 0x09E5 }, { 0x09FF, 0x0A00 }, + { 0x0A04, 0x0A04 }, { 0x0A0B, 0x0A0E }, { 0x0A11, 0x0A12 }, + { 0x0A29, 0x0A29 }, { 0x0A31, 0x0A31 }, { 0x0A34, 0x0A34 }, + { 0x0A37, 0x0A37 }, { 0x0A3A, 0x0A3B }, { 0x0A3D, 0x0A3D }, + { 0x0A43, 0x0A46 }, { 0x0A49, 0x0A4A }, { 0x0A4E, 0x0A50 }, + { 0x0A52, 0x0A58 }, { 0x0A5D, 0x0A5D }, { 0x0A5F, 0x0A65 }, + { 0x0A77, 0x0A80 }, { 0x0A84, 0x0A84 }, { 0x0A8E, 0x0A8E }, + { 0x0A92, 0x0A92 }, { 0x0AA9, 0x0AA9 }, { 0x0AB1, 0x0AB1 }, + { 0x0AB4, 0x0AB4 }, { 0x0ABA, 0x0ABB }, { 0x0AC6, 0x0AC6 }, + { 0x0ACA, 0x0ACA }, { 0x0ACE, 0x0ACF }, { 0x0AD1, 0x0ADF }, + { 0x0AE4, 0x0AE5 }, { 0x0AF2, 0x0AF8 }, { 0x0B00, 0x0B00 }, + { 0x0B04, 0x0B04 }, { 0x0B0D, 0x0B0E }, { 0x0B11, 0x0B12 }, + { 0x0B29, 0x0B29 }, { 0x0B31, 0x0B31 }, { 0x0B34, 0x0B34 }, + { 0x0B3A, 0x0B3B }, { 0x0B45, 0x0B46 }, { 0x0B49, 0x0B4A }, + { 0x0B4E, 0x0B54 }, { 0x0B58, 0x0B5B }, { 0x0B5E, 0x0B5E }, + { 0x0B64, 0x0B65 }, { 0x0B78, 0x0B81 }, { 0x0B84, 0x0B84 }, + { 0x0B8B, 0x0B8D }, { 0x0B91, 0x0B91 }, { 0x0B96, 0x0B98 }, + { 0x0B9B, 0x0B9B }, { 0x0B9D, 0x0B9D }, { 0x0BA0, 0x0BA2 }, + { 0x0BA5, 0x0BA7 }, { 0x0BAB, 0x0BAD }, { 0x0BBA, 0x0BBD }, + { 0x0BC3, 0x0BC5 }, { 0x0BC9, 0x0BC9 }, { 0x0BCE, 0x0BCF }, + { 0x0BD1, 0x0BD6 }, { 0x0BD8, 0x0BE5 }, { 0x0BFB, 0x0BFF }, + { 0x0C0D, 0x0C0D }, { 0x0C11, 0x0C11 }, { 0x0C29, 0x0C29 }, + { 0x0C3A, 0x0C3B }, { 0x0C45, 0x0C45 }, { 0x0C49, 0x0C49 }, + { 0x0C4E, 0x0C54 }, { 0x0C57, 0x0C57 }, { 0x0C5B, 0x0C5B }, + { 0x0C5E, 0x0C5F }, { 0x0C64, 0x0C65 }, { 0x0C70, 0x0C76 }, + { 0x0C8D, 0x0C8D }, { 0x0C91, 0x0C91 }, { 0x0CA9, 0x0CA9 }, + { 0x0CB4, 0x0CB4 }, { 0x0CBA, 0x0CBB }, { 0x0CC5, 0x0CC5 }, + { 0x0CC9, 0x0CC9 }, { 0x0CCE, 0x0CD4 }, { 0x0CD7, 0x0CDB }, + { 0x0CDF, 0x0CDF }, { 0x0CE4, 0x0CE5 }, { 0x0CF0, 0x0CF0 }, + { 0x0CF4, 0x0CFF }, { 0x0D0D, 0x0D0D }, { 0x0D11, 0x0D11 }, + { 0x0D45, 0x0D45 }, { 0x0D49, 0x0D49 }, { 0x0D50, 0x0D53 }, + { 0x0D64, 0x0D65 }, { 0x0D80, 0x0D80 }, { 0x0D84, 0x0D84 }, + { 0x0D97, 0x0D99 }, { 0x0DB2, 0x0DB2 }, { 0x0DBC, 0x0DBC }, + { 0x0DBE, 0x0DBF }, { 0x0DC7, 0x0DC9 }, { 0x0DCB, 0x0DCE }, + { 0x0DD5, 0x0DD5 }, { 0x0DD7, 0x0DD7 }, { 0x0DE0, 0x0DE5 }, + { 0x0DF0, 0x0DF1 }, { 0x0DF5, 0x0E00 }, { 0x0E3B, 0x0E3E }, + { 0x0E5C, 0x0E80 }, { 0x0E83, 0x0E83 }, { 0x0E85, 0x0E85 }, + { 0x0E8B, 0x0E8B }, { 0x0EA4, 0x0EA4 }, { 0x0EA6, 0x0EA6 }, + { 0x0EBE, 0x0EBF }, { 0x0EC5, 0x0EC5 }, { 0x0EC7, 0x0EC7 }, + { 0x0ECF, 0x0ECF }, { 0x0EDA, 0x0EDB }, { 0x0EE0, 0x0EFF }, + { 0x0F48, 0x0F48 }, { 0x0F6D, 0x0F70 }, { 0x0F98, 0x0F98 }, + { 0x0FBD, 0x0FBD }, { 0x0FCD, 0x0FCD }, { 0x0FDB, 0x0FFF }, + { 0x10C6, 0x10C6 }, { 0x10C8, 0x10CC }, { 0x10CE, 0x10CF }, + { 0x1249, 0x1249 }, { 0x124E, 0x124F }, { 0x1257, 0x1257 }, + { 0x1259, 0x1259 }, { 0x125E, 0x125F }, { 0x1289, 0x1289 }, + { 0x128E, 0x128F }, { 0x12B1, 0x12B1 }, { 0x12B6, 0x12B7 }, + { 0x12BF, 0x12BF }, { 0x12C1, 0x12C1 }, { 0x12C6, 0x12C7 }, + { 0x12D7, 0x12D7 }, { 0x1311, 0x1311 }, { 0x1316, 0x1317 }, + { 0x135B, 0x135C }, { 0x137D, 0x137F }, { 0x139A, 0x139F }, + { 0x13F6, 0x13F7 }, { 0x13FE, 0x13FF }, { 0x169D, 0x169F }, + { 0x16F9, 0x16FF }, { 0x1716, 0x171E }, { 0x1737, 0x173F }, + { 0x1754, 0x175F }, { 0x176D, 0x176D }, { 0x1771, 0x1771 }, + { 0x1774, 0x177F }, { 0x17DE, 0x17DF }, { 0x17EA, 0x17EF }, + { 0x17FA, 0x17FF }, { 0x181A, 0x181F }, { 0x1879, 0x187F }, + { 0x18AB, 0x18AF }, { 0x18F6, 0x18FF }, { 0x191F, 0x191F }, + { 0x192C, 0x192F }, { 0x193C, 0x193F }, { 0x1941, 0x1943 }, + { 0x196E, 0x196F }, { 0x1975, 0x197F }, { 0x19AC, 0x19AF }, + { 0x19CA, 0x19CF }, { 0x19DB, 0x19DD }, { 0x1A1C, 0x1A1D }, + { 0x1A5F, 0x1A5F }, { 0x1A7D, 0x1A7E }, { 0x1A8A, 0x1A8F }, + { 0x1A9A, 0x1A9F }, { 0x1AAE, 0x1AAF }, { 0x1ADE, 0x1ADF }, + { 0x1AEC, 0x1AFF }, { 0x1B4D, 0x1B4D }, { 0x1BF4, 0x1BFB }, + { 0x1C38, 0x1C3A }, { 0x1C4A, 0x1C4C }, { 0x1C8B, 0x1C8F }, + { 0x1CBB, 0x1CBC }, { 0x1CC8, 0x1CCF }, { 0x1CFB, 0x1CFF }, + { 0x1F16, 0x1F17 }, { 0x1F1E, 0x1F1F }, { 0x1F46, 0x1F47 }, + { 0x1F4E, 0x1F4F }, { 0x1F58, 0x1F58 }, { 0x1F5A, 0x1F5A }, + { 0x1F5C, 0x1F5C }, { 0x1F5E, 0x1F5E }, { 0x1F7E, 0x1F7F }, + { 0x1FB5, 0x1FB5 }, { 0x1FC5, 0x1FC5 }, { 0x1FD4, 0x1FD5 }, + { 0x1FDC, 0x1FDC }, { 0x1FF0, 0x1FF1 }, { 0x1FF5, 0x1FF5 }, + { 0x1FFF, 0x1FFF }, { 0x2028, 0x2029 }, { 0x2065, 0x2065 }, + { 0x2072, 0x2073 }, { 0x208F, 0x208F }, { 0x209D, 0x209F }, + { 0x20C2, 0x20CF }, { 0x20F1, 0x20FF }, { 0x218C, 0x218F }, + { 0x242A, 0x243F }, { 0x244B, 0x245F }, { 0x2B74, 0x2B75 }, + { 0x2CF4, 0x2CF8 }, { 0x2D26, 0x2D26 }, { 0x2D28, 0x2D2C }, + { 0x2D2E, 0x2D2F }, { 0x2D68, 0x2D6E }, { 0x2D71, 0x2D7E }, + { 0x2D97, 0x2D9F }, { 0x2DA7, 0x2DA7 }, { 0x2DAF, 0x2DAF }, + { 0x2DB7, 0x2DB7 }, { 0x2DBF, 0x2DBF }, { 0x2DC7, 0x2DC7 }, + { 0x2DCF, 0x2DCF }, { 0x2DD7, 0x2DD7 }, { 0x2DDF, 0x2DDF }, + { 0x2E5E, 0x2E7F }, { 0x2E9A, 0x2E9A }, { 0x2EF4, 0x2EFF }, + { 0x2FD6, 0x2FEF }, { 0x3040, 0x3040 }, { 0x3097, 0x3098 }, + { 0x3100, 0x3104 }, { 0x3130, 0x3130 }, { 0x318F, 0x318F }, + { 0x31E6, 0x31EE }, { 0x321F, 0x321F }, { 0x4DB6, 0x4DBF }, + { 0x9FD6, 0x9FFF }, { 0xA48D, 0xA48F }, { 0xA4C7, 0xA4CF }, + { 0xA62C, 0xA63F }, { 0xA6F8, 0xA6FF }, { 0xA7DD, 0xA7F0 }, + { 0xA82D, 0xA82F }, { 0xA83A, 0xA83F }, { 0xA878, 0xA87F }, + { 0xA8C6, 0xA8CD }, { 0xA8DA, 0xA8DF }, { 0xA954, 0xA95E }, + { 0xA97D, 0xA97F }, { 0xA9CE, 0xA9CE }, { 0xA9DA, 0xA9DD }, + { 0xA9FF, 0xA9FF }, { 0xAA37, 0xAA3F }, { 0xAA4E, 0xAA4F }, + { 0xAA5A, 0xAA5B }, { 0xAAC3, 0xAADA }, { 0xAAF7, 0xAB00 }, + { 0xAB07, 0xAB08 }, { 0xAB0F, 0xAB10 }, { 0xAB17, 0xAB1F }, + { 0xAB27, 0xAB27 }, { 0xAB2F, 0xAB2F }, { 0xAB6C, 0xAB6F }, + { 0xABEE, 0xABEF }, { 0xABFA, 0xABFF }, { 0xD7A4, 0xD7AF }, + { 0xD7C7, 0xD7CA }, { 0xD7FC, 0xDFFF }, { 0xFA6E, 0xFA6F }, + { 0xFADA, 0xFAFF }, { 0xFB07, 0xFB12 }, { 0xFB18, 0xFB1C }, + { 0xFB37, 0xFB37 }, { 0xFB3D, 0xFB3D }, { 0xFB3F, 0xFB3F }, + { 0xFB42, 0xFB42 }, { 0xFB45, 0xFB45 }, { 0xFDD0, 0xFDEF }, + { 0xFE1A, 0xFE1F }, { 0xFE53, 0xFE53 }, { 0xFE67, 0xFE67 }, + { 0xFE6C, 0xFE6F }, { 0xFE75, 0xFE75 }, { 0xFEFD, 0xFEFE }, + { 0xFF00, 0xFF00 }, { 0xFFBF, 0xFFC1 }, { 0xFFC8, 0xFFC9 }, + { 0xFFD0, 0xFFD1 }, { 0xFFD8, 0xFFD9 }, { 0xFFDD, 0xFFDF }, + { 0xFFE7, 0xFFE7 }, { 0xFFEF, 0xFFF8 }, { 0xFFFE, 0xFFFF }, + { 0x1000C, 0x1000C }, { 0x10027, 0x10027 }, { 0x1003B, 0x1003B }, + { 0x1003E, 0x1003E }, { 0x1004E, 0x1004F }, { 0x1005E, 0x1007F }, + { 0x100FB, 0x100FF }, { 0x10103, 0x10106 }, { 0x10134, 0x10136 }, + { 0x1018F, 0x1018F }, { 0x1019D, 0x1019F }, { 0x101A1, 0x101CF }, + { 0x101FE, 0x1027F }, { 0x1029D, 0x1029F }, { 0x102D1, 0x102DF }, + { 0x102FC, 0x102FF }, { 0x10324, 0x1032C }, { 0x1034B, 0x1034F }, + { 0x1037B, 0x1037F }, { 0x1039E, 0x1039E }, { 0x103C4, 0x103C7 }, + { 0x103D6, 0x103FF }, { 0x1049E, 0x1049F }, { 0x104AA, 0x104AF }, + { 0x104D4, 0x104D7 }, { 0x104FC, 0x104FF }, { 0x10528, 0x1052F }, + { 0x10564, 0x1056E }, { 0x1057B, 0x1057B }, { 0x1058B, 0x1058B }, + { 0x10593, 0x10593 }, { 0x10596, 0x10596 }, { 0x105A2, 0x105A2 }, + { 0x105B2, 0x105B2 }, { 0x105BA, 0x105BA }, { 0x105BD, 0x105BF }, + { 0x105F4, 0x105FF }, { 0x10737, 0x1073F }, { 0x10756, 0x1075F }, + { 0x10768, 0x1077F }, { 0x10786, 0x10786 }, { 0x107B1, 0x107B1 }, + { 0x107BB, 0x107FF }, { 0x10806, 0x10807 }, { 0x10809, 0x10809 }, + { 0x10836, 0x10836 }, { 0x10839, 0x1083B }, { 0x1083D, 0x1083E }, + { 0x10856, 0x10856 }, { 0x1089F, 0x108A6 }, { 0x108B0, 0x108DF }, + { 0x108F3, 0x108F3 }, { 0x108F6, 0x108FA }, { 0x1091C, 0x1091E }, + { 0x1093A, 0x1093E }, { 0x1095A, 0x1097F }, { 0x109B8, 0x109BB }, + { 0x109D0, 0x109D1 }, { 0x10A04, 0x10A04 }, { 0x10A07, 0x10A0B }, + { 0x10A14, 0x10A14 }, { 0x10A18, 0x10A18 }, { 0x10A36, 0x10A37 }, + { 0x10A3B, 0x10A3E }, { 0x10A49, 0x10A4F }, { 0x10A59, 0x10A5F }, + { 0x10AA0, 0x10ABF }, { 0x10AE7, 0x10AEA }, { 0x10AF7, 0x10AFF }, + { 0x10B36, 0x10B38 }, { 0x10B56, 0x10B57 }, { 0x10B73, 0x10B77 }, + { 0x10B92, 0x10B98 }, { 0x10B9D, 0x10BA8 }, { 0x10BB0, 0x10BFF }, + { 0x10C49, 0x10C7F }, { 0x10CB3, 0x10CBF }, { 0x10CF3, 0x10CF9 }, + { 0x10D28, 0x10D2F }, { 0x10D3A, 0x10D3F }, { 0x10D66, 0x10D68 }, + { 0x10D86, 0x10D8D }, { 0x10D90, 0x10E5F }, { 0x10E7F, 0x10E7F }, + { 0x10EAA, 0x10EAA }, { 0x10EAE, 0x10EAF }, { 0x10EB2, 0x10EC1 }, + { 0x10EC8, 0x10ECF }, { 0x10ED9, 0x10EF9 }, { 0x10F28, 0x10F2F }, + { 0x10F5A, 0x10F6F }, { 0x10F8A, 0x10FAF }, { 0x10FCC, 0x10FDF }, + { 0x10FF7, 0x10FFF }, { 0x1104E, 0x11051 }, { 0x11076, 0x1107E }, + { 0x110C3, 0x110CC }, { 0x110CE, 0x110CF }, { 0x110E9, 0x110EF }, + { 0x110FA, 0x110FF }, { 0x11135, 0x11135 }, { 0x11148, 0x1114F }, + { 0x11177, 0x1117F }, { 0x111E0, 0x111E0 }, { 0x111F5, 0x111FF }, + { 0x11212, 0x11212 }, { 0x11242, 0x1127F }, { 0x11287, 0x11287 }, + { 0x11289, 0x11289 }, { 0x1128E, 0x1128E }, { 0x1129E, 0x1129E }, + { 0x112AA, 0x112AF }, { 0x112EB, 0x112EF }, { 0x112FA, 0x112FF }, + { 0x11304, 0x11304 }, { 0x1130D, 0x1130E }, { 0x11311, 0x11312 }, + { 0x11329, 0x11329 }, { 0x11331, 0x11331 }, { 0x11334, 0x11334 }, + { 0x1133A, 0x1133A }, { 0x11345, 0x11346 }, { 0x11349, 0x1134A }, + { 0x1134E, 0x1134F }, { 0x11351, 0x11356 }, { 0x11358, 0x1135C }, + { 0x11364, 0x11365 }, { 0x1136D, 0x1136F }, { 0x11375, 0x1137F }, + { 0x1138A, 0x1138A }, { 0x1138C, 0x1138D }, { 0x1138F, 0x1138F }, + { 0x113B6, 0x113B6 }, { 0x113C1, 0x113C1 }, { 0x113C3, 0x113C4 }, + { 0x113C6, 0x113C6 }, { 0x113CB, 0x113CB }, { 0x113D6, 0x113D6 }, + { 0x113D9, 0x113E0 }, { 0x113E3, 0x113FF }, { 0x1145C, 0x1145C }, + { 0x11462, 0x1147F }, { 0x114C8, 0x114CF }, { 0x114DA, 0x1157F }, + { 0x115B6, 0x115B7 }, { 0x115DE, 0x115FF }, { 0x11645, 0x1164F }, + { 0x1165A, 0x1165F }, { 0x1166D, 0x1167F }, { 0x116BA, 0x116BF }, + { 0x116CA, 0x116CF }, { 0x116E4, 0x116FF }, { 0x1171B, 0x1171C }, + { 0x1172C, 0x1172F }, { 0x11747, 0x117FF }, { 0x1183C, 0x1189F }, + { 0x118F3, 0x118FE }, { 0x11907, 0x11908 }, { 0x1190A, 0x1190B }, + { 0x11914, 0x11914 }, { 0x11917, 0x11917 }, { 0x11936, 0x11936 }, + { 0x11939, 0x1193A }, { 0x11947, 0x1194F }, { 0x1195A, 0x1199F }, + { 0x119A8, 0x119A9 }, { 0x119D8, 0x119D9 }, { 0x119E5, 0x119FF }, + { 0x11A48, 0x11A4F }, { 0x11AA3, 0x11AAF }, { 0x11AF9, 0x11AFF }, + { 0x11B0A, 0x11B5F }, { 0x11B68, 0x11BBF }, { 0x11BE2, 0x11BEF }, + { 0x11BFA, 0x11BFF }, { 0x11C09, 0x11C09 }, { 0x11C37, 0x11C37 }, + { 0x11C46, 0x11C4F }, { 0x11C6D, 0x11C6F }, { 0x11C90, 0x11C91 }, + { 0x11CA8, 0x11CA8 }, { 0x11CB7, 0x11CFF }, { 0x11D07, 0x11D07 }, + { 0x11D0A, 0x11D0A }, { 0x11D37, 0x11D39 }, { 0x11D3B, 0x11D3B }, + { 0x11D3E, 0x11D3E }, { 0x11D48, 0x11D4F }, { 0x11D5A, 0x11D5F }, + { 0x11D66, 0x11D66 }, { 0x11D69, 0x11D69 }, { 0x11D8F, 0x11D8F }, + { 0x11D92, 0x11D92 }, { 0x11D99, 0x11D9F }, { 0x11DAA, 0x11DAF }, + { 0x11DDC, 0x11DDF }, { 0x11DEA, 0x11EDF }, { 0x11EF9, 0x11EFF }, + { 0x11F11, 0x11F11 }, { 0x11F3B, 0x11F3D }, { 0x11F5B, 0x11FAF }, + { 0x11FB1, 0x11FBF }, { 0x11FF2, 0x11FFE }, { 0x1239A, 0x123FF }, + { 0x1246F, 0x1246F }, { 0x12475, 0x1247F }, { 0x12544, 0x12F8F }, + { 0x12FF3, 0x12FFF }, { 0x13456, 0x1345F }, { 0x143FB, 0x143FF }, + { 0x14647, 0x160FF }, { 0x1613A, 0x167FF }, { 0x16A39, 0x16A3F }, + { 0x16A5F, 0x16A5F }, { 0x16A6A, 0x16A6D }, { 0x16ABF, 0x16ABF }, + { 0x16ACA, 0x16ACF }, { 0x16AEE, 0x16AEF }, { 0x16AF6, 0x16AFF }, + { 0x16B46, 0x16B4F }, { 0x16B5A, 0x16B5A }, { 0x16B62, 0x16B62 }, + { 0x16B78, 0x16B7C }, { 0x16B90, 0x16D3F }, { 0x16D7A, 0x16E3F }, + { 0x16E9B, 0x16E9F }, { 0x16EB9, 0x16EBA }, { 0x16ED4, 0x16EFF }, + { 0x16F4B, 0x16F4E }, { 0x16F88, 0x16F8E }, { 0x16FA0, 0x16FDF }, + { 0x16FE5, 0x16FEF }, { 0x16FF7, 0x187FF }, { 0x18CD6, 0x18CFE }, + { 0x18D00, 0x18D7F }, { 0x18DF3, 0x1AFEF }, { 0x1AFF4, 0x1AFF4 }, + { 0x1AFFC, 0x1AFFC }, { 0x1AFFF, 0x1AFFF }, { 0x1B123, 0x1B131 }, + { 0x1B133, 0x1B14F }, { 0x1B153, 0x1B154 }, { 0x1B156, 0x1B163 }, + { 0x1B168, 0x1B16F }, { 0x1B2FC, 0x1BBFF }, { 0x1BC6B, 0x1BC6F }, + { 0x1BC7D, 0x1BC7F }, { 0x1BC89, 0x1BC8F }, { 0x1BC9A, 0x1BC9B }, + { 0x1BCA4, 0x1CBFF }, { 0x1CCFD, 0x1CCFF }, { 0x1CEB4, 0x1CEB9 }, + { 0x1CED1, 0x1CEDF }, { 0x1CEF1, 0x1CEFF }, { 0x1CF2E, 0x1CF2F }, + { 0x1CF47, 0x1CF4F }, { 0x1CFC4, 0x1CFFF }, { 0x1D0F6, 0x1D0FF }, + { 0x1D127, 0x1D128 }, { 0x1D1EB, 0x1D1FF }, { 0x1D246, 0x1D2BF }, + { 0x1D2D4, 0x1D2DF }, { 0x1D2F4, 0x1D2FF }, { 0x1D357, 0x1D35F }, + { 0x1D379, 0x1D3FF }, { 0x1D455, 0x1D455 }, { 0x1D49D, 0x1D49D }, + { 0x1D4A0, 0x1D4A1 }, { 0x1D4A3, 0x1D4A4 }, { 0x1D4A7, 0x1D4A8 }, + { 0x1D4AD, 0x1D4AD }, { 0x1D4BA, 0x1D4BA }, { 0x1D4BC, 0x1D4BC }, + { 0x1D4C4, 0x1D4C4 }, { 0x1D506, 0x1D506 }, { 0x1D50B, 0x1D50C }, + { 0x1D515, 0x1D515 }, { 0x1D51D, 0x1D51D }, { 0x1D53A, 0x1D53A }, + { 0x1D53F, 0x1D53F }, { 0x1D545, 0x1D545 }, { 0x1D547, 0x1D549 }, + { 0x1D551, 0x1D551 }, { 0x1D6A6, 0x1D6A7 }, { 0x1D7CC, 0x1D7CD }, + { 0x1DA8C, 0x1DA9A }, { 0x1DAA0, 0x1DAA0 }, { 0x1DAB0, 0x1DEFF }, + { 0x1DF1F, 0x1DF24 }, { 0x1DF2B, 0x1DFFF }, { 0x1E007, 0x1E007 }, + { 0x1E019, 0x1E01A }, { 0x1E022, 0x1E022 }, { 0x1E025, 0x1E025 }, + { 0x1E02B, 0x1E02F }, { 0x1E06E, 0x1E08E }, { 0x1E090, 0x1E0FF }, + { 0x1E12D, 0x1E12F }, { 0x1E13E, 0x1E13F }, { 0x1E14A, 0x1E14D }, + { 0x1E150, 0x1E28F }, { 0x1E2AF, 0x1E2BF }, { 0x1E2FA, 0x1E2FE }, + { 0x1E300, 0x1E4CF }, { 0x1E4FA, 0x1E5CF }, { 0x1E5FB, 0x1E5FE }, + { 0x1E600, 0x1E6BF }, { 0x1E6DF, 0x1E6DF }, { 0x1E6F6, 0x1E6FD }, + { 0x1E700, 0x1E7DF }, { 0x1E7E7, 0x1E7E7 }, { 0x1E7EC, 0x1E7EC }, + { 0x1E7EF, 0x1E7EF }, { 0x1E7FF, 0x1E7FF }, { 0x1E8C5, 0x1E8C6 }, + { 0x1E8D7, 0x1E8FF }, { 0x1E94C, 0x1E94F }, { 0x1E95A, 0x1E95D }, + { 0x1E960, 0x1EC70 }, { 0x1ECB5, 0x1ED00 }, { 0x1ED3E, 0x1EDFF }, + { 0x1EE04, 0x1EE04 }, { 0x1EE20, 0x1EE20 }, { 0x1EE23, 0x1EE23 }, + { 0x1EE25, 0x1EE26 }, { 0x1EE28, 0x1EE28 }, { 0x1EE33, 0x1EE33 }, + { 0x1EE38, 0x1EE38 }, { 0x1EE3A, 0x1EE3A }, { 0x1EE3C, 0x1EE41 }, + { 0x1EE43, 0x1EE46 }, { 0x1EE48, 0x1EE48 }, { 0x1EE4A, 0x1EE4A }, + { 0x1EE4C, 0x1EE4C }, { 0x1EE50, 0x1EE50 }, { 0x1EE53, 0x1EE53 }, + { 0x1EE55, 0x1EE56 }, { 0x1EE58, 0x1EE58 }, { 0x1EE5A, 0x1EE5A }, + { 0x1EE5C, 0x1EE5C }, { 0x1EE5E, 0x1EE5E }, { 0x1EE60, 0x1EE60 }, + { 0x1EE63, 0x1EE63 }, { 0x1EE65, 0x1EE66 }, { 0x1EE6B, 0x1EE6B }, + { 0x1EE73, 0x1EE73 }, { 0x1EE78, 0x1EE78 }, { 0x1EE7D, 0x1EE7D }, + { 0x1EE7F, 0x1EE7F }, { 0x1EE8A, 0x1EE8A }, { 0x1EE9C, 0x1EEA0 }, + { 0x1EEA4, 0x1EEA4 }, { 0x1EEAA, 0x1EEAA }, { 0x1EEBC, 0x1EEEF }, + { 0x1EEF2, 0x1EFFF }, { 0x1F02C, 0x1F02F }, { 0x1F094, 0x1F09F }, + { 0x1F0AF, 0x1F0B0 }, { 0x1F0C0, 0x1F0C0 }, { 0x1F0D0, 0x1F0D0 }, + { 0x1F0F6, 0x1F0FF }, { 0x1F1AE, 0x1F1E5 }, { 0x1F203, 0x1F20F }, + { 0x1F23C, 0x1F23F }, { 0x1F249, 0x1F24F }, { 0x1F252, 0x1F25F }, + { 0x1F266, 0x1F2FF }, { 0x1F6D9, 0x1F6DB }, { 0x1F6ED, 0x1F6EF }, + { 0x1F6FD, 0x1F6FF }, { 0x1F7DA, 0x1F7DF }, { 0x1F7EC, 0x1F7EF }, + { 0x1F7F1, 0x1F7FF }, { 0x1F80C, 0x1F80F }, { 0x1F848, 0x1F84F }, + { 0x1F85A, 0x1F85F }, { 0x1F888, 0x1F88F }, { 0x1F8AE, 0x1F8AF }, + { 0x1F8BC, 0x1F8BF }, { 0x1F8C2, 0x1F8CF }, { 0x1F8D9, 0x1F8FF }, + { 0x1FA58, 0x1FA5F }, { 0x1FA6E, 0x1FA6F }, { 0x1FA7D, 0x1FA7F }, + { 0x1FA8B, 0x1FA8D }, { 0x1FAC7, 0x1FAC7 }, { 0x1FAC9, 0x1FACC }, + { 0x1FADD, 0x1FADE }, { 0x1FAEB, 0x1FAEE }, { 0x1FAF9, 0x1FAFF }, + { 0x1FB93, 0x1FB93 }, { 0x1FBFB, 0x1FFFF }, { 0x2A6D7, 0x2F7FF }, + { 0x2FA1E, 0xE0000 }, { 0xE0002, 0xE001F }, { 0xE0080, 0xE00FF }, + { 0xE01F0, 0x10FFFD } + }; + /* *INDENT-ON* */ - /* binary search in table of non-spacing characters */ - if (bisearch(ucs, combining, - sizeof(combining) / sizeof(struct interval) - 1)) - return 0; + /* sorted list of non-overlapping intervals of non-characters */ + /* generated by + * uniset +WIDTH-W +emoji/emoji-data.txt -0000..00ff -cat=Cn -cat=Mn c + */ + /* *INDENT-OFF* */ + /* generated by run-uniset_dbl 1.4 */ + static const struct interval doublewidth[] = { + { 0x1100, 0x115F }, { 0x200D, 0x200D }, { 0x203C, 0x203C }, + { 0x2049, 0x2049 }, { 0x20E3, 0x20E3 }, { 0x2122, 0x2122 }, + { 0x2139, 0x2139 }, { 0x2194, 0x2194 }, { 0x21A9, 0x21A9 }, + { 0x231A, 0x231B }, { 0x2328, 0x232A }, { 0x23CF, 0x23CF }, + { 0x23E9, 0x23ED }, { 0x23EF, 0x23F1 }, { 0x23F3, 0x23F3 }, + { 0x23F8, 0x23F8 }, { 0x24C2, 0x24C2 }, { 0x25AA, 0x25AA }, + { 0x25B6, 0x25B6 }, { 0x25C0, 0x25C0 }, { 0x25FB, 0x25FB }, + { 0x25FD, 0x25FE }, { 0x2600, 0x2600 }, { 0x2602, 0x2602 }, + { 0x2604, 0x2604 }, { 0x260E, 0x260E }, { 0x2611, 0x2611 }, + { 0x2614, 0x2615 }, { 0x2618, 0x2618 }, { 0x261D, 0x261D }, + { 0x2620, 0x2620 }, { 0x2622, 0x2622 }, { 0x2626, 0x2626 }, + { 0x262A, 0x262A }, { 0x262E, 0x2638 }, { 0x263A, 0x263A }, + { 0x2640, 0x2640 }, { 0x2642, 0x2642 }, { 0x2648, 0x2653 }, + { 0x265F, 0x2660 }, { 0x2663, 0x2663 }, { 0x2665, 0x2665 }, + { 0x2668, 0x2668 }, { 0x267B, 0x267B }, { 0x267E, 0x267F }, + { 0x268A, 0x268F }, { 0x2692, 0x2696 }, { 0x2699, 0x2699 }, + { 0x269B, 0x269B }, { 0x26A0, 0x26A1 }, { 0x26A7, 0x26A7 }, + { 0x26AA, 0x26AB }, { 0x26B0, 0x26B0 }, { 0x26BD, 0x26BE }, + { 0x26C4, 0x26C5 }, { 0x26C8, 0x26C8 }, { 0x26CE, 0x26CF }, + { 0x26D1, 0x26D1 }, { 0x26D3, 0x26D4 }, { 0x26E9, 0x26EA }, + { 0x26F0, 0x26F0 }, { 0x26F2, 0x26F5 }, { 0x26F7, 0x26F7 }, + { 0x26F9, 0x26FA }, { 0x26FD, 0x26FD }, { 0x2702, 0x2702 }, + { 0x2705, 0x2705 }, { 0x2708, 0x2708 }, { 0x270A, 0x270B }, + { 0x270D, 0x270D }, { 0x270F, 0x270F }, { 0x2712, 0x2712 }, + { 0x2714, 0x2714 }, { 0x2716, 0x2716 }, { 0x271D, 0x271D }, + { 0x2721, 0x2721 }, { 0x2728, 0x2728 }, { 0x2733, 0x2733 }, + { 0x2744, 0x2744 }, { 0x2747, 0x2747 }, { 0x274C, 0x274C }, + { 0x274E, 0x274E }, { 0x2753, 0x2755 }, { 0x2757, 0x2757 }, + { 0x2763, 0x2764 }, { 0x2795, 0x2797 }, { 0x27A1, 0x27A1 }, + { 0x27B0, 0x27B0 }, { 0x27BF, 0x27BF }, { 0x2934, 0x2934 }, + { 0x2B05, 0x2B05 }, { 0x2B1B, 0x2B1C }, { 0x2B50, 0x2B50 }, + { 0x2B55, 0x2B55 }, { 0x2E80, 0x2E99 }, { 0x2E9B, 0x2EF3 }, + { 0x2F00, 0x2FD5 }, { 0x2FF0, 0x3029 }, { 0x302E, 0x303E }, + { 0x3041, 0x3096 }, { 0x309B, 0x30FF }, { 0x3105, 0x312F }, + { 0x3131, 0x318E }, { 0x3190, 0x31E5 }, { 0x31EF, 0x321E }, + { 0x3220, 0x3247 }, { 0x3250, 0xA48C }, { 0xA490, 0xA4C6 }, + { 0xA960, 0xA97C }, { 0xAC00, 0xD7A3 }, { 0xF900, 0xFA6D }, + { 0xFA70, 0xFAD9 }, { 0xFE10, 0xFE19 }, { 0xFE30, 0xFE52 }, + { 0xFE54, 0xFE66 }, { 0xFE68, 0xFE6B }, { 0xFF01, 0xFF60 }, + { 0xFFE0, 0xFFE6 }, { 0x16FE0, 0x16FE3 }, { 0x16FF0, 0x16FF6 }, + { 0x17000, 0x18CD5 }, { 0x18CFF, 0x18D1E }, { 0x18D80, 0x18DF2 }, + { 0x1AFF0, 0x1AFF3 }, { 0x1AFF5, 0x1AFFB }, { 0x1AFFD, 0x1AFFE }, + { 0x1B000, 0x1B122 }, { 0x1B132, 0x1B132 }, { 0x1B150, 0x1B152 }, + { 0x1B155, 0x1B155 }, { 0x1B164, 0x1B167 }, { 0x1B170, 0x1B2FB }, + { 0x1D300, 0x1D356 }, { 0x1D360, 0x1D376 }, { 0x1F004, 0x1F004 }, + { 0x1F02C, 0x1F02C }, { 0x1F094, 0x1F094 }, { 0x1F0AF, 0x1F0AF }, + { 0x1F0C0, 0x1F0C0 }, { 0x1F0CF, 0x1F0D0 }, { 0x1F0F6, 0x1F0F6 }, + { 0x1F170, 0x1F170 }, { 0x1F17E, 0x1F17E }, { 0x1F18E, 0x1F18E }, + { 0x1F191, 0x1F19A }, { 0x1F1AE, 0x1F1AE }, { 0x1F1E6, 0x1F1E6 }, + { 0x1F200, 0x1F203 }, { 0x1F210, 0x1F23C }, { 0x1F240, 0x1F249 }, + { 0x1F250, 0x1F252 }, { 0x1F260, 0x1F266 }, { 0x1F300, 0x1F321 }, + { 0x1F324, 0x1F324 }, { 0x1F32D, 0x1F393 }, { 0x1F396, 0x1F396 }, + { 0x1F399, 0x1F399 }, { 0x1F39E, 0x1F39E }, { 0x1F3A0, 0x1F3CB }, + { 0x1F3CF, 0x1F3D4 }, { 0x1F3E0, 0x1F3F0 }, { 0x1F3F3, 0x1F3F5 }, + { 0x1F3F7, 0x1F4FD }, { 0x1F4FF, 0x1F53D }, { 0x1F549, 0x1F549 }, + { 0x1F54B, 0x1F54E }, { 0x1F550, 0x1F567 }, { 0x1F56F, 0x1F56F }, + { 0x1F573, 0x1F574 }, { 0x1F57A, 0x1F57A }, { 0x1F587, 0x1F587 }, + { 0x1F58A, 0x1F58A }, { 0x1F590, 0x1F590 }, { 0x1F595, 0x1F596 }, + { 0x1F5A4, 0x1F5A5 }, { 0x1F5A8, 0x1F5A8 }, { 0x1F5B1, 0x1F5B1 }, + { 0x1F5BC, 0x1F5BC }, { 0x1F5C2, 0x1F5C2 }, { 0x1F5D1, 0x1F5D1 }, + { 0x1F5DC, 0x1F5DC }, { 0x1F5E1, 0x1F5E1 }, { 0x1F5E3, 0x1F5E3 }, + { 0x1F5E8, 0x1F5E8 }, { 0x1F5EF, 0x1F5EF }, { 0x1F5F3, 0x1F5F3 }, + { 0x1F5FA, 0x1F64F }, { 0x1F680, 0x1F6C5 }, { 0x1F6CB, 0x1F6CD }, + { 0x1F6D0, 0x1F6D2 }, { 0x1F6D5, 0x1F6D9 }, { 0x1F6DC, 0x1F6E0 }, + { 0x1F6E9, 0x1F6E9 }, { 0x1F6EB, 0x1F6ED }, { 0x1F6F0, 0x1F6F0 }, + { 0x1F6F3, 0x1F6FD }, { 0x1F7DA, 0x1F7DA }, { 0x1F7E0, 0x1F7EC }, + { 0x1F7F0, 0x1F7F1 }, { 0x1F80C, 0x1F80C }, { 0x1F848, 0x1F848 }, + { 0x1F85A, 0x1F85A }, { 0x1F888, 0x1F888 }, { 0x1F8AE, 0x1F8AE }, + { 0x1F8BC, 0x1F8BC }, { 0x1F8C2, 0x1F8C2 }, { 0x1F8D9, 0x1F8D9 }, + { 0x1F90C, 0x1F93A }, { 0x1F93C, 0x1F945 }, { 0x1F947, 0x1F9FF }, + { 0x1FA58, 0x1FA58 }, { 0x1FA6E, 0x1FA6E }, { 0x1FA70, 0x1FA7D }, + { 0x1FA80, 0x1FA8B }, { 0x1FA8E, 0x1FAC9 }, { 0x1FACD, 0x1FADD }, + { 0x1FADF, 0x1FAEB }, { 0x1FAEF, 0x1FAF9 }, { 0x1FC00, 0x1FC00 }, + { 0x20000, 0x2A6DF }, { 0x2A700, 0x2B81D }, { 0x2B820, 0x2CEAD }, + { 0x2CEB0, 0x2EBE0 }, { 0x2EBF0, 0x2EE5D }, { 0x2F800, 0x2FA1D }, + { 0x30000, 0x3134A }, { 0x31350, 0x33479 }, { 0xE0020, 0xE0020 } + }; + /* *INDENT-ON* */ + + int result; + +#define Lookup(cmp, table) \ + bisearch(cmp, table, \ + (int) (sizeof(table) / sizeof(struct interval) - 1)) + + /* test for 8-bit control characters */ + if (cmp == 0) { + result = 0; + } else if (cmp < 32 || (cmp >= 0x7f && cmp < 0xa0)) { + result = -1; + } else if (cmp == 0xad) { + result = use_latin1; + } else if (Lookup(cmp, formatting)) { + /* treat formatting characters like control characters */ + result = 0; + } else if (Lookup(cmp, combining)) { + /* binary search in table of non-spacing characters */ + result = 0; + } else { + /* if we arrive here, cmp is not a combining or C0/C1 control character */ + result = 1; - /* 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) + if (Lookup(cmp, doublewidth)) { + result = 2; + } else if (cmp >= 0xd800 && cmp <= 0xdfff) { +#if HAVE_WCWIDTH + result = (wcwidth) (ucs); +#else + result = -1; #endif - )); + } else if (cmp >= unknowns[0].first && Lookup(cmp, unknowns)) { + result = -1; + } + } + return result; } - -NCURSES_EXPORT(int) mk_wcswidth(const wchar_t *pwcs, size_t n) +#ifdef UNUSED +int +mk_wcswidth(const wchar_t *pwcs, size_t n) { - int w, width = 0; + int width = 0; - for (;*pwcs && n-- > 0; pwcs++) - if ((w = mk_wcwidth(*pwcs)) < 0) - return -1; - else - width += w; + for (; *pwcs && n-- > 0; pwcs++) { + int w; - return width; -} + if ((w = mk_wcwidth(*pwcs)) < 0) + return -1; + else + width += w; + } + return width; +} +#endif /* UNUSED */ /* * The following functions are the same as mk_wcwidth() and - * mk_wcswidth(), except that spacing characters in the East Asian + * mk_wcwidth_cjk(), 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) +NCURSES_EXPORT(int) +mk_wcwidth_cjk(uint32_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" */ + /* sorted list of non-overlapping intervals of East Asian Ambiguous + * characters, generated by + * + * uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf \ + * +E000..F8FF \ + * +F0000..FFFFD \ + * +100000..10FFFD c + * + * "WIDTH-A" is a file extracted from EastAsianWidth.txt by selecting + * only those with width "A", and omitting: + * + * 0xAD + * all lines with "COMBINING" + */ + /* *INDENT-OFF* */ + /* generated by run-uniset_cjk 1.6 */ static const struct interval ambiguous[] = { { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 }, @@ -274,55 +824,179 @@ { 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 }, + { 0x2189, 0x2189 }, { 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 }, { 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 } + { 0x269E, 0x269F }, { 0x26BF, 0x26BF }, { 0x26C6, 0x26CD }, + { 0x26CF, 0x26D3 }, { 0x26D5, 0x26E1 }, { 0x26E3, 0x26E3 }, + { 0x26E8, 0x26E9 }, { 0x26EB, 0x26F1 }, { 0x26F4, 0x26F4 }, + { 0x26F6, 0x26F9 }, { 0x26FB, 0x26FC }, { 0x26FE, 0x26FF }, + { 0x273D, 0x273D }, { 0x2776, 0x277F }, { 0x2B56, 0x2B59 }, + { 0x3248, 0x324F }, { 0xE000, 0xF8FF }, { 0xFFFD, 0xFFFD }, + { 0x1F100, 0x1F10A }, { 0x1F110, 0x1F12D }, { 0x1F130, 0x1F169 }, + { 0x1F170, 0x1F18D }, { 0x1F18F, 0x1F190 }, { 0x1F19B, 0x1F1AC }, + { 0xF0000, 0xFFFFD }, { 0x100000, 0x10FFFD } }; + /* *INDENT-ON* */ + + /* binary search in table of non-spacing characters */ + if (Lookup((unsigned long) ucs, ambiguous)) + return 2; + + return mk_wcwidth(ucs); +} - /* binary search in table of non-spacing characters */ - if (bisearch(ucs, ambiguous, - sizeof(ambiguous) / sizeof(struct interval) - 1)) - return 2; +#ifdef UNUSED +NCURSES_EXPORT(int) +mk_wcswidth_cjk(const uint32_t *pwcs, size_t n) +{ + int width = 0; + + for (; *pwcs && n-- > 0; pwcs++) { + int w; - return mk_wcwidth(ucs); + if ((w = mk_wcwidth_cjk(*pwcs)) < 0) + return -1; + else + width += w; + } + + return width; } +#endif /* UNUSED */ +#ifdef TEST_DRIVER +static int opt_all = 0; +static int opt_quiet = 0; +static int opt_wider = 0; +static long total_test = 0; +static long total_errs = 0; -NCURSES_EXPORT(int) mk_wcswidth_cjk(const wchar_t *pwcs, size_t n) +static void +usage(void) { - int w, width = 0; + static const char *msg[] = + { + "Usage: test_wcwidth [options] [c1[-c1b] [c2-[c2b] [...]]]", + "", + "Options:", + " -a show all data, rather than just differences", + " -s show only summary", + " -w use width-characters for ambiguous-width" + }; + size_t n; + for (n = 0; n < sizeof(msg) / sizeof(msg[0]); ++n) { + fprintf(stderr, "%s\n", msg[n]); + } + exit(EXIT_FAILURE); +} - for (;*pwcs && n-- > 0; pwcs++) - if ((w = mk_wcwidth_cjk(*pwcs)) < 0) - return -1; - else - width += w; +static int +decode_one(const char *source, char **target) +{ + int result = -1; + long check; + int radix = 0; + if ((source[0] == 'u' || source[0] == 'U') && source[1] == '+') { + source += 2; + radix = 16; + } + check = strtol(source, target, radix); + if (*target != NULL && *target != source) + result = (int) check; + return result; +} - return width; +static int +decode_range(const char *source, int *lo, int *hi) +{ + int result = 0; + char *after1; + char *after2; + if ((*lo = decode_one(source, &after1)) >= 0) { + after1 += strspn(after1, ":-.\t "); + if ((*hi = decode_one(after1, &after2)) < 0) { + *hi = *lo; + } + result = 1; + } + return result; } -#ifdef __cplusplus +static void +do_range(const char *source) +{ + int lo, hi; + if (decode_range(source, &lo, &hi)) { + while (lo <= hi) { + wchar_t wlo = (wchar_t) lo; + int local_rc = opt_wider ? mk_wcwidth_cjk(wlo) : mk_wcwidth(wlo); + int other_rc = wcwidth(wlo); + ++total_test; + if (opt_all || (local_rc != other_rc)) { + if (!opt_quiet) + printf("U+%04X\t%d\t%d\n", lo, local_rc, other_rc); + } + if (local_rc != other_rc) { + ++total_errs; + } + ++lo; + } + } } -#endif + +int +main(int argc, char **argv) +{ + int ch; + + setlocale(LC_ALL, ""); + while ((ch = getopt(argc, argv, "asw")) != -1) { + switch (ch) { + case 'a': + opt_all = 1; + break; + case 's': + opt_quiet = 1; + break; + case 'w': + opt_wider = 1; + break; + default: + usage(); + } + } + if (optind >= argc) + usage(); + while (optind < argc) { + do_range(argv[optind++]); + } + if (total_test) { + printf("%ld/%ld mismatches (%.0f%%)\n", + total_errs, + total_test, + (100.0 * (double) total_errs) / (double) total_test); + } + return EXIT_SUCCESS; +} +#endif /* TEST_DRIVER 1 */ #endif /* _WCWIDTH_H_incl 1 */ diff --git a/contrib/ncurses/ncurses/widechar/charable.c b/contrib/ncurses/ncurses/widechar/charable.c --- a/contrib/ncurses/ncurses/widechar/charable.c +++ b/contrib/ncurses/ncurses/widechar/charable.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2018-2020,2025 Thomas E. Dickey * * Copyright 2003-2005,2008 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include -MODULE_ID("$Id: charable.c,v 1.8 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: charable.c,v 1.9 2025/09/13 10:55:44 tom Exp $") NCURSES_EXPORT(bool) _nc_is_charable(wchar_t ch) { @@ -52,9 +52,8 @@ #if HAVE_WCTOB result = wctob(ch); #elif HAVE_WCTOMB - char temp[MB_LEN_MAX]; - result = wctomb(temp, ch); - if (strlen(temp) == 1) + char temp[MB_LEN_MAX + 1]; + if (wctomb(temp, ch) == 1) result = UChar(temp[0]); else result = -1; diff --git a/contrib/ncurses/ncurses/widechar/lib_add_wch.c b/contrib/ncurses/ncurses/widechar/lib_add_wch.c --- a/contrib/ncurses/ncurses/widechar/lib_add_wch.c +++ b/contrib/ncurses/ncurses/widechar/lib_add_wch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2021,2023 Thomas E. Dickey * + * Copyright 2019-2024,2025 Thomas E. Dickey * * Copyright 2004-2011,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,7 +40,7 @@ #include #endif -MODULE_ID("$Id: lib_add_wch.c,v 1.18 2023/07/15 17:34:12 tom Exp $") +MODULE_ID("$Id: lib_add_wch.c,v 1.22 2025/01/19 00:51:54 tom Exp $") /* clone/adapt lib_addch.c */ static const cchar_t blankchar = NewChar(BLANK_TEXT); @@ -115,7 +115,7 @@ #endif static bool -newline_forces_scroll(WINDOW *win, NCURSES_SIZE_T *ypos) +newline_forces_scroll(const WINDOW *win, NCURSES_SIZE_T *ypos) { bool result = FALSE; @@ -307,7 +307,7 @@ /* the workhorse function -- add a character to the given window */ { NCURSES_SIZE_T x, y; - wchar_t *s; + const wchar_t *s; int tabsize = 8; #if USE_REENTRANT SCREEN *sp = _nc_screen_of(win); @@ -384,7 +384,7 @@ win->_flags &= ~_WRAPPED; break; default: - if ((s = wunctrl(&ch)) != 0) { + if ((s = wunctrl(&ch)) != NULL) { while (*s) { cchar_t sch; SetChar(sch, *s++, AttrOf(ch)); @@ -434,7 +434,7 @@ { int code = ERR; - TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("wechochar(%p, %s)"), + TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("wecho_wchar(%p, %s)"), (void *) win, _tracecchar_t(wch))); diff --git a/contrib/ncurses/ncurses/widechar/lib_box_set.c b/contrib/ncurses/ncurses/widechar/lib_box_set.c --- a/contrib/ncurses/ncurses/widechar/lib_box_set.c +++ b/contrib/ncurses/ncurses/widechar/lib_box_set.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 2002-2009,2011 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,7 +40,7 @@ #include -MODULE_ID("$Id: lib_box_set.c,v 1.7 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_box_set.c,v 1.8 2024/12/07 20:08:15 tom Exp $") NCURSES_EXPORT(int) wborder_set(WINDOW *win, @@ -67,7 +67,7 @@ if (!win) returnCode(ERR); -#define RENDER_WITH_DEFAULT(ch,def) w ##ch = _nc_render(win, (ch == 0) ? *(const ARG_CH_T)def : *ch) +#define RENDER_WITH_DEFAULT(ch,def) w ##ch = _nc_render(win, (ch == NULL) ? *(const ARG_CH_T)def : *ch) RENDER_WITH_DEFAULT(ls, WACS_VLINE); RENDER_WITH_DEFAULT(rs, WACS_VLINE); diff --git a/contrib/ncurses/ncurses/widechar/lib_cchar.c b/contrib/ncurses/ncurses/widechar/lib_cchar.c --- a/contrib/ncurses/ncurses/widechar/lib_cchar.c +++ b/contrib/ncurses/ncurses/widechar/lib_cchar.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2021,2022 Thomas E. Dickey * + * Copyright 2019-2022,2024 Thomas E. Dickey * * Copyright 2001-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -37,7 +37,7 @@ #include #include -MODULE_ID("$Id: lib_cchar.c,v 1.38 2022/07/27 08:03:16 tom Exp $") +MODULE_ID("$Id: lib_cchar.c,v 1.40 2024/12/07 18:07:52 tom Exp $") /* * The SuSv2 description leaves some room for interpretation. We'll assume wch @@ -119,7 +119,7 @@ } else #endif if (wcval != NULL) { - wchar_t *wp; + const wchar_t *wp; int len; #if HAVE_WMEMCHR @@ -135,7 +135,7 @@ * 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) { + } else if (attrs == NULL || pair_arg == NULL) { code = ERR; } else if (len >= 0) { int color_pair; diff --git a/contrib/ncurses/ncurses/widechar/lib_get_wch.c b/contrib/ncurses/ncurses/widechar/lib_get_wch.c --- a/contrib/ncurses/ncurses/widechar/lib_get_wch.c +++ b/contrib/ncurses/ncurses/widechar/lib_get_wch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 2002-2011,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -41,7 +41,7 @@ #include #include -MODULE_ID("$Id: lib_get_wch.c,v 1.26 2021/04/17 16:12:54 tom Exp $") +MODULE_ID("$Id: lib_get_wch.c,v 1.28 2025/11/01 20:16:24 tom Exp $") NCURSES_EXPORT(int) wget_wch(WINDOW *win, wint_t *result) @@ -62,7 +62,7 @@ _nc_lock_global(curses); sp = _nc_screen_of(win); - if (sp != 0) { + if (sp != NULL) { size_t count = 0; for (;;) { @@ -103,7 +103,7 @@ code = ERR; /* the two calls should match */ safe_ungetch(SP_PARM, value); } - value = wch; + value = (int) wch; break; } } @@ -112,7 +112,7 @@ code = ERR; } - if (result != 0) + if (result != NULL) *result = (wint_t) value; _nc_unlock_global(curses); diff --git a/contrib/ncurses/ncurses/widechar/lib_get_wstr.c b/contrib/ncurses/ncurses/widechar/lib_get_wstr.c --- a/contrib/ncurses/ncurses/widechar/lib_get_wstr.c +++ b/contrib/ncurses/ncurses/widechar/lib_get_wstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2021,2023 Thomas E. Dickey * + * Copyright 2018-2023,2024 Thomas E. Dickey * * Copyright 2002-2009,2011 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,10 +40,10 @@ #include -MODULE_ID("$Id: lib_get_wstr.c,v 1.21 2023/04/29 19:02:03 tom Exp $") +MODULE_ID("$Id: lib_get_wstr.c,v 1.22 2024/07/27 19:22:23 tom Exp $") static int -wadd_wint(WINDOW *win, wint_t *src) +wadd_wint(WINDOW *win, const wint_t *src) { cchar_t tmp; wchar_t wch[2]; @@ -59,7 +59,7 @@ * 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) +WipeOut(WINDOW *win, int y, int x, const wint_t *first, wint_t *last, int echoed) { if (last > first) { *--last = '\0'; diff --git a/contrib/ncurses/ncurses/widechar/lib_hline_set.c b/contrib/ncurses/ncurses/widechar/lib_hline_set.c --- a/contrib/ncurses/ncurses/widechar/lib_hline_set.c +++ b/contrib/ncurses/ncurses/widechar/lib_hline_set.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 2002-2010,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,7 +40,7 @@ #include -MODULE_ID("$Id: lib_hline_set.c,v 1.6 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_hline_set.c,v 1.7 2024/12/07 20:08:15 tom Exp $") NCURSES_EXPORT(int) whline_set(WINDOW *win, const cchar_t *ch, int n) @@ -60,7 +60,7 @@ CHANGED_RANGE(line, start, end); - if (ch == 0) + if (ch == NULL) wch = *WACS_HLINE; else wch = *ch; diff --git a/contrib/ncurses/ncurses/widechar/lib_in_wch.c b/contrib/ncurses/ncurses/widechar/lib_in_wch.c --- a/contrib/ncurses/ncurses/widechar/lib_in_wch.c +++ b/contrib/ncurses/ncurses/widechar/lib_in_wch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 2002-2009,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,7 +40,7 @@ #include -MODULE_ID("$Id: lib_in_wch.c,v 1.7 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_in_wch.c,v 1.8 2024/12/07 20:08:15 tom Exp $") NCURSES_EXPORT(int) win_wch(WINDOW *win, cchar_t *wcval) @@ -49,8 +49,8 @@ TR(TRACE_CCALLS, (T_CALLED("win_wch(%p,%p)"), (void *) win, (void *) wcval)); - if (win != 0 - && wcval != 0) { + if (win != NULL + && wcval != NULL) { int row, col; getyx(win, row, col); diff --git a/contrib/ncurses/ncurses/widechar/lib_in_wchnstr.c b/contrib/ncurses/ncurses/widechar/lib_in_wchnstr.c --- a/contrib/ncurses/ncurses/widechar/lib_in_wchnstr.c +++ b/contrib/ncurses/ncurses/widechar/lib_in_wchnstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 2002-2007,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,7 +40,7 @@ #include -MODULE_ID("$Id: lib_in_wchnstr.c,v 1.9 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_in_wchnstr.c,v 1.11 2024/12/07 18:03:14 tom Exp $") NCURSES_EXPORT(int) win_wchnstr(WINDOW *win, cchar_t *wchstr, int n) @@ -48,9 +48,9 @@ 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; + if (win != NULL + && wchstr != NULL) { + const NCURSES_CH_T *src; int row, col; int j, k, limit; diff --git a/contrib/ncurses/ncurses/widechar/lib_ins_wch.c b/contrib/ncurses/ncurses/widechar/lib_ins_wch.c --- a/contrib/ncurses/ncurses/widechar/lib_ins_wch.c +++ b/contrib/ncurses/ncurses/widechar/lib_ins_wch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2020,2023 Thomas E. Dickey * + * Copyright 2019-2024,2025 Thomas E. Dickey * * Copyright 2002-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,7 +40,7 @@ #include -MODULE_ID("$Id: lib_ins_wch.c,v 1.29 2023/11/21 21:53:28 tom Exp $") +MODULE_ID("$Id: lib_ins_wch.c,v 1.34 2025/06/21 22:26:21 tom Exp $") /* * Insert the given character, updating the current location to simplify @@ -63,7 +63,7 @@ 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; + const NCURSES_CH_T *temp2 = temp1 - cells; CHANGED_TO_EOL(line, win->_curx, win->_maxx); while (temp1 > end) @@ -87,7 +87,7 @@ T((T_CALLED("wins_wch(%p, %s)"), (void *) win, _tracecchar_t(wch))); - if (win != 0) { + if (win != NULL) { NCURSES_SIZE_T oy = win->_cury; NCURSES_SIZE_T ox = win->_curx; @@ -100,6 +100,14 @@ returnCode(code); } +static int +flush_wchars(WINDOW *win, wchar_t *wchars) +{ + cchar_t tmp_cchar; + (void) setcchar(&tmp_cchar, wchars, WA_NORMAL, (short) 0, (void *) 0); + return _nc_insert_wch(win, &tmp_cchar); +} + NCURSES_EXPORT(int) wins_nwstr(WINDOW *win, const wchar_t *wstr, int n) { @@ -108,9 +116,8 @@ T((T_CALLED("wins_nwstr(%p,%s,%d)"), (void *) win, _nc_viswbufn(wstr, n), n)); - if (win != 0 - && wstr != 0 - && n != 0) { + if (win != NULL + && wstr != NULL) { if (n < 0) { n = INT_MAX; @@ -122,27 +129,37 @@ SCREEN *sp = _nc_screen_of(win); NCURSES_SIZE_T oy = win->_cury; NCURSES_SIZE_T ox = win->_curx; + wchar_t tmp_wchars[1 + CCHARW_MAX]; + int num_wchars = 0; for (cp = wstr; ((cp - wstr) < n) && (*cp != L'\0'); 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 { + if (is7bits(*cp) && len <= 0) { + if (num_wchars) { + if ((code = flush_wchars(win, tmp_wchars)) != OK) + break; + num_wchars = 0; + } /* tabs, other ASCII stuff */ code = _nc_insert_ch(sp, win, (chtype) (*cp)); + } else { + if (num_wchars > 0 && len > 0) { + if ((code = flush_wchars(win, tmp_wchars)) != OK) + break; + num_wchars = 0; + } + if (num_wchars < CCHARW_MAX) { + tmp_wchars[num_wchars++] = *cp; + tmp_wchars[num_wchars] = L'\0'; + } } if (code != OK) break; } + if (code == OK && num_wchars) { + code = flush_wchars(win, tmp_wchars); + } win->_curx = ox; win->_cury = oy; diff --git a/contrib/ncurses/ncurses/widechar/lib_inwstr.c b/contrib/ncurses/ncurses/widechar/lib_inwstr.c --- a/contrib/ncurses/ncurses/widechar/lib_inwstr.c +++ b/contrib/ncurses/ncurses/widechar/lib_inwstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 2002-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -34,22 +34,22 @@ /* ** lib_inwstr.c ** -** The routines winnwstr() and winwstr(). +** The routine winnwstr(). ** */ #include -MODULE_ID("$Id: lib_inwstr.c,v 1.9 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_inwstr.c,v 1.14 2025/01/19 00:51:54 tom Exp $") NCURSES_EXPORT(int) winnwstr(WINDOW *win, wchar_t *wstr, int n) { int count = 0; - cchar_t *text; + const cchar_t *text; T((T_CALLED("winnwstr(%p,%p,%d)"), (void *) win, (void *) wstr, n)); - if (wstr != 0) { + if (wstr != NULL) { if (win) { int row, col; int last = 0; @@ -57,6 +57,9 @@ getyx(win, row, col); + if (n < 0) + n = CCHARW_MAX * (win->_maxx - win->_curx + 1); + text = win->_line[row].text; while (count < n && !done && count != ERR) { @@ -92,23 +95,3 @@ } 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/contrib/ncurses/ncurses/widechar/lib_key_name.c b/contrib/ncurses/ncurses/widechar/lib_key_name.c --- a/contrib/ncurses/ncurses/widechar/lib_key_name.c +++ b/contrib/ncurses/ncurses/widechar/lib_key_name.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2023 Thomas E. Dickey * + * Copyright 2020-2023,2024 Thomas E. Dickey * * Copyright 2007-2008,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -36,7 +36,7 @@ #include -MODULE_ID("$Id: lib_key_name.c,v 1.6 2023/06/03 12:15:34 tom Exp $") +MODULE_ID("$Id: lib_key_name.c,v 1.7 2024/07/27 19:23:59 tom Exp $") #define MyData _nc_globals.key_name @@ -44,7 +44,7 @@ key_name(wchar_t c) { cchar_t my_cchar; - wchar_t *my_wchars; + const wchar_t *my_wchars; size_t len; NCURSES_CONST char *result = NULL; diff --git a/contrib/ncurses/ncurses/widechar/lib_pecho_wchar.c b/contrib/ncurses/ncurses/widechar/lib_pecho_wchar.c --- a/contrib/ncurses/ncurses/widechar/lib_pecho_wchar.c +++ b/contrib/ncurses/ncurses/widechar/lib_pecho_wchar.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 2004,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,14 +33,14 @@ #include -MODULE_ID("$Id: lib_pecho_wchar.c,v 1.4 2021/10/23 17:07:56 tom Exp $") +MODULE_ID("$Id: lib_pecho_wchar.c,v 1.5 2024/12/07 20:08:15 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) + if (pad == NULL) returnCode(ERR); if (!IS_PAD(pad)) diff --git a/contrib/ncurses/ncurses/widechar/lib_slk_wset.c b/contrib/ncurses/ncurses/widechar/lib_slk_wset.c --- a/contrib/ncurses/ncurses/widechar/lib_slk_wset.c +++ b/contrib/ncurses/ncurses/widechar/lib_slk_wset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 2003-2011,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -41,7 +41,7 @@ #include #endif -MODULE_ID("$Id: lib_slk_wset.c,v 1.15 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_slk_wset.c,v 1.16 2024/12/07 20:08:15 tom Exp $") NCURSES_EXPORT(int) slk_wset(int i, const wchar_t *astr, int format) @@ -52,7 +52,7 @@ T((T_CALLED("slk_wset(%d, %s, %d)"), i, _nc_viswbuf(astr), format)); - if (astr != 0) { + if (astr != NULL) { size_t arglen; init_mb(state); @@ -61,7 +61,7 @@ if ((arglen = wcsrtombs(NULL, &str, (size_t) 0, &state)) != (size_t) -1) { char *mystr; - if ((mystr = (char *) _nc_doalloc(0, arglen + 1)) != 0) { + if ((mystr = (char *) _nc_doalloc(NULL, arglen + 1)) != NULL) { str = astr; if (wcsrtombs(mystr, &str, arglen, &state) != (size_t) -1) { /* glibc documentation claims that the terminating L'\0' diff --git a/contrib/ncurses/ncurses/widechar/lib_unget_wch.c b/contrib/ncurses/ncurses/widechar/lib_unget_wch.c --- a/contrib/ncurses/ncurses/widechar/lib_unget_wch.c +++ b/contrib/ncurses/ncurses/widechar/lib_unget_wch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2023 Thomas E. Dickey * + * Copyright 2020-2023,2024 Thomas E. Dickey * * Copyright 2002-2011,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,7 +40,7 @@ #include -MODULE_ID("$Id: lib_unget_wch.c,v 1.18 2023/06/03 12:50:52 tom Exp $") +MODULE_ID("$Id: lib_unget_wch.c,v 1.19 2024/12/07 20:08:15 tom Exp $") /* * Wrapper for wcrtomb() which obtains the length needed for the given @@ -51,7 +51,7 @@ { int result; - if (target == 0) { + if (target == NULL) { wchar_t temp[2]; const wchar_t *tempp = temp; temp[0] = source; @@ -75,13 +75,13 @@ T((T_CALLED("unget_wch(%p, %#lx)"), (void *) SP_PARM, (unsigned long) wch)); init_mb(state); - length = _nc_wcrtomb(0, wch, &state); + length = _nc_wcrtomb(NULL, wch, &state); if (length != (size_t) (-1) && length != 0) { char *string; - if ((string = (char *) malloc(length)) != 0) { + if ((string = (char *) malloc(length)) != NULL) { int n; init_mb(state); diff --git a/contrib/ncurses/ncurses/widechar/lib_vid_attr.c b/contrib/ncurses/ncurses/widechar/lib_vid_attr.c --- a/contrib/ncurses/ncurses/widechar/lib_vid_attr.c +++ b/contrib/ncurses/ncurses/widechar/lib_vid_attr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2023 Thomas E. Dickey * + * Copyright 2018-2023,2024 Thomas E. Dickey * * Copyright 2002-2014,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -37,7 +37,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_vid_attr.c,v 1.31 2023/04/28 20:59:34 tom Exp $") +MODULE_ID("$Id: lib_vid_attr.c,v 1.32 2024/12/07 20:08:59 tom Exp $") #define doPut(mode) \ TPUTS_TRACE(#mode); \ @@ -87,9 +87,9 @@ attr_t turn_on, turn_off; bool reverse = FALSE; - bool can_color = (SP_PARM == 0 || SP_PARM->_coloron); + bool can_color = (SP_PARM == NULL || SP_PARM->_coloron); #if NCURSES_EXT_FUNCS - bool fix_pair0 = (SP_PARM != 0 && SP_PARM->_coloron && !SP_PARM->_default_color); + bool fix_pair0 = (SP_PARM != NULL && SP_PARM->_coloron && !SP_PARM->_default_color); #else #define fix_pair0 FALSE #endif @@ -193,15 +193,15 @@ 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), + (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; diff --git a/contrib/ncurses/ncurses/widechar/lib_vline_set.c b/contrib/ncurses/ncurses/widechar/lib_vline_set.c --- a/contrib/ncurses/ncurses/widechar/lib_vline_set.c +++ b/contrib/ncurses/ncurses/widechar/lib_vline_set.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 2002-2010,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,7 +40,7 @@ #include -MODULE_ID("$Id: lib_vline_set.c,v 1.6 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_vline_set.c,v 1.7 2024/12/07 20:08:15 tom Exp $") NCURSES_EXPORT(int) wvline_set(WINDOW *win, const cchar_t *ch, int n) @@ -58,7 +58,7 @@ if (end > win->_maxy) end = win->_maxy; - if (ch == 0) + if (ch == NULL) wch = *WACS_VLINE; else wch = *ch; diff --git a/contrib/ncurses/ncurses/widechar/lib_wacs.c b/contrib/ncurses/ncurses/widechar/lib_wacs.c --- a/contrib/ncurses/ncurses/widechar/lib_wacs.c +++ b/contrib/ncurses/ncurses/widechar/lib_wacs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2018-2020,2024 Thomas E. Dickey * * Copyright 2002-2015,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,9 +33,9 @@ #include -MODULE_ID("$Id: lib_wacs.c,v 1.20 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_wacs.c,v 1.21 2024/12/07 20:08:32 tom Exp $") -NCURSES_EXPORT_VAR(cchar_t) * _nc_wacs = 0; +NCURSES_EXPORT_VAR(cchar_t) * _nc_wacs = NULL; NCURSES_EXPORT(void) _nc_init_wacs(void) @@ -119,7 +119,7 @@ T(("initializing WIDE-ACS map (Unicode is%s active)", active ? "" : " not")); - if ((_nc_wacs = typeCalloc(cchar_t, ACS_LEN)) != 0) { + if ((_nc_wacs = typeCalloc(cchar_t, ACS_LEN)) != NULL) { unsigned n; for (n = 0; n < SIZEOF(table); ++n) { diff --git a/contrib/ncurses/ncurses/widechar/lib_wunctrl.c b/contrib/ncurses/ncurses/widechar/lib_wunctrl.c --- a/contrib/ncurses/ncurses/widechar/lib_wunctrl.c +++ b/contrib/ncurses/ncurses/widechar/lib_wunctrl.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 2001-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -36,17 +36,18 @@ #include -MODULE_ID("$Id: lib_wunctrl.c,v 1.17 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_wunctrl.c,v 1.19 2024/12/07 18:03:14 tom Exp $") NCURSES_EXPORT(wchar_t *) NCURSES_SP_NAME(wunctrl) (NCURSES_SP_DCLx cchar_t *wc) { - static wchar_t str[CCHARW_MAX + 1], *wsp; + static wchar_t str[CCHARW_MAX + 1]; wchar_t *result; - if (wc == 0) { - result = 0; - } else if (SP_PARM != 0 && Charable(*wc)) { + if (wc == NULL) { + result = NULL; + } else if (SP_PARM != NULL && Charable(*wc)) { + wchar_t *wsp; const char *p = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx (unsigned) _nc_to_char((wint_t)CharOf(*wc))); diff --git a/contrib/ncurses/ncurses/widechar/widechars.c b/contrib/ncurses/ncurses/widechar/widechars.c --- a/contrib/ncurses/ncurses/widechar/widechars.c +++ b/contrib/ncurses/ncurses/widechar/widechars.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 2012,2013 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -31,9 +31,9 @@ #if USE_WIDEC_SUPPORT -MODULE_ID("$Id: widechars.c,v 1.9 2020/08/29 16:22:03 juergen Exp $") +MODULE_ID("$Id: widechars.c,v 1.11 2025/02/20 01:02:09 tom Exp $") -#if (defined(_NC_WINDOWS)) && !defined(_NC_MSC) +#if defined(_NC_MINGW) /* * MinGW has wide-character functions, but they do not work correctly. */ @@ -45,7 +45,7 @@ int count; int try; - if (s != 0 && n != 0) { + if (s != NULL && n != 0) { /* * MultiByteToWideChar() can decide to return more than one * wide-character. We want only one. Ignore any trailing null, both @@ -96,7 +96,7 @@ int count; wchar_t temp; - if (s != 0 && n != 0) { + if (s != NULL && n != 0) { count = _nc_mbtowc(&temp, s, n); if (count == 1) { int check = WideCharToMultiByte(CP_UTF8, @@ -148,6 +148,6 @@ return result; } -#endif /* _NC_WINDOWS */ +#endif /* _NC_MINGW */ #endif /* USE_WIDEC_SUPPORT */ diff --git a/contrib/ncurses/ncurses/win32con/gettimeofday.c b/contrib/ncurses/ncurses/win32con/gettimeofday.c --- a/contrib/ncurses/ncurses/win32con/gettimeofday.c +++ b/contrib/ncurses/ncurses/win32con/gettimeofday.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2023 Thomas E. Dickey * + * Copyright 2020-2023,2025 Thomas E. Dickey * * Copyright 2008-2010,2014 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,16 +27,11 @@ * authorization. * ****************************************************************************/ -#ifdef WINVER -# undef WINVER -#endif -#define WINVER 0x0501 - #include #include -MODULE_ID("$Id: gettimeofday.c,v 1.7 2023/02/25 20:05:36 tom Exp $") +MODULE_ID("$Id: gettimeofday.c,v 1.8 2025/08/30 17:59:42 tom Exp $") #if HAVE_GETTIMEOFDAY == 2 #define JAN1970 116444736000000000LL /* the value for 01/01/1970 00:00 */ diff --git a/contrib/ncurses/ncurses/win32con/wcwidth.c b/contrib/ncurses/ncurses/win32con/wcwidth.c --- a/contrib/ncurses/ncurses/win32con/wcwidth.c +++ b/contrib/ncurses/ncurses/win32con/wcwidth.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,7 +28,7 @@ ****************************************************************************/ #include -MODULE_ID("$Id: wcwidth.c,v 1.4 2020/07/11 21:02:10 tom Exp $") +MODULE_ID("$Id: wcwidth.c,v 1.5 2024/05/04 18:31:39 tom Exp $") #if USE_WIDEC_SUPPORT #define mk_wcwidth(ucs) _nc_wcwidth(ucs) @@ -36,10 +36,11 @@ #define mk_wcwidth_cjk(ucs) _nc_wcwidth_cjk(ucs) #define mk_wcswidth_cjk(pwcs, n) _nc_wcswidth_cjk(pwcs, n) -NCURSES_EXPORT(int) mk_wcwidth(wchar_t); -NCURSES_EXPORT(int) mk_wcswidth(const wchar_t *, size_t); -NCURSES_EXPORT(int) mk_wcwidth_cjk(wchar_t); -NCURSES_EXPORT(int) mk_wcswidth_cjk(const wchar_t *, size_t); +NCURSES_EXPORT(void) mk_wcwidth_init(int); +NCURSES_EXPORT(int) mk_wcwidth(uint32_t); +NCURSES_EXPORT(int) mk_wcswidth(const uint32_t *, size_t); +NCURSES_EXPORT(int) mk_wcwidth_cjk(uint32_t); +NCURSES_EXPORT(int) mk_wcswidth_cjk(const uint32_t *, size_t); #include #else diff --git a/contrib/ncurses/ncurses/win32con/win32_driver.c b/contrib/ncurses/ncurses/win32con/win32_driver.c --- a/contrib/ncurses/ncurses/win32con/win32_driver.c +++ b/contrib/ncurses/ncurses/win32con/win32_driver.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 2008-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,41 +38,29 @@ */ #include -#ifdef _NC_WINDOWS -#if (defined(__MINGW32__) || defined(__MINGW64__)) -#include -#else -#include -#endif -#include #define CUR TerminalType(my_term). -MODULE_ID("$Id: win32_driver.c,v 1.4 2023/09/16 16:29:24 tom Exp $") +MODULE_ID("$Id: win32_driver.c,v 1.20 2025/12/30 19:34:50 tom Exp $") #define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE) #define EXP_OPTIMIZE 0 -static bool console_initialized = FALSE; +#define AssertTCB() assert(TCB != NULL && (TCB->magic == WINMAGIC)) +#define validateConsoleHandle() (AssertTCB(), console_initialized || \ + (console_initialized = \ + _nc_console_checkinit(USE_NAMED_PIPES))) +#define SetSP() assert(TCB->csp != NULL); sp = TCB->csp; (void) sp -#define AssertTCB() assert(TCB != 0 && (TCB->magic == WINMAGIC)) -#define validateConsoleHandle() (AssertTCB() , console_initialized ||\ - (console_initialized=\ - _nc_console_checkinit(TRUE,FALSE))) -#define SetSP() assert(TCB->csp != 0); sp = TCB->csp; (void) sp -#define AdjustY() (WINCONSOLE.buffered ?\ - 0 : (int) WINCONSOLE.SBI.srWindow.Top) -#define RevAttr(attr) (WORD) (((attr) & 0xff00) | \ - ((((attr) & 0x07) << 4) | \ - (((attr) & 0x70) >> 4))) +#define AdjustY() (WINCONSOLE.buffered \ + ? 0 \ + : (int) WINCONSOLE.SBI.srWindow.Top) -#if USE_WIDEC_SUPPORT -#define write_screen WriteConsoleOutputW -#define read_screen ReadConsoleOutputW -#else -#define write_screen WriteConsoleOutput -#define read_screen ReadConsoleOutput -#endif +#define RevAttr(attr) (WORD) (((attr) & 0xff00) | \ + ((((attr) & 0x07) << 4) | \ + (((attr) & 0x70) >> 4))) + +static bool console_initialized = FALSE; static WORD MapAttr(WORD res, attr_t ch) @@ -140,7 +128,7 @@ for (i = save_region.Top; i <= save_region.Bottom; ++i) { for (j = save_region.Left; j <= save_region.Right; ++j) { - output[k++] = save_screen[ij++].Char.AsciiChar; + output[k++] = save_screen[ij++].CharInfoChar; } output[k++] = '\n'; } @@ -171,7 +159,7 @@ int y, int x, cchar_t *str, int limit) { int actual = 0; - CHAR_INFO *ci = TypeAlloca(CHAR_INFO, limit); + MakeArray(ci, CHAR_INFO, limit); COORD loc, siz; SMALL_RECT rec; int i; @@ -185,7 +173,7 @@ ch = str[i]; if (isWidecExt(ch)) continue; - ci[actual].Char.UnicodeChar = CharOf(ch); + ci[actual].CharInfoChar = CharOf(ch); ci[actual].Attributes = MapAttr(WINCONSOLE.SBI.wAttributes, AttrOf(ch)); if (AttrOf(ch) & A_ALTCHARSET) { @@ -194,9 +182,9 @@ if (which > 0 && which < ACS_LEN && CharOf(_nc_wacs[which]) != 0) { - ci[actual].Char.UnicodeChar = CharOf(_nc_wacs[which]); + ci[actual].CharInfoChar = CharOf(_nc_wacs[which]); } else { - ci[actual].Char.UnicodeChar = ' '; + ci[actual].CharInfoChar = ' '; } } } @@ -220,7 +208,7 @@ static BOOL con_write8(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, chtype *str, int n) { - CHAR_INFO *ci = TypeAlloca(CHAR_INFO, n); + MakeArray(ci, CHAR_INFO, n); COORD loc, siz; SMALL_RECT rec; int i; @@ -232,13 +220,13 @@ for (i = 0; i < n; i++) { ch = str[i]; - ci[i].Char.AsciiChar = ChCharOf(ch); + ci[i].CharInfoChar = ChCharOf(ch); ci[i].Attributes = MapAttr(WINCONSOLE.SBI.wAttributes, ChAttrOf(ch)); if (ChAttrOf(ch) & A_ALTCHARSET) { if (sp->_acs_map) - ci[i].Char.AsciiChar = - ChCharOf(NCURSES_SP_NAME(_nc_acs_char) (sp, ChCharOf(ch))); + ci[i].CharInfoChar = + ChCharOf(NCURSES_SP_NAME(_nc_acs_char) (sp, ChCharOf(ch))); } } @@ -415,16 +403,16 @@ if ((CurScreen(sp)->_clear || NewScreen(sp)->_clear)) { int x; #if USE_WIDEC_SUPPORT - cchar_t *empty = TypeAlloca(cchar_t, Width); + MakeArray(empty, cchar_t, Width); wchar_t blank[2] = { L' ', L'\0' }; for (x = 0; x < Width; x++) - setcchar(&empty[x], blank, 0, 0, 0); + setcchar(&empty[x], blank, 0, 0, NULL); #else - chtype *empty = TypeAlloca(chtype, Width); + MakeArray(empty, chtype, Width); for (x = 0; x < Width; x++) empty[x] = ' '; @@ -528,16 +516,17 @@ { bool code = FALSE; - T((T_CALLED("win32con::wcon_CanHandle(%p)"), TCB)); + T((T_CALLED("win32con::wcon_CanHandle(%p,%s,%p)"), + (void *) TCB, NonNull(tname), (void *) errret)); - assert((TCB != 0) && (tname != 0)); + assert(TCB != NULL); TCB->magic = WINMAGIC; - if (tname == 0 || *tname == 0) { + if (tname == NULL || *tname == 0) { if (!_nc_console_vt_supported()) code = TRUE; - } else if (tname != 0 && *tname == '#') { + } else if (tname != NULL && *tname == '#') { /* * Use "#" (a character which cannot begin a terminal's name) to * select specific driver from the table. @@ -551,9 +540,14 @@ || (strncmp(tname + 1, "win32con", n) == 0))) { code = TRUE; } - } else if (tname != 0 && stricmp(tname, "unknown") == 0) { + } else if (tname != NULL && stricmp(tname, "unknown") == 0) { code = TRUE; } +#if !USE_NAMED_PIPES + else if (_isatty(TCB->term.Filedes)) { + code = TRUE; + } +#endif /* * This is intentional, to avoid unnecessary breakage of applications @@ -589,8 +583,8 @@ int max_cells = (high * wide); int i; - CHAR_INFO *this_screen = TypeAlloca(CHAR_INFO, max_cells); - CHAR_INFO *that_screen = TypeAlloca(CHAR_INFO, max_cells); + MakeArray(this_screen, CHAR_INFO, max_cells); + MakeArray(that_screen, CHAR_INFO, max_cells); COORD this_size; SMALL_RECT this_region; COORD bufferCoord; @@ -752,9 +746,6 @@ returnCode(result); } -#define MIN_WIDE 80 -#define MIN_HIGH 24 - static int wcon_mode(TERMINAL_CONTROL_BLOCK * TCB, int progFlag, int defFlag) { @@ -762,12 +753,12 @@ TERMINAL *_term = (TERMINAL *) TCB; int code = ERR; + T((T_CALLED("win32con::wcon_mode(%p, progFlag=%d, defFlag=%d)"), + TCB, progFlag, defFlag)); + if (validateConsoleHandle()) { sp = TCB->csp; - T((T_CALLED("win32con::wcon_mode(%p, progFlag=%d, defFlag=%d)"), - TCB, progFlag, defFlag)); - WINCONSOLE.progMode = progFlag; WINCONSOLE.lastOut = progFlag ? WINCONSOLE.hdl : WINCONSOLE.out; SetConsoleActiveScreenBuffer(WINCONSOLE.lastOut); @@ -847,7 +838,7 @@ AssertTCB(); - if (!(console_initialized = _nc_console_checkinit(TRUE, FALSE))) { + if (!(console_initialized = _nc_console_checkinit(USE_NAMED_PIPES))) { returnVoid; } @@ -1059,7 +1050,7 @@ for (n = 0; n < SIZEOF(table); ++n) { real_map[table[n].acs_code] = (chtype) table[n].use_code | A_ALTCHARSET; - if (sp != 0) + if (sp != NULL) sp->_screen_acs_map[table[n].acs_code] = TRUE; } } @@ -1221,5 +1212,3 @@ wcon_kyExist, /* kyExist */ wcon_cursorSet /* cursorSet */ }; - -#endif /* _NC_WINDOWS */ diff --git a/contrib/ncurses/ncurses/win32con/win_driver.c b/contrib/ncurses/ncurses/win32con/win_driver.c deleted file mode 100644 --- a/contrib/ncurses/ncurses/win32con/win_driver.c +++ /dev/null @@ -1,2282 +0,0 @@ -/**************************************************************************** - * Copyright 2018-2021,2023 Thomas E. Dickey * - * Copyright 2008-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 * - * and: Thomas E. Dickey * - ****************************************************************************/ - -/* - * TODO - GetMousePos(POINT * result) from ntconio.c - * TODO - implement nodelay - * TODO - improve screen-repainting performance, using implied wraparound to reduce write's - * TODO - make it optional whether screen is restored or not when non-buffered - */ - -#include - -#ifdef _WIN32 -#include -#else -#include -#include -#endif - -#include - -#define PSAPI_VERSION 2 -#include - -#define CUR TerminalType(my_term). - -#define CONTROL_PRESSED (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED) - -MODULE_ID("$Id: win_driver.c,v 1.74 2023/09/16 16:27:44 tom Exp $") - -#define TypeAlloca(type,count) (type*) _alloca(sizeof(type) * (size_t) (count)) - -#define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE) - -#define EXP_OPTIMIZE 0 - -#define array_length(a) (sizeof(a)/sizeof(a[0])) - -static bool InitConsole(void); -static bool okConsoleHandle(TERMINAL_CONTROL_BLOCK *); - -#define AssertTCB() assert(TCB != 0 && (TCB->magic == WINMAGIC)) -#define SetSP() assert(TCB->csp != 0); sp = TCB->csp; (void) sp - -#define GenMap(vKey,key) MAKELONG(key, vKey) - -#define AdjustY() (CON.buffered ? 0 : (int) CON.SBI.srWindow.Top) - -#if USE_WIDEC_SUPPORT -#define write_screen WriteConsoleOutputW -#define read_screen ReadConsoleOutputW -#else -#define write_screen WriteConsoleOutput -#define read_screen ReadConsoleOutput -#endif -/* *INDENT-OFF* */ -static const LONG keylist[] = -{ - GenMap(VK_PRIOR, KEY_PPAGE), - GenMap(VK_NEXT, KEY_NPAGE), - GenMap(VK_END, KEY_END), - GenMap(VK_HOME, KEY_HOME), - GenMap(VK_LEFT, KEY_LEFT), - GenMap(VK_UP, KEY_UP), - GenMap(VK_RIGHT, KEY_RIGHT), - GenMap(VK_DOWN, KEY_DOWN), - GenMap(VK_DELETE, KEY_DC), - GenMap(VK_INSERT, KEY_IC) -}; -static const LONG ansi_keys[] = -{ - GenMap(VK_PRIOR, 'I'), - GenMap(VK_NEXT, 'Q'), - GenMap(VK_END, 'O'), - GenMap(VK_HOME, 'H'), - GenMap(VK_LEFT, 'K'), - GenMap(VK_UP, 'H'), - GenMap(VK_RIGHT, 'M'), - GenMap(VK_DOWN, 'P'), - GenMap(VK_DELETE, 'S'), - GenMap(VK_INSERT, 'R') -}; -/* *INDENT-ON* */ -#define N_INI ((int)array_length(keylist)) -#define FKEYS 24 -#define MAPSIZE (FKEYS + N_INI) -#define NUMPAIRS 64 - -/* A process can only have a single console, so it is safe - to maintain all the information about it in a single - static structure. - */ -static struct { - BOOL initialized; - BOOL buffered; - BOOL window_only; - BOOL progMode; - BOOL isTermInfoConsole; - HANDLE out; - HANDLE inp; - HANDLE hdl; - HANDLE lastOut; - int numButtons; - DWORD ansi_map[MAPSIZE]; - DWORD map[MAPSIZE]; - DWORD rmap[MAPSIZE]; - WORD pairs[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; -} CON; - -static BOOL console_initialized = FALSE; - -static WORD -MapColor(bool fore, int color) -{ - static const int _cmap[] = - {0, 4, 2, 6, 1, 5, 3, 7}; - int a; - if (color < 0 || color > 7) - a = fore ? 7 : 0; - else - a = _cmap[color]; - if (!fore) - a = a << 4; - return (WORD) a; -} - -#define RevAttr(attr) \ - (WORD) (((attr) & 0xff00) | \ - ((((attr) & 0x07) << 4) | \ - (((attr) & 0x70) >> 4))) - -static WORD -MapAttr(WORD res, attr_t ch) -{ - if (ch & A_COLOR) { - int p; - - p = PairNumber(ch); - if (p > 0 && p < NUMPAIRS) { - WORD a; - a = CON.pairs[p]; - res = (WORD) ((res & 0xff00) | a); - } - } - - if (ch & A_REVERSE) { - res = RevAttr(res); - } - - if (ch & A_STANDOUT) { - res = RevAttr(res) | BACKGROUND_INTENSITY; - } - - if (ch & A_BOLD) - res |= FOREGROUND_INTENSITY; - - if (ch & A_DIM) - res |= BACKGROUND_INTENSITY; - - return res; -} - -#if 0 /* def TRACE */ -static void -dump_screen(const char *fn, int ln) -{ - int max_cells = (CON.SBI.dwSize.Y * (1 + CON.SBI.dwSize.X)) + 1; - char output[max_cells]; - CHAR_INFO save_screen[max_cells]; - COORD save_size; - SMALL_RECT save_region; - COORD bufferCoord; - - T(("dump_screen %s@%d", fn, ln)); - - save_region.Top = CON.SBI.srWindow.Top; - save_region.Left = CON.SBI.srWindow.Left; - save_region.Bottom = CON.SBI.srWindow.Bottom; - save_region.Right = CON.SBI.srWindow.Right; - - save_size.X = (SHORT) (save_region.Right - save_region.Left + 1); - save_size.Y = (SHORT) (save_region.Bottom - save_region.Top + 1); - - bufferCoord.X = bufferCoord.Y = 0; - - if (read_screen(CON.hdl, - save_screen, - save_size, - bufferCoord, - &save_region)) { - int i, j; - int ij = 0; - int k = 0; - - for (i = save_region.Top; i <= save_region.Bottom; ++i) { - for (j = save_region.Left; j <= save_region.Right; ++j) { - output[k++] = save_screen[ij++].Char.AsciiChar; - } - output[k++] = '\n'; - } - output[k] = 0; - - T(("DUMP: %d,%d - %d,%d", - save_region.Top, - save_region.Left, - save_region.Bottom, - save_region.Right)); - T(("%s", output)); - } -} - -#else -#define dump_screen(fn,ln) /* nothing */ -#endif - -#if USE_WIDEC_SUPPORT -/* - * TODO: support surrogate pairs - * TODO: support combining characters - * TODO: support acsc - * TODO: _nc_wacs should be part of sp. - */ -static BOOL -con_write16(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, cchar_t *str, int limit) -{ - int actual = 0; - CHAR_INFO *ci = TypeAlloca(CHAR_INFO, limit); - COORD loc, siz; - SMALL_RECT rec; - int i; - cchar_t ch; - SCREEN *sp; - - AssertTCB(); - SetSP(); - - for (i = actual = 0; i < limit; i++) { - ch = str[i]; - if (isWidecExt(ch)) - continue; - ci[actual].Char.UnicodeChar = CharOf(ch); - ci[actual].Attributes = MapAttr(CON.SBI.wAttributes, - AttrOf(ch)); - if (AttrOf(ch) & A_ALTCHARSET) { - if (_nc_wacs) { - int which = CharOf(ch); - if (which > 0 - && which < ACS_LEN - && CharOf(_nc_wacs[which]) != 0) { - ci[actual].Char.UnicodeChar = CharOf(_nc_wacs[which]); - } else { - ci[actual].Char.UnicodeChar = ' '; - } - } - } - ++actual; - } - - loc.X = (SHORT) 0; - loc.Y = (SHORT) 0; - siz.X = (SHORT) actual; - siz.Y = 1; - - rec.Left = (SHORT) x; - rec.Top = (SHORT) (y + AdjustY()); - rec.Right = (SHORT) (x + limit - 1); - rec.Bottom = rec.Top; - - return write_screen(CON.hdl, ci, siz, loc, &rec); -} -#define con_write(tcb, y, x, str, n) con_write16(tcb, y, x, str, n) -#else -static BOOL -con_write8(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, chtype *str, int n) -{ - CHAR_INFO *ci = TypeAlloca(CHAR_INFO, n); - COORD loc, siz; - SMALL_RECT rec; - int i; - chtype ch; - SCREEN *sp; - - AssertTCB(); - SetSP(); - - for (i = 0; i < n; i++) { - ch = str[i]; - ci[i].Char.AsciiChar = ChCharOf(ch); - ci[i].Attributes = MapAttr(CON.SBI.wAttributes, - ChAttrOf(ch)); - if (ChAttrOf(ch) & A_ALTCHARSET) { - if (sp->_acs_map) - ci[i].Char.AsciiChar = - ChCharOf(NCURSES_SP_NAME(_nc_acs_char) (sp, ChCharOf(ch))); - } - } - - loc.X = (short) 0; - loc.Y = (short) 0; - siz.X = (short) n; - siz.Y = 1; - - rec.Left = (short) x; - rec.Top = (short) y; - rec.Right = (short) (x + n - 1); - rec.Bottom = rec.Top; - - return write_screen(CON.hdl, ci, siz, loc, &rec); -} -#define con_write(tcb, y, x, str, n) con_write8(tcb, y, x, str, n) -#endif - -#if EXP_OPTIMIZE -/* - * Comparing new/current screens, determine the last column-index for a change - * beginning on the given row,col position. Unlike a serial terminal, there is - * no cost for "moving" the "cursor" on the line as we update it. - */ -static int -find_end_of_change(SCREEN *sp, int row, int col) -{ - int result = col; - struct ldat *curdat = CurScreen(sp)->_line + row; - struct ldat *newdat = NewScreen(sp)->_line + row; - - while (col <= newdat->lastchar) { -#if USE_WIDEC_SUPPORT - if (isWidecExt(curdat->text[col]) || isWidecExt(newdat->text[col])) { - result = col; - } else if (memcmp(&curdat->text[col], - &newdat->text[col], - sizeof(curdat->text[0]))) { - result = col; - } else { - break; - } -#else - if (curdat->text[col] != newdat->text[col]) { - result = col; - } else { - break; - } -#endif - ++col; - } - return result; -} - -/* - * Given a row,col position at the end of a change-chunk, look for the - * beginning of the next change-chunk. - */ -static int -find_next_change(SCREEN *sp, int row, int col) -{ - struct ldat *curdat = CurScreen(sp)->_line + row; - struct ldat *newdat = NewScreen(sp)->_line + row; - int result = newdat->lastchar + 1; - - while (++col <= newdat->lastchar) { -#if USE_WIDEC_SUPPORT - if (isWidecExt(curdat->text[col]) != isWidecExt(newdat->text[col])) { - result = col; - break; - } else if (memcmp(&curdat->text[col], - &newdat->text[col], - sizeof(curdat->text[0]))) { - result = col; - break; - } -#else - if (curdat->text[col] != newdat->text[col]) { - result = col; - break; - } -#endif - } - return result; -} - -#define EndChange(first) \ - find_end_of_change(sp, y, first) -#define NextChange(last) \ - find_next_change(sp, y, last) - -#endif /* EXP_OPTIMIZE */ - -#define MARK_NOCHANGE(win,row) \ - win->_line[row].firstchar = _NOCHANGE; \ - win->_line[row].lastchar = _NOCHANGE - -static void -selectActiveHandle(void) -{ - if (CON.lastOut != CON.hdl) { - CON.lastOut = CON.hdl; - SetConsoleActiveScreenBuffer(CON.lastOut); - } -} - -static bool -restore_original_screen(void) -{ - COORD bufferCoord; - bool result = FALSE; - SMALL_RECT save_region = CON.save_region; - - T(("... restoring %s", CON.window_only ? "window" : "entire buffer")); - - bufferCoord.X = (SHORT) (CON.window_only ? CON.SBI.srWindow.Left : 0); - bufferCoord.Y = (SHORT) (CON.window_only ? CON.SBI.srWindow.Top : 0); - - if (write_screen(CON.hdl, - CON.save_screen, - CON.save_size, - bufferCoord, - &save_region)) { - result = TRUE; - mvcur(-1, -1, LINES - 2, 0); - T(("... restore original screen contents ok %dx%d (%d,%d - %d,%d)", - CON.save_size.Y, - CON.save_size.X, - save_region.Top, - save_region.Left, - save_region.Bottom, - save_region.Right)); - } else { - T(("... restore original screen contents err")); - } - return result; -} - -static const char * -wcon_name(TERMINAL_CONTROL_BLOCK * TCB) -{ - (void) TCB; - return "win32console"; -} - -static int -wcon_doupdate(TERMINAL_CONTROL_BLOCK * TCB) -{ - int result = ERR; - int y, nonempty, n, x0, x1, Width, Height; - SCREEN *sp; - - T((T_CALLED("win32con::wcon_doupdate(%p)"), TCB)); - if (okConsoleHandle(TCB)) { - SetSP(); - - Width = screen_columns(sp); - Height = screen_lines(sp); - nonempty = Min(Height, NewScreen(sp)->_maxy + 1); - - T(("... %dx%d clear cur:%d new:%d", - Height, Width, - CurScreen(sp)->_clear, - NewScreen(sp)->_clear)); - - 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 ((CurScreen(sp)->_clear || NewScreen(sp)->_clear)) { - int x; -#if USE_WIDEC_SUPPORT - cchar_t *empty = TypeAlloca(cchar_t, Width); - wchar_t blank[2] = - { - L' ', L'\0' - }; - - for (x = 0; x < Width; x++) - setcchar(&empty[x], blank, 0, 0, 0); -#else - chtype *empty = TypeAlloca(chtype, Width); - - for (x = 0; x < Width; x++) - empty[x] = ' '; -#endif - - for (y = 0; y < nonempty; y++) { - con_write(TCB, y, 0, empty, Width); - memcpy(empty, - CurScreen(sp)->_line[y].text, - (size_t) Width * sizeof(empty[0])); - } - CurScreen(sp)->_clear = FALSE; - NewScreen(sp)->_clear = FALSE; - touchwin(NewScreen(sp)); - T(("... cleared %dx%d lines @%d of screen", nonempty, Width, - AdjustY())); - } - - for (y = 0; y < nonempty; y++) { - x0 = NewScreen(sp)->_line[y].firstchar; - if (x0 != _NOCHANGE) { -#if EXP_OPTIMIZE - int x2; - int limit = NewScreen(sp)->_line[y].lastchar; - while ((x1 = EndChange(x0)) <= limit) { - while ((x2 = NextChange(x1)) <= limit && x2 <= (x1 + 2)) { - x1 = x2; - } - n = x1 - x0 + 1; - memcpy(&CurScreen(sp)->_line[y].text[x0], - &NewScreen(sp)->_line[y].text[x0], - n * sizeof(CurScreen(sp)->_line[y].text[x0])); - con_write(TCB, - y, - x0, - &CurScreen(sp)->_line[y].text[x0], n); - x0 = NextChange(x1); - } - - /* mark line changed successfully */ - if (y <= NewScreen(sp)->_maxy) { - MARK_NOCHANGE(NewScreen(sp), y); - } - if (y <= CurScreen(sp)->_maxy) { - MARK_NOCHANGE(CurScreen(sp), y); - } -#else - x1 = NewScreen(sp)->_line[y].lastchar; - n = x1 - x0 + 1; - if (n > 0) { - memcpy(&CurScreen(sp)->_line[y].text[x0], - &NewScreen(sp)->_line[y].text[x0], - (size_t) n * sizeof(CurScreen(sp)->_line[y].text[x0])); - con_write(TCB, - y, - x0, - &CurScreen(sp)->_line[y].text[x0], n); - - /* mark line changed successfully */ - if (y <= NewScreen(sp)->_maxy) { - MARK_NOCHANGE(NewScreen(sp), y); - } - if (y <= CurScreen(sp)->_maxy) { - MARK_NOCHANGE(CurScreen(sp), y); - } - } -#endif - } - } - - /* put everything back in sync */ - for (y = nonempty; y <= NewScreen(sp)->_maxy; y++) { - MARK_NOCHANGE(NewScreen(sp), y); - } - for (y = nonempty; y <= CurScreen(sp)->_maxy; y++) { - MARK_NOCHANGE(CurScreen(sp), y); - } - - if (!NewScreen(sp)->_leaveok) { - CurScreen(sp)->_curx = NewScreen(sp)->_curx; - CurScreen(sp)->_cury = NewScreen(sp)->_cury; - - TCB->drv->td_hwcur(TCB, - 0, 0, - CurScreen(sp)->_cury, CurScreen(sp)->_curx); - } - selectActiveHandle(); - result = OK; - } - returnCode(result); -} - -#ifdef __MING32__ -#define SysISATTY(fd) _isatty(fd) -#else -#define SysISATTY(fd) isatty(fd) -#endif - -static bool -wcon_CanHandle(TERMINAL_CONTROL_BLOCK * TCB, - const char *tname, - int *errret GCC_UNUSED) -{ - bool code = FALSE; - - T((T_CALLED("win32con::wcon_CanHandle(%p)"), TCB)); - - assert((TCB != 0) && (tname != 0)); - - TCB->magic = WINMAGIC; - - if (tname == 0 || *tname == 0) - code = TRUE; - else if (tname != 0 && *tname == '#') { - /* - * Use "#" (a character which cannot begin a terminal's name) to - * select specific driver from the table. - * - * In principle, we could have more than one non-terminfo driver, - * e.g., "win32gui". - */ - size_t n = strlen(tname + 1); - if (n != 0 - && ((strncmp(tname + 1, "win32console", n) == 0) - || (strncmp(tname + 1, "win32con", n) == 0))) { - code = TRUE; - } - } else if (tname != 0 && stricmp(tname, "unknown") == 0) { - code = TRUE; - } else if (SysISATTY(TCB->term.Filedes)) { - code = TRUE; - } - - /* - * This is intentional, to avoid unnecessary breakage of applications - * using symbols. - */ - if (code && (TerminalType(&TCB->term).Booleans == 0)) { - _nc_init_termtype(&TerminalType(&TCB->term)); -#if NCURSES_EXT_NUMBERS - _nc_export_termtype2(&TCB->term.type, &TerminalType(&TCB->term)); -#endif - } - - if (!code) { - if (_nc_mingw_isconsole(0)) - CON.isTermInfoConsole = TRUE; - } - returnBool(code); -} - -static int -wcon_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB, - int beepFlag) -{ - SCREEN *sp; - int res = ERR; - - int high = (CON.SBI.srWindow.Bottom - CON.SBI.srWindow.Top + 1); - int wide = (CON.SBI.srWindow.Right - CON.SBI.srWindow.Left + 1); - int max_cells = (high * wide); - int i; - - CHAR_INFO *this_screen = TypeAlloca(CHAR_INFO, max_cells); - CHAR_INFO *that_screen = TypeAlloca(CHAR_INFO, max_cells); - COORD this_size; - SMALL_RECT this_region; - COORD bufferCoord; - - if (okConsoleHandle(TCB)) { - SetSP(); - this_region.Top = CON.SBI.srWindow.Top; - this_region.Left = CON.SBI.srWindow.Left; - this_region.Bottom = CON.SBI.srWindow.Bottom; - this_region.Right = CON.SBI.srWindow.Right; - - this_size.X = (SHORT) wide; - this_size.Y = (SHORT) high; - - bufferCoord.X = this_region.Left; - bufferCoord.Y = this_region.Top; - - if (!beepFlag && - read_screen(CON.hdl, - this_screen, - this_size, - bufferCoord, - &this_region)) { - - memcpy(that_screen, - this_screen, - sizeof(CHAR_INFO) * (size_t) max_cells); - - for (i = 0; i < max_cells; i++) { - that_screen[i].Attributes = RevAttr(that_screen[i].Attributes); - } - - write_screen(CON.hdl, that_screen, this_size, bufferCoord, &this_region); - Sleep(200); - write_screen(CON.hdl, this_screen, this_size, bufferCoord, &this_region); - - } else { - MessageBeep(MB_ICONWARNING); /* MB_OK might be better */ - } - res = OK; - } - return res; -} - -static int -wcon_print(TERMINAL_CONTROL_BLOCK * TCB, - char *data GCC_UNUSED, - int len GCC_UNUSED) -{ - SCREEN *sp; - - AssertTCB(); - SetSP(); - - return ERR; -} - -static int -wcon_defaultcolors(TERMINAL_CONTROL_BLOCK * TCB, - int fg GCC_UNUSED, - int bg GCC_UNUSED) -{ - SCREEN *sp; - int code = ERR; - - AssertTCB(); - SetSP(); - - return (code); -} - -static bool -get_SBI(void) -{ - bool rc = FALSE; - if (GetConsoleScreenBufferInfo(CON.hdl, &(CON.SBI))) { - T(("GetConsoleScreenBufferInfo")); - T(("... buffer(X:%d Y:%d)", - CON.SBI.dwSize.X, - CON.SBI.dwSize.Y)); - T(("... window(X:%d Y:%d)", - CON.SBI.dwMaximumWindowSize.X, - CON.SBI.dwMaximumWindowSize.Y)); - T(("... cursor(X:%d Y:%d)", - CON.SBI.dwCursorPosition.X, - CON.SBI.dwCursorPosition.Y)); - T(("... display(Top:%d Bottom:%d Left:%d Right:%d)", - CON.SBI.srWindow.Top, - CON.SBI.srWindow.Bottom, - CON.SBI.srWindow.Left, - CON.SBI.srWindow.Right)); - if (CON.buffered) { - CON.origin.X = 0; - CON.origin.Y = 0; - } else { - CON.origin.X = CON.SBI.srWindow.Left; - CON.origin.Y = CON.SBI.srWindow.Top; - } - rc = TRUE; - } else { - T(("GetConsoleScreenBufferInfo ERR")); - } - return rc; -} - -static void -wcon_setcolor(TERMINAL_CONTROL_BLOCK * TCB, - int fore, - int color, - int (*outc) (SCREEN *, int) GCC_UNUSED) -{ - if (okConsoleHandle(TCB)) { - WORD a = MapColor(fore, color); - a |= (WORD) ((CON.SBI.wAttributes) & (fore ? 0xfff8 : 0xff8f)); - SetConsoleTextAttribute(CON.hdl, a); - get_SBI(); - } -} - -static bool -wcon_rescol(TERMINAL_CONTROL_BLOCK * TCB) -{ - bool res = FALSE; - - if (okConsoleHandle(TCB)) { - WORD a = FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN; - SetConsoleTextAttribute(CON.hdl, a); - get_SBI(); - res = TRUE; - } - return res; -} - -static bool -wcon_rescolors(TERMINAL_CONTROL_BLOCK * TCB) -{ - int result = FALSE; - SCREEN *sp; - - AssertTCB(); - SetSP(); - - return result; -} - -static int -wcon_size(TERMINAL_CONTROL_BLOCK * TCB, int *Lines, int *Cols) -{ - int result = ERR; - - T((T_CALLED("win32con::wcon_size(%p)"), TCB)); - - if (okConsoleHandle(TCB) && - Lines != NULL && - Cols != NULL) { - if (CON.buffered) { - *Lines = (int) (CON.SBI.dwSize.Y); - *Cols = (int) (CON.SBI.dwSize.X); - } else { - *Lines = (int) (CON.SBI.srWindow.Bottom + 1 - - CON.SBI.srWindow.Top); - *Cols = (int) (CON.SBI.srWindow.Right + 1 - - CON.SBI.srWindow.Left); - } - result = OK; - } - returnCode(result); -} - -static int -wcon_setsize(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED, - int l GCC_UNUSED, - int c GCC_UNUSED) -{ - AssertTCB(); - return ERR; -} - -static int -wcon_sgmode(TERMINAL_CONTROL_BLOCK * TCB, int setFlag, TTY * buf) -{ - DWORD dwFlag = 0; - tcflag_t iflag; - tcflag_t lflag; - int result = ERR; - - if (buf != NULL && okConsoleHandle(TCB)) { - - if (setFlag) { - iflag = buf->c_iflag; - lflag = buf->c_lflag; - - GetConsoleMode(CON.inp, &dwFlag); - - if (lflag & ICANON) - dwFlag |= ENABLE_LINE_INPUT; - else - dwFlag &= (DWORD) (~ENABLE_LINE_INPUT); - - if (lflag & ECHO) - dwFlag |= ENABLE_ECHO_INPUT; - else - dwFlag &= (DWORD) (~ENABLE_ECHO_INPUT); - - if (iflag & BRKINT) - dwFlag |= ENABLE_PROCESSED_INPUT; - else - dwFlag &= (DWORD) (~ENABLE_PROCESSED_INPUT); - - dwFlag |= ENABLE_MOUSE_INPUT; - - buf->c_iflag = iflag; - buf->c_lflag = lflag; - SetConsoleMode(CON.inp, dwFlag); - TCB->term.Nttyb = *buf; - } else { - iflag = TCB->term.Nttyb.c_iflag; - lflag = TCB->term.Nttyb.c_lflag; - GetConsoleMode(CON.inp, &dwFlag); - - if (dwFlag & ENABLE_LINE_INPUT) - lflag |= ICANON; - else - lflag &= (tcflag_t) (~ICANON); - - if (dwFlag & ENABLE_ECHO_INPUT) - lflag |= ECHO; - else - lflag &= (tcflag_t) (~ECHO); - - if (dwFlag & ENABLE_PROCESSED_INPUT) - iflag |= BRKINT; - else - iflag &= (tcflag_t) (~BRKINT); - - TCB->term.Nttyb.c_iflag = iflag; - TCB->term.Nttyb.c_lflag = lflag; - - *buf = TCB->term.Nttyb; - } - result = OK; - } - return result; -} - -#define MIN_WIDE 80 -#define MIN_HIGH 24 - -/* - * In "normal" mode, reset the buffer- and window-sizes back to their original values. - */ -static void -set_scrollback(bool normal, CONSOLE_SCREEN_BUFFER_INFO * info) -{ - SMALL_RECT rect; - COORD coord; - bool changed = FALSE; - - T((T_CALLED("win32con::set_scrollback(%s)"), - (normal - ? "normal" - : "application"))); - - T(("... SBI.srWindow %d,%d .. %d,%d", - info->srWindow.Top, - info->srWindow.Left, - info->srWindow.Bottom, - info->srWindow.Right)); - T(("... SBI.dwSize %dx%d", - info->dwSize.Y, - info->dwSize.X)); - - if (normal) { - rect = info->srWindow; - coord = info->dwSize; - if (memcmp(info, &CON.SBI, sizeof(*info)) != 0) { - changed = TRUE; - CON.SBI = *info; - } - } else { - int high = info->srWindow.Bottom - info->srWindow.Top + 1; - int wide = info->srWindow.Right - info->srWindow.Left + 1; - - if (high < MIN_HIGH) { - T(("... height %d < %d", high, MIN_HIGH)); - high = MIN_HIGH; - changed = TRUE; - } - if (wide < MIN_WIDE) { - T(("... width %d < %d", wide, MIN_WIDE)); - wide = MIN_WIDE; - changed = TRUE; - } - - rect.Left = - rect.Top = 0; - rect.Right = (SHORT) (wide - 1); - rect.Bottom = (SHORT) (high - 1); - - coord.X = (SHORT) wide; - coord.Y = (SHORT) high; - - if (info->dwSize.Y != high || - info->dwSize.X != wide || - info->srWindow.Top != 0 || - info->srWindow.Left != 0) { - changed = TRUE; - } - - } - - if (changed) { - T(("... coord %d,%d", coord.Y, coord.X)); - T(("... rect %d,%d - %d,%d", - rect.Top, rect.Left, - rect.Bottom, rect.Right)); - SetConsoleScreenBufferSize(CON.hdl, coord); /* dwSize */ - SetConsoleWindowInfo(CON.hdl, TRUE, &rect); /* srWindow */ - get_SBI(); - } - returnVoid; -} - -static int -wcon_mode(TERMINAL_CONTROL_BLOCK * TCB, int progFlag, int defFlag) -{ - SCREEN *sp; - TERMINAL *_term = (TERMINAL *) TCB; - int code = ERR; - - if (okConsoleHandle(TCB)) { - sp = TCB->csp; - - T((T_CALLED("win32con::wcon_mode(%p, prog=%d, def=%d)"), - TCB, progFlag, defFlag)); - - CON.progMode = progFlag; - CON.lastOut = progFlag ? CON.hdl : CON.out; - SetConsoleActiveScreenBuffer(CON.lastOut); - - if (progFlag) /* prog mode */ { - if (defFlag) { - if ((wcon_sgmode(TCB, FALSE, &(_term->Nttyb)) == OK)) { - _term->Nttyb.c_oflag &= (tcflag_t) (~OFLAGS_TABS); - code = OK; - } - } else { - /* reset_prog_mode */ - if (wcon_sgmode(TCB, TRUE, &(_term->Nttyb)) == OK) { - if (sp) { - if (sp->_keypad_on) - _nc_keypad(sp, TRUE); - } - if (!CON.buffered) { - set_scrollback(FALSE, &CON.SBI); - } - code = OK; - } - } - T(("... buffered:%d, clear:%d", CON.buffered, CurScreen(sp)->_clear)); - } else { /* shell mode */ - if (defFlag) { - /* def_shell_mode */ - if (wcon_sgmode(TCB, FALSE, &(_term->Ottyb)) == OK) { - code = OK; - } - } else { - /* reset_shell_mode */ - if (sp) { - _nc_keypad(sp, FALSE); - NCURSES_SP_NAME(_nc_flush) (sp); - } - code = wcon_sgmode(TCB, TRUE, &(_term->Ottyb)); - if (!CON.buffered) { - set_scrollback(TRUE, &CON.save_SBI); - if (!restore_original_screen()) - code = ERR; - } - SetConsoleCursorInfo(CON.hdl, &CON.save_CI); - } - } - - } - returnCode(code); -} - -static void -wcon_screen_init(SCREEN *sp GCC_UNUSED) -{ -} - -static void -wcon_wrap(SCREEN *sp GCC_UNUSED) -{ -} - -static int -rkeycompare(const void *el1, const void *el2) -{ - WORD key1 = (LOWORD((*((const LONG *) el1)))) & 0x7fff; - WORD key2 = (LOWORD((*((const LONG *) el2)))) & 0x7fff; - - return ((key1 < key2) ? -1 : ((key1 == key2) ? 0 : 1)); -} - -static int -keycompare(const void *el1, const void *el2) -{ - WORD key1 = HIWORD((*((const LONG *) el1))); - WORD key2 = HIWORD((*((const LONG *) el2))); - - return ((key1 < key2) ? -1 : ((key1 == key2) ? 0 : 1)); -} - -static int -MapKey(WORD vKey) -{ - WORD nKey = 0; - void *res; - LONG key = GenMap(vKey, 0); - int code = -1; - - res = bsearch(&key, - CON.map, - (size_t) (N_INI + FKEYS), - sizeof(keylist[0]), - keycompare); - if (res) { - key = *((LONG *) res); - nKey = LOWORD(key); - code = (int) (nKey & 0x7fff); - if (nKey & 0x8000) - code = -code; - } - return code; -} - -static int -AnsiKey(WORD vKey) -{ - WORD nKey = 0; - void *res; - LONG key = GenMap(vKey, 0); - int code = -1; - - res = bsearch(&key, - CON.ansi_map, - (size_t) (N_INI + FKEYS), - sizeof(keylist[0]), - keycompare); - if (res) { - key = *((LONG *) res); - nKey = LOWORD(key); - code = (int) (nKey & 0x7fff); - if (nKey & 0x8000) - code = -code; - } - return code; -} - -static void -wcon_release(TERMINAL_CONTROL_BLOCK * TCB) -{ - T((T_CALLED("win32con::wcon_release(%p)"), TCB)); - - AssertTCB(); - if (TCB->prop) - free(TCB->prop); - - returnVoid; -} - -static bool -read_screen_data(void) -{ - bool result = FALSE; - COORD bufferCoord; - size_t want; - - CON.save_size.X = (SHORT) (CON.save_region.Right - - CON.save_region.Left + 1); - CON.save_size.Y = (SHORT) (CON.save_region.Bottom - - CON.save_region.Top + 1); - - want = (size_t) (CON.save_size.X * CON.save_size.Y); - - if ((CON.save_screen = malloc(want * sizeof(CHAR_INFO))) != 0) { - bufferCoord.X = (SHORT) (CON.window_only ? CON.SBI.srWindow.Left : 0); - bufferCoord.Y = (SHORT) (CON.window_only ? CON.SBI.srWindow.Top : 0); - - T(("... reading console %s %dx%d into %d,%d - %d,%d at %d,%d", - CON.window_only ? "window" : "buffer", - CON.save_size.Y, CON.save_size.X, - CON.save_region.Top, - CON.save_region.Left, - CON.save_region.Bottom, - CON.save_region.Right, - bufferCoord.Y, - bufferCoord.X)); - - if (read_screen(CON.hdl, - CON.save_screen, - CON.save_size, - bufferCoord, - &CON.save_region)) { - result = TRUE; - } else { - T((" error %#lx", (unsigned long) GetLastError())); - FreeAndNull(CON.save_screen); - } - } - - return result; -} - -/* - * Attempt to save the screen contents. PDCurses does this if - * PDC_RESTORE_SCREEN is set, giving the same visual appearance on - * restoration as if the library had allocated a console buffer. MSDN - * says that the data which can be read is limited to 64Kb (and may be - * less). - */ -static bool -save_original_screen(void) -{ - bool result = FALSE; - - CON.save_region.Top = 0; - CON.save_region.Left = 0; - CON.save_region.Bottom = (SHORT) (CON.SBI.dwSize.Y - 1); - CON.save_region.Right = (SHORT) (CON.SBI.dwSize.X - 1); - - if (read_screen_data()) { - result = TRUE; - } else { - - CON.save_region.Top = CON.SBI.srWindow.Top; - CON.save_region.Left = CON.SBI.srWindow.Left; - CON.save_region.Bottom = CON.SBI.srWindow.Bottom; - CON.save_region.Right = CON.SBI.srWindow.Right; - - CON.window_only = TRUE; - - if (read_screen_data()) { - result = TRUE; - } - } - - T(("... save original screen contents %s", result ? "ok" : "err")); - return result; -} - -static void -wcon_init(TERMINAL_CONTROL_BLOCK * TCB) -{ - T((T_CALLED("win32con::wcon_init(%p)"), TCB)); - - AssertTCB(); - - if (TCB) { - if (!InitConsole()) { - returnVoid; - } - - TCB->info.initcolor = TRUE; - TCB->info.canchange = FALSE; - TCB->info.hascolor = TRUE; - TCB->info.caninit = TRUE; - - TCB->info.maxpairs = NUMPAIRS; - TCB->info.maxcolors = 8; - TCB->info.numlabels = 0; - TCB->info.labelwidth = 0; - TCB->info.labelheight = 0; - TCB->info.nocolorvideo = 1; - TCB->info.tabsize = 8; - - TCB->info.numbuttons = CON.numButtons; - TCB->info.defaultPalette = _nc_cga_palette; - - } - returnVoid; -} - -static void -wcon_initpair(TERMINAL_CONTROL_BLOCK * TCB, - int pair, - int f, - int b) -{ - SCREEN *sp; - - if (okConsoleHandle(TCB)) { - SetSP(); - - if ((pair > 0) && (pair < NUMPAIRS) && (f >= 0) && (f < 8) - && (b >= 0) && (b < 8)) { - CON.pairs[pair] = MapColor(true, f) | MapColor(false, b); - } - } -} - -static void -wcon_initcolor(TERMINAL_CONTROL_BLOCK * TCB, - int color GCC_UNUSED, - int r GCC_UNUSED, - int g GCC_UNUSED, - int b GCC_UNUSED) -{ - SCREEN *sp; - - AssertTCB(); - SetSP(); -} - -static void -wcon_do_color(TERMINAL_CONTROL_BLOCK * TCB, - int old_pair GCC_UNUSED, - int pair GCC_UNUSED, - int reverse GCC_UNUSED, - int (*outc) (SCREEN *, int) GCC_UNUSED -) -{ - SCREEN *sp; - - AssertTCB(); - SetSP(); -} - -static void -wcon_initmouse(TERMINAL_CONTROL_BLOCK * TCB) -{ - SCREEN *sp; - - if (okConsoleHandle(TCB)) { - SetSP(); - - sp->_mouse_type = M_TERM_DRIVER; - } -} - -static int -wcon_testmouse(TERMINAL_CONTROL_BLOCK * TCB, - int delay - EVENTLIST_2nd(_nc_eventlist * evl)) -{ - int rc = 0; - SCREEN *sp; - - if (okConsoleHandle(TCB)) { - SetSP(); - - if (sp->_drv_mouse_head < sp->_drv_mouse_tail) { - rc = TW_MOUSE; - } else { - rc = TCBOf(sp)->drv->td_twait(TCBOf(sp), - TWAIT_MASK, - delay, - (int *) 0 - EVENTLIST_2nd(evl)); - } - } - - return rc; -} - -static int -wcon_mvcur(TERMINAL_CONTROL_BLOCK * TCB, - int yold GCC_UNUSED, int xold GCC_UNUSED, - int y, int x) -{ - int ret = ERR; - if (okConsoleHandle(TCB)) { - COORD loc; - loc.X = (short) x; - loc.Y = (short) (y + AdjustY()); - SetConsoleCursorPosition(CON.hdl, loc); - ret = OK; - } - return ret; -} - -static void -wcon_hwlabel(TERMINAL_CONTROL_BLOCK * TCB, - int labnum GCC_UNUSED, - char *text GCC_UNUSED) -{ - SCREEN *sp; - - AssertTCB(); - SetSP(); -} - -static void -wcon_hwlabelOnOff(TERMINAL_CONTROL_BLOCK * TCB, - int OnFlag GCC_UNUSED) -{ - SCREEN *sp; - - AssertTCB(); - SetSP(); -} - -static chtype -wcon_conattr(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED) -{ - chtype res = A_NORMAL; - res |= (A_BOLD | A_DIM | A_REVERSE | A_STANDOUT | A_COLOR); - return res; -} - -static void -wcon_setfilter(TERMINAL_CONTROL_BLOCK * TCB) -{ - SCREEN *sp; - - AssertTCB(); - SetSP(); -} - -static void -wcon_initacs(TERMINAL_CONTROL_BLOCK * TCB, - chtype *real_map GCC_UNUSED, - chtype *fake_map GCC_UNUSED) -{ -#define DATA(a,b) { a, b } - static struct { - int acs_code; - int use_code; - } table[] = { - DATA('a', 0xb1), /* ACS_CKBOARD */ - DATA('f', 0xf8), /* ACS_DEGREE */ - DATA('g', 0xf1), /* ACS_PLMINUS */ - DATA('j', 0xd9), /* ACS_LRCORNER */ - DATA('l', 0xda), /* ACS_ULCORNER */ - DATA('k', 0xbf), /* ACS_URCORNER */ - DATA('m', 0xc0), /* ACS_LLCORNER */ - DATA('n', 0xc5), /* ACS_PLUS */ - DATA('q', 0xc4), /* ACS_HLINE */ - DATA('t', 0xc3), /* ACS_LTEE */ - DATA('u', 0xb4), /* ACS_RTEE */ - DATA('v', 0xc1), /* ACS_BTEE */ - DATA('w', 0xc2), /* ACS_TTEE */ - DATA('x', 0xb3), /* ACS_VLINE */ - DATA('y', 0xf3), /* ACS_LEQUAL */ - DATA('z', 0xf2), /* ACS_GEQUAL */ - DATA('0', 0xdb), /* ACS_BLOCK */ - DATA('{', 0xe3), /* ACS_PI */ - DATA('}', 0x9c), /* ACS_STERLING */ - DATA(',', 0xae), /* ACS_LARROW */ - DATA('+', 0xaf), /* ACS_RARROW */ - DATA('~', 0xf9), /* ACS_BULLET */ - }; -#undef DATA - unsigned n; - - SCREEN *sp; - if (okConsoleHandle(TCB)) { - SetSP(); - - for (n = 0; n < SIZEOF(table); ++n) { - real_map[table[n].acs_code] = (chtype) table[n].use_code | A_ALTCHARSET; - if (sp != 0) - sp->_screen_acs_map[table[n].acs_code] = TRUE; - } - } -} - -static ULONGLONG -tdiff(FILETIME fstart, FILETIME fend) -{ - ULARGE_INTEGER ustart; - ULARGE_INTEGER uend; - ULONGLONG diff; - - ustart.LowPart = fstart.dwLowDateTime; - ustart.HighPart = fstart.dwHighDateTime; - uend.LowPart = fend.dwLowDateTime; - uend.HighPart = fend.dwHighDateTime; - - diff = (uend.QuadPart - ustart.QuadPart) / 10000; - return diff; -} - -static int -Adjust(int milliseconds, int diff) -{ - if (milliseconds != INFINITY) { - milliseconds -= diff; - if (milliseconds < 0) - milliseconds = 0; - } - return milliseconds; -} - -#define BUTTON_MASK (FROM_LEFT_1ST_BUTTON_PRESSED | \ - FROM_LEFT_2ND_BUTTON_PRESSED | \ - FROM_LEFT_3RD_BUTTON_PRESSED | \ - FROM_LEFT_4TH_BUTTON_PRESSED | \ - RIGHTMOST_BUTTON_PRESSED) - -static mmask_t -decode_mouse(SCREEN *sp, int mask) -{ - mmask_t result = 0; - - (void) sp; - assert(sp && console_initialized); - - if (mask & FROM_LEFT_1ST_BUTTON_PRESSED) - result |= BUTTON1_PRESSED; - if (mask & FROM_LEFT_2ND_BUTTON_PRESSED) - result |= BUTTON2_PRESSED; - if (mask & FROM_LEFT_3RD_BUTTON_PRESSED) - result |= BUTTON3_PRESSED; - if (mask & FROM_LEFT_4TH_BUTTON_PRESSED) - result |= BUTTON4_PRESSED; - - if (mask & RIGHTMOST_BUTTON_PRESSED) { - switch (CON.numButtons) { - case 1: - result |= BUTTON1_PRESSED; - break; - case 2: - result |= BUTTON2_PRESSED; - break; - case 3: - result |= BUTTON3_PRESSED; - break; - case 4: - result |= BUTTON4_PRESSED; - break; - } - } - - return result; -} - -static int -console_twait( - SCREEN *sp, - HANDLE fd, - int mode, - int milliseconds, - int *timeleft - EVENTLIST_2nd(_nc_eventlist * evl)) -{ - INPUT_RECORD inp_rec; - BOOL b; - DWORD nRead = 0, rc = (DWORD) (-1); - int code = 0; - FILETIME fstart; - FILETIME fend; - int diff; - bool isImmed = (milliseconds == 0); - -#ifdef NCURSES_WGETCH_EVENTS - (void) evl; /* TODO: implement wgetch-events */ -#endif - -#define CONSUME() ReadConsoleInput(fd,&inp_rec,1,&nRead) - - assert(sp); - - TR(TRACE_IEVENT, ("start twait: %d milliseconds, mode: %d", - milliseconds, mode)); - - if (milliseconds < 0) - milliseconds = INFINITY; - - memset(&inp_rec, 0, sizeof(inp_rec)); - - while (true) { - GetSystemTimeAsFileTime(&fstart); - rc = WaitForSingleObject(fd, (DWORD) milliseconds); - GetSystemTimeAsFileTime(&fend); - diff = (int) tdiff(fstart, fend); - milliseconds = Adjust(milliseconds, diff); - - if (!isImmed && milliseconds <= 0) - break; - - if (rc == WAIT_OBJECT_0) { - if (mode) { - b = GetNumberOfConsoleInputEvents(fd, &nRead); - if (b && nRead > 0) { - b = PeekConsoleInput(fd, &inp_rec, 1, &nRead); - if (b && nRead > 0) { - switch (inp_rec.EventType) { - case KEY_EVENT: - if (mode & TW_INPUT) { - WORD vk = inp_rec.Event.KeyEvent.wVirtualKeyCode; - char ch = inp_rec.Event.KeyEvent.uChar.AsciiChar; - - if (inp_rec.Event.KeyEvent.bKeyDown) { - if (0 == ch) { - int nKey = MapKey(vk); - if (nKey < 0) { - CONSUME(); - continue; - } - } - code = TW_INPUT; - goto end; - } else { - CONSUME(); - } - } - continue; - case MOUSE_EVENT: - if (decode_mouse(sp, - (inp_rec.Event.MouseEvent.dwButtonState - & BUTTON_MASK)) == 0) { - CONSUME(); - } else if (mode & TW_MOUSE) { - code = TW_MOUSE; - goto end; - } - continue; - /* e.g., FOCUS_EVENT */ - default: - CONSUME(); - selectActiveHandle(); - continue; - } - } - } - } - continue; - } else { - if (rc != WAIT_TIMEOUT) { - code = -1; - break; - } else { - code = 0; - break; - } - } - } - end: - - TR(TRACE_IEVENT, ("end twait: returned %d (%d), remaining time %d msec", - code, errno, milliseconds)); - - if (timeleft) - *timeleft = milliseconds; - - return code; -} - -static int -wcon_twait(TERMINAL_CONTROL_BLOCK * TCB, - int mode, - int milliseconds, - int *timeleft - EVENTLIST_2nd(_nc_eventlist * evl)) -{ - SCREEN *sp; - int code = 0; - - if (okConsoleHandle(TCB)) { - SetSP(); - - code = console_twait(sp, - CON.inp, - mode, - milliseconds, - timeleft EVENTLIST_2nd(evl)); - } - return code; -} - -static bool -handle_mouse(SCREEN *sp, MOUSE_EVENT_RECORD mer) -{ - MEVENT work; - bool result = FALSE; - - assert(sp); - - sp->_drv_mouse_old_buttons = sp->_drv_mouse_new_buttons; - sp->_drv_mouse_new_buttons = mer.dwButtonState & BUTTON_MASK; - - /* - * We're only interested if the button is pressed or released. - * FIXME: implement continuous event-tracking. - */ - if (sp->_drv_mouse_new_buttons != sp->_drv_mouse_old_buttons) { - - memset(&work, 0, sizeof(work)); - - if (sp->_drv_mouse_new_buttons) { - - work.bstate |= decode_mouse(sp, sp->_drv_mouse_new_buttons); - - } else { - - /* cf: BUTTON_PRESSED, BUTTON_RELEASED */ - work.bstate |= (decode_mouse(sp, - sp->_drv_mouse_old_buttons) - >> 1); - - result = TRUE; - } - - work.x = mer.dwMousePosition.X; - work.y = mer.dwMousePosition.Y - AdjustY(); - - sp->_drv_mouse_fifo[sp->_drv_mouse_tail] = work; - sp->_drv_mouse_tail += 1; - } - - return result; -} - -static int -wcon_read(TERMINAL_CONTROL_BLOCK * TCB, int *buf) -{ - SCREEN *sp; - int n = -1; - - T((T_CALLED("win32con::wcon_read(%p)"), TCB)); - - assert(buf); - if (okConsoleHandle(TCB)) { - SetSP(); - - n = _nc_mingw_console_read(sp, CON.inp, buf); - } - returnCode(n); -} - -static int -wcon_nap(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED, int ms) -{ - T((T_CALLED("win32con::wcon_nap(%p, %d)"), TCB, ms)); - Sleep((DWORD) ms); - returnCode(OK); -} - -static int -wcon_cursorSet(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED, int mode) -{ - int res = -1; - - T((T_CALLED("win32con:wcon_cursorSet(%d)"), mode)); - if (okConsoleHandle(TCB)) { - CONSOLE_CURSOR_INFO this_CI = CON.save_CI; - switch (mode) { - case 0: - this_CI.bVisible = FALSE; - break; - case 1: - break; - case 2: - this_CI.dwSize = 100; - break; - } - SetConsoleCursorInfo(CON.hdl, &this_CI); - } - returnCode(res); -} - -static bool -wcon_kyExist(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED, int keycode) -{ - WORD nKey; - void *res; - bool found = FALSE; - LONG key = GenMap(0, (WORD) keycode); - - T((T_CALLED("win32con::wcon_kyExist(%d)"), keycode)); - res = bsearch(&key, - CON.rmap, - (size_t) (N_INI + FKEYS), - sizeof(keylist[0]), - rkeycompare); - if (res) { - key = *((LONG *) res); - nKey = LOWORD(key); - if (!(nKey & 0x8000)) - found = TRUE; - } - returnCode(found); -} - -static int -wcon_kpad(TERMINAL_CONTROL_BLOCK * TCB, int flag GCC_UNUSED) -{ - SCREEN *sp; - int code = ERR; - - T((T_CALLED("win32con::wcon_kpad(%p, %d)"), TCB, flag)); - - if (okConsoleHandle(TCB)) { - SetSP(); - - if (sp) { - code = OK; - } - } - returnCode(code); -} - -static int -wcon_keyok(TERMINAL_CONTROL_BLOCK * TCB, - int keycode, - int flag) -{ - int code = ERR; - SCREEN *sp; - WORD nKey; - WORD vKey; - void *res; - LONG key = GenMap(0, (WORD) keycode); - - T((T_CALLED("win32con::wcon_keyok(%p, %d, %d)"), TCB, keycode, flag)); - - if (okConsoleHandle(TCB)) { - SetSP(); - - if (sp) { - res = bsearch(&key, - CON.rmap, - (size_t) (N_INI + FKEYS), - sizeof(keylist[0]), - rkeycompare); - if (res) { - key = *((LONG *) res); - vKey = HIWORD(key); - nKey = (LOWORD(key)) & 0x7fff; - if (!flag) - nKey |= 0x8000; - *(LONG *) res = GenMap(vKey, nKey); - } - } - } - returnCode(code); -} - -NCURSES_EXPORT_VAR (TERM_DRIVER) _nc_WIN_DRIVER = { - FALSE, - wcon_name, /* Name */ - wcon_CanHandle, /* CanHandle */ - wcon_init, /* init */ - wcon_release, /* release */ - wcon_size, /* size */ - wcon_sgmode, /* sgmode */ - wcon_conattr, /* conattr */ - wcon_mvcur, /* hwcur */ - wcon_mode, /* mode */ - wcon_rescol, /* rescol */ - wcon_rescolors, /* rescolors */ - wcon_setcolor, /* color */ - wcon_dobeepflash, /* DoBeepFlash */ - wcon_initpair, /* initpair */ - wcon_initcolor, /* initcolor */ - wcon_do_color, /* docolor */ - wcon_initmouse, /* initmouse */ - wcon_testmouse, /* testmouse */ - wcon_setfilter, /* setfilter */ - wcon_hwlabel, /* hwlabel */ - wcon_hwlabelOnOff, /* hwlabelOnOff */ - wcon_doupdate, /* update */ - wcon_defaultcolors, /* defaultcolors */ - wcon_print, /* print */ - wcon_size, /* getsize */ - wcon_setsize, /* setsize */ - wcon_initacs, /* initacs */ - wcon_screen_init, /* scinit */ - wcon_wrap, /* scexit */ - wcon_twait, /* twait */ - wcon_read, /* read */ - wcon_nap, /* nap */ - wcon_kpad, /* kpad */ - wcon_keyok, /* kyOk */ - wcon_kyExist, /* kyExist */ - wcon_cursorSet /* cursorSet */ -}; - -/* --------------------------------------------------------- */ - -static HANDLE -get_handle(int fd) -{ - intptr_t value = _get_osfhandle(fd); - return (HANDLE) value; -} - -#if WINVER >= 0x0600 -/* This function tests, whether or not the ncurses application - is running as a descendant of MSYS2/cygwin mintty terminal - application. mintty doesn't use Windows Console for its screen - I/O, so the native Windows _isatty doesn't recognize it as - character device. But we can discover we are at the end of an - Pipe and can query to server side of the pipe, looking whether - or not this is mintty. - */ -static int -_ismintty(int fd, LPHANDLE pMinTTY) -{ - HANDLE handle = get_handle(fd); - DWORD dw; - int code = 0; - - T((T_CALLED("win32con::_ismintty(%d, %p)"), fd, pMinTTY)); - - if (handle != INVALID_HANDLE_VALUE) { - dw = GetFileType(handle); - if (dw == FILE_TYPE_PIPE) { - if (GetNamedPipeInfo(handle, 0, 0, 0, 0)) { - ULONG pPid; - /* Requires NT6 */ - if (GetNamedPipeServerProcessId(handle, &pPid)) { - TCHAR buf[MAX_PATH]; - DWORD len = 0; - /* These security attributes may allow us to - create a remote thread in mintty to manipulate - the terminal state remotely */ - HANDLE pHandle = OpenProcess( - PROCESS_CREATE_THREAD - | PROCESS_QUERY_INFORMATION - | PROCESS_VM_OPERATION - | PROCESS_VM_WRITE - | PROCESS_VM_READ, - FALSE, - pPid); - if (pMinTTY) - *pMinTTY = INVALID_HANDLE_VALUE; - if (pHandle != INVALID_HANDLE_VALUE) { - if ((len = GetProcessImageFileName( - pHandle, - buf, - (DWORD) - array_length(buf)))) { - TCHAR *pos = _tcsrchr(buf, _T('\\')); - if (pos) { - pos++; - if (_tcsnicmp(pos, _TEXT("mintty.exe"), 10) - == 0) { - if (pMinTTY) - *pMinTTY = pHandle; - code = 1; - } - } - } - } - } - } - } - } - returnCode(code); -} -#endif - -/* Borrowed from ansicon project. - Check whether or not an I/O handle is associated with - a Windows console. -*/ -static BOOL -IsConsoleHandle(HANDLE hdl) -{ - DWORD dwFlag = 0; - BOOL result; - - if (!GetConsoleMode(hdl, &dwFlag)) { - result = (int) WriteConsoleA(hdl, NULL, 0, &dwFlag, NULL); - } else { - result = (int) (dwFlag & ENABLE_PROCESSED_OUTPUT); - } - return result; -} - -/* Our replacement for the systems _isatty to include also - a test for mintty. This is called from the NC_ISATTY macro - defined in curses.priv.h - */ -int -_nc_mingw_isatty(int fd) -{ - int result = 0; - - if (SysISATTY(fd)) { - result = 1; - } else { -#if WINVER >= 0x0600 - result = _ismintty(fd, NULL); -#endif - } - return result; -} - -/* This is used when running in terminfo mode to discover, - whether or not the "terminal" is actually a Windows - Console. It is the responsibility of the console to deal - with the terminal escape sequences that are sent by - terminfo. - */ -int -_nc_mingw_isconsole(int fd) -{ - HANDLE hdl = get_handle(fd); - int code = 0; - - T((T_CALLED("win32con::_nc_mingw_isconsole(%d)"), fd)); - - code = (int) IsConsoleHandle(hdl); - - returnCode(code); -} - -#define TC_PROLOGUE(fd) \ - SCREEN *sp; \ - TERMINAL *term = 0; \ - int code = ERR; \ - if (_nc_screen_chain == 0) \ - return 0; \ - for (each_screen(sp)) { \ - if (sp->_term && (sp->_term->Filedes == fd)) { \ - term = sp->_term; \ - break; \ - } \ - } \ - assert(term != 0) - -int -_nc_mingw_tcsetattr( - int fd, - int optional_action GCC_UNUSED, - const struct termios *arg) -{ - TC_PROLOGUE(fd); - - if (_nc_mingw_isconsole(fd)) { - DWORD dwFlag = 0; - HANDLE ofd = get_handle(fd); - if (ofd != INVALID_HANDLE_VALUE) { - if (arg) { - if (arg->c_lflag & ICANON) - dwFlag |= ENABLE_LINE_INPUT; - else - dwFlag = dwFlag & (DWORD) (~ENABLE_LINE_INPUT); - - if (arg->c_lflag & ECHO) - dwFlag = dwFlag | ENABLE_ECHO_INPUT; - else - dwFlag = dwFlag & (DWORD) (~ENABLE_ECHO_INPUT); - - if (arg->c_iflag & BRKINT) - dwFlag |= ENABLE_PROCESSED_INPUT; - else - dwFlag = dwFlag & (DWORD) (~ENABLE_PROCESSED_INPUT); - } - dwFlag |= ENABLE_MOUSE_INPUT; - SetConsoleMode(ofd, dwFlag); - code = OK; - } - } - if (arg) - term->Nttyb = *arg; - - return code; -} - -int -_nc_mingw_tcgetattr(int fd, struct termios *arg) -{ - TC_PROLOGUE(fd); - - if (_nc_mingw_isconsole(fd)) { - if (arg) - *arg = term->Nttyb; - } - return code; -} - -int -_nc_mingw_tcflush(int fd, int queue) -{ - TC_PROLOGUE(fd); - (void) term; - - if (_nc_mingw_isconsole(fd)) { - if (queue == TCIFLUSH) { - BOOL b = FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE)); - if (!b) - return (int) GetLastError(); - } - } - return code; -} - -int -_nc_mingw_testmouse( - SCREEN *sp, - HANDLE fd, - int delay - EVENTLIST_2nd(_nc_eventlist * evl)) -{ - int rc = 0; - - assert(sp); - - if (sp->_drv_mouse_head < sp->_drv_mouse_tail) { - rc = TW_MOUSE; - } else { - rc = console_twait(sp, - fd, - TWAIT_MASK, - delay, - (int *) 0 - EVENTLIST_2nd(evl)); - } - return rc; -} - -int -_nc_mingw_console_read( - SCREEN *sp, - HANDLE fd, - int *buf) -{ - int rc = -1; - INPUT_RECORD inp_rec; - BOOL b; - DWORD nRead; - WORD vk; - - assert(sp); - assert(buf); - - memset(&inp_rec, 0, sizeof(inp_rec)); - - T((T_CALLED("_nc_mingw_console_read(%p)"), sp)); - - while ((b = ReadConsoleInput(fd, &inp_rec, 1, &nRead))) { - if (b && nRead > 0) { - if (rc < 0) - rc = 0; - rc = rc + (int) nRead; - if (inp_rec.EventType == KEY_EVENT) { - if (!inp_rec.Event.KeyEvent.bKeyDown) - continue; - *buf = (int) inp_rec.Event.KeyEvent.uChar.AsciiChar; - vk = inp_rec.Event.KeyEvent.wVirtualKeyCode; - /* - * There are 24 virtual function-keys (defined in winuser.h), - * and typically 12 function-keys on a keyboard. Use the - * shift-modifier to provide the remaining keys. - */ - if (vk >= VK_F1 && vk <= VK_F12) { - if (inp_rec.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED) { - vk = (WORD) (vk + 12); - } - } - if (*buf == 0) { - int key = MapKey(vk); - if (key < 0) - continue; - if (sp->_keypad_on) { - *buf = key; - } else { - ungetch('\0'); - *buf = AnsiKey(vk); - } - } else if (vk == VK_BACK) { - if (!(inp_rec.Event.KeyEvent.dwControlKeyState - & (SHIFT_PRESSED | CONTROL_PRESSED))) { - *buf = KEY_BACKSPACE; - } - } - break; - } else if (inp_rec.EventType == MOUSE_EVENT) { - if (handle_mouse(sp, - inp_rec.Event.MouseEvent)) { - *buf = KEY_MOUSE; - break; - } - } - continue; - } - } - returnCode(rc); -} - -static bool -InitConsole(void) -{ - /* initialize once, or not at all */ - if (!console_initialized) { - int i; - DWORD num_buttons; - WORD a; - BOOL buffered = TRUE; - BOOL b; - - START_TRACE(); - - for (i = 0; i < (N_INI + FKEYS); i++) { - if (i < N_INI) { - CON.rmap[i] = CON.map[i] = - (DWORD) keylist[i]; - CON.ansi_map[i] = (DWORD) ansi_keys[i]; - } else { - CON.rmap[i] = CON.map[i] = - (DWORD) GenMap((VK_F1 + (i - N_INI)), - (KEY_F(1) + (i - N_INI))); - CON.ansi_map[i] = - (DWORD) GenMap((VK_F1 + (i - N_INI)), - (';' + (i - N_INI))); - } - } - qsort(CON.ansi_map, - (size_t) (MAPSIZE), - sizeof(keylist[0]), - keycompare); - qsort(CON.map, - (size_t) (MAPSIZE), - sizeof(keylist[0]), - keycompare); - qsort(CON.rmap, - (size_t) (MAPSIZE), - sizeof(keylist[0]), - rkeycompare); - - if (GetNumberOfConsoleMouseButtons(&num_buttons)) { - CON.numButtons = (int) num_buttons; - } else { - CON.numButtons = 1; - } - - a = MapColor(true, COLOR_WHITE) | MapColor(false, COLOR_BLACK); - for (i = 0; i < NUMPAIRS; i++) - CON.pairs[i] = a; - - b = AllocConsole(); - - if (!b) - b = AttachConsole(ATTACH_PARENT_PROCESS); - - CON.inp = GetDirectHandle("CONIN$", FILE_SHARE_READ); - CON.out = GetDirectHandle("CONOUT$", FILE_SHARE_WRITE); - - if (getenv("NCGDB") || getenv("NCURSES_CONSOLE2")) { - T(("... will not buffer console")); - buffered = FALSE; - CON.hdl = CON.out; - } else { - T(("... creating console buffer")); - CON.hdl = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, - CONSOLE_TEXTMODE_BUFFER, - NULL); - } - - if (CON.hdl != INVALID_HANDLE_VALUE) { - CON.buffered = buffered; - get_SBI(); - CON.save_SBI = CON.SBI; - if (!buffered) { - save_original_screen(); - set_scrollback(FALSE, &CON.SBI); - } - GetConsoleCursorInfo(CON.hdl, &CON.save_CI); - T(("... initial cursor is %svisible, %d%%", - (CON.save_CI.bVisible ? "" : "not-"), - (int) CON.save_CI.dwSize)); - } - - console_initialized = TRUE; - } - return (CON.hdl != INVALID_HANDLE_VALUE); -} - -static bool -okConsoleHandle(TERMINAL_CONTROL_BLOCK * TCB) -{ - return ((TCB != 0) && - (TCB->magic == WINMAGIC) && - InitConsole()); -} - -/* - * While a constructor would ensure that this module is initialized, that will - * interfere with applications that may combine this with GUI interfaces. - */ -#if 0 -static -__attribute__((constructor)) - void _enter_console(void) -{ - (void) InitConsole(); -} -#endif diff --git a/contrib/ncurses/panel/Makefile.in b/contrib/ncurses/panel/Makefile.in --- a/contrib/ncurses/panel/Makefile.in +++ b/contrib/ncurses/panel/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.76 2021/07/03 15:45:33 tom Exp $ +# $Id: Makefile.in,v 1.81 2025/10/25 18:00:30 tom Exp $ ############################################################################## -# Copyright 2020,2021 Thomas E. Dickey # +# Copyright 2020-2024,2025 Thomas E. Dickey # # Copyright 1998-2015,2018 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -47,11 +47,14 @@ VPATH = @srcdir@ THIS = Makefile +@SET_MAKE@ +@SET_DESTDIR@ +TOP_MFLAGS = DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)" + x = @EXEEXT@ o = .@OBJEXT@ MODEL = @DFT_LWR_MODEL@ -DESTDIR = @DESTDIR@ top_srcdir = @top_srcdir@ srcdir = @srcdir@ prefix = @prefix@ @@ -63,7 +66,9 @@ datadir = @datadir@ includesubdir = @includesubdir@ -INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) +INCLUDEDIR = $(DESTDIR)$(includedir@MERGE_PREFIX@)$(includesubdir) +BINDIR = $(DESTDIR)$(bindir@MERGE_PREFIX@) +LIBDIR = $(DESTDIR)$(libdir@MERGE_PREFIX@) PACKAGE = @PACKAGE@ @@ -112,7 +117,7 @@ LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@ SHLIB_DIRS = -L../lib -SHLIB_LIST = $(SHLIB_DIRS) -lncurses@USE_LIB_SUFFIX@ @SHLIB_LIST@ +SHLIB_LIST = $(SHLIB_DIRS) -lncurses@ABI_SUFFIX@ @SHLIB_LIST@ RPATH_LIST = @RPATH_LIST@ RESULTING_SYMS = @RESULTING_SYMS@ @@ -153,10 +158,13 @@ libs \ install :: $(AUTO_SRC) $(LIBRARIES) +check :: + @echo "no unit-test implemented" + sources: $(AUTO_SRC) -$(DESTDIR)$(bindir) \ -$(DESTDIR)$(libdir) : +$(BINDIR) \ +$(LIBDIR) : mkdir -p $@ # make a copy to simplify include-paths while still keeping panel's include @@ -201,6 +209,12 @@ realclean :: distclean +# These rules are used to allow "make -n" to work on a clean directory-tree +../include/curses.h \ +../include/ncurses_def.h \ +../include/term.h : + ( cd ../include && $(MAKE) $(TOP_MFLAGS) ) + ############################################################################### # The remainder of this file is automatically generated during configuration ############################################################################### diff --git a/contrib/ncurses/panel/p_above.c b/contrib/ncurses/panel/p_above.c --- a/contrib/ncurses/panel/p_above.c +++ b/contrib/ncurses/panel/p_above.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2010,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -37,11 +37,11 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_above.c,v 1.11 2020/05/24 01:40:20 anonymous.maarten Exp $") +MODULE_ID("$Id: p_above.c,v 1.12 2024/12/07 23:05:20 tom Exp $") #if NCURSES_SP_FUNCS PANEL_EXPORT(PANEL *) -ground_panel(SCREEN * sp) +ground_panel(SCREEN *sp) { T((T_CALLED("ground_panel(%p)"), (void *)sp)); if (sp) @@ -51,12 +51,12 @@ if (_nc_bottom_panel) /* this is the pseudo panel */ returnPanel(_nc_bottom_panel->above); else - returnPanel(0); + returnPanel(NULL); } else { - if (0 == CURRENT_SCREEN) - returnPanel(0); + if (NULL == CURRENT_SCREEN) + returnPanel(NULL); else returnPanel(ground_panel(CURRENT_SCREEN)); } @@ -64,7 +64,7 @@ #endif PANEL_EXPORT(PANEL *) -panel_above(const PANEL * pan) +panel_above(const PANEL *pan) { PANEL *result; @@ -78,7 +78,7 @@ #else /* if top and bottom are equal, we have no or only the pseudo panel; if not, we return the panel above the pseudo panel */ - result = EMPTY_STACK()? (PANEL *) 0 : _nc_bottom_panel->above; + result = EMPTY_STACK()? (PANEL *)0 : _nc_bottom_panel->above; #endif } returnPanel(result); diff --git a/contrib/ncurses/panel/p_below.c b/contrib/ncurses/panel/p_below.c --- a/contrib/ncurses/panel/p_below.c +++ b/contrib/ncurses/panel/p_below.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2010,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -37,11 +37,11 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_below.c,v 1.11 2020/05/24 01:40:20 anonymous.maarten Exp $") +MODULE_ID("$Id: p_below.c,v 1.12 2024/12/07 23:05:20 tom Exp $") #if NCURSES_SP_FUNCS PANEL_EXPORT(PANEL *) -ceiling_panel(SCREEN * sp) +ceiling_panel(SCREEN *sp) { T((T_CALLED("ceiling_panel(%p)"), (void *)sp)); if (sp) @@ -49,12 +49,12 @@ struct panelhook *ph = NCURSES_SP_NAME(_nc_panelhook) (sp); /* if top and bottom are equal, we have no or only the pseudo panel */ - returnPanel(EMPTY_STACK()? (PANEL *) 0 : _nc_top_panel); + returnPanel(EMPTY_STACK()? (PANEL *)0 : _nc_top_panel); } else { - if (0 == CURRENT_SCREEN) - returnPanel(0); + if (NULL == CURRENT_SCREEN) + returnPanel(NULL); else returnPanel(ceiling_panel(CURRENT_SCREEN)); } @@ -62,7 +62,7 @@ #endif PANEL_EXPORT(PANEL *) -panel_below(const PANEL * pan) +panel_below(const PANEL *pan) { PANEL *result; @@ -71,7 +71,7 @@ { GetHook(pan); /* we must not return the pseudo panel */ - result = Is_Pseudo(pan->below) ? (PANEL *) 0 : pan->below; + result = Is_Pseudo(pan->below) ? (PANEL *)0 : pan->below; } else { @@ -79,7 +79,7 @@ result = ceiling_panel(CURRENT_SCREEN); #else /* if top and bottom are equal, we have no or only the pseudo panel */ - result = EMPTY_STACK()? (PANEL *) 0 : _nc_top_panel; + result = EMPTY_STACK()? (PANEL *)0 : _nc_top_panel; #endif } returnPanel(result); diff --git a/contrib/ncurses/panel/p_new.c b/contrib/ncurses/panel/p_new.c --- a/contrib/ncurses/panel/p_new.c +++ b/contrib/ncurses/panel/p_new.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -39,7 +39,7 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_new.c,v 1.24 2021/10/23 15:12:06 tom Exp $") +MODULE_ID("$Id: p_new.c,v 1.25 2024/12/07 23:00:37 tom Exp $") #ifdef TRACE static char *stdscr_id; @@ -86,7 +86,7 @@ ph->destroy = del_panel; #endif _nc_stdscr_pseudo_panel = AllocPanel("root_panel"); - if (_nc_stdscr_pseudo_panel != 0) + if (_nc_stdscr_pseudo_panel != NULL) { PANEL *pan = _nc_stdscr_pseudo_panel; WINDOW *win = SP_PARM->_stdscr; diff --git a/contrib/ncurses/panel/panel.c b/contrib/ncurses/panel/panel.c --- a/contrib/ncurses/panel/panel.c +++ b/contrib/ncurses/panel/panel.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2010,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -37,14 +37,14 @@ /* panel.c -- implementation of panels library, some core routines */ #include "panel.priv.h" -MODULE_ID("$Id: panel.c,v 1.30 2020/09/26 18:05:17 tom Exp $") +MODULE_ID("$Id: panel.c,v 1.31 2024/12/07 23:05:20 tom Exp $") /*+------------------------------------------------------------------------- _nc_retrace_panel (pan) --------------------------------------------------------------------------*/ #ifdef TRACE PANEL_EXPORT(PANEL *) -_nc_retrace_panel(PANEL * pan) +_nc_retrace_panel(PANEL *pan) { T((T_RETURN("%p"), (void *)pan)); return pan; @@ -61,7 +61,7 @@ { char temp[32]; - if (ptr != 0) + if (ptr != NULL) _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "%p", ptr); else _nc_STRCPY(temp, "", sizeof(temp)); @@ -75,7 +75,7 @@ --------------------------------------------------------------------------*/ #ifdef TRACE PANEL_EXPORT(void) -_nc_dPanel(const char *text, const PANEL * pan) +_nc_dPanel(const char *text, const PANEL *pan) { _tracef("%s id=%s b=%s a=%s y=%d x=%d", text, USER_PTR(pan->user, 1), @@ -90,7 +90,7 @@ --------------------------------------------------------------------------*/ #ifdef TRACE PANEL_EXPORT(void) -_nc_dStack(const char *fmt, int num, const PANEL * pan) +_nc_dStack(const char *fmt, int num, const PANEL *pan) { char s80[80]; @@ -116,7 +116,7 @@ --------------------------------------------------------------------------*/ #ifdef TRACE PANEL_EXPORT(void) -_nc_Wnoutrefresh(const PANEL * pan) +_nc_Wnoutrefresh(const PANEL *pan) { dPanel("wnoutrefresh", pan); wnoutrefresh(pan->win); @@ -128,7 +128,7 @@ --------------------------------------------------------------------------*/ #ifdef TRACE PANEL_EXPORT(void) -_nc_Touchpan(const PANEL * pan) +_nc_Touchpan(const PANEL *pan) { dPanel("Touchpan", pan); touchwin(pan->win); @@ -140,7 +140,7 @@ --------------------------------------------------------------------------*/ #ifdef TRACE PANEL_EXPORT(void) -_nc_Touchline(const PANEL * pan, int start, int count) +_nc_Touchline(const PANEL *pan, int start, int count) { char s80[80]; diff --git a/contrib/ncurses/panel/panel.priv.h b/contrib/ncurses/panel/panel.priv.h --- a/contrib/ncurses/panel/panel.priv.h +++ b/contrib/ncurses/panel/panel.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2014,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,7 +27,7 @@ * authorization. * ****************************************************************************/ -/* $Id: panel.priv.h,v 1.30 2020/09/26 18:05:32 tom Exp $ */ +/* $Id: panel.priv.h,v 1.31 2024/12/07 23:01:42 tom Exp $ */ #ifndef NCURSES_PANEL_PRIV_H #define NCURSES_PANEL_PRIV_H 1 @@ -86,7 +86,7 @@ #define GetScreenHook(sp) \ struct panelhook* ph = NCURSES_SP_NAME(_nc_panelhook)(sp) #define GetPanelHook(pan) \ - GetScreenHook(pan ? _nc_screen_of((pan)->win) : 0) + GetScreenHook(pan ? _nc_screen_of((pan)->win) : NULL) #define GetWindowHook(win) \ SCREEN* sp = _nc_screen_of(win); \ GetScreenHook(sp) diff --git a/contrib/ncurses/progs/Makefile.in b/contrib/ncurses/progs/Makefile.in --- a/contrib/ncurses/progs/Makefile.in +++ b/contrib/ncurses/progs/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.115 2024/04/08 18:33:54 tom Exp $ +# $Id: Makefile.in,v 1.121 2025/10/18 13:34:20 tom Exp $ ############################################################################## -# Copyright 2020-2021,2024 Thomas E. Dickey # +# Copyright 2020-2024,2025 Thomas E. Dickey # # Copyright 1998-2016,2018 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -47,14 +47,14 @@ VPATH = @srcdir@ THIS = Makefile -TOP_MFLAGS = @cf_cv_makeflags@ DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)" @SET_MAKE@ +@SET_DESTDIR@ +TOP_MFLAGS = DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)" x = @EXEEXT@ o = .@OBJEXT@ MODEL = ../@DFT_OBJ_SUBDIR@ -DESTDIR = @DESTDIR@ top_srcdir = @top_srcdir@ srcdir = @srcdir@ prefix = @prefix@ @@ -66,7 +66,8 @@ datadir = @datadir@ includesubdir = @includesubdir@ -INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) +INCLUDEDIR = $(DESTDIR)$(includedir@MERGE_PREFIX@)$(includesubdir) +BINDIR = $(DESTDIR)$(bindir@MERGE_PREFIX@) PACKAGE = @PACKAGE@ @@ -94,7 +95,7 @@ INCDIR = $(top_srcdir)/include NCUDIR = $(top_srcdir)/ncurses -CPPFLAGS = -DHAVE_CONFIG_H -I../progs -I../ncurses -I$(top_srcdir)/ncurses @CPPFLAGS@ +CPPFLAGS = -DHAVE_CONFIG_H -DACTUAL_TIC="\"$(actual_tic)\"" -I../progs -I../ncurses -I$(top_srcdir)/ncurses @CPPFLAGS@ CCFLAGS = $(CPPFLAGS) $(CFLAGS) @@ -230,37 +231,37 @@ echo "#define PROG_INIT \"$(define_init)\"" >>$@ echo "#endif /* __TRANSFORM_H */" >>$@ -install.progs: $(AUTO_SRC) $(PROGS) $(DESTDIR)$(bindir) -@MAKE_TERMINFO@ $(LIBTOOL_INSTALL) $(INSTALL_PROG) tic$x $(DESTDIR)$(bindir)/$(actual_tic) -@MAKE_TERMINFO@ $(LIBTOOL_INSTALL) $(INSTALL_PROG) toe$x $(DESTDIR)$(bindir)/$(actual_toe) +install.progs: $(AUTO_SRC) $(PROGS) $(BINDIR) +@MAKE_TERMINFO@ $(LIBTOOL_INSTALL) $(INSTALL_PROG) tic$x $(BINDIR)/$(actual_tic) +@MAKE_TERMINFO@ $(LIBTOOL_INSTALL) $(INSTALL_PROG) toe$x $(BINDIR)/$(actual_toe) @MAKE_TERMINFO@ @echo "linking $(actual_infotocap) to $(actual_tic)" -@MAKE_TERMINFO@ -@rm -f $(DESTDIR)$(bindir)/$(actual_infotocap) -@MAKE_TERMINFO@ ( cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tic) $(actual_infotocap) ) +@MAKE_TERMINFO@ -@rm -f $(BINDIR)/$(actual_infotocap) +@MAKE_TERMINFO@ ( cd $(BINDIR) && $(LN_S) $(actual_tic) $(actual_infotocap) ) @MAKE_TERMINFO@ @echo "linking $(actual_captoinfo) to $(actual_tic)" -@MAKE_TERMINFO@ -@rm -f $(DESTDIR)$(bindir)/$(actual_captoinfo) -@MAKE_TERMINFO@ ( cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tic) $(actual_captoinfo) ) - $(LIBTOOL_INSTALL) $(INSTALL_PROG) infocmp$x $(DESTDIR)$(bindir)/$(actual_infocmp) - $(LIBTOOL_INSTALL) $(INSTALL_PROG) clear$x $(DESTDIR)$(bindir)/$(actual_clear) - $(LIBTOOL_INSTALL) $(INSTALL_PROG) tabs$x $(DESTDIR)$(bindir)/$(actual_tabs) - $(LIBTOOL_INSTALL) $(INSTALL_PROG) tput$x $(DESTDIR)$(bindir)/$(actual_tput) - $(LIBTOOL_INSTALL) $(INSTALL_PROG) tset$x $(DESTDIR)$(bindir)/$(actual_tset) +@MAKE_TERMINFO@ -@rm -f $(BINDIR)/$(actual_captoinfo) +@MAKE_TERMINFO@ ( cd $(BINDIR) && $(LN_S) $(actual_tic) $(actual_captoinfo) ) + $(LIBTOOL_INSTALL) $(INSTALL_PROG) infocmp$x $(BINDIR)/$(actual_infocmp) + $(LIBTOOL_INSTALL) $(INSTALL_PROG) clear$x $(BINDIR)/$(actual_clear) + $(LIBTOOL_INSTALL) $(INSTALL_PROG) tabs$x $(BINDIR)/$(actual_tabs) + $(LIBTOOL_INSTALL) $(INSTALL_PROG) tput$x $(BINDIR)/$(actual_tput) + $(LIBTOOL_INSTALL) $(INSTALL_PROG) tset$x $(BINDIR)/$(actual_tset) @echo "linking $(actual_reset) to $(actual_tset)" - -@rm -f $(DESTDIR)$(bindir)/$(actual_reset) - ( cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tset) $(actual_reset) ) + -@rm -f $(BINDIR)/$(actual_reset) + ( cd $(BINDIR) && $(LN_S) $(actual_tset) $(actual_reset) ) uninstall.progs: -@MAKE_TERMINFO@ -@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_tic) -@MAKE_TERMINFO@ -@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_toe) -@MAKE_TERMINFO@ -@rm -f $(DESTDIR)$(bindir)/$(actual_captoinfo) -@MAKE_TERMINFO@ -@rm -f $(DESTDIR)$(bindir)/$(actual_infotocap) - -@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_infocmp) - -@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_clear) - -@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_tabs) - -@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_tput) - -@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_tset) - -@rm -f $(DESTDIR)$(bindir)/$(actual_reset) - -$(DESTDIR)$(bindir) : +@MAKE_TERMINFO@ -@$(LIBTOOL_CLEAN) rm -f $(BINDIR)/$(actual_tic) +@MAKE_TERMINFO@ -@$(LIBTOOL_CLEAN) rm -f $(BINDIR)/$(actual_toe) +@MAKE_TERMINFO@ -@rm -f $(BINDIR)/$(actual_captoinfo) +@MAKE_TERMINFO@ -@rm -f $(BINDIR)/$(actual_infotocap) + -@$(LIBTOOL_CLEAN) rm -f $(BINDIR)/$(actual_infocmp) + -@$(LIBTOOL_CLEAN) rm -f $(BINDIR)/$(actual_clear) + -@$(LIBTOOL_CLEAN) rm -f $(BINDIR)/$(actual_tabs) + -@$(LIBTOOL_CLEAN) rm -f $(BINDIR)/$(actual_tput) + -@$(LIBTOOL_CLEAN) rm -f $(BINDIR)/$(actual_tset) + -@rm -f $(BINDIR)/$(actual_reset) + +$(BINDIR) : mkdir -p $@ # @@ -352,7 +353,9 @@ realclean :: distclean # These rules are used to allow "make -n" to work on a clean directory-tree +../include/curses.h \ ../include/hashsize.h \ +../include/ncurses_def.h \ ../include/parametrized.h \ ../include/term.h : ( cd ../include && $(MAKE) $(TOP_MFLAGS) ) diff --git a/contrib/ncurses/progs/capconvert b/contrib/ncurses/progs/capconvert --- a/contrib/ncurses/progs/capconvert +++ b/contrib/ncurses/progs/capconvert @@ -1,6 +1,6 @@ #!/bin/sh ############################################################################## -# Copyright 2019-2021,2022 Thomas E. Dickey # +# Copyright 2019-2022,2025 Thomas E. Dickey # # Copyright 1998-2011,2017 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -27,7 +27,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: capconvert,v 1.12 2022/07/16 21:00:27 tom Exp $ +# $Id: capconvert,v 1.13 2025/06/14 15:16:35 tom Exp $ # # capconvert -- automated conversion from termcap to terminfo # @@ -42,12 +42,12 @@ # case they're on a workstation and probably don't. # Check to make sure TERMINFO is not already defined -if test -n "$TERMINFO" +if [ -n "$TERMINFO" ] then echo "TERMINFO is already defined in your environment. This means" echo "you already have a local terminfo tree, so you do not need any" echo "conversion." - if test ! -d "$TERMINFO" ; then + if [ ! -d "$TERMINFO" ] ; then echo "Caution: TERMINFO does not point to a directory!" fi exit; @@ -62,17 +62,17 @@ /usr/local/lib/terminfo \ /usr/local/share/terminfo do - if test -d "$p" ; then + if [ -d "$p" ] ; then terminfo=yes break fi done -if test $terminfo = yes +if [ $terminfo = yes ] then echo "Your system already has a system-wide terminfo tree." echo "" - if test -z "$TERMCAP" + if [ -z "$TERMCAP" ] then echo "You have no TERMCAP variable set, so we are done." # Assumes the terminfo master covers all canned terminal types @@ -97,7 +97,7 @@ # Check if test -x works (it is not portable, but useful) OPT="-x" -TMP=test$$; touch $TMP && chmod 755 $TMP +TMP="test$$"; touch "$TMP" && chmod 755 "$TMP" if test $OPT $TMP ; then chmod 644 $TMP test $OPT $TMP && OPT="-f" @@ -119,7 +119,7 @@ done IFS="$save_ifs" -if test -n "$TIC" +if [ -n "$TIC" ] then echo "I see tic at $TIC." case $TIC in # (vi @@ -140,7 +140,7 @@ # # Make the user a terminfo directory -if test -d "$HOME"/.terminfo +if [ -d "$HOME"/.terminfo ] then echo "It appears you already have a private terminfo directory" echo "at $HOME/.terminfo; this seems odd, because TERMINFO" @@ -158,7 +158,7 @@ echo ""; # Find a terminfo source to work from -if test -f ../misc/terminfo.src +if [ -f ../misc/terminfo.src ] then echo "I see the terminfo master source is handy; I will use that." master=../misc/terminfo.src @@ -189,7 +189,7 @@ do echo "Please tell me which one to use:" read master; - if test -f "$master" + if [ -f "$master" ] then break else @@ -209,11 +209,11 @@ trap 'rm -f tsplit$$.*; exit 1' 1 2 3 15 trap 'rm -f tsplit$$.*' 0 sed -n "$master" \ - -e '1,/SPLIT HERE/w 'tsplit$$.01 \ - -e '/SPLIT HERE/,$w 'tsplit$$.02 \ + -e '1,/SPLIT HERE/w '"tsplit$$.01" \ + -e '/SPLIT HERE/,$w '"tsplit$$.02" \ 2>/dev/null -for x in tsplit$$.*; do eval $TIC "$x"; done -rm tsplit$$.* +for x in ./tsplit$$.*; do eval "$TIC" "$x"; done +rm ./tsplit$$.* trap EXIT INT QUIT TERM HUP # echo "You now have a private tree under $HOME/.terminfo;" @@ -221,7 +221,7 @@ echo "and ncurses tic will automatically compile entries to it." # We're done unless user has a .termcap file or equivalent named by TERMCAP -if test -z "$TERMCAP" +if [ -z "$TERMCAP" ] then echo "You have no TERMCAP set, so we are done." fi @@ -232,23 +232,23 @@ # we don't actually know what TERM will be nor even if it always has # the same value for this user) we do the following three steps... -if test -f "$HOME"/.termcap +if [ -f "$HOME"/.termcap ] then echo "I see you have a \$HOME/.termcap file. I will compile that." - eval $TIC "$HOME"/.termcap + eval "$TIC" "$HOME"/.termcap echo "Done." echo "Note that editing $HOME/.termcap will no longer change the data curses sees." -elif test -f "$TERMCAP" +elif [ -f "$TERMCAP" ] then echo "Your TERMCAP names the file $TERMCAP. I will compile that." - eval $TIC "$TERMCAP" + eval "$TIC" "$TERMCAP" echo "Done." echo "Note that editing $TERMCAP will no longer change the data curses sees." else echo "Your TERMCAP value appears to be an entry in termcap format." echo "I will compile it." echo "$TERMCAP" >myterm$$ - eval $TIC myterm$$ + eval "$TIC" myterm$$ rm myterm$$ echo "Done." echo "Note that editing TERMCAP will no longer change the data curses sees." diff --git a/contrib/ncurses/progs/clear.c b/contrib/ncurses/progs/clear.c --- a/contrib/ncurses/progs/clear.c +++ b/contrib/ncurses/progs/clear.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -41,7 +41,7 @@ #include #include -MODULE_ID("$Id: clear.c,v 1.24 2021/03/20 18:23:14 tom Exp $") +MODULE_ID("$Id: clear.c,v 1.25 2024/10/19 22:00:53 tom Exp $") const char *_nc_progname = "clear"; @@ -71,7 +71,7 @@ TTY tty_settings; int fd; int c; - char *term; + NCURSES_CONST char *term; bool opt_x = FALSE; /* clear scrollback if possible */ _nc_progname = _nc_rootname(argv[0]); diff --git a/contrib/ncurses/progs/clear_cmd.c b/contrib/ncurses/progs/clear_cmd.c --- a/contrib/ncurses/progs/clear_cmd.c +++ b/contrib/ncurses/progs/clear_cmd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2018,2020,2025 Thomas E. Dickey * * Copyright 2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,23 +38,82 @@ #define USE_LIBTINFO #include -MODULE_ID("$Id: clear_cmd.c,v 1.5 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: clear_cmd.c,v 1.8 2025/12/06 21:00:26 tom Exp $") +#ifdef TERMIOS static int putch(int c) { return putchar(c); } +#endif int clear_cmd(bool legacy) { - int retval = tputs(clear_screen, lines > 0 ? lines : 1, putch); + int retval; +#ifdef TERMIOS + retval = tputs(clear_screen, lines > 0 ? lines : 1, putch); if (!legacy) { /* Clear the scrollback buffer if possible. */ - char *E3 = tigetstr("E3"); - if (E3) + char *E3 = tigetstr(UserCap(E3)); + if (VALID_STRING(E3)) (void) tputs(E3, lines > 0 ? lines : 1, putch); } +#elif defined(_NC_WINDOWS) + /* + * https://learn.microsoft.com/en-us/windows/console/clearing-the-screen + */ + HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); + COORD coordScreen = + {0, 0}; +#if defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING) + DWORD mode = 0; + + retval = ERR; + + if (GetConsoleMode(hConsole, &mode)) { + const DWORD originalMode = mode; + mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; + + if (SetConsoleMode(hConsole, mode)) { + DWORD written = 0; + PCWSTR sequence = legacy ? L"\x1b[2J" : L"\x1b[2J\x1b[3J"; + if (WriteConsoleW(hConsole, sequence, + (DWORD) wcslen(sequence), + &written, NULL)) { + SetConsoleCursorPosition(hConsole, coordScreen); + retval = OK; + } + SetConsoleMode(hConsole, originalMode); + } + } +#else + DWORD cCharsWritten; + CONSOLE_SCREEN_BUFFER_INFO csbi; + DWORD dwConSize; + + (void) legacy; + retval = ERR; + + /* Get the number of character cells in the current buffer, + * to fill the entire screen with blanks */ + if (GetConsoleScreenBufferInfo(hConsole, &csbi) + && (dwConSize = csbi.dwSize.X * csbi.dwSize.Y) > 0 + && FillConsoleOutputCharacter(hConsole, + (TCHAR) ' ', + dwConSize, + coordScreen, + &cCharsWritten) + && FillConsoleOutputAttribute(hConsole, + csbi.wAttributes, + dwConSize, + coordScreen, + &cCharsWritten)) { + SetConsoleCursorPosition(hConsole, coordScreen); + retval = OK; + } +#endif +#endif return retval; } diff --git a/contrib/ncurses/progs/dump_entry.c b/contrib/ncurses/progs/dump_entry.c --- a/contrib/ncurses/progs/dump_entry.c +++ b/contrib/ncurses/progs/dump_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -40,7 +40,7 @@ #include /* this C file is generated */ #include /* so is this */ -MODULE_ID("$Id: dump_entry.c,v 1.196 2023/05/27 20:13:10 tom Exp $") +MODULE_ID("$Id: dump_entry.c,v 1.199 2025/02/08 21:53:40 tom Exp $") #define DISCARD(string) string = ABSENT_STRING #define PRINTF (void) printf @@ -121,7 +121,7 @@ if (want > dst->size) { dst->size += (want + 1024); /* be generous */ dst->text = typeRealloc(char, dst->size, dst->text); - if (dst->text == 0) + if (dst->text == NULL) failed("strncpy_DYN"); } _nc_STRNCPY(dst->text + dst->used, src, need + 1); @@ -132,7 +132,7 @@ static void strcpy_DYN(DYNBUF * dst, const char *src) { - if (src == 0) { + if (src == NULL) { dst->used = 0; strcpy_DYN(dst, ""); } else { @@ -144,9 +144,9 @@ static void free_DYN(DYNBUF * p) { - if (p->text != 0) + if (p->text != NULL) free(p->text); - p->text = 0; + p->text = NULL; p->size = 0; p->used = 0; } @@ -170,7 +170,7 @@ { const struct name_table_entry *np; - if ((np = _nc_find_entry(name, _nc_get_hash_table(0))) != 0) { + if ((np = _nc_find_entry(name, _nc_get_hash_table(0))) != NULL) { switch (np->nte_type) { case BOOLEAN: NameTrans(bool_from_termcap, boolcodes); @@ -186,7 +186,7 @@ } } - return (0); + return (NULL); } void @@ -212,7 +212,7 @@ did_wrap = (width <= 0); /* versions */ - if (version == 0) + if (version == NULL) tversion = V_ALLCAPS; else if (!strcmp(version, "SVr1") || !strcmp(version, "SVR1") || !strcmp(version, "Ultrix")) @@ -458,7 +458,7 @@ } n++; } - } else if (strchr("pPg", ch) != 0) { + } else if (strchr("pPg", ch) != NULL) { result += 2; } else { result++; /* ordinary operator */ @@ -526,7 +526,7 @@ const char *fill = "\\s"; size_t need = strlen(src); size_t size = strlen(fill); - char *result = 0; + char *result = NULL; int pass; size_t s, d; for (pass = 0; pass < 2; ++pass) { @@ -550,7 +550,7 @@ result[d] = '\0'; } else { result = calloc(need + 1, sizeof(char)); - if (result == 0) + if (result == NULL) failed("fill_spaces"); } } @@ -598,7 +598,7 @@ if (TcOutput()) trailer = "\\\n\t "; - if (!TcOutput() && (p = strchr(fill, '=')) != 0) { + if (!TcOutput() && (p = strchr(fill, '=')) != NULL) { base = (int) (p + 1 - fill); if (base > 8) base = 8; @@ -612,7 +612,7 @@ align[base] = '\0'; } /* "pretty" overrides wrapping if it already split the line */ - if (!pretty || strchr(fill, '\n') == 0) { + if (!pretty || strchr(fill, '\n') == NULL) { int tag = 0; if (TcOutput() && outbuf.used && !wrap_1ST(mode)) { @@ -725,7 +725,7 @@ * given leading text. */ static bool -leading_DYN(DYNBUF * buffer, const char *leading) +leading_DYN(const DYNBUF * buffer, const char *leading) { bool result = FALSE; size_t need = strlen(leading); @@ -841,7 +841,7 @@ strncpy_DYN(&tmpbuf, src++, (size_t) 1); if (src[0] == '%' && src[1] != '\0' - && (strchr("?e;", src[1])) == 0) { + && (strchr("?e;", src[1])) == NULL) { tmpbuf.text[tmpbuf.used++] = '\n'; indent_DYN(&tmpbuf, level); } @@ -926,12 +926,12 @@ len = 12; /* terminfo file-header */ - if (pred == 0) { + if (pred == NULL) { cur_type = tterm; pred = dump_predicate; } - strcpy_DYN(&outbuf, 0); + strcpy_DYN(&outbuf, NULL); if (content_only) { column = indent; /* workaround to prevent empty lines */ } else { @@ -1118,9 +1118,9 @@ : ((*srccap == 'k') ? 0 : has_params(srccap, FALSE))); - char *cv = _nc_infotocap(name, srccap, params); + const char *cv = _nc_infotocap(name, srccap, params); - if (cv == 0) { + if (cv == NULL) { if (outform == F_TCONVERR) { _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) "%s=!!! %s WILL NOT CONVERT !!!", @@ -1129,7 +1129,8 @@ } else if (suppress_untranslatable) { continue; } else { - char *s = srccap, *d = buffer; + const char *s = srccap; + char *d = buffer; int need = 3 + (int) strlen(name); while ((*d = *s++) != 0) { if ((d - buffer + 2) >= (int) sizeof(buffer)) { @@ -1168,7 +1169,7 @@ char *src = _nc_tic_expand(capability, outform == F_TERMINFO, numbers); - strcpy_DYN(&tmpbuf, 0); + strcpy_DYN(&tmpbuf, NULL); strcpy_DYN(&tmpbuf, name); strcpy_DYN(&tmpbuf, "="); if (pretty @@ -1208,9 +1209,10 @@ } else if (tversion == V_AIX) { if (VALID_STRING(acs_chars)) { bool box_ok = TRUE; - const char *acstrans = "lqkxjmwuvtn"; + static const char acstrans[] = "lqkxjmwuvtn"; const char *cp; - char *tp, *sp, boxchars[11]; + const char *sp; + char *tp, boxchars[sizeof(acstrans)]; tp = boxchars; for (cp = acstrans; *cp; cp++) { @@ -1222,7 +1224,7 @@ break; } } - tp[0] = '\0'; + *tp = '\0'; if (box_ok) { char *tmp = _nc_tic_expand(boxchars, @@ -1324,7 +1326,7 @@ } static char * -find_string(TERMTYPE2 *tterm, char *name) +find_string(TERMTYPE2 *tterm, const char *name) { PredIdx n; for (n = 0; n < NUM_STRINGS(tterm); ++n) { @@ -1352,7 +1354,7 @@ char name[20]; for (n = 0; n <= 10; ++n) { - char *cap; + const char *cap; _nc_SPRINTF(name, _nc_SLIMIT(sizeof(name)) "lf%d", n); cap = find_string(tterm, name); @@ -1379,7 +1381,7 @@ char name[20]; for (n = 60; n >= 0; --n) { - char *cap; + const char *cap; _nc_SPRINTF(name, _nc_SLIMIT(sizeof(name)) "kf%d", n); cap = find_string(tterm, name); @@ -1398,7 +1400,7 @@ * Check if the given acsc string is a 1-1 mapping, i.e., just-like-vt100. * Also, since this is for termcap, we only care about the line-drawing map. */ -#define isLine(c) (strchr("lmkjtuvwqxn", c) != 0) +#define isLine(c) (strchr("lmkjtuvwqxn", c) != NULL) static bool one_one_mapping(const char *mapping) @@ -1444,7 +1446,7 @@ } static void -encode_b64(char *target, char *source, unsigned state, int *saved) +encode_b64(char *target, const char *source, unsigned state, int *saved) { /* RFC-4648 */ static const char data[] = @@ -1509,7 +1511,7 @@ } } if (quickdump & 2) { - static char padding[] = + static const char padding[] = {0, 0}; int value = 0; @@ -1701,7 +1703,7 @@ } outbuf.text[outbuf.used] = '\0'; } - if (outbuf.text != 0) { + if (outbuf.text != NULL) { (void) fputs(outbuf.text, stdout); putchar('\n'); } diff --git a/contrib/ncurses/progs/infocmp.c b/contrib/ncurses/progs/infocmp.c --- a/contrib/ncurses/progs/infocmp.c +++ b/contrib/ncurses/progs/infocmp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2022,2023 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -43,7 +43,11 @@ #include -MODULE_ID("$Id: infocmp.c,v 1.163 2023/12/16 17:27:47 tom Exp $") +MODULE_ID("$Id: infocmp.c,v 1.177 2025/12/27 22:18:10 tom Exp $") + +#ifndef ACTUAL_TIC +#define ACTUAL_TIC "tic" +#endif #define MAX_STRING 1024 /* maximum formatted string */ @@ -61,6 +65,9 @@ static ENTRY *entries; /* terminfo entries */ static int termcount; /* count of terminal entries */ +static const char usage_string[] = \ +"Usage: %s [options] [-A directory] [-B directory] [termname...]"; + static bool limited = TRUE; /* "-r" option is not set */ static bool quiet = FALSE; static bool literal = FALSE; @@ -125,7 +132,7 @@ } static void -canonical_name(char *source, char *target) +canonical_name(const char *source, char *target) /* extract the terminal type's primary name */ { int limit = NAMESIZE; @@ -207,8 +214,6 @@ switch (type) { case BOOLEAN: { - int is_set = FALSE; - /* * This assumes that multiple use entries are supposed * to contribute the logical or of their boolean capabilities. @@ -221,6 +226,8 @@ * recorded in the terminfo database. */ if (idx < NUM_BOOLEANS(&(entries[0].tterm))) { + int is_set = FALSE; + for (ep = &entries[1]; ep < entries + termcount; ep++) { if (idx < NUM_BOOLEANS(&(ep->tterm)) && (is_set = ep->tterm.Booleans[idx])) { @@ -235,14 +242,14 @@ case NUMBER: { - int value = ABSENT_NUMERIC; - /* * We take the semantics of multiple uses to be 'each * capability gets the first non-default value found * in the sequence of use entries'. */ if (idx < NUM_NUMBERS(&(entries[0].tterm))) { + int value = ABSENT_NUMERIC; + for (ep = &entries[1]; ep < entries + termcount; ep++) if (idx < NUM_NUMBERS(&(ep->tterm)) && VALID_NUMERIC(ep->tterm.Numbers[idx])) { @@ -258,8 +265,8 @@ case STRING: { - char *termstr = entries[0].tterm.Strings[idx]; - char *usestr = ABSENT_STRING; + const char *termstr = entries[0].tterm.Strings[idx]; + const char *usestr = ABSENT_STRING; /* * We take the semantics of multiple uses to be 'each @@ -295,7 +302,7 @@ } static bool -useeq(ENTRY * e1, ENTRY * e2) +useeq(const ENTRY * e1, const ENTRY * e2) /* are the use references in two entries equivalent? */ { unsigned i, j; @@ -322,7 +329,7 @@ } static bool -entryeq(TERMTYPE2 *t1, TERMTYPE2 *t2) +entryeq(const TERMTYPE2 *t1, const TERMTYPE2 *t2) /* are two entries equivalent? */ { unsigned i; @@ -345,7 +352,7 @@ #define TIC_EXPAND(result) _nc_tic_expand(result, outform==F_TERMINFO, numbers) static void -print_uses(ENTRY * ep, FILE *fp) +print_uses(const ENTRY * ep, FILE *fp) /* print an entry's use references */ { if (!ep->nuses) { @@ -397,7 +404,7 @@ } static void -dump_string(char *val, char *buf) +dump_string(const char *val, char *buf) /* display the value of a string capability */ { if (val == ABSENT_STRING) @@ -472,13 +479,13 @@ compare_predicate(PredType type, PredIdx idx, const char *name) /* predicate function to use for entry difference reports */ { - ENTRY *e1 = &entries[0]; - ENTRY *e2 = &entries[1]; + const ENTRY *e1 = &entries[0]; + const ENTRY *e2 = &entries[1]; char buf1[MAX_STRING]; char buf2[MAX_STRING]; int b1, b2; int n1, n2; - char *s1, *s2; + const char *s1, *s2; bool found; int extra = 1; @@ -805,10 +812,10 @@ static char * lookup_params(const assoc * table, char *dst, char *src) { - char *result = 0; + char *result = NULL; const char *ep = strtok(src, ";"); - if (ep != 0) { + if (ep != NULL) { const assoc *ap; do { @@ -828,7 +835,7 @@ _nc_STRCAT(dst, ep, MAX_TERMINFO_LENGTH); _nc_STRCAT(dst, ";", MAX_TERMINFO_LENGTH); } while - ((ep = strtok((char *) 0, ";"))); + ((ep = strtok((char *) 0, ";")) != NULL); dst[strlen(dst) - 1] = '\0'; @@ -840,7 +847,7 @@ static void analyze_string(const char *name, const char *cap, TERMTYPE2 *tp) { - char buf2[MAX_TERMINFO_LENGTH]; + char buf2[MAX_TERMINFO_LENGTH + 1]; const char *sp; const assoc *ap; int tp_lines = tp->Numbers[2]; @@ -854,12 +861,12 @@ int csi; size_t len = 0; size_t next; - const char *expansion = 0; + const char *expansion = NULL; char buf3[MAX_TERMINFO_LENGTH]; /* first, check other capabilities in this entry */ for (i = 0; i < STRCOUNT; i++) { - char *cp = tp->Strings[i]; + const char *cp = tp->Strings[i]; /* don't use function-key capabilities */ if (strnames[i] == NULL) @@ -870,7 +877,8 @@ if (VALID_STRING(cp) && cp[0] != '\0' && cp != cap) { - len = strlen(cp); + if ((len = strlen(cp)) > MAX_TERMINFO_LENGTH) + len = MAX_TERMINFO_LENGTH; _nc_STRNCPY(buf2, sp, len); buf2[len] = '\0'; @@ -1045,14 +1053,14 @@ FALSE, 0, 65535, itrace, FALSE, FALSE, FALSE); for (n = 0; n < argc && n < MAXCOMPARE; n++) { - if (freopen(argv[n], "r", stdin) == 0) - _nc_err_abort("Can't open %s", argv[n]); + if (freopen(argv[n], "r", stdin) == NULL) + _nc_err_abort("Can't open %s: %s", argv[n], strerror(errno)); #if NO_LEAKS entered[n].head = _nc_head; entered[n].tail = _nc_tail; #endif - _nc_head = _nc_tail = 0; + _nc_head = _nc_tail = NULL; /* parse entries out of the source file */ _nc_set_source(argv[n]); @@ -1180,7 +1188,7 @@ names[0] = name1; names[1] = name2; - names[2] = 0; + names[2] = NULL; entries[0] = *qp; entries[1] = *rp; @@ -1216,7 +1224,6 @@ #define DATA(s) s "\n" static const char head[] = { - DATA("Usage: infocmp [options] [-A directory] [-B directory] [termname...]") DATA("") DATA("Options:") }; @@ -1235,7 +1242,7 @@ ," -I use terminfo-names" ," -K use termcap-names and BSD syntax" ," -L use long names" - ," -R subset (see manpage)" + ," -R subset (see man page)" ," -T eliminate size limits (test)" ," -U do not post-process entries" ," -V print version" @@ -1271,42 +1278,81 @@ const size_t last = SIZEOF(options); const size_t left = (last + 1) / 2; size_t n; + FILE *fp = stderr; - fputs(head, stderr); + fprintf(fp, usage_string, _nc_progname); + fputs(head, fp); for (n = 0; n < left; n++) { size_t m = n + left; if (m < last) - fprintf(stderr, "%-40.40s%s\n", options[n], options[m]); + fprintf(fp, "%-40.40s%s\n", options[n], options[m]); else - fprintf(stderr, "%s\n", options[n]); + fprintf(fp, "%s\n", options[n]); } ExitProgram(EXIT_FAILURE); } +#define isName(c) ((c) == '_' || isalnum(UChar(c))) + static char * -any_initializer(const char *fmt, const char *type) +safe_name(const char *format, const char *prefix, const char *name) { - static char *initializer; + static char *result; static size_t need; char *s; - if (initializer == 0) { - need = (strlen(entries->tterm.term_names) - + strlen(type) - + strlen(fmt)); - initializer = (char *) malloc(need + 1); - if (initializer == 0) - failed("any_initializer"); + if (result == NULL) { + need = (strlen(prefix) + + strlen(name) + + strlen(format)); + result = (char *) malloc(need + 1); + if (result == NULL) + failed("safe_name"); } - _nc_STRCPY(initializer, entries->tterm.term_names, need); - for (s = initializer; *s != 0 && *s != '|'; s++) { - if (!isalnum(UChar(*s))) + _nc_STRCPY(result, "", need); + if (isdigit(UChar(*prefix))) + _nc_STRCAT(result, "ti_", need); + _nc_STRCAT(result, prefix, need); + for (s = result; *s != 0 && *s != '|'; s++) { + if (!isName(*s)) *s = '_'; } *s = 0; - _nc_SPRINTF(s, _nc_SLIMIT(need) fmt, type); - return initializer; + if (isdigit(UChar(*name)) && !*prefix) + *s++ = '_'; + _nc_SPRINTF(s, _nc_SLIMIT(need) format, name); + return result; +} + +/* + * escape contents of a double-quoted string. + */ +static char * +safe_string(const char *source) +{ + static char *result; + static size_t need; + char *d; + if (result == NULL) { + need = 2 * strlen(source) + 1; + result = (char *) malloc(need + 1); + } + for (d = result; *source != '\0'; ++source) { + char ch = *source; + if (ch == '"' || ch == '\\') { + *d++ = '\\'; + } + *d++ = ch; + } + *d = '\0'; + return result; +} + +static char * +any_initializer(const char *fmt, const char *type) +{ + return safe_name(fmt, entries->tterm.term_names, type); } static char * @@ -1321,25 +1367,72 @@ return any_initializer("_s_%s", type); } +#if NCURSES_XNAMES +static char * +name_of(const char *name) +{ + return safe_name("name_of_%s", "", name); +} + +static void +dump_extended_name(const char *name) +{ + static char **known; + static size_t dumped; + static size_t length; + + if (name != NULL) { + bool found = FALSE; + if (length != 0) { + size_t check; + for (check = 0; check < dumped; ++check) { + if (!strcmp(name, known[check])) { + found = TRUE; + break; + } + } + } + if (!found) { + if (dumped + 2 > length) { + length += 100; + known = realloc(known, length * sizeof(*known)); + } + printf("\n"); + printf("#ifndef %s\n", safe_name("extension_%s", "", name)); + printf("static char %s[] = \"%s\";\n", name_of(name), name); + printf("#define %s 1\n", safe_name("extension_%s", "", name)); + printf("#endif\n"); + known[dumped] = strdup(name); + } + } else { + while (dumped != 0) { + free(known[--dumped]); + } + free(known); + length = 0; + } +} +#endif + /* dump C initializers for the terminal type */ static void -dump_initializers(TERMTYPE2 *term) +dump_initializers(const TERMTYPE2 *term) { unsigned n; - const char *str = 0; + const char *str = NULL; printf("\nstatic char %s[] = \"%s\";\n\n", - name_initializer("alias"), entries->tterm.term_names); + name_initializer("alias"), safe_string(entries->tterm.term_names)); for_each_string(n, term) { if (VALID_STRING(term->Strings[n])) { char buf[MAX_STRING], *sp, *tp; tp = buf; -#define TP_LIMIT ((MAX_STRING - 5) - (size_t)(tp - buf)) +#define TP_LIMIT ((MAX_STRING - 6) - (size_t)(tp - buf)) *tp++ = '"'; for (sp = term->Strings[n]; - *sp != 0 && TP_LIMIT > 2; + *sp != 0 && TP_LIMIT > 5; sp++) { if (isascii(UChar(*sp)) && isprint(UChar(*sp)) @@ -1426,19 +1519,29 @@ if ((NUM_BOOLEANS(term) != BOOLCOUNT) || (NUM_NUMBERS(term) != NUMCOUNT) || (NUM_STRINGS(term) != STRCOUNT)) { + for (n = BOOLCOUNT; n < NUM_BOOLEANS(term); ++n) { + dump_extended_name(ExtBoolname(term, (int) n, boolnames)); + } + for (n = NUMCOUNT; n < NUM_NUMBERS(term); ++n) { + dump_extended_name(ExtNumname(term, (int) n, numnames)); + } + for (n = STRCOUNT; n < NUM_STRINGS(term); ++n) { + dump_extended_name(ExtStrname(term, (int) n, strnames)); + } + printf("\n"); (void) printf("static char * %s[] = %s\n", name_initializer("string_ext"), L_CURL); for (n = BOOLCOUNT; n < NUM_BOOLEANS(term); ++n) { - (void) printf("\t/* %3u: bool */\t\"%s\",\n", - n, ExtBoolname(term, (int) n, boolnames)); + (void) printf("\t/* %3u: bool */\t%s,\n", + n, name_of(ExtBoolname(term, (int) n, boolnames))); } for (n = NUMCOUNT; n < NUM_NUMBERS(term); ++n) { - (void) printf("\t/* %3u: num */\t\"%s\",\n", - n, ExtNumname(term, (int) n, numnames)); + (void) printf("\t/* %3u: num */\t%s,\n", + n, name_of(ExtNumname(term, (int) n, numnames))); } for (n = STRCOUNT; n < NUM_STRINGS(term); ++n) { - (void) printf("\t/* %3u: str */\t\"%s\",\n", - n, ExtStrname(term, (int) n, strnames)); + (void) printf("\t/* %3u: str */\t%s,\n", + n, name_of(ExtStrname(term, (int) n, strnames))); } (void) printf("%s;\n", R_CURL); } @@ -1447,7 +1550,7 @@ /* dump C initializers for the terminal type */ static void -dump_termtype(TERMTYPE2 *term) +dump_termtype(const TERMTYPE2 *term) { (void) printf("\t%s\n\t\t%s,\n", L_CURL, name_initializer("alias")); (void) printf("\t\t(char *)0,\t/* pointer to string table */\n"); @@ -1488,10 +1591,10 @@ static int optarg_to_number(void) { - char *temp = 0; + char *temp = NULL; long value = strtol(optarg, &temp, 0); - if (temp == 0 || temp == optarg || *temp != 0) { + if (temp == NULL || temp == optarg || *temp != 0) { fprintf(stderr, "Expected a number, not \"%s\"\n", optarg); ExitProgram(EXIT_FAILURE); } @@ -1503,7 +1606,7 @@ { char *terminal; - if ((terminal = getenv("TERM")) == 0) { + if ((terminal = getenv("TERM")) == NULL) { (void) fprintf(stderr, "%s: environment variable TERM not set\n", _nc_progname); @@ -1523,7 +1626,7 @@ const char *path2; _nc_first_db(&state, &offset); - while ((path2 = _nc_next_db(&state, &offset)) != 0) { + while ((path2 = _nc_next_db(&state, &offset)) != NULL) { printf("%s\n", path2); } _nc_last_db(); @@ -1551,8 +1654,8 @@ { /* Avoid "local data >32k" error with mwcc */ /* Also avoid overflowing smaller stacks on systems like AmigaOS */ - path *tfile = 0; - char **tname = 0; + path *tfile = NULL; + char **tname = NULL; size_t maxterms; char **myargv; @@ -1568,7 +1671,7 @@ bool wrap_strings = FALSE; /* where is the terminfo database location going to default to? */ - restdir = firstdir = 0; + restdir = firstdir = NULL; #if NCURSES_XNAMES use_extended_names(FALSE); @@ -1579,7 +1682,7 @@ /* make sure we have enough space to add two terminal entries */ myargv = typeCalloc(char *, (size_t) (argc + 3)); - if (myargv == 0) + if (myargv == NULL) failed("myargv"); memcpy(myargv, argv, (sizeof(char *) * (size_t) argc)); @@ -1663,7 +1766,7 @@ outform = F_TERMINFO; if (sortmode == S_DEFAULT) sortmode = S_VARIABLE; - tversion = 0; + tversion = NULL; break; case 'i': @@ -1704,7 +1807,7 @@ break; case 'r': - tversion = 0; + tversion = NULL; break; case 's': @@ -1772,20 +1875,20 @@ } maxterms = (size_t) (argc + 2 - optind); - if ((tfile = typeMalloc(path, maxterms)) == 0) + if ((tfile = typeMalloc(path, maxterms)) == NULL) failed("tfile"); - if ((tname = typeCalloc(char *, maxterms)) == 0) + if ((tname = typeCalloc(char *, maxterms)) == NULL) failed("tname"); - if ((entries = typeCalloc(ENTRY, maxterms)) == 0) + if ((entries = typeCalloc(ENTRY, maxterms)) == NULL) failed("entries"); #if NO_LEAKS - if ((entered = typeCalloc(ENTERED, maxterms)) == 0) + if ((entered = typeCalloc(ENTERED, maxterms)) == NULL) failed("entered"); #endif - if (tfile == 0 - || tname == 0 - || entries == 0) { + if (tfile == NULL + || tname == NULL + || entries == NULL) { fprintf(stderr, "%s: not enough memory\n", _nc_progname); ExitProgram(EXIT_FAILURE); } @@ -1833,11 +1936,6 @@ if (directory) { #if NCURSES_USE_DATABASE -#if MIXEDCASE_FILENAMES -#define LEAF_FMT "%c" -#else -#define LEAF_FMT "%02x" -#endif _nc_SPRINTF(tfile[termcount], _nc_SLIMIT(sizeof(path)) "%s/" LEAF_FMT "/%s", @@ -1870,10 +1968,32 @@ } if (status <= 0) { - (void) fprintf(stderr, - "%s: couldn't open terminfo file %s.\n", - _nc_progname, - tfile[termcount]); + switch (status) { + case TGETENT_NO: + (void) fprintf(stderr, + "%s: error: no match in terminfo" + " database for terminal type" + " \"%s\"\n", + _nc_progname, + tname[termcount]); + break; + case TGETENT_ERR: + /* + * Several database files might be checked; their + * file names are not exposed via this API. The + * best we can do is report how the final one + * attempted failed. Also, tfile[termcount] is + * deeply misleading when a hashed database is used. + */ + (void) fprintf(stderr, + "%s: error: unable to open terminfo" + " database: %s\n", + _nc_progname, + strerror(errno)); + break; + default: + assert(0 == "unhandled _nc_read_entry2 return"); + } MAIN_LEAKS(); ExitProgram(EXIT_FAILURE); } @@ -1933,8 +2053,8 @@ tname[0]); if (!quiet) (void) - printf("#\tReconstructed via infocmp from file: %s\n", - tfile[0]); + printf("#\tReconstructed via %s from file: %s\n", + _nc_progname, tfile[0]); dump_entry(&entries[0].tterm, suppress_untranslatable, limited, @@ -1980,7 +2100,8 @@ } else if (compare == C_USEALL) { (void) fprintf(stderr, "Sorry, -u doesn't work with -F\n"); } else if (compare == C_DEFAULT) { - (void) fprintf(stderr, "Use `tic -[CI] ' for this.\n"); + (void) fprintf(stderr, + "Use `" ACTUAL_TIC " -[CI] ' for this.\n"); } else if (argc - optind != 2) { (void) fprintf(stderr, "File comparison needs exactly two file arguments.\n"); diff --git a/contrib/ncurses/progs/modules b/contrib/ncurses/progs/modules --- a/contrib/ncurses/progs/modules +++ b/contrib/ncurses/progs/modules @@ -1,7 +1,7 @@ -# $Id: modules,v 1.25 2021/04/18 17:21:03 tom Exp $ +# $Id: modules,v 1.31 2025/07/13 09:08:38 tom Exp $ # Program modules (some are in ncurses lib!) ############################################################################## -# Copyright 2020,2021 Thomas E. Dickey # +# Copyright 2020-2024,2025 Thomas E. Dickey # # Copyright 1998-2014,2016 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -33,18 +33,18 @@ # @ base -clear progs $(srcdir) $(HEADER_DEPS) tty_settings.h -tic progs $(srcdir) $(HEADER_DEPS) transform.h $(srcdir)/dump_entry.h $(srcdir)/tparm_type.h -toe progs $(srcdir) $(HEADER_DEPS) $(INCDIR)/hashed_db.h -clear_cmd progs $(srcdir) $(HEADER_DEPS) clear_cmd.h -dump_entry progs $(srcdir) $(HEADER_DEPS) $(srcdir)/dump_entry.h ../include/parametrized.h $(INCDIR)/capdefaults.c termsort.h -infocmp progs $(srcdir) $(HEADER_DEPS) $(srcdir)/dump_entry.h -reset_cmd progs $(srcdir) $(HEADER_DEPS) reset_cmd.h tty_settings.h -tabs progs $(srcdir) $(HEADER_DEPS) -tparm_type progs $(srcdir) $(HEADER_DEPS) $(srcdir)/tparm_type.h -tput progs $(srcdir) $(HEADER_DEPS) transform.h $(srcdir)/tparm_type.h reset_cmd.h tty_settings.h -tset progs $(srcdir) $(HEADER_DEPS) transform.h ../include/termcap.h reset_cmd.h tty_settings.h +clear progs $(srcdir) $(HEADER_DEPS) $(srcdir)/clear_cmd.h $(srcdir)/tty_settings.h +tic progs $(srcdir) $(HEADER_DEPS) $(INCDIR)/hashed_db.h $(srcdir)/dump_entry.h $(srcdir)/tparm_type.h ../include/parametrized.h transform.h +toe progs $(srcdir) $(HEADER_DEPS) $(INCDIR)/hashed_db.h +clear_cmd progs $(srcdir) $(HEADER_DEPS) $(srcdir)/clear_cmd.h +dump_entry progs $(srcdir) $(HEADER_DEPS) $(srcdir)/dump_entry.h ../include/capdefaults.c ../include/parametrized.h termsort.h +infocmp progs $(srcdir) $(HEADER_DEPS) $(srcdir)/dump_entry.h +reset_cmd progs $(srcdir) $(HEADER_DEPS) $(srcdir)/reset_cmd.h $(srcdir)/tty_settings.h +tabs progs $(srcdir) $(HEADER_DEPS) $(srcdir)/tty_settings.h +tparm_type progs $(srcdir) $(HEADER_DEPS) $(srcdir)/tparm_type.h +tput progs $(srcdir) $(HEADER_DEPS) $(srcdir)/clear_cmd.h $(srcdir)/reset_cmd.h $(srcdir)/tparm_type.h $(srcdir)/tty_settings.h transform.h +tset progs $(srcdir) $(HEADER_DEPS) ../include/termcap.h $(srcdir)/reset_cmd.h $(srcdir)/tty_settings.h transform.h transform progs $(srcdir) $(HEADER_DEPS) transform.h -tty_settings progs $(srcdir) $(HEADER_DEPS) tty_settings.h +tty_settings progs $(srcdir) $(HEADER_DEPS) $(srcdir)/tty_settings.h # vile:makemode diff --git a/contrib/ncurses/progs/progs.priv.h b/contrib/ncurses/progs/progs.priv.h --- a/contrib/ncurses/progs/progs.priv.h +++ b/contrib/ncurses/progs/progs.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2022,2024 Thomas E. Dickey * + * Copyright 2019-2024,2025 Thomas E. Dickey * * Copyright 1998-2015,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -31,7 +31,7 @@ * Author: Thomas E. Dickey 1997-on * ****************************************************************************/ /* - * $Id: progs.priv.h,v 1.62 2024/04/08 17:28:28 tom Exp $ + * $Id: progs.priv.h,v 1.63 2025/12/27 22:17:25 tom Exp $ * * progs.priv.h * diff --git a/contrib/ncurses/progs/reset_cmd.c b/contrib/ncurses/progs/reset_cmd.c --- a/contrib/ncurses/progs/reset_cmd.c +++ b/contrib/ncurses/progs/reset_cmd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2023,2024 Thomas E. Dickey * + * Copyright 2019-2024,2025 Thomas E. Dickey * * Copyright 2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -53,7 +53,7 @@ #include #endif -MODULE_ID("$Id: reset_cmd.c,v 1.37 2024/04/08 17:29:34 tom Exp $") +MODULE_ID("$Id: reset_cmd.c,v 1.42 2025/11/22 21:38:31 tom Exp $") /* * SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS, @@ -104,8 +104,8 @@ char buf[BUFSIZ]; bool sent = FALSE; - if (file != 0) { - if ((fp = safe_fopen(file, "r")) == 0) + if (file != NULL) { + if ((fp = safe_fopen(file, "r")) == NULL) failed(file); while ((nr = fread(buf, sizeof(char), sizeof(buf), fp)) != 0) { @@ -271,6 +271,7 @@ void reset_tty_settings(int fd, TTY * tty_settings, int noset) { +#ifdef TERMIOS unsigned mask; #ifdef TIOCMGET int modem_bits; @@ -278,7 +279,6 @@ GET_TTY(fd, tty_settings); -#ifdef TERMIOS #if defined(VDISCARD) && defined(CDISCARD) reset_char(VDISCARD, CDISCARD); #endif @@ -370,6 +370,28 @@ | ECHOK | ECHOCTL | ECHOKE)); +#elif defined(_NC_WINDOWS) + /* reference: + https://learn.microsoft.com/en-us/windows/console/setconsolemode + https://learn.microsoft.com/en-us/windows/console/high-level-console-modes + */ + GET_TTY(fd, tty_settings); + /* do not change ENABLE_VIRTUAL_TERMINAL_INPUT */ + /* do not change ENABLE_WINDOW_INPUT */ + tty_settings->dwFlagIn &= ~( + ENABLE_INSERT_MODE | + ENABLE_QUICK_EDIT_MODE); + tty_settings->dwFlagIn |= ( + ENABLE_EXTENDED_FLAGS | + ENABLE_MOUSE_INPUT | + ENABLE_LINE_INPUT | /* like ICANON */ + ENABLE_ECHO_INPUT | /* like ECHO */ + ENABLE_PROCESSED_INPUT /* like BRKINT */ + ); +#ifdef ENABLED_PROCESSED_OUTPUT + tty_settings->dwFlagOut |= ENABLED_PROCESSED_OUTPUT; +#endif + tty_settings->dwFlagOut |= ENABLE_WRAP_AT_EOL_OUTPUT; #endif /* TERMIOS */ if (!noset) { @@ -381,6 +403,7 @@ * Returns a "good" value for the erase character. This is loosely based on * the BSD4.4 logic. */ +#ifdef TERMIOS static int default_erase(void) { @@ -396,6 +419,7 @@ return result; } +#endif /* * Update the values of the erase, interrupt, and kill characters in the TTY @@ -408,13 +432,7 @@ void set_control_chars(TTY * tty_settings, int my_erase, int my_intr, int my_kill) { -#if defined(EXP_WIN32_DRIVER) - /* noop */ - (void) tty_settings; - (void) my_erase; - (void) my_intr; - (void) my_kill; -#else +#ifdef TERMIOS if (DISABLED(tty_settings->c_cc[VERASE]) || my_erase >= 0) { tty_settings->c_cc[VERASE] = UChar((my_erase >= 0) ? my_erase @@ -432,7 +450,13 @@ ? my_kill : CKILL); } -#endif +#elif defined(_NC_WINDOWS) + /* noop */ + (void) tty_settings; + (void) my_erase; + (void) my_intr; + (void) my_kill; +#endif /* TERMIOS */ } /* @@ -442,9 +466,7 @@ void set_conversions(TTY * tty_settings) { -#if defined(EXP_WIN32_DRIVER) - /* FIXME */ -#else +#ifdef TERMIOS set_flags(tty_settings->c_oflag, ONLCR); set_flags(tty_settings->c_iflag, ICRNL); set_flags(tty_settings->c_lflag, ECHO); @@ -462,7 +484,9 @@ clear_flags(tty_settings->c_oflag, OXTABS); #endif /* OXTABS */ set_flags(tty_settings->c_lflag, (ECHOE | ECHOK)); -#endif +#elif defined(_NC_WINDOWS) + (void) tty_settings; +#endif /* TERMIOS */ } static bool @@ -528,7 +552,7 @@ (void) old_settings; #if TAB3 - if (old_settings != 0 && + if (old_settings != NULL && old_settings->c_oflag & (TAB3 | ONLCR | OCRNL | ONLRET)) { old_settings->c_oflag &= (TAB3 | ONLCR | OCRNL | ONLRET); SET_TTY(fd, old_settings); @@ -539,11 +563,11 @@ IGNORE_RC(system(init_prog)); } - need_flush |= sent_string((use_reset && (reset_1string != 0)) + need_flush |= sent_string((use_reset && (reset_1string != NULL)) ? reset_1string : init_1string); - need_flush |= sent_string((use_reset && (reset_2string != 0)) + need_flush |= sent_string((use_reset && (reset_2string != NULL)) ? reset_2string : init_2string); @@ -584,7 +608,7 @@ need_flush |= cat_file((use_reset && reset_file) ? reset_file : init_file); - need_flush |= sent_string((use_reset && (reset_3string != 0)) + need_flush |= sent_string((use_reset && (reset_3string != NULL)) ? reset_3string : init_3string); } @@ -592,6 +616,7 @@ return need_flush; } +#ifdef TERMIOS /* * Tell the user if a control key has been changed from the default value. */ @@ -605,20 +630,11 @@ unsigned older = 0, newer = 0; char *p; -#if defined(EXP_WIN32_DRIVER) - /* noop */ - (void) old_settings; - (void) new_settings; - (void) name; - (void) which; - (void) def; -#else newer = new_settings->c_cc[which]; older = old_settings->c_cc[which]; if (older == newer && older == def) return; -#endif (void) fprintf(stderr, "%s %s ", name, older == newer ? "is" : "set to"); if (DISABLED(newer)) { @@ -629,7 +645,7 @@ */ } else if (newer == 0177) { (void) fprintf(stderr, "delete.\n"); - } else if ((p = key_backspace) != 0 + } else if ((p = key_backspace) != NULL && newer == (unsigned char) p[0] && p[1] == '\0') { (void) fprintf(stderr, "backspace.\n"); @@ -639,6 +655,7 @@ } else (void) fprintf(stderr, "%c.\n", UChar(newer)); } +#endif /* TERMIOS */ /************************************************************************** * Miscellaneous. @@ -655,20 +672,21 @@ void reset_flush(void) { - if (my_file != 0) + if (my_file != NULL) fflush(my_file); } void print_tty_chars(TTY * old_settings, TTY * new_settings) { -#if defined(EXP_WIN32_DRIVER) - /* noop */ -#else +#ifdef TERMIOS show_tty_change(old_settings, new_settings, "Erase", VERASE, CERASE); show_tty_change(old_settings, new_settings, "Kill", VKILL, CKILL); show_tty_change(old_settings, new_settings, "Interrupt", VINTR, CINTR); -#endif +#elif defined(_NC_WINDOWS) + (void) old_settings; + (void) new_settings; +#endif /* TERMIOS */ } #if HAVE_SIZECHANGE diff --git a/contrib/ncurses/progs/tabs.c b/contrib/ncurses/progs/tabs.c --- a/contrib/ncurses/progs/tabs.c +++ b/contrib/ncurses/progs/tabs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2022,2023 Thomas E. Dickey * + * Copyright 2020-2023,2024 Thomas E. Dickey * * Copyright 2008-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -39,7 +39,7 @@ #include #include -MODULE_ID("$Id: tabs.c,v 1.53 2023/11/04 20:46:09 tom Exp $") +MODULE_ID("$Id: tabs.c,v 1.56 2024/12/07 22:10:45 tom Exp $") static GCC_NORETURN void usage(void); @@ -78,7 +78,7 @@ { bool result = FALSE; if (VALID_STRING(clear_all_tabs)) { - char *param = skip_csi(clear_all_tabs); + const char *param = skip_csi(clear_all_tabs); if (!strcmp(param, "3g")) result = TRUE; } @@ -86,7 +86,7 @@ } static void -do_tabs(int *tab_list) +do_tabs(const int *tab_list) { int last = 1; int stop; @@ -147,7 +147,7 @@ "%s: tab-stops are not in increasing order: %d %d\n", _nc_progname, value, result[n - 1]); free(result); - result = 0; + result = NULL; break; } ++n; @@ -159,7 +159,7 @@ } } - if (result != 0) { + if (result != NULL) { /* * If there is only one value, then it is an option such as "-8". */ @@ -229,7 +229,7 @@ * ruler. */ static void -write_tabs(int *tab_list, const char *new_line) +write_tabs(const int *tab_list, const char *new_line) { int stop; @@ -250,7 +250,7 @@ trimmed_tab_list(const char *source) { char *result = strdup(source); - if (result != 0) { + if (result != NULL) { int j, k, last; for (j = k = last = 0; result[j] != 0; ++j) { @@ -280,7 +280,7 @@ { bool result = FALSE; - if (source != 0) { + if (source != NULL) { size_t len = strlen(source); if (len != 0) result = (source[len - 1] != ','); @@ -303,7 +303,7 @@ char *result = *append; char *copied = trimmed_tab_list(value); - if (copied != 0 && *copied != '\0') { + if (copied != NULL && *copied != '\0') { const char *comma = ","; size_t need = 1 + strlen(copied); @@ -313,15 +313,15 @@ comma = ""; need += strlen(comma); - if (*append != 0) + if (*append != NULL) need += strlen(*append); result = malloc(need); - if (result == 0) + if (result == NULL) failed("add_to_tab_list"); *result = '\0'; - if (*append != 0) { + if (*append != NULL) { _nc_STRCPY(result, *append, need); free(*append); } @@ -402,7 +402,7 @@ { bool result = TRUE; - if (tab_list != 0 && *tab_list != '\0') { + if (tab_list != NULL && *tab_list != '\0') { if (comma_is_needed(tab_list)) { int n; @@ -433,7 +433,7 @@ while (*value != '\0' && (isdigit(UChar(*value)) || isspace(UChar(*value)) || - strchr("+,", UChar(*value)) != 0)) { + strchr("+,", UChar(*value)) != NULL)) { ++value; } return value; @@ -445,7 +445,6 @@ #define DATA(s) s "\n" static const char msg[] = { - DATA("Usage: tabs [options] [tabstop-list]") DATA("") DATA("Options:") DATA(" -0 reset tabs") @@ -468,9 +467,11 @@ DATA("or 1,+10,+10 which is the same.") }; #undef DATA + FILE *fp = stderr; fflush(stdout); - fputs(msg, stderr); + fprintf(fp, "Usage: %s [options] [tabstop-list]\n", _nc_progname); + fputs(msg, fp); ExitProgram(EXIT_FAILURE); } @@ -482,9 +483,9 @@ bool no_op = FALSE; bool change_tty = FALSE; int n, ch; - NCURSES_CONST char *term_name = 0; - char *append = 0; - const char *tab_list = 0; + NCURSES_CONST char *term_name = NULL; + char *append = NULL; + const char *tab_list = NULL; const char *new_line = "\n"; int margin = -1; TTY tty_settings; @@ -492,7 +493,7 @@ _nc_progname = _nc_rootname(argv[0]); - if ((term_name = getenv("TERM")) == 0) + if ((term_name = getenv("TERM")) == NULL) term_name = "ansi+tabs"; /* cannot use getopt, since some options are two-character */ @@ -616,11 +617,11 @@ } break; default: - if (append != 0) { + if (append != NULL) { if (tab_list != (const char *) append) { /* one of the predefined options was used */ free(append); - append = 0; + append = NULL; } } tab_list = add_to_tab_list(&append, option); @@ -682,7 +683,7 @@ list = decode_tabs(tab_list, margin); - if (list != 0) { + if (list != NULL) { if (!no_op) do_tabs(list); if (debug) { @@ -703,7 +704,7 @@ } rc = EXIT_SUCCESS; } - if (append != 0) + if (append != NULL) free(append); ExitProgram(rc); } diff --git a/contrib/ncurses/progs/tic.c b/contrib/ncurses/progs/tic.c --- a/contrib/ncurses/progs/tic.c +++ b/contrib/ncurses/progs/tic.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2023,2024 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2017,2018 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -49,7 +49,7 @@ #include #include -MODULE_ID("$Id: tic.c,v 1.325 2024/03/02 19:33:22 tom Exp $") +MODULE_ID("$Id: tic.c,v 1.334 2025/12/25 21:27:48 tom Exp $") #define STDIN_NAME "" @@ -61,7 +61,7 @@ static bool infodump = FALSE; /* running as captoinfo? */ static bool showsummary = FALSE; static unsigned debug_level; -static char **namelst = 0; +static char **namelst = NULL; static const char *to_remove; #if NCURSES_XNAMES @@ -104,9 +104,9 @@ static void free_namelist(char **src) { - if (src != 0) { + if (src != NULL) { int n; - for (n = 0; src[n] != 0; ++n) + for (n = 0; src[n] != NULL; ++n) free(src[n]); free(src); } @@ -120,9 +120,9 @@ free_namelist(namelst); _nc_leaks_dump_entry(); #endif - if (tmp_fp != 0) + if (tmp_fp != NULL) fclose(tmp_fp); - if (to_remove != 0) { + if (to_remove != NULL) { int rc; #if HAVE_REMOVE @@ -203,7 +203,8 @@ { unsigned n; int ch; - char *s, *d, *t; + char *s, *d; + const char *t; char result[MAX_ENTRY_SIZE]; /* @@ -213,7 +214,7 @@ for (n = 0; n < STRCOUNT; n++) { s = ep->tterm.Strings[n]; if (VALID_STRING(s) - && strchr(s, L_BRACE) != 0) { + && strchr(s, L_BRACE) != NULL) { d = result; t = s; while ((ch = *t++) != 0) { @@ -223,14 +224,14 @@ break; } else if ((ch == '%') && (*t == L_BRACE)) { - char *v = 0; + char *v = NULL; long value = strtol(t + 1, &v, 0); - if (v != 0 + if (v != NULL && *v == R_BRACE && value > 0 && value != '\\' /* FIXME */ && value < 127 - && isprint((int) value)) { + && isprint(UChar(value))) { *d++ = S_QUOTE; *d++ = (char) value; *d++ = S_QUOTE; @@ -333,14 +334,14 @@ in_name = FALSE; suffix[0] = '\0'; - if ((up = strchr(namebuf, '#')) != 0 - || (up = strchr(namebuf, '=')) != 0 - || ((up = strchr(namebuf, '@')) != 0 && up[1] == '>')) { + if ((up = strchr(namebuf, '#')) != NULL + || (up = strchr(namebuf, '=')) != NULL + || ((up = strchr(namebuf, '@')) != NULL && up[1] == '>')) { _nc_STRCPY(suffix, up, have); *up = '\0'; } - if ((tp = nametrans(namebuf)) != 0) { + if ((tp = nametrans(namebuf)) != NULL) { (void) putchar(':'); (void) fputs(tp, stdout); (void) fputs(suffix, stdout); @@ -367,7 +368,7 @@ static char * stripped(char *src) { - char *dst = 0; + char *dst = NULL; while (isspace(UChar(*src))) src++; @@ -387,7 +388,7 @@ static FILE * open_tempfile(char *filename) { - FILE *result = 0; + FILE *result = NULL; _nc_STRCPY(filename, "/tmp/XXXXXX", PATH_MAX); #if HAVE_MKSTEMP @@ -409,9 +410,8 @@ copy_input(FILE *source, const char *filename, char *alt_file) { char my_altfile[PATH_MAX]; - FILE *result = 0; + FILE *result = NULL; FILE *target; - int ch; if (alt_file == NULL) alt_file = my_altfile; @@ -423,7 +423,7 @@ } else { clearerr(source); for (;;) { - ch = fgetc(source); + int ch = fgetc(source); if (feof(source)) { break; } else if (ferror(source)) { @@ -458,7 +458,7 @@ if (!strcmp(filename, "-")) { fp = copy_input(stdin, STDIN_NAME, alt_file); - } else if (stat(filename, &sb) == -1) { + } else if (!_nc_is_path_found(filename, &sb)) { fprintf(stderr, "%s: cannot open '%s': %s\n", _nc_progname, filename, strerror(errno)); ExitProgram(EXIT_FAILURE); @@ -476,7 +476,7 @@ ExitProgram(EXIT_FAILURE); } if (mode != S_IFREG) { - if (alt_file != 0) { + if (alt_file != NULL) { FILE *fp2 = copy_input(fp, filename, alt_file); fp = fp2; } else { @@ -493,7 +493,7 @@ static char ** make_namelist(char *src) { - char **dst = 0; + char **dst = NULL; char *s, *base; unsigned pass, n, nn; @@ -501,14 +501,14 @@ if (src == NULL) { /* EMPTY */ ; - } else if (strchr(src, '/') != 0) { /* a filename */ + } else if (strchr(src, '/') != NULL) { /* a filename */ FILE *fp = open_input(src, (char *) 0); for (pass = 1; pass <= 2; pass++) { nn = 0; - while (fgets(buffer, sizeof(buffer), fp) != 0) { - if ((s = stripped(buffer)) != 0) { - if (dst != 0) + while (fgets(buffer, sizeof(buffer), fp) != NULL) { + if ((s = stripped(buffer)) != NULL) { + if (dst != NULL) dst[nn] = s; else free(s); @@ -517,8 +517,10 @@ } if (pass == 1) { if ((dst = typeCalloc(char *, nn + 1)) == NULL) - failed("make_namelist"); + failed("make_namelist (alloc)"); rewind(fp); + if (errno != 0) + failed("make_namelist (rewind)"); } } fclose(fp); @@ -531,7 +533,7 @@ nn++; } else { src[n] = '\0'; - if ((s = stripped(base)) != 0) + if ((s = stripped(base)) != NULL) dst[nn++] = s; base = &src[n + 1]; } @@ -545,9 +547,9 @@ } } } - if (showsummary && (dst != 0)) { + if (showsummary && (dst != NULL)) { fprintf(log_fp, "Entries that will be compiled:\n"); - for (n = 0; dst[n] != 0; n++) + for (n = 0; dst[n] != NULL; n++) fprintf(log_fp, "%u:%s\n", n + 1, dst[n]); } return dst; @@ -559,10 +561,10 @@ { bool code = FALSE; - if (needle != 0) { + if (needle != NULL) { size_t n; - for (n = 0; needle[n] != 0; n++) { + for (n = 0; needle[n] != NULL; n++) { if (_nc_name_match(haystack, needle[n], "|")) { code = TRUE; break; @@ -593,20 +595,20 @@ #endif DEBUG(1, ("** stat(%s)", result)); - if (stat(result, &sb) >= 0) { + if (_nc_is_path_found(result, &sb)) { #if USE_HASHED_DB if (!S_ISREG(sb.st_mode) - || access(result, R_OK | W_OK) != 0) { + || _nc_access(result, R_OK | W_OK) != 0) { DEBUG(1, ("...not a writable file")); free(result); - result = 0; + result = NULL; } #else if (!S_ISDIR(sb.st_mode) - || access(result, R_OK | W_OK | X_OK) != 0) { + || _nc_access(result, R_OK | W_OK | X_OK) != 0) { DEBUG(1, ("...not a writable directory")); free(result); - result = 0; + result = NULL; } #endif } else { @@ -617,19 +619,19 @@ if (leaf) { char save = result[leaf]; result[leaf] = 0; - if (stat(result, &sb) >= 0 + if (_nc_is_path_found(result, &sb) && S_ISDIR(sb.st_mode) && access(result, R_OK | W_OK | X_OK) == 0) { result[leaf] = save; } else { DEBUG(1, ("...parent directory %s is not writable", result)); free(result); - result = 0; + result = NULL; } } else { DEBUG(1, ("... no parent directory")); free(result); - result = 0; + result = NULL; } } return result; @@ -643,22 +645,22 @@ static void show_databases(const char *outdir) { - bool specific = (outdir != 0) || getenv("TERMINFO") != 0; + bool specific = (outdir != NULL) || getenv("TERMINFO") != NULL; char *result; - const char *tried = 0; + const char *tried = NULL; if (outdir == NULL) { outdir = _nc_tic_dir(NULL); } - if ((result = valid_db_path(outdir)) != 0) { + if ((result = valid_db_path(outdir)) != NULL) { printf("%s\n", result); free(result); } else { tried = outdir; } - if ((outdir = _nc_home_terminfo())) { - if ((result = valid_db_path(outdir)) != 0) { + if ((outdir = _nc_home_terminfo()) != NULL) { + if ((result = valid_db_path(outdir)) != NULL) { printf("%s\n", result); free(result); } else if (!specific) { @@ -922,13 +924,13 @@ if (infodump == TRUE) { /* captoinfo's no-argument case */ source_file = "/etc/termcap"; - if ((termcap = getenv("TERMCAP")) != 0 - && (namelst = make_namelist(getenv("TERM"))) != 0) { + if ((termcap = getenv("TERMCAP")) != NULL + && (namelst = make_namelist(getenv("TERM"))) != NULL) { if (access(termcap, F_OK) == 0) { /* file exists */ source_file = termcap; } else { - if ((tmp_fp = open_tempfile(my_tmpname)) != 0) { + if ((tmp_fp = open_tempfile(my_tmpname)) != NULL) { source_file = my_tmpname; fprintf(tmp_fp, "%s\n", termcap); fclose(tmp_fp); @@ -1119,7 +1121,7 @@ * Check if the alternate character-set capabilities are consistent. */ static void -check_acs(TERMTYPE2 *tp) +check_acs(const TERMTYPE2 *tp) { int vt100_smacs = 0; int vt100_rmacs = 0; @@ -1332,8 +1334,8 @@ if ((ch = keypad_final(string)) != '\0') { const char *list = "PQRSwxymtuvlqrsPpn"; /* app-keypad except "Enter" */ - char *test = (strchr) (list, ch); - if (test != 0) + const char *test = (strchr) (list, ch); + if (test != NULL) result = (long) (test - list); } return result; @@ -1363,7 +1365,7 @@ } } if (!repeated) { - char *up = list[1]; + const char *up = list[1]; size_t prefix = (size_t) csi_length(up); size_t suffix; @@ -1410,7 +1412,7 @@ #define UNEXPECTED(name) if (PRESENT(name)) _nc_warning("unexpected " #name ", for %s", why) static void -check_noaddress(TERMTYPE2 *tp, const char *why) +check_noaddress(const TERMTYPE2 *tp, const char *why) { UNEXPECTED(column_address); UNEXPECTED(cursor_address); @@ -1541,7 +1543,7 @@ * is mapped inconsistently. */ static void -check_keypad(TERMTYPE2 *tp) +check_keypad(const TERMTYPE2 *tp) { char show[80]; @@ -1710,8 +1712,8 @@ static bool uses_SGR_39_49(const char *value) { - return (strstr(value, "39;49") != 0 - || strstr(value, "49;39") != 0); + return (strstr(value, "39;49") != NULL + || strstr(value, "49;39") != NULL); } /* @@ -1727,7 +1729,7 @@ bool have_kmouse = FALSE; bool use_sgr_39_49 = FALSE; const char *name_39_49 = "orig_pair or orig_colors"; - char *name = _nc_first_name(tp->term_names); + const char *name = _nc_first_name(tp->term_names); bool is_screen = !strncmp(name, "screen", 6); bool screen_base = (is_screen && strchr(name, '.') == NULL); @@ -1895,7 +1897,7 @@ static struct user_table_entry const * lookup_user_capability(const char *name) { - struct user_table_entry const *result = 0; + struct user_table_entry const *result = NULL; if (*name != 'k') { result = _nc_find_user_entry(name); } @@ -1927,7 +1929,7 @@ #if NCURSES_XNAMES else if (using_extensions) { struct user_table_entry const *p = lookup_user_capability(name); - if (p != 0) { + if (p != NULL) { result = (int) p->ute_argc; } } @@ -1985,7 +1987,7 @@ * markers. */ static void -check_params(TERMTYPE2 *tp, const char *name, const char *value, int extended) +check_params(const TERMTYPE2 *tp, const char *name, const char *value, int extended) { int expected = expected_params(name); int actual = 0; @@ -2023,7 +2025,7 @@ _nc_warning("expected character after %% in %s", name); break; } else if (*s == 'p') { - if (*++s == '\0' || !isdigit((int) *s)) { + if (*++s == '\0' || !isdigit(UChar(*s))) { _nc_warning("expected digit after %%p in %s", name); return; } else { @@ -2132,7 +2134,7 @@ skip_DECSCNM(const char *value, int *flag) { *flag = -1; - if (value != 0) { + if (value != NULL) { int skip = csi_length(value); if (skip > 0 && value[skip++] == '?' && @@ -2149,16 +2151,16 @@ } static void -check_delays(TERMTYPE2 *tp, const char *name, const char *value) +check_delays(const TERMTYPE2 *tp, const char *name, const char *value) { const char *p, *q; - const char *first = 0; - const char *last = 0; + const char *first = NULL; + const char *last = NULL; for (p = value; *p != '\0'; ++p) { if (p[0] == '$' && p[1] == '<') { const char *base = p + 2; - const char *mark = 0; + const char *mark = NULL; bool mixed = FALSE; int proportional = 0; int mandatory = 0; @@ -2177,7 +2179,7 @@ ++mandatory; if (mark == NULL) mark = q; - } else if (!(isalnum(UChar(*q)) || strchr("+-.", *q) != 0)) { + } else if (!(isalnum(UChar(*q)) || strchr("+-.", *q) != NULL)) { break; } else if (proportional || mandatory) { mixed = TRUE; @@ -2213,7 +2215,7 @@ if (!strcmp(name, "flash") || !strcmp(name, "beep")) { - if (first != 0) { + if (first != NULL) { if (first == value || *last == 0) { /* * Delay is on one end or the other. @@ -2227,9 +2229,9 @@ * Check for missing delay when using VT100 reverse-video. * A real VT100 might not need this, but terminal emulators do. */ - if ((p = skip_DECSCNM(value, &flag)) != 0 && + if ((p = skip_DECSCNM(value, &flag)) != NULL && flag > 0 && - skip_DECSCNM(p, &flag) != 0 && + skip_DECSCNM(p, &flag) != NULL && flag == 0) { _nc_warning("expected a delay in %s", name); } @@ -2302,7 +2304,7 @@ break; case Other: default: -#define myParam(n) (p_is_s[n - 1] != 0 ? ((TPARM_ARG) strings[n]) : numbers[n]) +#define myParam(n) (p_is_s[n - 1] != NULL ? ((TPARM_ARG) strings[n]) : numbers[n]) result = TPARM_9(value, myParam(1), myParam(2), @@ -2575,7 +2577,7 @@ similar_sgr(int num, char *a, char *b) { char *base_a = a; - char *base_b = b; + const char *base_b = b; int delaying = 0; while (*b != 0) { @@ -2631,7 +2633,7 @@ } static char * -check_sgr(TERMTYPE2 *tp, char *zero, int num, char *cap, const char *name) +check_sgr(const TERMTYPE2 *tp, const char *zero, int num, char *cap, const char *name) { char *test; @@ -2646,7 +2648,7 @@ num == 7, num == 8, num == 9); - if (test != 0) { + if (test != NULL) { if (PRESENT(cap)) { if (!similar_sgr(num, test, cap)) { _nc_warning("%s differs from sgr(%d)\n\t%s=%s\n\tsgr(%d)=%s", @@ -2731,7 +2733,7 @@ } static void -show_fkey_name(NAME_VALUE * data) +show_fkey_name(const NAME_VALUE * data) { if (data->keycode > 0) { fprintf(stderr, " %s", keyname(data->keycode)); @@ -2866,7 +2868,7 @@ static void check_exit_attribute(const char *name, char *test, char *trimmed, char *untrimmed) { - if (VALID_STRING(test) && (trimmed != 0)) { + if (VALID_STRING(test) && (trimmed != NULL)) { if (similar_sgr(-1, trimmed, test) || similar_sgr(-1, untrimmed, test)) { _nc_warning("%s matches exit_attribute_mode", name); @@ -2909,7 +2911,7 @@ * Check if the given capability contains a given SGR attribute. */ static void -check_sgr_param(TERMTYPE2 *tp, int code, const char *name, char *value) +check_sgr_param(TERMTYPE2 *tp, int code, const char *name, const char *const value) { if (VALID_STRING(value)) { int ncv = ((code != 0) ? (1 << (code - 1)) : 0); @@ -2961,7 +2963,7 @@ int result = -1; const struct name_table_entry *np; - if ((np = _nc_find_entry(name, _nc_get_hash_table(0))) != 0) { + if ((np = _nc_find_entry(name, _nc_get_hash_table(0))) != NULL) { result = np->nte_type; } return result; @@ -2988,7 +2990,7 @@ static void check_user_capability_type(const char *name, int actual) { - if (lookup_user_capability(name) == 0) { + if (lookup_user_capability(name) == NULL) { int expected = standard_type(name); if (expected >= 0) { _nc_warning("expected %s to be %s, but actually %s", @@ -3111,7 +3113,7 @@ } static int -guess_ANSI_VTxx(TERMTYPE2 *tp) +guess_ANSI_VTxx(const TERMTYPE2 *tp) { int result = -1; int checks = 0; @@ -3151,10 +3153,10 @@ */ #if defined(user6) && defined(user7) && defined(user8) && defined(user9) static void -check_user_6789(TERMTYPE2 *tp) +check_user_6789(const TERMTYPE2 *tp) { /* - * Check if the terminal is known to not + * Check if the terminal is known to not */ #define NO_QUERY(longname,shortname) \ if (PRESENT(longname)) _nc_warning(#shortname " is not supported") @@ -3200,7 +3202,7 @@ check_conflict(tp); for_each_string(j, tp) { - char *a = tp->Strings[j]; + const char *a = tp->Strings[j]; if (VALID_STRING(a)) { const char *name = ExtStrname(tp, (int) j, strnames); /* @@ -3270,17 +3272,17 @@ ANDMISSING(clear_all_tabs, set_tab); if (PRESENT(set_attributes)) { - char *zero = 0; + char *zero = NULL; _nc_tparm_err = 0; if (PRESENT(exit_attribute_mode)) { - zero = strdup(CHECK_SGR(0, exit_attribute_mode)); + zero = CHECK_SGR(0, exit_attribute_mode); } else { - zero = strdup(TIPARM_9(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, 0)); + zero = TIPARM_9(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, 0); } check_tparm_err(0); - if (zero != 0) { + if (zero != NULL) { CHECK_SGR(1, enter_standout_mode); CHECK_SGR(2, enter_underline_mode); CHECK_SGR(3, enter_reverse_mode); @@ -3290,7 +3292,6 @@ CHECK_SGR(7, enter_secure_mode); CHECK_SGR(8, enter_protected_mode); CHECK_SGR(9, enter_alt_charset_mode); - free(zero); } else { _nc_warning("sgr(0) did not return a value"); } @@ -3366,6 +3367,6 @@ /* * Finally, do the non-verbose checks */ - if (save_check_termtype != 0) + if (save_check_termtype != NULL) save_check_termtype(tp, literal); } diff --git a/contrib/ncurses/progs/toe.c b/contrib/ncurses/progs/toe.c --- a/contrib/ncurses/progs/toe.c +++ b/contrib/ncurses/progs/toe.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2013,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -39,13 +39,11 @@ #include -#include - #if USE_HASHED_DB #include #endif -MODULE_ID("$Id: toe.c,v 1.89 2023/07/01 17:04:46 tom Exp $") +MODULE_ID("$Id: toe.c,v 1.95 2025/12/25 21:54:15 tom Exp $") #define isDotname(name) (!strcmp(name, ".") || !strcmp(name, "..")) @@ -86,7 +84,7 @@ strmalloc(const char *value) { char *result = strdup(value); - if (result == 0) { + if (result == NULL) { failed("strmalloc"); } return result; @@ -100,7 +98,7 @@ if (want >= len_termdata) { len_termdata = (2 * want) + 10; ptr_termdata = typeRealloc(TERMDATA, len_termdata, ptr_termdata); - if (ptr_termdata == 0) + if (ptr_termdata == NULL) failed("ptr_termdata"); } @@ -200,14 +198,14 @@ static void free_termdata(void) { - if (ptr_termdata != 0) { + if (ptr_termdata != NULL) { while (use_termdata != 0) { --use_termdata; free(ptr_termdata[use_termdata].term_name); free(ptr_termdata[use_termdata].description); } free(ptr_termdata); - ptr_termdata = 0; + ptr_termdata = NULL; } use_termdata = 0; len_termdata = 0; @@ -217,7 +215,7 @@ allocArgv(size_t count) { char **result = typeCalloc(char *, count + 1); - if (result == 0) + if (result == NULL) failed("realloc eargv"); assert(result != 0); @@ -265,15 +263,15 @@ typedef void (DescHook) (int /* db_index */ , int /* db_limit */ , const char * /* term_name */ , - TERMTYPE2 * /* term */ ); + const TERMTYPE2 * /* term */ ); static const char * -term_description(TERMTYPE2 *tp) +term_description(const TERMTYPE2 *tp) { const char *desc; - if (tp->term_names == 0 - || (desc = strrchr(tp->term_names, '|')) == 0 + if (tp->term_names == NULL + || (desc = strrchr(tp->term_names, '|')) == NULL || (*++desc == '\0')) { desc = "(No description)"; } @@ -283,7 +281,7 @@ /* display a description for the type */ static void -deschook(int db_index, int db_limit, const char *term_name, TERMTYPE2 *tp) +deschook(int db_index, int db_limit, const char *term_name, const TERMTYPE2 *tp) { (void) db_index; (void) db_limit; @@ -307,7 +305,7 @@ } static unsigned long -checksum_of(TERMTYPE2 *tp) +checksum_of(const TERMTYPE2 *tp) { unsigned long result = string_sum(tp->term_names); unsigned i; @@ -326,7 +324,7 @@ /* collect data, to sort before display */ static void -sorthook(int db_index, int db_limit, const char *term_name, TERMTYPE2 *tp) +sorthook(int db_index, int db_limit, const char *term_name, const TERMTYPE2 *tp) { TERMDATA *data = new_termdata(); @@ -374,10 +372,10 @@ memset(&data, 0, sizeof(data)); data.term_names = strmalloc(buffer); - while ((next = strtok(list, "|")) != 0) { + while ((next = strtok(list, "|")) != NULL) { if (next != last) hook(db_index, db_limit, next, &data); - list = 0; + list = NULL; } free(data.term_names); } @@ -385,11 +383,11 @@ #if NCURSES_USE_DATABASE static char * -copy_entryname(DIRENT * src) +copy_entryname(const DIRENT * src) { size_t len = NAMLEN(src); char *result = malloc(len + 1); - if (result == 0) + if (result == NULL) failed("copy entryname"); memcpy(result, src->d_name, len); result[len] = '\0'; @@ -409,11 +407,11 @@ for (i = 0; i < eargc; i++) { #if NCURSES_USE_DATABASE if (_nc_is_dir_path(eargv[i])) { - char *cwd_buf = 0; + char *cwd_buf = NULL; DIR *termdir; - DIRENT *subdir; + const DIRENT *subdir; - if ((termdir = opendir(eargv[i])) == 0) { + if ((termdir = opendir(eargv[i])) == NULL) { (void) fflush(stdout); (void) fprintf(stderr, "%s: can't open terminfo directory %s\n", @@ -424,11 +422,11 @@ if (verbosity) (void) printf("#\n#%s:\n#\n", eargv[i]); - while ((subdir = readdir(termdir)) != 0) { + while ((subdir = readdir(termdir)) != NULL) { size_t cwd_len; char *name_1; DIR *entrydir; - DIRENT *entry; + const DIRENT *entry; name_1 = copy_entryname(subdir); if (isDotname(name_1)) { @@ -436,9 +434,9 @@ continue; } - cwd_len = NAMLEN(subdir) + strlen(eargv[i]) + 3; + cwd_len = strlen(name_1) + strlen(eargv[i]) + 3; cwd_buf = typeRealloc(char, cwd_len, cwd_buf); - if (cwd_buf == 0) + if (cwd_buf == NULL) failed("realloc cwd_buf"); assert(cwd_buf != 0); @@ -451,11 +449,11 @@ continue; entrydir = opendir("."); - if (entrydir == 0) { + if (entrydir == NULL) { perror(cwd_buf); continue; } - while ((entry = readdir(entrydir)) != 0) { + while ((entry = readdir(entrydir)) != NULL) { char *name_2; TERMTYPE2 lterm; char *cn; @@ -489,7 +487,7 @@ closedir(entrydir); } closedir(termdir); - if (cwd_buf != 0) + if (cwd_buf != NULL) free(cwd_buf); continue; } @@ -502,7 +500,7 @@ (void) printf("#\n#%s:\n#\n", eargv[i]); if (make_db_name(filename, eargv[i], sizeof(filename))) { - if ((capdbp = _nc_db_open(filename, FALSE)) != 0) { + if ((capdbp = _nc_db_open(filename, FALSE)) != NULL) { DBT key, data; int code; @@ -536,13 +534,13 @@ #if HAVE_BSD_CGETENT { CGETENT_CONST char *db_array[2]; - char *buffer = 0; + char *buffer = NULL; if (verbosity) (void) printf("#\n#%s:\n#\n", eargv[i]); db_array[0] = eargv[i]; - db_array[1] = 0; + db_array[1] = NULL; if (cgetfirst(&buffer, db_array) > 0) { if (is_termcap(buffer)) { @@ -605,7 +603,7 @@ bool direct_dependencies = FALSE; bool invert_dependencies = FALSE; bool header = FALSE; - char *report_file = 0; + const char *report_file = NULL; int code; int this_opt, last_opt = '?'; unsigned v_opt = 0; @@ -660,8 +658,8 @@ } use_verbosity(v_opt); - if (report_file != 0) { - if (freopen(report_file, "r", stdin) == 0) { + if (report_file != NULL) { + if (freopen(report_file, "r", stdin) == NULL) { (void) fflush(stdout); fprintf(stderr, "%s: can't open %s\n", _nc_progname, report_file); ExitProgram(EXIT_FAILURE); @@ -669,7 +667,7 @@ /* parse entries out of the source file */ _nc_set_source(report_file); - _nc_read_entry_source(stdin, 0, FALSE, FALSE, NULLHOOK); + _nc_read_entry_source(stdin, NULL, FALSE, FALSE, NULLHOOK); } /* maybe we want a direct-dependency listing? */ @@ -729,7 +727,7 @@ DBDIRS state; int offset; int pass; - char **eargv = 0; + char **eargv = NULL; code = EXIT_FAILURE; for (pass = 0; pass < 2; ++pass) { @@ -737,7 +735,7 @@ const char *path; _nc_first_db(&state, &offset); - while ((path = _nc_next_db(&state, &offset)) != 0) { + while ((path = _nc_next_db(&state, &offset)) != NULL) { if (quick_prefix(path)) continue; if (pass) { @@ -747,7 +745,7 @@ } if (!pass) { eargv = allocArgv(count); - if (eargv == 0) + if (eargv == NULL) failed("eargv"); } else { code = typelist((int) count, eargv, header, hook); @@ -761,10 +759,10 @@ char **eargv = allocArgv((size_t) 2); size_t count = 0; - if (eargv == 0) + if (eargv == NULL) failed("eargv"); _nc_first_db(&state, &offset); - if ((path = _nc_next_db(&state, &offset)) != 0) { + if ((path = _nc_next_db(&state, &offset)) != NULL) { if (!quick_prefix(path)) eargv[count++] = strmalloc(path); } diff --git a/contrib/ncurses/progs/tput.c b/contrib/ncurses/progs/tput.c --- a/contrib/ncurses/progs/tput.c +++ b/contrib/ncurses/progs/tput.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2023,2024 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -47,7 +47,7 @@ #include #include -MODULE_ID("$Id: tput.c,v 1.104 2024/04/20 22:20:51 tom Exp $") +MODULE_ID("$Id: tput.c,v 1.110 2025/01/12 00:36:15 tom Exp $") #define PUTS(s) fputs(s, stdout) @@ -120,11 +120,11 @@ static char my_clear[] = "clear"; char *result = name; - if ((is_init = same_program(name, program ? PROG_INIT : my_init))) + if ((is_init = same_program(name, program ? PROG_INIT : my_init)) == TRUE) result = my_init; - if ((is_reset = same_program(name, program ? PROG_RESET : my_reset))) + if ((is_reset = same_program(name, program ? PROG_RESET : my_reset)) == TRUE) result = my_reset; - if ((is_clear = same_program(name, program ? PROG_CLEAR : my_clear))) + if ((is_clear = same_program(name, program ? PROG_CLEAR : my_clear)) == TRUE) result = my_clear; return result; } @@ -182,8 +182,8 @@ NCURSES_INT2 my_rows = lines; NCURSES_INT2 my_cols = columns; set_window_size(fd, &my_rows, &my_cols); - lines = my_rows; - columns = my_cols; + lines = (short) my_rows; + columns = (short) my_cols; } #else (void) fd; @@ -219,7 +219,7 @@ const struct name_table_entry *np; termcap = TRUE; - if ((np = _nc_find_entry(name, _nc_get_hash_table(termcap))) != 0) { + if ((np = _nc_find_entry(name, _nc_get_hash_table(termcap))) != NULL) { switch (np->nte_type) { case BOOLEAN: name = boolnames[np->nte_index]; @@ -239,54 +239,71 @@ #endif quit(ErrCapName, "unknown terminfo capability '%s'", name); } else if (VALID_STRING(s)) { - if (argc > 1) { - int k; - int narg; - int analyzed; - int provided; - int popcount; - long numbers[1 + NUM_PARM]; - char *strings[1 + NUM_PARM]; - char *p_is_s[NUM_PARM]; - TParams paramType; - - /* Nasty hack time. The tparm function needs to see numeric - * parameters as numbers, not as pointers to their string - * representations - */ - - for (k = 1; (k < argc) && (k <= NUM_PARM); k++) { - char *tmp = 0; - strings[k] = argv[k]; - numbers[k] = strtol(argv[k], &tmp, 0); - if (tmp == 0 || *tmp != 0) - numbers[k] = 0; - } - for (k = argc; k <= NUM_PARM; k++) { - numbers[k] = 0; - strings[k] = 0; - } - - paramType = tparm_type(name); + TParams paramType; + long numbers[1 + NUM_PARM]; + char *strings[1 + NUM_PARM]; + char *p_is_s[NUM_PARM]; + int k; + int narg; + int analyzed = 0; + int provided = 0; + int popcount = 0; + + paramType = tparm_type(name); #if NCURSES_XNAMES - /* - * If the capability is an extended one, analyze the string. - */ - if (paramType == Numbers) { - struct name_table_entry const *entry_ptr; - entry_ptr = _nc_find_type_entry(name, STRING, FALSE); - if (entry_ptr == NULL) { - paramType = Other; - } + /* + * If the capability is an extended one, analyze the string. + */ + if (paramType == Numbers) { + struct name_table_entry const *entry_ptr; + entry_ptr = _nc_find_type_entry(name, STRING, FALSE); + if (entry_ptr == NULL) { + paramType = Other; } + } #endif + /* Nasty hack time. The tparm function needs to see numeric parameters + * as numbers, not as pointers to their string representations + */ + for (k = 1; (k < argc) && (k <= NUM_PARM); k++) { + char *tmp = NULL; + strings[k] = argv[k]; + numbers[k] = strtol(argv[k], &tmp, 0); + if (tmp == NULL || *tmp != 0) + numbers[k] = 0; + } + for (k = argc; k <= NUM_PARM; k++) { + numbers[k] = 0; + strings[k] = NULL; + } - popcount = 0; + switch (paramType) { + case Str: + analyzed = 1; + break; + case Str_Str: + analyzed = 2; + break; + case Num_Str: + analyzed = 2; + break; + case Num_Str_Str: + analyzed = 3; + break; + case Numbers: + case Other: + analyzed = _nc_tparm_analyze(NULL, s, p_is_s, &popcount); + break; + } + if (analyzed < popcount) { + analyzed = popcount; + } + + if (argc > 1) { _nc_reset_tparm(NULL); /* * Count the number of numeric parameters which are provided. */ - provided = 0; for (narg = 1; narg < argc; ++narg) { char *ending = NULL; long check = strtol(argv[narg], &ending, 0); @@ -297,13 +314,11 @@ switch (paramType) { case Str: s = TPARM_1(s, strings[1]); - analyzed = 1; if (provided == 0 && argc >= 1) provided++; break; case Str_Str: s = TPARM_2(s, strings[1], strings[2]); - analyzed = 2; if (provided == 0 && argc >= 1) provided++; if (provided == 1 && argc >= 2) @@ -311,22 +326,19 @@ break; case Num_Str: s = TPARM_2(s, numbers[1], strings[2]); - analyzed = 2; if (provided == 1 && argc >= 2) provided++; break; case Num_Str_Str: s = TPARM_3(s, numbers[1], strings[2], strings[3]); - analyzed = 3; if (provided == 1 && argc >= 2) provided++; if (provided == 2 && argc >= 3) provided++; break; case Numbers: - analyzed = _nc_tparm_analyze(NULL, s, p_is_s, &popcount); #define myParam(n) numbers[n] - s = TIPARM_9(s, + s = TIPARM_N(analyzed, s, myParam(1), myParam(2), myParam(3), @@ -341,24 +353,20 @@ case Other: /* FALLTHRU */ default: - analyzed = _nc_tparm_analyze(NULL, s, p_is_s, &popcount); -#define myParam(n) (p_is_s[n - 1] != 0 ? ((TPARM_ARG) strings[n]) : numbers[n]) - s = TPARM_9(s, - myParam(1), - myParam(2), - myParam(3), - myParam(4), - myParam(5), - myParam(6), - myParam(7), - myParam(8), - myParam(9)); +#define myParam(n) (p_is_s[n - 1] != NULL ? ((TPARM_ARG) strings[n]) : numbers[n]) + s = TIPARM_N(analyzed, s, + myParam(1), + myParam(2), + myParam(3), + myParam(4), + myParam(5), + myParam(6), + myParam(7), + myParam(8), + myParam(9)); #undef myParam break; } - if (analyzed < popcount) { - analyzed = popcount; - } if (opt_v && (analyzed != provided)) { fprintf(stderr, "%s: %s parameters for \"%s\"\n", _nc_progname, @@ -366,6 +374,12 @@ argv[0]); } *used += provided; + } else { + if (opt_v) { + fprintf(stderr, "%s: missing parameters for \"%s\"\n", + _nc_progname, + argv[0]); + } } /* use putp() in order to perform padding */ @@ -440,7 +454,7 @@ argv += optind; } - if (term == 0 || *term == '\0') + if (term == NULL || *term == '\0') quit(ErrUsage, "No value for $TERM and no -T specified"); fd = save_tty_settings(&tty_settings, need_tty); @@ -464,7 +478,7 @@ ExitProgram(code); } - while (fgets(buf, sizeof(buf), stdin) != 0) { + while (fgets(buf, sizeof(buf), stdin) != NULL) { size_t need = strlen(buf); char **argvec = typeCalloc(char *, need + 1); char **argnow; diff --git a/contrib/ncurses/progs/tset.c b/contrib/ncurses/progs/tset.c --- a/contrib/ncurses/progs/tset.c +++ b/contrib/ncurses/progs/tset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2021,2024 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -98,7 +98,7 @@ char *ttyname(int fd); #endif -MODULE_ID("$Id: tset.c,v 1.135 2024/04/20 22:20:41 tom Exp $") +MODULE_ID("$Id: tset.c,v 1.141 2025/11/01 20:16:41 tom Exp $") #ifndef environ extern char **environ; @@ -185,19 +185,19 @@ (void) fprintf(stderr, "Terminal type? "); (void) fflush(stderr); - if (fgets(answer, sizeof(answer), stdin) == 0) { - if (dflt == 0) { + if (fgets(answer, sizeof(answer), stdin) == NULL) { + if (dflt == NULL) { exit_error(); /* NOTREACHED */ } return (dflt); } - if ((p = strchr(answer, '\n')) != 0) + if ((p = strchr(answer, '\n')) != NULL) *p = '\0'; if (answer[0]) return (answer); - if (dflt != 0) + if (dflt != NULL) return (dflt); } } @@ -233,7 +233,7 @@ int speed; } SPEEDS; -#if defined(EXP_WIN32_DRIVER) +#if defined(_NC_WINDOWS) static const SPEEDS speeds[] = { {"0", 0} @@ -344,7 +344,7 @@ static int tbaudrate(char *rate) { - const SPEEDS *sp = 0; + const SPEEDS *sp = NULL; size_t n; /* The baudrate number can be preceded by a 'B', which is ignored. */ @@ -361,7 +361,7 @@ break; } } - if (sp == 0) + if (sp == NULL) err("unknown baud rate %s", rate); return (sp->speed); } @@ -377,18 +377,18 @@ MAP *mapp; char *copy, *p; const char *termp; - char *base = 0; + char *base = NULL; copy = strdup(arg); mapp = typeMalloc(MAP, 1); - if (copy == 0 || mapp == 0) + if (copy == NULL || mapp == NULL) failed("malloc"); assert(copy != 0); assert(mapp != 0); - mapp->next = 0; - if (maplist == 0) + mapp->next = NULL; + if (maplist == NULL) cur = maplist = mapp; else { cur->next = mapp; @@ -400,14 +400,14 @@ arg = strpbrk(arg, "><@=!:"); - if (arg == 0) { /* [?]term */ + if (arg == NULL) { /* [?]term */ mapp->type = mapp->porttype; - mapp->porttype = 0; + mapp->porttype = NULL; goto done; } if (arg == mapp->porttype) /* [><@=! baud]:term */ - termp = mapp->porttype = 0; + termp = mapp->porttype = NULL; else termp = base = arg; @@ -442,7 +442,7 @@ ++arg; } else { /* Optional baudrate. */ arg = strchr(p = arg, ':'); - if (arg == 0) + if (arg == NULL) goto badmopt; *arg++ = '\0'; mapp->speed = tbaudrate(p); @@ -451,7 +451,7 @@ mapp->type = arg; /* Terminate porttype, if specified. */ - if (termp != 0) + if (termp != NULL) *base = '\0'; /* If a NOT conditional, reverse the test. */ @@ -499,7 +499,7 @@ int match; for (mapp = maplist; mapp; mapp = mapp->next) - if (mapp->porttype == 0 || !strcmp(mapp->porttype, type)) { + if (mapp->porttype == NULL || !strcmp(mapp->porttype, type)) { switch (mapp->conditional) { case 0: /* No test specified. */ match = TRUE; @@ -543,7 +543,7 @@ get_termcap_entry(int fd, char *userarg) { int errret; - char *p; + const char *p; const char *ttype; #if HAVE_PATH_TTYS #if HAVE_GETTTYNAM @@ -562,11 +562,11 @@ } /* Try the environment. */ - if ((ttype = getenv("TERM")) != 0) + if ((ttype = getenv("TERM")) != NULL) goto map; #if HAVE_PATH_TTYS - if ((ttypath = ttyname(fd)) != 0) { + if ((ttypath = ttyname(fd)) != NULL) { p = _nc_basename(ttypath); #if HAVE_GETTTYNAM /* @@ -574,7 +574,7 @@ * there's an /etc/ttys to look up device-to-type mappings in. * Try ttyname(3); check for dialup or other mapping. */ - if ((t = getttynam(p))) { + if ((t = getttynam(p)) != NULL) { ttype = t->ty_type; goto map; } @@ -616,14 +616,14 @@ * by out of date stuff in the environment. */ found: - if ((p = getenv("TERMCAP")) != 0 && !_nc_is_abs_path(p)) { + if ((p = getenv("TERMCAP")) != NULL && !_nc_is_abs_path(p)) { /* 'unsetenv("TERMCAP")' is not portable. * The 'environ' array is better. */ int n; - for (n = 0; environ[n] != 0; n++) { + for (n = 0; environ[n] != NULL; n++) { if (!strncmp("TERMCAP=", environ[n], (size_t) 8)) { - while ((environ[n] = environ[n + 1]) != 0) { + while ((environ[n] = environ[n + 1]) != NULL) { n++; } break; @@ -639,7 +639,7 @@ if (ttype[1] != '\0') ttype = askuser(ttype + 1); else - ttype = askuser(0); + ttype = askuser(NULL); } /* Find the terminfo entry. If it doesn't exist, ask the user. */ while (setupterm((NCURSES_CONST char *) ttype, fd, &errret) @@ -647,12 +647,12 @@ if (errret == 0) { (void) fprintf(stderr, "%s: unknown terminal type %s\n", _nc_progname, ttype); - ttype = 0; + ttype = NULL; } else { (void) fprintf(stderr, "%s: can't initialize terminal type %s (error %d)\n", _nc_progname, ttype, errret); - ttype = 0; + ttype = NULL; } ttype = askuser(ttype); } @@ -676,7 +676,7 @@ obsolete(char **argv) { for (; *argv; ++argv) { - char *parm = argv[0]; + const char *parm = argv[0]; if (parm[0] == '-' && parm[1] == '\0') { argv[0] = strdup("-q"); @@ -713,7 +713,7 @@ * Figure out what shell we're using. A hack, we look for an * environmental variable SHELL ending in "csh". */ - if ((var = getenv("SHELL")) != 0 + if ((var = getenv("SHELL")) != NULL && ((len = (int) strlen(leaf = _nc_basename(var))) >= 3) && !strcmp(leaf + len - 3, "csh")) p = "set noglob;\nsetenv TERM %s;\nunset noglob;\n"; @@ -806,7 +806,7 @@ tkillchar = arg_to_char(); break; case 'm': /* map identifier to type */ - add_mapping(0, optarg); + add_mapping(NULL, optarg); break; case 'p': /* OBSOLETE: map identifier to type */ add_mapping("plugboard", optarg); @@ -851,7 +851,7 @@ oldmode = mode; #ifdef TERMIOS ospeed = (NCURSES_OSPEED) cfgetospeed(&mode); -#elif defined(EXP_WIN32_DRIVER) +#elif defined(_NC_WINDOWS) ospeed = 0; #else ospeed = (NCURSES_OSPEED) mode.sg_ospeed; @@ -872,8 +872,8 @@ NCURSES_INT2 my_rows = lines; NCURSES_INT2 my_cols = columns; set_window_size(my_fd, &my_rows, &my_cols); - lines = my_rows; - columns = my_cols; + lines = (short) my_rows; + columns = (short) my_cols; } #endif if (opt_c) { diff --git a/contrib/nvi/.gitignore b/contrib/nvi/.gitignore deleted file mode 100644 --- a/contrib/nvi/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -*.swp -*~ -*.orig -*.core -extern.h -*_def.h -version.h -tags -build/ - -# Ignore files by the GNU Global source code tagging system. -/GPATH -/GRTAGS -/GTAGS diff --git a/contrib/nvi/CMakeLists.txt b/contrib/nvi/CMakeLists.txt --- a/contrib/nvi/CMakeLists.txt +++ b/contrib/nvi/CMakeLists.txt @@ -42,10 +42,6 @@ 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) @@ -81,44 +77,59 @@ set(REGEX_SRCS regex/regcomp.c regex/regerror.c regex/regexec.c regex/regfree.c) +set(GENERATED_HDRS + ${CMAKE_CURRENT_BINARY_DIR}/cl_extern.h + ${CMAKE_CURRENT_BINARY_DIR}/common_extern.h + ${CMAKE_CURRENT_BINARY_DIR}/ex_extern.h + ${CMAKE_CURRENT_BINARY_DIR}/vi_extern.h + ${CMAKE_CURRENT_BINARY_DIR}/options_def.h + ${CMAKE_CURRENT_BINARY_DIR}/ex_def.h + ${CMAKE_CURRENT_BINARY_DIR}/version.h) + # 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 +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cl_extern.h + COMMAND ${extract_protos} ${CL_SRCS} > + ${CMAKE_CURRENT_BINARY_DIR}/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 +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/common_extern.h + COMMAND ${extract_protos} ${COMMON_SRCS} > + ${CMAKE_CURRENT_BINARY_DIR}/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 +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ex_extern.h + COMMAND ${extract_protos} ${EX_SRCS} > + ${CMAKE_CURRENT_BINARY_DIR}/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 +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/vi_extern.h + COMMAND ${extract_protos} ${VI_SRCS} > + ${CMAKE_CURRENT_BINARY_DIR}/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 +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/options_def.h + COMMAND awk -f common/options.awk common/options.c > + ${CMAKE_CURRENT_BINARY_DIR}/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 +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ex_def.h + COMMAND awk -f ex/ex.awk ex/ex_cmd.c > + ${CMAKE_CURRENT_BINARY_DIR}/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 +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.h + COMMAND ${extract_version} README > + ${CMAKE_CURRENT_BINARY_DIR}/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_sources(nvi PRIVATE ${CL_SRCS} ${COMMON_SRCS} ${EX_SRCS} ${VI_SRCS} + ${GENERATED_HDRS}) target_compile_definitions(nvi PRIVATE $<$:DEBUG> $<$:COMLOG>) @@ -208,18 +219,8 @@ if(NOT DBOPEN_IN_LIBC) target_link_libraries(nvi PRIVATE db1) endif() -if (APPLE) - # Avoid using an incompatible db.h installed to /usr/local (since this is - # part of the default search path on macOS) - set(DB_H_GUESS "${CMAKE_OSX_SYSROOT}/usr/include/db.h") - if (NOT EXISTS ${DB_H_GUESS}) - message(FATAL_ERROR "Could not find db.h at the expected path (${DB_H_GUESS}).") - endif() - add_definitions("-DDB_H_ABS_PATH=<${DB_H_GUESS}>") -else() - find_path(DB_INCLUDE_DIR db.h PATH_SUFFIXES db1) - target_include_directories(nvi PRIVATE ${DB_INCLUDE_DIR}) -endif() +find_path(DB_INCLUDE_DIR db.h PATH_SUFFIXES db1) +target_include_directories(nvi PRIVATE ${DB_INCLUDE_DIR}) check_include_files(libutil.h HAVE_LIBUTIL_H) check_include_files(ncurses.h HAVE_NCURSES_H) diff --git a/contrib/nvi/README b/contrib/nvi/README --- a/contrib/nvi/README +++ b/contrib/nvi/README @@ -1,4 +1,4 @@ -This is version 2.2.1 (2023-09-25) of nex/nvi, a reimplementation of the ex/vi +This is version 2.2.2 (2025-10-08) of nex/nvi, a reimplementation of the ex/vi text editors originally distributed as part of the Fourth Berkeley Software Distribution (4BSD), by the University of California, Berkeley. diff --git a/contrib/nvi/cl/cl.h b/contrib/nvi/cl/cl.h --- a/contrib/nvi/cl/cl.h +++ b/contrib/nvi/cl/cl.h @@ -77,4 +77,4 @@ #define RCNO(sp, cno) (cno) #define RLNO(sp, lno) (lno) -#include "extern.h" +#include "cl_extern.h" diff --git a/contrib/nvi/cl/extern.h b/contrib/nvi/cl/extern.h new file mode 100644 --- /dev/null +++ b/contrib/nvi/cl/extern.h @@ -0,0 +1,31 @@ +int cl_waddstr(SCR *, const CHAR_T *, size_t); +int cl_addstr(SCR *, const char *, size_t); +int cl_attr(SCR *, scr_attr_t, int); +int cl_baud(SCR *, u_long *); +int cl_bell(SCR *); +int cl_clrtoeol(SCR *); +int cl_cursor(SCR *, size_t *, size_t *); +int cl_deleteln(SCR *); +int cl_discard(SCR *, SCR **); +int cl_ex_adjust(SCR *, exadj_t); +int cl_insertln(SCR *); +int cl_keyval(SCR *, scr_keyval_t, CHAR_T *, int *); +int cl_move(SCR *, size_t, size_t); +int cl_refresh(SCR *, int); +int cl_rename(SCR *, char *, int); +void cl_setname(GS *, char *); +int cl_split(SCR *, SCR *); +int cl_suspend(SCR *, int *); +void cl_usage(void); +int sig_init(GS *, SCR *); +int cl_event(SCR *, EVENT *, u_int32_t, int); +int cl_screen(SCR *, u_int32_t); +int cl_quit(GS *); +int cl_getcap(SCR *, char *, char **); +int cl_term_init(SCR *); +int cl_term_end(GS *); +int cl_fmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t); +int cl_optchange(SCR *, int, char *, u_long *); +int cl_omesg(SCR *, CL_PRIVATE *, int); +int cl_ssize(SCR *, int, size_t *, size_t *, int *); +int cl_putchar(int); diff --git a/contrib/nvi/common/common.h b/contrib/nvi/common/common.h --- a/contrib/nvi/common/common.h +++ b/contrib/nvi/common/common.h @@ -11,11 +11,7 @@ #define TCSASOFT 0 #endif -#ifdef DB_H_ABS_PATH -#include DB_H_ABS_PATH -#else #include -#endif #include /* May refer to the bundled regex. */ #include @@ -92,4 +88,11 @@ #include "log.h" #include "mem.h" -#include "extern.h" +#include "common_extern.h" + +#ifndef SLIST_REMOVE_AFTER +#define SLIST_REMOVE_AFTER(elm, field) do { \ + SLIST_NEXT(elm, field) = \ + SLIST_NEXT(SLIST_NEXT(elm, field), field); \ +} while (0) +#endif diff --git a/contrib/nvi/common/cut.c b/contrib/nvi/common/cut.c --- a/contrib/nvi/common/cut.c +++ b/contrib/nvi/common/cut.c @@ -68,6 +68,10 @@ recno_t lno; int append, copy_one, copy_def; + /* Check if the line numbers are out-of-band */ + if (fm->lno == OOBLNO || tm->lno == OOBLNO) + return (1); + /* * If the user specified a buffer, put it there. (This may require * a copy into the numeric buffers. We do the copy so that we don't @@ -175,6 +179,7 @@ text_lfree(cbp->textq); cbp->len = 0; cbp->flags = 0; + sp->gp->dcbp = NULL; return (1); } diff --git a/contrib/nvi/common/extern.h b/contrib/nvi/common/extern.h new file mode 100644 --- /dev/null +++ b/contrib/nvi/common/extern.h @@ -0,0 +1,131 @@ +char * codeset(void); +void conv_init(SCR *, SCR *); +int conv_enc(SCR *, int, char *); +void conv_end(SCR *); +int cut(SCR *, CHAR_T *, MARK *, MARK *, int); +int cut_line(SCR *, recno_t, size_t, size_t, CB *); +void cut_close(GS *); +TEXT *text_init(SCR *, const CHAR_T *, size_t, size_t); +void text_lfree(TEXTH *); +void text_free(TEXT *); +int del(SCR *, MARK *, MARK *, int); +int looks_utf8(const char *, size_t); +int looks_utf16(const char *, size_t); +int decode_utf8(const char *); +int decode_utf16(const char *, int); +FREF *file_add(SCR *, char *); +int file_init(SCR *, FREF *, char *, int); +int file_end(SCR *, EXF *, int); +int file_write(SCR *, MARK *, MARK *, char *, int); +int file_m1(SCR *, int, int); +int file_m2(SCR *, int); +int file_m3(SCR *, int); +int file_aw(SCR *, int); +void set_alt_name(SCR *, char *); +lockr_t file_lock(SCR *, char *, int, int); +int v_key_init(SCR *); +void v_key_ilookup(SCR *); +size_t v_key_len(SCR *, ARG_CHAR_T); +char *v_key_name(SCR *, ARG_CHAR_T); +e_key_t v_key_val(SCR *, ARG_CHAR_T); +int v_event_push(SCR *, EVENT *, CHAR_T *, size_t, u_int); +int v_event_get(SCR *, EVENT *, int, u_int32_t); +void v_event_err(SCR *, EVENT *); +int v_event_flush(SCR *, u_int); +int db_eget(SCR *, recno_t, CHAR_T **, size_t *, int *); +int db_get(SCR *, recno_t, u_int32_t, CHAR_T **, size_t *); +int db_delete(SCR *, recno_t); +int db_append(SCR *, int, recno_t, CHAR_T *, size_t); +int db_insert(SCR *, recno_t, CHAR_T *, size_t); +int db_set(SCR *, recno_t, CHAR_T *, size_t); +int db_exist(SCR *, recno_t); +int db_last(SCR *, recno_t *); +int db_rget(SCR *, recno_t, char **, size_t *); +int db_rset(SCR *, recno_t, char *, size_t); +void db_err(SCR *, recno_t); +int log_init(SCR *, EXF *); +int log_end(SCR *, EXF *); +int log_cursor(SCR *); +int log_line(SCR *, recno_t, u_int); +int log_mark(SCR *, LMARK *); +int log_backward(SCR *, MARK *); +int log_setline(SCR *); +int log_forward(SCR *, MARK *); +int editor(GS *, int, char *[]); +void v_end(GS *); +int mark_init(SCR *, EXF *); +int mark_end(SCR *, EXF *); +int mark_get(SCR *, ARG_CHAR_T, MARK *, mtype_t); +int mark_set(SCR *, ARG_CHAR_T, MARK *, int); +int mark_insdel(SCR *, lnop_t, recno_t); +void msgq(SCR *, mtype_t, const char *, ...); +void msgq_wstr(SCR *, mtype_t, const CHAR_T *, const char *); +void msgq_str(SCR *, mtype_t, const char *, const char *); +void mod_rpt(SCR *); +void msgq_status(SCR *, recno_t, u_int); +int msg_open(SCR *, char *); +void msg_close(GS *); +const char *msg_cmsg(SCR *, cmsg_t, size_t *); +const char *msg_cat(SCR *, const char *, size_t *); +char *msg_print(SCR *, const char *, int *); +int opts_init(SCR *, int *); +int opts_set(SCR *, ARGS *[], char *); +int o_set(SCR *, int, u_int, char *, u_long); +int opts_empty(SCR *, int, int); +void opts_dump(SCR *, enum optdisp); +int opts_save(SCR *, FILE *); +OPTLIST const *opts_search(CHAR_T *); +void opts_nomatch(SCR *, CHAR_T *); +int opts_copy(SCR *, SCR *); +void opts_free(SCR *); +int f_altwerase(SCR *, OPTION *, char *, u_long *); +int f_columns(SCR *, OPTION *, char *, u_long *); +int f_lines(SCR *, OPTION *, char *, u_long *); +int f_lisp(SCR *, OPTION *, char *, u_long *); +int f_msgcat(SCR *, OPTION *, char *, u_long *); +int f_print(SCR *, OPTION *, char *, u_long *); +int f_readonly(SCR *, OPTION *, char *, u_long *); +int f_recompile(SCR *, OPTION *, char *, u_long *); +int f_reformat(SCR *, OPTION *, char *, u_long *); +int f_ttywerase(SCR *, OPTION *, char *, u_long *); +int f_w300(SCR *, OPTION *, char *, u_long *); +int f_w1200(SCR *, OPTION *, char *, u_long *); +int f_w9600(SCR *, OPTION *, char *, u_long *); +int f_window(SCR *, OPTION *, char *, u_long *); +int f_encoding(SCR *, OPTION *, char *, u_long *); +int put(SCR *, CB *, CHAR_T *, MARK *, MARK *, int); +int rcv_tmp(SCR *, EXF *, char *); +int rcv_init(SCR *); +int rcv_sync(SCR *, u_int); +int rcv_list(SCR *); +int rcv_read(SCR *, FREF *); +int screen_init(GS *, SCR *, SCR **); +int screen_end(SCR *); +SCR *screen_next(SCR *); +int f_search(SCR *, + MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int); +int b_search(SCR *, + MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int); +void search_busy(SCR *, busy_t); +int seq_set(SCR *, CHAR_T *, + size_t, CHAR_T *, size_t, CHAR_T *, size_t, seq_t, int); +int seq_delete(SCR *, CHAR_T *, size_t, seq_t); +int seq_free(SEQ *); +SEQ *seq_find + (SCR *, SEQ **, EVENT *, CHAR_T *, size_t, seq_t, int *); +void seq_close(GS *); +int seq_dump(SCR *, seq_t, int); +int seq_save(SCR *, FILE *, char *, seq_t); +int e_memcmp(CHAR_T *, EVENT *, size_t); +void *binc(SCR *, void *, size_t *, size_t); +int nonblank(SCR *, recno_t, size_t *); +char *join(char *, char *); +char *expanduser(char *); +char *quote(char *); +char *v_strdup(SCR *, const char *, size_t); +CHAR_T *v_wstrdup(SCR *, const CHAR_T *, size_t); +enum nresult nget_uslong(u_long *, const CHAR_T *, CHAR_T **, int); +enum nresult nget_slong(long *, const CHAR_T *, CHAR_T **, int); +void timepoint_steady(struct timespec *); +void timepoint_system(struct timespec *); +void TRACE(SCR *, const char *, ...); diff --git a/contrib/nvi/common/line.c b/contrib/nvi/common/line.c --- a/contrib/nvi/common/line.c +++ b/contrib/nvi/common/line.c @@ -51,7 +51,7 @@ * line in an empty file, find the last line of the file; db_last * fails loudly. */ - if ((lno == 0 || lno == 1) && db_last(sp, &l1)) + if ((lno == OOBLNO || lno == 1) && db_last(sp, &l1)) return (1); /* If the file isn't empty, fail loudly. */ @@ -92,7 +92,7 @@ * have to have an OOB condition for the look-aside into the input * buffer anyway. */ - if (lno == 0) + if (lno == OOBLNO) goto err1; /* Check for no underlying file. */ diff --git a/contrib/nvi/common/options.c b/contrib/nvi/common/options.c --- a/contrib/nvi/common/options.c +++ b/contrib/nvi/common/options.c @@ -317,14 +317,13 @@ argv[1] = &b; /* Set numeric and string default values. */ -#define OI(indx, str) do { \ - a.len = STRLEN(str); \ - if (STRCMP((CHAR_T*)str, b2) != 0) \ - (void)MEMCPY(b2, str, a.len+1); \ - if (opts_set(sp, argv, NULL)) { \ - optindx = indx; \ +#define OI(indx, ...) do { \ + size_t len = SPRINTF(b2, SIZE(b2), __VA_ARGS__); \ + if (len < 0 || len >= SIZE(b2) || opts_set(sp, argv, NULL)) { \ + optindx = indx; \ goto err; \ } \ + a.len = len; \ } while (0) /* * Indirect global options to global space. Specifically, set up @@ -345,9 +344,7 @@ F_SET(&sp->opts[O_SECURE], OPT_GLOBAL); /* Initialize string values. */ - (void)SPRINTF(b2, SIZE(b2), - L("cdpath=%s"), (s = getenv("CDPATH")) == NULL ? ":" : s); - OI(O_CDPATH, b2); + OI(O_CDPATH, L("cdpath=%s"), (s = getenv("CDPATH")) == NULL ? ":" : s); OI(O_CEDIT, L("cedit=\033")); /* @@ -357,32 +354,26 @@ * are two ways to change this -- the user can set either the directory * option or the TMPDIR environmental variable. */ - (void)SPRINTF(b2, SIZE(b2), + OI(O_TMPDIR, L("directory=%s"), (s = getenv("TMPDIR")) == NULL ? _PATH_TMP : s); - OI(O_TMPDIR, b2); OI(O_ESCAPETIME, L("escapetime=6")); OI(O_FILEC, L("filec=\t")); OI(O_KEYTIME, L("keytime=6")); OI(O_MATCHCHARS, L("matchchars=()[]{}")); OI(O_MATCHTIME, L("matchtime=7")); - (void)SPRINTF(b2, SIZE(b2), L("msgcat=%s"), _PATH_MSGCAT); - OI(O_MSGCAT, b2); + OI(O_MSGCAT, L("msgcat=%s"), _PATH_MSGCAT); OI(O_REPORT, L("report=5")); OI(O_PARAGRAPHS, L("paragraphs=IPLPPPQPP LIpplpipbp")); - (void)SPRINTF(b2, SIZE(b2), L("path=%s"), ""); - OI(O_PATH, b2); - (void)SPRINTF(b2, SIZE(b2), L("recdir=%s"), NVI_PATH_PRESERVE); - OI(O_RECDIR, b2); + OI(O_PATH, L("path=%s"), ""); + OI(O_RECDIR, L("recdir=%s"), NVI_PATH_PRESERVE); OI(O_SECTIONS, L("sections=NHSHH HUnhsh")); - (void)SPRINTF(b2, SIZE(b2), + OI(O_SHELL, L("shell=%s"), (s = getenv("SHELL")) == NULL ? _PATH_BSHELL : s); - OI(O_SHELL, b2); OI(O_SHELLMETA, L("shellmeta=~{[*?$`'\"\\")); OI(O_SHIFTWIDTH, L("shiftwidth=8")); OI(O_SIDESCROLL, L("sidescroll=16")); OI(O_TABSTOP, L("tabstop=8")); - (void)SPRINTF(b2, SIZE(b2), L("tags=%s"), _PATH_TAGS); - OI(O_TAGS, b2); + OI(O_TAGS, L("tags=%s"), _PATH_TAGS); /* * XXX @@ -391,8 +382,7 @@ */ if ((v = (O_VAL(sp, O_LINES) - 1) / 2) == 0) v = 1; - (void)SPRINTF(b2, SIZE(b2), L("scroll=%ld"), v); - OI(O_SCROLL, b2); + OI(O_SCROLL, L("scroll=%ld"), v); /* * The default window option values are: @@ -412,8 +402,7 @@ else if ((v = O_VAL(sp, O_LINES) - 1) == 0) v = 1; - (void)SPRINTF(b2, SIZE(b2), L("window=%lu"), v); - OI(O_WINDOW, b2); + OI(O_WINDOW, L("window=%lu"), v); /* * Set boolean default values, and copy all settings into the default diff --git a/contrib/nvi/common/options_def.h b/contrib/nvi/common/options_def.h new file mode 100644 --- /dev/null +++ b/contrib/nvi/common/options_def.h @@ -0,0 +1,86 @@ +#define O_ALTNOTATION 0 +#define O_ALTWERASE 1 +#define O_AUTOINDENT 2 +#define O_AUTOPRINT 3 +#define O_AUTOWRITE 4 +#define O_BACKUP 5 +#define O_BEAUTIFY 6 +#define O_CDPATH 7 +#define O_CEDIT 8 +#define O_COLUMNS 9 +#define O_COMBINED 10 +#define O_COMMENT 11 +#define O_TMPDIR 12 +#define O_EDCOMPATIBLE 13 +#define O_ERRORBELLS 14 +#define O_ESCAPETIME 15 +#define O_EXPANDTAB 16 +#define O_EXRC 17 +#define O_EXTENDED 18 +#define O_FILEC 19 +#define O_FILEENCODING 20 +#define O_FLASH 21 +#define O_HARDTABS 22 +#define O_ICLOWER 23 +#define O_IGNORECASE 24 +#define O_INPUTENCODING 25 +#define O_KEYTIME 26 +#define O_LEFTRIGHT 27 +#define O_LINES 28 +#define O_LISP 29 +#define O_LIST 30 +#define O_LOCKFILES 31 +#define O_MAGIC 32 +#define O_MATCHCHARS 33 +#define O_MATCHTIME 34 +#define O_MESG 35 +#define O_MODELINE 36 +#define O_MSGCAT 37 +#define O_NOPRINT 38 +#define O_NUMBER 39 +#define O_OCTAL 40 +#define O_OPEN 41 +#define O_OPTIMIZE 42 +#define O_PARAGRAPHS 43 +#define O_PATH 44 +#define O_PRINT 45 +#define O_PROMPT 46 +#define O_READONLY 47 +#define O_RECDIR 48 +#define O_REDRAW 49 +#define O_REMAP 50 +#define O_REPORT 51 +#define O_RULER 52 +#define O_SCROLL 53 +#define O_SEARCHINCR 54 +#define O_SECTIONS 55 +#define O_SECURE 56 +#define O_SHELL 57 +#define O_SHELLMETA 58 +#define O_SHIFTWIDTH 59 +#define O_SHOWFILENAME 60 +#define O_SHOWMATCH 61 +#define O_SHOWMODE 62 +#define O_SIDESCROLL 63 +#define O_SLOWOPEN 64 +#define O_SOURCEANY 65 +#define O_TABSTOP 66 +#define O_TAGLENGTH 67 +#define O_TAGS 68 +#define O_TERM 69 +#define O_TERSE 70 +#define O_TILDEOP 71 +#define O_TIMEOUT 72 +#define O_TTYWERASE 73 +#define O_VERBOSE 74 +#define O_W1200 75 +#define O_W300 76 +#define O_W9600 77 +#define O_WARN 78 +#define O_WINDOW 79 +#define O_WINDOWNAME 80 +#define O_WRAPLEN 81 +#define O_WRAPMARGIN 82 +#define O_WRAPSCAN 83 +#define O_WRITEANY 84 +#define O_OPTIONCOUNT 85 diff --git a/contrib/nvi/common/put.c b/contrib/nvi/common/put.c --- a/contrib/nvi/common/put.c +++ b/contrib/nvi/common/put.c @@ -26,16 +26,16 @@ * put -- * Put text buffer contents into the file. * - * PUBLIC: int put(SCR *, CB *, CHAR_T *, MARK *, MARK *, int); + * PUBLIC: int put(SCR *, CB *, CHAR_T *, MARK *, MARK *, int, int); */ int -put(SCR *sp, CB *cbp, CHAR_T *namep, MARK *cp, MARK *rp, int append) +put(SCR *sp, CB *cbp, CHAR_T *namep, MARK *cp, MARK *rp, int append, int cnt) { CHAR_T name; TEXT *ltp, *tp; recno_t lno; size_t blen, clen, len; - int rval; + int rval, i, isempty; CHAR_T *bp, *t; CHAR_T *p; @@ -77,11 +77,16 @@ if (cp->lno == 1) { if (db_last(sp, &lno)) return (1); - if (lno == 0) { - for (; tp != NULL; - ++lno, ++sp->rptlines[L_ADDED], tp = TAILQ_NEXT(tp, q)) - if (db_append(sp, 1, lno, tp->lb, tp->len)) - return (1); + if (lno == 0 && F_ISSET(cbp, CB_LMODE)) { + for (i = cnt; i > 0; i--) { + for (; tp != NULL; + ++lno, ++sp->rptlines[L_ADDED], + tp = TAILQ_NEXT(tp, q)) + if (db_append(sp, 1, lno, tp->lb, + tp->len)) + return (1); + tp = TAILQ_FIRST(cbp->textq); + } rp->lno = 1; rp->cno = 0; return (0); @@ -92,10 +97,14 @@ if (F_ISSET(cbp, CB_LMODE)) { lno = append ? cp->lno : cp->lno - 1; rp->lno = lno + 1; - for (; tp != NULL; - ++lno, ++sp->rptlines[L_ADDED], tp = TAILQ_NEXT(tp, q)) - if (db_append(sp, 1, lno, tp->lb, tp->len)) - return (1); + for (i = cnt; i > 0; i--) { + for (; tp != NULL; + ++lno, ++sp->rptlines[L_ADDED], + tp = TAILQ_NEXT(tp, q)) + if (db_append(sp, 1, lno, tp->lb, tp->len)) + return (1); + tp = TAILQ_FIRST(cbp->textq); + } rp->cno = 0; (void)nonblank(sp, rp->lno, &rp->cno); return (0); @@ -111,8 +120,11 @@ * Get the first line. */ lno = cp->lno; - if (db_get(sp, lno, DBG_FATAL, &p, &len)) - return (1); + if (db_eget(sp, lno, &p, &len, &isempty)) { + if (!isempty) + return (1); + len = 0; + } GET_SPACE_RETW(sp, bp, blen, tp->len + len + 1); t = bp; @@ -126,8 +138,10 @@ /* First line from the CB. */ if (tp->len != 0) { - MEMCPY(t, tp->lb, tp->len); - t += tp->len; + for (i = cnt; i > 0; i--) { + MEMCPY(t, tp->lb, tp->len); + t += tp->len; + } } /* Calculate length left in the original line. */ diff --git a/contrib/nvi/common/recover.c b/contrib/nvi/common/recover.c --- a/contrib/nvi/common/recover.c +++ b/contrib/nvi/common/recover.c @@ -34,8 +34,8 @@ #include #include -#include "../ex/version.h" #include "common.h" +#include "version.h" #include "pathnames.h" /* diff --git a/contrib/nvi/ex/ex.h b/contrib/nvi/ex/ex.h --- a/contrib/nvi/ex/ex.h +++ b/contrib/nvi/ex/ex.h @@ -99,7 +99,8 @@ #define AGV_GLOBAL 0x04 /* global command. */ #define AGV_V 0x08 /* v command. */ #define AGV_ALL (AGV_AT | AGV_AT_NORANGE | AGV_GLOBAL | AGV_V) - u_int8_t agv_flags; + u_int8_t agv_flags : 4; + u_int8_t trailing : 1; /* Command had trailing | or \n. */ /* Clear the structure before each ex command. */ #define CLEAR_EX_CMD(cmdp) do { \ @@ -228,4 +229,4 @@ } tagmsg_t; #include "ex_def.h" -#include "extern.h" +#include "ex_extern.h" diff --git a/contrib/nvi/ex/ex.c b/contrib/nvi/ex/ex.c --- a/contrib/nvi/ex/ex.c +++ b/contrib/nvi/ex/ex.c @@ -773,6 +773,7 @@ * no longer useful. */ vi_address = ecp->clen != 0 && ecp->cp[0] != '\n'; + ecp->trailing = 0; for (p = ecp->cp; ecp->clen > 0; --ecp->clen, ++ecp->cp) { ch = ecp->cp[0]; if (IS_ESCAPE(sp, ecp, ch) && ecp->clen > 1) { @@ -788,6 +789,7 @@ ch = tmp; } } else if (ch == '\n' || ch == '|') { + ecp->trailing = 1; if (ch == '\n') F_SET(ecp, E_NEWLINE); --ecp->clen; diff --git a/contrib/nvi/ex/ex_append.c b/contrib/nvi/ex/ex_append.c --- a/contrib/nvi/ex/ex_append.c +++ b/contrib/nvi/ex/ex_append.c @@ -149,17 +149,15 @@ for (p = cmdp->save_cmd, len = cmdp->save_cmdlen; len > 0; p = t) { for (t = p; len > 0 && t[0] != '\n'; ++t, --len); - if (t != p || len == 0) { - if (F_ISSET(sp, SC_EX_GLOBAL) && - t - p == 1 && p[0] == '.') { - ++t; - if (len > 0) - --len; - break; - } - if (db_append(sp, 1, lno++, p, t - p)) - return (1); + if (F_ISSET(sp, SC_EX_GLOBAL) && + t - p == 1 && p[0] == '.') { + ++t; + if (len > 0) + --len; + break; } + if (db_append(sp, 1, lno++, p, t - p)) + return (1); if (len != 0) { ++t; if (--len == 0 && @@ -181,6 +179,9 @@ if (len != 0) cmdp->save_cmd = t; cmdp->save_cmdlen = len; + } else if (cmdp->trailing) { + if (db_append(sp, 1, lno++, NULL, 0)) + return 1; } if (F_ISSET(sp, SC_EX_GLOBAL)) { diff --git a/contrib/nvi/ex/ex_bang.c b/contrib/nvi/ex/ex_bang.c --- a/contrib/nvi/ex/ex_bang.c +++ b/contrib/nvi/ex/ex_bang.c @@ -174,8 +174,8 @@ if (!F_ISSET(sp, SC_VI) && !F_ISSET(sp, SC_EX_SILENT)) (void)ex_puts(sp, "!\n"); - /* Apply expandtab to the new text */ - if (O_ISSET(sp, O_EXPANDTAB)) + /* If addresses were specified, apply expandtab to the new text */ + if (cmdp->addrcnt != 0 && O_ISSET(sp, O_EXPANDTAB)) ex_retab(sp, cmdp); /* diff --git a/contrib/nvi/ex/ex_def.h b/contrib/nvi/ex/ex_def.h new file mode 100644 --- /dev/null +++ b/contrib/nvi/ex/ex_def.h @@ -0,0 +1,76 @@ +#define C_SCROLL 0 +#define C_BANG 1 +#define C_HASH 2 +#define C_SUBAGAIN 3 +#define C_STAR 4 +#define C_SHIFTL 5 +#define C_EQUAL 6 +#define C_SHIFTR 7 +#define C_AT 8 +#define C_APPEND 9 +#define C_ABBR 10 +#define C_ARGS 11 +#define C_BG 12 +#define C_CHANGE 13 +#define C_CD 14 +#define C_CHDIR 15 +#define C_COPY 16 +#define C_CSCOPE 17 +#define C_DELETE 18 +#define C_DISPLAY 19 +#define C_EDIT 20 +#define C_EX 21 +#define C_EXUSAGE 22 +#define C_FILE 23 +#define C_FG 24 +#define C_GLOBAL 25 +#define C_HELP 26 +#define C_INSERT 27 +#define C_JOIN 28 +#define C_K 29 +#define C_LIST 30 +#define C_MOVE 31 +#define C_MARK 32 +#define C_MAP 33 +#define C_MKEXRC 34 +#define C_NEXT 35 +#define C_NUMBER 36 +#define C_OPEN 37 +#define C_PRINT 38 +#define C_PRESERVE 39 +#define C_PREVIOUS 40 +#define C_PUT 41 +#define C_QUIT 42 +#define C_READ 43 +#define C_RECOVER 44 +#define C_RESIZE 45 +#define C_REWIND 46 +#define C_SUBSTITUTE 47 +#define C_SCRIPT 48 +#define C_SET 49 +#define C_SHELL 50 +#define C_SOURCE 51 +#define C_STOP 52 +#define C_SUSPEND 53 +#define C_T 54 +#define C_TAG 55 +#define C_TAGNEXT 56 +#define C_TAGPOP 57 +#define C_TAGPREV 58 +#define C_TAGTOP 59 +#define C_UNDO 60 +#define C_UNABBREVIATE 61 +#define C_UNMAP 62 +#define C_V 63 +#define C_VERSION 64 +#define C_VISUAL_EX 65 +#define C_VISUAL_VI 66 +#define C_VIUSAGE 67 +#define C_VSPLIT 68 +#define C_WRITE 69 +#define C_WN 70 +#define C_WQ 71 +#define C_XIT 72 +#define C_YANK 73 +#define C_Z 74 +#define C_SUBTILDE 75 diff --git a/contrib/nvi/ex/ex_move.c b/contrib/nvi/ex/ex_move.c --- a/contrib/nvi/ex/ex_move.c +++ b/contrib/nvi/ex/ex_move.c @@ -57,7 +57,7 @@ /* Put the text into place. */ tm.lno = cmdp->lineno; tm.cno = 0; - if (put(sp, &cb, NULL, &tm, &m, 1)) + if (put(sp, &cb, NULL, &tm, &m, 1, 1)) rval = 1; else { /* diff --git a/contrib/nvi/ex/ex_put.c b/contrib/nvi/ex/ex_put.c --- a/contrib/nvi/ex/ex_put.c +++ b/contrib/nvi/ex/ex_put.c @@ -38,7 +38,7 @@ m.cno = sp->cno; if (put(sp, NULL, FL_ISSET(cmdp->iflags, E_C_BUFFER) ? &cmdp->buffer : NULL, - &cmdp->addr1, &m, 1)) + &cmdp->addr1, &m, 1, 1)) return (1); sp->lno = m.lno; sp->cno = m.cno; diff --git a/contrib/nvi/ex/ex_shift.c b/contrib/nvi/ex/ex_shift.c --- a/contrib/nvi/ex/ex_shift.c +++ b/contrib/nvi/ex/ex_shift.c @@ -79,8 +79,12 @@ return (0); } - /* Copy the lines being shifted into the unnamed buffer. */ - if (cut(sp, NULL, &cmdp->addr1, &cmdp->addr2, CUT_LINEMODE)) + /* + * When not doing re-expand tabs, copy the lines being shifted into + * the unnamed buffer. + */ + if (rl != RETAB && + cut(sp, NULL, &cmdp->addr1, &cmdp->addr2, CUT_LINEMODE)) return (1); /* diff --git a/contrib/nvi/ex/extern.h b/contrib/nvi/ex/extern.h new file mode 100644 --- /dev/null +++ b/contrib/nvi/ex/extern.h @@ -0,0 +1,131 @@ +int ex(SCR **); +int ex_cmd(SCR *); +int ex_range(SCR *, EXCMD *, int *); +int ex_is_abbrev(CHAR_T *, size_t); +int ex_is_unmap(CHAR_T *, size_t); +void ex_badaddr + (SCR *, EXCMDLIST const *, enum badaddr, enum nresult); +int ex_abbr(SCR *, EXCMD *); +int ex_unabbr(SCR *, EXCMD *); +int ex_append(SCR *, EXCMD *); +int ex_change(SCR *, EXCMD *); +int ex_insert(SCR *, EXCMD *); +int ex_next(SCR *, EXCMD *); +int ex_prev(SCR *, EXCMD *); +int ex_rew(SCR *, EXCMD *); +int ex_args(SCR *, EXCMD *); +char **ex_buildargv(SCR *, EXCMD *, char *); +int argv_init(SCR *, EXCMD *); +int argv_exp0(SCR *, EXCMD *, CHAR_T *, size_t); +int argv_exp1(SCR *, EXCMD *, CHAR_T *, size_t, int); +int argv_exp2(SCR *, EXCMD *, CHAR_T *, size_t); +int argv_exp3(SCR *, EXCMD *, CHAR_T *, size_t); +int argv_flt_ex(SCR *, EXCMD *, CHAR_T *, size_t); +int argv_free(SCR *); +int argv_flt_path(SCR *, EXCMD *, CHAR_T *, size_t); +CHAR_T *argv_esc(SCR *, EXCMD *, CHAR_T *, size_t); +CHAR_T *argv_uesc(SCR *, EXCMD *, CHAR_T *, size_t); +int ex_at(SCR *, EXCMD *); +int ex_bang(SCR *, EXCMD *); +int ex_cd(SCR *, EXCMD *); +int ex_cscope(SCR *, EXCMD *); +int cscope_end(SCR *); +int cscope_display(SCR *); +int cscope_search(SCR *, TAGQ *, TAG *); +int ex_delete(SCR *, EXCMD *); +int ex_display(SCR *, EXCMD *); +int ex_edit(SCR *, EXCMD *); +int ex_equal(SCR *, EXCMD *); +int ex_file(SCR *, EXCMD *); +int ex_filter(SCR *, + EXCMD *, MARK *, MARK *, MARK *, CHAR_T *, enum filtertype); +int ex_global(SCR *, EXCMD *); +int ex_v(SCR *, EXCMD *); +int ex_g_insdel(SCR *, lnop_t, recno_t); +int ex_screen_copy(SCR *, SCR *); +int ex_screen_end(SCR *); +int ex_optchange(SCR *, int, char *, u_long *); +int ex_exrc(SCR *); +int ex_run_str(SCR *, char *, CHAR_T *, size_t, int, int); +int ex_join(SCR *, EXCMD *); +int ex_map(SCR *, EXCMD *); +int ex_unmap(SCR *, EXCMD *); +int ex_mark(SCR *, EXCMD *); +int ex_mkexrc(SCR *, EXCMD *); +int ex_copy(SCR *, EXCMD *); +int ex_move(SCR *, EXCMD *); +int ex_open(SCR *, EXCMD *); +int ex_preserve(SCR *, EXCMD *); +int ex_recover(SCR *, EXCMD *); +int ex_list(SCR *, EXCMD *); +int ex_number(SCR *, EXCMD *); +int ex_pr(SCR *, EXCMD *); +int ex_print(SCR *, EXCMD *, MARK *, MARK *, u_int32_t); +int ex_ldisplay(SCR *, const CHAR_T *, size_t, size_t, u_int); +int ex_scprint(SCR *, MARK *, MARK *); +int ex_printf(SCR *, const char *, ...); +int ex_puts(SCR *, const char *); +int ex_fflush(SCR *sp); +int ex_put(SCR *, EXCMD *); +int ex_quit(SCR *, EXCMD *); +int ex_read(SCR *, EXCMD *); +int ex_readfp(SCR *, char *, FILE *, MARK *, recno_t *, int); +int ex_bg(SCR *, EXCMD *); +int ex_fg(SCR *, EXCMD *); +int ex_resize(SCR *, EXCMD *); +int ex_sdisplay(SCR *); +int ex_script(SCR *, EXCMD *); +int sscr_exec(SCR *, recno_t); +int sscr_input(SCR *); +int sscr_end(SCR *); +int ex_set(SCR *, EXCMD *); +int ex_shell(SCR *, EXCMD *); +int ex_exec_proc(SCR *, EXCMD *, char *, const char *, int); +int proc_wait(SCR *, long, const char *, int, int); +int ex_shiftl(SCR *, EXCMD *); +int ex_shiftr(SCR *, EXCMD *); +int ex_retab(SCR *, EXCMD *); +int ex_source(SCR *, EXCMD *); +int ex_stop(SCR *, EXCMD *); +int ex_s(SCR *, EXCMD *); +int ex_subagain(SCR *, EXCMD *); +int ex_subtilde(SCR *, EXCMD *); +int re_compile(SCR *, + CHAR_T *, size_t, CHAR_T **, size_t *, regex_t *, u_int); +void re_error(SCR *, int, regex_t *); +int ex_tag_first(SCR *, CHAR_T *); +int ex_tag_push(SCR *, EXCMD *); +int ex_tag_next(SCR *, EXCMD *); +int ex_tag_prev(SCR *, EXCMD *); +int ex_tag_nswitch(SCR *, TAG *, int); +int ex_tag_Nswitch(SCR *, TAG *, int); +int ex_tag_pop(SCR *, EXCMD *); +int ex_tag_top(SCR *, EXCMD *); +int ex_tag_display(SCR *); +int ex_tag_copy(SCR *, SCR *); +int tagq_free(SCR *, TAGQ *); +int tagq_push(SCR*, TAGQ*, int, int ); +void tag_msg(SCR *, tagmsg_t, char *); +int ex_tagf_alloc(SCR *, char *); +int ex_tag_free(SCR *); +int ex_txt(SCR *, TEXTH *, ARG_CHAR_T, u_int32_t); +int ex_undo(SCR *, EXCMD *); +int ex_help(SCR *, EXCMD *); +int ex_usage(SCR *, EXCMD *); +int ex_viusage(SCR *, EXCMD *); +void ex_cinit(SCR *, EXCMD *, int, int, recno_t, recno_t, int); +int ex_getline(SCR *, FILE *, size_t *); +int ex_ncheck(SCR *, int); +int ex_init(SCR *); +void ex_wemsg(SCR *, CHAR_T *, exm_t); +void ex_emsg(SCR *, char *, exm_t); +int ex_version(SCR *, EXCMD *); +int ex_visual(SCR *, EXCMD *); +int ex_wn(SCR *, EXCMD *); +int ex_wq(SCR *, EXCMD *); +int ex_write(SCR *, EXCMD *); +int ex_xit(SCR *, EXCMD *); +int ex_writefp(SCR *, + char *, FILE *, MARK *, MARK *, u_long *, u_long *, int); +int ex_yank(SCR *, EXCMD *); +int ex_z(SCR *, EXCMD *); diff --git a/contrib/nvi/vi/extern.h b/contrib/nvi/vi/extern.h new file mode 100644 --- /dev/null +++ b/contrib/nvi/vi/extern.h @@ -0,0 +1,145 @@ +int cs_init(SCR *, VCS *); +int cs_next(SCR *, VCS *); +int cs_fspace(SCR *, VCS *); +int cs_fblank(SCR *, VCS *); +int cs_prev(SCR *, VCS *); +int cs_bblank(SCR *, VCS *); +int v_at(SCR *, VICMD *); +int v_chrepeat(SCR *, VICMD *); +int v_chrrepeat(SCR *, VICMD *); +int v_cht(SCR *, VICMD *); +int v_chf(SCR *, VICMD *); +int v_chT(SCR *, VICMD *); +int v_chF(SCR *, VICMD *); +int v_delete(SCR *, VICMD *); +int v_again(SCR *, VICMD *); +int v_exmode(SCR *, VICMD *); +int v_join(SCR *, VICMD *); +int v_shiftl(SCR *, VICMD *); +int v_shiftr(SCR *, VICMD *); +int v_suspend(SCR *, VICMD *); +int v_switch(SCR *, VICMD *); +int v_tagpush(SCR *, VICMD *); +int v_tagpop(SCR *, VICMD *); +int v_filter(SCR *, VICMD *); +int v_ex(SCR *, VICMD *); +int v_ecl_exec(SCR *); +int v_increment(SCR *, VICMD *); +int v_screen_copy(SCR *, SCR *); +int v_screen_end(SCR *); +int v_optchange(SCR *, int, char *, u_long *); +int v_iA(SCR *, VICMD *); +int v_ia(SCR *, VICMD *); +int v_iI(SCR *, VICMD *); +int v_ii(SCR *, VICMD *); +int v_iO(SCR *, VICMD *); +int v_io(SCR *, VICMD *); +int v_change(SCR *, VICMD *); +int v_Replace(SCR *, VICMD *); +int v_subst(SCR *, VICMD *); +int v_left(SCR *, VICMD *); +int v_cfirst(SCR *, VICMD *); +int v_first(SCR *, VICMD *); +int v_ncol(SCR *, VICMD *); +int v_zero(SCR *, VICMD *); +int v_mark(SCR *, VICMD *); +int v_bmark(SCR *, VICMD *); +int v_fmark(SCR *, VICMD *); +int v_emark(SCR *, VICMD *); +int v_match(SCR *, VICMD *); +int v_buildmcs(SCR *, char *); +int v_paragraphf(SCR *, VICMD *); +int v_paragraphb(SCR *, VICMD *); +int v_buildps(SCR *, char *, char *); +int v_Put(SCR *, VICMD *); +int v_put(SCR *, VICMD *); +int v_redraw(SCR *, VICMD *); +int v_replace(SCR *, VICMD *); +int v_right(SCR *, VICMD *); +int v_dollar(SCR *, VICMD *); +int v_screen(SCR *, VICMD *); +int v_lgoto(SCR *, VICMD *); +int v_home(SCR *, VICMD *); +int v_middle(SCR *, VICMD *); +int v_bottom(SCR *, VICMD *); +int v_up(SCR *, VICMD *); +int v_cr(SCR *, VICMD *); +int v_down(SCR *, VICMD *); +int v_hpageup(SCR *, VICMD *); +int v_hpagedown(SCR *, VICMD *); +int v_pagedown(SCR *, VICMD *); +int v_pageup(SCR *, VICMD *); +int v_lineup(SCR *, VICMD *); +int v_linedown(SCR *, VICMD *); +int v_searchb(SCR *, VICMD *); +int v_searchf(SCR *, VICMD *); +int v_searchN(SCR *, VICMD *); +int v_searchn(SCR *, VICMD *); +int v_searchw(SCR *, VICMD *); +int v_correct(SCR *, VICMD *, int); +int v_sectionf(SCR *, VICMD *); +int v_sectionb(SCR *, VICMD *); +int v_sentencef(SCR *, VICMD *); +int v_sentenceb(SCR *, VICMD *); +int v_status(SCR *, VICMD *); +int v_tcmd(SCR *, VICMD *, ARG_CHAR_T, u_int); +int v_txt(SCR *, VICMD *, MARK *, + const CHAR_T *, size_t, ARG_CHAR_T, recno_t, u_long, u_int32_t); +int v_txt_auto(SCR *, recno_t, TEXT *, size_t, TEXT *); +int v_ulcase(SCR *, VICMD *); +int v_mulcase(SCR *, VICMD *); +int v_Undo(SCR *, VICMD *); +int v_undo(SCR *, VICMD *); +void v_eof(SCR *, MARK *); +void v_eol(SCR *, MARK *); +void v_nomove(SCR *); +void v_sof(SCR *, MARK *); +void v_sol(SCR *); +int v_isempty(CHAR_T *, size_t); +void v_emsg(SCR *, char *, vim_t); +int v_wordW(SCR *, VICMD *); +int v_wordw(SCR *, VICMD *); +int v_wordE(SCR *, VICMD *); +int v_worde(SCR *, VICMD *); +int v_wordB(SCR *, VICMD *); +int v_wordb(SCR *, VICMD *); +int v_xchar(SCR *, VICMD *); +int v_Xchar(SCR *, VICMD *); +int v_yank(SCR *, VICMD *); +int v_z(SCR *, VICMD *); +int vs_crel(SCR *, long); +int v_zexit(SCR *, VICMD *); +int vi(SCR **); +int v_curword(SCR *); +int vs_line(SCR *, SMAP *, size_t *, size_t *); +int vs_number(SCR *); +void vs_busy(SCR *, const char *, busy_t); +void vs_home(SCR *); +void vs_update(SCR *, const char *, const CHAR_T *); +void vs_msg(SCR *, mtype_t, char *, size_t); +int vs_ex_resolve(SCR *, int *); +int vs_resolve(SCR *, SCR *, int); +int vs_repaint(SCR *, EVENT *); +int vs_refresh(SCR *, int); +int vs_column(SCR *, size_t *); +size_t vs_screens(SCR *, recno_t, size_t *); +size_t vs_columns(SCR *, CHAR_T *, recno_t, size_t *, size_t *); +size_t vs_rcm(SCR *, recno_t, int); +size_t vs_colpos(SCR *, recno_t, size_t); +int vs_change(SCR *, recno_t, lnop_t); +int vs_sm_fill(SCR *, recno_t, pos_t); +int vs_sm_scroll(SCR *, MARK *, recno_t, scroll_t); +int vs_sm_1up(SCR *); +int vs_sm_1down(SCR *); +int vs_sm_next(SCR *, SMAP *, SMAP *); +int vs_sm_prev(SCR *, SMAP *, SMAP *); +int vs_sm_cursor(SCR *, SMAP **); +int vs_sm_position(SCR *, MARK *, u_long, pos_t); +recno_t vs_sm_nlines(SCR *, SMAP *, recno_t, size_t); +int vs_split(SCR *, SCR *, int); +int vs_vsplit(SCR *, SCR *); +int vs_discard(SCR *, SCR **); +int vs_fg(SCR *, SCR **, CHAR_T *, int); +int vs_bg(SCR *); +int vs_swap(SCR *, SCR **, char *); +int vs_resize(SCR *, long, adj_t); diff --git a/contrib/nvi/vi/v_put.c b/contrib/nvi/vi/v_put.c --- a/contrib/nvi/vi/v_put.c +++ b/contrib/nvi/vi/v_put.c @@ -41,15 +41,12 @@ * Historic vi did not support a count with the 'p' and 'P' * commands. It's useful, so we do. */ - for (cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) { - if (put(sp, NULL, - F_ISSET(vp, VC_BUFFER) ? &vp->buffer : NULL, - &vp->m_start, &vp->m_final, 0)) - return (1); - vp->m_start = vp->m_final; - if (INTERRUPTED(sp)) - return (1); - } + cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; + if (put(sp, NULL, + F_ISSET(vp, VC_BUFFER) ? &vp->buffer : NULL, + &vp->m_start, &vp->m_final, 0, cnt)) + return (1); + return (0); } @@ -71,16 +68,17 @@ * !!! * Historic vi did not support a count with the 'p' and 'P' * commands. It's useful, so we do. + * + * The cursor placement of an individual 'p' and 'P' used to + * affect the content when a count is presented. Now we let + * the command implementation be count-aware instead. */ - for (cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) { - if (put(sp, NULL, - F_ISSET(vp, VC_BUFFER) ? &vp->buffer : NULL, - &vp->m_start, &vp->m_final, 1)) - return (1); - vp->m_start = vp->m_final; - if (INTERRUPTED(sp)) - return (1); - } + cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; + if (put(sp, NULL, + F_ISSET(vp, VC_BUFFER) ? &vp->buffer : NULL, + &vp->m_start, &vp->m_final, 1, cnt)) + return (1); + return (0); } diff --git a/contrib/nvi/vi/vi.h b/contrib/nvi/vi/vi.h --- a/contrib/nvi/vi/vi.h +++ b/contrib/nvi/vi/vi.h @@ -381,4 +381,4 @@ VIM_NOCOM, VIM_NOCOM_B, VIM_USAGE, VIM_WRESIZE } vim_t; -#include "extern.h" +#include "vi_extern.h" diff --git a/etc/mtree/BSD.debug.dist b/etc/mtree/BSD.debug.dist --- a/etc/mtree/BSD.debug.dist +++ b/etc/mtree/BSD.debug.dist @@ -9,6 +9,8 @@ .. boot kernel + gdb + .. .. modules .. @@ -45,6 +47,10 @@ .. i18n .. + krb5 + plugins + .. + .. libxo encoder .. diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -843,6 +843,10 @@ .. .. .. + pkg + triggers + .. + .. security .. sendmail diff --git a/include/stdlib.h b/include/stdlib.h --- a/include/stdlib.h +++ b/include/stdlib.h @@ -333,6 +333,8 @@ void srandomdev(void); long long strtonum(const char *, long long, long long, const char **); +long long + strtonumx(const char *, long long, long long, const char **, int); /* Deprecated interfaces, to be removed. */ __int64_t diff --git a/lib/Makefile b/lib/Makefile --- a/lib/Makefile +++ b/lib/Makefile @@ -73,7 +73,6 @@ liblzma \ libmemstat \ libmd \ - libmixer \ libmt \ lib80211 \ libnetbsd \ @@ -176,7 +175,6 @@ .endif SUBDIR.${MK_CUSE}+= libcuse -SUBDIR.${MK_CUSE}+= virtual_oss SUBDIR.${MK_TOOLCHAIN}+=libpe SUBDIR.${MK_DIALOG}+= libdpv libfigpar SUBDIR.${MK_FDT}+= libfdt @@ -238,6 +236,8 @@ SUBDIR.${MK_RADIUS_SUPPORT}+= libradius SUBDIR.${MK_SENDMAIL}+= libmilter libsm libsmdb libsmutil SUBDIR.${MK_TELNET}+= libtelnet +SUBDIR.${MK_SOUND}+= libmixer +SUBDIR.${MK_CUSE}.${MK_SOUND}+= virtual_oss SUBDIR.${MK_TESTS_SUPPORT}+= atf SUBDIR.${MK_TESTS_SUPPORT}+= liblutok SUBDIR.${MK_TESTS}+= tests diff --git a/lib/csu/common/notes.h b/lib/csu/common/notes.h --- a/lib/csu/common/notes.h +++ b/lib/csu/common/notes.h @@ -27,6 +27,4 @@ #define NOTE_FREEBSD_VENDOR "FreeBSD" -#define NOTE_SECTION ".note.tag" - #endif diff --git a/lib/libc/Makefile b/lib/libc/Makefile --- a/lib/libc/Makefile +++ b/lib/libc/Makefile @@ -142,9 +142,6 @@ .if ${MK_HESIOD} != "no" CFLAGS+= -DHESIOD .endif -.if ${MK_FP_LIBC} == "no" -CFLAGS+= -DNO_FLOATING_POINT -.endif .if ${MK_NS_CACHING} != "no" CFLAGS+= -DNS_CACHING .endif diff --git a/lib/libc/aarch64/string/Makefile.inc b/lib/libc/aarch64/string/Makefile.inc --- a/lib/libc/aarch64/string/Makefile.inc +++ b/lib/libc/aarch64/string/Makefile.inc @@ -5,10 +5,8 @@ AARCH64_STRING_FUNCS= \ memcmp \ - memcpy \ memmove \ memrchr \ - memset \ stpcpy \ strchr \ strchrnul \ @@ -34,7 +32,12 @@ timingsafe_bcmp.S \ timingsafe_memcmp.S \ bcopy.c \ - bzero.c + bzero.c \ + memcpy.S \ + memcpy_resolver.c \ + memmove_resolver.c \ + memset.S \ + memset_resolver.c # # Add the above functions. Generate an asm file that includes the needed @@ -55,6 +58,8 @@ CFLAGS.${FUNC}.S+=-I${SRCTOP}/contrib/arm-optimized-routines/string .endfor -# memchr.S is a wrapper in the src tree for the implementation from +# Several files are wrappers in the src tree for the implementation from # arm-optimized-routines CFLAGS.memchr.S+=-I${SRCTOP}/contrib/arm-optimized-routines/string +CFLAGS.memcpy.S+=-I${SRCTOP}/contrib/arm-optimized-routines/string +CFLAGS.memset.S+=-I${SRCTOP}/contrib/arm-optimized-routines/string diff --git a/lib/libc/aarch64/string/memcpy.S b/lib/libc/aarch64/string/memcpy.S --- a/lib/libc/aarch64/string/memcpy.S +++ b/lib/libc/aarch64/string/memcpy.S @@ -1,3 +1,3 @@ -#define __memcpy_aarch64_simd memcpy -#define __memmove_aarch64_simd memmove #include "aarch64/memcpy-advsimd.S" +#include "aarch64/memcpy-mops.S" +#include "aarch64/memmove-mops.S" diff --git a/sys/compat/linuxkpi/common/include/linux/acpi.h b/lib/libc/aarch64/string/memcpy_resolver.c copy from sys/compat/linuxkpi/common/include/linux/acpi.h copy to lib/libc/aarch64/string/memcpy_resolver.c --- a/sys/compat/linuxkpi/common/include/linux/acpi.h +++ b/lib/libc/aarch64/string/memcpy_resolver.c @@ -1,17 +1,16 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2020 Vladimir Kondratyev + * Copyright (c) 2026 Arm Ltd * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: + * 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. + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -25,25 +24,19 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ +#include +#include -#ifndef _LINUXKPI_LINUX_ACPI_H_ -#define _LINUXKPI_LINUX_ACPI_H_ +#include -#include -#include +void *__memcpy_aarch64_simd(void *, const void *, size_t); +void *__memcpy_aarch64_mops(void *, const void *, size_t); -#if defined(__aarch64__) || defined(__amd64__) || defined(__i386__) +DEFINE_UIFUNC(, void *, memcpy, (void *, const void *, size_t)) +{ + if (ifunc_arg->_hwcap2 & HWCAP2_MOPS) + return (__memcpy_aarch64_mops); -#include -#include + return (__memcpy_aarch64_simd); +} -#define ACPI_HANDLE(dev) \ - ((dev)->bsddev != NULL ? bsd_acpi_get_handle((dev)->bsddev) : NULL) -#define acpi_device_handle(dev) \ - ((dev) != NULL ? bsd_acpi_get_handle(dev) : NULL) -static inline void acpi_dev_put(struct acpi_device *adev) {} -#define acpi_handle_debug(handle, fmt, ...) - -#endif - -#endif /* _LINUXKPI_LINUX_ACPI_H_ */ diff --git a/sys/compat/linuxkpi/common/include/linux/acpi.h b/lib/libc/aarch64/string/memmove_resolver.c copy from sys/compat/linuxkpi/common/include/linux/acpi.h copy to lib/libc/aarch64/string/memmove_resolver.c --- a/sys/compat/linuxkpi/common/include/linux/acpi.h +++ b/lib/libc/aarch64/string/memmove_resolver.c @@ -1,17 +1,16 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2020 Vladimir Kondratyev + * Copyright (c) 2026 Arm Ltd * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: + * 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. + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -25,25 +24,19 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ +#include +#include -#ifndef _LINUXKPI_LINUX_ACPI_H_ -#define _LINUXKPI_LINUX_ACPI_H_ +#include -#include -#include +void *__memmove_aarch64_simd(void *, const void *, size_t); +void *__memmove_aarch64_mops(void *, const void *, size_t); -#if defined(__aarch64__) || defined(__amd64__) || defined(__i386__) +DEFINE_UIFUNC(, void *, memmove, (void *, const void *, size_t)) +{ + if (ifunc_arg->_hwcap2 & HWCAP2_MOPS) + return (__memmove_aarch64_mops); -#include -#include + return (__memmove_aarch64_simd); +} -#define ACPI_HANDLE(dev) \ - ((dev)->bsddev != NULL ? bsd_acpi_get_handle((dev)->bsddev) : NULL) -#define acpi_device_handle(dev) \ - ((dev) != NULL ? bsd_acpi_get_handle(dev) : NULL) -static inline void acpi_dev_put(struct acpi_device *adev) {} -#define acpi_handle_debug(handle, fmt, ...) - -#endif - -#endif /* _LINUXKPI_LINUX_ACPI_H_ */ diff --git a/lib/libc/aarch64/string/memset.S b/lib/libc/aarch64/string/memset.S new file mode 100644 --- /dev/null +++ b/lib/libc/aarch64/string/memset.S @@ -0,0 +1,2 @@ +#include "aarch64/memset.S" +#include "aarch64/memset-mops.S" diff --git a/sys/compat/linuxkpi/common/include/linux/acpi.h b/lib/libc/aarch64/string/memset_resolver.c copy from sys/compat/linuxkpi/common/include/linux/acpi.h copy to lib/libc/aarch64/string/memset_resolver.c --- a/sys/compat/linuxkpi/common/include/linux/acpi.h +++ b/lib/libc/aarch64/string/memset_resolver.c @@ -1,17 +1,16 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2020 Vladimir Kondratyev + * Copyright (c) 2026 Arm Ltd * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: + * 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. + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -25,25 +24,19 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ +#include +#include -#ifndef _LINUXKPI_LINUX_ACPI_H_ -#define _LINUXKPI_LINUX_ACPI_H_ +#include -#include -#include +void *__memset_aarch64(void *, int, size_t); +void *__memset_aarch64_mops(void *, int, size_t); -#if defined(__aarch64__) || defined(__amd64__) || defined(__i386__) +DEFINE_UIFUNC(, void *, memset, (void *, int, size_t)) +{ + if (ifunc_arg->_hwcap2 & HWCAP2_MOPS) + return (__memset_aarch64_mops); -#include -#include + return (__memset_aarch64); +} -#define ACPI_HANDLE(dev) \ - ((dev)->bsddev != NULL ? bsd_acpi_get_handle((dev)->bsddev) : NULL) -#define acpi_device_handle(dev) \ - ((dev) != NULL ? bsd_acpi_get_handle(dev) : NULL) -static inline void acpi_dev_put(struct acpi_device *adev) {} -#define acpi_handle_debug(handle, fmt, ...) - -#endif - -#endif /* _LINUXKPI_LINUX_ACPI_H_ */ diff --git a/lib/libc/csu/aarch64/reloc.c b/lib/libc/csu/aarch64/reloc.c --- a/lib/libc/csu/aarch64/reloc.c +++ b/lib/libc/csu/aarch64/reloc.c @@ -25,17 +25,42 @@ */ #include +#include + +static __ifunc_arg_t ifunc_arg; static void -ifunc_init(const Elf_Auxinfo *aux __unused) +ifunc_init(const Elf_Auxinfo *aux) { + ifunc_arg._size = sizeof(ifunc_arg); + ifunc_arg._hwcap = 0; + ifunc_arg._hwcap2 = 0; + ifunc_arg._hwcap3 = 0; + ifunc_arg._hwcap4 = 0; + + for (; aux->a_type != AT_NULL; aux++) { + switch (aux->a_type) { + case AT_HWCAP: + ifunc_arg._hwcap = aux->a_un.a_val | _IFUNC_ARG_HWCAP; + break; + case AT_HWCAP2: + ifunc_arg._hwcap2 = aux->a_un.a_val; + break; + case AT_HWCAP3: + ifunc_arg._hwcap3 = aux->a_un.a_val; + break; + case AT_HWCAP4: + ifunc_arg._hwcap4 = aux->a_un.a_val; + break; + } + } } static void crt1_handle_rela(const Elf_Rela *r) { typedef Elf_Addr (*ifunc_resolver_t)( - uint64_t, uint64_t, uint64_t, uint64_t, + uint64_t, const __ifunc_arg_t *, uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, uint64_t); Elf_Addr *ptr, *where, target; @@ -43,7 +68,7 @@ case R_AARCH64_IRELATIVE: ptr = (Elf_Addr *)r->r_addend; where = (Elf_Addr *)r->r_offset; - target = ((ifunc_resolver_t)ptr)(0, 0, 0, 0, 0, 0, 0, 0); + target = ((ifunc_resolver_t)ptr)(ifunc_arg._hwcap, &ifunc_arg, 0, 0, 0, 0, 0, 0); *where = target; break; } diff --git a/lib/libc/gen/exterr_cat_filenames.h b/lib/libc/gen/exterr_cat_filenames.h --- a/lib/libc/gen/exterr_cat_filenames.h +++ b/lib/libc/gen/exterr_cat_filenames.h @@ -8,9 +8,9 @@ [EXTERR_CAT_GEOM] = "geom/geom_subr.c", [EXTERR_CAT_GEOMVFS] = "geom/geom_vfs.c", [EXTERR_CAT_FILEDESC] = "kern/kern_descrip.c", - [EXTERR_CAT_INOTIFY] = "kern/vfs_inotify.c", [EXTERR_CAT_GENIO] = "kern/sys_generic.c", [EXTERR_CAT_VFSBIO] = "kern/vfs_bio.c", + [EXTERR_CAT_INOTIFY] = "kern/vfs_inotify.c", [EXTERR_CAT_VFSSYSCALL] = "kern/vfs_syscalls.c", [EXTERR_CAT_BRIDGE] = "net/if_bridge.c", [EXTERR_CAT_SWAP] = "vm/swap_pager.c", diff --git a/lib/libc/gen/fmtcheck.c b/lib/libc/gen/fmtcheck.c --- a/lib/libc/gen/fmtcheck.c +++ b/lib/libc/gen/fmtcheck.c @@ -55,10 +55,8 @@ FMTCHECK_INTMAXTPOINTER, FMTCHECK_PTRDIFFTPOINTER, FMTCHECK_SIZETPOINTER, -#ifndef NO_FLOATING_POINT FMTCHECK_DOUBLE, FMTCHECK_LONGDOUBLE, -#endif FMTCHECK_STRING, FMTCHECK_WSTRING, FMTCHECK_WIDTH, @@ -185,7 +183,6 @@ RETURN(pf,f,FMTCHECK_UNKNOWN); RETURN(pf,f,FMTCHECK_LONG); } -#ifndef NO_FLOATING_POINT if (strchr("aAeEfFgG", *f)) { switch (modifier) { case MOD_LONGDOUBLE: @@ -197,7 +194,6 @@ RETURN(pf,f,FMTCHECK_UNKNOWN); } } -#endif if (*f == 'c') { switch (modifier) { case MOD_LONG: diff --git a/lib/libc/stdio/printf-pos.c b/lib/libc/stdio/printf-pos.c --- a/lib/libc/stdio/printf-pos.c +++ b/lib/libc/stdio/printf-pos.c @@ -311,11 +311,9 @@ goto rflag; } goto reswitch; -#ifndef NO_FLOATING_POINT case 'L': flags |= LONGDBL; goto rflag; -#endif case 'h': if (flags & SHORTINT) { flags &= ~SHORTINT; @@ -359,7 +357,6 @@ if ((error = addsarg(&types, flags))) goto error; break; -#ifndef NO_FLOATING_POINT case 'a': case 'A': case 'e': @@ -372,7 +369,6 @@ if (error) goto error; break; -#endif /* !NO_FLOATING_POINT */ case 'n': if (flags & INTMAXT) error = addtype(&types, TP_INTMAXT); @@ -504,11 +500,9 @@ goto rflag; } goto reswitch; -#ifndef NO_FLOATING_POINT case 'L': flags |= LONGDBL; goto rflag; -#endif case 'h': if (flags & SHORTINT) { flags &= ~SHORTINT; @@ -552,7 +546,6 @@ if ((error = addsarg(&types, flags))) goto error; break; -#ifndef NO_FLOATING_POINT case 'a': case 'A': case 'e': @@ -565,7 +558,6 @@ if (error) goto error; break; -#endif /* !NO_FLOATING_POINT */ case 'n': if (flags & INTMAXT) error = addtype(&types, TP_INTMAXT); @@ -744,14 +736,10 @@ (*argtable) [n].pintmaxarg = va_arg (ap, intmax_t *); break; case T_DOUBLE: -#ifndef NO_FLOATING_POINT (*argtable) [n].doublearg = va_arg (ap, double); -#endif break; case T_LONG_DOUBLE: -#ifndef NO_FLOATING_POINT (*argtable) [n].longdoublearg = va_arg (ap, long double); -#endif break; case TP_CHAR: (*argtable) [n].pchararg = va_arg (ap, char *); diff --git a/lib/libc/stdio/printfcommon.h b/lib/libc/stdio/printfcommon.h --- a/lib/libc/stdio/printfcommon.h +++ b/lib/libc/stdio/printfcommon.h @@ -43,7 +43,6 @@ */ -#ifndef NO_FLOATING_POINT #define dtoa __dtoa #define freedtoa __freedtoa @@ -57,7 +56,6 @@ static int exponent(CHAR *, int, CHAR); -#endif /* !NO_FLOATING_POINT */ static CHAR *__ujtoa(uintmax_t, CHAR *, int, int, const char *); static CHAR *__ultoa(u_long, CHAR *, int, int, const char *); @@ -280,7 +278,6 @@ return (cp); } -#ifndef NO_FLOATING_POINT static int exponent(CHAR *p0, int exp, CHAR fmtch) @@ -318,4 +315,3 @@ return (p - p0); } -#endif /* !NO_FLOATING_POINT */ diff --git a/lib/libc/stdio/printflocal.h b/lib/libc/stdio/printflocal.h --- a/lib/libc/stdio/printflocal.h +++ b/lib/libc/stdio/printflocal.h @@ -82,10 +82,8 @@ ptrdiff_t *pptrdiffarg; ssize_t *pssizearg; intmax_t *pintmaxarg; -#ifndef NO_FLOATING_POINT double doublearg; long double longdoublearg; -#endif wint_t wintarg; wchar_t *pwchararg; }; diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c --- a/lib/libc/stdio/vfprintf.c +++ b/lib/libc/stdio/vfprintf.c @@ -314,7 +314,6 @@ char sign; /* sign prefix (' ', '+', '-', or \0) */ struct grouping_state gs; /* thousands' grouping info */ -#ifndef NO_FLOATING_POINT /* * We can decompose the printed representation of floating * point numbers into several parts, some of which may be empty: @@ -343,7 +342,6 @@ int ndig; /* actual number of digits returned by dtoa */ char expstr[MAXEXPDIG+2]; /* buffer for exponent string: e+ZZZ */ char *dtoaresult; /* buffer allocated by dtoa */ -#endif u_long ulval; /* integer arguments %[diouxX] */ uintmax_t ujval; /* %j, %ll, %q, %t, %z integers */ int base; /* base for [diouxX] conversion */ @@ -465,12 +463,10 @@ va_copy(orgap, ap); io_init(&io, fp); ret = 0; -#ifndef NO_FLOATING_POINT dtoaresult = NULL; decimal_point = localeconv_l(locale)->decimal_point; /* The overwhelmingly common case is decpt_len == 1. */ decpt_len = (decimal_point[1] == '\0' ? 1 : strlen(decimal_point)); -#endif /* * Scan the format for conversions (`%' character). @@ -574,11 +570,9 @@ } width = n; goto reswitch; -#ifndef NO_FLOATING_POINT case 'L': flags |= LONGDBL; goto rflag; -#endif case 'h': if (flags & SHORTINT) { flags &= ~SHORTINT; @@ -704,7 +698,6 @@ } base = 10; goto number; -#ifndef NO_FLOATING_POINT case 'a': case 'A': if (ch == 'a') { @@ -823,7 +816,6 @@ size += grouping_init(&gs, expt, locale); } break; -#endif /* !NO_FLOATING_POINT */ case 'm': error = __strerror_rl(serrno, errnomsg, sizeof(errnomsg), locale); @@ -1023,9 +1015,7 @@ PAD(width - realsz, zeroes); /* the string or number proper */ -#ifndef NO_FLOATING_POINT if ((flags & FPT) == 0) { -#endif /* leading zeroes from decimal precision */ PAD(dprec - size, zeroes); if (gs.grouping) { @@ -1034,7 +1024,6 @@ } else { PRINT(cp, size); } -#ifndef NO_FLOATING_POINT } else { /* glue together f_p fragments */ if (!expchar) { /* %[fF] or sufficiently short %[gG] */ if (expt <= 0) { @@ -1071,7 +1060,6 @@ PRINT(expstr, expsize); } } -#endif /* left-adjusting padding (always blank) */ if (flags & LADJUST) PAD(width - realsz, blanks); @@ -1085,10 +1073,8 @@ FLUSH(); error: va_end(orgap); -#ifndef NO_FLOATING_POINT if (dtoaresult != NULL) freedtoa(dtoaresult); -#endif if (convbuf != NULL) free(convbuf); if (__sferror(fp)) diff --git a/lib/libc/stdio/vfscanf.c b/lib/libc/stdio/vfscanf.c --- a/lib/libc/stdio/vfscanf.c +++ b/lib/libc/stdio/vfscanf.c @@ -56,9 +56,7 @@ #include "local.h" #include "xlocale_private.h" -#ifndef NO_FLOATING_POINT #include -#endif #define BUF 513 /* Maximum length of numeric string. */ @@ -89,9 +87,7 @@ #define CT_FLOAT 4 /* %[efgEFG] conversion */ static const u_char *__sccl(char *, const u_char *); -#ifndef NO_FLOATING_POINT static int parsefloat(FILE *, char *, char *, locale_t); -#endif __weak_reference(__vfscanf, vfscanf); @@ -648,12 +644,10 @@ base = 16; break; -#ifndef NO_FLOATING_POINT case 'A': case 'E': case 'F': case 'G': case 'a': case 'e': case 'f': case 'g': c = CT_FLOAT; break; -#endif case 'S': flags |= LONG; @@ -835,7 +829,6 @@ } break; -#ifndef NO_FLOATING_POINT case CT_FLOAT: /* scan a floating point number as if by strtod */ if (width == 0 || width > sizeof(buf) - 1) @@ -858,7 +851,6 @@ } } break; -#endif /* !NO_FLOATING_POINT */ } if (!(flags & SUPPRESS)) nassigned++; @@ -984,7 +976,6 @@ /* NOTREACHED */ } -#ifndef NO_FLOATING_POINT static int parsefloat(FILE *fp, char *buf, char *end, locale_t locale) { @@ -1153,4 +1144,3 @@ *++commit = '\0'; return (commit - buf); } -#endif diff --git a/lib/libc/stdio/vfwprintf.c b/lib/libc/stdio/vfwprintf.c --- a/lib/libc/stdio/vfwprintf.c +++ b/lib/libc/stdio/vfwprintf.c @@ -389,7 +389,6 @@ int prec; /* precision from format; <0 for N/A */ wchar_t sign; /* sign prefix (' ', '+', '-', or \0) */ struct grouping_state gs; /* thousands' grouping info */ -#ifndef NO_FLOATING_POINT /* * We can decompose the printed representation of floating * point numbers into several parts, some of which may be empty: @@ -417,7 +416,6 @@ int ndig; /* actual number of digits returned by dtoa */ wchar_t expstr[MAXEXPDIG+2]; /* buffer for exponent string: e+ZZZ */ char *dtoaresult; /* buffer allocated by dtoa */ -#endif u_long ulval; /* integer arguments %[diouxX] */ uintmax_t ujval; /* %j, %ll, %q, %t, %z integers */ int base; /* base for [diouxX] conversion */ @@ -537,9 +535,7 @@ va_copy(orgap, ap); io_init(&io, fp); ret = 0; -#ifndef NO_FLOATING_POINT decimal_point = get_decpt(locale); -#endif /* * Scan the format for conversions (`%' character). @@ -643,11 +639,9 @@ } width = n; goto reswitch; -#ifndef NO_FLOATING_POINT case 'L': flags |= LONGDBL; goto rflag; -#endif case 'h': if (flags & SHORTINT) { flags &= ~SHORTINT; @@ -761,7 +755,6 @@ } base = 10; goto number; -#ifndef NO_FLOATING_POINT case 'a': case 'A': if (ch == 'a') { @@ -885,7 +878,6 @@ size += grouping_init(&gs, expt, locale); } break; -#endif /* !NO_FLOATING_POINT */ case 'n': /* * Assignment-like behavior is specified if the @@ -1080,9 +1072,7 @@ PAD(width - realsz, zeroes); /* the string or number proper */ -#ifndef NO_FLOATING_POINT if ((flags & FPT) == 0) { -#endif /* leading zeroes from decimal precision */ PAD(dprec - size, zeroes); if (gs.grouping) { @@ -1091,7 +1081,6 @@ } else { PRINT(cp, size); } -#ifndef NO_FLOATING_POINT } else { /* glue together f_p fragments */ if (!expchar) { /* %[fF] or sufficiently short %[gG] */ if (expt <= 0) { @@ -1129,7 +1118,6 @@ PRINT(expstr, expsize); } } -#endif /* left-adjusting padding (always blank) */ if (flags & LADJUST) PAD(width - realsz, blanks); diff --git a/lib/libc/stdio/vfwscanf.c b/lib/libc/stdio/vfwscanf.c --- a/lib/libc/stdio/vfwscanf.c +++ b/lib/libc/stdio/vfwscanf.c @@ -84,9 +84,7 @@ #define CT_INT 3 /* %[dioupxX] conversion */ #define CT_FLOAT 4 /* %[efgEFG] conversion */ -#ifndef NO_FLOATING_POINT static int parsefloat(FILE *, wchar_t *, wchar_t *, locale_t); -#endif struct ccl { const wchar_t *start; /* character class start */ @@ -630,12 +628,10 @@ base = 16; break; -#ifndef NO_FLOATING_POINT case 'A': case 'E': case 'F': case 'G': case 'a': case 'e': case 'f': case 'g': c = CT_FLOAT; break; -#endif case 'S': flags |= LONG; @@ -813,7 +809,6 @@ } break; -#ifndef NO_FLOATING_POINT case CT_FLOAT: /* scan a floating point number as if by strtod */ if (width == 0 || width > sizeof(buf) / @@ -835,7 +830,6 @@ } } break; -#endif /* !NO_FLOATING_POINT */ } if (!(flags & SUPPRESS)) nassigned++; @@ -848,7 +842,6 @@ return (nassigned); } -#ifndef NO_FLOATING_POINT static int parsefloat(FILE *fp, wchar_t *buf, wchar_t *end, locale_t locale) { @@ -1007,4 +1000,3 @@ *++commit = '\0'; return (commit - buf); } -#endif diff --git a/lib/libc/stdio/xprintf.c b/lib/libc/stdio/xprintf.c --- a/lib/libc/stdio/xprintf.c +++ b/lib/libc/stdio/xprintf.c @@ -60,10 +60,8 @@ int intarg; long longarg; intmax_t intmaxarg; -#ifndef NO_FLOATING_POINT double doublearg; long double longdoublearg; -#endif wint_t wintarg; char *pchararg; wchar_t *pwchararg; @@ -497,14 +495,10 @@ args[ch].pwchararg = va_arg (ap, wchar_t *); break; case PA_DOUBLE: -#ifndef NO_FLOATING_POINT args[ch].doublearg = va_arg (ap, double); -#endif break; case PA_DOUBLE | PA_FLAG_LONG_DOUBLE: -#ifndef NO_FLOATING_POINT args[ch].longdoublearg = va_arg (ap, long double); -#endif break; default: errx(1, "argtype = %x (fmt = \"%s\")\n", diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc --- a/lib/libc/stdlib/Makefile.inc +++ b/lib/libc/stdlib/Makefile.inc @@ -142,6 +142,7 @@ MLINKS+=strtol.3 strtoll.3 \ strtol.3 strtoq.3 \ strtol.3 strtoimax.3 +MLINKS+=strtonum.3 strtonumx.3 MLINKS+=strtoul.3 strtoull.3 \ strtoul.3 strtouq.3 \ strtoul.3 strtoumax.3 diff --git a/lib/libc/stdlib/Symbol.map b/lib/libc/stdlib/Symbol.map --- a/lib/libc/stdlib/Symbol.map +++ b/lib/libc/stdlib/Symbol.map @@ -134,6 +134,7 @@ FBSD_1.9 { memalignment; recallocarray; + strtonumx; tdestroy; }; diff --git a/lib/libc/stdlib/strtonum.3 b/lib/libc/stdlib/strtonum.3 --- a/lib/libc/stdlib/strtonum.3 +++ b/lib/libc/stdlib/strtonum.3 @@ -1,4 +1,5 @@ .\" Copyright (c) 2004 Ted Unangst +.\" Copyright 2023 Oxide Computer Company .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above @@ -14,11 +15,12 @@ .\" .\" $OpenBSD: strtonum.3,v 1.13 2006/04/25 05:15:42 tedu Exp $ .\" -.Dd April 29, 2004 +.Dd January 15, 2026 .Dt STRTONUM 3 .Os .Sh NAME -.Nm strtonum +.Nm strtonum , +.Nm strtonumx .Nd "reliably convert string value to an integer" .Sh SYNOPSIS .In stdlib.h @@ -29,26 +31,33 @@ .Fa "long long maxval" .Fa "const char **errstr" .Fc +.Ft long long +.Fo strtonumx +.Fa "const char *nptr" +.Fa "long long minval" +.Fa "long long maxval" +.Fa "const char **errstr" +.Fa "int base" +.Fc .Sh DESCRIPTION The .Fn strtonum -function converts the string in +and +.Fn strtonumx +functions convert the string in .Fa nptr to a .Vt "long long" value. -The -.Fn strtonum -function was designed to facilitate safe, robust programming -and overcome the shortcomings of the +These functions were designed to facilitate safe, robust programming and +overcome the shortcomings of the .Xr atoi 3 and .Xr strtol 3 family of interfaces. .Pp The string may begin with an arbitrary amount of whitespace -(as determined by -.Xr isspace 3 ) +.Pq as determined by Xr isspace 3 followed by a single optional .Ql + or @@ -57,7 +66,10 @@ .Pp The remainder of the string is converted to a .Vt "long long" -value according to base 10. +value according to base 10 +.Pq for Fn strtonum +or the provided base +.Pq for Fn strtonumx . .Pp The value obtained is then checked against the provided .Fa minval @@ -68,13 +80,30 @@ .Fa errstr is non-null, .Fn strtonum -stores an error string in +and +.Fn strtonumx +store an error string in .Fa *errstr indicating the failure. +.Pp +For +.Fn strtonumx +the value of +.Ar base +is interpreted in the same way as described in +.Xr strtoll 3 . +In particular, if the value of +.Ar base +is 0, then the expected form of +.Ar nptr +is that of a decimal constant, octal constant or hexadecimal constant, any of +which may be preceded by a + or - sign. .Sh RETURN VALUES The .Fn strtonum -function returns the result of the conversion, +and +.Fn strtonumx +functions return the result of the conversion, unless the value would exceed the provided bounds or is invalid. On error, 0 is returned, .Va errno @@ -90,6 +119,8 @@ .Sh EXAMPLES Using .Fn strtonum +and +.Fn strtonumx correctly is meant to be simpler than the alternative functions. .Bd -literal -offset indent int iterations; @@ -107,7 +138,10 @@ .It Bq Er ERANGE The given string was out of range. .It Bq Er EINVAL -The given string did not consist solely of digit characters. +The given string did not consist solely of digit characters +.Pq for Fn strtonum , +or characters which are valid in the given base +.Pq for Fn strtonumx . .It Bq Er EINVAL The supplied .Fa minval @@ -120,12 +154,15 @@ will be set to one of the following strings: .Pp .Bl -tag -width ".Li too large" -compact -.It Li "too large" +.It Qq too large The result was larger than the provided maximum value. -.It Li "too small" +.It Qq too small The result was smaller than the provided minimum value. -.It Li invalid -The string did not consist solely of digit characters. +.It Qq invalid +The string did not consist solely of characters valid in the specified base +.Pq or base 10 for Fn strtonum . +.It Qq unparsable; invalid base specified +The specified base was outside the permitted range. .El .Sh SEE ALSO .Xr atof 3 , @@ -152,3 +189,6 @@ .Fn strtonum function first appeared in .Ox 3.6 . +The +.Fn strtonumx +function first appeared in illumos in 2023. diff --git a/lib/libc/stdlib/strtonum.c b/lib/libc/stdlib/strtonum.c --- a/lib/libc/stdlib/strtonum.c +++ b/lib/libc/stdlib/strtonum.c @@ -2,6 +2,8 @@ * Copyright (c) 2004 Ted Unangst and Todd Miller * All rights reserved. * + * Copyright 2023 Oxide Computer Company + * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. @@ -24,10 +26,13 @@ #define INVALID 1 #define TOOSMALL 2 #define TOOLARGE 3 +#define BADBASE 4 + +#define MBASE ('z' - 'a' + 1 + 10) long long -strtonum(const char *numstr, long long minval, long long maxval, - const char **errstrp) +strtonumx(const char *numstr, long long minval, long long maxval, + const char **errstrp, int base) { long long ll = 0; int error = 0; @@ -35,20 +40,23 @@ struct errval { const char *errstr; int err; - } ev[4] = { + } ev[5] = { { NULL, 0 }, { "invalid", EINVAL }, { "too small", ERANGE }, { "too large", ERANGE }, + { "unparsable; invalid base specified", EINVAL }, }; ev[0].err = errno; errno = 0; if (minval > maxval) { error = INVALID; + } else if (base < 0 || base > MBASE || base == 1) { + error = BADBASE; } else { - ll = strtoll(numstr, &ep, 10); - if (errno == EINVAL || numstr == ep || *ep != '\0') + ll = strtoll(numstr, &ep, base); + if (numstr == ep || *ep != '\0') error = INVALID; else if ((ll == LLONG_MIN && errno == ERANGE) || ll < minval) error = TOOSMALL; @@ -58,8 +66,15 @@ if (errstrp != NULL) *errstrp = ev[error].errstr; errno = ev[error].err; - if (error) + if (error != 0) ll = 0; return (ll); } + +long long +strtonum(const char *numstr, long long minval, long long maxval, + const char **errstrp) +{ + return (strtonumx(numstr, minval, maxval, errstrp, 10)); +} diff --git a/lib/libc/stdlib/tdestroy.c b/lib/libc/stdlib/tdestroy.c --- a/lib/libc/stdlib/tdestroy.c +++ b/lib/libc/stdlib/tdestroy.c @@ -16,53 +16,51 @@ { } -/* Find the leftmost node. */ -static posix_tnode * -tdestroy_find_leftmost(posix_tnode *tn) -{ - while (tn->llink != NULL) - tn = tn->llink; - return (tn); -} - -/* - * This algorithm for non-recursive non-allocating destruction of the tree - * is described in - * https://codegolf.stackexchange.com/questions/478/free-a-binary-tree/489#489P - * and in https://devblogs.microsoft.com/oldnewthing/20251107-00/?p=111774. - */ void tdestroy(void *rootp, void (*node_free)(void *)) { - posix_tnode *tn, *tn_leftmost, *xtn; + posix_tnode *back, *curr, **front; - tn = rootp; - if (tn == NULL) + if (rootp == NULL) return; if (node_free == NULL) node_free = nul_node_free; - tn_leftmost = tn; - while (tn != NULL) { + back = rootp; + front = &back; + + for (;;) { /* - * Make the right subtree the left subtree of the - * leftmost node, and recalculate the leftmost. + * The sequence of nodes from back to just before *front linked + * by llink have been found to have non-NULL rlink. + * + * Extend *front to (*front)->llink, deleting *front from the + * sequence if it has a NULL rlink. */ - tn_leftmost = tdestroy_find_leftmost(tn_leftmost); - if (tn->rlink != NULL) { - tn_leftmost->llink = tn->rlink; - tn_leftmost = tn_leftmost->llink; + curr = *front; + if (curr->rlink != NULL) + front = &curr->llink; + else { + *front = curr->llink; + node_free(curr->key); + free(curr); } + if (*front != NULL) + continue; + if (back == NULL) + break; /* - * At this point, all children of tn have been - * arranged to be reachable via tn->left. We can - * safely delete the current node and advance to its - * left child as the new root. + * The sequence cannot be extended because *front is NULL. Make + * the rlink of the back node the new *front, the llink of the + * back node the new back, and free the old back node. */ - xtn = tn->llink; - node_free(tn->key); - free(tn); - tn = xtn; + curr = back; + back = curr->llink; + if (back == NULL) + front = &back; + *front = curr->rlink; + node_free(curr->key); + free(curr); } } diff --git a/lib/libc/string/swab.c b/lib/libc/string/swab.c --- a/lib/libc/string/swab.c +++ b/lib/libc/string/swab.c @@ -3,14 +3,16 @@ * Copyright (c) 2024 rilysh */ +#include #include #include void swab(const void * __restrict from, void * __restrict to, ssize_t len) { - const uint16_t *f __aligned(1) = from; - uint16_t *t __aligned(1) = to; + const char *f = from; + char *t = to; + uint16_t tmp; /* * POSIX says overlapping copy behavior is undefined, however many @@ -19,7 +21,12 @@ * and swapping them before writing them back accomplishes this. */ while (len > 1) { - *t++ = bswap16(*f++); + memcpy(&tmp, f, 2); + tmp = bswap16(tmp); + memcpy(t, &tmp, 2); + + f += 2; + t += 2; len -= 2; } } diff --git a/lib/libexecinfo/tests/sigtramp_test.c b/lib/libexecinfo/tests/sigtramp_test.c --- a/lib/libexecinfo/tests/sigtramp_test.c +++ b/lib/libexecinfo/tests/sigtramp_test.c @@ -45,6 +45,14 @@ ATF_TC_WITHOUT_HEAD(test_backtrace_sigtramp); ATF_TC_BODY(test_backtrace_sigtramp, tc) { +#if defined(__aarch64__) + /* + * https://reviews.llvm.org is deprecated and + * this review is never going to be updated or completed + */ + atf_tc_expect_fail("https://reviews.llvm.org/D155066"); +#endif + struct sigaction act; pid_t child; int status; diff --git a/lib/libjail/jail.c b/lib/libjail/jail.c --- a/lib/libjail/jail.c +++ b/lib/libjail/jail.c @@ -29,12 +29,14 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -46,12 +48,72 @@ #define SJPARAM "security.jail.param" -#define JPS_IN_ADDR 1 -#define JPS_IN6_ADDR 2 +#define JPSDEF_OF(jp) \ + ((jp)->jp_structtype >= 0 ? &jp_structdefs[(jp)->jp_structtype] : NULL) + +static int jps_get(struct jailparam *, struct iovec *); +static int jps_set(const struct jailparam *, struct iovec *); +static void jps_free(struct jailparam *); + +typedef int (jps_import_t)(const struct jailparam *, int, const char *); +typedef char *(jps_export_t)(const struct jailparam *, int); +typedef int (jps_get_t)(struct jailparam *, struct iovec *); +typedef int (jps_set_t)(const struct jailparam *, struct iovec *); +typedef void (jps_free_t)(struct jailparam *); + +static jps_import_t jps_import_in_addr; +static jps_import_t jps_import_in6_addr; +static jps_import_t jps_import_mac_label; + +static jps_export_t jps_export_in_addr; +static jps_export_t jps_export_in6_addr; +static jps_export_t jps_export_mac_label; + +static jps_get_t jps_get_mac_label; + +static jps_set_t jps_set_mac_label; + +static jps_free_t jps_free_mac_label; + +static const struct jp_structdef { + const char *jps_type; /* sysctl type */ + size_t jps_valuelen; /* value size */ + jps_import_t *jps_import; /* jailparam_import() */ + jps_export_t *jps_export; /* jailparam_export() */ + jps_get_t *jps_get; /* jailparam_get() */ + jps_set_t *jps_set; /* jailparam_set() */ + jps_free_t *jps_free; /* jailparam_free() */ +} jp_structdefs[] = { + { + .jps_type = "S,in_addr", + .jps_valuelen = sizeof(struct in_addr), + .jps_import = jps_import_in_addr, + .jps_export = jps_export_in_addr, + }, + { + .jps_type = "S,in6_addr", + .jps_valuelen = sizeof(struct in6_addr), + .jps_import = jps_import_in6_addr, + .jps_export = jps_export_in6_addr, + }, + { + .jps_type = "S,mac", + .jps_valuelen = sizeof(mac_t *), + .jps_import = jps_import_mac_label, + .jps_export = jps_export_mac_label, + .jps_get = jps_get_mac_label, + .jps_set = jps_set_mac_label, + .jps_free = jps_free_mac_label, + }, +}; + +_Static_assert(nitems(jp_structdefs) <= INT_MAX, + "Too many struct definitions requires an ABI break in struct jailparam"); #define ARRAY_SANITY 5 #define ARRAY_SLOP 5 +static const struct jp_structdef *jp_structinfo(const char *type, int *); static int jailparam_import_enum(const char **values, int nvalues, const char *valstr, size_t valsize, int *value); @@ -66,6 +128,23 @@ static const char *bool_values[] = { "false", "true" }; static const char *jailsys_values[] = { "disable", "new", "inherit" }; +static const struct jp_structdef * +jp_structinfo(const char *type, int *oidx) +{ + const struct jp_structdef *jpsdef; + + for (size_t idx = 0; idx < nitems(jp_structdefs); idx++) { + jpsdef = &jp_structdefs[idx]; + + if (strcmp(jpsdef->jps_type, type) == 0) { + *oidx = (int)idx; + return (jpsdef); + } + } + + *oidx = -1; + return (NULL); +} /* * Import a null-terminated parameter list and set a jail with the flags @@ -325,6 +404,7 @@ { char *p, *ep, *tvalue; const char *avalue; + const struct jp_structdef *jpsdef; int i, nval, fw; if (value == NULL) @@ -426,34 +506,13 @@ case CTLTYPE_STRUCT: tvalue = alloca(fw + 1); strlcpy(tvalue, avalue, fw + 1); - switch (jp->jp_structtype) { - case JPS_IN_ADDR: - if (inet_pton(AF_INET, tvalue, - &((struct in_addr *)jp->jp_value)[i]) != 1) - { - snprintf(jail_errmsg, - JAIL_ERRMSGLEN, - "%s: not an IPv4 address: %s", - jp->jp_name, tvalue); - errno = EINVAL; - goto error; - } - break; - case JPS_IN6_ADDR: - if (inet_pton(AF_INET6, tvalue, - &((struct in6_addr *)jp->jp_value)[i]) != 1) - { - snprintf(jail_errmsg, - JAIL_ERRMSGLEN, - "%s: not an IPv6 address: %s", - jp->jp_name, tvalue); - errno = EINVAL; - goto error; - } - break; - default: + + if (jp->jp_structtype == -1) goto unknown_type; - } + + jpsdef = &jp_structdefs[jp->jp_structtype]; + if ((*jpsdef->jps_import)(jp, i, tvalue) != 0) + goto error; break; default: unknown_type: @@ -548,7 +607,7 @@ /* No value means key removal. */ jiov[i].iov_base = NULL; jiov[i].iov_len = 0; - } else { + } else if (jps_set(&jp[j], &jiov[i]) != 0) { /* * Try to fill in missing values with an empty string. */ @@ -593,7 +652,7 @@ { struct iovec *jiov; struct jailparam *jp_desc, *jp_lastjid, *jp_jid, *jp_name, *jp_key; - int i, ai, ki, jid, arrays, sanity; + int i, ai, ki, jid, arrays, processed, sanity; unsigned j; /* @@ -695,6 +754,26 @@ JAIL_ERRMSGLEN); return (-1); } + + /* + * Returns -1 on error, or # index populated on + * success. 0 is perfectly valid for a type + * that may want to simply initialize the value + * as needed. + */ + processed = jps_get(&jp[j], &jiov[i]); + if (processed == -1) { + return (-1); + } else if (processed > 0) { + /* + * The above math for jiov sizing does + * not really account for one param + * expanding to multiple entries. + */ + assert(processed == 1); + i += processed; + continue; + } } jiov[i].iov_base = jp[j].jp_value; jiov[i].iov_len = jp[j].jp_valuelen; @@ -773,6 +852,7 @@ { size_t *valuelens; char *value, *tvalue, **values; + const struct jp_structdef *jpsdef; size_t valuelen; int i, nval, ival; char valbuf[INET6_ADDRSTRLEN]; @@ -839,29 +919,25 @@ (uintmax_t)((uint64_t *)jp->jp_value)[i]); break; case CTLTYPE_STRUCT: - switch (jp->jp_structtype) { - case JPS_IN_ADDR: - if (inet_ntop(AF_INET, - &((struct in_addr *)jp->jp_value)[i], - valbuf, sizeof(valbuf)) == NULL) { - strerror_r(errno, jail_errmsg, - JAIL_ERRMSGLEN); - return (NULL); - } - break; - case JPS_IN6_ADDR: - if (inet_ntop(AF_INET6, - &((struct in6_addr *)jp->jp_value)[i], - valbuf, sizeof(valbuf)) == NULL) { - strerror_r(errno, jail_errmsg, - JAIL_ERRMSGLEN); - return (NULL); - } - break; - default: + if (jp->jp_structtype == -1) goto unknown_type; + + jpsdef = &jp_structdefs[jp->jp_structtype]; + value = (*jpsdef->jps_export)(jp, i); + if (value == NULL) { + strerror_r(errno, jail_errmsg, + JAIL_ERRMSGLEN); + return (NULL); } - break; + + valuelens[i] = strlen(value) + 1; + valuelen += valuelens[i]; + values[i] = alloca(valuelens[i]); + strcpy(values[i], value); + + free(value); + value = NULL; + continue; /* Value already added to values[] */ default: unknown_type: snprintf(jail_errmsg, JAIL_ERRMSGLEN, @@ -896,12 +972,15 @@ void jailparam_free(struct jailparam *jp, unsigned njp) { + unsigned j; for (j = 0; j < njp; j++) { free(jp[j].jp_name); - if (!(jp[j].jp_flags & JP_RAWVALUE)) + if (!(jp[j].jp_flags & JP_RAWVALUE)) { + jps_free(jp); free(jp[j].jp_value); + } } } @@ -1055,14 +1134,17 @@ } jp->jp_valuelen = strtoul(desc.s, NULL, 10); break; - case CTLTYPE_STRUCT: - if (!strcmp(desc.s, "S,in_addr")) { - jp->jp_structtype = JPS_IN_ADDR; - jp->jp_valuelen = sizeof(struct in_addr); - } else if (!strcmp(desc.s, "S,in6_addr")) { - jp->jp_structtype = JPS_IN6_ADDR; - jp->jp_valuelen = sizeof(struct in6_addr); + case CTLTYPE_STRUCT: { + const struct jp_structdef *jpsdef; + + jpsdef = jp_structinfo(desc.s, &jp->jp_structtype); + if (jpsdef != NULL) { + assert(jp->jp_structtype >= 0); + + jp->jp_valuelen = jpsdef->jps_valuelen; } else { + assert(jp->jp_structtype == -1); + desclen = 0; if (sysctl(mib + 2, miblen / sizeof(int), NULL, &jp->jp_valuelen, NULL, 0) < 0) { @@ -1073,6 +1155,7 @@ } } break; + } case CTLTYPE_NODE: /* * A node might be described by an empty-named child, @@ -1215,3 +1298,198 @@ return (kvname); } + +static int +jps_get(struct jailparam *jp, struct iovec *jiov) +{ + const struct jp_structdef *jpsdef; + + jpsdef = JPSDEF_OF(jp); + if (jpsdef == NULL || jpsdef->jps_get == NULL) + return (0); /* Nop, but not an error. */ + + return ((jpsdef->jps_get)(jp, jiov)); +} + +static int +jps_set(const struct jailparam *jp, struct iovec *jiov) +{ + const struct jp_structdef *jpsdef; + + jpsdef = JPSDEF_OF(jp); + if (jpsdef == NULL || jpsdef->jps_set == NULL) + return (EINVAL); /* Unhandled */ + + return ((jpsdef->jps_set)(jp, jiov)); +} + +static void +jps_free(struct jailparam *jp) +{ + const struct jp_structdef *jpsdef; + + jpsdef = JPSDEF_OF(jp); + if (jpsdef == NULL) + return; + + if (jpsdef->jps_free != NULL) + jpsdef->jps_free(jp); +} + +static int +jps_import_in_addr(const struct jailparam *jp, int i, const char *value) +{ + struct in_addr *addr; + + addr = &((struct in_addr *)jp->jp_value)[i]; + if (inet_pton(AF_INET, value, addr) != 1) { + snprintf(jail_errmsg, JAIL_ERRMSGLEN, + "%s: not an IPv4 address: %s", jp->jp_name, value); + errno = EINVAL; + return (-1); + } + + return (0); +} + +static int +jps_import_in6_addr(const struct jailparam *jp, int i, const char *value) +{ + struct in6_addr *addr6; + + addr6 = &((struct in6_addr *)jp->jp_value)[i]; + if (inet_pton(AF_INET6, value, addr6) != 1) { + snprintf(jail_errmsg, JAIL_ERRMSGLEN, + "%s: not an IPv6 address: %s", jp->jp_name, value); + errno = EINVAL; + return (-1); + } + + return (0); +} + +static int +jps_import_mac_label(const struct jailparam *jp, int i, const char *value) +{ + mac_t *pmac; + + pmac = &((mac_t *)jp->jp_value)[i]; + if (mac_from_text(pmac, value) != 0) { + int serrno = errno; + + snprintf(jail_errmsg, JAIL_ERRMSGLEN, "%s: mac_from_text: %s", + jp->jp_name, strerror(errno)); + errno = serrno; + return (-1); + } + + return (0); +} + +static char * +jps_export_in_addr(const struct jailparam *jp, int i) +{ + struct in_addr *addr; + char valbuf[INET_ADDRSTRLEN]; + + addr = &((struct in_addr *)jp->jp_value)[i]; + if (inet_ntop(AF_INET, addr, valbuf, sizeof(valbuf)) == NULL) + return (NULL); + + /* Error checked by caller. */ + return (strdup(valbuf)); +} + +static char * +jps_export_in6_addr(const struct jailparam *jp, int i) +{ + struct in6_addr *addr6; + char valbuf[INET6_ADDRSTRLEN]; + + addr6 = &((struct in6_addr *)jp->jp_value)[i]; + if (inet_ntop(AF_INET6, addr6, valbuf, sizeof(valbuf)) == NULL) + return (NULL); + + /* Error checked by caller. */ + return (strdup(valbuf)); +} + +static char * +jps_export_mac_label(const struct jailparam *jp, int i) +{ + mac_t *macp; + char *labelbuf; + int error; + + macp = &((mac_t *)jp->jp_value)[i]; + error = mac_to_text(*macp, &labelbuf); + if (error != 0) + return (NULL); + + return (labelbuf); +} + +static int +jps_get_mac_label(struct jailparam *jp, struct iovec *jiov) +{ + mac_t *pmac = jp->jp_value; + int error; + + error = mac_prepare_type(pmac, "jail"); + if (error != 0) { + int serrno = errno; + + free(jp->jp_value); + jp->jp_value = NULL; + if (serrno == ENOENT) { + snprintf(jail_errmsg, sizeof(jail_errmsg), + "jail_get: no mac.conf(5) jail config"); + } else { + strerror_r(serrno, jail_errmsg, JAIL_ERRMSGLEN); + } + + errno = serrno; + return (-1); + } + + /* + * MAC label gets special handling because libjail internally maintains + * it as a pointer to a mac_t, but we actually want to pass the mac_t + * itself. We don't want the jailparam_get() zeroing behavior, as it's + * initialized by us. + */ + jiov->iov_base = *pmac; + jiov->iov_len = sizeof(**pmac); + return (1); +} + +static int +jps_set_mac_label(const struct jailparam *jp, struct iovec *jiov) +{ + mac_t *pmac; + + /* + * MAC label gets special handling because libjail internally + * maintains it as a pointer to a mac_t, but we actually want to + * pass the mac_t itself. + */ + pmac = jp->jp_value; + if (pmac != NULL) { + jiov->iov_base = *pmac; + jiov->iov_len = sizeof(**pmac); + } else { + jiov->iov_base = NULL; + jiov->iov_len = 0; + } + + return (0); +} + +static void +jps_free_mac_label(struct jailparam *jp) +{ + mac_t *pmac = jp->jp_value; + + if (pmac != NULL) + mac_free(*pmac); +} diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -249,6 +249,14 @@ struct pf_rule_gid gid; char rcv_ifname[IFNAMSIZ]; bool rcvifnot; + struct { + uint8_t id; + int limiter_action; + } statelim; + struct { + uint8_t id; + int limiter_action; + } sourcelim; uint32_t rule_flag; uint8_t action; @@ -590,4 +598,103 @@ int pfctl_clr_astats(struct pfctl_handle *h, const struct pfr_table *tbl, struct pfr_addr *addr, int size, int *nzero, int flags); +struct pfctl_limit_rate { + unsigned int limit; + unsigned int seconds; +}; + +struct pfctl_state_lim { + uint32_t ticket; + char name[PF_STATELIM_NAME_LEN]; + uint32_t id; + unsigned int limit; + + struct pfctl_limit_rate rate; + + char description[PF_STATELIM_DESCR_LEN]; + + unsigned int inuse; + uint64_t admitted; + uint64_t hardlimited; + uint64_t ratelimited; +}; + +int pfctl_state_limiter_nget(struct pfctl_handle *h, struct pfctl_state_lim *lim); +int pfctl_state_limiter_add(struct pfctl_handle *h, struct pfctl_state_lim *lim); + +struct pfctl_source_lim { + uint32_t ticket; + + char name[PF_SOURCELIM_NAME_LEN]; + uint32_t id; + + /* limit on the total number of address entries */ + unsigned int entries; + + /* limit on the number of states per address entry */ + unsigned int limit; + + /* rate limit on the creation of states by an address entry */ + struct pfctl_limit_rate rate; + + /* + * when the number of states on an entry exceeds hwm, add + * the address to the specified table. when the number of + * states goes below lwm, remove it from the table. + */ + char overload_tblname[PF_TABLE_NAME_SIZE]; + unsigned int overload_hwm; + unsigned int overload_lwm; + + /* + * mask addresses before they're used for entries. /64s + * everywhere for inet6 makes it easy to use too much memory. + */ + unsigned int inet_prefix; + unsigned int inet6_prefix; + + char description[PF_SOURCELIM_DESCR_LEN]; + + unsigned int nentries; + unsigned int inuse; + + uint64_t addrallocs; + uint64_t addrnomem; + uint64_t admitted; + uint64_t addrlimited; + uint64_t hardlimited; + uint64_t ratelimited; +}; + +int pfctl_source_limiter_get(struct pfctl_handle *h, struct pfctl_source_lim *lim); +int pfctl_source_limiter_nget(struct pfctl_handle *h, struct pfctl_source_lim *lim); +int pfctl_source_limiter_add(struct pfctl_handle *h, struct pfctl_source_lim *lim); + +struct pfctl_source { + sa_family_t af; + unsigned int rdomain; + struct pf_addr addr; + + unsigned int inet_prefix; + unsigned int inet6_prefix; + + unsigned int limit; + unsigned int inuse; + uint64_t admitted; + uint64_t hardlimited; + uint64_t ratelimited; +}; +typedef int (*pfctl_get_source_fn)(struct pfctl_source *, void *); +int pfctl_source_get(struct pfctl_handle *h, int id, + pfctl_get_source_fn fn, void *arg); + +struct pfctl_source_clear { + char name[PF_SOURCELIM_NAME_LEN]; + uint32_t id; + sa_family_t af; + unsigned int rdomain; + struct pf_addr addr; +}; +int pfctl_source_clear(struct pfctl_handle *h, struct pfctl_source_clear *); + #endif diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -1313,6 +1313,11 @@ snl_add_msg_attr_ip6(nw, PF_RT_DIVERT_ADDRESS, &r->divert.addr.v6); snl_add_msg_attr_u16(nw, PF_RT_DIVERT_PORT, r->divert.port); + snl_add_msg_attr_u8(nw, PF_RT_STATE_LIMIT, r->statelim.id); + snl_add_msg_attr_u32(nw, PF_RT_STATE_LIMIT_ACTION, r->statelim.limiter_action); + snl_add_msg_attr_u8(nw, PF_RT_SOURCE_LIMIT, r->sourcelim.id); + snl_add_msg_attr_u32(nw, PF_RT_SOURCE_LIMIT_ACTION, r->sourcelim.limiter_action); + snl_end_attr_nested(nw, off); } @@ -1704,6 +1709,10 @@ { .type = PF_RT_TYPE_2, .off = _OUT(r.type), .cb = snl_attr_get_uint16 }, { .type = PF_RT_CODE_2, .off = _OUT(r.code), .cb = snl_attr_get_uint16 }, { .type = PF_RT_EXPTIME, .off = _OUT(r.exptime), .cb = snl_attr_get_time_t }, + { .type = PF_RT_STATE_LIMIT, .off = _OUT(r.statelim.id), .cb = snl_attr_get_uint8 }, + { .type = PF_RT_SOURCE_LIMIT, .off = _OUT(r.sourcelim.id), .cb = snl_attr_get_uint8 }, + { .type = PF_RT_STATE_LIMIT_ACTION, .off = _OUT(r.statelim.limiter_action), .cb = snl_attr_get_uint32 }, + { .type = PF_RT_SOURCE_LIMIT_ACTION, .off = _OUT(r.sourcelim.limiter_action), .cb = snl_attr_get_uint32 }, }; #undef _OUT SNL_DECLARE_PARSER(getrule_parser, struct genlmsghdr, snl_f_p_empty, ap_getrule); @@ -3910,3 +3919,317 @@ return (ret); } +static void +snl_add_msg_attr_limit_rate(struct snl_writer *nw, uint32_t type, + const struct pfctl_limit_rate *rate) +{ + int off; + + off = snl_add_msg_attr_nested(nw, type); + + snl_add_msg_attr_u32(nw, PF_LR_LIMIT, rate->limit); + snl_add_msg_attr_u32(nw, PF_LR_SECONDS, rate->seconds); + + snl_end_attr_nested(nw, off); +} + +#define _OUT(_field) offsetof(struct pfctl_limit_rate, _field) +static const struct snl_attr_parser ap_limit_rate[] = { + { .type = PF_LR_LIMIT, .off = _OUT(limit), .cb = snl_attr_get_uint32 }, + { .type = PF_LR_SECONDS, .off = _OUT(seconds), .cb = snl_attr_get_uint32 }, +}; +SNL_DECLARE_ATTR_PARSER(limit_rate_parser, ap_limit_rate); +#undef _OUT + +#define _OUT(_field) offsetof(struct pfctl_state_lim, _field) +static struct snl_attr_parser ap_statelim[] = { + { .type = PF_SL_NAME, .off = _OUT(name), .arg_u32 = PF_STATELIM_NAME_LEN, .cb = snl_attr_copy_string }, + { .type = PF_SL_ID, .off = _OUT(id), .cb = snl_attr_get_uint32 }, + { .type = PF_SL_LIMIT, .off = _OUT(limit), .cb = snl_attr_get_uint32 }, + { .type = PF_SL_RATE, .off = _OUT(rate), .arg = &limit_rate_parser, .cb = snl_attr_get_nested }, + { .type = PF_SL_DESCR, .off = _OUT(description), .arg_u32 = PF_STATELIM_DESCR_LEN, .cb = snl_attr_copy_string }, + { .type = PF_SL_INUSE, .off = _OUT(inuse), .cb = snl_attr_get_uint32 }, + { .type = PF_SL_ADMITTED, .off = _OUT(admitted), .cb = snl_attr_get_uint64 }, + { .type = PF_SL_HARDLIMITED, .off = _OUT(hardlimited), .cb = snl_attr_get_uint64 }, + { .type = PF_SL_RATELIMITED, .off = _OUT(ratelimited), .cb = snl_attr_get_uint64 }, +}; +#undef _OUT +SNL_DECLARE_PARSER(statelim_parser, struct genlmsghdr, snl_f_p_empty, ap_statelim); + +int +pfctl_state_limiter_nget(struct pfctl_handle *h, struct pfctl_state_lim *lim) +{ + struct snl_writer nw; + struct snl_errmsg_data e = {}; + struct nlmsghdr *hdr; + uint32_t seq_id; + int family_id; + + family_id = snl_get_genl_family(&h->ss, PFNL_FAMILY_NAME); + if (family_id == 0) + return (ENOTSUP); + + snl_init_writer(&h->ss, &nw); + hdr = snl_create_genl_msg_request(&nw, family_id, PFNL_CMD_STATE_LIMITER_NGET); + + snl_add_msg_attr_u32(&nw, PF_SL_ID, lim->id); + + if ((hdr = snl_finalize_msg(&nw)) == NULL) + return (ENXIO); + seq_id = hdr->nlmsg_seq; + + if (! snl_send_message(&h->ss, hdr)) + return (ENXIO); + + while ((hdr = snl_read_reply_multi(&h->ss, seq_id, &e)) != NULL) { + if (! snl_parse_nlmsg(&h->ss, hdr, &statelim_parser, lim)) + continue; + } + + return (e.error); +} + +int +pfctl_state_limiter_add(struct pfctl_handle *h, struct pfctl_state_lim *lim) +{ + struct snl_writer nw; + struct snl_errmsg_data e = {}; + struct nlmsghdr *hdr; + uint32_t seq_id; + int family_id; + + family_id = snl_get_genl_family(&h->ss, PFNL_FAMILY_NAME); + if (family_id == 0) + return (ENOTSUP); + + snl_init_writer(&h->ss, &nw); + hdr = snl_create_genl_msg_request(&nw, family_id, PFNL_CMD_STATE_LIMITER_ADD); + + snl_add_msg_attr_u32(&nw, PF_SL_ID, lim->id); + snl_add_msg_attr_u32(&nw, PF_SL_TICKET, lim->ticket); + snl_add_msg_attr_string(&nw, PF_SL_NAME, lim->name); + snl_add_msg_attr_u32(&nw, PF_SL_LIMIT, lim->limit); + snl_add_msg_attr_limit_rate(&nw, PF_SL_RATE, &lim->rate); + snl_add_msg_attr_string(&nw, PF_SL_DESCR, lim->description); + + if ((hdr = snl_finalize_msg(&nw)) == NULL) + return (ENXIO); + seq_id = hdr->nlmsg_seq; + + if (! snl_send_message(&h->ss, hdr)) + return (ENXIO); + + while ((hdr = snl_read_reply_multi(&h->ss, seq_id, &e)) != NULL) { + if (! snl_parse_nlmsg(&h->ss, hdr, &statelim_parser, &lim)) + continue; + } + + return (e.error); +} + +#define _OUT(_field) offsetof(struct pfctl_source_lim, _field) +static struct snl_attr_parser ap_sourcelim[] = { + { .type = PF_SCL_NAME, .off = _OUT(name), .arg_u32 = PF_SOURCELIM_NAME_LEN, .cb = snl_attr_copy_string }, + { .type = PF_SCL_ID, .off = _OUT(id), .cb = snl_attr_get_uint32 }, + { .type = PF_SCL_ENTRIES, .off = _OUT(entries), .cb = snl_attr_get_uint32 }, + { .type = PF_SCL_LIMIT, .off = _OUT(limit), .cb = snl_attr_get_uint32 }, + { .type = PF_SCL_RATE, .off = _OUT(rate), .arg = &limit_rate_parser, .cb = snl_attr_get_nested }, + { .type = PF_SCL_OVERLOAD_TBL_NAME, .off = _OUT(overload_tblname), .arg_u32 = PF_TABLE_NAME_SIZE, .cb = snl_attr_copy_string }, + { .type = PF_SCL_OVERLOAD_HIGH_WM, .off = _OUT(overload_hwm), .cb = snl_attr_get_uint32 }, + { .type = PF_SCL_OVERLOAD_LOW_WM, .off = _OUT(overload_lwm), .cb = snl_attr_get_uint32 }, + { .type = PF_SCL_INET_PREFIX, .off = _OUT(inet_prefix), .cb = snl_attr_get_uint32 }, + { .type = PF_SCL_INET6_PREFIX, .off = _OUT(inet6_prefix), .cb = snl_attr_get_uint32 }, + { .type = PF_SCL_DESCR, .off = _OUT(description), .arg_u32 = PF_SOURCELIM_DESCR_LEN, .cb = snl_attr_copy_string }, + { .type = PF_SCL_NENTRIES, .off = _OUT(nentries), .cb = snl_attr_get_uint32 }, + { .type = PF_SCL_INUSE, .off = _OUT(inuse), .cb = snl_attr_get_uint32 }, + { .type = PF_SCL_ADDR_ALLOCS, .off = _OUT(addrallocs), .cb = snl_attr_get_uint64 }, + { .type = PF_SCL_ADDR_NOMEM, .off = _OUT(addrnomem), .cb = snl_attr_get_uint64 }, + { .type = PF_SCL_ADMITTED, .off = _OUT(admitted), .cb = snl_attr_get_uint64 }, + { .type = PF_SCL_ADDRLIMITED, .off = _OUT(addrlimited), .cb = snl_attr_get_uint64 }, + { .type = PF_SCL_HARDLIMITED, .off = _OUT(hardlimited), .cb = snl_attr_get_uint64 }, + { .type = PF_SCL_RATELIMITED, .off = _OUT(ratelimited), .cb = snl_attr_get_uint64 }, +}; +#undef _OUT +SNL_DECLARE_PARSER(sourcelim_parser, struct genlmsghdr, snl_f_p_empty, ap_sourcelim); + +int +pfctl_source_limiter_add(struct pfctl_handle *h, struct pfctl_source_lim *lim) +{ + struct snl_writer nw; + struct snl_errmsg_data e = {}; + struct nlmsghdr *hdr; + uint32_t seq_id; + int family_id; + + family_id = snl_get_genl_family(&h->ss, PFNL_FAMILY_NAME); + if (family_id == 0) + return (ENOTSUP); + + snl_init_writer(&h->ss, &nw); + hdr = snl_create_genl_msg_request(&nw, family_id, PFNL_CMD_SOURCE_LIMITER_ADD); + + snl_add_msg_attr_u32(&nw, PF_SCL_TICKET, lim->ticket); + snl_add_msg_attr_string(&nw, PF_SCL_NAME, lim->name); + snl_add_msg_attr_u32(&nw, PF_SCL_ID, lim->id); + snl_add_msg_attr_u32(&nw, PF_SCL_ENTRIES, lim->entries); + snl_add_msg_attr_u32(&nw, PF_SCL_LIMIT, lim->limit); + snl_add_msg_attr_limit_rate(&nw, PF_SCL_RATE, &lim->rate); + snl_add_msg_attr_string(&nw, PF_SCL_OVERLOAD_TBL_NAME, lim->overload_tblname); + snl_add_msg_attr_u32(&nw, PF_SCL_OVERLOAD_HIGH_WM, lim->overload_hwm); + snl_add_msg_attr_u32(&nw, PF_SCL_OVERLOAD_LOW_WM, lim->overload_lwm); + snl_add_msg_attr_u32(&nw, PF_SCL_INET_PREFIX, lim->inet_prefix); + snl_add_msg_attr_u32(&nw, PF_SCL_INET6_PREFIX, lim->inet6_prefix); + snl_add_msg_attr_string(&nw, PF_SCL_DESCR, lim->description); + + if ((hdr = snl_finalize_msg(&nw)) == NULL) + return (ENXIO); + seq_id = hdr->nlmsg_seq; + + if (! snl_send_message(&h->ss, hdr)) + return (ENXIO); + + while ((hdr = snl_read_reply_multi(&h->ss, seq_id, &e)) != NULL) { + if (! snl_parse_nlmsg(&h->ss, hdr, &sourcelim_parser, &lim)) + continue; + } + + return (e.error); +} + +static int +_pfctl_source_limiter_get(struct pfctl_handle *h, int cmd, struct pfctl_source_lim *lim) +{ + struct snl_writer nw; + struct snl_errmsg_data e = {}; + struct nlmsghdr *hdr; + uint32_t seq_id; + int family_id; + + family_id = snl_get_genl_family(&h->ss, PFNL_FAMILY_NAME); + if (family_id == 0) + return (ENOTSUP); + + snl_init_writer(&h->ss, &nw); + hdr = snl_create_genl_msg_request(&nw, family_id, cmd); + + snl_add_msg_attr_u32(&nw, PF_SCL_ID, lim->id); + + if ((hdr = snl_finalize_msg(&nw)) == NULL) + return (ENXIO); + seq_id = hdr->nlmsg_seq; + + if (! snl_send_message(&h->ss, hdr)) + return (ENXIO); + + while ((hdr = snl_read_reply_multi(&h->ss, seq_id, &e)) != NULL) { + if (! snl_parse_nlmsg(&h->ss, hdr, &sourcelim_parser, lim)) + continue; + } + + return (e.error); +} + +int +pfctl_source_limiter_get(struct pfctl_handle *h, struct pfctl_source_lim *lim) +{ + return (_pfctl_source_limiter_get(h, PFNL_CMD_SOURCE_LIMITER_GET, lim)); +} + +int +pfctl_source_limiter_nget(struct pfctl_handle *h, struct pfctl_source_lim *lim) +{ + return (_pfctl_source_limiter_get(h, PFNL_CMD_SOURCE_LIMITER_NGET, lim)); +} + +#define _OUT(_field) offsetof(struct pfctl_source, _field) +static struct snl_attr_parser ap_source[] = { + { .type = PF_SRC_AF, .off = _OUT(af), .cb = snl_attr_get_uint8 }, + { .type = PF_SRC_RDOMAIN, .off = _OUT(rdomain), .cb = snl_attr_get_uint32 }, + { .type = PF_SRC_ADDR, .off = _OUT(addr), .cb = snl_attr_get_in6_addr }, + { .type = PF_SRC_INUSE, .off = _OUT(inuse), .cb = snl_attr_get_uint32 }, + { .type = PF_SRC_ADMITTED, .off = _OUT(admitted), .cb = snl_attr_get_uint64 }, + { .type = PF_SRC_HARDLIMITED, .off = _OUT(hardlimited), .cb = snl_attr_get_uint64 }, + { .type = PF_SRC_RATELIMITED, .off = _OUT(ratelimited), .cb = snl_attr_get_uint64 }, + { .type = PF_SRC_LIMIT, .off = _OUT(limit), .cb = snl_attr_get_uint32 }, + { .type = PF_SRC_INET_PREFIX, .off = _OUT(inet_prefix), .cb = snl_attr_get_uint32 }, + {. type = PF_SRC_INET6_PREFIX, .off = _OUT(inet6_prefix), .cb = snl_attr_get_uint32 }, +}; +#undef _OUT +SNL_DECLARE_PARSER(source_parser, struct genlmsghdr, snl_f_p_empty, ap_source); + +int +pfctl_source_get(struct pfctl_handle *h, int id, pfctl_get_source_fn fn, void *arg) +{ + struct snl_writer nw; + struct snl_errmsg_data e = {}; + struct nlmsghdr *hdr; + uint32_t seq_id; + int family_id, error; + + family_id = snl_get_genl_family(&h->ss, PFNL_FAMILY_NAME); + if (family_id == 0) + return (ENOTSUP); + + snl_init_writer(&h->ss, &nw); + hdr = snl_create_genl_msg_request(&nw, family_id, PFNL_CMD_SOURCE_NGET); + + snl_add_msg_attr_u32(&nw, PF_SRC_ID, id); + + if ((hdr = snl_finalize_msg(&nw)) == NULL) + return (ENXIO); + seq_id = hdr->nlmsg_seq; + + if (! snl_send_message(&h->ss, hdr)) + return (ENXIO); + + while ((hdr = snl_read_reply_multi(&h->ss, seq_id, &e)) != NULL) { + struct pfctl_source src; + + if (! snl_parse_nlmsg(&h->ss, hdr, &source_parser, &src)) + continue; + + error = fn(&src, arg); + if (error != 0) { + e.error = error; + break; + } + } + + return (e.error); +} + +int +pfctl_source_clear(struct pfctl_handle *h, struct pfctl_source_clear *kill) +{ + struct snl_writer nw; + struct snl_errmsg_data e = {}; + struct nlmsghdr *hdr; + uint32_t seq_id; + int family_id; + + family_id = snl_get_genl_family(&h->ss, PFNL_FAMILY_NAME); + if (family_id == 0) + return (ENOTSUP); + + snl_init_writer(&h->ss, &nw); + hdr = snl_create_genl_msg_request(&nw, family_id, PFNL_CMD_SOURCE_CLEAR); + + snl_add_msg_attr_string(&nw, PF_SC_NAME, kill->name); + snl_add_msg_attr_u32(&nw, PF_SC_ID, kill->id); + snl_add_msg_attr_u32(&nw, PF_SC_RDOMAIN, kill->rdomain); + snl_add_msg_attr_u8(&nw, PF_SC_AF, kill->af); + snl_add_msg_attr_ip6(&nw, PF_SC_ADDR, &kill->addr.v6); + + if ((hdr = snl_finalize_msg(&nw)) == NULL) + return (ENXIO); + seq_id = hdr->nlmsg_seq; + + if (! snl_send_message(&h->ss, hdr)) + return (ENXIO); + + while ((hdr = snl_read_reply_multi(&h->ss, seq_id, &e)) != NULL) { + } + + return (e.error); +} + diff --git a/lib/msun/powerpc/fenv.h b/lib/msun/powerpc/fenv.h --- a/lib/msun/powerpc/fenv.h +++ b/lib/msun/powerpc/fenv.h @@ -40,17 +40,6 @@ typedef __uint32_t fexcept_t; /* Exception flags */ -#ifdef __SPE__ -#define FE_OVERFLOW 0x00000100 -#define FE_UNDERFLOW 0x00000200 -#define FE_DIVBYZERO 0x00000400 -#define FE_INVALID 0x00000800 -#define FE_INEXACT 0x00001000 - -#define FE_ALL_INVALID FE_INVALID - -#define _FPUSW_SHIFT 6 -#else #define FE_INEXACT 0x02000000 #define FE_DIVBYZERO 0x04000000 #define FE_UNDERFLOW 0x08000000 @@ -78,7 +67,6 @@ FE_VXSNAN | FE_INVALID) #define _FPUSW_SHIFT 22 -#endif #define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_INEXACT | \ FE_ALL_INVALID | FE_OVERFLOW | FE_UNDERFLOW) @@ -101,17 +89,10 @@ FE_OVERFLOW | FE_UNDERFLOW) >> _FPUSW_SHIFT) #ifndef _SOFT_FLOAT -#ifdef __SPE__ -#define __mffs(__env) \ - __asm __volatile("mfspr %0, 512" : "=r" ((__env)->__bits.__reg)) -#define __mtfsf(__env) \ - __asm __volatile("mtspr 512,%0;isync" :: "r" ((__env).__bits.__reg)) -#else #define __mffs(__env) \ __asm __volatile("mffs %0" : "=f" ((__env)->__d)) #define __mtfsf(__env) \ __asm __volatile("mtfsf 255,%0" :: "f" ((__env).__d)) -#endif #else #define __mffs(__env) #define __mtfsf(__env) @@ -167,9 +148,6 @@ return (0); } -#ifdef __SPE__ -extern int feraiseexcept(int __excepts); -#else __fenv_static inline int feraiseexcept(int __excepts) { @@ -182,7 +160,6 @@ __mtfsf(__r); return (0); } -#endif __fenv_static inline int fetestexcept(int __excepts) diff --git a/lib/msun/powerpc/fenv.c b/lib/msun/powerpc/fenv.c --- a/lib/msun/powerpc/fenv.c +++ b/lib/msun/powerpc/fenv.c @@ -28,27 +28,17 @@ #define __fenv_static #include "fenv.h" -#ifdef __SPE__ -#include -#include -#endif #ifdef __GNUC_GNU_INLINE__ #error "This file must be compiled with C99 'inline' semantics" #endif -#ifdef __SPE__ -const fenv_t __fe_dfl_env = SPEFSCR_DFLT; -#else const fenv_t __fe_dfl_env = 0x00000000; -#endif extern inline int feclearexcept(int __excepts); extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts); extern inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts); -#ifndef __SPE__ extern inline int feraiseexcept(int __excepts); -#endif extern inline int fetestexcept(int __excepts); extern inline int fegetround(void); extern inline int fesetround(int __round); @@ -58,27 +48,3 @@ extern inline int feupdateenv(const fenv_t *__envp); extern inline int feenableexcept(int __mask); extern inline int fedisableexcept(int __mask); - -#ifdef __SPE__ -#define PMAX 0x7f7fffff -#define PMIN 0x00800000 -int feraiseexcept(int __excepts) -{ - uint32_t spefscr; - - spefscr = mfspr(SPR_SPEFSCR); - mtspr(SPR_SPEFSCR, spefscr | (__excepts & FE_ALL_EXCEPT)); - - if (__excepts & FE_INVALID) - __asm __volatile ("efsdiv %0, %0, %1" :: "r"(0), "r"(0)); - if (__excepts & FE_DIVBYZERO) - __asm __volatile ("efsdiv %0, %0, %1" :: "r"(1.0f), "r"(0)); - if (__excepts & FE_UNDERFLOW) - __asm __volatile ("efsmul %0, %0, %0" :: "r"(PMIN)); - if (__excepts & FE_OVERFLOW) - __asm __volatile ("efsadd %0, %0, %0" :: "r"(PMAX)); - if (__excepts & FE_INEXACT) - __asm __volatile ("efssub %0, %0, %1" :: "r"(PMIN), "r"(1.0f)); - return (0); -} -#endif diff --git a/lib/ncurses/tinfo/Makefile b/lib/ncurses/tinfo/Makefile --- a/lib/ncurses/tinfo/Makefile +++ b/lib/ncurses/tinfo/Makefile @@ -16,6 +16,7 @@ NCURSES_OK_WCHAR_T= 1 NEED_WCHAR_H= 1 NCURSES_EXT_COLORS= 1 +NCURSES_RGB_COLORS= 0 NCURSES_EXT_FUNCS= 1 NCURSES_CONST= const NCURSES_INLINE= inline @@ -49,7 +50,7 @@ HAVE_TERMIO_H= 0 HAVE_VSSCANF= 1 HAVE_STDINT_H= 1 -HEADER_STDBOOL= 1 +HAVE_STDBOOL_H= 1 HAVE_STDNORETURN_H= 0 ENABLE_SIGWINCH= 1 # XXX amd64 1L and int @@ -193,14 +194,6 @@ SYMLINKS+= libtinfow.so ${LIBDIR}/libtinfo.so .endif -DOCSDIR= ${SHAREDIR}/doc/ncurses -DOCS= ncurses-intro.html hackguide.html - -.if ${MK_HTML} != "no" -.PATH: ${NCURSES_DIR}/doc/html -FILESGROUPS= DOCS -.endif - # Generated source .ORDER: names.c codes.c @@ -357,6 +350,7 @@ -e "/@NCURSES_OPAQUE_MENU@/s%%${NCURSES_OPAQUE_MENU}%" \ -e "/@NCURSES_OPAQUE_PANEL@/s%%${NCURSES_OPAQUE_PANEL}%" \ -e "/@NCURSES_PATCH@/s%%${NCURSES_PATCH}%" \ + -e "/@NCURSES_RGB_COLORS@/s%%${NCURSES_RGB_COLORS}%" \ -e "/@NCURSES_SIZE_T@/s%%${NCURSES_SIZE_T}%" \ -e "/@NCURSES_TPARM_VARARGS@/s%%${NCURSES_TPARM_VARARGS}%" \ -e "/@NCURSES_WATTR_MACROS@/s%%${NCURSES_WATTR_MACROS}%"\ @@ -369,15 +363,15 @@ -e "/@NCURSES_SP_FUNCS@/s%%${NCURSES_SP_FUNCS}%g" \ -e "/@NEED_WCHAR_H@/s%%${NEED_WCHAR_H}%" \ -e "/@USE_CXX_BOOL@/s%%${USE_CXX_BOOL}%" \ + -e "/@USE_STDBOOL_H@/s%%${HAVE_STDBOOL_H}%" \ -e "/@GENERATED_EXT_FUNCS@/s%%generated%g" \ -e "s%@NCURSES_CCHARW_MAX@%5%g" \ -e "s%@cf_cv_1UL@%${ONEUL}%g" \ - -e "s%@cf_cv_builtin_bool@%${BUILTIN_BOOL}%g" \ + -e "s%@USE_BUILTIN_BOOL@%${BUILTIN_BOOL}%g" \ -e "s%@cf_cv_enable_lp64@%${ENABLE_LP64}%g" \ -e "s%@cf_cv_enable_opaque@%${ENABLE_OPAQUE}%g" \ -e "s%@cf_cv_enable_reentrant@%${ENABLE_REENTRANT}%g" \ -e "s%@cf_cv_enable_sigwinch@%${ENABLE_SIGWINCH}%g" \ - -e "s%@cf_cv_header_stdbool_h@%${HEADER_STDBOOL}%g" \ -e "s%@cf_cv_type_of_bool@%${TYPE_OF_BOOL}%g" \ -e "s%@cf_cv_typeof_chtype@%${TYPEOF_CHTYPE}%g" \ -e "s%@cf_cv_typeof_mmask_t@%${TYPEOF_MMASK_T}%g" \ diff --git a/lib/ncurses/tinfo/ncurses_cfg.h b/lib/ncurses/tinfo/ncurses_cfg.h --- a/lib/ncurses/tinfo/ncurses_cfg.h +++ b/lib/ncurses/tinfo/ncurses_cfg.h @@ -1,6 +1,6 @@ /* include/ncurses_cfg.h. Generated automatically by configure. */ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -32,7 +32,7 @@ * Author: Thomas E. Dickey 1997-on * ****************************************************************************/ /* - * $Id: ncurses_cfg.hin,v 1.13 2020/03/08 12:37:59 tom Exp $ + * $Id: ncurses_cfg.hin,v 1.15 2024/06/08 14:04:14 tom Exp $ * * Both ncurses_cfg.h and ncurses_def.h are internal header-files used when * building ncurses. @@ -45,14 +45,14 @@ * * See: * https://invisible-island.net/autoconf/ - * ftp://ftp.invisible-island.net/autoconf/ + * https://invisible-island.net/archives/autoconf/ */ #ifndef NC_CONFIG_H #define NC_CONFIG_H #define PACKAGE "ncurses" -#define NCURSES_VERSION "6.5" -#define NCURSES_PATCHDATE 20240427 +#define NCURSES_VERSION "6.6" +#define NCURSES_PATCHDATE 20251230 #define SYSTEM_NAME "FreeBSD" #if 0 #include @@ -60,9 +60,6 @@ #define HAVE_LONG_FILE_NAMES 1 #define MIXEDCASE_FILENAMES 1 #define STDC_HEADERS 1 -#define USE_GETCAP 1 -#define BSD_TPUTS 1 -#define HAVE_BSD_CGETENT 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_STAT_H 1 #define HAVE_STDLIB_H 1 @@ -78,6 +75,7 @@ #define TERMINFO "/usr/share/terminfo" #define HAVE_BIG_CORE 1 #define TERMPATH "/etc/termcap:/usr/share/misc/termcap" +#define USE_GETCAP 1 #define USE_HOME_TERMINFO 1 #define USE_ROOT_ENVIRON 1 #define USE_ROOT_ACCESS 1 @@ -88,6 +86,7 @@ #define HAVE_LINK 1 #define HAVE_SYMLINK 1 #define USE_LINKS 1 +#define BSD_TPUTS 1 #define HAVE_LANGINFO_CODESET 1 #define USE_WIDEC_SUPPORT 1 #define NCURSES_WIDECHAR 1 @@ -106,6 +105,7 @@ #define HAVE_MBSRTOWCS 1 #define HAVE_WCSTOMBS 1 #define HAVE_MBSTOWCS 1 +#define HAVE_WCWIDTH 1 #define NEED_WCHAR_H 1 #define HAVE_FSEEKO 1 #define RGB_PATH "no" @@ -134,6 +134,7 @@ #define NCURSES_WRAP_PREFIX "_nc_" #define USE_ASSUMED_COLOR 1 #define USE_HASHMAP 1 +#define USE_COLORFGBG 1 #define GCC_SCANF 1 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) #define GCC_PRINTF 1 @@ -159,7 +160,6 @@ #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 @@ -169,7 +169,6 @@ #define HAVE_STRDUP 1 #define HAVE_SYS_TIME_SELECT 1 #define SIG_ATOMIC_T volatile sig_atomic_t -#define HAVE_ERRNO 1 #define HAVE_CLOCK_GETTIME 1 #define HAVE_FPATHCONF 1 #define HAVE_GETCWD 1 @@ -197,6 +196,7 @@ #define HAVE_VSNPRINTF 1 #define HAVE_PATH_TTYS 1 #define HAVE_GETTTYNAM 1 +#define HAVE_BSD_CGETENT 1 #define HAVE_ISASCII 1 #define HAVE_NANOSLEEP 1 #define HAVE_TERMIOS_H 1 @@ -216,8 +216,15 @@ #define HAVE_WORKING_VFORK 1 #define HAVE_WORKING_FORK 1 #define USE_FOPEN_BIN_R 1 +#define HAVE_CC_T 1 +#define HAVE_SPEED_T 1 +#define HAVE_TCFLAG_T 1 +#define HAVE_SIGSET_T 1 #define USE_OPENPTY_HEADER #define USE_XTERM_PTY 1 +#define USE_STDBOOL_H 1 +#define HAVE_NEW 1 +#define HAVE_EXCEPTION 1 #define HAVE_TYPEINFO 1 #define HAVE_IOSTREAM 1 #define IOSTREAM_NAMESPACE 1 @@ -233,7 +240,7 @@ #define HAVE_FORM_H 1 #define HAVE_LIBFORM 1 #define NCURSES_PATHSEP ':' -#define NCURSES_VERSION_STRING "6.5.20240427" +#define NCURSES_VERSION_STRING "6.6.20251230" #define NCURSES_OSPEED_COMPAT 1 #include diff --git a/lib/virtual_oss/Makefile b/lib/virtual_oss/Makefile --- a/lib/virtual_oss/Makefile +++ b/lib/virtual_oss/Makefile @@ -1,9 +1,8 @@ .include -SHLIBDIR?= ${LIBDIR}/virtual_oss - SUBDIR+= null \ oss -.include "Makefile.inc" +SUBDIR_PARALLEL= + .include diff --git a/lib/virtual_oss/Makefile.inc b/lib/virtual_oss/Makefile.inc --- a/lib/virtual_oss/Makefile.inc +++ b/lib/virtual_oss/Makefile.inc @@ -1,5 +1,9 @@ PACKAGE= sound -.include "../Makefile.inc" +SHLIBDIR= ${LIBDIR}/virtual_oss + +CFLAGS+= -I${SRCTOP}/usr.sbin/virtual_oss/virtual_oss +# XXX virtual_oss/int.h includes samplerate.h, but the library isn't used +CFLAGS+= -I${SYSROOT:U${DESTDIR}}/${INCLUDEDIR}/private/samplerate -LDFLAGS+= -L${.OBJDIR:H:H}/libsamplerate +.include "../Makefile.inc" diff --git a/lib/virtual_oss/bt/Makefile b/lib/virtual_oss/bt/Makefile --- a/lib/virtual_oss/bt/Makefile +++ b/lib/virtual_oss/bt/Makefile @@ -1,14 +1,10 @@ SHLIB_NAME= voss_bt.so -SHLIBDIR= ${LIBDIR}/virtual_oss SRCS= bt.c \ avdtp.c \ sbc_encode.c -CFLAGS+= -I${SRCTOP}/usr.sbin/virtual_oss/virtual_oss \ - -I${SRCTOP}/contrib/libsamplerate -LDFLAGS+= -lbluetooth -lsdp -LIBADD= samplerate +LIBADD= bluetooth sdp .if defined(HAVE_LIBAV) CFLAGS+= -I${LOCALBASE:U/usr/local}/include -DHAVE_LIBAV diff --git a/lib/virtual_oss/null/Makefile b/lib/virtual_oss/null/Makefile --- a/lib/virtual_oss/null/Makefile +++ b/lib/virtual_oss/null/Makefile @@ -1,10 +1,5 @@ SHLIB_NAME= voss_null.so -SHLIBDIR= ${LIBDIR}/virtual_oss SRCS= null.c -CFLAGS+= -I${SRCTOP}/usr.sbin/virtual_oss/virtual_oss \ - -I${SRCTOP}/contrib/libsamplerate -LIBADD= samplerate - .include diff --git a/lib/virtual_oss/oss/Makefile b/lib/virtual_oss/oss/Makefile --- a/lib/virtual_oss/oss/Makefile +++ b/lib/virtual_oss/oss/Makefile @@ -1,10 +1,5 @@ SHLIB_NAME= voss_oss.so -SHLIBDIR= ${LIBDIR}/virtual_oss SRCS= oss.c -CFLAGS+= -I${SRCTOP}/usr.sbin/virtual_oss/virtual_oss \ - -I${SRCTOP}/contrib/libsamplerate -LIBADD= samplerate - .include diff --git a/lib/virtual_oss/sndio/Makefile b/lib/virtual_oss/sndio/Makefile --- a/lib/virtual_oss/sndio/Makefile +++ b/lib/virtual_oss/sndio/Makefile @@ -1,12 +1,8 @@ SHLIB_NAME= voss_sndio.so -SHLIBDIR= ${LIBDIR}/virtual_oss SRCS= sndio.c -CFLAGS+= -I${SRCTOP}/usr.sbin/virtual_oss/virtual_oss \ - -I${SRCTOP}/contrib/libsamplerate \ - -I${LOCALBASE:U/usr/local}/include +CFLAGS+= -I${LOCALBASE:U/usr/local}/include \ LDFLAGS+= -L${LOCALBASE:U/usr/local}/lib -lsndio -LIBADD= samplerate .include diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -705,6 +705,10 @@ osrelease_enable="YES" # Update /var/run/os-release on boot (or NO). osrelease_file="/var/run/os-release" # File to update for os-release. osrelease_perms="444" # Default permission for os-release file. +osrelease_home_url="https://FreeBSD.org" # HOME_URL in /var/run/os-release. +osrelease_documentation_url="https://docs.FreeBSD.org" # DOCUMENTATION_URL in /var/run/os-release. +osrelease_support_url="https://www.FreeBSD.org/support" # SUPPORT_URL in /var/run/os-release. +osrelease_bug_report_url="https://bugs.FreeBSD.org" # BUG_REPORT_URL in /var/run/os-release. dmesg_enable="YES" # Save dmesg(8) to /var/run/dmesg.boot dmesg_umask="022" # Default umask for /var/run/dmesg.boot file. watchdogd_enable="NO" # Start the software watchdog daemon diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile --- a/libexec/rc/rc.d/Makefile +++ b/libexec/rc/rc.d/Makefile @@ -36,7 +36,6 @@ linux \ local \ localpkg \ - mixer \ motd \ mountcritlocal \ mountcritremote \ @@ -301,9 +300,10 @@ VIPACKAGE= vi VI= virecover -CONFGROUPS.${MK_CUSE}+= VOSS -VOSSPACKAGE= sound -VOSS= virtual_oss +CONFGROUPS.${MK_SOUND}+= SOUND +SOUNDPACKAGE= sound +SOUND= mixer \ + virtual_oss CONFGROUPS.${MK_WIRELESS}+= HOSTAPD HOSTAPDPACKAGE= hostapd diff --git a/libexec/rc/rc.d/os-release b/libexec/rc/rc.d/os-release --- a/libexec/rc/rc.d/os-release +++ b/libexec/rc/rc.d/os-release @@ -8,14 +8,21 @@ . /etc/rc.subr -: ${osrelease_file:=/var/run/os-release} -: ${osrelease_perms:=444} name="osrelease" -desc="Update ${osrelease_file}" +desc="os-release update" rcvar="osrelease_enable" start_cmd="osrelease_start" stop_cmd=":" +load_rc_config $name + +: ${osrelease_file:=/var/run/os-release} +: ${osrelease_perms:=444} +: ${osrelease_home_url:="https://www.FreeBSD.org"} +: ${osrelease_documentation_url:="https://docs.FreeBSD.org"} +: ${osrelease_support_url:="https://www.FreeBSD.org/support"} +: ${osrelease_bug_report_url:="https://bugs.FreeBSD.org"} + osrelease_start() { local _version _version_id @@ -32,16 +39,16 @@ ANSI_COLOR="0;31" PRETTY_NAME="FreeBSD $_version" CPE_NAME="cpe:/o:freebsd:freebsd:$_version_id" - HOME_URL="https://FreeBSD.org/" - BUG_REPORT_URL="https://bugs.FreeBSD.org/" + HOME_URL="${osrelease_home_url}" + DOCUMENTATION_URL="${osrelease_documentation_url}" + SUPPORT_URL="${osrelease_support_url}" + BUG_REPORT_URL="${osrelease_bug_report_url}" __EOF__ install -C -o root -g wheel -m ${osrelease_perms} "$t" "${osrelease_file}" rm -f "$t" startmsg 'done.' } -load_rc_config $name - # doesn't make sense to run in a svcj: config setting osrelease_svcj="NO" diff --git a/libexec/rtld-elf/aarch64/reloc.c b/libexec/rtld-elf/aarch64/reloc.c --- a/libexec/rtld-elf/aarch64/reloc.c +++ b/libexec/rtld-elf/aarch64/reloc.c @@ -444,10 +444,21 @@ return (target); } +__ifunc_arg_t ifunc_arg = { + ._size = sizeof(__ifunc_arg_t) +}; + void -ifunc_init(Elf_Auxinfo *aux_info[__min_size(AT_COUNT)] __unused) +ifunc_init(Elf_Auxinfo *aux_info[__min_size(AT_COUNT)]) { - + ifunc_arg._hwcap = aux_info[AT_HWCAP] != NULL ? + (aux_info[AT_HWCAP]->a_un.a_val | _IFUNC_ARG_HWCAP) : 0; + ifunc_arg._hwcap2 = aux_info[AT_HWCAP2] != NULL ? + aux_info[AT_HWCAP2]->a_un.a_val : 0; + ifunc_arg._hwcap3 = aux_info[AT_HWCAP3] != NULL ? + aux_info[AT_HWCAP3]->a_un.a_val : 0; + ifunc_arg._hwcap4 = aux_info[AT_HWCAP4] != NULL ? + aux_info[AT_HWCAP4]->a_un.a_val : 0; } /* diff --git a/libexec/rtld-elf/aarch64/rtld_machdep.h b/libexec/rtld-elf/aarch64/rtld_machdep.h --- a/libexec/rtld-elf/aarch64/rtld_machdep.h +++ b/libexec/rtld-elf/aarch64/rtld_machdep.h @@ -33,6 +33,7 @@ #include #include +#include #include struct Struct_Obj_Entry; @@ -67,6 +68,8 @@ #define call_init_pointer(obj, target) \ (((InitArrFunc)(target))(main_argc, main_argv, environ)) +extern struct __ifunc_arg_t ifunc_arg; + /* * Pass zeros into the ifunc resolver so we can change them later. The first * 8 arguments on arm64 are passed in registers so make them known values @@ -74,9 +77,10 @@ * no arguments are passed in, and if this changes later will be able to * compare the argument with 0 to see if it is set. */ -#define call_ifunc_resolver(ptr) \ - (((Elf_Addr (*)(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, \ - uint64_t, uint64_t, uint64_t))ptr)(0, 0, 0, 0, 0, 0, 0, 0)) +#define call_ifunc_resolver(ptr) \ + (((Elf_Addr (*)(uint64_t, const struct __ifunc_arg_t *, uint64_t, \ + uint64_t, uint64_t, uint64_t, uint64_t, uint64_t))ptr)( \ + ifunc_arg._hwcap, &ifunc_arg, 0, 0, 0, 0, 0, 0)) #define round(size, align) \ (((size) + (align) - 1) & ~((align) - 1)) diff --git a/libexec/rtld-elf/debug.h b/libexec/rtld-elf/debug.h --- a/libexec/rtld-elf/debug.h +++ b/libexec/rtld-elf/debug.h @@ -33,7 +33,7 @@ #define DEBUG_H 1 #include - +#include #include #include "rtld_paths.h" #include "rtld_printf.h" @@ -47,9 +47,6 @@ #define dbg(...) ((void) 0) #endif -#define assert(cond) ((cond) ? (void) 0 : \ - (msg(_BASENAME_RTLD ": assert failed: " __FILE__ ":" \ - __XSTRING(__LINE__) "\n"), abort())) #define msg(s) rtld_putstr(s) #define trace() msg(_BASENAME_RTLD ": " __XSTRING(__LINE__) "\n") diff --git a/libexec/rtld-elf/map_object.c b/libexec/rtld-elf/map_object.c --- a/libexec/rtld-elf/map_object.c +++ b/libexec/rtld-elf/map_object.c @@ -318,7 +318,7 @@ phsize); obj->phdr_alloc = true; } - obj->phsize = phsize; + obj->phnum = phsize / sizeof(*phdr); if (phinterp != NULL) obj->interp = (const char *)(obj->relocbase + phinterp->p_vaddr); diff --git a/libexec/rtld-elf/powerpc/reloc.c b/libexec/rtld-elf/powerpc/reloc.c --- a/libexec/rtld-elf/powerpc/reloc.c +++ b/libexec/rtld-elf/powerpc/reloc.c @@ -366,9 +366,7 @@ * Synchronize icache for executable segments in case we made * any changes. */ - for (phdr = obj->phdr; - (const char *)phdr < (const char *)obj->phdr + obj->phsize; - phdr++) { + for (phdr = obj->phdr; phdr < obj->phdr + obj->phnum; phdr++) { if (phdr->p_type == PT_LOAD && (phdr->p_flags & PF_X) != 0) { __syncicache(obj->relocbase + phdr->p_vaddr, phdr->p_memsz); diff --git a/libexec/rtld-elf/powerpc/rtld_start.S b/libexec/rtld-elf/powerpc/rtld_start.S --- a/libexec/rtld-elf/powerpc/rtld_start.S +++ b/libexec/rtld-elf/powerpc/rtld_start.S @@ -101,17 +101,10 @@ sc _END(.rtld_start) -#ifdef __SPE__ -/* stack space for 30 GPRs + SPEFSCR/ACC/lr/cr */ -#define NREGS 31 -#define GPRWIDTH 8 -#define FUDGE 4 /* Fudge factor for alignment */ -#else /* stack space for 30 GPRs + lr/cr */ #define NREGS 30 #define GPRWIDTH 4 #define FUDGE 4 -#endif /* Stack frame needs the 12-byte ABI frame plus fudge factor. */ #define STACK_SIZE (NREGS * GPRWIDTH + 4 * 2 + 12 + FUDGE) @@ -125,11 +118,7 @@ */ _ENTRY(_rtld_bind_secureplt_start) stwu %r1,-STACK_SIZE(%r1) -#ifdef __SPE__ - evstdd %r0,24(%r1) -#else stw %r0,20(%r1) # save r0 -#endif /* * Instead of division which is costly we will use multiplicative @@ -157,110 +146,25 @@ _ENTRY(_rtld_bind_start) stwu %r1,-STACK_SIZE(%r1) -#ifdef __SPE__ - evstdd %r0,24(%r1) -#else stw %r0,20(%r1) # save r0 -#endif 1: mflr %r0 stw %r0,16(%r1) # save lr mfcr %r0 stw %r0,12(%r1) # save cr -#ifdef __SPE__ - evstdd %r3, 32(%r1) - evstdd %r4, 40(%r1) - evstdd %r5, 48(%r1) - evstdd %r6, 56(%r1) - evstdd %r7, 64(%r1) - evstdd %r8, 72(%r1) - evstdd %r9, 80(%r1) - evstdd %r10, 88(%r1) - evstdd %r11, 96(%r1) - evstdd %r12, 104(%r1) - evstdd %r13, 112(%r1) - evstdd %r14, 120(%r1) - evstdd %r15, 128(%r1) - evstdd %r16, 136(%r1) - evstdd %r17, 144(%r1) - evstdd %r18, 152(%r1) - evstdd %r19, 160(%r1) - evstdd %r20, 168(%r1) - evstdd %r21, 176(%r1) - evstdd %r22, 184(%r1) - evstdd %r23, 192(%r1) - evstdd %r24, 200(%r1) - evstdd %r25, 208(%r1) - evstdd %r26, 216(%r1) - evstdd %r27, 224(%r1) - evstdd %r28, 232(%r1) - evstdd %r29, 240(%r1) - evstdd %r30, 248(%r1) - li %r3, 256 - evstddx %r31, %r1, %r3 - evxor %r0, %r0, %r0 - li %r3, 264 - evmwumiaa %r0, %r0, %r0 - evstddx %r0, %r1, %r3 - mfspr %r3, SPR_SPEFSCR - stw %r3, 20(%r1) -#else stmw %r3,24(%r1) # save r3-r31 -#endif mr %r3,%r12 # obj mulli %r4,%r11,12 # rela index * sizeof(Elf_Rela) bl _rtld_bind # target addr = _rtld_bind(obj, reloff) mtctr %r3 # move absolute target addr into ctr -#ifdef __SPE__ - lwz %r3, 20(%r1) - mtspr SPR_SPEFSCR, %r3 - li %r3, 264 - evlddx %r0, %r3, %r1 - evmra %r0, %r0 - evldd %r3, 32(%r1) - evldd %r4, 40(%r1) - evldd %r5, 48(%r1) - evldd %r6, 56(%r1) - evldd %r7, 64(%r1) - evldd %r8, 72(%r1) - evldd %r9, 80(%r1) - evldd %r10, 88(%r1) - evldd %r11, 96(%r1) - evldd %r12, 104(%r1) - evldd %r13, 112(%r1) - evldd %r14, 120(%r1) - evldd %r15, 128(%r1) - evldd %r16, 136(%r1) - evldd %r17, 144(%r1) - evldd %r18, 152(%r1) - evldd %r19, 160(%r1) - evldd %r20, 168(%r1) - evldd %r21, 176(%r1) - evldd %r22, 184(%r1) - evldd %r23, 192(%r1) - evldd %r24, 200(%r1) - evldd %r25, 208(%r1) - evldd %r26, 216(%r1) - evldd %r27, 224(%r1) - evldd %r28, 232(%r1) - evldd %r29, 240(%r1) - evldd %r30, 248(%r1) - li %r0, 256 - evlddx %r31, %r1, %r0 -#else lmw %r3,24(%r1) # restore r3-r31 -#endif lwz %r0,12(%r1) # restore cr mtcr %r0 lwz %r0,16(%r1) # restore lr mtlr %r0 -#ifdef __SPE__ - evldd %r0,24(%r1) -#else lwz %r0,20(%r1) # restore r0 -#endif addi %r1,%r1,STACK_SIZE # restore stack bctr # jump to target diff --git a/libexec/rtld-elf/powerpc64/reloc.c b/libexec/rtld-elf/powerpc64/reloc.c --- a/libexec/rtld-elf/powerpc64/reloc.c +++ b/libexec/rtld-elf/powerpc64/reloc.c @@ -364,9 +364,7 @@ * Synchronize icache for executable segments in case we made * any changes. */ - for (phdr = obj->phdr; - (const char *)phdr < (const char *)obj->phdr + obj->phsize; - phdr++) { + for (phdr = obj->phdr; phdr < obj->phdr + obj->phnum; phdr++) { if (phdr->p_type == PT_LOAD && (phdr->p_flags & PF_X) != 0) { __syncicache(obj->relocbase + phdr->p_vaddr, phdr->p_memsz); diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h --- a/libexec/rtld-elf/rtld.h +++ b/libexec/rtld-elf/rtld.h @@ -152,7 +152,7 @@ const Elf_Dyn *dynamic; /* Dynamic section */ caddr_t entry; /* Entry point */ const Elf_Phdr *phdr; /* Program header if it is mapped, else NULL */ - size_t phsize; /* Size of program header in bytes */ + size_t phnum; /* Number of program headers */ const char *interp; /* Pathname of the interpreter, if any */ Elf_Word stack_flags; @@ -212,11 +212,11 @@ Ver_Entry *vertab; /* Versions required /defined by this object */ int vernum; /* Number of entries in vertab */ - Elf_Addr init; /* Initialization function to call */ - Elf_Addr fini; /* Termination function to call */ - Elf_Addr preinit_array; /* Pre-initialization array of functions */ - Elf_Addr init_array; /* Initialization array of functions */ - Elf_Addr fini_array; /* Termination array of functions */ + uintptr_t init; /* Initialization function to call */ + uintptr_t fini; /* Termination function to call */ + uintptr_t *preinit_array; /* Pre-initialization array of functions */ + uintptr_t *init_array; /* Initialization array of functions */ + uintptr_t *fini_array; /* Termination array of functions */ int preinit_array_num; /* Number of entries in preinit_array */ int init_array_num; /* Number of entries in init_array */ int fini_array_num; /* Number of entries in fini_array */ diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -978,9 +978,9 @@ * functions for binaries linked with old crt1 which calls * _init itself. */ - obj_main->init = obj_main->fini = (Elf_Addr)NULL; + obj_main->init = obj_main->fini = 0; obj_main->preinit_array = obj_main->init_array = - obj_main->fini_array = (Elf_Addr)NULL; + obj_main->fini_array = NULL; } if (direct_exec) { @@ -1499,43 +1499,43 @@ break; case DT_INIT: - obj->init = (Elf_Addr)(obj->relocbase + + obj->init = (uintptr_t)(obj->relocbase + dynp->d_un.d_ptr); break; case DT_PREINIT_ARRAY: - obj->preinit_array = (Elf_Addr)(obj->relocbase + + obj->preinit_array = (uintptr_t *)(obj->relocbase + dynp->d_un.d_ptr); break; case DT_PREINIT_ARRAYSZ: obj->preinit_array_num = dynp->d_un.d_val / - sizeof(Elf_Addr); + sizeof(uintptr_t); break; case DT_INIT_ARRAY: - obj->init_array = (Elf_Addr)(obj->relocbase + + obj->init_array = (uintptr_t *)(obj->relocbase + dynp->d_un.d_ptr); break; case DT_INIT_ARRAYSZ: obj->init_array_num = dynp->d_un.d_val / - sizeof(Elf_Addr); + sizeof(uintptr_t); break; case DT_FINI: - obj->fini = (Elf_Addr)(obj->relocbase + + obj->fini = (uintptr_t)(obj->relocbase + dynp->d_un.d_ptr); break; case DT_FINI_ARRAY: - obj->fini_array = (Elf_Addr)(obj->relocbase + + obj->fini_array = (uintptr_t *)(obj->relocbase + dynp->d_un.d_ptr); break; case DT_FINI_ARRAYSZ: obj->fini_array_num = dynp->d_un.d_val / - sizeof(Elf_Addr); + sizeof(uintptr_t); break; case DT_DEBUG: @@ -1684,7 +1684,7 @@ continue; obj->phdr = phdr; - obj->phsize = ph->p_memsz; + obj->phnum = ph->p_memsz / sizeof(*ph); obj->relocbase = __DECONST(char *, phdr) - ph->p_vaddr; break; } @@ -2423,8 +2423,7 @@ first_seg = true; obj->stack_flags = PF_X | PF_R | PF_W; - for (ph = obj->phdr; - (const char *)ph < (const char *)obj->phdr + obj->phsize; ph++) { + for (ph = obj->phdr; ph < obj->phdr + obj->phnum; ph++) { switch (ph->p_type) { case PT_LOAD: if (first_seg) { @@ -2486,7 +2485,7 @@ ehdr = (Elf_Ehdr *)mapbase; objtmp.phdr = (Elf_Phdr *)((char *)mapbase + ehdr->e_phoff); - objtmp.phsize = ehdr->e_phnum * sizeof(objtmp.phdr[0]); + objtmp.phnum = ehdr->e_phnum; /* Initialize the object list. */ TAILQ_INIT(&obj_list); @@ -2600,8 +2599,7 @@ STAILQ_FOREACH(tmp, &iflist, link) { Obj_Entry *tobj = tmp->obj; - if ((tobj->fini != (Elf_Addr)NULL || - tobj->fini_array != (Elf_Addr)NULL) && + if ((tobj->fini != 0 || tobj->fini_array != NULL) && !tobj->on_fini_list) { objlist_push_tail(&list_fini, tobj); tobj->on_fini_list = true; @@ -2673,8 +2671,7 @@ * Add the object to the global fini list in the * reverse order. */ - if ((obj->fini != (Elf_Addr)NULL || - obj->fini_array != (Elf_Addr)NULL) && + if ((obj->fini != 0 || obj->fini_array != NULL) && !obj->on_fini_list) { objlist_push_head(&list_fini, obj); obj->on_fini_list = true; @@ -2998,7 +2995,7 @@ obj = obj_new(); phdr = (const Elf_Phdr *)((const char *)addr + ehdr->e_phoff); obj->phdr = phdr; - obj->phsize = ehdr->e_phnum * sizeof(*phdr); + obj->phnum = ehdr->e_phnum; phlimit = phdr + ehdr->e_phnum; seg0 = segn = NULL; @@ -3076,10 +3073,10 @@ static void preinit_main(void) { - Elf_Addr *preinit_addr; + uintptr_t *preinit_addr; int index; - preinit_addr = (Elf_Addr *)obj_main->preinit_array; + preinit_addr = obj_main->preinit_array; if (preinit_addr == NULL) return; @@ -3106,7 +3103,7 @@ { Objlist_Entry *elm; struct dlerror_save *saved_msg; - Elf_Addr *fini_addr; + uintptr_t *fini_addr; int index; assert(root == NULL || root->refcount == 1); @@ -3139,7 +3136,7 @@ * defined. When this happens, DT_FINI_ARRAY is * processed first. */ - fini_addr = (Elf_Addr *)elm->obj->fini_array; + fini_addr = elm->obj->fini_array; if (fini_addr != NULL && elm->obj->fini_array_num > 0) { for (index = elm->obj->fini_array_num - 1; index >= 0; index--) { @@ -3157,7 +3154,7 @@ } } } - if (elm->obj->fini != (Elf_Addr)NULL) { + if (elm->obj->fini != 0) { dbg("calling fini function for %s at %p", elm->obj->path, (void *)elm->obj->fini); LD_UTRACE(UTRACE_FINI_CALL, elm->obj, @@ -3193,7 +3190,7 @@ Objlist_Entry *elm; Obj_Entry *obj; struct dlerror_save *saved_msg; - Elf_Addr *init_addr; + uintptr_t *init_addr; void (*reg)(void (*)(void)); int index; @@ -3238,14 +3235,14 @@ * It is legal to have both DT_INIT and DT_INIT_ARRAY defined. * When this happens, DT_INIT is processed first. */ - if (elm->obj->init != (Elf_Addr)NULL) { + if (elm->obj->init != 0) { dbg("calling init function for %s at %p", elm->obj->path, (void *)elm->obj->init); LD_UTRACE(UTRACE_INIT_CALL, elm->obj, (void *)elm->obj->init, 0, 0, elm->obj->path); call_init_pointer(elm->obj, elm->obj->init); } - init_addr = (Elf_Addr *)elm->obj->init_array; + init_addr = elm->obj->init_array; if (init_addr != NULL) { for (index = 0; index < elm->obj->init_array_num; index++) { @@ -3380,10 +3377,10 @@ { const Elf_Phdr *ph; void *base; - size_t l, sz; + size_t sz; int prot; - for (l = obj->phsize / sizeof(*ph), ph = obj->phdr; l > 0; l--, ph++) { + for (ph = obj->phdr; ph < obj->phdr + obj->phnum; ph++) { if (ph->p_type != PT_LOAD || (ph->p_flags & PF_W) != 0) continue; base = obj->relocbase + rtld_trunc_page(ph->p_vaddr); @@ -4331,7 +4328,7 @@ phdr_info->dlpi_addr = (Elf_Addr)obj->relocbase; phdr_info->dlpi_name = obj->path; phdr_info->dlpi_phdr = obj->phdr; - phdr_info->dlpi_phnum = obj->phsize / sizeof(obj->phdr[0]); + phdr_info->dlpi_phnum = obj->phnum; phdr_info->dlpi_tls_modid = obj->tlsindex; phdr_info->dlpi_tls_data = (char *)tls_get_addr_slow(_tcb_get(), obj->tlsindex, 0, true); @@ -5499,7 +5496,7 @@ char *addr; size_t i; size_t extra_size, maxalign, post_size, pre_size, tls_block_size; - size_t tls_init_align, tls_init_offset; + size_t tls_init_align, tls_init_offset, tls_bss_offset; if (oldtcb != NULL && tcbsize == TLS_TCB_SIZE) return (oldtcb); @@ -5557,11 +5554,10 @@ obj->tlsinitsize); } if (obj->tlssize > obj->tlsinitsize) { - memset(addr + tls_init_offset + - obj->tlsinitsize, - 0, - obj->tlssize - obj->tlsinitsize - - tls_init_offset); + tls_bss_offset = tls_init_offset + + obj->tlsinitsize; + memset(addr + tls_bss_offset, 0, + obj->tlssize - tls_bss_offset); } dtv->dtv_slots[obj->tlsindex - 1].dtvs_tls = addr; } @@ -6149,8 +6145,7 @@ caddr_t relro_page; size_t relro_size; - for (ph = obj->phdr; (const char *)ph < (const char *)obj->phdr + - obj->phsize; ph++) { + for (ph = obj->phdr; ph < obj->phdr + obj->phnum; ph++) { if (ph->p_type != PT_GNU_RELRO) continue; relro_page = obj->relocbase + rtld_trunc_page(ph->p_vaddr); diff --git a/release/Makefile.ec2 b/release/Makefile.ec2 --- a/release/Makefile.ec2 +++ b/release/Makefile.ec2 @@ -61,6 +61,9 @@ .for _FL in ${EC2_FLAVOURS:tl} .if defined(SSMPREFIX) && !empty(SSMPREFIX) SSMOPTS_${_FL}_${_FS}= --ssm-name ${SSMPREFIX}/${TARGET_ARCH:S/aarch64/arm64/}/${_FL}/${_FS}/${REVISION}/${BRANCH} +.if ${BRANCH} == "RELEASE" +SSMOPTSEXTRA_${_FL}_${_FS}= --ssm-name-extra ${SSMPREFIX}/${TARGET_ARCH:S/aarch64/arm64/}/${_FL}/${_FS}/${REVISION}/${BRANCH}/latest +.endif .endif EC2AMILIST+= ec2ami-${_FL}-${_FS} CLEANFILES+= ec2ami-${_FL}-${_FS} @@ -84,7 +87,8 @@ @false .endif /usr/local/bin/bsdec2-image-upload ${PUBLISH} ${PUBLICSNAP} \ - ${EC2ARCH} ${SSMOPTS_${_FL}_${_FS}} ${BOOTMODEOPT} --sriov --ena \ + ${EC2ARCH} ${SSMOPTS_${_FL}_${_FS}} ${SSMOPTSEXTRA_${_FL}_${_FS}} \ + ${BOOTMODEOPT} --sriov --ena \ ${.OBJDIR}/${EC2-${_FL:tu}${_FS:tu}IMAGE} \ "${AMIBASENAME} ${_FL} ${_FS:tu}" \ "${TYPE}/${TARGET} ${GITBRANCH}@${GITREV}" \ diff --git a/sbin/devd/Makefile b/sbin/devd/Makefile --- a/sbin/devd/Makefile +++ b/sbin/devd/Makefile @@ -32,11 +32,6 @@ CONSOLE+= moused.conf syscons.conf CONSOLEPACKAGE= console-tools -CONFGROUPS+= SND -SNDDIR= ${DEVDDIR} -SND= snd.conf -SNDPACKAGE= sound - .if ${MK_BLUETOOTH} != "no" CONFGROUPS+= BLUETOOTH BLUETOOTHDIR= ${DEVDDIR} @@ -56,6 +51,13 @@ NVME+= nvmf.conf NVMEPACKAGE= nvme-tools +.if ${MK_SOUND} != "no" +CONFGROUPS+= SND +SNDDIR= ${DEVDDIR} +SND= snd.conf +SNDPACKAGE= sound +.endif + .if ${MK_USB} != "no" DEVD+= uath.conf ulpt.conf .endif diff --git a/sbin/ifconfig/af_link.c b/sbin/ifconfig/af_link.c --- a/sbin/ifconfig/af_link.c +++ b/sbin/ifconfig/af_link.c @@ -134,7 +134,7 @@ sdl->sdl_alen != ETHER_ADDR_LEN) return; - strncpy(ifr.ifr_name, ifa->ifa_name, sizeof(ifr.ifr_name)); + strlcpy(ifr.ifr_name, ifa->ifa_name, sizeof(ifr.ifr_name)); memcpy(&ifr.ifr_addr, ifa->ifa_addr, sizeof(ifa->ifa_addr->sa_len)); ifr.ifr_addr.sa_family = AF_LOCAL; if ((sock_hw = socket(AF_LOCAL, SOCK_DGRAM, 0)) < 0) { diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -72,6 +72,8 @@ #include "pfctl_parser.h" #include "pfctl.h" +#define ISSET(_v, _m) ((_v) & (_m)) + static struct pfctl *pf = NULL; static int debug = 0; static int rulestate = 0; @@ -178,7 +180,8 @@ PF_STATE_OPT_MAX_SRC_CONN_RATE, PF_STATE_OPT_MAX_SRC_NODES, PF_STATE_OPT_OVERLOAD, PF_STATE_OPT_STATELOCK, PF_STATE_OPT_TIMEOUT, PF_STATE_OPT_SLOPPY, - PF_STATE_OPT_PFLOW, PF_STATE_OPT_ALLOW_RELATED }; + PF_STATE_OPT_PFLOW, PF_STATE_OPT_ALLOW_RELATED, + PF_STATE_OPT_STATELIM, PF_STATE_OPT_SOURCELIM }; enum { PF_SRCTRACK_NONE, PF_SRCTRACK, PF_SRCTRACK_GLOBAL, PF_SRCTRACK_RULE }; @@ -254,6 +257,11 @@ bool binat; }; +struct limiterspec { + uint32_t id; + int limiter_action; +}; + static struct filter_opts { int marker; #define FOM_FLAGS 0x0001 @@ -284,6 +292,8 @@ u_int32_t tos; u_int32_t prob; u_int32_t ridentifier; + struct limiterspec statelim; + struct limiterspec sourcelim; struct { int action; struct node_state_opt *options; @@ -362,6 +372,51 @@ struct node_tinithead init_nodes; } table_opts; +struct statelim_opts { + unsigned int marker; +#define STATELIM_M_ID 0x01 +#define STATELIM_M_LIMIT 0x02 +#define STATELIM_M_RATE 0x04 + + uint32_t id; + char name[PF_STATELIM_NAME_LEN]; + unsigned int limit; + struct { + unsigned int limit; + unsigned int seconds; + } rate; +}; + +static struct statelim_opts statelim_opts; + +struct sourcelim_opts { + unsigned int marker; +#define SOURCELIM_M_ID 0x01 +#define SOURCELIM_M_ENTRIES 0x02 +#define SOURCELIM_M_LIMIT 0x04 +#define SOURCELIM_M_RATE 0x08 +#define SOURCELIM_M_TABLE 0x10 +#define SOURCELIM_M_INET_MASK 0x20 +#define SOURCELIM_M_INET6_MASK 0x40 + + uint32_t id; + unsigned int entries; + unsigned int limit; + struct { + unsigned int limit; + unsigned int seconds; + } rate; + struct { + char name[PF_TABLE_NAME_SIZE]; + unsigned int above; + unsigned int below; + } table; + unsigned int inet_mask; + unsigned int inet6_mask; +}; + +static struct sourcelim_opts sourcelim_opts; + static struct codel_opts codel_opts; static struct node_hfsc_opts hfsc_opts; static struct node_fairq_opts fairq_opts; @@ -513,7 +568,10 @@ struct node_hfsc_opts hfsc_opts; struct node_fairq_opts fairq_opts; struct codel_opts codel_opts; + struct statelim_opts *statelim_opts; + struct sourcelim_opts *sourcelim_opts; struct pfctl_watermarks *watermarks; + struct limiterspec limiterspec; } v; int lineno; } YYSTYPE; @@ -548,12 +606,13 @@ %token TAGGED TAG IFBOUND FLOATING STATEPOLICY STATEDEFAULTS ROUTE SETTOS %token DIVERTTO DIVERTREPLY BRIDGE_TO RECEIVEDON NE LE GE AFTO NATTO RDRTO %token BINATTO MAXPKTRATE MAXPKTSIZE IPV6NH +%token LIMITER ID RATE SOURCE ENTRIES ABOVE BELOW MASK NOMATCH %token STRING %token NUMBER %token PORTBINARY %type interface if_list if_item_not if_item %type number icmptype icmp6type uid gid -%type tos not yesno optnodf +%type tos not yesno optnodf sourcelim_opt_below %type probability %type no dir af fragcache optimizer syncookie_val %type sourcetrack flush unaryop statelock @@ -610,12 +669,19 @@ %type etherfrom etherto %type bridge %type xmac mac mac_list macspec +%type statelim_nm sourcelim_nm +%type statelim_id sourcelim_id limiter_opt limiter_opt_spec +%type statelim_filter_opt sourcelim_filter_opt +%type statelim_opts +%type sourcelim_opts %% ruleset : /* empty */ | ruleset include '\n' | ruleset '\n' | ruleset option '\n' + | ruleset statelim '\n' + | ruleset sourcelim '\n' | ruleset etherrule '\n' | ruleset etheranchorrule '\n' | ruleset scrubrule '\n' @@ -2322,6 +2388,417 @@ } ; +statelim : statelim_nm statelim_opts { + struct pfctl_statelim *stlim; + size_t len; + + if (!ISSET($2->marker, STATELIM_M_ID)) { + yyerror("id not specified"); + free($1); + YYERROR; + } + if (!ISSET($2->marker, STATELIM_M_LIMIT)) { + yyerror("limit not specified"); + free($1); + YYERROR; + } + + stlim = calloc(1, sizeof(*stlim)); + if (stlim == NULL) + err(1, "state limiter: malloc"); + + len = strlcpy(stlim->ioc.name, $1, + sizeof(stlim->ioc.name)); + free($1); + if (len >= sizeof(stlim->ioc.name)) { + /* abort? */ + YYERROR; + } + + stlim->ioc.id = $2->id; + stlim->ioc.limit = $2->limit; + stlim->ioc.rate.limit = $2->rate.limit; + stlim->ioc.rate.seconds = $2->rate.seconds; + + if (pfctl_add_statelim(pf, stlim) != 0) { + yyerror("state limiter %s id %u" + " already exists", + stlim->ioc.name, stlim->ioc.id); + free(stlim); + YYERROR; + } + } + ; + +statelim_nm : STATE LIMITER string { + size_t len = strlen($3); + if (len < 1) { + yyerror("state limiter name is too short"); + free($3); + YYERROR; + } + if (len >= PF_STATELIM_NAME_LEN) { + yyerror("state limiter name is too long"); + free($3); + YYERROR; + } + $$ = $3; + } + ; + +statelim_id : ID NUMBER { + if ($2 < PF_STATELIM_ID_MIN || + $2 > PF_STATELIM_ID_MAX) { + yyerror("state limiter id %lld: " + "invalid identifier", $2); + YYERROR; + } + + $$ = $2; + } + ; + +statelim_opts : /* empty */ { + yyerror("state limiter missing options"); + YYERROR; + } + | { + memset(&statelim_opts, 0, sizeof(statelim_opts)); + } statelim_opts_l { + $$ = &statelim_opts; + } + ; + +statelim_opts_l : statelim_opts_l statelim_opt + | statelim_opt + ; + +statelim_opt : statelim_id { + if (ISSET(statelim_opts.marker, STATELIM_M_ID)) { + yyerror("id cannot be respecified"); + YYERROR; + } + + statelim_opts.id = $1; + + statelim_opts.marker |= STATELIM_M_ID; + } + | LIMIT NUMBER { + if (ISSET(statelim_opts.marker, STATELIM_M_LIMIT)) { + yyerror("limit cannot be respecified"); + YYERROR; + } + + if ($2 < PF_STATELIM_LIMIT_MIN || + $2 > PF_STATELIM_LIMIT_MAX) { + yyerror("invalid state limiter limit"); + YYERROR; + } + + statelim_opts.limit = $2; + + statelim_opts.marker |= STATELIM_M_LIMIT; + } + | RATE NUMBER '/' NUMBER { + if (ISSET(statelim_opts.marker, STATELIM_M_RATE)) { + yyerror("rate cannot be respecified"); + YYERROR; + } + if ($2 < 1) { + yyerror("invalid rate limit %lld", $2); + YYERROR; + } + if ($4 < 1) { + yyerror("invalid rate seconds %lld", $4); + YYERROR; + } + + statelim_opts.rate.limit = $2; + statelim_opts.rate.seconds = $4; + + statelim_opts.marker |= STATELIM_M_RATE; + } + ; + +statelim_filter_opt + : STATE LIMITER STRING limiter_opt_spec { + struct pfctl_statelim *stlim; + + stlim = pfctl_get_statelim_nm(pf, $3); + free($3); + if (stlim == NULL) { + yyerror("state limiter not found"); + YYERROR; + } + + $$.id = stlim->ioc.id; + $$.limiter_action = $4; + } + | STATE LIMITER statelim_id limiter_opt_spec { + $$.id = $3; + $$.limiter_action = $4; + } + ; + +sourcelim : sourcelim_nm sourcelim_opts { + struct pfctl_sourcelim *srlim; + size_t len; + + if (!ISSET($2->marker, SOURCELIM_M_ID)) { + yyerror("id not specified"); + free($1); + YYERROR; + } + if (!ISSET($2->marker, SOURCELIM_M_ENTRIES)) { + yyerror("entries not specified"); + free($1); + YYERROR; + } + if (!ISSET($2->marker, SOURCELIM_M_LIMIT)) { + yyerror("state limit not specified"); + free($1); + YYERROR; + } + + srlim = calloc(1, sizeof(*srlim)); + if (srlim == NULL) + err(1, "source limiter: malloc"); + + len = strlcpy(srlim->ioc.name, $1, + sizeof(srlim->ioc.name)); + free($1); + if (len >= sizeof(srlim->ioc.name)) { + /* abort? */ + YYERROR; + } + + srlim->ioc.id = $2->id; + srlim->ioc.entries = $2->entries; + srlim->ioc.limit = $2->limit; + srlim->ioc.rate.limit = $2->rate.limit; + srlim->ioc.rate.seconds = $2->rate.seconds; + + if (ISSET($2->marker, SOURCELIM_M_TABLE)) { + if (strlcpy(srlim->ioc.overload_tblname, + $2->table.name, + sizeof(srlim->ioc.overload_tblname)) >= + sizeof(srlim->ioc.overload_tblname)) { + abort(); + } + srlim->ioc.overload_hwm = $2->table.above; + srlim->ioc.overload_lwm = $2->table.below; + } + + srlim->ioc.inet_prefix = $2->inet_mask; + srlim->ioc.inet6_prefix = $2->inet6_mask; + + if (pfctl_add_sourcelim(pf, srlim) != 0) { + yyerror("source limiter %s id %u" + " already exists", + srlim->ioc.name, srlim->ioc.id); + free(srlim); + YYERROR; + } + } + ; + +sourcelim_nm : SOURCE LIMITER string { + size_t len = strlen($3); + if (len < 1) { + yyerror("source limiter name is too short"); + free($3); + YYERROR; + } + if (len >= PF_SOURCELIM_NAME_LEN) { + yyerror("source limiter name is too long"); + free($3); + YYERROR; + } + $$ = $3; + } + ; + +sourcelim_id : ID NUMBER { + if ($2 < PF_SOURCELIM_ID_MIN || + $2 > PF_SOURCELIM_ID_MAX) { + yyerror("source limiter id %lld: " + "invalid identifier", $2); + YYERROR; + } + + $$ = $2; + } + ; + +sourcelim_opts : /* empty */ { + yyerror("source limiter missing options"); + YYERROR; + } + | { + memset(&sourcelim_opts, 0, sizeof(sourcelim_opts)); + sourcelim_opts.inet_mask = 32; + sourcelim_opts.inet6_mask = 128; + } sourcelim_opts_l { + $$ = &sourcelim_opts; + } + ; + +sourcelim_opts_l : sourcelim_opts_l sourcelim_opt + | sourcelim_opt + ; + +sourcelim_opt : sourcelim_id { + if (ISSET(sourcelim_opts.marker, SOURCELIM_M_ID)) { + yyerror("entries cannot be respecified"); + YYERROR; + } + + sourcelim_opts.id = $1; + + sourcelim_opts.marker |= SOURCELIM_M_ID; + } + | ENTRIES NUMBER { + if (ISSET(sourcelim_opts.marker, SOURCELIM_M_ENTRIES)) { + yyerror("entries cannot be respecified"); + YYERROR; + } + + sourcelim_opts.entries = $2; + + sourcelim_opts.marker |= SOURCELIM_M_ENTRIES; + } + | LIMIT NUMBER { + if (ISSET(sourcelim_opts.marker, SOURCELIM_M_LIMIT)) { + yyerror("state limit cannot be respecified"); + YYERROR; + } + + sourcelim_opts.limit = $2; + + sourcelim_opts.marker |= SOURCELIM_M_LIMIT; + } + | RATE NUMBER '/' NUMBER { + if (ISSET(sourcelim_opts.marker, SOURCELIM_M_RATE)) { + yyerror("rate cannot be respecified"); + YYERROR; + } + + sourcelim_opts.rate.limit = $2; + sourcelim_opts.rate.seconds = $4; + + sourcelim_opts.marker |= SOURCELIM_M_RATE; + } + | TABLE '<' STRING '>' ABOVE NUMBER sourcelim_opt_below { + size_t stringlen; + + if (ISSET(sourcelim_opts.marker, SOURCELIM_M_TABLE)) { + free($3); + yyerror("rate cannot be respecified"); + YYERROR; + } + + stringlen = strlcpy(sourcelim_opts.table.name, + $3, sizeof(sourcelim_opts.table.name)); + free($3); + if (stringlen == 0 || + stringlen >= PF_TABLE_NAME_SIZE) { + yyerror("invalid table name"); + YYERROR; + } + + if ($6 < 0) { + yyerror("above limit is invalid"); + YYERROR; + } + if ($7 > $6) { + yyerror("below limit higher than above limit"); + YYERROR; + } + + sourcelim_opts.table.above = $6; + sourcelim_opts.table.below = $7; + + sourcelim_opts.marker |= SOURCELIM_M_TABLE; + } + | INET MASK NUMBER { + if (ISSET(sourcelim_opts.marker, + SOURCELIM_M_INET_MASK)) { + yyerror("inet mask cannot be respecified"); + YYERROR; + } + + if ($3 < 1 || $3 > 32) { + yyerror("inet mask length out of range"); + YYERROR; + } + + sourcelim_opts.inet_mask = $3; + + sourcelim_opts.marker |= SOURCELIM_M_INET_MASK; + } + | INET6 MASK NUMBER { + if (ISSET(sourcelim_opts.marker, + SOURCELIM_M_INET6_MASK)) { + yyerror("inet6 mask cannot be respecified"); + YYERROR; + } + + if ($3 < 1 || $3 > 128) { + yyerror("inet6 mask length out of range"); + YYERROR; + } + + sourcelim_opts.inet6_mask = $3; + + sourcelim_opts.marker |= SOURCELIM_M_INET6_MASK; + } + ; + +sourcelim_opt_below + : /* empty */ { + $$ = 0; + } + | BELOW NUMBER { + if ($2 < 1) { + yyerror("below limit is invalid"); + YYERROR; + } + $$ = $2; + } + ; + +sourcelim_filter_opt + : SOURCE LIMITER STRING limiter_opt_spec { + struct pfctl_sourcelim *srlim; + + srlim = pfctl_get_sourcelim_nm(pf, $3); + free($3); + if (srlim == NULL) { + yyerror("source limiter not found"); + YYERROR; + } + + $$.id = srlim->ioc.id; + $$.limiter_action = $4; + } + | SOURCE LIMITER sourcelim_id limiter_opt_spec { + $$.id = $3; + $$.limiter_action = $4; + } + ; + +limiter_opt_spec: /* empty */ { $$ = PF_LIMITER_NOMATCH; } + | '(' limiter_opt ')' { $$ = $2; } + ; + +limiter_opt: BLOCK { + $$ = PF_LIMITER_BLOCK; + } + | NOMATCH { + $$ = PF_LIMITER_NOMATCH; + } + ; + pfrule : action dir logquick interface route af proto fromto filter_opts { @@ -2562,6 +3039,7 @@ } r.timeout[o->data.timeout.number] = o->data.timeout.seconds; + break; } o = o->next; if (!defaults) @@ -2713,12 +3191,20 @@ filter_opts : { bzero(&filter_opts, sizeof filter_opts); + filter_opts.statelim.id = PF_STATELIM_ID_NONE; + filter_opts.statelim.limiter_action = PF_LIMITER_NOMATCH; + filter_opts.sourcelim.id = PF_SOURCELIM_ID_NONE; + filter_opts.sourcelim.limiter_action = PF_LIMITER_NOMATCH; filter_opts.rtableid = -1; } filter_opts_l { $$ = filter_opts; } | /* empty */ { bzero(&filter_opts, sizeof filter_opts); + filter_opts.statelim.id = PF_STATELIM_ID_NONE; + filter_opts.statelim.limiter_action = PF_LIMITER_NOMATCH; + filter_opts.sourcelim.id = PF_SOURCELIM_ID_NONE; + filter_opts.sourcelim.limiter_action = PF_LIMITER_NOMATCH; filter_opts.rtableid = -1; $$ = filter_opts; } @@ -2862,6 +3348,20 @@ if (filter_opts.prob == 0) filter_opts.prob = 1; } + | statelim_filter_opt { + if (filter_opts.statelim.id != PF_STATELIM_ID_NONE) { + yyerror("state limiter already specified"); + YYERROR; + } + filter_opts.statelim = $1; + } + | sourcelim_filter_opt { + if (filter_opts.sourcelim.id != PF_SOURCELIM_ID_NONE) { + yyerror("source limiter already specified"); + YYERROR; + } + filter_opts.sourcelim = $1; + } | RTABLE NUMBER { if ($2 < 0 || $2 > rt_tableid_max()) { yyerror("invalid rtable id"); @@ -6615,6 +7115,7 @@ { /* this has to be sorted always */ static const struct keywords keywords[] = { + { "above", ABOVE}, { "af-to", AFTO}, { "all", ALL}, { "allow-opts", ALLOWOPTS}, @@ -6624,6 +7125,7 @@ { "antispoof", ANTISPOOF}, { "any", ANY}, { "bandwidth", BANDWIDTH}, + { "below", BELOW}, { "binat", BINAT}, { "binat-anchor", BINATANCHOR}, { "binat-to", BINATTO}, @@ -6643,6 +7145,7 @@ { "drop", DROP}, { "dup-to", DUPTO}, { "endpoint-independent", ENDPI}, + { "entries", ENTRIES}, { "ether", ETHER}, { "fail-policy", FAILPOLICY}, { "fairq", FAIRQ}, @@ -6662,6 +7165,7 @@ { "hostid", HOSTID}, { "icmp-type", ICMPTYPE}, { "icmp6-type", ICMP6TYPE}, + { "id", ID}, { "if-bound", IFBOUND}, { "in", IN}, { "include", INCLUDE}, @@ -6673,11 +7177,13 @@ { "l3", L3}, { "label", LABEL}, { "limit", LIMIT}, + { "limiter", LIMITER}, { "linkshare", LINKSHARE}, { "load", LOAD}, { "log", LOG}, { "loginterface", LOGINTERFACE}, { "map-e-portset", MAPEPORTSET}, + { "mask", MASK}, { "match", MATCH}, { "matches", MATCHES}, { "max", MAXIMUM}, @@ -6695,6 +7201,7 @@ { "nat-to", NATTO}, { "no", NO}, { "no-df", NODF}, + { "no-match", NOMATCH}, { "no-route", NOROUTE}, { "no-sync", NOSYNC}, { "on", ON}, @@ -6717,6 +7224,7 @@ { "quick", QUICK}, { "random", RANDOM}, { "random-id", RANDOMID}, + { "rate", RATE}, { "rdr", RDR}, { "rdr-anchor", RDRANCHOR}, { "rdr-to", RDRTO}, @@ -6741,6 +7249,7 @@ { "set-tos", SETTOS}, { "skip", SKIP}, { "sloppy", SLOPPY}, + { "source", SOURCE}, { "source-hash", SOURCEHASH}, { "source-track", SOURCETRACK}, { "state", STATE}, @@ -6890,7 +7399,7 @@ top: p = buf; - while ((c = lgetc(0)) == ' ' || c == '\t') + while ((c = lgetc(0)) == ' ' || c == '\t' || c == '\014') ; /* nothing */ yylval.lineno = file->lineno; @@ -7720,10 +8229,23 @@ r->rule_flag |= PFRULE_ONCE; } + if (opts->statelim.id != PF_STATELIM_ID_NONE && r->action != PF_PASS) { + yyerror("state limiter only applies to pass rules"); + return (1); + } + if (opts->sourcelim.id != PF_SOURCELIM_ID_NONE && r->action != PF_PASS) { + yyerror("source limiter only applies to pass rules"); + return (1); + } + r->keep_state = opts->keep.action; r->pktrate.limit = opts->pktrate.limit; r->pktrate.seconds = opts->pktrate.seconds; r->prob = opts->prob; + r->statelim.id = opts->statelim.id; + r->statelim.limiter_action = opts->statelim.limiter_action; + r->sourcelim.id = opts->sourcelim.id; + r->sourcelim.limiter_action = opts->sourcelim.limiter_action; r->rtableid = opts->rtableid; r->ridentifier = opts->ridentifier; r->max_pkt_size = opts->max_pkt_size; diff --git a/sbin/pfctl/pfctl.8 b/sbin/pfctl/pfctl.8 --- a/sbin/pfctl/pfctl.8 +++ b/sbin/pfctl/pfctl.8 @@ -24,7 +24,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd August 28, 2025 +.Dd December 30, 2025 .Dt PFCTL 8 .Os .Sh NAME @@ -43,7 +43,7 @@ .Op Fl K Ar host | network .Xo .Oo Fl k -.Ar host | network | label | id | gateway | nat +.Ar host | network | label | id | gateway | source | nat .Oc Xc .Op Fl o Ar level .Op Fl p Ar device @@ -281,7 +281,7 @@ entries from the first host/network to the second. .It Xo .Fl k -.Ar host | network | label | id | key | gateway | nat +.Ar host | network | label | id | key | gateway | source | nat .Xc Kill all of the state entries matching the specified .Ar host , @@ -290,6 +290,7 @@ .Ar id , .Ar key , .Ar gateway, +.Ar source , or .Ar nat. .Pp @@ -374,6 +375,10 @@ .Pp .Dl # pfctl -k nat -k 192.168.0.1 .Pp +To remove a source from a source limiter use: +.Pp +.Dl # pfctl -I 1 -k source -k 192.0.2.2 +.Pp .It Fl M Kill matching states in the opposite direction (on other interfaces) when killing states. @@ -524,6 +529,26 @@ interface statistics are also shown. .Fl i can be used to select an interface or a group of interfaces. +.It Cm LimiterStates +Show information about state limiters. +If +.Fl R Ar id +is specified as well, +only the state limiter identified by +.Ar id +is shown. +.It Cm LimiterSrcs +Show information about source limiters. +If +.Fl R Ar id +is specified as well, +only the state limiter identified by +.Ar id +is shown. +If +.Fl v +is specified, +the address entries for the source pools are shown too. .It Cm all Show all of the above, except for the lists of interfaces and operating system fingerprints. diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -60,11 +60,14 @@ #include #include #include +#include #include #include "pfctl_parser.h" #include "pfctl.h" +struct pfctl_opt_id; + void usage(void); int pfctl_enable(int, int); int pfctl_disable(int, int); @@ -87,6 +90,7 @@ void pfctl_label_kill_states(int, const char *, int); void pfctl_id_kill_states(int, const char *, int); void pfctl_key_kill_states(int, const char *, int); +void pfctl_kill_source(int, const char *, const char *, int); int pfctl_parse_host(char *, struct pf_rule_addr *); void pfctl_init_options(struct pfctl *); int pfctl_load_options(struct pfctl *); @@ -101,6 +105,8 @@ const char *, int); void pfctl_print_eth_rule_counters(struct pfctl_eth_rule *, int); void pfctl_print_rule_counters(struct pfctl_rule *, int); +int pfctl_show_statelims(int, enum pfctl_show, int); +int pfctl_show_sourcelims(int, enum pfctl_show, int, const char *); int pfctl_show_eth_rules(int, char *, int, enum pfctl_show, char *, int, int); int pfctl_show_rules(int, char *, int, enum pfctl_show, char *, int, int); int pfctl_show_nat(int, const char *, int, char *, int, int); @@ -117,6 +123,10 @@ int pfctl_show_anchors(int, int, char *); int pfctl_show_eth_anchors(int, int, char *); int pfctl_ruleset_trans(struct pfctl *, char *, struct pfctl_anchor *, bool); +void pfctl_load_statelims(struct pfctl *); +void pfctl_load_statelim(struct pfctl *, struct pfctl_statelim *); +void pfctl_load_sourcelims(struct pfctl *); +void pfctl_load_sourcelim(struct pfctl *, struct pfctl_source_lim *); int pfctl_eth_ruleset_trans(struct pfctl *, char *, struct pfctl_eth_anchor *); int pfctl_load_eth_ruleset(struct pfctl *, char *, @@ -127,6 +137,7 @@ struct pfctl_ruleset *, int, int); int pfctl_load_rule(struct pfctl *, char *, struct pfctl_rule *, int); const char *pfctl_lookup_option(char *, const char * const *); +int pfctl_lookup_id(const char *, const struct pfctl_opt_id *); void pfctl_reset(int, int); int pfctl_walk_show(int, struct pfioc_ruleset *, void *); int pfctl_walk_get(int, struct pfioc_ruleset *, void *); @@ -141,6 +152,38 @@ int pfctl_call_clearanchors(int, int, struct pfr_anchoritem *); int pfctl_call_showtables(int, int, struct pfr_anchoritem *); +RB_PROTOTYPE(pfctl_statelim_ids, pfctl_statelim, entry, + pfctl_statelim_id_cmp); +RB_PROTOTYPE(pfctl_statelim_nms, pfctl_statelim, entry, + pfctl_statelim_nm_cmp); +RB_PROTOTYPE(pfctl_sourcelim_ids, pfctl_sourcelim, entry, + pfctl_sourcelim_id_cmp); +RB_PROTOTYPE(pfctl_sourcelim_nms, pfctl_sourcelim, entry, + pfctl_sourcelim_nm_cmp); + +enum showopt_id { + SHOWOPT_NONE = 0, + SHOWOPT_ETHER, + SHOWOPT_NAT, + SHOWOPT_QUEUE, + SHOWOPT_RULES, + SHOWOPT_ANCHORS, + SHOWOPT_SOURCES, + SHOWOPT_STATES, + SHOWOPT_INFO, + SHOWOPT_IFACES, + SHOWOPT_LABELS, + SHOWOPT_TIMEOUTS, + SHOWOPT_MEMORY, + SHOWOPT_TABLES, + SHOWOPT_OSFP, + SHOWOPT_RUNNING, + SHOWOPT_STATELIMS, + SHOWOPT_SOURCELIMS, + SHOWOPT_CREATORIDS, + SHOWOPT_ALL, +}; + static struct pfctl_anchor_global pf_anchors; struct pfctl_anchor pf_main_anchor; struct pfctl_eth_anchor pf_eth_main_anchor; @@ -148,7 +191,7 @@ static const char *clearopt; static char *rulesopt; -static const char *showopt; +static int showopt; static const char *debugopt; static char *anchoropt; static const char *optiopt = NULL; @@ -256,10 +299,33 @@ "ethernet", "Reset", NULL }; -static const char * const showopt_list[] = { - "ether", "nat", "queue", "rules", "Anchors", "Sources", "states", - "info", "Interfaces", "labels", "timeouts", "memory", "Tables", - "osfp", "Running", "all", "creatorids", NULL +struct pfctl_opt_id { + const char *name; + int id; +}; + +static const struct pfctl_opt_id showopt_list[] = { + { "ether", SHOWOPT_ETHER }, + { "nat", SHOWOPT_NAT }, + { "queue", SHOWOPT_QUEUE }, + { "rules", SHOWOPT_RULES }, + { "Anchors", SHOWOPT_ANCHORS }, + { "Sources", SHOWOPT_SOURCES }, + { "states", SHOWOPT_STATES }, + { "info", SHOWOPT_INFO }, + { "Interfaces", SHOWOPT_IFACES }, + { "labels", SHOWOPT_LABELS }, + { "timeouts", SHOWOPT_TIMEOUTS }, + { "memory", SHOWOPT_MEMORY }, + { "Tables", SHOWOPT_TABLES }, + { "osfp", SHOWOPT_OSFP }, + { "Running", SHOWOPT_RUNNING }, + { "LimiterStates", SHOWOPT_STATELIMS }, + { "LimiterSrcs", SHOWOPT_SOURCELIMS }, + { "creatorids", SHOWOPT_CREATORIDS }, + { "all", SHOWOPT_ALL }, + + { NULL, SHOWOPT_NONE }, }; static const char * const tblcmdopt_list[] = { @@ -1191,6 +1257,239 @@ printf("%s\n", title); } +int +pfctl_show_statelims(int dev, enum pfctl_show format, int opts) +{ + struct pfctl_state_lim stlim; + uint32_t id = PF_STATELIM_ID_MIN; + int error; + + if (opts & PF_OPT_SHOWALL) + pfctl_print_title("STATE LIMITERS:"); + + if (format == PFCTL_SHOW_LABELS) { + printf("%3s %8s/%-8s %5s/%-5s %8s %8s %8s\n", "ID", "USE", + "LIMIT", "RATE", "SECS", "ADMIT", "HARDLIM", "RATELIM"); + } + + for (;;) { + memset(&stlim, 0, sizeof(stlim)); + stlim.id = id; + + error = pfctl_state_limiter_nget(pfh, &stlim); + if (error != 0) { + if (error == ENOENT) { + /* we're done */ + return (0); + } + warnc(error, "DIOCGETNSTATELIM %u", stlim.id); + return (-1); + } + + switch (format) { + case PFCTL_SHOW_RULES: + print_statelim(&stlim); + break; + case PFCTL_SHOW_LABELS: + printf("%3u %8u/%-8u ", stlim.id, stlim.inuse, + stlim.limit); + if (stlim.rate.limit != 0) { + printf("%5u/%-5u ", stlim.rate.limit, + stlim.rate.seconds); + } else + printf("%5s/%-5s ", "nil", "nil"); + printf("%8ju %8ju %8ju\n", stlim.admitted, + stlim.hardlimited, stlim.ratelimited); + break; + default: + errx(1, "%s: unexpected format %d", __func__, format); + /* NOTREACHED */ + } + + id = stlim.id + 1; + } +} + +static inline int +pf_addr_inc(struct pf_addr *addr) +{ + int i; + uint32_t val, inc; + + for (i = 3; i >= 0; i--) { + val = ntohl(addr->addr32[i]); + inc = val + 1; + addr->addr32[i] = htonl(inc); + if (inc > val) + return (0); + } + + return (1); +} + +static int +pfctl_print_source(struct pfctl_source *e, void *arg) +{ + print_addr_str(e->af, &e->addr); + switch (e->af) { + case AF_INET: + printf("/%u ", e->inet_prefix); + break; + case AF_INET6: + printf("/%u ", e->inet6_prefix); + break; + default: + printf("/af? "); + break; + } + printf("rdomain %u ", e->rdomain); + + printf("inuse %u/%u ", e->inuse, e->limit); + printf("admit %ju hardlim %ju ratelim %ju\n", + e->admitted, e->hardlimited, e->ratelimited); + + return (0); +} + +static int +pfctl_show_sources(int dev, const struct pfctl_source_lim *srlim, + enum pfctl_show format, int opts) +{ + int error; + + if (format != PFCTL_SHOW_LABELS) + errx(1, "%s format is not PFCTL_SHOW_LABELS", __func__); + + error = pfctl_source_get(pfh, srlim->id, pfctl_print_source, NULL); + if (error != 0) + warnc(error, "DIOCGETNSOURCE %u", srlim->id); + return (error); +} + +int +pfctl_show_sourcelims(int dev, enum pfctl_show format, int opts, + const char *idopt) +{ + struct pfctl_source_lim srlim; + uint32_t id = PF_SOURCELIM_ID_MIN; + int error; + + if (idopt != NULL) { + const char *errstr; + + id = strtonum(idopt, PF_SOURCELIM_ID_MIN, PF_SOURCELIM_ID_MAX, + &errstr); + if (errstr != NULL) + errx(1, "source limiter id: %s", errstr); + } + + if (opts & PF_OPT_SHOWALL) + pfctl_print_title("SOURCE LIMITERS:"); + + if (format == PFCTL_SHOW_LABELS) { + printf("%3s %8s/%-8s %5s %5s/%-5s %8s %8s %8s %8s\n", "ID", + "USE", "ADDRS", "LIMIT", "RATE", "SECS", "ADMIT", "ADDRLIM", + "HARDLIM", "RATELIM"); + } + + for (;;) { + memset(&srlim, 0, sizeof(srlim)); + srlim.id = id; + + if (idopt != NULL) { + error = pfctl_source_limiter_get(pfh, &srlim); + } else { + error = pfctl_source_limiter_nget(pfh, &srlim); + } + + if (error != 0) { + if (error == ESRCH) { + /* we're done */ + return (0); + } + warnc(error, "DIOCGETNSOURCELIM %u", srlim.id); + return (-1); + } + + switch (format) { + case PFCTL_SHOW_RULES: + print_sourcelim(&srlim); + break; + + case PFCTL_SHOW_LABELS: + printf("%3u %8u/%-8u %5u ", srlim.id, srlim.nentries, + srlim.entries, srlim.limit); + if (srlim.rate.limit != 0) { + printf("%5u/%-5u ", srlim.rate.limit, + srlim.rate.seconds); + } else + printf("%5s/%-5s ", "nil", "nil"); + printf("%8ju %8ju %8ju %8ju\n", + srlim.admitted, srlim.addrlimited, srlim.hardlimited, + srlim.ratelimited); + + if (opts & PF_OPT_VERBOSE) + if (pfctl_show_sources(dev, &srlim, format, + opts) != 0) + return (-1); + break; + + default: + errx(1, "%s: unexpected format %d", __func__, format); + /* NOTREACHED */ + } + + id = srlim.id + 1; + } + + return (0); +} + +void +pfctl_kill_source(int dev, const char *idopt, const char *source, int opts) +{ + struct pfctl_source_clear clear = { 0 }; + unsigned int id; + const char *errstr; + struct addrinfo hints, *res; + int error; + + if (idopt == NULL) + errx(1, "source limiter id unspecified"); + if (source == NULL) + errx(1, "source limiter address unspecified"); + + id = strtonum(idopt, PF_SOURCELIM_ID_MIN, PF_SOURCELIM_ID_MAX, &errstr); + if (errstr != NULL) + errx(1, "source limiter id: %s", errstr); + + memset(&hints, 0, sizeof(hints)); + hints.ai_socktype = SOCK_DGRAM; /* dummy */ + hints.ai_flags = AI_NUMERICHOST; + + error = getaddrinfo(source, NULL, &hints, &res); + if (error != 0) + errx(1, "source limiter address: %s", gai_strerror(error)); + + clear.id = id; + clear.af = res->ai_family; + copy_satopfaddr(&clear.addr, res->ai_addr); + + freeaddrinfo(res); + + error = pfctl_source_clear(pfh, &clear); + switch (error) { + case 0: + break; + case ESRCH: + errx(1, "source limiter %u not found", id); + case ENOENT: + errx(1, "source limiter %u: %s not found", id, source); + default: + err(1, "kill source limiter %u entry %s", id, source); + } +} + int pfctl_show_eth_rules(int dev, char *path, int opts, enum pfctl_show format, char *anchorname, int depth, int wildcard) @@ -1977,6 +2276,78 @@ return (0); } +void +pfctl_load_statelim(struct pfctl *pf, struct pfctl_statelim *stlim) +{ + int error; + + if (pf->opts & PF_OPT_VERBOSE) + print_statelim(&stlim->ioc); + + if (pf->opts & PF_OPT_NOACTION) + return; + + error = pfctl_state_limiter_add(pf->h, &stlim->ioc); + if (error) { + errc(1, error, "DIOCADDSTATELIM %s id %u", stlim->ioc.name, + stlim->ioc.id); + } +} + +void +pfctl_load_statelims(struct pfctl *pf) +{ + struct pfctl_statelim *stlim; + u_int32_t ticket = 0; + + if ((pf->opts & PF_OPT_NOACTION) == 0) + ticket = pfctl_get_ticket(pf->trans, PF_RULESET_FILTER, ""); + + RB_FOREACH(stlim, pfctl_statelim_ids, &pf->statelim_ids) + { + stlim->ioc.ticket = ticket; + pfctl_load_statelim(pf, stlim); + } + + /* Don't free the statelims because we're about to exit anyway. */ +} + +void +pfctl_load_sourcelim(struct pfctl *pf, struct pfctl_source_lim *srlim) +{ + int error; + + if (pf->opts & PF_OPT_VERBOSE) + print_sourcelim(srlim); + + if (pf->opts & PF_OPT_NOACTION) + return; + + error = pfctl_source_limiter_add(pf->h, srlim); + if (error != 0) { + errc(1, error, "DIOCADDSOURCELIM %s id %u", srlim->name, + srlim->id); + } +} + +void +pfctl_load_sourcelims(struct pfctl *pf) +{ + struct pfctl_sourcelim *srlim; + uint32_t ticket = 0; + + if ((pf->opts & PF_OPT_NOACTION) == 0) + ticket = pfctl_get_ticket(pf->trans, PF_RULESET_FILTER, ""); + + RB_FOREACH(srlim, pfctl_sourcelim_ids, &pf->sourcelim_ids) + { + srlim->ioc.ticket = ticket; + pfctl_load_sourcelim(pf, &srlim->ioc); + } + + /* Don't free the sourcelims because we're about to exit anyway. */ +} + int pfctl_load_eth_ruleset(struct pfctl *pf, char *path, struct pfctl_eth_ruleset *rs, int depth) @@ -2332,6 +2703,11 @@ pf.optimize = optimize; pf.loadopt = loadopt; + RB_INIT(&pf.statelim_ids); + RB_INIT(&pf.statelim_nms); + RB_INIT(&pf.sourcelim_ids); + RB_INIT(&pf.sourcelim_nms); + /* non-brace anchor, create without resolving the path */ if ((pf.anchor = calloc(1, sizeof(*pf.anchor))) == NULL) ERRX("%s: calloc", __func__); @@ -2398,6 +2774,11 @@ if (loadopt & PFCTL_FLAG_OPTION) pfctl_adjust_skip_ifaces(&pf); + if (anchorname[0] == '\0' && pf.loadopt & PFCTL_FLAG_FILTER) { + pfctl_load_statelims(&pf); + pfctl_load_sourcelims(&pf); + } + if ((pf.loadopt & PFCTL_FLAG_FILTER && (pfctl_load_ruleset(&pf, path, rs, PF_RULESET_SCRUB, 0))) || (pf.loadopt & PFCTL_FLAG_ETH && @@ -3209,6 +3590,25 @@ return (NULL); } +int +pfctl_lookup_id(const char *cmd, const struct pfctl_opt_id *opt_ids) +{ + const struct pfctl_opt_id *opt_id; + int id = 0; + size_t cmdlen = strlen(cmd); + + for (opt_id = opt_ids; opt_id->id != 0; opt_id++) { + if (strncmp(cmd, opt_id->name, cmdlen) == 0) { + if (id != 0) + errx(1, "%s is ambiguous", cmd); + + id = opt_id->id; + } + } + + return (id); +} + void pfctl_reset(int dev, int opts) { @@ -3258,12 +3658,13 @@ int optimize = PF_OPTIMIZE_BASIC; char anchorname[MAXPATHLEN]; char *path; + const char *idopt = NULL; if (argc < 2) usage(); while ((ch = getopt(argc, argv, - "a:AdD:eqf:F:ghi:k:K:mMnNOo:Pp:rRs:St:T:vx:z")) != -1) { + "a:AdD:eqf:F:ghi:I:k:K:mMnNOo:Pp:rRs:St:T:vx:z")) != -1) { switch (ch) { case 'a': anchoropt = optarg; @@ -3295,6 +3696,9 @@ case 'i': ifaceopt = optarg; break; + case 'I': + idopt = optarg; + break; case 'k': if (state_killers >= 2) { warnx("can only specify -k twice"); @@ -3359,8 +3763,8 @@ opts |= PF_OPT_NUMERIC; break; case 's': - showopt = pfctl_lookup_option(optarg, showopt_list); - if (showopt == NULL) { + showopt = pfctl_lookup_id(optarg, showopt_list); + if (showopt == 0) { warnx("Unknown show modifier '%s'", optarg); usage(); } @@ -3433,7 +3837,7 @@ if (anchoropt[0] == '\0') errx(1, "anchor name must not be empty"); - if (mode == O_RDONLY && showopt == NULL && tblcmdopt == NULL) { + if (mode == O_RDONLY && showopt == 0 && tblcmdopt == NULL) { warnx("anchors apply to -f, -F, -s, and -T only"); usage(); } @@ -3467,7 +3871,8 @@ opts |= PF_OPT_DUMMYACTION; /* turn off options */ opts &= ~ (PF_OPT_DISABLE | PF_OPT_ENABLE); - clearopt = showopt = debugopt = NULL; + clearopt = debugopt = NULL; + showopt = 0; #if !defined(ENABLE_ALTQ) altqsupport = 0; #else @@ -3489,97 +3894,102 @@ if ((path = calloc(1, MAXPATHLEN)) == NULL) errx(1, "%s: calloc", __func__); - if (showopt != NULL) { - switch (*showopt) { - case 'A': - pfctl_show_anchors(dev, opts, anchorname); - if (opts & PF_OPT_VERBOSE2) - printf("Ethernet:\n"); - pfctl_show_eth_anchors(dev, opts, anchorname); - break; - case 'r': - pfctl_load_fingerprints(dev, opts); - pfctl_show_rules(dev, path, opts, PFCTL_SHOW_RULES, - anchorname, 0, 0); - break; - case 'l': - pfctl_load_fingerprints(dev, opts); - pfctl_show_rules(dev, path, opts, PFCTL_SHOW_LABELS, - anchorname, 0, 0); - break; - case 'n': - pfctl_load_fingerprints(dev, opts); - pfctl_show_nat(dev, path, opts, anchorname, 0, 0); - break; - case 'q': - pfctl_show_altq(dev, ifaceopt, opts, - opts & PF_OPT_VERBOSE2); - break; - case 's': - pfctl_show_states(dev, ifaceopt, opts); - break; - case 'S': - pfctl_show_src_nodes(dev, opts); - break; - case 'i': - pfctl_show_status(dev, opts); - break; - case 'R': - exit_val = pfctl_show_running(dev); - break; - case 't': - pfctl_show_timeouts(dev, opts); - break; - case 'm': - pfctl_show_limits(dev, opts); - break; - case 'e': - pfctl_show_eth_rules(dev, path, opts, 0, anchorname, 0, - 0); - break; - case 'a': - opts |= PF_OPT_SHOWALL; - pfctl_load_fingerprints(dev, opts); - - pfctl_show_eth_rules(dev, path, opts, 0, anchorname, 0, - 0); - - pfctl_show_nat(dev, path, opts, anchorname, 0, 0); - pfctl_show_rules(dev, path, opts, PFCTL_SHOW_RULES, - anchorname, 0, 0); - pfctl_show_altq(dev, ifaceopt, opts, 0); - pfctl_show_states(dev, ifaceopt, opts); - pfctl_show_src_nodes(dev, opts); - pfctl_show_status(dev, opts); - pfctl_show_rules(dev, path, opts, PFCTL_SHOW_LABELS, - anchorname, 0, 0); - pfctl_show_timeouts(dev, opts); - pfctl_show_limits(dev, opts); + switch (showopt) { + case SHOWOPT_NONE: + break; + case SHOWOPT_ANCHORS: + pfctl_show_anchors(dev, opts, anchorname); + if (opts & PF_OPT_VERBOSE2) + printf("Ethernet:\n"); + pfctl_show_eth_anchors(dev, opts, anchorname); + break; + case SHOWOPT_RULES: + pfctl_load_fingerprints(dev, opts); + pfctl_show_rules(dev, path, opts, PFCTL_SHOW_RULES, anchorname, + 0, 0); + break; + case SHOWOPT_LABELS: + pfctl_load_fingerprints(dev, opts); + pfctl_show_rules(dev, path, opts, PFCTL_SHOW_LABELS, anchorname, + 0, 0); + break; + case SHOWOPT_NAT: + pfctl_load_fingerprints(dev, opts); + pfctl_show_nat(dev, path, opts, anchorname, 0, 0); + break; + case SHOWOPT_QUEUE: + pfctl_show_altq(dev, ifaceopt, opts, opts & PF_OPT_VERBOSE2); + break; + case SHOWOPT_STATES: + pfctl_show_states(dev, ifaceopt, opts); + break; + case SHOWOPT_SOURCES: + pfctl_show_src_nodes(dev, opts); + break; + case SHOWOPT_INFO: + pfctl_show_status(dev, opts); + break; + case SHOWOPT_RUNNING: + exit_val = pfctl_show_running(dev); + break; + case SHOWOPT_TIMEOUTS: + pfctl_show_timeouts(dev, opts); + break; + case SHOWOPT_MEMORY: + pfctl_show_limits(dev, opts); + break; + case SHOWOPT_ETHER: + pfctl_show_eth_rules(dev, path, opts, 0, anchorname, 0, 0); + break; + case SHOWOPT_ALL: + opts |= PF_OPT_SHOWALL; + pfctl_load_fingerprints(dev, opts); + + pfctl_show_eth_rules(dev, path, opts, 0, anchorname, 0, 0); + + pfctl_show_nat(dev, path, opts, anchorname, 0, 0); + pfctl_show_rules(dev, path, opts, PFCTL_SHOW_RULES, anchorname, + 0, 0); + pfctl_show_altq(dev, ifaceopt, opts, 0); + pfctl_show_states(dev, ifaceopt, opts); + pfctl_show_src_nodes(dev, opts); + pfctl_show_status(dev, opts); + pfctl_show_rules(dev, path, opts, PFCTL_SHOW_LABELS, anchorname, + 0, 0); + pfctl_show_timeouts(dev, opts); + pfctl_show_limits(dev, opts); + pfctl_show_statelims(dev, PFCTL_SHOW_LABELS, opts); + pfctl_show_sourcelims(dev, PFCTL_SHOW_LABELS, opts, idopt); + pfctl_show_tables(anchorname, opts); + pfctl_show_fingerprints(opts); + break; + case SHOWOPT_TABLES: + if (opts & PF_OPT_RECURSE) { + opts |= PF_OPT_CALLSHOW; + pfctl_recurse(dev, opts, anchorname, + pfctl_call_showtables); + } else pfctl_show_tables(anchorname, opts); - pfctl_show_fingerprints(opts); - break; - case 'T': - if (opts & PF_OPT_RECURSE) { - opts |= PF_OPT_CALLSHOW; - pfctl_recurse(dev, opts, anchorname, - pfctl_call_showtables); - } else - pfctl_show_tables(anchorname, opts); - break; - case 'o': - pfctl_load_fingerprints(dev, opts); - pfctl_show_fingerprints(opts); - break; - case 'I': - pfctl_show_ifaces(ifaceopt, opts); - break; - case 'c': - pfctl_show_creators(opts); - break; - } + break; + case SHOWOPT_OSFP: + pfctl_load_fingerprints(dev, opts); + pfctl_show_fingerprints(opts); + break; + case SHOWOPT_IFACES: + pfctl_show_ifaces(ifaceopt, opts); + break; + case SHOWOPT_CREATORIDS: + pfctl_show_creators(opts); + break; + case SHOWOPT_STATELIMS: + pfctl_show_statelims(dev, PFCTL_SHOW_LABELS, opts); + break; + case SHOWOPT_SOURCELIMS: + pfctl_show_sourcelims(dev, PFCTL_SHOW_LABELS, opts, idopt); + break; } - if ((opts & PF_OPT_CLRRULECTRS) && showopt == NULL) { + if ((opts & PF_OPT_CLRRULECTRS) && showopt == 0) { pfctl_show_eth_rules(dev, path, opts, PFCTL_SHOW_NOTHING, anchorname, 0, 0); pfctl_show_rules(dev, path, opts, PFCTL_SHOW_NOTHING, @@ -3668,6 +4078,8 @@ pfctl_gateway_kill_states(dev, ifaceopt, opts); else if (!strcmp(state_kill[0], "key")) pfctl_key_kill_states(dev, ifaceopt, opts); + else if (!strcmp(state_kill[0], "source")) + pfctl_kill_source(dev, idopt, state_kill[1], opts); else pfctl_net_kill_states(dev, ifaceopt, opts); } @@ -3758,3 +4170,137 @@ return strerror(errnum); } } + +static inline int +pfctl_statelim_id_cmp(const struct pfctl_statelim *a, + const struct pfctl_statelim *b) +{ + uint32_t ida = a->ioc.id; + uint32_t idb = b->ioc.id; + + if (ida > idb) + return (1); + if (ida < idb) + return (-1); + + return (0); +} + +RB_GENERATE(pfctl_statelim_ids, pfctl_statelim, entry, pfctl_statelim_id_cmp); + +static inline int +pfctl_statelim_nm_cmp(const struct pfctl_statelim *a, + const struct pfctl_statelim *b) +{ + return (strcmp(a->ioc.name, b->ioc.name)); +} + +RB_GENERATE(pfctl_statelim_nms, pfctl_statelim, entry, pfctl_statelim_nm_cmp); + +int +pfctl_add_statelim(struct pfctl *pf, struct pfctl_statelim *stlim) +{ + struct pfctl_statelim *ostlim; + + ostlim = RB_INSERT(pfctl_statelim_ids, &pf->statelim_ids, stlim); + if (ostlim != NULL) + return (-1); + + ostlim = RB_INSERT(pfctl_statelim_nms, &pf->statelim_nms, stlim); + if (ostlim != NULL) { + RB_REMOVE(pfctl_statelim_ids, &pf->statelim_ids, stlim); + return (-1); + } + + return (0); +} + +struct pfctl_statelim * +pfctl_get_statelim_id(struct pfctl *pf, uint32_t id) +{ + struct pfctl_statelim key; + + key.ioc.id = id; + + return (RB_FIND(pfctl_statelim_nms, &pf->statelim_nms, &key)); +} + +struct pfctl_statelim * +pfctl_get_statelim_nm(struct pfctl *pf, const char *name) +{ + struct pfctl_statelim key; + + if (strlcpy(key.ioc.name, name, sizeof(key.ioc.name)) >= + sizeof(key.ioc.name)) + return (NULL); + + return (RB_FIND(pfctl_statelim_nms, &pf->statelim_nms, &key)); +} + +static inline int +pfctl_sourcelim_id_cmp(const struct pfctl_sourcelim *a, + const struct pfctl_sourcelim *b) +{ + uint32_t ida = a->ioc.id; + uint32_t idb = b->ioc.id; + + if (ida > idb) + return (1); + if (ida < idb) + return (-1); + + return (0); +} + +RB_GENERATE(pfctl_sourcelim_ids, pfctl_sourcelim, entry, + pfctl_sourcelim_id_cmp); + +static inline int +pfctl_sourcelim_nm_cmp(const struct pfctl_sourcelim *a, + const struct pfctl_sourcelim *b) +{ + return (strcmp(a->ioc.name, b->ioc.name)); +} + +RB_GENERATE(pfctl_sourcelim_nms, pfctl_sourcelim, entry, + pfctl_sourcelim_nm_cmp); + +int +pfctl_add_sourcelim(struct pfctl *pf, struct pfctl_sourcelim *srlim) +{ + struct pfctl_sourcelim *osrlim; + + osrlim = RB_INSERT(pfctl_sourcelim_ids, &pf->sourcelim_ids, srlim); + if (osrlim != NULL) + return (-1); + + osrlim = RB_INSERT(pfctl_sourcelim_nms, &pf->sourcelim_nms, srlim); + if (osrlim != NULL) { + RB_REMOVE(pfctl_sourcelim_ids, &pf->sourcelim_ids, srlim); + return (-1); + } + + return (0); +} + +struct pfctl_sourcelim * +pfctl_get_sourcelim_id(struct pfctl *pf, uint32_t id) +{ + struct pfctl_sourcelim key; + + key.ioc.id = id; + + return (RB_FIND(pfctl_sourcelim_nms, &pf->sourcelim_nms, &key)); +} + +struct pfctl_sourcelim * +pfctl_get_sourcelim_nm(struct pfctl *pf, const char *name) +{ + struct pfctl_sourcelim key; + + if (strlcpy(key.ioc.name, name, sizeof(key.ioc.name)) >= + sizeof(key.ioc.name)) + return (NULL); + + return (RB_FIND(pfctl_sourcelim_nms, &pf->sourcelim_nms, &key)); +} diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -75,6 +75,21 @@ struct pfr_buffer; /* forward definition */ +struct pfctl_statelim { + struct pfctl_state_lim ioc; + RB_ENTRY(pfctl_statelim) entry; +}; + +RB_HEAD(pfctl_statelim_ids, pfctl_statelim); +RB_HEAD(pfctl_statelim_nms, pfctl_statelim); + +struct pfctl_sourcelim { + struct pfctl_source_lim ioc; + RB_ENTRY(pfctl_sourcelim) entry; +}; + +RB_HEAD(pfctl_sourcelim_ids, pfctl_sourcelim); +RB_HEAD(pfctl_sourcelim_nms, pfctl_sourcelim); struct pfctl { int dev; @@ -99,6 +114,11 @@ u_int32_t eth_ticket; const char *ruleset; + struct pfctl_statelim_ids statelim_ids; + struct pfctl_statelim_nms statelim_nms; + struct pfctl_sourcelim_ids sourcelim_ids; + struct pfctl_sourcelim_nms sourcelim_nms; + /* 'set foo' options */ u_int32_t timeout[PFTM_MAX]; u_int32_t limit[PF_LIMIT_MAX]; @@ -296,6 +316,17 @@ void pfctl_move_pool(struct pfctl_pool *, struct pfctl_pool *); void pfctl_clear_pool(struct pfctl_pool *); +int pfctl_add_statelim(struct pfctl *, struct pfctl_statelim *); +struct pfctl_statelim * + pfctl_get_statelim_id(struct pfctl *, uint32_t); +struct pfctl_statelim * + pfctl_get_statelim_nm(struct pfctl *, const char *); +int pfctl_add_sourcelim(struct pfctl *, struct pfctl_sourcelim *); +struct pfctl_sourcelim * + pfctl_get_sourcelim_id(struct pfctl *, uint32_t); +struct pfctl_sourcelim * + pfctl_get_sourcelim_nm(struct pfctl *, const char *); + int pfctl_apply_timeout(struct pfctl *, const char *, int, int); int pfctl_set_reassembly(struct pfctl *, int, int); int pfctl_set_optimization(struct pfctl *, const char *); @@ -312,6 +343,8 @@ void print_pool(struct pfctl_pool *, u_int16_t, u_int16_t, int); void print_src_node(struct pfctl_src_node *, int); +void print_statelim(const struct pfctl_state_lim *); +void print_sourcelim(const struct pfctl_source_lim *); void print_eth_rule(struct pfctl_eth_rule *, const char *, int); void print_rule(struct pfctl_rule *, const char *, int, int); void print_tabledef(const char *, int, int, struct node_tinithead *); diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -855,6 +855,38 @@ r->dnpipe); } +void +print_statelim(const struct pfctl_state_lim *ioc) +{ + printf("state limiter %s id %u limit %u", ioc->name, ioc->id, + ioc->limit); + if (ioc->rate.limit != 0) + printf(" rate %u/%u", ioc->rate.limit, ioc->rate.seconds); + + printf("\n"); +} + +void +print_sourcelim(const struct pfctl_source_lim *ioc) +{ + printf("source limiter %s id %u entries %u limit %u", ioc->name, + ioc->id, ioc->entries, ioc->limit); + if (ioc->rate.limit != 0) + printf(" rate %u/%u", ioc->rate.limit, ioc->rate.seconds); + if (ioc->overload_tblname[0] != '\0') { + printf(" table <%s> above %u", ioc->overload_tblname, + ioc->overload_hwm); + if (ioc->overload_lwm) + printf(" below %u", ioc->overload_lwm); + } + if (ioc->inet_prefix < 32) + printf(" inet mask %u", ioc->inet_prefix); + if (ioc->inet6_prefix < 128) + printf(" inet6 mask %u", ioc->inet6_prefix); + + printf("\n"); +} + void print_rule(struct pfctl_rule *r, const char *anchor_call, int opts, int numeric) { @@ -1080,6 +1112,33 @@ } printf(" probability %s%%", buf); } + if (r->statelim.id != PF_STATELIM_ID_NONE) { +#if 0 /* XXX need pf to find statelims */ + struct pfctl_statelim *stlim = + pfctl_get_statelim_id(pf, r->statelim); + + if (stlim != NULL) + printf(" state limiter %s", stlim->ioc.name); + else +#endif + printf(" state limiter id %u (%s)", r->statelim.id, + (r->statelim.limiter_action == PF_LIMITER_BLOCK) ? + "block" : "no-match"); + } + if (r->sourcelim.id != PF_SOURCELIM_ID_NONE) { +#if 0 /* XXX need pf to find sourcelims */ + struct pfctl_sourcelim *srlim = + pfctl_get_sourcelim_id(pf, r->sourcelim); + + if (srlim != NULL) + printf(" source limiter %s", srlim->ioc.name); + else +#endif + printf(" source limiter id %u (%s)", r->sourcelim.id, + (r->sourcelim.limiter_action == PF_LIMITER_BLOCK) ? + "block" : "no-match"); + } + ropts = 0; if (r->max_states || r->max_src_nodes || r->max_src_states) ropts = 1; @@ -1543,11 +1602,18 @@ copy_satopfaddr(&n->addr.v.a.addr, ifa->ifa_addr); ifa->ifa_netmask->sa_family = ifa->ifa_addr->sa_family; copy_satopfaddr(&n->addr.v.a.mask, ifa->ifa_netmask); - if (ifa->ifa_broadaddr != NULL) { + if (ifa->ifa_flags & IFF_BROADCAST && + ifa->ifa_broadaddr != NULL && + ifa->ifa_broadaddr->sa_len != 0) { + ifa->ifa_broadaddr->sa_family = + ifa->ifa_addr->sa_family; ifa->ifa_broadaddr->sa_family = ifa->ifa_addr->sa_family; copy_satopfaddr(&n->bcast, ifa->ifa_broadaddr); - } - if (ifa->ifa_dstaddr != NULL) { + } else if (ifa->ifa_flags & IFF_POINTOPOINT && + ifa->ifa_dstaddr != NULL && + ifa->ifa_dstaddr->sa_len != 0) { + ifa->ifa_dstaddr->sa_family = + ifa->ifa_addr->sa_family; ifa->ifa_dstaddr->sa_family = ifa->ifa_addr->sa_family; copy_satopfaddr(&n->peer, ifa->ifa_dstaddr); } diff --git a/sbin/pfctl/tests/files/pf1076.in b/sbin/pfctl/tests/files/pf1076.in new file mode 100644 --- /dev/null +++ b/sbin/pfctl/tests/files/pf1076.in @@ -0,0 +1,2 @@ +state limiter "dns-server" id 1 limit 1000 rate 1/10 +pass in proto tcp to port domain state limiter "dns-server" diff --git a/sbin/pfctl/tests/files/pf1076.ok b/sbin/pfctl/tests/files/pf1076.ok new file mode 100644 --- /dev/null +++ b/sbin/pfctl/tests/files/pf1076.ok @@ -0,0 +1,2 @@ +state limiter dns-server id 1 limit 1000 rate 1/10 +pass in proto tcp from any to any port = domain flags S/SA keep state state limiter id 1 (no-match) diff --git a/sbin/pfctl/tests/files/pf1077.in b/sbin/pfctl/tests/files/pf1077.in new file mode 100644 --- /dev/null +++ b/sbin/pfctl/tests/files/pf1077.in @@ -0,0 +1,2 @@ +source limiter "dns-server" id 1 entries 2 limit 3 rate 4/5 inet mask 16 +pass in proto tcp to port domain source limiter "dns-server" diff --git a/sbin/pfctl/tests/files/pf1077.ok b/sbin/pfctl/tests/files/pf1077.ok new file mode 100644 --- /dev/null +++ b/sbin/pfctl/tests/files/pf1077.ok @@ -0,0 +1,2 @@ +source limiter dns-server id 1 entries 2 limit 3 rate 4/5 inet mask 16 +pass in proto tcp from any to any port = domain flags S/SA keep state source limiter id 1 (no-match) diff --git a/sbin/pfctl/tests/files/pf1078.in b/sbin/pfctl/tests/files/pf1078.in new file mode 100644 --- /dev/null +++ b/sbin/pfctl/tests/files/pf1078.in @@ -0,0 +1,3 @@ +pass in proto tcp + +pass in proto udp diff --git a/sbin/pfctl/tests/files/pf1078.ok b/sbin/pfctl/tests/files/pf1078.ok new file mode 100644 --- /dev/null +++ b/sbin/pfctl/tests/files/pf1078.ok @@ -0,0 +1,2 @@ +pass in proto tcp all flags S/SA keep state +pass in proto udp all keep state diff --git a/sbin/pfctl/tests/pfctl_test_list.inc b/sbin/pfctl/tests/pfctl_test_list.inc --- a/sbin/pfctl/tests/pfctl_test_list.inc +++ b/sbin/pfctl/tests/pfctl_test_list.inc @@ -184,3 +184,6 @@ PFCTL_TEST(1073, "Filter AF different than route-to AF, with prefer-ipv6-nexthop") PFCTL_TEST_FAIL(1074, "Filter AF different than route-to AF, without prefer-ipv6-nexthop") PFCTL_TEST(1075, "One shot rule") +PFCTL_TEST(1076, "State limiter") +PFCTL_TEST(1077, "Source limiter") +PFCTL_TEST(1078, "New page") diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -331,6 +331,7 @@ mac_test.4 \ malo.4 \ max44009.4 \ + ${_mca.4} \ md.4 \ mdio.4 \ me.4 \ @@ -884,6 +885,7 @@ _io.4= io.4 _itwd.4= itwd.4 _kvmclock.4= kvmclock.4 +_mca.4= mca.4 _mgb.4= mgb.4 _nda.4= nda.4 _nfe.4= nfe.4 diff --git a/share/man/man4/bge.4 b/share/man/man4/bge.4 --- a/share/man/man4/bge.4 +++ b/share/man/man4/bge.4 @@ -29,7 +29,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF .\" THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd August 18, 2017 +.Dd January 16, 2026 .Dt BGE 4 .Os .Sh NAME @@ -276,3 +276,11 @@ while the system is up as the kernel is currently unable to cope with a .Nm interface disappearing. +.Pp +The UDP transmit checksum offloading is disabled by default, see +.Va dev.bge.%d.forced_udpcsum . +To avoid problems when the interface is a member of a +.Xr bridge 4 +interface, all transmit checksum offloading is initially disabled in this case. +Transmit checksum offloading can be enabled using +.Xr ifconfig 8 . diff --git a/share/man/man4/genetlink.4 b/share/man/man4/genetlink.4 --- a/share/man/man4/genetlink.4 +++ b/share/man/man4/genetlink.4 @@ -131,6 +131,7 @@ "notify" Notifies on family registrations/removal. .Ed .Sh SEE ALSO +.Xr snl 3 , .Xr netlink 4 .Sh HISTORY The diff --git a/share/man/man4/mac.4 b/share/man/man4/mac.4 --- a/share/man/man4/mac.4 +++ b/share/man/man4/mac.4 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 30, 2024 +.Dd January 15, 2026 .Dt MAC 4 .Os .Sh NAME @@ -115,6 +115,8 @@ .Bl -ohang .It Sy "File System" File system mounts, modifying directories, modifying files, etc. +.It Sy Jails +Creating, modifying, removing, and attaching to jails .It Sy KLD Loading, unloading, and retrieving statistics on loaded kernel modules .It Sy Network @@ -163,6 +165,7 @@ .Bl -column "user (by login class)" "Xr setfmac 8 , Xr setfsmac 8" -offset indent .It Sy "Subject/Object" Ta Sy "Utility" .It "File system object" Ta Xr setfmac 8 , Xr setfsmac 8 +.It Jail Ta Xr jail 8 .It "Network interface" Ta Xr ifconfig 8 .It "TTY (by login class)" Ta Xr login.conf 5 .It "User (by login class)" Ta Xr login.conf 5 @@ -219,6 +222,7 @@ .Xr mac_test 4 , .Xr login.conf 5 , .Xr maclabel 7 , +.Xr jail 8 , .Xr getfmac 8 , .Xr getpmac 8 , .Xr setfmac 8 , diff --git a/share/man/man4/mca.4 b/share/man/man4/mca.4 new file mode 100644 --- /dev/null +++ b/share/man/man4/mca.4 @@ -0,0 +1,277 @@ +.\" +.\" Copyright (c) 2026 The FreeBSD Project +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.Dd January 14, 2026 +.Dt MCA 4 amd64 +.Os +.Sh NAME +.Nm mca +.Nd Machine Check Architecture +.Sh DESCRIPTION +The +.Nm +subsystem provides support for the x86 Machine Check Architecture. +The CPU uses this architecture to report various hardware problems, +ranging from correctible errors to uncorrectible fatal errors. +The +.Nm +subsystem processes the errors reported by the CPU and logs them +according to the user-supplied configuration. +.Pp +The +.Nm +subsystem is automatically compiled into every x86 kernel. +.Sh LOGGING +By default, every message is logged to four locations: +.Bl -bullet +.It +The console +.It +The system log (using the +.Dv LOG_KERN +.Xr syslog 3 +facility) +.It +An in-kernel cache of event records +.It +A statistics array +.El +.Pp +An administrator can disable console logging of non-fatal errors using the +.Va hw.mca.uselog +.Xr sysctl 8 +or tunable setting. +Fatal errors are always logged to the console. +.Pp +The in-kernel cache of event records can be accessed from userspace using the +.Va hw.mca.records +.Xr sysctl 8 +node. +By default, the in-kernel cache of event records grows without bound and +contains records for all +.Nm +events received since system boot. +The cache can be limited (in which case it turns into a ring buffer) or +disabled altogether using the +.Va hw.mca.maxcount +.Xr sysctl 8 +or tunable setting. +.Pp +The statistics array can be retrieved using the +.Va hw.mca.stats +.Xr sysctl 8 +node. +.Sh SYSCTL VARIABLES +The subsystem has a number of configuration options to control the +way events are processed and logged. +These options are configured via +.Xr sysctl 8 +variables or tunables. +These settings control things such as log destination, event limiting, +and sampling. +These settings directly impact both the completeness of logs and the performance +impact of processing +.Nm +events. +A system administrator may want to review these and modify them to obtain +the appropriate behavior in their environment. +.Bl -tag -width indent +.It Va hw.mca.enabled +(Only settable as a tunable.) +.Pp +If set to 0, the CPU is not configured to send +.Nm +messages to the kernel. +.Pp +Default is 1 (enabled). +.It Va hw.mca.log_corrected +(Settable as a tunable or sysctl.) +.Pp +If enabled, corrected messages are logged to console, syslog, the in-kernel +event cache, and the statistics array (subject to separate configuration +controlling those facilities). +If disabled, corrected messages are only logged to the in-kernel event +cache (subject to separate configuration controlling that facility). +.Pp +Default is 1 (enabled). +.It Va hw.mca.intel6h_HSD131 +(Only settable as a tunable.) +.Pp +This setting enables a workaround for benign corrected parity errors which +may be reported by certain Intel desktop Haswell CPUs. +(The name "HSD131" comes from the name of the Intel erratum report about this +issue.) +.Pp +Default is 0 (disabled). +.It Va hw.mca.amd10h_L1TP +(Only settable as a tunable.) +.Pp +Enable logging of level one TLB parity errors on certain AMD CPUs. +This option has no impact on other CPUs. +.Pp +Default is 1 (enabled). +.It Va hw.mca.erratum383 +(Only settable as a tunable.) +.Pp +This setting enables a workaround for Erratum 383 on AMD Family 10h CPUs. +The erratum changes the way pages are promoted to or demoted from being +super-pages. +On affected AMD CPUs, either +.Va hw.mca.amd10h_L1TP +or +.Va hw.mca.erratum383 +must be on. +If both are off, the system will dynamically enable +.Va hw.mca.erratum383 +at boot time. +.Pp +Default is 0 (disabled). +.It Va hw.mca.uselog +(Settable as a tunable or sysctl.) +.Pp +If enabled, the system will send messages about non-fatal +.Nm +events to syslog and not to the console. +If disabled, the system will send messages about non-fatal +.Nm +events to both syslog and the console. +Fatal events are always logged to the console. +.Pp +Default is false (disabled). +.It Va hw.mca.stats +(Read-only sysctl.) +.Pp +This returns an array of +.Va MCA_T_COUNT +uint64_t values. +The +.Vt "enum mca_stat_types" +definition in +.In x86/mca.h +provides the value of +.Va MCA_T_COUNT +and the index values for various event types. +.It Va hw.mca.log_interval +(Settable as a tunable or sysctl.) +.Pp +This sets the minimum time (in seconds) between logging correctible errors. +The rate limit is only applied after the system records a reasonable +number of errors of the same type. +The goal is to reduce the impact of the system seeing and attempting to log +a burst of similar errors, which can be expensive (especially when printed +to the console). +If this setting is 0, no rate limit is applied. +.Pp +Default is 0 (no rate limit). +.It Va hw.mca.cmc_throttle +(Settable as a tunable or sysctl. Only available if +.Xr apic 4 +support is enabled and the hardware supports CMC interrupt throttling.) +.Pp +This sets the maximum time (in seconds) to throttle CMC interrupts. +In normal operation, the system attempts to receive CMC interrupts as soon as +an event occurs. +However, if a high rate of events occurs in a short time, the system will +begin throttling the CMC interrupts. +While the events continue to occur at a high rate, the system will gradually +increase the throttling interval until it reaches the +.Va hw.mca.cmc_throttle +setting. +.Pp +Default is 60 seconds. +.It Va hw.mca.count +(Read-only sysctl.) +.Pp +This returns the current number of +.Nm +records in the in-kernel cache. +This can be used to determine how many records are available to read with the +.Va hw.mca.records +.Xr sysctl 8 +interface. +It can also be used to monitor the amount of memory used by the in-kernel +record cache. +.It Va hw.mca.maxcount +(Settable as a tunable or sysctl.) +.Pp +This setting controls the size and behavior of the in-kernel cache of +.Nm +records. +If the setting is -1, the in-kernel cache grows without bounds and contains a +complete record events since boot or the last time the +.Va hw.mca.maxcount +setting was changed. +If the setting is 0, the in-kernel cache is disabled. +If the setting is a positive integer, the in-kernel cache functions as a ring +buffer with the number of entries defined by the setting. +.Pp +Default is -1 (unlimited). +.It Va hw.mca.interval +(Settable as a tunable or sysctl.) +.Pp +This setting controls how often (in seconds) the kernel should proactively +scan for new +.Nm +events. +In many circumstances, the CPU will send an interrupt to signal new events. +However, there are cases where the periodic scan for events will discover +new events. +.Pp +Default is 300 seconds. +.It Va hw.mca.force_scan +(Settable only as a sysctl.) +.Pp +Setting this to any non-zero value will force an immediate scan for +.Nm +events. +Setting this to zero has no effect. +This is functionally a write-only setting. +The current value is always 0, even when a scan is running. +.Pp +Default is 0 (no scan requested). +.It Va hw.mca.records.n +(Read-only sysctl.) +.Pp +This is used to copy +.Nm +records from the in-kernel cache to a user space process. +The +.Va n +value in the +.Xr sysctl 8 +node is an integer index into the in-kernel cache. +(Or, put differently, the "new" value describes how many records the kernel +should skip to find the desired record.) +The return value is a +.Vt "struct mca_record" , +which is defined in +.In x86/mca.h . +.El +.Sh LOADER TUNABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel or stored in +.Pa /boot/loader.conf . +The tunables all have corresponding +.Xr sysctl 8 +entries. +The tunables are listed above in the +.Sx SYSCTL VARIABLES +section. +.Sh COMPATIBILITY +.Nm +is only available on x86 systems. +.Sh SEE ALSO +.Xr loader.conf 5 , +.Xr sysctl 8 , +.Xr syslogd 8 +.Sh AUTHORS +The +.Nm +subsystem was originally written by +.An John Baldwin Aq Mt jhb@FreeBSD.org . +.Pp +This manual page was written by +.An Jonathan Looney Aq Mt jtl@FreeBSD.org . diff --git a/share/man/man4/netlink.4 b/share/man/man4/netlink.4 --- a/share/man/man4/netlink.4 +++ b/share/man/man4/netlink.4 @@ -336,6 +336,7 @@ . .El .Sh SEE ALSO +.Xr snl 3 , .Xr genetlink 4 , .Xr rtnetlink 4 .Rs diff --git a/share/man/man4/rtnetlink.4 b/share/man/man4/rtnetlink.4 --- a/share/man/man4/rtnetlink.4 +++ b/share/man/man4/rtnetlink.4 @@ -129,7 +129,8 @@ .It Dv RTA_METRICS (nested) Container attribute, listing route properties. The only supported sub-attribute is -.Dv RTAX_MTU , which stores path MTU as uint32_t. +.Dv RTAX_MTU , +which stores path MTU as uint32_t. .It Dv RTA_MULTIPATH This attribute contains multipath route nexthops with their weights. These nexthops are represented as a sequence of @@ -293,7 +294,8 @@ Deletes the interface specified by .Dv IFLA_IFNAME . .Ss RTM_GETLINK -Fetches a single interface or all interfaces in the current VNET, depending on the +Fetches a single interface or all interfaces in the current VNET, +depending on the .Dv NLM_F_DUMP flag. Each interface is reported as a @@ -524,6 +526,7 @@ RTNLGRP_NEIGH Notifies on ARP/NDP neighbor arrival/removal/change .Ed .Sh SEE ALSO +.Xr snl 3 , .Xr netlink 4 , .Xr route 4 .Sh HISTORY diff --git a/share/man/man4/termios.4 b/share/man/man4/termios.4 --- a/share/man/man4/termios.4 +++ b/share/man/man4/termios.4 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd June 28, 2020 +.Dd January 14, 2026 .Dt TERMIOS 4 .Os .Sh NAME @@ -759,7 +759,9 @@ the percentage of cpu the process is getting, and the resident set size of the process. .Pp -In case the +In case the kernel has +.Xr stack 9 +support configured and the .Xr sysctl 8 variable .Va kern.tty_info_kstacks diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -27,7 +27,7 @@ .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd November 3, 2025 +.Dd January 12, 2026 .Dt PF.CONF 5 .Os .Sh NAME @@ -2365,6 +2365,32 @@ .Bd -literal -offset indent block in proto icmp probability 20% .Ed +.It Cm state limiter Ar name Oo Cm (limiter options) Oc +Use the specified state limiter to restrict the creation of states +by this rule. +By default if capacity is not available, the rule is ignored +and ruleset evaluation continues with next rule.. +Use +.Ic block +option to change default behavior such packet is blocked +when limit is reached. +See the +.Sx State Limiters +section for more information. +.Pp +.It Cm source limiter Ar name Oo Cm (limiter options) Oc +Use the specified source limiter to restrict the creation of states +by this rule. +By default if capacity is not available, the rule is ignored +and ruleset evaluation continues with next rule.. +Use +.Ic block +option to change default behavior such packet is blocked +when limit is reached. +See the +.Sx Source Limiters +section for more information. +.Pp .It Ar prio Aq Ar number Only match packets which have the given queueing priority assigned. .El @@ -2609,6 +2635,145 @@ .Bd -literal -offset indent pass in proto tcp from any to any port www synproxy state .Ed +.Ss State Limiters +State limiters provide a mechanism to limit the number of states created, +or the rate of state creation, +by a set of rules. +State limiters are configured and loaded with the main ruleset, but +can be used by rules in any anchor. +The overall number of states is still subject to the limit set with +.Cm set limit states , +but the number of states created by a subset of rules can be provided +by a state limiter. +.Pp +A state limiter is configured with the following statement: +.Pp +.Bl -tag -width xxxx -compact +.It Cm state limiter Ar name +Each state limiter is identified by a unique name. +.El +.Pp +State limiters support the following configuration: +.Pp +.Bl -tag -width xxxx -compact +.It Cm id Ar number +A unique identifier between 1 and 255. +This configuration is required. +.It Cm limit Ar number +Specify the maximum number of states. +This configuration is required. +.It Cm rate Ar number Ns / Ns Ar seconds +Limit the rate at which states can be created over a time interval. +The connection rate is an approximation calculated as a moving +average. +.El +.Pp +Pass rules can specify a state limiter using the +.Cm state limiter Ar name +option. +If the number of states allowed has hit the limit, the pass rule +does not match and ruleset evaluation continues past it. +.Pp +An example use case for a state limiter is to restrict the number of +connections allowed to a service that is accessible via multiple +protocols, e.g. a DNS server that can be accessed by both TCP and +UDP on port 53, DNS-over-TLS on TCP port 853, and DNS-over-HTTPS +on TCP port 443 can be limited to 1000 concurrent connections: +.Pp +.Bd -literal -offset indent -compact +state limiter "dns-server" id 1 limit 1000 + +pass in proto { tcp udp } to port domain state limiter "dns-server" +pass in proto tcp to port { 853 443 } state limiter "dns-server" +.Ed +.Ss Source Limiters +Source limiters apply limits on the number of states, +or the rate of state creation, +for connections coming from a source address or network for a set +of rules. +Source limiters are configured and loaded with the main ruleset, but +can be used by rules in any anchor. +The overall number of states is still subject to the limit set with +.Cm set limit states , +but limits on states for a subset of source addresses and rules can +be provided with source limiters. +.Pp +Source address entries in source pools are created on demand, +and are used to account for the states created for each source +address or network. +A source limiter specifies the maximum number of source address +entries it will track, and can be configured to mask bits in network +prefixes to have source entries cover larger portions of the address +space if needed. +.Pp +A source limiter is configured with the following statement: +.Pp +.Bl -tag -width xxxx -compact +.It Cm source limiter Ar name +Each source limiter is uniquely identified by the specified name. +.El +.Pp +Source limiter support the following configuration: +.Pp +.Bl -tag -width xxxx -compact +.It Cm id Ar number +A unique identifier between 1 and 255. +This configuration is required. +.It Cm entries Ar number +Specify the maximum number of source address entries. +This configuration is required. +.It Cm limit Ar number +Specify the maximum number of states for each source address entry. +This configuration is required. +.It Cm rate Ar number Ns / Ns Ar seconds +Limit the rate at which states can be created by each source address +entry over a time interval. +The connection rate is an approximation calculated as a moving +average. +.It Cm inet mask Ar prefixlen +Mask IPv4 source addresses using the prefix length specified with +.Ar prefixlen +when creating an address entry. +The default IPv4 prefix length is 32 bits. +.It Cm inet6 mask Ar prefixlen +Mask IPv6 source addresses using the prefix length specified with +.Ar prefixlen +when creating an address entry. +The default IPv6 prefix length is 128 bits. +.It Cm table < Ns Ar table Ns > Cm above Ar hwm Op Cm below Ar lwm +Add the address to the specified +.Ar table +when the number of states goes above the +.Ar hwm +high water mark. +The address will be removed from the table when the number of states +drops below the +.Ar lwm +low water mark. +The default low water mark is 0. +.El +.Pp +Pass rules can specify a source limiter using the +.Cm source limiter Ar name +option. +.Pp +An example use for a source limiter is the mitigation of denial of +service caused by the exhaustion of firewall resources by network +or port scans from outside the network. +The states created by any one scanner from any one source address +can be limited to avoid impacting other sources. +Below, up to 10000 IPv4 hosts and IPv6 /64 networks from the external +network are each limited to a maximum of 1000 connections, and are +rate limited to creating 100 states over a 10 second interval: +.Pp +.Bd -literal -offset indent -compact +source limiter "internet" id 1 entries 10000 \e + limit 1000 rate 100/10 \e + inet6 mask 64 + +block in on egress +pass in on egress source limiter "internet" +.Ed .Sh STATEFUL TRACKING OPTIONS A number of options related to stateful tracking can be applied on a per-rule basis. @@ -3457,6 +3622,10 @@ "max-pkt-size" number | "queue" ( string | "(" string [ [ "," ] string ] ")" ) | "rtable" number | "probability" number"%" | "prio" number | + "state limiter" name | + "state limiter" name "(" limiter-opts ")" | + "source limiter" name | + "source limiter" name "(" limiter-opts ")" | "prio" number | "dnpipe" ( number | "(" number "," number ")" ) | "dnqueue" ( number | "(" number "," number ")" ) | "ridentifier" number | @@ -3636,6 +3805,7 @@ upperlimit-sc = "upperlimit" sc-spec sc-spec = ( bandwidth-spec | "(" bandwidth-spec number bandwidth-spec ")" ) +limiter-opts = "block" | "no-match" include = "include" filename .Ed .Sh FILES diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,5 +1,5 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. -.Dd December 29, 2025 +.Dd January 16, 2026 .Dt SRC.CONF 5 .Os .Sh NAME @@ -530,6 +530,12 @@ similar to DWARF and the venerable stabs and is required for DTrace. .It Va WITHOUT_CUSE Do not build CUSE-related programs and libraries. +When set, it enforces these options: +.Pp +.Bl -item -compact +.It +.Va WITHOUT_SOUND +.El .It Va WITHOUT_CXGBETOOL Do not build .Xr cxgbetool 8 @@ -755,10 +761,6 @@ Also disables all format checking. .It Va WITHOUT_FORTH Build bootloaders without Forth support. -.It Va WITHOUT_FP_LIBC -Build -.Nm libc -without floating-point support. .It Va WITHOUT_FREEBSD_UPDATE Do not build .Xr freebsd-update 8 . diff --git a/share/man/man7/tuning.7 b/share/man/man7/tuning.7 --- a/share/man/man7/tuning.7 +++ b/share/man/man7/tuning.7 @@ -222,6 +222,21 @@ .Va vm.stats.vm.v_wire_count sysctls, respectively). .Pp +Due to the architecture of the +.Fx +virtual memory subsystem, the use of copy on write (CoW) anonymous +memory, e.g. on +.Xr fork 2 , +causes swap reservation for all three regions (VM objects): +in the original pre-fork mapping, and its copies in +the parent and child, instead of only two. +Eventually the subsystem tries to optimize the internal layout +of the tracking for CoW and often removes (collapses) no longer +needed backing objects, re-assigning its pages and swap +reservations to the copies. +Collapsing frees the swap reserve, but it is not guaranteed +to happen. +.Pp The .Va kern.ipc.maxpipekva loader tunable is used to set a hard limit on the diff --git a/share/misc/committers-src.dot b/share/misc/committers-src.dot --- a/share/misc/committers-src.dot +++ b/share/misc/committers-src.dot @@ -241,8 +241,9 @@ jon [label="Jonathan Chen\njon@FreeBSD.org\n2000/10/17"] jonathan [label="Jonathan Anderson\njonathan@FreeBSD.org\n2010/10/07"] jpaetzel [label="Josh Paetzel\njpaetzel@FreeBSD.org\n2011/01/21"] -jrhall [label="John Hall\njrhall@FreeBSD.org\n2025/11/18" +jrhall [label="John Hall\njrhall@FreeBSD.org\n2025/11/18"] jrtc27 [label="Jessica Clarke\njrtc27@FreeBSD.org\n2020/01/23"] +js [label="Johan Söllvander\njs@FreeBSD.org\n2025/12/16"] jtl [label="Jonathan T. Looney\njtl@FreeBSD.org\n2015/10/26"] julian [label="Julian Elischer\njulian@FreeBSD.org\n1993/04/19"] jwd [label="John De Boskey\njwd@FreeBSD.org\n2000/05/19"] @@ -320,6 +321,7 @@ pjd [label="Pawel Jakub Dawidek\npjd@FreeBSD.org\n2004/02/02"] pkelsey [label="Patrick Kelsey\npkelsey@FreeBSD.org\n2014/05/29"] pluknet [label="Sergey Kandaurov\npluknet@FreeBSD.org\n2010/10/05"] +pouria [label="Pouria Mousavizadeh Tehrani\npouria@FreeBSD.org\n2026/01/10"] ps [label="Paul Saab\nps@FreeBSD.org\n2000/02/23"] qingli [label="Qing Li\nqingli@FreeBSD.org\n2005/04/13"] rajeshasp [label="Rajesh Kumar M A\nrajeshasp@FreeBSD.org\n2021/01/27"] @@ -359,6 +361,7 @@ sgalabov [label="Stanislav Galabov\nsgalabov@FreeBSD.org\n2016/02/24"] shurd [label="Stephen Hurd\nshurd@FreeBSD.org\n2017/09/02"] simon [label="Simon L. Nielsen\nsimon@FreeBSD.org\n2006/03/07"] +siva [label="Siva Mahadevan\nsiva@FreeBSD.org\n2026/01/16"] sjg [label="Simon J. Gerraty\nsjg@FreeBSD.org\n2012/10/23"] skra [label="Svatopluk Kraus\nskra@FreeBSD.org\n2015/10/28"] slavash [label="Slava Shwartsman\nslavash@FreeBSD.org\n2018/02/08"] @@ -453,6 +456,8 @@ araujo -> miwi +asomers -> js + avg -> art avg -> eugen avg -> pluknet @@ -568,6 +573,7 @@ emaste -> olce emaste -> rstone emaste -> scottph +emaste -> siva emax -> markus @@ -588,6 +594,7 @@ glebius -> cy glebius -> mav +glebius -> pouria gnn -> arybchik gnn -> davide @@ -777,6 +784,7 @@ lwhsu -> aokblast lwhsu -> khng +lwhsu -> siva manu -> corvink manu -> oh diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -99,7 +99,6 @@ FINGER \ FLOPPY \ FORTH \ - FP_LIBC \ FREEBSD_UPDATE \ FTP \ GAMES \ @@ -172,6 +171,7 @@ SERVICESDB \ SETUID_LOGIN \ SHAREDOCS \ + SOUND \ SOURCELESS \ SOURCELESS_HOST \ SOURCELESS_UCODE \ @@ -500,6 +500,11 @@ MK_LLVM_COV:= no .endif +# CUSE is needed only by virtual_oss, but virtual_oss is part of MK_SOUND. +.if ${MK_CUSE} == "no" +MK_SOUND:= no +.endif + .if ${MK_ASAN} == "yes" # In order to get sensible backtraces from ASAN we have to install # llvm-symbolizer as /usr/bin/addr2line instead of the elftoolchain version. diff --git a/stand/powerpc/ofw/cas.c b/stand/powerpc/ofw/cas.c --- a/stand/powerpc/ofw/cas.c +++ b/stand/powerpc/ofw/cas.c @@ -36,6 +36,9 @@ #endif /* PVR */ +#define PVR_CPU_P6 0x003e0000 +#define PVR_CPU_P7 0x003f0000 +#define PVR_CPU_P7PLUS 0x004a0000 #define PVR_CPU_P8E 0x004b0000 #define PVR_CPU_P8NVL 0x004c0000 #define PVR_CPU_P8 0x004d0000 @@ -125,7 +128,7 @@ } __packed; static struct ibm_arch_vec { - struct pvr pvr_list[10]; + struct pvr pvr_list[13]; uint8_t num_opts; struct opt_vec_ignore vec1; struct opt_vec_ignore vec2; @@ -134,6 +137,9 @@ struct opt_vec5 vec5; } __packed ibm_arch_vec = { /* pvr_list */ { + { htobe32(PVR_CPU_MASK), htobe32(PVR_CPU_P6) }, + { htobe32(PVR_CPU_MASK), htobe32(PVR_CPU_P7) }, + { htobe32(PVR_CPU_MASK), htobe32(PVR_CPU_P7PLUS) }, { htobe32(PVR_CPU_MASK), htobe32(PVR_CPU_P8) }, { htobe32(PVR_CPU_MASK), htobe32(PVR_CPU_P8E) }, { htobe32(PVR_CPU_MASK), htobe32(PVR_CPU_P8NVL) }, diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -240,6 +240,7 @@ device axp # AMD EPYC integrated NIC (requires miibus) # PCI Ethernet NICs. +device aq # Aquantia / Marvell AQC1xx device bxe # Broadcom NetXtreme II BCM5771X/BCM578XX 10GbE device le # AMD Am7900 LANCE and Am79C9xx PCnet device rge # Realtek 8125/8126/8127 diff --git a/sys/amd64/conf/MINIMAL b/sys/amd64/conf/MINIMAL --- a/sys/amd64/conf/MINIMAL +++ b/sys/amd64/conf/MINIMAL @@ -134,6 +134,7 @@ device vtnet # VirtIO Ethernet device device virtio_blk # VirtIO Block device device virtio_balloon # VirtIO Memory Balloon device +device virtio_scsi # VirtIO SCSI device # Linux KVM paravirtualization support device kvm_clock # KVM paravirtual clock driver diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES --- a/sys/amd64/conf/NOTES +++ b/sys/amd64/conf/NOTES @@ -43,6 +43,9 @@ # Optional devices: # +# vt(4) drivers. +device vt_efifb # EFI framebuffer + # 3Dfx Voodoo Graphics, Voodoo II /dev/3dfx CDEV support. This will create # the /dev/3dfx0 device to work with glide implementations. This should get # linked to /dev/3dfx and /dev/voodoo. Note that this is not the same as diff --git a/sys/arm/broadcom/bcm2835/files.bcm283x b/sys/arm/broadcom/bcm2835/files.bcm283x --- a/sys/arm/broadcom/bcm2835/files.bcm283x +++ b/sys/arm/broadcom/bcm2835/files.bcm283x @@ -32,7 +32,7 @@ contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c optional vchiq \ compile-with "${NORMAL_C} -Wno-unused -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" contrib/vchiq/interface/vchiq_arm/vchiq_arm.c optional vchiq \ - compile-with "${NORMAL_C} -Wno-unused -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" + compile-with "${NORMAL_C} -Wno-unused ${NO_WDEFAULT_CONST_INIT_FIELD_UNSAFE} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" contrib/vchiq/interface/vchiq_arm/vchiq_connected.c optional vchiq \ compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" contrib/vchiq/interface/vchiq_arm/vchiq_core.c optional vchiq \ diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -1094,6 +1094,11 @@ MRS_FIELD_VALUE_END, }; +static const struct mrs_field_hwcap id_aa64isar2_mops_caps[] = { + MRS_HWCAP(2, HWCAP2_MOPS, ID_AA64ISAR2_MOPS_IMPL), + MRS_HWCAP_END +}; + static const struct mrs_field_value id_aa64isar2_apa3[] = { MRS_FIELD_VALUE(ID_AA64ISAR2_APA3_NONE, ""), MRS_FIELD_VALUE(ID_AA64ISAR2_APA3_PAC, "APA3 PAC"), @@ -1149,7 +1154,8 @@ MRS_FIELD(ID_AA64ISAR2, PAC_frac, false, MRS_LOWER, 0, id_aa64isar2_pac_frac), MRS_FIELD(ID_AA64ISAR2, BC, false, MRS_LOWER, 0, id_aa64isar2_bc), - MRS_FIELD(ID_AA64ISAR2, MOPS, false, MRS_LOWER, 0, id_aa64isar2_mops), + MRS_FIELD_HWCAP(ID_AA64ISAR2, MOPS, false, MRS_LOWER, MRS_USERSPACE, + id_aa64isar2_mops, id_aa64isar2_mops_caps), MRS_FIELD_HWCAP(ID_AA64ISAR2, APA3, false, MRS_LOWER, MRS_USERSPACE, id_aa64isar2_apa3, id_aa64isar2_apa3_caps), MRS_FIELD_HWCAP(ID_AA64ISAR2, GPA3, false, MRS_LOWER, MRS_USERSPACE, diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -219,6 +219,41 @@ pan_check, NULL, pan_enable, pan_disabled, CPU_FEAT_AFTER_DEV | CPU_FEAT_PER_CPU); +static cpu_feat_en +mops_check(const struct cpu_feat *feat __unused, u_int midr __unused) +{ + uint64_t id_aa64isar2; + + if (!get_kernel_reg(ID_AA64ISAR2_EL1, &id_aa64isar2)) + return (FEAT_ALWAYS_DISABLE); + if (ID_AA64ISAR2_MOPS_VAL(id_aa64isar2) == ID_AA64ISAR2_MOPS_NONE) + return (FEAT_ALWAYS_DISABLE); + + return (FEAT_DEFAULT_ENABLE); +} + +static bool +mops_enable(const struct cpu_feat *feat __unused, + cpu_feat_errata errata_status __unused, u_int *errata_list __unused, + u_int errata_count __unused) +{ + WRITE_SPECIALREG(sctlr_el1, READ_SPECIALREG(sctlr_el1) | SCTLR_MSCEn); + isb(); + + return (true); +} + +static void +mops_disabled(const struct cpu_feat *feat __unused) +{ + WRITE_SPECIALREG(sctlr_el1, READ_SPECIALREG(sctlr_el1) & ~SCTLR_MSCEn); + isb(); +} + +CPU_FEAT(feat_mops, "MOPS", + mops_check, NULL, mops_enable, mops_disabled, + CPU_FEAT_AFTER_DEV | CPU_FEAT_PER_CPU); + bool has_hyp(void) { diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -597,6 +597,66 @@ } } +static void +handle_moe(struct thread *td, struct trapframe *frame, uint64_t esr) +{ + uint64_t src; + uint64_t dest; + uint64_t size; + int src_reg; + int dest_reg; + int size_reg; + int format_option; + + format_option = esr & ISS_MOE_FORMAT_OPTION_MASK; + dest_reg = (esr & ISS_MOE_DESTREG_MASK) >> ISS_MOE_DESTREG_SHIFT; + size_reg = (esr & ISS_MOE_SIZEREG_MASK) >> ISS_MOE_SIZEREG_SHIFT; + dest = frame->tf_x[dest_reg]; + size = frame->tf_x[size_reg]; + + /* + * Put the registers back in the original format suitable for a + * prologue instruction, using the generic return routine from the + * Arm ARM (DDI 0487I.a) rules CNTMJ and MWFQH. + */ + if (esr & ISS_MOE_MEMINST) { + /* SET* instruction */ + if (format_option == ISS_MOE_FORMAT_OPTION_A || + format_option == ISS_MOE_FORMAT_OPTION_A2) { + /* Format is from Option A; forward set */ + frame->tf_x[dest_reg] = dest + size; + frame->tf_x[size_reg] = -size; + } + } else { + /* CPY* instruction */ + src_reg = (esr & ISS_MOE_SRCREG_MASK) >> ISS_MOE_SRCREG_SHIFT; + src = frame->tf_x[src_reg]; + + if (format_option == ISS_MOE_FORMAT_OPTION_B || + format_option == ISS_MOE_FORMAT_OPTION_B2) { + /* Format is from Option B */ + if (frame->tf_spsr & PSR_N) { + /* Backward copy */ + frame->tf_x[dest_reg] = dest - size; + frame->tf_x[src_reg] = src + size; + } + } else { + /* Format is from Option A */ + if (frame->tf_x[size_reg] & (1UL << 63)) { + /* Forward copy */ + frame->tf_x[dest_reg] = dest + size; + frame->tf_x[src_reg] = src + size; + frame->tf_x[size_reg] = -size; + } + } + } + + if (esr & ISS_MOE_FROM_EPILOGUE) + frame->tf_elr -= 8; + else + frame->tf_elr -= 4; +} + void do_el0_sync(struct thread *td, struct trapframe *frame) { @@ -738,6 +798,10 @@ exception); userret(td, frame); break; + case EXCP_MOE: + handle_moe(td, frame, esr); + userret(td, frame); + break; default: call_trapsignal(td, SIGBUS, BUS_OBJERR, (void *)frame->tf_elr, exception); diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -592,6 +592,27 @@ #define ISS_MSR_REG(reg) \ __ISS_MSR_REG(reg##_op0, reg##_op1, reg##_CRn, reg##_CRm, reg##_op2) +#define ISS_MOE_MEMINST_SHIFT 24 +#define ISS_MOE_MEMINST (0x01 << ISS_MOE_MEMINST_SHIFT) +#define ISS_MOE_isSETG_SHIFT 24 +#define ISS_MOE_isSETG (0x01 << ISS_MOE_isSETG_SHIFT) +#define ISS_MOE_OPTIONS_SHIFT 19 +#define ISS_MOE_OPTIONS_MASK (0x0f << ISS_MOE_OPTIONS_SHIFT) +#define ISS_MOE_FROM_EPILOGUE_SHIFT 18 +#define ISS_MOE_FROM_EPILOGUE (0x01 << ISS_MOE_FROM_EPILOGUE_SHIFT) +#define ISS_MOE_FORMAT_OPTION_SHIFT 16 +#define ISS_MOE_FORMAT_OPTION_MASK (0x03 << ISS_MOE_FORMAT_OPTION_SHIFT) +#define ISS_MOE_FORMAT_OPTION_B (0x00 << ISS_MOE_FORMAT_OPTION_SHIFT) +#define ISS_MOE_FORMAT_OPTION_A (0x01 << ISS_MOE_FORMAT_OPTION_SHIFT) +#define ISS_MOE_FORMAT_OPTION_A2 (0x02 << ISS_MOE_FORMAT_OPTION_SHIFT) +#define ISS_MOE_FORMAT_OPTION_B2 (0x03 << ISS_MOE_FORMAT_OPTION_SHIFT) +#define ISS_MOE_DESTREG_SHIFT 10 +#define ISS_MOE_DESTREG_MASK (0x1f << ISS_MOE_DESTREG_SHIFT) +#define ISS_MOE_SRCREG_SHIFT 5 +#define ISS_MOE_SRCREG_MASK (0x1f << ISS_MOE_SRCREG_SHIFT) +#define ISS_MOE_SIZEREG_SHIFT 0 +#define ISS_MOE_SIZEREG_MASK (0x1f << ISS_MOE_SIZEREG_SHIFT) + #define ISS_DATA_ISV_SHIFT 24 #define ISS_DATA_ISV (0x01 << ISS_DATA_ISV_SHIFT) #define ISS_DATA_SAS_SHIFT 22 @@ -656,6 +677,7 @@ #define EXCP_DATA_ABORT_L 0x24 /* Data abort, from lower EL */ #define EXCP_DATA_ABORT 0x25 /* Data abort, from same EL */ #define EXCP_SP_ALIGN 0x26 /* SP slignment fault */ +#define EXCP_MOE 0x27 /* Memory Operation Exception */ #define EXCP_TRAP_FP 0x2c /* Trapped FP exception */ #define EXCP_SERROR 0x2f /* SError interrupt */ #define EXCP_BRKPT_EL0 0x30 /* Hardware breakpoint, from same EL */ @@ -1960,7 +1982,7 @@ #define MAIR_EL1_CRn 10 #define MAIR_EL1_CRm 2 #define MAIR_EL1_op2 0 -#define MAIR_ATTR_MASK(idx) (UL(0xff) << ((n)* 8)) +#define MAIR_ATTR_MASK(idx) (UL(0xff) << ((idx) * 8)) #define MAIR_ATTR(attr, idx) ((attr) << ((idx) * 8)) #define MAIR_DEVICE_nGnRnE UL(0x00) #define MAIR_DEVICE_nGnRE UL(0x04) @@ -2627,7 +2649,9 @@ #define SCTLR_LSMAOE (UL(0x1) << 29) #define SCTLR_EnIB (UL(0x1) << 30) #define SCTLR_EnIA (UL(0x1) << 31) -/* Bits 34:32 are reserved */ +/* Bit 32 is reserved */ +#define SCTLR_MSCEn (UL(0x1) << 33) +/* Bit 34 is reserved */ #define SCTLR_BT0 (UL(0x1) << 35) #define SCTLR_BT1 (UL(0x1) << 36) #define SCTLR_ITFSB (UL(0x1) << 37) diff --git a/sys/arm64/include/ifunc.h b/sys/arm64/include/ifunc.h --- a/sys/arm64/include/ifunc.h +++ b/sys/arm64/include/ifunc.h @@ -29,20 +29,38 @@ #ifndef __ARM64_IFUNC_H #define __ARM64_IFUNC_H +struct __ifunc_arg_t +{ + unsigned long _size; /* Size of the struct, so it can grow. */ + unsigned long _hwcap; + unsigned long _hwcap2; + unsigned long _hwcap3; + unsigned long _hwcap4; +}; + +typedef struct __ifunc_arg_t __ifunc_arg_t; + +#define _IFUNC_ARG_HWCAP (1ULL << 62) + #define DEFINE_IFUNC(qual, ret_type, name, args) \ static ret_type (*name##_resolver(void))args __used; \ qual ret_type name args __attribute__((ifunc(#name "_resolver"))); \ static ret_type (*name##_resolver(void))args #define DEFINE_UIFUNC(qual, ret_type, name, args) \ - static ret_type (*name##_resolver(uint64_t, uint64_t, \ + static ret_type (*name##_resolver(uint64_t, \ + const struct __ifunc_arg_t *ifunc_arg, \ uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, \ uint64_t))args __used; \ qual ret_type name args __attribute__((ifunc(#name "_resolver"))); \ - static ret_type (*name##_resolver(uint64_t _arg1 __unused, \ - uint64_t _arg2 __unused, uint64_t _arg3 __unused, \ - uint64_t _arg4 __unused, uint64_t _arg5 __unused, \ - uint64_t _arg6 __unused, uint64_t _arg7 __unused, \ + static ret_type (*name##_resolver( \ + uint64_t at_hwcap __unused, \ + const struct __ifunc_arg_t *ifunc_arg __unused, \ + uint64_t _arg3 __unused, \ + uint64_t _arg4 __unused, \ + uint64_t _arg5 __unused, \ + uint64_t _arg6 __unused, \ + uint64_t _arg7 __unused, \ uint64_t _arg8 __unused))args #endif diff --git a/sys/arm64/iommu/smmu.c b/sys/arm64/iommu/smmu.c --- a/sys/arm64/iommu/smmu.c +++ b/sys/arm64/iommu/smmu.c @@ -1698,22 +1698,21 @@ unit = (struct smmu_unit *)iommu; - domain = malloc(sizeof(*domain), M_SMMU, M_WAITOK | M_ZERO); - error = smmu_asid_alloc(sc, &new_asid); if (error) { - free(domain, M_SMMU); device_printf(sc->dev, "Could not allocate ASID for a new domain.\n"); return (NULL); } + domain = malloc(sizeof(*domain), M_SMMU, M_WAITOK | M_ZERO); domain->asid = (uint16_t)new_asid; smmu_pmap_pinit(&domain->p); error = smmu_init_cd(sc, domain); if (error) { + smmu_asid_free(sc, domain->asid); free(domain, M_SMMU); device_printf(sc->dev, "Could not initialize CD\n"); return (NULL); diff --git a/sys/arm64/vmm/io/vgic_v3.c b/sys/arm64/vmm/io/vgic_v3.c --- a/sys/arm64/vmm/io/vgic_v3.c +++ b/sys/arm64/vmm/io/vgic_v3.c @@ -672,7 +672,7 @@ if (irq == NULL) continue; - if (!irq->enabled) + if (irq->enabled) ret |= 1u << i; vgic_v3_release_irq(irq); } diff --git a/sys/cddl/dev/sdt/sdt.c b/sys/cddl/dev/sdt/sdt.c --- a/sys/cddl/dev/sdt/sdt.c +++ b/sys/cddl/dev/sdt/sdt.c @@ -60,6 +60,9 @@ #include +_Static_assert(sizeof((struct sdt_probe *)NULL)->id == sizeof(dtrace_id_t), + "sdt_probe.id and dtrace_id_t size mismatch"); + /* DTrace methods. */ static void sdt_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *); static uint64_t sdt_getargval(void *, dtrace_id_t, void *, int, int); diff --git a/sys/compat/linux/linux_if.c b/sys/compat/linux/linux_if.c --- a/sys/compat/linux/linux_if.c +++ b/sys/compat/linux/linux_if.c @@ -105,12 +105,13 @@ linux_ifnet_vnet_uninit(void *arg __unused) { /* - * At a normal vnet shutdown all interfaces are gone at this point. - * But when we kldunload linux.ko, the vnet_deregister_sysuninit() - * would call this function for the default vnet. + * All cloned interfaces are already gone at this point, as well + * as interfaces that were if_vmove'd into this vnet. However, + * if a jail has created IFT_ETHER interfaces in self, or has had + * physical Ethernet drivers attached in self, than we may have + * allocated entries in the unr(9), so clear it to avoid KASSERT. */ - if (IS_DEFAULT_VNET(curvnet)) - clear_unrhdr(V_linux_eth_unr); + clear_unrhdr(V_linux_eth_unr); delete_unrhdr(V_linux_eth_unr); } VNET_SYSUNINIT(linux_ifnet_vnet_uninit, SI_SUB_PROTO_IF, SI_ORDER_ANY, diff --git a/sys/compat/linuxkpi/common/include/linux/acpi.h b/sys/compat/linuxkpi/common/include/linux/acpi.h --- a/sys/compat/linuxkpi/common/include/linux/acpi.h +++ b/sys/compat/linuxkpi/common/include/linux/acpi.h @@ -32,7 +32,7 @@ #include #include -#if defined(__aarch64__) || defined(__amd64__) || defined(__i386__) +#if defined(__aarch64__) || defined(__amd64__) || defined(__i386__) || defined(__riscv) #include #include diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -1136,19 +1136,28 @@ static inline enum pci_bus_speed pcie_get_speed_cap(struct pci_dev *dev) { + struct pci_dev *pbus; device_t root; uint32_t lnkcap, lnkcap2; int error, pos; - root = device_get_parent(dev->dev.bsddev); - if (root == NULL) - return (PCI_SPEED_UNKNOWN); - root = device_get_parent(root); - if (root == NULL) - return (PCI_SPEED_UNKNOWN); - root = device_get_parent(root); - if (root == NULL) - return (PCI_SPEED_UNKNOWN); + /* + * We should always be called on a PCI device. + * The only current consumer I could find was amdgpu which either + * calls us directly on a pdev(drmn?) or with the result of + * pci_upstream_bridge(). + * + * Treat "drmn" as special again as it is not a PCI device. + */ + if (dev->pdrv != NULL && dev->pdrv->isdrm) { + pbus = pci_upstream_bridge(dev); + if (pbus == NULL) + return (PCI_SPEED_UNKNOWN); + } else + pbus = dev; + + /* "root" may be misleading as it may not be that. */ + root = pbus->dev.bsddev; if (pci_get_vendor(root) == PCI_VENDOR_ID_VIA || pci_get_vendor(root) == PCI_VENDOR_ID_SERVERWORKS) diff --git a/sys/compat/linuxkpi/common/src/linux_current.c b/sys/compat/linuxkpi/common/src/linux_current.c --- a/sys/compat/linuxkpi/common/src/linux_current.c +++ b/sys/compat/linuxkpi/common/src/linux_current.c @@ -90,11 +90,8 @@ } ts = uma_zalloc(linux_current_zone, flags | M_ZERO); - if (ts == NULL) { - if ((flags & (M_WAITOK | M_NOWAIT)) == M_WAITOK) - panic("linux_alloc_current: failed to allocate task"); + if (ts == NULL) return (ENOMEM); - } mm = NULL; /* setup new task structure */ @@ -118,10 +115,7 @@ PROC_UNLOCK(proc); mm = uma_zalloc(linux_mm_zone, flags | M_ZERO); if (mm == NULL) { - if ((flags & (M_WAITOK | M_NOWAIT)) == M_WAITOK) - panic( - "linux_alloc_current: failed to allocate mm"); - uma_zfree(linux_current_zone, mm); + uma_zfree(linux_current_zone, ts); return (ENOMEM); } diff --git a/sys/compat/linuxkpi/common/src/linux_firmware.c b/sys/compat/linuxkpi/common/src/linux_firmware.c --- a/sys/compat/linuxkpi/common/src/linux_firmware.c +++ b/sys/compat/linuxkpi/common/src/linux_firmware.c @@ -66,7 +66,8 @@ uint32_t flags; if (fw_name == NULL || fw == NULL || dev == NULL) { - *fw = NULL; + if (fw != NULL) + *fw = NULL; return (-EINVAL); } diff --git a/sys/compat/linuxkpi/common/src/linux_shmemfs.c b/sys/compat/linuxkpi/common/src/linux_shmemfs.c --- a/sys/compat/linuxkpi/common/src/linux_shmemfs.c +++ b/sys/compat/linuxkpi/common/src/linux_shmemfs.c @@ -62,11 +62,10 @@ struct linux_file * linux_shmem_file_setup(const char *name, loff_t size, unsigned long flags) { - struct fileobj { + struct { struct linux_file file __aligned(sizeof(void *)); struct vnode vnode __aligned(sizeof(void *)); - }; - struct fileobj *fileobj; + } *fileobj; struct linux_file *filp; struct vnode *vp; int error; @@ -89,7 +88,7 @@ } return (filp); err_1: - kfree(filp); + kfree(fileobj); err_0: return (ERR_PTR(error)); } diff --git a/sys/conf/NOTES b/sys/conf/NOTES --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2673,7 +2673,6 @@ # Debug options options BUS_DEBUG # enable newbus debugging -options DEBUG_VFS_LOCKS # enable VFS lock debugging options SOCKBUF_DEBUG # enable sockbuf last record/mb tail checking options IFMEDIA_DEBUG # enable debugging in net/if_media.c diff --git a/sys/conf/files b/sys/conf/files --- a/sys/conf/files +++ b/sys/conf/files @@ -5264,6 +5264,7 @@ security/mac/mac_pipe.c optional mac security/mac/mac_posix_sem.c optional mac security/mac/mac_posix_shm.c optional mac +security/mac/mac_prison.c optional mac security/mac/mac_priv.c optional mac security/mac/mac_process.c optional mac security/mac/mac_socket.c optional mac diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -112,6 +112,7 @@ crypto/openssl/amd64/ossl_aes_gcm_avx512.c optional ossl crypto/openssl/ossl_aes_gcm.c optional ossl dev/amdgpio/amdgpio.c optional amdgpio +dev/asmc/asmc.c optional asmc isa dev/axgbe/if_axgbe_pci.c optional axp dev/axgbe/xgbe-desc.c optional axp dev/axgbe/xgbe-dev.c optional axp diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -629,7 +629,7 @@ contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c optional vchiq soc_brcm_bcm2837 fdt \ compile-with "${NORMAL_C} -Wno-unused -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" contrib/vchiq/interface/vchiq_arm/vchiq_arm.c optional vchiq soc_brcm_bcm2837 fdt \ - compile-with "${NORMAL_C} -Wno-unused -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" + compile-with "${NORMAL_C} -Wno-unused ${NO_WDEFAULT_CONST_INIT_FIELD_UNSAFE} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" contrib/vchiq/interface/vchiq_arm/vchiq_connected.c optional vchiq soc_brcm_bcm2837 fdt \ compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" contrib/vchiq/interface/vchiq_arm/vchiq_core.c optional vchiq soc_brcm_bcm2837 fdt \ diff --git a/sys/conf/files.x86 b/sys/conf/files.x86 --- a/sys/conf/files.x86 +++ b/sys/conf/files.x86 @@ -67,7 +67,6 @@ dev/amdsmn/amdsmn.c optional amdsmn | amdtemp dev/amdtemp/amdtemp.c optional amdtemp dev/arcmsr/arcmsr.c optional arcmsr pci -dev/asmc/asmc.c optional asmc isa dev/atkbdc/atkbd.c optional atkbd atkbdc dev/atkbdc/atkbd_atkbdc.c optional atkbd atkbdc dev/atkbdc/atkbdc.c optional atkbdc diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -37,6 +37,9 @@ NO_WSTRICT_PROTOTYPES= -Wno-strict-prototypes NO_WDEPRECATED_NON_PROTOTYPE= -Wno-deprecated-non-prototype .endif +.if ${COMPILER_VERSION} >= 210000 +NO_WDEFAULT_CONST_INIT_FIELD_UNSAFE= -Wno-default-const-init-field-unsafe +.endif # Several other warnings which might be useful in some cases, but not severe # enough to error out the whole kernel build. Display them anyway, so there is # some incentive to fix them eventually. diff --git a/sys/conf/options b/sys/conf/options --- a/sys/conf/options +++ b/sys/conf/options @@ -601,7 +601,6 @@ BURN_BRIDGES opt_global.h DEBUG opt_global.h DEBUG_LOCKS opt_global.h -DEBUG_VFS_LOCKS opt_global.h DFLTPHYS opt_global.h DIAGNOSTIC opt_global.h INVARIANT_SUPPORT opt_global.h diff --git a/sys/conf/options.i386 b/sys/conf/options.i386 --- a/sys/conf/options.i386 +++ b/sys/conf/options.i386 @@ -112,6 +112,3 @@ # x86 specific uart options UART_NS8250_EARLY_PORT opt_uart.h - -# Enable asmc(4)-specific debug logic. -ASMC_DEBUG opt_asmc.h diff --git a/sys/conf/std.nodebug b/sys/conf/std.nodebug --- a/sys/conf/std.nodebug +++ b/sys/conf/std.nodebug @@ -7,7 +7,6 @@ nooptions DIAGNOSTIC nooptions WITNESS nooptions WITNESS_SKIPSPIN -nooptions DEBUG_VFS_LOCKS nooptions BUF_TRACKING nooptions FULL_BUF_TRACKING nooptions DEADLKRES diff --git a/sys/crypto/sha2/sha256c.c b/sys/crypto/sha2/sha256c.c --- a/sys/crypto/sha2/sha256c.c +++ b/sys/crypto/sha2/sha256c.c @@ -206,12 +206,8 @@ DEFINE_UIFUNC(static, void, SHA256_Transform, (uint32_t * state, const unsigned char block[64])) { - u_long hwcap; - - if (elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)) == 0) { - if ((hwcap & HWCAP_SHA2) != 0) - return (SHA256_Transform_arm64); - } + if ((at_hwcap & HWCAP_SHA2) != 0) + return (SHA256_Transform_arm64); return (SHA256_Transform_c); } diff --git a/sys/crypto/sha2/sha512c.c b/sys/crypto/sha2/sha512c.c --- a/sys/crypto/sha2/sha512c.c +++ b/sys/crypto/sha2/sha512c.c @@ -236,13 +236,8 @@ DEFINE_UIFUNC(static, void, SHA512_Transform, (uint64_t * state, const unsigned char block[SHA512_BLOCK_LENGTH])) { - u_long hwcap; - - if (elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)) == 0) { - if ((hwcap & HWCAP_SHA512) != 0) { - return (SHA512_Transform_arm64); - } - } + if ((at_hwcap & HWCAP_SHA512) != 0) + return (SHA512_Transform_arm64); return (SHA512_Transform_c); } diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -58,6 +58,7 @@ #if defined(__i386__) || defined(__amd64__) #include +#include #include #include #include @@ -679,15 +680,19 @@ #endif /* - * Probe all supported ACPI sleep states. Awake (S0) is always supported. + * Probe all supported ACPI sleep states. Awake (S0) is always supported, + * and suspend-to-idle is always supported on x86 only (at the moment). */ - acpi_supported_sstates[ACPI_STATE_S0] = TRUE; + acpi_supported_sstates[ACPI_STATE_S0] = true; acpi_supported_stypes[POWER_STYPE_AWAKE] = true; +#if defined(__i386__) || defined(__amd64__) + acpi_supported_stypes[POWER_STYPE_SUSPEND_TO_IDLE] = true; +#endif for (state = ACPI_STATE_S1; state <= ACPI_STATE_S5; state++) if (ACPI_SUCCESS(AcpiEvaluateObject(ACPI_ROOT_OBJECT, __DECONST(char *, AcpiGbl_SleepStateNames[state]), NULL, NULL)) && ACPI_SUCCESS(AcpiGetSleepTypeData(state, &TypeA, &TypeB))) { - acpi_supported_sstates[state] = TRUE; + acpi_supported_sstates[state] = true; acpi_supported_stypes[acpi_sstate_to_stype(state)] = true; } @@ -705,13 +710,24 @@ else if (acpi_supported_sstates[ACPI_STATE_S2]) sc->acpi_standby_sx = ACPI_STATE_S2; - /* Pick the first valid sleep type for the sleep button default. */ + /* + * Pick the first valid sleep type for the sleep button default. If that + * type was hibernate and we support s2idle, set it to that. The sleep + * button prefers s2mem instead of s2idle at the moment as s2idle may not + * yet work reliably on all machines. In the future, we should set this to + * s2idle when ACPI_FADT_LOW_POWER_S0 is set. + */ sc->acpi_sleep_button_stype = POWER_STYPE_UNKNOWN; for (stype = POWER_STYPE_STANDBY; stype <= POWER_STYPE_HIBERNATE; stype++) if (acpi_supported_stypes[stype]) { sc->acpi_sleep_button_stype = stype; break; } + if (sc->acpi_sleep_button_stype == POWER_STYPE_HIBERNATE || + sc->acpi_sleep_button_stype == POWER_STYPE_UNKNOWN) { + if (acpi_supported_stypes[POWER_STYPE_SUSPEND_TO_IDLE]) + sc->acpi_sleep_button_stype = POWER_STYPE_SUSPEND_TO_IDLE; + } acpi_enable_fixed_events(sc); @@ -3315,7 +3331,8 @@ return (0); #else - /* This platform does not support acpi suspend/resume. */ + device_printf(sc->acpi_dev, "ACPI suspend not supported on this platform " + "(TODO suspend to idle should be, however)\n"); return (EOPNOTSUPP); #endif } @@ -3330,13 +3347,13 @@ int acpi_AckSleepState(struct apm_clone_data *clone, int error) { + struct acpi_softc *sc = clone->acpi_sc; + #if defined(__amd64__) || defined(__i386__) - struct acpi_softc *sc; int ret, sleeping; /* If no pending sleep type, return an error. */ ACPI_LOCK(acpi); - sc = clone->acpi_sc; if (sc->acpi_next_stype == POWER_STYPE_AWAKE) { ACPI_UNLOCK(acpi); return (ENXIO); @@ -3379,7 +3396,8 @@ } return (ret); #else - /* This platform does not support acpi suspend/resume. */ + device_printf(sc->acpi_dev, "ACPI suspend not supported on this platform " + "(TODO suspend to idle should be, however)\n"); return (EOPNOTSUPP); #endif } @@ -3418,27 +3436,133 @@ } enum acpi_sleep_state { - ACPI_SS_NONE, - ACPI_SS_GPE_SET, - ACPI_SS_DEV_SUSPEND, - ACPI_SS_SLP_PREP, - ACPI_SS_SLEPT, + ACPI_SS_NONE = 0, + ACPI_SS_GPE_SET = 1 << 0, + ACPI_SS_DEV_SUSPEND = 1 << 1, + ACPI_SS_SLP_PREP = 1 << 2, + ACPI_SS_SLEPT = 1 << 3, }; +static void +do_standby(struct acpi_softc *sc, enum acpi_sleep_state *slp_state, + register_t rflags) +{ + ACPI_STATUS status; + + status = AcpiEnterSleepState(sc->acpi_standby_sx); + intr_restore(rflags); + AcpiLeaveSleepStatePrep(sc->acpi_standby_sx); + if (ACPI_FAILURE(status)) { + device_printf(sc->acpi_dev, "AcpiEnterSleepState failed - %s\n", + AcpiFormatException(status)); + return; + } + *slp_state |= ACPI_SS_SLEPT; +} + +static void +do_sleep(struct acpi_softc *sc, enum acpi_sleep_state *slp_state, + register_t rflags, int state) +{ + int sleep_result; + ACPI_EVENT_STATUS power_button_status; + + MPASS(state == ACPI_STATE_S3 || state == ACPI_STATE_S4); + + sleep_result = acpi_sleep_machdep(sc, state); + acpi_wakeup_machdep(sc, state, sleep_result, 0); + + if (sleep_result == 1 && state == ACPI_STATE_S3) { + /* + * XXX According to ACPI specification SCI_EN bit should be restored + * by ACPI platform (BIOS, firmware) to its pre-sleep state. + * Unfortunately some BIOSes fail to do that and that leads to + * unexpected and serious consequences during wake up like a system + * getting stuck in SMI handlers. + * This hack is picked up from Linux, which claims that it follows + * Windows behavior. + */ + AcpiWriteBitRegister(ACPI_BITREG_SCI_ENABLE, ACPI_ENABLE_EVENT); + + /* + * Prevent misinterpretation of the wakeup by power button + * as a request for power off. + * Ideally we should post an appropriate wakeup event, + * perhaps using acpi_event_power_button_wake or alike. + * + * Clearing of power button status after wakeup is mandated + * by ACPI specification in section "Fixed Power Button". + * + * XXX As of ACPICA 20121114 AcpiGetEventStatus provides + * status as 0/1 corresponding to inactive/active despite + * its type being ACPI_EVENT_STATUS. In other words, + * we should not test for ACPI_EVENT_FLAG_SET for time being. + */ + if (ACPI_SUCCESS(AcpiGetEventStatus(ACPI_EVENT_POWER_BUTTON, + &power_button_status)) && power_button_status != 0) { + AcpiClearEvent(ACPI_EVENT_POWER_BUTTON); + device_printf(sc->acpi_dev, "cleared fixed power button status\n"); + } + } + + intr_restore(rflags); + + /* call acpi_wakeup_machdep() again with interrupt enabled */ + acpi_wakeup_machdep(sc, state, sleep_result, 1); + + AcpiLeaveSleepStatePrep(state); + + if (sleep_result == -1) + return; + + /* Re-enable ACPI hardware on wakeup from sleep state 4. */ + if (state == ACPI_STATE_S4) + AcpiEnable(); + *slp_state |= ACPI_SS_SLEPT; +} + +#if defined(__i386__) || defined(__amd64__) +static void +do_idle(struct acpi_softc *sc, enum acpi_sleep_state *slp_state, + register_t rflags) +{ + + intr_suspend(); + + /* + * The CPU will exit idle when interrupted, so we want to minimize the + * number of interrupts it can receive while idle. We do this by only + * allowing SCI (system control interrupt) interrupts, which are used by + * the ACPI firmware to send wake GPEs to the OS. + * + * XXX We might still receive other spurious non-wake GPEs from noisy + * devices that can't be disabled, so this will need to end up being a + * suspend-to-idle loop which, when breaking out of idle, will check the + * reason for the wakeup and immediately idle the CPU again if it was not a + * proper wake event. + */ + intr_enable_src(AcpiGbl_FADT.SciInterrupt); + + cpu_idle(0); + + intr_resume(false); + intr_restore(rflags); + *slp_state |= ACPI_SS_SLEPT; +} +#endif + /* * Enter the desired system sleep state. * - * Currently we support S1-S5 but S4 is only S4BIOS + * Currently we support S1-S5 and suspend-to-idle, but S4 is only S4BIOS. */ static ACPI_STATUS acpi_EnterSleepState(struct acpi_softc *sc, enum power_stype stype) { register_t intr; ACPI_STATUS status; - ACPI_EVENT_STATUS power_button_status; enum acpi_sleep_state slp_state; int acpi_sstate; - int sleep_result; ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, stype); @@ -3498,7 +3622,7 @@ /* Enable any GPEs as appropriate and requested by the user. */ acpi_wake_prep_walk(sc, stype); - slp_state = ACPI_SS_GPE_SET; + slp_state |= ACPI_SS_GPE_SET; /* * Inform all devices that we are going to sleep. If at least one @@ -3509,113 +3633,81 @@ * bus interface does not provide for this. */ if (DEVICE_SUSPEND(root_bus) != 0) { - device_printf(sc->acpi_dev, "device_suspend failed\n"); - goto backout; + device_printf(sc->acpi_dev, "device_suspend failed\n"); + goto backout; } - slp_state = ACPI_SS_DEV_SUSPEND; + slp_state |= ACPI_SS_DEV_SUSPEND; - status = AcpiEnterSleepStatePrep(acpi_sstate); - if (ACPI_FAILURE(status)) { - device_printf(sc->acpi_dev, "AcpiEnterSleepStatePrep failed - %s\n", - AcpiFormatException(status)); - goto backout; + if (stype != POWER_STYPE_SUSPEND_TO_IDLE) { + status = AcpiEnterSleepStatePrep(acpi_sstate); + if (ACPI_FAILURE(status)) { + device_printf(sc->acpi_dev, "AcpiEnterSleepStatePrep failed - %s\n", + AcpiFormatException(status)); + goto backout; + } } - slp_state = ACPI_SS_SLP_PREP; + slp_state |= ACPI_SS_SLP_PREP; if (sc->acpi_sleep_delay > 0) DELAY(sc->acpi_sleep_delay * 1000000); suspendclock(); intr = intr_disable(); - if (stype != POWER_STYPE_STANDBY) { - sleep_result = acpi_sleep_machdep(sc, acpi_sstate); - acpi_wakeup_machdep(sc, acpi_sstate, sleep_result, 0); - - /* - * XXX According to ACPI specification SCI_EN bit should be restored - * by ACPI platform (BIOS, firmware) to its pre-sleep state. - * Unfortunately some BIOSes fail to do that and that leads to - * unexpected and serious consequences during wake up like a system - * getting stuck in SMI handlers. - * This hack is picked up from Linux, which claims that it follows - * Windows behavior. - */ - if (sleep_result == 1 && stype != POWER_STYPE_HIBERNATE) - AcpiWriteBitRegister(ACPI_BITREG_SCI_ENABLE, ACPI_ENABLE_EVENT); - - if (sleep_result == 1 && stype == POWER_STYPE_SUSPEND_TO_MEM) { - /* - * Prevent mis-interpretation of the wakeup by power button - * as a request for power off. - * Ideally we should post an appropriate wakeup event, - * perhaps using acpi_event_power_button_wake or alike. - * - * Clearing of power button status after wakeup is mandated - * by ACPI specification in section "Fixed Power Button". - * - * XXX As of ACPICA 20121114 AcpiGetEventStatus provides - * status as 0/1 corressponding to inactive/active despite - * its type being ACPI_EVENT_STATUS. In other words, - * we should not test for ACPI_EVENT_FLAG_SET for time being. - */ - if (ACPI_SUCCESS(AcpiGetEventStatus(ACPI_EVENT_POWER_BUTTON, - &power_button_status)) && power_button_status != 0) { - AcpiClearEvent(ACPI_EVENT_POWER_BUTTON); - device_printf(sc->acpi_dev, - "cleared fixed power button status\n"); - } - } - - intr_restore(intr); - - /* call acpi_wakeup_machdep() again with interrupt enabled */ - acpi_wakeup_machdep(sc, acpi_sstate, sleep_result, 1); - - AcpiLeaveSleepStatePrep(acpi_sstate); - - if (sleep_result == -1) - goto backout; - - /* Re-enable ACPI hardware on wakeup from hibernate. */ - if (stype == POWER_STYPE_HIBERNATE) - AcpiEnable(); - } else { - status = AcpiEnterSleepState(acpi_sstate); - intr_restore(intr); - AcpiLeaveSleepStatePrep(acpi_sstate); - if (ACPI_FAILURE(status)) { - device_printf(sc->acpi_dev, "AcpiEnterSleepState failed - %s\n", - AcpiFormatException(status)); - goto backout; - } + switch (stype) { + case POWER_STYPE_STANDBY: + do_standby(sc, &slp_state, intr); + break; + case POWER_STYPE_SUSPEND_TO_MEM: + case POWER_STYPE_HIBERNATE: + do_sleep(sc, &slp_state, intr, acpi_sstate); + break; + case POWER_STYPE_SUSPEND_TO_IDLE: +#if defined(__i386__) || defined(__amd64__) + do_idle(sc, &slp_state, intr); + break; +#endif + case POWER_STYPE_AWAKE: + case POWER_STYPE_POWEROFF: + case POWER_STYPE_COUNT: + case POWER_STYPE_UNKNOWN: + __unreachable(); } - slp_state = ACPI_SS_SLEPT; /* * Back out state according to how far along we got in the suspend * process. This handles both the error and success cases. */ backout: - if (slp_state >= ACPI_SS_SLP_PREP) + if ((slp_state & ACPI_SS_SLP_PREP) != 0) { resumeclock(); - if (slp_state >= ACPI_SS_GPE_SET) { + slp_state &= ~ACPI_SS_SLP_PREP; + } + if ((slp_state & ACPI_SS_GPE_SET) != 0) { acpi_wake_prep_walk(sc, stype); sc->acpi_stype = POWER_STYPE_AWAKE; + slp_state &= ~ACPI_SS_GPE_SET; } - if (slp_state >= ACPI_SS_DEV_SUSPEND) + if ((slp_state & ACPI_SS_DEV_SUSPEND) != 0) { DEVICE_RESUME(root_bus); - if (slp_state >= ACPI_SS_SLP_PREP) + slp_state &= ~ACPI_SS_DEV_SUSPEND; + } + if (stype != POWER_STYPE_SUSPEND_TO_IDLE && (slp_state & ACPI_SS_SLP_PREP) != 0) { AcpiLeaveSleepState(acpi_sstate); - if (slp_state >= ACPI_SS_SLEPT) { + slp_state &= ~ACPI_SS_SLP_PREP; + } + if ((slp_state & ACPI_SS_SLEPT) != 0) { #if defined(__i386__) || defined(__amd64__) /* NB: we are still using ACPI timecounter at this point. */ resume_TSC(); #endif acpi_resync_clock(sc); acpi_enable_fixed_events(sc); + slp_state &= ~ACPI_SS_SLEPT; } sc->acpi_next_stype = POWER_STYPE_AWAKE; + MPASS(slp_state == ACPI_SS_NONE); + bus_topo_unlock(); #ifdef EARLY_AP_STARTUP @@ -4242,6 +4334,21 @@ ACPI_UNLOCK(acpi); } +void +acpi_deregister_ioctls(acpi_ioctl_fn fn) +{ + struct acpi_ioctl_hook *hp, *thp; + + ACPI_LOCK(acpi); + TAILQ_FOREACH_SAFE(hp, &acpi_ioctl_hooks, link, thp) { + if (hp->fn == fn) { + TAILQ_REMOVE(&acpi_ioctl_hooks, hp, link); + free(hp, M_ACPIDEV); + } + } + ACPI_UNLOCK(acpi); +} + static int acpiopen(struct cdev *dev, int flag, int fmt, struct thread *td) { diff --git a/sys/dev/acpica/acpi_battery.c b/sys/dev/acpica/acpi_battery.c --- a/sys/dev/acpica/acpi_battery.c +++ b/sys/dev/acpica/acpi_battery.c @@ -531,13 +531,7 @@ out: if (error) { - acpi_deregister_ioctl(ACPIIO_BATT_GET_UNITS, acpi_battery_ioctl); - acpi_deregister_ioctl(ACPIIO_BATT_GET_BATTINFO, acpi_battery_ioctl); - acpi_deregister_ioctl(ACPIIO_BATT_GET_BATTINFO_V1, acpi_battery_ioctl); - acpi_deregister_ioctl(ACPIIO_BATT_GET_BIF, acpi_battery_ioctl); - acpi_deregister_ioctl(ACPIIO_BATT_GET_BIX, acpi_battery_ioctl); - acpi_deregister_ioctl(ACPIIO_BATT_GET_BST, acpi_battery_ioctl); - acpi_deregister_ioctl(ACPIIO_BATT_GET_BST_V1, acpi_battery_ioctl); + acpi_deregister_ioctls(acpi_battery_ioctl); } return (error); } diff --git a/sys/dev/acpica/acpiio.h b/sys/dev/acpica/acpiio.h --- a/sys/dev/acpica/acpiio.h +++ b/sys/dev/acpica/acpiio.h @@ -205,6 +205,7 @@ typedef int (*acpi_ioctl_fn)(u_long cmd, caddr_t addr, void *arg); extern int acpi_register_ioctl(u_long cmd, acpi_ioctl_fn fn, void *arg); extern void acpi_deregister_ioctl(u_long cmd, acpi_ioctl_fn fn); +extern void acpi_deregister_ioctls(acpi_ioctl_fn fn); #endif #endif /* !_ACPIIO_H_ */ diff --git a/sys/dev/aq/aq_common.h b/sys/dev/aq/aq_common.h --- a/sys/dev/aq/aq_common.h +++ b/sys/dev/aq/aq_common.h @@ -67,5 +67,4 @@ #define AQ_VER "0.0.5" -#endif //_AQ_COMMON_H_ - +#endif // _AQ_COMMON_H_ diff --git a/sys/dev/aq/aq_dbg.c b/sys/dev/aq/aq_dbg.c --- a/sys/dev/aq/aq_dbg.c +++ b/sys/dev/aq/aq_dbg.c @@ -56,7 +56,8 @@ #define __field(TYPE, VAR) TYPE VAR; void -trace_aq_tx_descr(int ring_idx, unsigned int pointer, volatile uint64_t descr[2]) +trace_aq_tx_descr(int ring_idx, unsigned int pointer, + volatile uint64_t descr[2]) { #if AQ_CFG_DEBUG_LVL > 2 struct __entry{ @@ -211,7 +212,8 @@ for (i = 0; i < size; ++i) { sprintf(buf, "%02X ", ((const unsigned char*)data)[i]); strcat(line, buf); - if (((const unsigned char*)data)[i] >= ' ' && ((const unsigned char*)data)[i] <= '~') { + if (((const unsigned char*)data)[i] >= ' ' && + ((const unsigned char*)data)[i] <= '~') { ascii[i % 16] = ((const unsigned char*)data)[i]; } else { ascii[i % 16] = '.'; diff --git a/sys/dev/aq/aq_device.h b/sys/dev/aq/aq_device.h --- a/sys/dev/aq/aq_device.h +++ b/sys/dev/aq/aq_device.h @@ -147,4 +147,4 @@ int aq_mediachange(struct ifnet *ifp); void aq_if_update_admin_status(if_ctx_t ctx); -#endif +#endif // _AQ_DEVICE_H_ diff --git a/sys/dev/aq/aq_fw.c b/sys/dev/aq/aq_fw.c --- a/sys/dev/aq/aq_fw.c +++ b/sys/dev/aq/aq_fw.c @@ -62,6 +62,7 @@ } aq_fw_bootloader_mode; #define AQ_CFG_HOST_BOOT_DISABLE 0 + // Timeouts #define RBL_TIMEOUT_MS 10000 #define MAC_FW_START_TIMEOUT_MS 10000 @@ -215,12 +216,14 @@ int k; reg_global_ctl2_set(hw, 0x40e1); - // Let Felicity hardware to complete SMBUS transaction before Global software reset. + // Let Felicity hardware complete SMBUS transaction before Global + // software reset. msec_delay(50); /* - * If SPI burst transaction was interrupted(before running the script), global software - * reset may not clear SPI interface. Clean it up manually before global reset. + * If SPI burst transaction was interrupted(before running the script), + * global software reset may not clear SPI interface. Clean it up + * manually before global reset. */ reg_glb_nvr_provisioning2_set(hw, 0xa0); reg_glb_nvr_interface1_set(hw, 0x9f); @@ -236,8 +239,8 @@ reg_glb_general_provisioning9_set(hw, 1); /* - * For the case SPI burst transaction was interrupted (by MCP reset above), - * wait until it is completed by hardware. + * For the case SPI burst transaction was interrupted (by MCP reset + * above), wait until it is completed by hardware. */ msec_delay(50); // Sleep for 10 ms. @@ -263,7 +266,8 @@ trace(dbg_init, "FLB> MAC kickstart done, %d ms", k); /* FW reset */ reg_global_ctl2_set(hw, 0x80e0); - // Let Felicity hardware complete SMBUS transaction before Global software reset. + // Let Felicity hardware complete SMBUS transaction before + // Global software reset. msec_delay(50); } reg_glb_cpu_sem_set(hw, 1, 0); diff --git a/sys/dev/aq/aq_fw1x.c b/sys/dev/aq/aq_fw1x.c --- a/sys/dev/aq/aq_fw1x.c +++ b/sys/dev/aq/aq_fw1x.c @@ -171,7 +171,8 @@ const int retryCount = 1000; for (int i = 0; i < retryCount; ++i) { - // Read the beginning of Statistics structure to capture the Transaction ID. + // Read the beginning of Statistics structure to capture the + // Transaction ID. aq_hw_fw_downld_dwords(hal, hal->mbox_addr, (uint32_t*)&mbox, (uint32_t)((char*)&mbox.stats - (char*)&mbox) / sizeof(uint32_t)); @@ -185,7 +186,6 @@ * Compare transaction ID to initial value. * If it's different means f/w is alive. We're done. */ - return (EOK); } @@ -321,4 +321,3 @@ .get_mac_addr = fw1x_get_mac_addr, .get_stats = fw1x_get_stats, }; - diff --git a/sys/dev/aq/aq_fw2x.c b/sys/dev/aq/aq_fw2x.c --- a/sys/dev/aq/aq_fw2x.c +++ b/sys/dev/aq/aq_fw2x.c @@ -193,7 +193,6 @@ #define FW2X_LED_DEFAULT 0x0U // Firmware v2-3.x specific functions. -//@{ int fw2x_reset(struct aq_hw* hw); int fw2x_set_mode(struct aq_hw* hw, enum aq_hw_fw_mpi_state_e mode, @@ -203,8 +202,6 @@ int fw2x_get_mac_addr(struct aq_hw* hw, uint8_t* mac); int fw2x_get_stats(struct aq_hw* hw, struct aq_hw_stats_s* stats); -//@} - static uint64_t @@ -474,7 +471,7 @@ return (-ENOTSUP); } - // Say to F/W to update the statistics + // Tell F/W to update the statistics. if (!toggle_mpi_ctrl_and_wait_(hw, FW2X_CAP_STATISTICS, 1, 25)) { trace_error(dbg_fw, "fw2x> statistics update timeout"); AQ_DBG_EXIT(-ETIME); diff --git a/sys/dev/aq/aq_hw.h b/sys/dev/aq/aq_hw.h --- a/sys/dev/aq/aq_hw.h +++ b/sys/dev/aq/aq_hw.h @@ -356,5 +356,4 @@ int aq_hw_rss_set(struct aq_hw_s *self, uint8_t rss_table[HW_ATL_RSS_INDIRECTION_TABLE_MAX]); int aq_hw_udp_rss_enable(struct aq_hw_s *self, bool enable); -#endif //_AQ_HW_H_ - +#endif // _AQ_HW_H_ diff --git a/sys/dev/aq/aq_hw.c b/sys/dev/aq/aq_hw.c --- a/sys/dev/aq/aq_hw.c +++ b/sys/dev/aq/aq_hw.c @@ -796,9 +796,11 @@ void -aq_hw_set_promisc(struct aq_hw_s *self, bool l2_promisc, bool vlan_promisc, bool mc_promisc) +aq_hw_set_promisc(struct aq_hw_s *self, bool l2_promisc, bool vlan_promisc, + bool mc_promisc) { - AQ_DBG_ENTERA("promisc %d, vlan_promisc %d, allmulti %d", l2_promisc, vlan_promisc, mc_promisc); + AQ_DBG_ENTERA("promisc %d, vlan_promisc %d, allmulti %d", l2_promisc, + vlan_promisc, mc_promisc); rpfl2promiscuous_mode_en_set(self, l2_promisc); @@ -811,7 +813,8 @@ } int -aq_hw_rss_hash_set(struct aq_hw_s *self, uint8_t rss_key[HW_ATL_RSS_HASHKEY_SIZE]) +aq_hw_rss_hash_set(struct aq_hw_s *self, + uint8_t rss_key[HW_ATL_RSS_HASHKEY_SIZE]) { uint32_t rss_key_dw[HW_ATL_RSS_HASHKEY_SIZE / 4]; uint32_t addr = 0U; @@ -841,7 +844,8 @@ } int -aq_hw_rss_hash_get(struct aq_hw_s *self, uint8_t rss_key[HW_ATL_RSS_HASHKEY_SIZE]) +aq_hw_rss_hash_get(struct aq_hw_s *self, + uint8_t rss_key[HW_ATL_RSS_HASHKEY_SIZE]) { uint32_t rss_key_dw[HW_ATL_RSS_HASHKEY_SIZE / 4]; uint32_t addr = 0U; @@ -863,7 +867,8 @@ } int -aq_hw_rss_set(struct aq_hw_s *self, uint8_t rss_table[HW_ATL_RSS_INDIRECTION_TABLE_MAX]) +aq_hw_rss_set(struct aq_hw_s *self, + uint8_t rss_table[HW_ATL_RSS_INDIRECTION_TABLE_MAX]) { uint16_t bitary[(HW_ATL_RSS_INDIRECTION_TABLE_MAX * 3 / 16U)]; diff --git a/sys/dev/aq/aq_hw_llh.c b/sys/dev/aq/aq_hw_llh.c --- a/sys/dev/aq/aq_hw_llh.c +++ b/sys/dev/aq/aq_hw_llh.c @@ -89,7 +89,8 @@ } void -reg_glb_daisy_chain_status1_set(struct aq_hw* hw, uint32_t glb_daisy_chain_status1) +reg_glb_daisy_chain_status1_set(struct aq_hw* hw, + uint32_t glb_daisy_chain_status1) { AQ_WRITE_REG(hw, glb_daisy_chain_status1_adr, glb_daisy_chain_status1); } @@ -459,7 +460,8 @@ } void -itr_mif_int_map_set(struct aq_hw *aq_hw, uint32_t mifInterruptMapping, uint32_t mif) +itr_mif_int_map_set(struct aq_hw *aq_hw, uint32_t mifInterruptMapping, + uint32_t mif) { AQ_WRITE_REG_BIT(aq_hw, itrImrMifM_ADR(mif), itrImrMifM_MSK(mif), itrImrMifM_SHIFT(mif), mifInterruptMapping); @@ -516,8 +518,8 @@ } void -rdm_rx_desc_data_buff_size_set(struct aq_hw *aq_hw, uint32_t rx_desc_data_buff_size, - uint32_t descriptor) +rdm_rx_desc_data_buff_size_set(struct aq_hw *aq_hw, + uint32_t rx_desc_data_buff_size, uint32_t descriptor) { AQ_WRITE_REG_BIT(aq_hw, rdm_descddata_size_adr(descriptor), rdm_descddata_size_msk, rdm_descddata_size_shift, @@ -525,14 +527,16 @@ } void -rdm_rx_desc_dca_en_set(struct aq_hw *aq_hw, uint32_t rx_desc_dca_en, uint32_t dca) +rdm_rx_desc_dca_en_set(struct aq_hw *aq_hw, uint32_t rx_desc_dca_en, + uint32_t dca) { AQ_WRITE_REG_BIT(aq_hw, rdm_dcaddesc_en_adr(dca), rdm_dcaddesc_en_msk, rdm_dcaddesc_en_shift, rx_desc_dca_en); } void -rdm_rx_desc_en_set(struct aq_hw *aq_hw, uint32_t rx_desc_en, uint32_t descriptor) +rdm_rx_desc_en_set(struct aq_hw *aq_hw, uint32_t rx_desc_en, + uint32_t descriptor) { AQ_WRITE_REG_BIT(aq_hw, rdm_descden_adr(descriptor), rdm_descden_msk, rdm_descden_shift, rx_desc_en); @@ -564,14 +568,16 @@ } void -rdm_rx_desc_len_set(struct aq_hw *aq_hw, uint32_t rx_desc_len, uint32_t descriptor) +rdm_rx_desc_len_set(struct aq_hw *aq_hw, uint32_t rx_desc_len, + uint32_t descriptor) { AQ_WRITE_REG_BIT(aq_hw, rdm_descdlen_adr(descriptor), rdm_descdlen_msk, rdm_descdlen_shift, rx_desc_len); } void -rdm_rx_desc_res_set(struct aq_hw *aq_hw, uint32_t rx_desc_res, uint32_t descriptor) +rdm_rx_desc_res_set(struct aq_hw *aq_hw, uint32_t rx_desc_res, + uint32_t descriptor) { AQ_WRITE_REG_BIT(aq_hw, rdm_descdreset_adr(descriptor), rdm_descdreset_msk, rdm_descdreset_shift, rx_desc_res); @@ -587,7 +593,8 @@ } void -rdm_rx_head_dca_en_set(struct aq_hw *aq_hw, uint32_t rx_head_dca_en, uint32_t dca) +rdm_rx_head_dca_en_set(struct aq_hw *aq_hw, uint32_t rx_head_dca_en, + uint32_t dca) { AQ_WRITE_REG_BIT(aq_hw, rdm_dcadhdr_en_adr(dca), rdm_dcadhdr_en_msk, rdm_dcadhdr_en_shift, rx_head_dca_en); @@ -960,7 +967,8 @@ } void -rpf_rss_redir_tbl_wr_data_set(struct aq_hw *aq_hw, uint32_t rss_redir_tbl_wr_data) +rpf_rss_redir_tbl_wr_data_set(struct aq_hw *aq_hw, + uint32_t rss_redir_tbl_wr_data) { AQ_WRITE_REG_BIT(aq_hw, rpf_rss_redir_wr_data_adr, rpf_rss_redir_wr_data_msk, rpf_rss_redir_wr_data_shift, @@ -1010,7 +1018,8 @@ } void -hw_atl_rpf_vlan_prom_mode_en_set(struct aq_hw_s *aq_hw, uint32_t vlan_prom_mode_en) +hw_atl_rpf_vlan_prom_mode_en_set(struct aq_hw_s *aq_hw, + uint32_t vlan_prom_mode_en) { aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_VL_PROMIS_MODE_ADR, HW_ATL_RPF_VL_PROMIS_MODE_MSK, @@ -1029,7 +1038,8 @@ } void -hw_atl_rpf_vlan_untagged_act_set(struct aq_hw_s *aq_hw, uint32_t vlan_untagged_act) +hw_atl_rpf_vlan_untagged_act_set(struct aq_hw_s *aq_hw, + uint32_t vlan_untagged_act) { aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_VL_UNTAGGED_ACT_ADR, HW_ATL_RPF_VL_UNTAGGED_ACT_MSK, @@ -1038,7 +1048,8 @@ } void -hw_atl_rpf_vlan_flr_en_set(struct aq_hw_s *aq_hw, uint32_t vlan_flr_en, uint32_t filter) +hw_atl_rpf_vlan_flr_en_set(struct aq_hw_s *aq_hw, uint32_t vlan_flr_en, + uint32_t filter) { aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_VL_EN_F_ADR(filter), HW_ATL_RPF_VL_EN_F_MSK, @@ -1047,7 +1058,8 @@ } void -hw_atl_rpf_vlan_flr_act_set(struct aq_hw_s *aq_hw, uint32_t vlan_flr_act, uint32_t filter) +hw_atl_rpf_vlan_flr_act_set(struct aq_hw_s *aq_hw, uint32_t vlan_flr_act, + uint32_t filter) { aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_VL_ACT_F_ADR(filter), HW_ATL_RPF_VL_ACT_F_MSK, @@ -1056,7 +1068,8 @@ } void -hw_atl_rpf_vlan_id_flr_set(struct aq_hw_s *aq_hw, uint32_t vlan_id_flr, uint32_t filter) +hw_atl_rpf_vlan_id_flr_set(struct aq_hw_s *aq_hw, uint32_t vlan_id_flr, + uint32_t filter) { aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_VL_ID_F_ADR(filter), HW_ATL_RPF_VL_ID_F_MSK, @@ -1075,7 +1088,8 @@ } void -hw_atl_rpf_vlan_rxq_flr_set(struct aq_hw_s *aq_hw, uint32_t vlan_rxq, uint32_t filter) +hw_atl_rpf_vlan_rxq_flr_set(struct aq_hw_s *aq_hw, uint32_t vlan_rxq, + uint32_t filter) { aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_VL_RXQ_F_ADR(filter), HW_ATL_RPF_VL_RXQ_F_MSK, @@ -1084,7 +1098,8 @@ }; void -hw_atl_rpf_etht_flr_en_set(struct aq_hw_s *aq_hw, uint32_t etht_flr_en, uint32_t filter) +hw_atl_rpf_etht_flr_en_set(struct aq_hw_s *aq_hw, uint32_t etht_flr_en, + uint32_t filter) { aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_ET_ENF_ADR(filter), HW_ATL_RPF_ET_ENF_MSK, @@ -1101,8 +1116,8 @@ } void -hw_atl_rpf_etht_rx_queue_en_set(struct aq_hw_s *aq_hw, uint32_t etht_rx_queue_en, - uint32_t filter) +hw_atl_rpf_etht_rx_queue_en_set(struct aq_hw_s *aq_hw, + uint32_t etht_rx_queue_en, uint32_t filter) { aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_ET_RXQFEN_ADR(filter), HW_ATL_RPF_ET_RXQFEN_MSK, @@ -1111,8 +1126,8 @@ } void -hw_atl_rpf_etht_user_priority_set(struct aq_hw_s *aq_hw, uint32_t etht_user_priority, - uint32_t filter) +hw_atl_rpf_etht_user_priority_set(struct aq_hw_s *aq_hw, + uint32_t etht_user_priority, uint32_t filter) { aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_ET_UPF_ADR(filter), HW_ATL_RPF_ET_UPF_MSK, @@ -1148,7 +1163,8 @@ } void -hw_atl_rpf_etht_flr_set(struct aq_hw_s *aq_hw, uint32_t etht_flr, uint32_t filter) +hw_atl_rpf_etht_flr_set(struct aq_hw_s *aq_hw, uint32_t etht_flr, + uint32_t filter) { aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_ET_VALF_ADR(filter), HW_ATL_RPF_ET_VALF_MSK, @@ -1220,7 +1236,8 @@ } void -hw_atl_rpf_l3_l4_rxqf_en_set(struct aq_hw_s *aq_hw, uint32_t val, uint32_t filter) +hw_atl_rpf_l3_l4_rxqf_en_set(struct aq_hw_s *aq_hw, uint32_t val, + uint32_t filter) { aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_L3_L4_RXQF_EN_ADR(filter), HW_ATL_RPF_L3_L4_RXQF_EN_MSK, @@ -1228,7 +1245,8 @@ } void -hw_atl_rpf_l3_l4_mng_rxqf_set(struct aq_hw_s *aq_hw, uint32_t val, uint32_t filter) +hw_atl_rpf_l3_l4_mng_rxqf_set(struct aq_hw_s *aq_hw, uint32_t val, + uint32_t filter) { aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_L3_L4_MNG_RXQF_ADR(filter), HW_ATL_RPF_L3_L4_MNG_RXQF_MSK, @@ -1321,7 +1339,8 @@ } void -rpf_vlan_flr_act_set(struct aq_hw *aq_hw, uint32_t vlan_flr_act, uint32_t filter) +rpf_vlan_flr_act_set(struct aq_hw *aq_hw, uint32_t vlan_flr_act, + uint32_t filter) { AQ_WRITE_REG_BIT(aq_hw, rpf_vl_act_f_adr(filter), rpf_vl_act_f_msk, rpf_vl_act_f_shift, vlan_flr_act); @@ -1366,21 +1385,24 @@ } void -rpf_etht_rx_queue_set(struct aq_hw *aq_hw, uint32_t etht_rx_queue, uint32_t filter) +rpf_etht_rx_queue_set(struct aq_hw *aq_hw, uint32_t etht_rx_queue, + uint32_t filter) { AQ_WRITE_REG_BIT(aq_hw, rpf_et_rxqf_adr(filter), rpf_et_rxqf_msk, rpf_et_rxqf_shift, etht_rx_queue); } void -rpf_etht_mgt_queue_set(struct aq_hw *aq_hw, uint32_t etht_mgt_queue, uint32_t filter) +rpf_etht_mgt_queue_set(struct aq_hw *aq_hw, uint32_t etht_mgt_queue, + uint32_t filter) { AQ_WRITE_REG_BIT(aq_hw, rpf_et_mng_rxqf_adr(filter), rpf_et_mng_rxqf_msk, rpf_et_mng_rxqf_shift, etht_mgt_queue); } void -rpf_etht_flr_act_set(struct aq_hw *aq_hw, uint32_t etht_flr_act, uint32_t filter) +rpf_etht_flr_act_set(struct aq_hw *aq_hw, uint32_t etht_flr_act, + uint32_t filter) { AQ_WRITE_REG_BIT(aq_hw, rpf_et_actf_adr(filter), rpf_et_actf_msk, rpf_et_actf_shift, etht_flr_act); @@ -1565,14 +1587,16 @@ } void -tdm_tx_desc_dca_en_set(struct aq_hw *aq_hw, uint32_t tx_desc_dca_en, uint32_t dca) +tdm_tx_desc_dca_en_set(struct aq_hw *aq_hw, uint32_t tx_desc_dca_en, + uint32_t dca) { AQ_WRITE_REG_BIT(aq_hw, tdm_dcaddesc_en_adr(dca), tdm_dcaddesc_en_msk, tdm_dcaddesc_en_shift, tx_desc_dca_en); } void -tdm_tx_desc_en_set(struct aq_hw *aq_hw, uint32_t tx_desc_en, uint32_t descriptor) +tdm_tx_desc_en_set(struct aq_hw *aq_hw, uint32_t tx_desc_en, + uint32_t descriptor) { AQ_WRITE_REG_BIT(aq_hw, tdm_descden_adr(descriptor), tdm_descden_msk, tdm_descden_shift, tx_desc_en); @@ -1586,7 +1610,8 @@ } void -tdm_tx_desc_len_set(struct aq_hw *aq_hw, uint32_t tx_desc_len, uint32_t descriptor) +tdm_tx_desc_len_set(struct aq_hw *aq_hw, uint32_t tx_desc_len, + uint32_t descriptor) { AQ_WRITE_REG_BIT(aq_hw, tdm_descdlen_adr(descriptor), tdm_descdlen_msk, tdm_descdlen_shift, tx_desc_len); @@ -1721,7 +1746,8 @@ } void -tpo_tcp_udp_crc_offload_en_set(struct aq_hw *aq_hw, uint32_t tcp_udp_crc_offload_en) +tpo_tcp_udp_crc_offload_en_set(struct aq_hw *aq_hw, + uint32_t tcp_udp_crc_offload_en) { AQ_WRITE_REG_BIT(aq_hw, tpol4chk_en_adr, tpol4chk_en_msk, tpol4chk_en_shift, tcp_udp_crc_offload_en); @@ -1876,7 +1902,8 @@ uint32_t reg_glb_cpu_scratch_scp_get(struct aq_hw *hw, uint32_t glb_cpu_scratch_scp_idx) { - return AQ_READ_REG(hw, glb_cpu_scratch_scp_adr(glb_cpu_scratch_scp_idx)); + return AQ_READ_REG(hw, + glb_cpu_scratch_scp_adr(glb_cpu_scratch_scp_idx)); } void reg_glb_cpu_scratch_scp_set(struct aq_hw *aq_hw, uint32_t glb_cpu_scratch_scp, @@ -1892,7 +1919,8 @@ return AQ_READ_REG(hw, glb_cpu_no_reset_scratchpad_adr(index)); } void -reg_glb_cpu_no_reset_scratchpad_set(struct aq_hw* hw, uint32_t value, uint32_t index) +reg_glb_cpu_no_reset_scratchpad_set(struct aq_hw* hw, uint32_t value, + uint32_t index) { AQ_WRITE_REG(hw, glb_cpu_no_reset_scratchpad_adr(index), value); } diff --git a/sys/dev/aq/aq_media.c b/sys/dev/aq/aq_media.c --- a/sys/dev/aq/aq_media.c +++ b/sys/dev/aq/aq_media.c @@ -119,7 +119,9 @@ AQ_DBG_ENTERA("media 0x%x", user_media); if (!(ifm->ifm_media & IFM_ETHER)) { - device_printf(aq_dev->dev, "%s(): aq_dev interface - bad media: 0x%X", __FUNCTION__, ifm->ifm_media); + device_printf(aq_dev->dev, + "%s(): aq_dev interface - bad media: 0x%X", __FUNCTION__, + ifm->ifm_media); return (0); // should never happen } diff --git a/sys/dev/aq/aq_ring.c b/sys/dev/aq/aq_ring.c --- a/sys/dev/aq/aq_ring.c +++ b/sys/dev/aq/aq_ring.c @@ -107,9 +107,11 @@ rdm_rx_desc_len_set(hw, ring->rx_size / 8U, ring->index); - device_printf(ring->dev->dev, "ring %d: __PAGESIZE=%d MCLBYTES=%d hw->max_frame_size=%d\n", - ring->index, PAGE_SIZE, MCLBYTES, ring->rx_max_frame_size); - rdm_rx_desc_data_buff_size_set(hw, ring->rx_max_frame_size / 1024U, ring->index); + device_printf(ring->dev->dev, + "ring %d: __PAGESIZE=%d MCLBYTES=%d hw->max_frame_size=%d\n", + ring->index, PAGE_SIZE, MCLBYTES, ring->rx_max_frame_size); + rdm_rx_desc_data_buff_size_set(hw, ring->rx_max_frame_size / 1024U, + ring->index); rdm_rx_desc_head_buff_size_set(hw, 0U, ring->index); rdm_rx_desc_head_splitting_set(hw, 0U, ring->index); @@ -279,7 +281,8 @@ for (iter = 0, cnt = 0, i = idx; iter < ring->rx_size && cnt <= budget;) { - trace_aq_rx_descr(ring->index, i, (volatile uint64_t*)&rx_desc[i]); + trace_aq_rx_descr(ring->index, i, + (volatile uint64_t*)&rx_desc[i]); if (!rx_desc[i].wb.dd) break; @@ -309,8 +312,8 @@ static void aq_rx_set_cso_flags(aq_rx_desc_t *rx_desc, if_rxd_info_t ri) { - if ((rx_desc->wb.pkt_type & 0x3) == 0) { //IPv4 - if (rx_desc->wb.rx_cntl & BIT(0)){ // IPv4 csum checked + if ((rx_desc->wb.pkt_type & 0x3) == 0) { // IPv4 + if (rx_desc->wb.rx_cntl & BIT(0)) { // IPv4 csum checked ri->iri_csum_flags |= CSUM_IP_CHECKED; if (!(rx_desc->wb.rx_stat & BIT(1))) ri->iri_csum_flags |= CSUM_IP_VALID; @@ -355,7 +358,8 @@ do { rx_desc = (aq_rx_desc_t *) &ring->rx_descs[cidx]; - trace_aq_rx_descr(ring->index, cidx, (volatile uint64_t*)rx_desc); + trace_aq_rx_descr(ring->index, cidx, + (volatile uint64_t *)rx_desc); if ((rx_desc->wb.rx_stat & BIT(0)) != 0) { ring->stats.rx_err++; diff --git a/sys/dev/asmc/asmc.c b/sys/dev/asmc/asmc.c --- a/sys/dev/asmc/asmc.c +++ b/sys/dev/asmc/asmc.c @@ -287,6 +287,13 @@ ASMC_MBP114_TEMPS, ASMC_MBP114_TEMPNAMES, ASMC_MBP114_TEMPDESCS }, + { + "MacBookPro11,5", + "Apple SMC MacBook Pro Retina Core i7 (mid 2015, 15-inch, AMD GPU)", + ASMC_SMS_FUNCS_DISABLED, ASMC_FAN_FUNCS2, ASMC_LIGHT_FUNCS, + ASMC_MBP115_TEMPS, ASMC_MBP115_TEMPNAMES, ASMC_MBP115_TEMPDESCS + }, + /* The Mac Mini has no SMS */ { "Macmini1,1", "Apple SMC Mac Mini", diff --git a/sys/dev/asmc/asmcvar.h b/sys/dev/asmc/asmcvar.h --- a/sys/dev/asmc/asmcvar.h +++ b/sys/dev/asmc/asmcvar.h @@ -467,6 +467,41 @@ "Pbus", "Ambient Light", "Leftside", "Rightside", "CPU Package Core", \ "CPU Package GPU", "CPU Package Total", "System Total", "DC In" } +/* MacBookPro11,5 - same as 11,4 but without IBLC, ICMC, and IC2C keys */ +#define ASMC_MBP115_TEMPS { "IC0C", "ID0R", "IHDC", "IPBR", "IC0R", \ + "IO3R", "IO5R", "IM0C", "IC1C", \ + "IC3C", "ILDC", "IAPC", "IHSC", \ + "TC0P", "TP0P", "TM0P", \ + "Ta0P", "Th2H", "Th1H", "TW0P", "Ts0P", \ + "Ts1P", "TB0T", "TB1T", "TB2T", "TH0A", "TH0B", \ + "TC1C", "TC2C", "TC3C", "TC4C", "TCXC", \ + "TCGC", "TPCD", "TCSA", "VC0C", "VD0R", \ + "VP0R", "ALSL", "F0Ac", "F1Ac", "PCPC", \ + "PCPG", "PCPT", "PSTR", "PDTR", NULL } + + +#define ASMC_MBP115_TEMPNAMES { "IC0C", "ID0R", "IHDC", "IPBR", "IC0R", \ + "IO3R", "IO5R", "IM0C", "IC1C", \ + "IC3C", "ILDC", "IAPC", "IHSC", \ + "TC0P", "TP0P", "TM0P", \ + "Ta0P", "Th2H", "Th1H", "TW0P", "Ts0P", \ + "Ts1P", "TB0T", "TB1T", "TB2T", "TH0A", "TH0B", \ + "TC1C", "TC2C", "TC3C", "TC4C", "TCXC", \ + "TCGC", "TPCD", "TCSA", "VC0C", "VD0R", \ + "VP0R", "ALSL", "F0Ac", "F1Ac", "PCPC", \ + "PCPG", "PCPT", "PSTR", "PDTR" } + +#define ASMC_MBP115_TEMPDESCS { "CPU High (CPU, I/O)", "DC In", "SSD", "Charger (BMON)", "CPU", \ + "Other 3.3V", "Other 5V", "Memory", "Platform Controller Hub Core", \ + "CPU DDR", "LCD Panel", "Airport", "Thunderbolt", \ + "CPU Proximity", "Platform Controller Hub", "Memory Proximity", "Air Flow Proximity", \ + "Left Fin Stack", "Right Fin Stack", "Airport Proximity", "Palm Rest", "Palm Rest Actuator", \ + "Battery Max", "Battery Sensor 1", "Battery Sensor 2", "SSD A", "SSD B", \ + "CPU Core 1", "CPU Core 2", "CPU Core 3", "CPU Core 4", "CPU PECI Die", \ + "Intel GPU", "Platform Controller Hub PECI", "CPU System Agent Core", "CPU VCore", "DC In", \ + "Pbus", "Ambient Light", "Leftside", "Rightside", "CPU Package Core", \ + "CPU Package GPU", "CPU Package Total", "System Total", "DC In" } + #define ASMC_MM_TEMPS { "TN0P", "TN1P", NULL } #define ASMC_MM_TEMPNAMES { "northbridge1", "northbridge2" } #define ASMC_MM_TEMPDESCS { "Northbridge Point 1", \ diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c --- a/sys/dev/bge/if_bge.c +++ b/sys/dev/bge/if_bge.c @@ -3721,7 +3721,12 @@ if_setgetcounterfn(ifp, bge_get_counter); if_setsendqlen(ifp, BGE_TX_RING_CNT - 1); if_setsendqready(ifp); - if_sethwassist(ifp, sc->bge_csum_features); + /* Initially enable checksum offloading either for all of IPv4, TCP/IPv4 + * and UDP/IPv4, or for none. This avoids problems when the interface + * is added to a bridge. + */ + if (sc->bge_csum_features & CSUM_UDP) + if_sethwassist(ifp, sc->bge_csum_features); if_setcapabilities(ifp, IFCAP_HWCSUM | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU); if ((sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) != 0) { @@ -3732,6 +3737,13 @@ if_setcapabilitiesbit(ifp, IFCAP_VLAN_HWCSUM, 0); #endif if_setcapenable(ifp, if_getcapabilities(ifp)); + /* + * Disable TXCSUM capability initially, if UDP checksum offloading is + * not enabled. This avoids problems when the interface is added to a + * bridge. + */ + if ((sc->bge_csum_features & CSUM_UDP) == 0) + if_setcapenablebit(ifp, 0, IFCAP_TXCSUM); #ifdef DEVICE_POLLING if_setcapabilitiesbit(ifp, IFCAP_POLLING, 0); #endif diff --git a/sys/dev/clk/rockchip/rk_clk_fract.c b/sys/dev/clk/rockchip/rk_clk_fract.c --- a/sys/dev/clk/rockchip/rk_clk_fract.c +++ b/sys/dev/clk/rockchip/rk_clk_fract.c @@ -80,7 +80,7 @@ * http://en.wikipedia.org/wiki/Continued_fraction * * - n_input, d_input Given input fraction - * - n_max, d_max Maximum vaues of divider registers + * - n_max, d_max Maximum values of divider registers * - n_out, d_out Computed approximation */ diff --git a/sys/dev/dwc/dwc1000_core.c b/sys/dev/dwc/dwc1000_core.c --- a/sys/dev/dwc/dwc1000_core.c +++ b/sys/dev/dwc/dwc1000_core.c @@ -238,7 +238,7 @@ DWC_ASSERT_LOCKED(sc); reg = READ4(sc, MAC_CONFIGURATION); - if ((if_getcapenable(sc->ifp) & IFCAP_RXCSUM) != 0) + if ((if_getcapenable(sc->ifp) & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) != 0) reg |= CONF_IPC; else reg &= ~CONF_IPC; diff --git a/sys/dev/dwc/dwc1000_dma.c b/sys/dev/dwc/dwc1000_dma.c --- a/sys/dev/dwc/dwc1000_dma.c +++ b/sys/dev/dwc/dwc1000_dma.c @@ -248,7 +248,7 @@ struct bus_dma_segment segs[TX_MAP_MAX_SEGS]; int error, nsegs; struct mbuf * m; - uint32_t flags = 0; + uint32_t flags; int i; int last; @@ -276,19 +276,12 @@ m = *mp; - if ((m->m_pkthdr.csum_flags & CSUM_IP) != 0) { - if ((m->m_pkthdr.csum_flags & (CSUM_TCP|CSUM_UDP)) != 0) { - if (!sc->dma_ext_desc) - flags = NTDESC1_CIC_FULL; - else - flags = ETDESC0_CIC_FULL; - } else { - if (!sc->dma_ext_desc) - flags = NTDESC1_CIC_HDR; - else - flags = ETDESC0_CIC_HDR; - } - } + if ((m->m_pkthdr.csum_flags & (CSUM_DELAY_DATA | CSUM_DELAY_DATA_IPV6)) != 0) + flags = sc->dma_ext_desc ? ETDESC0_CIC_SEG : NTDESC1_CIC_SEG; + else if ((m->m_pkthdr.csum_flags & CSUM_IP) != 0) + flags = sc->dma_ext_desc ? ETDESC0_CIC_HDR : NTDESC1_CIC_HDR; + else + flags = sc->dma_ext_desc ? ETDESC0_CIC_NONE : NTDESC1_CIC_NONE; bus_dmamap_sync(sc->txbuf_tag, sc->txbuf_map[idx].map, BUS_DMASYNC_PREWRITE); @@ -397,8 +390,8 @@ m->m_len = len; if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); - if ((if_getcapenable(ifp) & IFCAP_RXCSUM) != 0 && - (rdesc0 & RDESC0_FT) != 0) { + if ((if_getcapenable(ifp) & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) != 0 && + (rdesc0 & RDESC0_FT) != 0) { m->m_pkthdr.csum_flags = CSUM_IP_CHECKED; if ((rdesc0 & RDESC0_ICE) == 0) m->m_pkthdr.csum_flags |= CSUM_IP_VALID; diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -263,14 +263,20 @@ /* No work to do except acknowledge the change took */ if_togglecapenable(ifp, IFCAP_VLAN_MTU); } - if (mask & IFCAP_RXCSUM) - if_togglecapenable(ifp, IFCAP_RXCSUM); + if (mask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) + if_togglecapenable(ifp, IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6); if (mask & IFCAP_TXCSUM) if_togglecapenable(ifp, IFCAP_TXCSUM); if ((if_getcapenable(ifp) & IFCAP_TXCSUM) != 0) - if_sethwassistbits(ifp, CSUM_IP | CSUM_UDP | CSUM_TCP, 0); + if_sethwassistbits(ifp, CSUM_IP | CSUM_DELAY_DATA, 0); else - if_sethwassistbits(ifp, 0, CSUM_IP | CSUM_UDP | CSUM_TCP); + if_sethwassistbits(ifp, 0, CSUM_IP | CSUM_DELAY_DATA); + if (mask & IFCAP_TXCSUM_IPV6) + if_togglecapenable(ifp, IFCAP_TXCSUM_IPV6); + if ((if_getcapenable(ifp) & IFCAP_TXCSUM_IPV6) != 0) + if_sethwassistbits(ifp, CSUM_DELAY_DATA_IPV6, 0); + else + if_sethwassistbits(ifp, 0, CSUM_DELAY_DATA_IPV6); if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { DWC_LOCK(sc); @@ -607,8 +613,8 @@ if_setinitfn(ifp, dwc_init); if_setsendqlen(ifp, TX_MAP_COUNT - 1); if_setsendqready(sc->ifp); - if_sethwassist(sc->ifp, CSUM_IP | CSUM_UDP | CSUM_TCP); - if_setcapabilities(sc->ifp, IFCAP_VLAN_MTU | IFCAP_HWCSUM); + if_sethwassist(sc->ifp, CSUM_IP | CSUM_DELAY_DATA | CSUM_DELAY_DATA_IPV6); + if_setcapabilities(sc->ifp, IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6); if_setcapenable(sc->ifp, if_getcapabilities(sc->ifp)); /* Attach the mii driver. */ diff --git a/sys/dev/iicbus/adc/ads111x.c b/sys/dev/iicbus/adc/ads111x.c --- a/sys/dev/iicbus/adc/ads111x.c +++ b/sys/dev/iicbus/adc/ads111x.c @@ -407,15 +407,15 @@ chantree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(devtree), OID_AUTO, chanstr, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "channel data"); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(chantree), OID_AUTO, - "gain_index", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, + "gain_index", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, sc, chan, ads111x_sysctl_gainidx, "I", "programmable gain amp setting, 0-7"); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(chantree), OID_AUTO, - "rate_index", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, + "rate_index", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, sc, chan, ads111x_sysctl_rateidx, "I", "sample rate setting, 0-7"); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(chantree), OID_AUTO, "voltage", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_SKIP | CTLFLAG_NEEDGIANT, sc, + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_SKIP | CTLFLAG_MPSAFE, sc, chan, ads111x_sysctl_voltage, "I", "sampled voltage in microvolts"); c->configured = true; @@ -565,13 +565,13 @@ ctx = device_get_sysctl_ctx(dev); tree = device_get_sysctl_tree(dev); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, - "config", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, sc, 0, + "config", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, sc, 0, ads111x_sysctl_config, "I", "configuration register word"); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, - "lo_thresh", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, sc, 0, + "lo_thresh", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, sc, 0, ads111x_sysctl_lothresh, "I", "comparator low threshold"); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, - "hi_thresh", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, sc, 0, + "hi_thresh", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, sc, 0, ads111x_sysctl_hithresh, "I", "comparator high threshold"); /* Set up channels based on metadata or default config. */ diff --git a/sys/dev/isl/isl.c b/sys/dev/isl/isl.c --- a/sys/dev/isl/isl.c +++ b/sys/dev/isl/isl.c @@ -202,7 +202,7 @@ if (use_als) { SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "als", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, ISL_METHOD_ALS, isl_sysctl, "I", "Current ALS sensor read-out"); } @@ -210,7 +210,7 @@ if (use_ir) { SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "ir", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, ISL_METHOD_IR, isl_sysctl, "I", "Current IR sensor read-out"); } @@ -218,20 +218,20 @@ if (use_prox) { SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "prox", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, ISL_METHOD_PROX, isl_sysctl, "I", "Current proximity sensor read-out"); } SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "resolution", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, ISL_METHOD_RESOLUTION, isl_sysctl, "I", "Current proximity sensor resolution"); SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "range", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, ISL_METHOD_RANGE, isl_sysctl, "I", "Current proximity sensor range"); diff --git a/sys/dev/jme/if_jme.c b/sys/dev/jme/if_jme.c --- a/sys/dev/jme/if_jme.c +++ b/sys/dev/jme/if_jme.c @@ -971,23 +971,23 @@ child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->jme_dev)); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "tx_coal_to", - CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, &sc->jme_tx_coal_to, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, &sc->jme_tx_coal_to, 0, sysctl_hw_jme_tx_coal_to, "I", "jme tx coalescing timeout"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "tx_coal_pkt", - CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, &sc->jme_tx_coal_pkt, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, &sc->jme_tx_coal_pkt, 0, sysctl_hw_jme_tx_coal_pkt, "I", "jme tx coalescing packet"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rx_coal_to", - CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, &sc->jme_rx_coal_to, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, &sc->jme_rx_coal_to, 0, sysctl_hw_jme_rx_coal_to, "I", "jme rx coalescing timeout"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rx_coal_pkt", - CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, &sc->jme_rx_coal_pkt, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, &sc->jme_rx_coal_pkt, 0, sysctl_hw_jme_rx_coal_pkt, "I", "jme rx coalescing packet"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "process_limit", - CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, &sc->jme_process_limit, 0, sysctl_hw_jme_proc_limit, "I", "max number of Rx events to process"); diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -1617,7 +1617,6 @@ 0, 0); swap_release_by_cred(IDX_TO_OFF(oldpages - newpages), sc->cred); - sc->s_swap.object->charge = IDX_TO_OFF(newpages); sc->s_swap.object->size = newpages; VM_OBJECT_WUNLOCK(sc->s_swap.object); } else if (newpages > oldpages) { @@ -1637,7 +1636,6 @@ } } VM_OBJECT_WLOCK(sc->s_swap.object); - sc->s_swap.object->charge = IDX_TO_OFF(newpages); sc->s_swap.object->size = newpages; VM_OBJECT_WUNLOCK(sc->s_swap.object); } diff --git a/sys/dev/mxge/if_mxge.c b/sys/dev/mxge/if_mxge.c --- a/sys/dev/mxge/if_mxge.c +++ b/sys/dev/mxge/if_mxge.c @@ -1804,7 +1804,7 @@ uint32_t low, high_swapped; int len, seglen, cum_len, cum_len_next; int next_is_first, chop, cnt, rdma_count, small; - uint16_t pseudo_hdr_offset, cksum_offset, mss, sum; + uint16_t pseudo_hdr_offset, cksum_offset, mss, sum = 0; uint8_t flags, flags_next; static int once; diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1877,8 +1877,10 @@ struct nvme_request *req) { struct nvme_qpair *qpair; + int32_t ioq; - qpair = &ctrlr->ioq[QP(ctrlr, curcpu)]; + ioq = req->ioq == NVME_IOQ_DEFAULT ? QP(ctrlr, curcpu) : req->ioq; + qpair = &ctrlr->ioq[ioq]; nvme_qpair_submit_request(qpair, req); } diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -112,7 +112,9 @@ struct memdesc payload; nvme_cb_fn_t cb_fn; void *cb_arg; - int32_t retries; + int16_t retries; + uint16_t ioq; +#define NVME_IOQ_DEFAULT 0xffff bool payload_valid; bool timeout; bool spare[2]; /* Future use */ @@ -491,6 +493,7 @@ req = malloc(sizeof(*req), M_NVME, how | M_ZERO); if (req != NULL) { + req->ioq = NVME_IOQ_DEFAULT; req->cb_fn = cb_fn; req->cb_arg = cb_arg; req->timeout = true; @@ -551,6 +554,22 @@ #define nvme_free_request(req) free(req, M_NVME) +static __inline void +nvme_request_set_ioq(struct nvme_controller *ctrlr, struct nvme_request *req, + uint16_t ioq) +{ + /* + * Note: NVMe queues are numbered 1-65535. The ioq here is numbered + * 0-65534 to avoid off-by-one bugs, with 65535 being reserved for + * DEFAULT. + */ + KASSERT(ioq == NVME_IOQ_DEFAULT || ioq < ctrlr->num_io_queues, + ("ioq %d out of range 0..%d", ioq, ctrlr->num_io_queues)); + if (ioq < 0 || ioq >= ctrlr->num_io_queues) + ioq = NVME_IOQ_DEFAULT; + req->ioq = ioq; +} + void nvme_notify_async(struct nvme_controller *ctrlr, const struct nvme_completion *async_cpl, uint32_t log_page_id, void *log_page_buffer, diff --git a/sys/dev/smartpqi/smartpqi_prototypes.h b/sys/dev/smartpqi/smartpqi_prototypes.h --- a/sys/dev/smartpqi/smartpqi_prototypes.h +++ b/sys/dev/smartpqi/smartpqi_prototypes.h @@ -167,10 +167,6 @@ rcb_t *, rcb_t *, int); int pqisrc_write_current_time_to_host_wellness(pqisrc_softstate_t *softs); int pqisrc_write_driver_version_to_host_wellness(pqisrc_softstate_t *softs); -extern inline void pqisrc_aio_build_cdb(aio_req_locator_t *, uint32_t, - rcb_t *, uint8_t *); -extern inline boolean_t pqisrc_aio_req_too_big(pqisrc_softstate_t *, pqi_scsi_dev_t *, - rcb_t const *, aio_req_locator_t *, uint32_t); void pqisrc_build_aio_common(pqisrc_softstate_t *, pqi_aio_req_t *, rcb_t *, uint32_t); void pqisrc_build_aio_R1_write(pqisrc_softstate_t *, diff --git a/sys/dev/smartpqi/smartpqi_request.c b/sys/dev/smartpqi/smartpqi_request.c --- a/sys/dev/smartpqi/smartpqi_request.c +++ b/sys/dev/smartpqi/smartpqi_request.c @@ -1492,7 +1492,7 @@ * handle based on dev type, Raid level, and encryption status. * TODO: make limits dynamic when this becomes possible. */ -inline boolean_t +static boolean_t pqisrc_aio_req_too_big(pqisrc_softstate_t *softs, pqi_scsi_dev_t *device, rcb_t const *rcb, aio_req_locator_t *l, uint32_t disk_blk_cnt) @@ -1636,7 +1636,7 @@ } /* build the aio cdb */ -inline void +static void pqisrc_aio_build_cdb(aio_req_locator_t *l, uint32_t disk_blk_cnt, rcb_t *rcb, uint8_t *cdb) { diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c --- a/sys/dev/sound/midi/midi.c +++ b/sys/dev/sound/midi/midi.c @@ -236,7 +236,7 @@ return (0); } - used = MIN(size, MIDIQ_LEN(m->outq)); + used = min(size, MIDIQ_LEN(m->outq)); if (used) MIDIQ_DEQ(m->outq, buf, used); if (MIDIQ_EMPTY(m->outq)) { @@ -387,13 +387,15 @@ * At this point, it is certain that m->inq has data */ - used = MIN(MIDIQ_LEN(m->inq), uio->uio_resid); - used = MIN(used, MIDI_RSIZE); + used = min(MIDIQ_LEN(m->inq), uio->uio_resid); + used = min(used, MIDI_RSIZE); MIDIQ_DEQ(m->inq, buf, used); + mtx_unlock(&m->lock); retval = uiomove(buf, used, uio); if (retval) - goto err1; + goto err0; + mtx_lock(&m->lock); } /* @@ -454,12 +456,14 @@ * We are certain than data can be placed on the queue */ - used = MIN(MIDIQ_AVAIL(m->outq), uio->uio_resid); - used = MIN(used, MIDI_WSIZE); + used = min(MIDIQ_AVAIL(m->outq), uio->uio_resid); + used = min(used, MIDI_WSIZE); + mtx_unlock(&m->lock); retval = uiomove(buf, used, uio); if (retval) - goto err1; + goto err0; + mtx_lock(&m->lock); MIDIQ_ENQ(m->outq, buf, used); /* * Inform the bottom half that data can be written diff --git a/sys/dev/sound/midi/midiq.h b/sys/dev/sound/midi/midiq.h --- a/sys/dev/sound/midi/midiq.h +++ b/sys/dev/sound/midi/midiq.h @@ -56,7 +56,7 @@ * No protection against overflow, underflow */ #define MIDIQ_ENQ(head, buf, size) do { \ - MIDIQ_MOVE(&(head).b[(head).h], (buf), sizeof(*(head).b) * MIN((size), (head).s - (head).h)); \ + MIDIQ_MOVE(&(head).b[(head).h], (buf), sizeof(*(head).b) * min((size), (head).s - (head).h)); \ if( (head).s - (head).h < (size) ) { \ MIDIQ_MOVE((head).b, (buf) + (head).s - (head).h, sizeof(*(head).b) * ((size) - (head).s + (head).h) ); \ } \ @@ -67,7 +67,7 @@ #define MIDIQ_DEQ_I(head, buf, size, move, update) do { \ if(MIDIQ_FULL(head)) (head).h=(head).t; \ - if (move) MIDIQ_MOVE((buf), &(head).b[(head).t], sizeof(*(head).b) * MIN((size), (head).s - (head).t)); \ + if (move) MIDIQ_MOVE((buf), &(head).b[(head).t], sizeof(*(head).b) * min((size), (head).s - (head).t)); \ if( (head).s - (head).t < (size) ) { \ if (move) MIDIQ_MOVE((buf) + (head).s - (head).t, (head).b, sizeof(*(head).b) * ((size) - (head).s + (head).t) ); \ } \ diff --git a/sys/dev/sound/pci/cs4281.c b/sys/dev/sound/pci/cs4281.c --- a/sys/dev/sound/pci/cs4281.c +++ b/sys/dev/sound/pci/cs4281.c @@ -350,7 +350,7 @@ /* 2 interrupts are possible and used in buffer (half-empty,empty), * hence factor of 2. */ - ch->blksz = MIN(blocksize, sc->bufsz / 2); + ch->blksz = min(blocksize, sc->bufsz / 2); sndbuf_resize(ch->buffer, 2, ch->blksz); ch->dma_setup = 0; adcdac_prog(ch); diff --git a/sys/dev/sound/pci/hdspe-pcm.c b/sys/dev/sound/pci/hdspe-pcm.c --- a/sys/dev/sound/pci/hdspe-pcm.c +++ b/sys/dev/sound/pci/hdspe-pcm.c @@ -474,7 +474,7 @@ channels = hdspe_channel_count(ports, pcm_width); /* Only copy as much as supported by both hardware and pcm channel. */ - slots = hdspe_port_slot_width(subset, MIN(adat_width, pcm_width)); + slots = hdspe_port_slot_width(subset, min(adat_width, pcm_width)); /* Let the compiler inline and loop unroll common cases. */ if (slots == 2) @@ -520,7 +520,7 @@ channels = hdspe_channel_count(ports, pcm_width); /* Only copy as much as supported by both hardware and pcm channel. */ - slots = hdspe_port_slot_width(subset, MIN(adat_width, pcm_width)); + slots = hdspe_port_slot_width(subset, min(adat_width, pcm_width)); /* Let the compiler inline and loop unroll common cases. */ if (slots == 2) diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -150,7 +150,7 @@ #define UAUDIO_NCHANBUFS 2 /* number of outstanding request */ #define UAUDIO_RECURSE_LIMIT 255 /* rounds */ #define UAUDIO_BITS_MAX 32 /* maximum sample size in bits */ -#define UAUDIO_CHANNELS_MAX MIN(64, AFMT_CHANNEL_MAX) +#define UAUDIO_CHANNELS_MAX min(64, AFMT_CHANNEL_MAX) #define UAUDIO_MATRIX_MAX 8 /* channels */ #define MAKE_WORD(h,l) (((h) << 8) | (l)) @@ -1651,7 +1651,7 @@ * buffer. Try using a larger buffer and see if that * helps: */ - rates = MIN(UAUDIO20_MAX_RATES, (255 - 2) / 12); + rates = min(UAUDIO20_MAX_RATES, (255 - 2) / 12); error = USB_ERR_INVAL; } else { rates = UGETW(data); diff --git a/sys/dev/usb/wlan/if_mtw.c b/sys/dev/usb/wlan/if_mtw.c --- a/sys/dev/usb/wlan/if_mtw.c +++ b/sys/dev/usb/wlan/if_mtw.c @@ -64,6 +64,7 @@ #include #include +#include #include "usbdevs.h" @@ -525,6 +526,15 @@ sc->sc_dev = self; sc->sc_sent = 0; + /* + * Reset the device to clear any stale state left over from + * a previous warm reboot. Some MT7601U devices fail otherwise. + */ + error = usbd_req_re_enumerate(uaa->device, NULL); + if (error != 0) + device_printf(self, "USB re-enumerate failed, continuing\n"); + DELAY(100000); /* 100ms settle time */ + mtx_init(&sc->sc_mtx, device_get_nameunit(sc->sc_dev), MTX_NETWORK_LOCK, MTX_DEF); @@ -585,7 +595,7 @@ sc->mac_rev = tmp & 0xffff; mtw_load_microcode(sc); - ret = msleep(&sc->fwloading, &sc->sc_mtx, 0, "fwload", 3 * hz); + ret = msleep(&sc->fwloading, &sc->sc_mtx, 0, "fwload", 10 * hz); if (ret == EWOULDBLOCK || sc->fwloading != 1) { device_printf(sc->sc_dev, "timeout waiting for MCU to initialize\n"); @@ -1105,11 +1115,22 @@ // int ntries; int dlen, ilen; device_printf(sc->sc_dev, "version:0x%hx\n", sc->asic_ver); - /* is firmware already running? */ + /* + * Firmware may still be running from a previous warm reboot. + * Force a reset of the MCU to ensure a clean state. + */ mtw_read_cfg(sc, MTW_MCU_DMA_ADDR, &tmp); if (tmp == MTW_MCU_READY) { - return; + device_printf(sc->sc_dev, "MCU already running, resetting\n"); + mtw_write(sc, MTW_MCU_RESET_CTL, MTW_RESET); + DELAY(10000); + mtw_write(sc, MTW_MCU_RESET_CTL, 0); + DELAY(10000); + /* Clear ready flag */ + mtw_write_cfg(sc, MTW_MCU_DMA_ADDR, 0); + DELAY(1000); } + if (sc->asic_ver == 0x7612) { fwname = "mtw-mt7662u_rom_patch"; @@ -2856,7 +2877,7 @@ } mtw_delay(sc, 10); - for (ntries = 0; ntries < 100; ntries++) { + for (ntries = 0; ntries < 300; ntries++) { if ((error = mtw_read_cfg(sc, MTW_MCU_DMA_ADDR, &tmp)) != 0) { device_printf(sc->sc_dev, @@ -2870,9 +2891,9 @@ break; } - mtw_delay(sc, 10); + mtw_delay(sc, 30); } - if (ntries == 100) + if (ntries == 300) sc->fwloading = 0; wakeup(&sc->fwloading); return; diff --git a/sys/dev/vt/vt.h b/sys/dev/vt/vt.h --- a/sys/dev/vt/vt.h +++ b/sys/dev/vt/vt.h @@ -81,7 +81,6 @@ #else #define DPRINTF(_l, ...) do {} while (0) #endif -#define ISSIGVALID(sig) ((sig) > 0 && (sig) < NSIG) #define VT_SYSCTL_INT(_name, _default, _descr) \ int vt_##_name = (_default); \ diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -3046,9 +3046,9 @@ DPRINTF(5, "reset WAIT_ACQ, "); return (0); } else if (mode->mode == VT_PROCESS) { - if (!(ISSIGVALID(mode->relsig) && - ISSIGVALID(mode->acqsig) && - (mode->frsig == 0 || ISSIGVALID(mode->frsig)))) { + if (!(_SIG_VALID(mode->relsig) && + _SIG_VALID(mode->acqsig) && + (mode->frsig == 0 || _SIG_VALID(mode->frsig)))) { DPRINTF(5, "error EINVAL\n"); return (EINVAL); } diff --git a/sys/fs/nfs/nfs.h b/sys/fs/nfs/nfs.h --- a/sys/fs/nfs/nfs.h +++ b/sys/fs/nfs/nfs.h @@ -872,6 +872,11 @@ #define SUPPACL_NFSV4 1 #define SUPPACL_POSIX 2 +/* Values NFSv4 uses for exclusive_flag. */ +#define NFSV4_EXCLUSIVE_NONE 0 +#define NFSV4_EXCLUSIVE 1 +#define NFSV4_EXCLUSIVE_41 2 + #endif /* _KERNEL */ #endif /* _NFS_NFS_H */ diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -410,7 +410,7 @@ int nfsrv_checkuidgid(struct nfsrv_descript *, struct nfsvattr *); void nfsrv_fixattr(struct nfsrv_descript *, vnode_t, struct nfsvattr *, NFSACL_T *, NFSACL_T *, NFSPROC_T *, nfsattrbit_t *, - struct nfsexstuff *); + bool); int nfsrv_errmoved(int); int nfsrv_putreferralattr(struct nfsrv_descript *, nfsattrbit_t *, struct nfsreferral *, int, int *); diff --git a/sys/fs/nfs/nfsdport.h b/sys/fs/nfs/nfsdport.h --- a/sys/fs/nfs/nfsdport.h +++ b/sys/fs/nfs/nfsdport.h @@ -46,6 +46,8 @@ #define NFSVNO_ISSETATIME(n) ((n)->na_atime.tv_sec != VNOVAL) #define NFSVNO_NOTSETMTIME(n) ((n)->na_mtime.tv_sec == VNOVAL) #define NFSVNO_ISSETMTIME(n) ((n)->na_mtime.tv_sec != VNOVAL) +#define NFSVNO_NOTSETFLAGS(n) ((n)->na_flags == VNOVAL) +#define NFSVNO_ISSETFLAGS(n) ((n)->na_flags != VNOVAL) /* * This structure acts as a "catch-all" for information that diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -1972,6 +1972,7 @@ NFSACL_T *aclp, NFSACL_T *daclp, nfsattrbit_t *attrbitp, struct ucred *cred, bool done_namei, struct nfsexstuff *exp, struct vnode **vpp) { + struct vattr va; struct vnode *vp = NULL; u_quad_t tempsize; struct nfsexstuff nes; @@ -2018,23 +2019,52 @@ &ndp->ni_vp : NULL, false); nfsvno_relpathbuf(ndp); if (!nd->nd_repstat) { - if (*exclusive_flagp) { - *exclusive_flagp = 0; - NFSVNO_ATTRINIT(nvap); - nvap->na_atime.tv_sec = cverf[0]; - nvap->na_atime.tv_nsec = cverf[1]; + if (*exclusive_flagp != NFSV4_EXCLUSIVE_NONE) { + VATTR_NULL(&va); + va.va_atime.tv_sec = cverf[0]; + va.va_atime.tv_nsec = cverf[1]; nd->nd_repstat = VOP_SETATTR(ndp->ni_vp, - &nvap->na_vattr, cred); + &va, cred); if (nd->nd_repstat != 0) { vput(ndp->ni_vp); ndp->ni_vp = NULL; nd->nd_repstat = NFSERR_NOTSUPP; - } else + } else { + /* + * Few clients set these + * attributes in Open/Create + * Exclusive_41. If this + * changes, this should include + * setting atime, instead of + * the above. + */ + if (*exclusive_flagp == + NFSV4_EXCLUSIVE_41 && + (NFSISSET_ATTRBIT(attrbitp, + NFSATTRBIT_OWNER) || + NFSISSET_ATTRBIT(attrbitp, + NFSATTRBIT_OWNERGROUP) || + NFSISSET_ATTRBIT(attrbitp, + NFSATTRBIT_TIMEMODIFYSET)|| + NFSISSET_ATTRBIT(attrbitp, + NFSATTRBIT_ARCHIVE) || + NFSISSET_ATTRBIT(attrbitp, + NFSATTRBIT_HIDDEN) || + NFSISSET_ATTRBIT(attrbitp, + NFSATTRBIT_SYSTEM) || + aclp != NULL || + daclp != NULL)) + nfsrv_fixattr(nd, + ndp->ni_vp, nvap, + aclp, daclp, p, + attrbitp, true); NFSSETBIT_ATTRBIT(attrbitp, NFSATTRBIT_TIMEACCESS); + } + *exclusive_flagp = NFSV4_EXCLUSIVE_NONE; } else { nfsrv_fixattr(nd, ndp->ni_vp, nvap, - aclp, daclp, p, attrbitp, exp); + aclp, daclp, p, attrbitp, false); } } vp = ndp->ni_vp; diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -1608,7 +1608,7 @@ nd->nd_repstat = nfsvno_mknod(&named, &nva, nd->nd_cred, p); if (!nd->nd_repstat) { vp = named.ni_vp; - nfsrv_fixattr(nd, vp, &nva, aclp, daclp, p, &attrbits, exp); + nfsrv_fixattr(nd, vp, &nva, aclp, daclp, p, &attrbits, false); nd->nd_repstat = nfsvno_getfh(vp, fhp, p); if ((nd->nd_flag & ND_NFSV3) && !nd->nd_repstat) nd->nd_repstat = nfsvno_getattr(vp, &nva, nd, p, 1, @@ -2120,7 +2120,7 @@ !(nd->nd_flag & ND_NFSV2), nd->nd_saveduid, nd->nd_cred, p, exp); if (!nd->nd_repstat && !(nd->nd_flag & ND_NFSV2)) { nfsrv_fixattr(nd, ndp->ni_vp, nvap, aclp, NULL, p, attrbitp, - exp); + false); if (nd->nd_flag & ND_NFSV3) { nd->nd_repstat = nfsvno_getfh(ndp->ni_vp, fhp, p); if (!nd->nd_repstat) @@ -2255,7 +2255,7 @@ nd->nd_cred, p, exp); if (!nd->nd_repstat) { vp = ndp->ni_vp; - nfsrv_fixattr(nd, vp, nvap, aclp, daclp, p, attrbitp, exp); + nfsrv_fixattr(nd, vp, nvap, aclp, daclp, p, attrbitp, false); nd->nd_repstat = nfsvno_getfh(vp, fhp, p); if (!(nd->nd_flag & ND_NFSV4) && !nd->nd_repstat) nd->nd_repstat = nfsvno_getattr(vp, nvap, nd, p, 1, @@ -2964,7 +2964,8 @@ u_int32_t *tl; int i, retext; struct nfsstate *stp = NULL; - int error = 0, create, claim, exclusive_flag = 0, override; + int error = 0, create, claim, override; + int exclusive_flag = NFSV4_EXCLUSIVE_NONE; u_int32_t rflags = NFSV4OPEN_LOCKTYPEPOSIX, acemask; int how = NFSCREATE_UNCHECKED; int32_t cverf[2], tverf[2] = { 0, 0 }; @@ -3229,6 +3230,7 @@ case NFSCREATE_EXCLUSIVE: if (nd->nd_repstat == 0 && named.ni_vp == NULL) nva.na_mode = 0; + exclusive_flag = NFSV4_EXCLUSIVE; /* FALLTHROUGH */ case NFSCREATE_EXCLUSIVE41: if (nd->nd_repstat == 0 && named.ni_vp != NULL) { @@ -3244,7 +3246,8 @@ if (nd->nd_repstat != 0) done_namei = true; } - exclusive_flag = 1; + if (how == NFSCREATE_EXCLUSIVE41) + exclusive_flag = NFSV4_EXCLUSIVE_41; break; } } diff --git a/sys/fs/nfsserver/nfs_nfsdsubs.c b/sys/fs/nfsserver/nfs_nfsdsubs.c --- a/sys/fs/nfsserver/nfs_nfsdsubs.c +++ b/sys/fs/nfsserver/nfs_nfsdsubs.c @@ -1645,7 +1645,7 @@ void nfsrv_fixattr(struct nfsrv_descript *nd, vnode_t vp, struct nfsvattr *nvap, NFSACL_T *aclp, NFSACL_T *daclp, NFSPROC_T *p, - nfsattrbit_t *attrbitp, struct nfsexstuff *exp) + nfsattrbit_t *attrbitp, bool atime_done) { int change = 0; struct nfsvattr nva; @@ -1675,7 +1675,7 @@ } } if (NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_TIMEACCESSSET) && - NFSVNO_ISSETATIME(nvap)) { + !atime_done && NFSVNO_ISSETATIME(nvap)) { nva.na_atime = nvap->na_atime; change++; NFSSETBIT_ATTRBIT(&nattrbits, NFSATTRBIT_TIMEACCESSSET); @@ -1736,7 +1736,7 @@ } } if (change) { - error = nfsvno_setattr(vp, &nva, nd->nd_cred, p, exp); + error = nfsvno_setattr(vp, &nva, nd->nd_cred, p, NULL); if (error) { NFSCLRALL_ATTRBIT(attrbitp, &nattrbits); } diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -1071,7 +1071,7 @@ * forwarded VOP reacquires the base vnode lock the unionfs vnode * lock will no longer be held. This can lead to violation of the * caller's sychronization requirements as well as various failed - * locking assertions when DEBUG_VFS_LOCKS is enabled. + * locking assertions when INVARIANTS is enabled. * 2) Loss of reference on the base vnode. The caller is expected to * hold a v_usecount reference on the unionfs vnode, while the * unionfs vnode holds a reference on the base-layer vnode(s). But diff --git a/sys/i386/conf/MINIMAL b/sys/i386/conf/MINIMAL --- a/sys/i386/conf/MINIMAL +++ b/sys/i386/conf/MINIMAL @@ -114,7 +114,6 @@ # vt is the default video console driver device vt device vt_vga -device vt_efifb device vt_vbefb device agp # support several AGP chipsets @@ -139,6 +138,7 @@ device vtnet # VirtIO Ethernet device device virtio_blk # VirtIO Block device device virtio_balloon # VirtIO Memory Balloon device +device virtio_scsi # VirtIO SCSI device # Linux KVM paravirtualization support device kvm_clock # KVM paravirtual clock driver diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -79,6 +80,8 @@ #endif /* DDB */ #include +#include +#include #define PRISON0_HOSTUUID_MODULE "hostuuid" @@ -275,8 +278,17 @@ uint8_t *file, *data; size_t size; char buf[sizeof(prison0.pr_hostuuid)]; +#ifdef MAC + int error __diagused; +#endif bool valid; +#ifdef MAC + error = mac_prison_init(&prison0, M_WAITOK); + MPASS(error == 0); + + mtx_unlock(&prison0.pr_mtx); +#endif prison0.pr_cpuset = cpuset_ref(thread0.td_cpuset); prison0.pr_osreldate = osreldate; strlcpy(prison0.pr_osrelease, osrelease, sizeof(prison0.pr_osrelease)); @@ -1017,6 +1029,10 @@ #endif unsigned long hid; size_t namelen, onamelen, pnamelen; +#ifdef MAC + void *mac_set_prison_data = NULL; + int gotmaclabel; +#endif int created, cuflags, descend, drflags, enforce; int error, errmsg_len, errmsg_pos; int gotchildmax, gotenforce, gothid, gotrsnum, gotslevel; @@ -1339,6 +1355,17 @@ pr_flags |= PR_HOST; } +#ifdef MAC + /* Process the mac.label vfsopt */ + error = mac_set_prison_prepare(td, opts, &mac_set_prison_data); + if (error == ENOENT) + gotmaclabel = 0; + else if (error != 0) + goto done_errmsg; + else + gotmaclabel = 1; +#endif + #ifdef INET error = vfs_getopt(opts, "ip4.addr", &op, &ip4s); if (error == ENOENT) @@ -1692,6 +1719,11 @@ /* If there's no prison to update, create a new one and link it in. */ created = pr == NULL; if (created) { +#ifdef MAC + error = mac_prison_check_create(td->td_ucred, opts, flags); + if (error != 0) + goto done_deref; +#endif for (tpr = mypr; tpr != NULL; tpr = tpr->pr_parent) if (tpr->pr_childcount >= tpr->pr_childmax) { error = EPERM; @@ -1828,7 +1860,14 @@ if (error) goto done_deref; +#ifdef MAC + error = mac_prison_init(pr, M_WAITOK); + MPASS(error == 0); + + mtx_assert(&pr->pr_mtx, MA_OWNED); +#else mtx_lock(&pr->pr_mtx); +#endif drflags |= PD_LOCKED; } else { /* @@ -1839,6 +1878,11 @@ prison_hold(pr); drflags |= PD_DEREF; } +#ifdef MAC + error = mac_prison_check_set(td->td_ucred, pr, opts, flags); + if (error != 0) + goto done_deref; +#endif #if defined(VIMAGE) && (defined(INET) || defined(INET6)) if ((pr->pr_flags & PR_VNET) && (ch_flags & (PR_IP4_USER | PR_IP6_USER))) { @@ -2155,6 +2199,17 @@ } } pr->pr_flags = (pr->pr_flags & ~ch_flags) | pr_flags; + +#ifdef MAC + /* Apply any request MAC label before we let modules do their work. */ + if (gotmaclabel) { + error = mac_set_prison_core(td, pr, mac_set_prison_data); + if (error) { + vfs_opterror(opts, "mac relabel denied"); + goto done_deref; + } + } +#endif mtx_unlock(&pr->pr_mtx); drflags &= ~PD_LOCKED; /* @@ -2230,6 +2285,13 @@ if (created) { sx_assert(&allprison_lock, SX_XLOCKED); prison_knote(ppr, NOTE_JAIL_CHILD | pr->pr_id); +#ifdef MAC + /* + * Note that mac_prison_created() assumes that it's called in a + * sleepable context. + */ + mac_prison_created(td->td_ucred, pr); +#endif mtx_lock(&pr->pr_mtx); drflags |= PD_LOCKED; pr->pr_state = PRISON_STATE_ALIVE; @@ -2237,6 +2299,14 @@ /* Attach this process to the prison if requested. */ if (flags & JAIL_ATTACH) { +#ifdef MAC + error = mac_prison_check_attach(td->td_ucred, pr); + if (error != 0) { + vfs_opterror(opts, + "attach operation denied by MAC policy"); + goto done_deref; + } +#endif error = do_jail_attach(td, pr, prison_lock_xlock(pr, drflags & PD_LOCK_FLAGS)); drflags &= ~(PD_LOCKED | PD_LIST_XLOCKED); @@ -2328,6 +2398,10 @@ #endif #ifdef INET6 prison_ip_free(ip6); +#endif +#ifdef MAC + if (mac_set_prison_data != NULL) + mac_set_prison_finish(td, error == 0, mac_set_prison_data); #endif if (jfp_out != NULL) fdrop(jfp_out, td); @@ -2540,12 +2614,6 @@ drflags |= PD_DEREF; mtx_lock(&pr->pr_mtx); drflags |= PD_LOCKED; - if (!(prison_isalive(pr) || (flags & JAIL_DYING))) { - error = ENOENT; - vfs_opterror(opts, "jail %d is dying", - pr->pr_id); - goto done; - } goto found_prison; } if (flags & JAIL_AT_DESC) { @@ -2577,7 +2645,29 @@ prison_ischild(mypr, pr)) { mtx_lock(&pr->pr_mtx); drflags |= PD_LOCKED; +#ifdef MAC + /* + * We special-case this one check because we + * don't want MAC to break jail enumeration. We + * need to just move on to the next accessible + * and alive prison. + */ + error = mac_prison_check_get(td->td_ucred, pr, + opts, flags); + if (error != 0) { + mtx_unlock(&pr->pr_mtx); + drflags &= ~PD_LOCKED; + continue; + } + + /* + * Avoid potentially expensive trip back into + * the MAC framework. + */ + goto found_prison_nomac_alive; +#else goto found_prison; +#endif } } error = ENOENT; @@ -2592,13 +2682,6 @@ pr = prison_find_child(mypr, jid); if (pr != NULL) { drflags |= PD_LOCKED; - if (!(prison_isalive(pr) || - (flags & JAIL_DYING))) { - error = ENOENT; - vfs_opterror(opts, "jail %d is dying", - jid); - goto done; - } goto found_prison; } error = ENOENT; @@ -2617,12 +2700,6 @@ pr = prison_find_name(mypr, name); if (pr != NULL) { drflags |= PD_LOCKED; - if (!(prison_isalive(pr) || (flags & JAIL_DYING))) { - error = ENOENT; - vfs_opterror(opts, "jail \"%s\" is dying", - name); - goto done; - } goto found_prison; } error = ENOENT; @@ -2636,6 +2713,25 @@ goto done; found_prison: +#ifdef MAC + error = mac_prison_check_get(td->td_ucred, pr, opts, flags); + if (error != 0) + goto done; +#endif + if (!(prison_isalive(pr) || (flags & JAIL_DYING))) { + error = ENOENT; + if (pr->pr_name[0] != '0' && isdigit(pr->pr_name[0])) { + vfs_opterror(opts, "jail %d is dying", + pr->pr_id); + } else { + vfs_opterror(opts, "jail \"%s\" (%d) is dying", + pr->pr_name, pr->pr_id); + } + goto done; + } +#ifdef MAC + found_prison_nomac_alive: +#endif /* Get the parameters of the prison. */ if (!(drflags & PD_DEREF)) { prison_hold(pr); @@ -2771,9 +2867,22 @@ if (error != 0 && error != ENOENT) goto done; - /* Get the module parameters. */ +#ifdef MAC + /* + * We get the MAC label last because we'll let the MAC framework drop + * pr_mtx to externalize the label. + */ + error = mac_get_prison(td, pr, opts); + mtx_assert(&pr->pr_mtx, MA_NOTOWNED); + drflags &= ~PD_LOCKED; + if (error != 0 && error != ENOENT) + goto done; +#else mtx_unlock(&pr->pr_mtx); drflags &= ~PD_LOCKED; +#endif + + /* Get the module parameters. */ error = osd_jail_call(pr, PR_METHOD_GET, opts); if (error) goto done; @@ -2875,6 +2984,14 @@ sx_xunlock(&allprison_lock); return (EINVAL); } +#ifdef MAC + error = mac_prison_check_remove(td->td_ucred, pr); + if (error != 0) { + mtx_unlock(&pr->pr_mtx); + sx_xunlock(&allprison_lock); + return (error); + } +#endif prison_hold(pr); prison_remove(pr); return (0); @@ -2897,6 +3014,10 @@ return (error); error = priv_check_cred(jdcred, PRIV_JAIL_REMOVE); crfree(jdcred); +#ifdef MAC + if (error == 0) + error = mac_prison_check_remove(td->td_ucred, pr); +#endif if (error) { prison_free(pr); return (error); @@ -2941,14 +3062,25 @@ return (EINVAL); } +#ifdef MAC + error = mac_prison_check_attach(td->td_ucred, pr); + if (error != 0) + goto unlock; +#endif + /* Do not allow a process to attach to a prison that is not alive. */ if (!prison_isalive(pr)) { - mtx_unlock(&pr->pr_mtx); - sx_sunlock(&allprison_lock); - return (EINVAL); + error = EINVAL; + goto unlock; } return (do_jail_attach(td, pr, PD_LOCKED | PD_LIST_SLOCKED)); + +unlock: + + mtx_unlock(&pr->pr_mtx); + sx_sunlock(&allprison_lock); + return (error); } /* @@ -2970,6 +3102,10 @@ goto fail; drflags |= PD_DEREF; error = priv_check_cred(jdcred, PRIV_JAIL_ATTACH); +#ifdef MAC + if (error == 0) + error = mac_prison_check_attach(td->td_ucred, pr); +#endif crfree(jdcred); if (error) goto fail; @@ -3070,6 +3206,13 @@ prison_deref(oldcred->cr_prison, drflags); crfree(oldcred); prison_knote(pr, NOTE_JAIL_ATTACH | td->td_proc->p_pid); +#ifdef MAC + /* + * Note that mac_prison_attached() assumes that it's called in a + * sleepable context. + */ + mac_prison_attached(td->td_ucred, pr, td->td_proc); +#endif /* * If the prison was killed while changing credentials, die along @@ -3540,6 +3683,16 @@ KASSERT( refcount_load(&prison0.pr_ref) != 0, ("prison0 pr_ref=0")); +#ifdef MAC + /* + * The MAC framework will call into any + * policies that want to hook + * prison_destroy_label, so ideally we + * call this prior to any final state + * invalidation to be safe. + */ + mac_prison_destroy(pr); +#endif pr->pr_state = PRISON_STATE_INVALID; TAILQ_REMOVE(&allprison, pr, pr_list); LIST_REMOVE(pr, pr_sibling); @@ -4999,6 +5152,11 @@ SYSCTL_JAIL_PARAM_NODE(cpuset, "Jail cpuset"); SYSCTL_JAIL_PARAM(_cpuset, id, CTLTYPE_INT | CTLFLAG_RD, "I", "Jail cpuset ID"); +#ifdef MAC +SYSCTL_JAIL_PARAM_STRUCT(_mac, label, CTLFLAG_RW, sizeof(struct mac), + "S,mac", "Jail MAC label"); +#endif + #ifdef INET SYSCTL_JAIL_PARAM_SYS_NODE(ip4, CTLFLAG_RDTUN, "Jail IPv4 address virtualization"); diff --git a/sys/kern/kern_jaildesc.c b/sys/kern/kern_jaildesc.c --- a/sys/kern/kern_jaildesc.c +++ b/sys/kern/kern_jaildesc.c @@ -72,42 +72,66 @@ }; /* - * Given a jail descriptor number, return its prison and/or its - * credential. They are returned held, and will need to be released - * by the caller. + * Retrieve a prison from a jail descriptor. If prp is not NULL, then the + * prison will be held and subsequently returned, and must be released by the + * caller. This differs from jaildesc_get_prison in that it doesn't actually + * require the caller to take the struct prison, which we use internally when + * the caller doesn't necessarily need it- it might just want to check validity. */ -int -jaildesc_find(struct thread *td, int fd, struct prison **prp, - struct ucred **ucredp) +static int +jaildesc_get_prison_impl(struct file *fp, struct prison **prp) { - struct file *fp; - struct jaildesc *jd; struct prison *pr; - int error; + struct jaildesc *jd; + + if (fp->f_type != DTYPE_JAILDESC) + return (EINVAL); - error = fget(td, fd, &cap_no_rights, &fp); - if (error != 0) - return (error); - if (fp->f_type != DTYPE_JAILDESC) { - error = EINVAL; - goto out; - } jd = fp->f_data; JAILDESC_LOCK(jd); pr = jd->jd_prison; if (pr == NULL || !prison_isvalid(pr)) { - error = ENOENT; JAILDESC_UNLOCK(jd); - goto out; + return (ENOENT); } + if (prp != NULL) { prison_hold(pr); *prp = pr; } + JAILDESC_UNLOCK(jd); - if (ucredp != NULL) - *ucredp = crhold(fp->f_cred); - out: + + return (0); +} + +/* + * Given a jail descriptor number, return its prison and/or its + * credential. They are returned held, and will need to be released + * by the caller. + */ +int +jaildesc_find(struct thread *td, int fd, struct prison **prp, + struct ucred **ucredp) +{ + struct file *fp; + int error; + + error = fget(td, fd, &cap_no_rights, &fp); + if (error != 0) + return (error); + + error = jaildesc_get_prison_impl(fp, prp); + if (error == 0) { + /* + * jaildesc_get_prison validated the file and held the prison + * for us if the caller wants it, so we just need to grab the + * ucred on the way out. + */ + if (ucredp != NULL) + *ucredp = crhold(fp->f_cred); + } + fdrop(fp, td); return (error); } @@ -145,6 +169,17 @@ return (0); } +/* + * Retrieve a prison from a jail descriptor. It will be returned held, and must + * be released by the caller. + */ +int +jaildesc_get_prison(struct file *fp, struct prison **prp) +{ + MPASS(prp != NULL); + return (jaildesc_get_prison_impl(fp, prp)); +} + /* * Assocate a jail descriptor with its prison. */ diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c --- a/sys/kern/kern_sendfile.c +++ b/sys/kern/kern_sendfile.c @@ -518,8 +518,7 @@ static int sendfile_getobj(struct thread *td, struct file *fp, vm_object_t *obj_res, - struct vnode **vp_res, struct shmfd **shmfd_res, off_t *obj_size, - int *bsize) + struct vnode **vp_res, struct shmfd **shmfd_res, off_t *obj_size) { vm_object_t obj; struct vnode *vp; @@ -530,7 +529,6 @@ vp = *vp_res = NULL; obj = NULL; shmfd = *shmfd_res = NULL; - *bsize = 0; /* * The file descriptor must be a regular file and have a @@ -543,7 +541,6 @@ error = EINVAL; goto out; } - *bsize = vp->v_mount->mnt_stat.f_iosize; obj = vp->v_object; if (obj == NULL) { error = EINVAL; @@ -717,7 +714,7 @@ struct shmfd *shmfd; struct vattr va; off_t off, sbytes, rem, obj_size, nobj_size; - int bsize, error, ext_pgs_idx, hdrlen, max_pgs, softerr; + int error, ext_pgs_idx, hdrlen, max_pgs, softerr; #ifdef KERN_TLS int tls_enq_cnt; #endif @@ -733,7 +730,7 @@ softerr = 0; use_ext_pgs = false; - error = sendfile_getobj(td, fp, &obj, &vp, &shmfd, &obj_size, &bsize); + error = sendfile_getobj(td, fp, &obj, &vp, &shmfd, &obj_size); if (error != 0) goto out; diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -1183,6 +1183,7 @@ NULL, NULL, itimer_init, itimer_fini, UMA_ALIGN_PTR, 0); register_posix_clock(CLOCK_REALTIME, &rt_clock); register_posix_clock(CLOCK_MONOTONIC, &rt_clock); + register_posix_clock(CLOCK_UPTIME, &rt_clock); register_posix_clock(CLOCK_TAI, &rt_clock); p31b_setcfg(CTL_P1003_1B_TIMERS, 200112L); p31b_setcfg(CTL_P1003_1B_DELAYTIMER_MAX, INT_MAX); diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c --- a/sys/kern/subr_smp.c +++ b/sys/kern/subr_smp.c @@ -624,6 +624,19 @@ mtx_unlock_spin(&smp_ipi_mtx); } +void +smp_rendezvous_cpu(u_int cpuid, + void (* setup_func)(void *), + void (* action_func)(void *), + void (* teardown_func)(void *), + void *arg) +{ + cpuset_t set; + + CPU_SETOF(cpuid, &set); + smp_rendezvous_cpus(set, setup_func, action_func, teardown_func, arg); +} + void smp_rendezvous(void (* setup_func)(void *), void (* action_func)(void *), diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c --- a/sys/kern/uipc_domain.c +++ b/sys/kern/uipc_domain.c @@ -168,20 +168,6 @@ return (EOPNOTSUPP); } -static int -pr_sosend_notsupp(struct socket *so, struct sockaddr *addr, struct uio *uio, - struct mbuf *top, struct mbuf *control, int flags, struct thread *td) -{ - return (EOPNOTSUPP); -} - -static int -pr_soreceive_notsupp(struct socket *so, struct sockaddr **paddr, - struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, int *flagsp) -{ - return (EOPNOTSUPP); -} - static void pr_init(struct domain *dom, struct protosw *pr) { @@ -217,8 +203,6 @@ NOTSUPP(pr_sendfile_wait); NOTSUPP(pr_shutdown); NOTSUPP(pr_sockaddr); - NOTSUPP(pr_sosend); - NOTSUPP(pr_soreceive); NOTSUPP(pr_ready); } diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -759,7 +759,6 @@ /* Free the swap accounted for shm */ swap_release_by_cred(delta, object->cred); - object->charge -= delta; } else { if ((shmfd->shm_seals & F_SEAL_GROW) != 0) return (EPERM); @@ -768,7 +767,6 @@ delta = IDX_TO_OFF(nobjsize - object->size); if (!swap_reserve_by_cred(delta, object->cred)) return (ENOMEM); - object->charge += delta; } shmfd->shm_size = length; mtx_lock(&shm_timestamp_lock); diff --git a/sys/modules/Makefile b/sys/modules/Makefile --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -551,6 +551,17 @@ SUBDIR+= linux_common .endif +# LinuxKPI based wireless drivers. +.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ + ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "riscv" +_iwlwifi= iwlwifi +_rtw88= rtw88 +# rtw89 currently cannot be compiled without ACPI (seems also broken in Linux). +.if ${KERN_OPTS:MDEV_ACPI} +_rtw89= rtw89 +.endif +.endif + .if ${MACHINE_CPUARCH} != "arm" .if ${MK_OFED} != "no" || defined(ALL_MODULES) _ibcore= ibcore @@ -583,9 +594,6 @@ _ena= ena _gve= gve _igc= igc -_iwlwifi= iwlwifi -_rtw88= rtw88 -_rtw89= rtw89 _vmware= vmware .endif @@ -786,7 +794,6 @@ _amdsmn= amdsmn _amdtemp= amdtemp _arcmsr= arcmsr -_asmc= asmc .if ${MK_CRYPT} != "no" || defined(ALL_MODULES) _blake2= blake2 .endif @@ -845,6 +852,7 @@ .if ${MACHINE_CPUARCH} == "amd64" _amdgpio= amdgpio +_asmc= asmc _ccp= ccp _enic= enic _iavf= iavf diff --git a/sys/modules/iwlwifi/Makefile b/sys/modules/iwlwifi/Makefile --- a/sys/modules/iwlwifi/Makefile +++ b/sys/modules/iwlwifi/Makefile @@ -4,7 +4,9 @@ WITH_CONFIG_PM= 0 WITH_DEBUGFS= 0 +.if ${KERN_OPTS:MDEV_ACPI} WITH_CONFIG_ACPI= 1 +.endif KMOD= if_iwlwifi @@ -60,10 +62,11 @@ .endif .if defined(WITH_CONFIG_ACPI) && ${WITH_CONFIG_ACPI} > 0 -SRCS+= fw/acpi.c +SRCS.DEV_ACPI+= fw/acpi.c CFLAGS+= -DCONFIG_ACPI -CFLAGS+= -DLINUXKPI_WANT_LINUX_ACPI .endif +# This needs to always stay on for the LinuxKPI header file. +CFLAGS+= -DLINUXKPI_WANT_LINUX_ACPI # Other SRCS+= ${LINUXKPI_GENSRCS} diff --git a/sys/modules/rtw89/Makefile b/sys/modules/rtw89/Makefile --- a/sys/modules/rtw89/Makefile +++ b/sys/modules/rtw89/Makefile @@ -4,13 +4,16 @@ WITH_CONFIG_PM= 0 WITH_DEBUGFS= 0 +.if ${KERN_OPTS:MDEV_ACPI} +WITH_CONFIG_ACPI= 1 +.endif KMOD= if_rtw89 SRCS= core.c SRCS+= pci.c pci_be.c SRCS+= chan.c mac80211.c mac.c mac_be.c phy.c phy_be.c fw.c -SRCS+= acpi.c cam.c efuse.c efuse_be.c regd.c sar.c coex.c ps.c ser.c +SRCS+= cam.c efuse.c efuse_be.c regd.c sar.c coex.c ps.c ser.c SRCS+= util.c SRCS+= rtw8852a.c rtw8852a_rfk.c rtw8852a_rfk_table.c rtw8852a_table.c SRCS+= rtw8852ae.c @@ -26,6 +29,13 @@ SRCS+= rtw8922a.c rtw8922a_rfk.c SRCS+= rtw8922ae.c +.if defined(WITH_CONFIG_ACPI) && ${WITH_CONFIG_ACPI} > 0 +SRCS.DEV_ACPI+= acpi.c +CFLAGS+= -DCONFIG_ACPI +.endif +# This needs to always stay on for the LinuxKPI header file. +CFLAGS+= -DLINUXKPI_WANT_LINUX_ACPI + # USB parts #SRCS+= rtw8851bu.c rtw8852bu.c #SRCS+= usb.c @@ -44,7 +54,6 @@ CFLAGS+= -DKBUILD_MODNAME='"rtw89"' CFLAGS+= -DLINUXKPI_VERSION=61700 -CFLAGS+= -DLINUXKPI_WANT_LINUX_ACPI CFLAGS+= -I${DEVRTW89DIR} CFLAGS+= ${LINUXKPI_INCLUDES} diff --git a/sys/net/if.c b/sys/net/if.c --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1115,6 +1115,8 @@ altq_detach(&ifp->if_snd); #endif + rt_flushifroutes(ifp); + if_purgeaddrs(ifp); EVENTHANDLER_INVOKE(ifnet_departure_event, ifp); if_purgemaddrs(ifp); @@ -1139,8 +1141,6 @@ } else IF_ADDR_WUNLOCK(ifp); } - - rt_flushifroutes(ifp); } #ifdef VIMAGE diff --git a/sys/net/if_enc.c b/sys/net/if_enc.c --- a/sys/net/if_enc.c +++ b/sys/net/if_enc.c @@ -387,7 +387,7 @@ ifc_create_ifp(encname, &ifd, &ifp); V_enc_sc = ifp->if_softc; } -VNET_SYSINIT(vnet_enc_init, SI_SUB_PSEUDO, SI_ORDER_ANY, +VNET_SYSINIT(vnet_enc_init, SI_SUB_PROTO_IF, SI_ORDER_ANY, vnet_enc_init, NULL); static void diff --git a/sys/net/if_ovpn.c b/sys/net/if_ovpn.c --- a/sys/net/if_ovpn.c +++ b/sys/net/if_ovpn.c @@ -1669,6 +1669,7 @@ NET_EPOCH_EXIT(et); CURVNET_RESTORE(); OVPN_COUNTER_ADD(sc, lost_data_pkts_out, 1); + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); m_freem(m); return (0); } @@ -1680,6 +1681,8 @@ if (ret == 0) { OVPN_COUNTER_ADD(sc, sent_data_pkts, 1); OVPN_COUNTER_ADD(sc, tunnel_bytes_sent, tunnel_len); + if_inc_counter(sc->ifp, IFCOUNTER_OPACKETS, 1); + if_inc_counter(sc->ifp, IFCOUNTER_OBYTES, tunnel_len); } crypto_freereq(crp); @@ -1706,6 +1709,7 @@ if (V_replay_protection && ! ovpn_check_replay(key->decrypt, seq)) { OVPN_RUNLOCK(sc); OVPN_COUNTER_ADD(sc, lost_data_pkts_in, 1); + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); m_freem(m); return; } @@ -1767,6 +1771,7 @@ m = m_pullup(m, 1); if (m == NULL) { OVPN_COUNTER_ADD(sc, nomem_data_pkts_in, 1); + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); return; } @@ -1783,6 +1788,7 @@ netisr_dispatch(af == AF_INET ? NETISR_IP : NETISR_IPV6, m); } else { OVPN_COUNTER_ADD(sc, lost_data_pkts_in, 1); + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); m_freem(m); } } @@ -1827,6 +1833,7 @@ crypto_freereq(crp); atomic_add_int(&sc->refcount, -1); OVPN_COUNTER_ADD(sc, lost_data_pkts_in, 1); + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); OVPN_RUNLOCK(sc); m_freem(m); return (0); @@ -1844,6 +1851,7 @@ atomic_add_int(&sc->refcount, -1); OVPN_RUNLOCK(sc); OVPN_COUNTER_ADD(sc, lost_data_pkts_in, 1); + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); m_freem(m); CURVNET_RESTORE(); return (0); @@ -1859,6 +1867,7 @@ */ OVPN_RUNLOCK(sc); OVPN_COUNTER_ADD(sc, lost_data_pkts_in, 1); + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); m_freem(m); CURVNET_RESTORE(); return (0); @@ -2073,6 +2082,7 @@ if (_ovpn_lock_trackerp != NULL) OVPN_RUNLOCK(sc); OVPN_COUNTER_ADD(sc, lost_data_pkts_out, 1); + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); m_freem(m); return (ELOOP); } @@ -2089,6 +2099,7 @@ if (_ovpn_lock_trackerp != NULL) OVPN_RUNLOCK(sc); OVPN_COUNTER_ADD(sc, nomem_data_pkts_out, 1); + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); return (ENOBUFS); } ohdr = mtod(m, struct ovpn_wire_header *); @@ -2105,6 +2116,7 @@ if (_ovpn_lock_trackerp != NULL) OVPN_RUNLOCK(sc); OVPN_COUNTER_ADD(sc, nomem_data_pkts_out, 1); + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); /* Let's avoid (very unlikely, but still) wraparounds of the * 64-bit counter taking us back to 0. */ @@ -2127,6 +2139,8 @@ if (ret == 0) { OVPN_COUNTER_ADD(sc, sent_data_pkts, 1); OVPN_COUNTER_ADD(sc, tunnel_bytes_sent, tunnel_len); + if_inc_counter(sc->ifp, IFCOUNTER_OPACKETS, 1); + if_inc_counter(sc->ifp, IFCOUNTER_OBYTES, tunnel_len); } return (ret); } @@ -2136,6 +2150,7 @@ if (_ovpn_lock_trackerp != NULL) OVPN_RUNLOCK(sc); OVPN_COUNTER_ADD(sc, nomem_data_pkts_out, 1); + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); m_freem(m); return (ENOBUFS); } @@ -2174,6 +2189,7 @@ ret = crypto_dispatch(crp); if (ret) { OVPN_COUNTER_ADD(sc, lost_data_pkts_out, 1); + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); } return (ret); @@ -2198,6 +2214,7 @@ if (peer == NULL || sc->ifp->if_link_state != LINK_STATE_UP) { OVPN_RUNLOCK(sc); OVPN_COUNTER_ADD(sc, lost_data_pkts_out, 1); + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); m_freem(m); return (ENETDOWN); } @@ -2208,6 +2225,7 @@ if (m == NULL) { OVPN_RUNLOCK(sc); OVPN_COUNTER_ADD(sc, nomem_data_pkts_out, 1); + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); m_freem(m); return (ENOBUFS); } @@ -2241,6 +2259,7 @@ if (m == NULL) { OVPN_RUNLOCK(sc); OVPN_COUNTER_ADD(sc, nomem_data_pkts_out, 1); + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); return (ENOBUFS); } ip = mtod(m, struct ip *); @@ -2274,12 +2293,14 @@ if (m == NULL) { OVPN_RUNLOCK(sc); OVPN_COUNTER_ADD(sc, nomem_data_pkts_out, 1); + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); return (ENOBUFS); } m = m_pullup(m, sizeof(*ip6) + sizeof(*udp)); if (m == NULL) { OVPN_RUNLOCK(sc); OVPN_COUNTER_ADD(sc, nomem_data_pkts_out, 1); + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); return (ENOBUFS); } @@ -2341,6 +2362,7 @@ m = m_unshare(m, M_NOWAIT); if (m == NULL) { OVPN_COUNTER_ADD(sc, lost_data_pkts_out, 1); + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); return (ENOBUFS); } @@ -2350,6 +2372,7 @@ if (__predict_false(ifp->if_link_state != LINK_STATE_UP)) { OVPN_COUNTER_ADD(sc, lost_data_pkts_out, 1); + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); OVPN_RUNLOCK(sc); m_freem(m); return (ENETDOWN); @@ -2368,6 +2391,7 @@ if (peer == NULL) { /* No destination. */ OVPN_COUNTER_ADD(sc, lost_data_pkts_out, 1); + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); OVPN_RUNLOCK(sc); m_freem(m); return (ENETDOWN); @@ -2463,6 +2487,8 @@ M_ASSERTPKTHDR(m); OVPN_COUNTER_ADD(sc, transport_bytes_received, m->m_pkthdr.len - off); + if_inc_counter(sc->ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len - off); + if_inc_counter(sc->ifp, IFCOUNTER_IPACKETS, 1); ohdrlen = sizeof(*ohdr) - sizeof(ohdr->auth_tag); @@ -2492,6 +2518,7 @@ m = m_unshare(m, M_NOWAIT); if (m == NULL) { OVPN_COUNTER_ADD(sc, nomem_data_pkts_in, 1); + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); return (true); } @@ -2499,6 +2526,7 @@ if (m == NULL) { OVPN_RUNLOCK(sc); OVPN_COUNTER_ADD(sc, nomem_data_pkts_in, 1); + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); return (true); } @@ -2515,6 +2543,7 @@ if (key == NULL || key->decrypt == NULL) { OVPN_RUNLOCK(sc); OVPN_COUNTER_ADD(sc, lost_data_pkts_in, 1); + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); m_freem(m); return (true); } @@ -2560,6 +2589,7 @@ if (m == NULL) { OVPN_RUNLOCK(sc); OVPN_COUNTER_ADD(sc, nomem_data_pkts_in, 1); + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); return (true); } uhdr = mtodo(m, 0); @@ -2569,6 +2599,7 @@ crp = crypto_getreq(key->decrypt->cryptoid, M_NOWAIT); if (crp == NULL) { OVPN_COUNTER_ADD(sc, nomem_data_pkts_in, 1); + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); OVPN_RUNLOCK(sc); m_freem(m); return (true); @@ -2605,6 +2636,7 @@ ret = crypto_dispatch(crp); if (ret != 0) { OVPN_COUNTER_ADD(sc, lost_data_pkts_in, 1); + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); } return (true); diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -329,6 +329,9 @@ MALLOC_DECLARE(M_PF); MALLOC_DECLARE(M_PFHASH); MALLOC_DECLARE(M_PF_RULE_ITEM); +MALLOC_DECLARE(M_PF_STATE_LINK); +MALLOC_DECLARE(M_PF_SOURCE_LIM); +MALLOC_DECLARE(M_PF_STATE_LIM); SDT_PROVIDER_DECLARE(pf); SDT_PROBE_DECLARE(pf, , test, reason_set); @@ -893,6 +896,14 @@ u_int8_t set_prio[2]; sa_family_t naf; u_int8_t rcvifnot; + struct { + uint8_t id; + int limiter_action; + } statelim; + struct { + uint8_t id; + int limiter_action; + } sourcelim; struct { struct pf_addr addr; @@ -1102,7 +1113,54 @@ }; _Static_assert(sizeof(struct pf_state_export) == 384, "size incorrect"); +#define PF_STATELIM_NAME_LEN 16 /* kstat istr */ +#define PF_STATELIM_DESCR_LEN 64 + +#define PF_SOURCELIM_NAME_LEN 16 /* kstat istr */ +#define PF_SOURCELIM_DESCR_LEN 64 + #ifdef _KERNEL +struct kstat; + +/* + * PF state links + * + * This is used to augment a struct pf_state so it can be + * tracked/referenced by the state and source address limiter things. + * Each limiter maintains a list of the states they "own", and these + * state links are what the limiters use to wire a state into their + * lists. + * + * Without PF state links, the pf_state struct would have to grow + * a lot to support a feature that may not be used. + * + * pfl_entry is used by the pools to add states to their list. + * pfl_state allows the pools to get from their list of states to + * the states themselves. + * + * pfl_link allows operations on states (well, delete) to be able + * to quickly locate the pf_state_link struct so they can be unwired + * from the pools. + */ + +#define PF_STATE_LINK_TYPE_STATELIM 1 +#define PF_STATE_LINK_TYPE_SOURCELIM 2 + +struct pf_kstate; +struct pf_state_link { + /* used by source/state pools to get to states */ + TAILQ_ENTRY(pf_state_link) pfl_link; + + /* used by pf_state to get to source/state pools */ + SLIST_ENTRY(pf_state_link) pfl_linkage; + + struct pf_kstate *pfl_state; + unsigned int pfl_type; +}; + +TAILQ_HEAD(pf_state_link_list, pf_state_link); +SLIST_HEAD(pf_state_linkage, pf_state_link); + struct pf_kstate { /* * Area shared with pf_state_cmp @@ -1144,13 +1202,226 @@ u_int16_t tag; u_int16_t if_index_in; u_int16_t if_index_out; + uint8_t statelim; + uint8_t sourcelim; + struct pf_state_linkage linkage; +}; + +/* + * State limiter + */ + +struct pf_limiter_rate { + unsigned int limit; + unsigned int seconds; +}; + +struct pf_statelim { + RB_ENTRY(pf_statelim) pfstlim_id_tree; + RB_ENTRY(pf_statelim) pfstlim_nm_tree; + TAILQ_ENTRY(pf_statelim) pfstlim_list; + struct kstat *pfstlim_ks; + + uint32_t pfstlim_id; + char pfstlim_nm[PF_STATELIM_NAME_LEN]; + + /* config */ + + unsigned int pfstlim_limit; + struct pf_limiter_rate pfstlim_rate; + + /* run state */ + struct mtx pfstlim_lock; + + /* rate limiter */ + uint64_t pfstlim_rate_ts; + uint64_t pfstlim_rate_token; + uint64_t pfstlim_rate_bucket; + + unsigned int pfstlim_inuse; + struct pf_state_link_list pfstlim_states; + + /* counters */ + + struct { + uint64_t admitted; + uint64_t hardlimited; + uint64_t ratelimited; + } pfstlim_counters; + + struct { + time_t created; + time_t updated; + time_t cleared; + } pfstlim_timestamps; }; +RB_HEAD(pf_statelim_id_tree, pf_statelim); +RB_PROTOTYPE(pf_statelim_id_tree, pf_statelim, pfstlim_id_tree, cmp); + +RB_HEAD(pf_statelim_nm_tree, pf_statelim); +RB_PROTOTYPE(pf_statelim_nm_tree, pf_statelim, pfstlim_nm_tree, cmp); + +TAILQ_HEAD(pf_statelim_list, pf_statelim); + +VNET_DECLARE(struct pf_statelim_id_tree, pf_statelim_id_tree_active); +#define V_pf_statelim_id_tree_active VNET(pf_statelim_id_tree_active) +VNET_DECLARE(struct pf_statelim_list, pf_statelim_list_active); +#define V_pf_statelim_list_active VNET(pf_statelim_list_active) + +VNET_DECLARE(struct pf_statelim_id_tree, pf_statelim_id_tree_inactive); +#define V_pf_statelim_id_tree_inactive VNET(pf_statelim_id_tree_inactive) +VNET_DECLARE(struct pf_statelim_nm_tree, pf_statelim_nm_tree_inactive); +#define V_pf_statelim_nm_tree_inactive VNET(pf_statelim_nm_tree_inactive) +VNET_DECLARE(struct pf_statelim_list, pf_statelim_list_inactive); +#define V_pf_statelim_list_inactive VNET(pf_statelim_list_inactive) + +static inline unsigned int +pf_statelim_enter(struct pf_statelim *pfstlim) +{ + mtx_lock(&pfstlim->pfstlim_lock); + + return (0); +} + +static inline void +pf_statelim_leave(struct pf_statelim *pfstlim, unsigned int gen) +{ + return (mtx_unlock(&pfstlim->pfstlim_lock)); +} + /* - * 6 cache lines per struct, 10 structs per page. - * Try to not grow the struct beyond that. + * Source address pools */ -_Static_assert(sizeof(struct pf_kstate) <= 384, "pf_kstate size crosses 384 bytes"); + +struct pf_sourcelim; + +struct pf_source { + RB_ENTRY(pf_source) pfsr_tree; + RB_ENTRY(pf_source) pfsr_ioc_tree; + struct pf_sourcelim *pfsr_parent; + + sa_family_t pfsr_af; + u_int16_t pfsr_rdomain; + struct pf_addr pfsr_addr; + + /* run state */ + + unsigned int pfsr_inuse; + unsigned int pfsr_intable; + struct pf_state_link_list pfsr_states; + time_t pfsr_empty_ts; + TAILQ_ENTRY(pf_source) pfsr_empty_gc; + + /* rate limiter */ + uint64_t pfsr_rate_ts; + + struct { + uint64_t admitted; + uint64_t hardlimited; + uint64_t ratelimited; + } pfsr_counters; +}; + +RB_HEAD(pf_source_tree, pf_source); +RB_PROTOTYPE(pf_source_tree, pf_source, pfsr_tree, cmp); + +RB_HEAD(pf_source_ioc_tree, pf_source); +RB_PROTOTYPE(pf_source_ioc_tree, pf_source, pfsr_ioc_tree, cmp); + +TAILQ_HEAD(pf_source_list, pf_source); + +struct pf_sourcelim { + RB_ENTRY(pf_sourcelim) pfsrlim_id_tree; + RB_ENTRY(pf_sourcelim) pfsrlim_nm_tree; + TAILQ_ENTRY(pf_sourcelim) pfsrlim_list; + struct kstat *pfsrlim_ks; + + uint32_t pfsrlim_id; + char pfsrlim_nm[PF_SOURCELIM_NAME_LEN]; + unsigned int pfsrlim_disabled; + + /* config */ + + unsigned int pfsrlim_entries; + unsigned int pfsrlim_limit; + unsigned int pfsrlim_ipv4_prefix; + unsigned int pfsrlim_ipv6_prefix; + + struct pf_limiter_rate pfsrlim_rate; + + struct { + char name[PF_TABLE_NAME_SIZE]; + unsigned int hwm; + unsigned int lwm; + struct pfr_ktable *table; + } pfsrlim_overload; + + /* run state */ + struct mtx pfsrlim_lock; + + struct pf_addr pfsrlim_ipv4_mask; + struct pf_addr pfsrlim_ipv6_mask; + + uint64_t pfsrlim_rate_token; + uint64_t pfsrlim_rate_bucket; + + /* number of pf_sources */ + unsigned int pfsrlim_nsources; + struct pf_source_tree pfsrlim_sources; + struct pf_source_ioc_tree pfsrlim_ioc_sources; + + struct { + /* number of times pf_source was allocated */ + uint64_t addrallocs; + /* state was rejected because the address limit was hit */ + uint64_t addrlimited; + /* no memory to create address thing */ + uint64_t addrnomem; + + /* sum of pf_source inuse gauges */ + uint64_t inuse; + /* sum of pf_source admitted counters */ + uint64_t admitted; + /* sum of pf_source hardlimited counters */ + uint64_t hardlimited; + /* sum of pf_source ratelimited counters */ + uint64_t ratelimited; + } pfsrlim_counters; +}; + +RB_HEAD(pf_sourcelim_id_tree, pf_sourcelim); +RB_PROTOTYPE(pf_sourcelim_id_tree, pf_sourcelim, pfsrlim_id_tree, cmp); + +RB_HEAD(pf_sourcelim_nm_tree, pf_sourcelim); +RB_PROTOTYPE(pf_sourcelim_nm_tree, pf_sourcelim, pfsrlim_nm_tree, cmp); + +TAILQ_HEAD(pf_sourcelim_list, pf_sourcelim); + +VNET_DECLARE(struct pf_sourcelim_id_tree, pf_sourcelim_id_tree_active); +#define V_pf_sourcelim_id_tree_active VNET(pf_sourcelim_id_tree_active) +VNET_DECLARE(struct pf_sourcelim_list, pf_sourcelim_list_active); +#define V_pf_sourcelim_list_active VNET(pf_sourcelim_list_active) + +VNET_DECLARE(struct pf_sourcelim_id_tree, pf_sourcelim_id_tree_inactive); +#define V_pf_sourcelim_id_tree_inactive VNET(pf_sourcelim_id_tree_inactive) +VNET_DECLARE(struct pf_sourcelim_nm_tree, pf_sourcelim_nm_tree_inactive); +#define V_pf_sourcelim_nm_tree_inactive VNET(pf_sourcelim_nm_tree_inactive) +VNET_DECLARE(struct pf_sourcelim_list, pf_sourcelim_list_inactive); +#define V_pf_sourcelim_list_inactive VNET(pf_sourcelim_list_inactive) + +static inline unsigned int +pf_sourcelim_enter(struct pf_sourcelim *pfsrlim) +{ + mtx_lock(&pfsrlim->pfsrlim_lock); + return (0); +} + +static inline void +pf_sourcelim_leave(struct pf_sourcelim *pfsrlim, unsigned int gen) +{ + mtx_unlock(&pfsrlim->pfsrlim_lock); +} enum pf_test_status { PF_TEST_FAIL = -1, @@ -1168,6 +1439,7 @@ int state_icmp; int tag; int rewrite; + int limiter_drop; u_short reason; struct pf_src_node *sns[PF_SN_MAX]; struct pf_krule *nr; @@ -1186,6 +1458,9 @@ uint16_t virtual_type; uint16_t virtual_id; int depth; + struct pf_statelim *statelim; + struct pf_sourcelim *sourcelim; + struct pf_source *source; }; #define PF_ANCHOR_STACK_MAX 32 @@ -1805,7 +2080,116 @@ #define PF_SYNCOOKIES_HIWATPCT 25 #define PF_SYNCOOKIES_LOWATPCT (PF_SYNCOOKIES_HIWATPCT / 2) +#define PF_STATELIM_ID_NONE 0 +#define PF_STATELIM_ID_MIN 1 +#define PF_STATELIM_ID_MAX 255 /* fits in pf_state uint8_t */ +#define PF_STATELIM_LIMIT_MIN 1 +#define PF_STATELIM_LIMIT_MAX (1 << 24) /* pf is pretty scalable */ + +#define PF_SOURCELIM_ID_NONE 0 +#define PF_SOURCELIM_ID_MIN 1 +#define PF_SOURCELIM_ID_MAX 255 /* fits in pf_state uint8_t */ + #ifdef _KERNEL + +struct pfioc_statelim { + uint32_t ticket; + + char name[PF_STATELIM_NAME_LEN]; + uint32_t id; + + /* limit on the total number of states */ + unsigned int limit; + + /* rate limit on the creation of states */ + struct pf_limiter_rate rate; + + char description[PF_STATELIM_DESCR_LEN]; + + /* kernel state for GET ioctls */ + unsigned int inuse; /* gauge */ + uint64_t admitted; /* counter */ + uint64_t hardlimited; /* counter */ + uint64_t ratelimited; /* counter */ +}; + +struct pfioc_sourcelim { + uint32_t ticket; + + char name[PF_SOURCELIM_NAME_LEN]; + uint32_t id; + + /* limit on the total number of address entries */ + unsigned int entries; + + /* limit on the number of states per address entry */ + unsigned int limit; + + /* rate limit on the creation of states by an address entry */ + struct pf_limiter_rate rate; + + /* + * when the number of states on an entry exceeds hwm, add + * the address to the specified table. when the number of + * states goes below lwm, remove it from the table. + */ + char overload_tblname[PF_TABLE_NAME_SIZE]; + unsigned int overload_hwm; + unsigned int overload_lwm; + + /* + * mask addresses before they're used for entries. /64s + * everywhere for inet6 makes it easy to use too much memory. + */ + unsigned int inet_prefix; + unsigned int inet6_prefix; + + char description[PF_SOURCELIM_DESCR_LEN]; + + /* kernel state for GET ioctls */ + unsigned int nentries; /* gauge */ + unsigned int inuse; /* gauge */ + + uint64_t addrallocs; /* counter */ + uint64_t addrnomem; /* counter */ + uint64_t admitted; /* counter */ + uint64_t addrlimited; /* counter */ + uint64_t hardlimited; /* counter */ + uint64_t ratelimited; /* counter */ +}; + +struct pfioc_source_kill { + char name[PF_SOURCELIM_NAME_LEN]; + uint32_t id; + unsigned int rdomain; + sa_family_t af; + struct pf_addr addr; + + unsigned int rmstates; /* kill the states too? */ +}; + +int pf_statelim_add(const struct pfioc_statelim *); +struct pf_statelim *pf_statelim_rb_find(struct pf_statelim_id_tree *, + struct pf_statelim *); +struct pf_statelim *pf_statelim_rb_nfind(struct pf_statelim_id_tree *, + struct pf_statelim *); +int pf_statelim_get(struct pfioc_statelim *, + struct pf_statelim *(*rbt_op)(struct pf_statelim_id_tree *, + struct pf_statelim *)); +int pf_sourcelim_add(const struct pfioc_sourcelim *); +struct pf_sourcelim *pf_sourcelim_rb_find(struct pf_sourcelim_id_tree *, + struct pf_sourcelim *); +struct pf_sourcelim *pf_sourcelim_rb_nfind(struct pf_sourcelim_id_tree *, + struct pf_sourcelim *); +int pf_sourcelim_get(struct pfioc_sourcelim *, + struct pf_sourcelim *(*rbt_op)(struct pf_sourcelim_id_tree *, + struct pf_sourcelim *)); +struct pf_source *pf_source_rb_find(struct pf_source_ioc_tree *, + struct pf_source *); +struct pf_source *pf_source_rb_nfind(struct pf_source_ioc_tree *, + struct pf_source *); +int pf_source_clr(struct pfioc_source_kill *); + struct pf_kstatus { counter_u64_t counters[PFRES_MAX]; /* reason for passing/dropping */ counter_u64_t lcounters[KLCNT_MAX]; /* limit counters */ @@ -2420,6 +2804,14 @@ return ((t.tv_sec * 1000) + (t.tv_usec / 1000)); } +static inline uint64_t +SEC_TO_NSEC(uint64_t seconds) +{ + if (seconds > UINT64_MAX / 1000000000ULL) + return (UINT64_MAX); + return (seconds * 1000000000ULL); +} + extern struct pf_kstate *pf_find_state_byid(uint64_t, uint32_t); extern struct pf_kstate *pf_find_state_all( const struct pf_state_key_cmp *, @@ -2554,6 +2946,7 @@ int pfr_set_tflags(struct pfr_table *, int, int, int, int *, int *, int); int pfr_clr_addrs(struct pfr_table *, int *, int); int pfr_insert_kentry(struct pfr_ktable *, struct pfr_addr *, time_t); +int pfr_remove_kentry(struct pfr_ktable *, struct pfr_addr *); int pfr_add_addrs(struct pfr_table *, struct pfr_addr *, int, int *, int); int pfr_del_addrs(struct pfr_table *, struct pfr_addr *, int, int *, diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c --- a/sys/net80211/ieee80211_proto.c +++ b/sys/net80211/ieee80211_proto.c @@ -747,8 +747,8 @@ ((flags & (IEEE80211_F_DOFRATE|IEEE80211_F_DOFMCS)) && fixedrate != ucastrate)) { IEEE80211_NOTE(vap, IEEE80211_MSG_XRATE | IEEE80211_MSG_11N, ni, - "%s: flags 0x%x okrate %d error %d fixedrate 0x%x " - "ucastrate %x\n", __func__, fixedrate, ucastrate, flags); + "%s: flags 0x%x okrate %d error %d fixedrate 0x%x ucastrate 0x%x\n", + __func__, flags, okrate, error, fixedrate, ucastrate); return badrate | IEEE80211_RATE_BASIC; } else return IEEE80211_RV(okrate); diff --git a/sys/netgraph/netflow/netflow_v9.c b/sys/netgraph/netflow/netflow_v9.c --- a/sys/netgraph/netflow/netflow_v9.c +++ b/sys/netgraph/netflow/netflow_v9.c @@ -227,6 +227,7 @@ else NG_FREE_ITEM(item); + fe->sent_packets++; free(t, M_NETFLOW_GENERAL); return (error); diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h --- a/sys/netinet6/in6.h +++ b/sys/netinet6/in6.h @@ -671,6 +671,8 @@ uint32_t off_l4, uint32_t len, uint32_t cov); int in6_cksum_pseudo(struct ip6_hdr *, uint32_t, uint8_t, uint16_t); +time_t in6_expire_time(uint32_t); + int in6_localaddr(struct in6_addr *); int in6_localip(struct in6_addr *); bool in6_localip_fib(struct in6_addr *, uint16_t); diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -317,7 +317,6 @@ return (error); } /* FALLTHROUGH */ - case OSIOCGIFINFO_IN6: case SIOCGIFINFO_IN6: case SIOCGNBRINFO_IN6: case SIOCGDEFIFACE_IN6: @@ -1029,6 +1028,15 @@ return (ia); } +time_t +in6_expire_time(uint32_t ltime) +{ + if (ltime == ND6_INFINITE_LIFETIME) + return (0); + else + return (time_uptime + ltime); +} + /* * Update/configure interface address parameters: * @@ -1051,16 +1059,10 @@ * these members for applications. */ ia->ia6_lifetime = ifra->ifra_lifetime; - if (ia->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME) { - ia->ia6_lifetime.ia6t_expire = - time_uptime + ia->ia6_lifetime.ia6t_vltime; - } else - ia->ia6_lifetime.ia6t_expire = 0; - if (ia->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME) { - ia->ia6_lifetime.ia6t_preferred = - time_uptime + ia->ia6_lifetime.ia6t_pltime; - } else - ia->ia6_lifetime.ia6t_preferred = 0; + ia->ia6_lifetime.ia6t_expire = + in6_expire_time(ifra->ifra_lifetime.ia6t_vltime); + ia->ia6_lifetime.ia6t_preferred = + in6_expire_time(ifra->ifra_lifetime.ia6t_pltime); /* * backward compatibility - if IN6_IFF_DEPRECATED is set from the @@ -1327,6 +1329,28 @@ (*carp_detach_p)(&ia->ia_ifa, false); goto out; } + } else if (pr->ndpr_raf_onlink) { + time_t expiry; + + /* + * If the prefix already exists, update lifetimes, but avoid + * shortening them. + */ + ND6_WLOCK(); + expiry = in6_expire_time(pr0.ndpr_pltime); + if (pr->ndpr_preferred != 0 && + (pr->ndpr_preferred < expiry || expiry == 0)) { + pr->ndpr_pltime = pr0.ndpr_pltime; + pr->ndpr_preferred = expiry; + } + expiry = in6_expire_time(pr0.ndpr_vltime); + if (pr->ndpr_expire != 0 && + (pr->ndpr_expire < expiry || expiry == 0)) { + pr->ndpr_vltime = pr0.ndpr_vltime; + pr->ndpr_expire = expiry; + } + pr->ndpr_lastupdate = time_uptime; + ND6_WUNLOCK(); } /* relate the address to the prefix */ diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -449,9 +449,6 @@ #define SIOCGIFAFLAG_IN6 _IOWR('i', 73, struct in6_ifreq) -#ifdef _KERNEL -#define OSIOCGIFINFO_IN6 _IOWR('i', 76, struct in6_ondireq) -#endif #define SIOCGIFINFO_IN6 _IOWR('i', 108, struct in6_ndireq) #define SIOCSIFINFO_IN6 _IOWR('i', 109, struct in6_ndireq) #define SIOCSNDFLUSH_IN6 _IOWR('i', 77, struct in6_ifreq) diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -556,6 +556,7 @@ if ((error = ip6_insert_jumboopt(&exthdrs, plen)) != 0) goto freehdrs; ip6->ip6_plen = 0; + optlen += 8; /* JUMBOOPTLEN */ } else ip6->ip6_plen = htons(plen); nexthdrp = &ip6->ip6_nxt; diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -139,23 +139,6 @@ /* struct sockaddr_in6 advrtr[] */ }; -#ifdef _KERNEL -struct in6_ondireq { - char ifname[IFNAMSIZ]; - struct { - u_int32_t linkmtu; /* LinkMTU */ - u_int32_t maxmtu; /* Upper bound of LinkMTU */ - u_int32_t basereachable; /* BaseReachableTime */ - u_int32_t reachable; /* Reachable Time */ - u_int32_t retrans; /* Retrans Timer */ - u_int32_t flags; /* Flags */ - int recalctm; /* BaseReacable re-calculation timer */ - u_int8_t chlim; /* CurHopLimit */ - u_int8_t receivedra; - } ndi; -}; -#endif - struct in6_ndireq { char ifname[IFNAMSIZ]; struct nd_ifinfo ndi; diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1649,20 +1649,8 @@ /* XXXGL: ??? */ if (ifp->if_inet6 == NULL) return (EPFNOSUPPORT); - switch (cmd) { - case OSIOCGIFINFO_IN6: #define ND ndi->ndi - /* XXX: old ndp(8) assumes a positive value for linkmtu. */ - bzero(&ND, sizeof(ND)); - ND.linkmtu = IN6_LINKMTU(ifp); - ND.maxmtu = ND_IFINFO(ifp)->maxmtu; - ND.basereachable = ND_IFINFO(ifp)->basereachable; - ND.reachable = ND_IFINFO(ifp)->reachable; - ND.retrans = ND_IFINFO(ifp)->retrans; - ND.flags = ND_IFINFO(ifp)->flags; - ND.recalctm = ND_IFINFO(ifp)->recalctm; - ND.chlim = ND_IFINFO(ifp)->chlim; - break; + switch (cmd) { case SIOCGIFINFO_IN6: ND = *ND_IFINFO(ifp); break; diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1146,39 +1146,18 @@ return (n); } -static int +static void in6_init_prefix_ltimes(struct nd_prefix *ndpr) { - if (ndpr->ndpr_pltime == ND6_INFINITE_LIFETIME) - ndpr->ndpr_preferred = 0; - else - ndpr->ndpr_preferred = time_uptime + ndpr->ndpr_pltime; - if (ndpr->ndpr_vltime == ND6_INFINITE_LIFETIME) - ndpr->ndpr_expire = 0; - else - ndpr->ndpr_expire = time_uptime + ndpr->ndpr_vltime; - - return 0; + ndpr->ndpr_preferred = in6_expire_time(ndpr->ndpr_pltime); + ndpr->ndpr_expire = in6_expire_time(ndpr->ndpr_vltime); } static void in6_init_address_ltimes(struct nd_prefix *new, struct in6_addrlifetime *lt6) { - /* init ia6t_expire */ - if (lt6->ia6t_vltime == ND6_INFINITE_LIFETIME) - lt6->ia6t_expire = 0; - else { - lt6->ia6t_expire = time_uptime; - lt6->ia6t_expire += lt6->ia6t_vltime; - } - - /* init ia6t_preferred */ - if (lt6->ia6t_pltime == ND6_INFINITE_LIFETIME) - lt6->ia6t_preferred = 0; - else { - lt6->ia6t_preferred = time_uptime; - lt6->ia6t_preferred += lt6->ia6t_pltime; - } + lt6->ia6t_preferred = in6_expire_time(lt6->ia6t_pltime); + lt6->ia6t_expire = in6_expire_time(lt6->ia6t_vltime); } static struct in6_ifaddr * @@ -1394,11 +1373,8 @@ new->ndpr_vltime = pr->ndpr_vltime; new->ndpr_pltime = pr->ndpr_pltime; new->ndpr_flags = pr->ndpr_flags; - if ((error = in6_init_prefix_ltimes(new)) != 0) { - free(new, M_IP6NDP); - return (error); - } new->ndpr_lastupdate = time_uptime; + in6_init_prefix_ltimes(new); /* initialization */ LIST_INIT(&new->ndpr_advrtrs); @@ -1542,7 +1518,7 @@ if (new->ndpr_raf_onlink) { pr->ndpr_vltime = new->ndpr_vltime; pr->ndpr_pltime = new->ndpr_pltime; - (void)in6_init_prefix_ltimes(pr); /* XXX error case? */ + in6_init_prefix_ltimes(pr); pr->ndpr_lastupdate = time_uptime; } diff --git a/sys/netpfil/ipfw/ip_fw2.c b/sys/netpfil/ipfw/ip_fw2.c --- a/sys/netpfil/ipfw/ip_fw2.c +++ b/sys/netpfil/ipfw/ip_fw2.c @@ -3667,6 +3667,7 @@ #ifdef IPFIREWALL_NAT LIST_INIT(&chain->nat); #endif + RB_INIT(&chain->taps); /* Init shared services hash table */ ipfw_init_srv(chain); @@ -3731,29 +3732,26 @@ V_ipfw_vnet_ready = 0; /* tell new callers to go away */ /* - * disconnect from ipv4, ipv6, layer2 and sockopt. - * Then grab, release and grab again the WLOCK so we make - * sure the update is propagated and nobody will be in. + * Disconnect from ipv4, ipv6, layer2 and sockopt. pfil(9) hook + * removal is synchronized by the net epoch, but our destructors + * free the memory immediately, thus we need for the epoch sections + * to complete. */ ipfw_detach_hooks(); V_ip_fw_ctl_ptr = NULL; + NET_EPOCH_WAIT(); last = IS_DEFAULT_VNET(curvnet) ? 1 : 0; IPFW_UH_WLOCK(chain); - IPFW_UH_WUNLOCK(chain); ipfw_dyn_uninit(0); /* run the callout_drain */ - IPFW_UH_WLOCK(chain); - reap = NULL; - IPFW_WLOCK(chain); for (i = 0; i < chain->n_rules; i++) ipfw_reap_add(chain, &reap, chain->map[i]); free(chain->map, M_IPFW); ipfw_destroy_skipto_cache(chain); - IPFW_WUNLOCK(chain); IPFW_UH_WUNLOCK(chain); ipfw_destroy_tables(chain, last); ipfw_eaction_uninit(chain, last); diff --git a/sys/netpfil/ipfw/ip_fw_bpf.c b/sys/netpfil/ipfw/ip_fw_bpf.c --- a/sys/netpfil/ipfw/ip_fw_bpf.c +++ b/sys/netpfil/ipfw/ip_fw_bpf.c @@ -1,7 +1,7 @@ /*- * Copyright (c) 2016 Yandex LLC * Copyright (c) 2016 Andrey V. Elsukov - * Copyright (c) 2025 Gleb Smirnoff + * Copyright (c) 2025-2026 Gleb Smirnoff * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -68,20 +68,20 @@ { return (a->rule != b->rule ? (a->rule < b->rule ? -1 : 1) : 0); } -RB_HEAD(tap_tree, ipfw_tap); -VNET_DEFINE_STATIC(struct tap_tree, tap_tree); -#define V_tap_tree VNET(tap_tree) RB_GENERATE_STATIC(tap_tree, ipfw_tap, entry, tap_compare); -VNET_DEFINE_STATIC(struct ipfw_tap *, default_tap); +VNET_DEFINE_STATIC(struct ipfw_tap, default_tap) = { .name = "ipfw0" }; #define V_default_tap VNET(default_tap) void -ipfw_tap_alloc(uint32_t rule) +ipfw_tap_alloc(struct ip_fw_chain *ch, uint32_t rule) { struct ipfw_tap *tap, key = { .rule = rule }; int n __diagused; - tap = RB_FIND(tap_tree, &V_tap_tree, &key); + MPASS(rule > 0 && rule < IPFW_DEFAULT_RULE); + IPFW_UH_WLOCK_ASSERT(ch); + + tap = RB_FIND(tap_tree, &ch->taps, &key); if (tap != NULL) { MPASS(tap->rule == rule); tap->refs++; @@ -90,43 +90,51 @@ tap = malloc(sizeof(*tap), M_IPFW, M_WAITOK); tap->rule = rule; tap->refs = 1; - /* Note: the default rule logs to "ipfw0". */ - if (__predict_false(rule == IPFW_DEFAULT_RULE)) { - V_default_tap = tap; - rule = 0; - } n = snprintf(tap->name, sizeof(tap->name), "ipfw%u", rule); MPASS(n > 4 && n < sizeof("ipfw4294967295")); tap->bpf = bpf_attach(tap->name, DLT_EN10MB, PFLOG_HDRLEN, &bpf_ipfw_methods, NULL); - tap = RB_INSERT(tap_tree, &V_tap_tree, tap); + tap = RB_INSERT(tap_tree, &ch->taps, tap); MPASS(tap == NULL); } void -ipfw_tap_free(uint32_t rule) +ipfw_tap_free(struct ip_fw_chain *ch, uint32_t rule) { - struct ipfw_tap *tap, key = { .rule = rule }; - tap = RB_FIND(tap_tree, &V_tap_tree, &key); + MPASS(rule > 0 && rule < IPFW_DEFAULT_RULE); + IPFW_UH_WLOCK_ASSERT(ch); + + tap = RB_FIND(tap_tree, &ch->taps, &key); MPASS(tap != NULL); if (--tap->refs == 0) { bpf_detach(tap->bpf); - RB_REMOVE(tap_tree, &V_tap_tree, tap); + RB_REMOVE(tap_tree, &ch->taps, tap); free(tap, M_IPFW); } } void -ipfw_bpf_tap(struct ip_fw_args *args, struct ip *ip, uint32_t rulenum) +ipfw_bpf_tap(struct ip_fw_chain *ch, struct ip_fw_args *args, + struct ip *ip, uint32_t rulenum) { - struct ipfw_tap *tap, key = { .rule = rulenum }; + struct ipfw_tap *tap; - tap = RB_FIND(tap_tree, &V_tap_tree, &key); - MPASS(tap != NULL); - if (!bpf_peers_present(tap->bpf)) - tap = V_default_tap; + if (rulenum == IPFW_DEFAULT_RULE) { + tap = &V_default_tap; + } else { + struct ipfw_tap key = { .rule = rulenum }; + + tap = RB_FIND(tap_tree, &ch->taps, &key); + MPASS(tap != NULL); + /* + * Compatibility: if user is not using per-rule taps, fallback + * to the default tap. + */ + if (!bpf_peers_present(tap->bpf)) + tap = &V_default_tap; + } if (args->flags & IPFW_ARGS_LENMASK) { bpf_tap(tap->bpf, args->mem, IPFW_ARGS_LENGTH(args->flags)); } else if (args->flags & IPFW_ARGS_ETHER) { @@ -161,7 +169,8 @@ void ipfw_bpf_init(int first __unused) { - ipfw_tap_alloc(IPFW_DEFAULT_RULE); + V_default_tap.bpf = bpf_attach(V_default_tap.name, DLT_EN10MB, + PFLOG_HDRLEN, &bpf_ipfw_methods, NULL); V_bpf_pflog = bpf_attach("ipfwlog0", DLT_PFLOG, PFLOG_HDRLEN, &bpf_ipfw_methods, NULL); } @@ -169,7 +178,6 @@ void ipfw_bpf_uninit(int last __unused) { - - ipfw_tap_free(IPFW_DEFAULT_RULE); + bpf_detach(V_default_tap.bpf); bpf_detach(V_bpf_pflog); } diff --git a/sys/netpfil/ipfw/ip_fw_dynamic.c b/sys/netpfil/ipfw/ip_fw_dynamic.c --- a/sys/netpfil/ipfw/ip_fw_dynamic.c +++ b/sys/netpfil/ipfw/ip_fw_dynamic.c @@ -663,6 +663,8 @@ ipfw_obj_ntlv *ntlv; char *name; + IPFW_UH_WLOCK_ASSERT(ch); + DYN_DEBUG("uidx %u", ti->uidx); if (ti->uidx != 0) { if (ti->tlvs == NULL) @@ -681,7 +683,6 @@ obj->no.etlv = IPFW_TLV_STATE_NAME; strlcpy(obj->name, name, sizeof(obj->name)); - IPFW_UH_WLOCK(ch); no = ipfw_objhash_lookup_name_type(ni, 0, IPFW_TLV_STATE_NAME, name); if (no != NULL) { @@ -691,14 +692,12 @@ */ *pkidx = no->kidx; no->refcnt++; - IPFW_UH_WUNLOCK(ch); free(obj, M_IPFW); DYN_DEBUG("\tfound kidx %u for name '%s'", *pkidx, no->name); return (0); } if (ipfw_objhash_alloc_idx(ni, &obj->no.kidx) != 0) { DYN_DEBUG("\talloc_idx failed for %s", name); - IPFW_UH_WUNLOCK(ch); free(obj, M_IPFW); return (ENOSPC); } @@ -706,7 +705,6 @@ SRV_OBJECT(ch, obj->no.kidx) = obj; obj->no.refcnt++; *pkidx = obj->no.kidx; - IPFW_UH_WUNLOCK(ch); DYN_DEBUG("\tcreated kidx %u for name '%s'", *pkidx, name); return (0); } @@ -2145,9 +2143,6 @@ * Userland can invoke ipfw_expire_dyn_states() to delete * specific states, this will lead to modification of expired * lists. - * - * XXXAE: do we need DYN_EXPIRED_LOCK? We can just use - * IPFW_UH_WLOCK to protect access to these lists. */ DYN_EXPIRED_LOCK(); DYN_FREE_STATES(s4, s4n, ipv4); @@ -2306,8 +2301,6 @@ void *rule; int bucket, removed, length, max_length; - IPFW_UH_WLOCK_ASSERT(ch); - /* * Unlink expired states from each bucket. * With acquired bucket lock iterate entries of each lists: @@ -2733,10 +2726,6 @@ s, entry); \ } \ } while (0) - /* - * Prevent rules changing from userland. - */ - IPFW_UH_WLOCK(chain); /* * Hold traffic processing until we finish resize to * prevent access to states lists. @@ -2780,7 +2769,6 @@ V_curr_dyn_buckets = new; IPFW_WUNLOCK(chain); - IPFW_UH_WUNLOCK(chain); /* Release old resources */ while (bucket-- != 0) @@ -2818,15 +2806,8 @@ * First free states unlinked in previous passes. */ dyn_free_states(&V_layer3_chain); - /* - * Now unlink others expired states. - * We use IPFW_UH_WLOCK to avoid concurrent call of - * dyn_expire_states(). It is the only function that does - * deletion of state entries from states lists. - */ - IPFW_UH_WLOCK(&V_layer3_chain); dyn_expire_states(&V_layer3_chain, NULL); - IPFW_UH_WUNLOCK(&V_layer3_chain); + /* * Send keepalives if they are enabled and the time has come. */ @@ -2863,14 +2844,24 @@ void ipfw_expire_dyn_states(struct ip_fw_chain *chain, ipfw_range_tlv *rt) { + IPFW_RLOCK_TRACKER; + /* * Do not perform any checks if we currently have no dynamic states */ if (V_dyn_count == 0) return; - IPFW_UH_WLOCK_ASSERT(chain); + /* + * Acquire read lock to prevent race with dyn_grow_hashtable() called + * via dyn_tick(). Note that dyn_tick() also calls dyn_expire_states(), + * but doesn't acquire the chain lock. A race between dyn_tick() and + * this function should be safe, as dyn_expire_states() does all proper + * locking of buckets and expire lists. + */ + IPFW_RLOCK(chain); dyn_expire_states(chain, rt); + IPFW_RUNLOCK(chain); } /* diff --git a/sys/netpfil/ipfw/ip_fw_iface.c b/sys/netpfil/ipfw/ip_fw_iface.c --- a/sys/netpfil/ipfw/ip_fw_iface.c +++ b/sys/netpfil/ipfw/ip_fw_iface.c @@ -320,9 +320,7 @@ * First request to subsystem. * Let's perform init. */ - IPFW_UH_WUNLOCK(ch); vnet_ipfw_iface_init(ch); - IPFW_UH_WLOCK(ch); ii = CHAIN_TO_II(ch); } @@ -335,8 +333,6 @@ return (0); } - IPFW_UH_WUNLOCK(ch); - /* Not found. Let's create one */ iif = malloc(sizeof(struct ipfw_iface), M_IPFW, M_WAITOK | M_ZERO); TAILQ_INIT(&iif->consumers); @@ -350,7 +346,6 @@ * are not holding any locks. */ iif->no.refcnt = 1; - IPFW_UH_WLOCK(ch); tmp = (struct ipfw_iface *)ipfw_objhash_lookup_name(ii, 0, name); if (tmp != NULL) { diff --git a/sys/netpfil/ipfw/ip_fw_log.c b/sys/netpfil/ipfw/ip_fw_log.c --- a/sys/netpfil/ipfw/ip_fw_log.c +++ b/sys/netpfil/ipfw/ip_fw_log.c @@ -722,7 +722,7 @@ /* O_LOG is the first action */ ((cmd = ACTION_PTR(f)) && cmd->arg1 == IPFW_LOG_DEFAULT)) { if (V_fw_verbose == 0) { - ipfw_bpf_tap(args, ip, + ipfw_bpf_tap(chain, args, ip, f != NULL ? f->rulenum : IPFW_DEFAULT_RULE); return; } @@ -737,6 +737,6 @@ ipfw_log_rtsock(chain, f, hlen, args, offset, tablearg, eh); if (cmd->arg1 & IPFW_LOG_IPFW0) - ipfw_bpf_tap(args, ip, f->rulenum); + ipfw_bpf_tap(chain, args, ip, f->rulenum); } /* end of file */ diff --git a/sys/netpfil/ipfw/ip_fw_nat.c b/sys/netpfil/ipfw/ip_fw_nat.c --- a/sys/netpfil/ipfw/ip_fw_nat.c +++ b/sys/netpfil/ipfw/ip_fw_nat.c @@ -503,7 +503,6 @@ gencnt = chain->gencnt; ptr = lookup_nat_name(&chain->nat, ucfg->name); if (ptr == NULL) { - IPFW_UH_WUNLOCK(chain); /* New rule: allocate and init new instance. */ ptr = malloc(sizeof(struct cfg_nat), M_IPFW, M_WAITOK | M_ZERO); ptr->lib = LibAliasInit(NULL); @@ -514,7 +513,6 @@ LIST_REMOVE(ptr, _next); flush_nat_ptrs(chain, ptr->id); IPFW_WUNLOCK(chain); - IPFW_UH_WUNLOCK(chain); } /* @@ -543,7 +541,6 @@ del_redir_spool_cfg(ptr, &ptr->redir_chain); /* Add new entries. */ add_redir_spool_cfg((char *)(ucfg + 1), ptr); - IPFW_UH_WLOCK(chain); /* Extra check to avoid race with another ipfw_nat_cfg() */ tcfg = NULL; @@ -1049,7 +1046,6 @@ len += sizeof(struct cfg_spool_legacy); } } - IPFW_UH_RUNLOCK(chain); data = malloc(len, M_TEMP, M_WAITOK | M_ZERO); bcopy(&nat_cnt, data, sizeof(nat_cnt)); @@ -1057,7 +1053,6 @@ nat_cnt = 0; len = sizeof(nat_cnt); - IPFW_UH_RLOCK(chain); if (gencnt != chain->gencnt) { free(data, M_TEMP); goto retry; diff --git a/sys/netpfil/ipfw/ip_fw_private.h b/sys/netpfil/ipfw/ip_fw_private.h --- a/sys/netpfil/ipfw/ip_fw_private.h +++ b/sys/netpfil/ipfw/ip_fw_private.h @@ -28,6 +28,9 @@ #ifndef _IPFW2_PRIVATE_H #define _IPFW2_PRIVATE_H +#include +#include + /* * Internal constants and data structures used by ipfw components * and not meant to be exported outside the kernel. @@ -161,9 +164,10 @@ void ipfw_bpf_init(int); void ipfw_bpf_uninit(int); -void ipfw_tap_alloc(uint32_t); -void ipfw_tap_free(uint32_t); -void ipfw_bpf_tap(struct ip_fw_args *, struct ip *, uint32_t); +void ipfw_tap_alloc(struct ip_fw_chain *, uint32_t); +void ipfw_tap_free(struct ip_fw_chain *, uint32_t); +void ipfw_bpf_tap(struct ip_fw_chain *, struct ip_fw_args *, struct ip *, + uint32_t); void ipfw_pflog_tap(void *, struct mbuf *); void ipfw_log(struct ip_fw_chain *chain, struct ip_fw *f, u_int hlen, struct ip_fw_args *args, u_short offset, uint32_t tablearg, struct ip *ip, @@ -320,10 +324,11 @@ void *ifcfg; /* interface module data */ int *idxmap_back; /* standby skipto array of rules */ struct namedobj_instance *srvmap; /* cfg name->number mappings */ + RB_HEAD(tap_tree, ipfw_tap) taps; /* see ip_fw_bpf.c */ #if defined( __linux__ ) || defined( _WIN32 ) spinlock_t uh_lock; #else - struct rwlock uh_lock; /* lock for upper half */ + struct sx uh_lock; /* lock for upper half */ #endif }; @@ -451,12 +456,12 @@ #else /* FreeBSD */ #define IPFW_LOCK_INIT(_chain) do { \ rm_init_flags(&(_chain)->rwmtx, "IPFW static rules", RM_RECURSE); \ - rw_init(&(_chain)->uh_lock, "IPFW UH lock"); \ + sx_init(&(_chain)->uh_lock, "IPFW UH lock"); \ } while (0) #define IPFW_LOCK_DESTROY(_chain) do { \ rm_destroy(&(_chain)->rwmtx); \ - rw_destroy(&(_chain)->uh_lock); \ + sx_destroy(&(_chain)->uh_lock); \ } while (0) #define IPFW_RLOCK_ASSERT(_chain) rm_assert(&(_chain)->rwmtx, RA_RLOCKED) @@ -471,14 +476,14 @@ #define IPFW_PF_RUNLOCK(p) IPFW_RUNLOCK(p) #endif -#define IPFW_UH_RLOCK_ASSERT(_chain) rw_assert(&(_chain)->uh_lock, RA_RLOCKED) -#define IPFW_UH_WLOCK_ASSERT(_chain) rw_assert(&(_chain)->uh_lock, RA_WLOCKED) -#define IPFW_UH_UNLOCK_ASSERT(_chain) rw_assert(&(_chain)->uh_lock, RA_UNLOCKED) +#define IPFW_UH_RLOCK_ASSERT(_chain) sx_assert(&(_chain)->uh_lock, SA_SLOCKED) +#define IPFW_UH_WLOCK_ASSERT(_chain) sx_assert(&(_chain)->uh_lock, SA_XLOCKED) +#define IPFW_UH_UNLOCK_ASSERT(_chain) sx_assert(&(_chain)->uh_lock, SA_UNLOCKED) -#define IPFW_UH_RLOCK(p) rw_rlock(&(p)->uh_lock) -#define IPFW_UH_RUNLOCK(p) rw_runlock(&(p)->uh_lock) -#define IPFW_UH_WLOCK(p) rw_wlock(&(p)->uh_lock) -#define IPFW_UH_WUNLOCK(p) rw_wunlock(&(p)->uh_lock) +#define IPFW_UH_RLOCK(p) sx_slock(&(p)->uh_lock) +#define IPFW_UH_RUNLOCK(p) sx_sunlock(&(p)->uh_lock) +#define IPFW_UH_WLOCK(p) sx_xlock(&(p)->uh_lock) +#define IPFW_UH_WUNLOCK(p) sx_xunlock(&(p)->uh_lock) struct obj_idx { uint32_t uidx; /* internal index supplied by userland */ diff --git a/sys/netpfil/ipfw/ip_fw_sockopt.c b/sys/netpfil/ipfw/ip_fw_sockopt.c --- a/sys/netpfil/ipfw/ip_fw_sockopt.c +++ b/sys/netpfil/ipfw/ip_fw_sockopt.c @@ -210,8 +210,6 @@ */ if (rule->refcnt > 1) return; - if (ACTION_PTR(rule)->opcode == O_LOG) - ipfw_tap_free(rule->rulenum); uma_zfree_pcpu(V_ipfw_cntr_zone, rule->cntr); free(rule, M_IPFW); } @@ -337,44 +335,15 @@ } /* - * allocate a new map, returns the chain locked. extra is the number - * of entries to add or delete. - */ -static struct ip_fw ** -get_map(struct ip_fw_chain *chain, int extra, int locked) -{ - - for (;;) { - struct ip_fw **map; - u_int i, mflags; - - mflags = M_ZERO | ((locked != 0) ? M_NOWAIT : M_WAITOK); - - i = chain->n_rules + extra; - map = malloc(i * sizeof(struct ip_fw *), M_IPFW, mflags); - if (map == NULL) { - printf("%s: cannot allocate map\n", __FUNCTION__); - return NULL; - } - if (!locked) - IPFW_UH_WLOCK(chain); - if (i >= chain->n_rules + extra) /* good */ - return map; - /* otherwise we lost the race, free and retry */ - if (!locked) - IPFW_UH_WUNLOCK(chain); - free(map, M_IPFW); - } -} - -/* - * swap the maps. It is supposed to be called with IPFW_UH_WLOCK + * swap the maps. */ static struct ip_fw ** swap_map(struct ip_fw_chain *chain, struct ip_fw **new_map, int new_len) { struct ip_fw **old_map; + IPFW_UH_WLOCK_ASSERT(chain); + IPFW_WLOCK(chain); chain->id++; chain->n_rules = new_len; @@ -459,6 +428,7 @@ struct ip_fw *krule; struct ip_fw **map; /* the new array of pointers */ + IPFW_UH_WLOCK(chain); /* Check if we need to do table/obj index remap */ tcount = 0; for (ci = rci, i = 0; i < count; ci++, i++) { @@ -484,8 +454,6 @@ * We have some more table rules * we need to rollback. */ - - IPFW_UH_WLOCK(chain); while (ci != rci) { ci--; if (ci->object_opcodes == 0) @@ -493,33 +461,16 @@ unref_rule_objects(chain,ci->krule); } - IPFW_UH_WUNLOCK(chain); - } - + IPFW_UH_WUNLOCK(chain); return (error); } tcount++; } - /* get_map returns with IPFW_UH_WLOCK if successful */ - map = get_map(chain, count, 0 /* not locked */); - if (map == NULL) { - if (tcount > 0) { - /* Unbind tables */ - IPFW_UH_WLOCK(chain); - for (ci = rci, i = 0; i < count; ci++, i++) { - if (ci->object_opcodes == 0) - continue; - - unref_rule_objects(chain, ci->krule); - } - IPFW_UH_WUNLOCK(chain); - } - - return (ENOSPC); - } + map = malloc((chain->n_rules + count) * sizeof(struct ip_fw *), + M_IPFW, M_ZERO | M_WAITOK); if (V_autoinc_step < 1) V_autoinc_step = 1; @@ -552,6 +503,8 @@ memcpy((char *)ci->urule + ci->urule_numoff, &rulenum, sizeof(rulenum)); } + if (ACTION_PTR(krule)->opcode == O_LOG) + ipfw_tap_alloc(chain, krule->rulenum); } /* duplicate the remaining part, we always have the default rule */ @@ -572,9 +525,9 @@ { struct ip_fw **map; - map = get_map(chain, 1, 0); - if (map == NULL) - return (ENOMEM); + IPFW_UH_WLOCK(chain); + map = malloc((chain->n_rules + 1) * sizeof(struct ip_fw *), + M_IPFW, M_ZERO | M_WAITOK); if (chain->n_rules > 0) bcopy(chain->map, map, chain->n_rules * sizeof(struct ip_fw *)); @@ -812,12 +765,8 @@ } /* Allocate new map of the same size */ - map = get_map(chain, 0, 1 /* locked */); - if (map == NULL) { - IPFW_UH_WUNLOCK(chain); - return (ENOMEM); - } - + map = malloc(chain->n_rules * sizeof(struct ip_fw *), + M_IPFW, M_ZERO | M_WAITOK); n = 0; ndyn = 0; ofs = start; @@ -2153,6 +2102,8 @@ else no->refcnt--; } + if (ACTION_PTR(rule)->opcode == O_LOG) + ipfw_tap_free(ch, rule->rulenum); } /* @@ -2227,7 +2178,7 @@ cmdlen = 0; error = 0; - IPFW_UH_WLOCK(ch); + IPFW_UH_WLOCK_ASSERT(ch); /* Increase refcount on each existing referenced table. */ for ( ; l > 0 ; l -= cmdlen, cmd += cmdlen) { @@ -2250,10 +2201,8 @@ if (error != 0) { /* Unref everything we have already done */ unref_oib_objects(ch, rule->cmd, oib, pidx); - IPFW_UH_WUNLOCK(ch); return (error); } - IPFW_UH_WUNLOCK(ch); /* Perform auto-creation for non-existing objects */ if (pidx != oib) @@ -2512,9 +2461,6 @@ /* Copy opcodes */ memcpy(krule->cmd, urule->cmd, krule->cmd_len * sizeof(uint32_t)); - - if (ACTION_PTR(krule)->opcode == O_LOG) - ipfw_tap_alloc(krule->rulenum); } /* diff --git a/sys/netpfil/ipfw/ip_fw_table.h b/sys/netpfil/ipfw/ip_fw_table.h --- a/sys/netpfil/ipfw/ip_fw_table.h +++ b/sys/netpfil/ipfw/ip_fw_table.h @@ -32,7 +32,39 @@ */ #ifdef _KERNEL -struct table_algo; +/* + * Table has the following `type` concepts: + * + * `no.type` represents lookup key type (addr, ifp, uid, etc..) + * vmask represents bitmask of table values which are present at the moment. + * Special IPFW_VTYPE_LEGACY ( (uint32_t)-1 ) represents old + * single-value-for-all approach. + */ +struct table_config { + struct named_object no; + uint8_t tflags; /* type flags */ + uint8_t locked; /* 1 if locked from changes */ + uint8_t linked; /* 1 if already linked */ + uint8_t ochanged; /* used by set swapping */ + uint8_t vshared; /* 1 if using shared value array */ + uint8_t spare[3]; + uint32_t count; /* Number of records */ + uint32_t limit; /* Max number of records */ + uint32_t vmask; /* bitmask with supported values */ + uint32_t ocount; /* used by set swapping */ + uint64_t gencnt; /* generation count */ + char tablename[64]; /* table name */ + struct table_algo *ta; /* Callbacks for given algo */ + void *astate; /* algorithm state */ + struct table_info { + table_lookup_t *lookup;/* Lookup function */ + void *state; /* Lookup radix/other structure */ + void *xstate;/* eXtended state */ + u_long data; /* Hints for given func */ + } ti_copy; /* data to put to table_info */ + struct namedobj_instance *vi; +}; + struct tables_config { struct namedobj_instance *namehash; struct namedobj_instance *valhash; @@ -40,18 +72,9 @@ uint32_t algo_count; struct table_algo *algo[256]; struct table_algo *def_algo[IPFW_TABLE_MAXTYPE + 1]; - TAILQ_HEAD(op_state_l,op_state) state_list; }; #define CHAIN_TO_TCFG(chain) ((struct tables_config *)(chain)->tblcfg) -struct table_info { - table_lookup_t *lookup; /* Lookup function */ - void *state; /* Lookup radix/other structure */ - void *xstate; /* eXtended state */ - u_long data; /* Hints for given func */ -}; - -struct table_value; struct tentry_info { void *paddr; struct table_value *pvalue; @@ -159,18 +182,16 @@ /* ipfw_table_value.c functions */ struct table_config; -struct tableop_state; void ipfw_table_value_init(struct ip_fw_chain *ch, int first); void ipfw_table_value_destroy(struct ip_fw_chain *ch, int last); -int ipfw_link_table_values(struct ip_fw_chain *ch, struct tableop_state *ts, - uint8_t flags); +int ipfw_link_table_values(struct ip_fw_chain *ch, struct table_config *tc, + struct tentry_info *tei, uint32_t count, uint8_t flags); void ipfw_garbage_table_values(struct ip_fw_chain *ch, struct table_config *tc, struct tentry_info *tei, uint32_t count, int rollback); void ipfw_import_table_value_v1(ipfw_table_value *iv); void ipfw_export_table_value_v1(struct table_value *v, ipfw_table_value *iv); void ipfw_unref_table_values(struct ip_fw_chain *ch, struct table_config *tc, struct table_algo *ta, void *astate, struct table_info *ti); -void rollback_table_values(struct tableop_state *ts); int ipfw_rewrite_table_uidx(struct ip_fw_chain *chain, struct rule_check_info *ci); @@ -189,32 +210,5 @@ int ipfw_foreach_table_tentry(struct ip_fw_chain *ch, uint32_t kidx, ta_foreach_f f, void *arg); -/* internal functions */ -void tc_ref(struct table_config *tc); -void tc_unref(struct table_config *tc); - -struct op_state; -typedef void (op_rollback_f)(void *object, struct op_state *state); -struct op_state { - TAILQ_ENTRY(op_state) next; /* chain link */ - op_rollback_f *func; -}; - -struct tableop_state { - struct op_state opstate; - struct ip_fw_chain *ch; - struct table_config *tc; - struct table_algo *ta; - struct tentry_info *tei; - uint32_t count; - uint32_t vmask; - int vshared; - int modified; -}; - -void add_toperation_state(struct ip_fw_chain *ch, struct tableop_state *ts); -void del_toperation_state(struct ip_fw_chain *ch, struct tableop_state *ts); -void rollback_toperation_state(struct ip_fw_chain *ch, void *object); - #endif /* _KERNEL */ #endif /* _IPFW2_TABLE_H */ diff --git a/sys/netpfil/ipfw/ip_fw_table.c b/sys/netpfil/ipfw/ip_fw_table.c --- a/sys/netpfil/ipfw/ip_fw_table.c +++ b/sys/netpfil/ipfw/ip_fw_table.c @@ -61,34 +61,6 @@ #include #include - /* - * Table has the following `type` concepts: - * - * `no.type` represents lookup key type (addr, ifp, uid, etc..) - * vmask represents bitmask of table values which are present at the moment. - * Special IPFW_VTYPE_LEGACY ( (uint32_t)-1 ) represents old - * single-value-for-all approach. - */ -struct table_config { - struct named_object no; - uint8_t tflags; /* type flags */ - uint8_t locked; /* 1 if locked from changes */ - uint8_t linked; /* 1 if already linked */ - uint8_t ochanged; /* used by set swapping */ - uint8_t vshared; /* 1 if using shared value array */ - uint8_t spare[3]; - uint32_t count; /* Number of records */ - uint32_t limit; /* Max number of records */ - uint32_t vmask; /* bitmask with supported values */ - uint32_t ocount; /* used by set swapping */ - uint64_t gencnt; /* generation count */ - char tablename[64]; /* table name */ - struct table_algo *ta; /* Callbacks for given algo */ - void *astate; /* algorithm state */ - struct table_info ti_copy; /* data to put to table_info */ - struct namedobj_instance *vi; -}; - static int find_table_err(struct namedobj_instance *ni, struct tid_info *ti, struct table_config **tc); static struct table_config *find_table(struct namedobj_instance *ni, @@ -115,8 +87,8 @@ struct tid_info *b); static int check_table_name(const char *name); -static int check_table_space(struct ip_fw_chain *ch, struct tableop_state *ts, - struct table_config *tc, struct table_info *ti, uint32_t count); +static int check_table_space(struct ip_fw_chain *ch, struct table_config *tc, + struct table_info *ti, uint32_t count); static int destroy_table(struct ip_fw_chain *ch, struct tid_info *ti); static struct table_algo *find_table_algo(struct tables_config *tableconf, @@ -130,49 +102,6 @@ #define TA_BUF_SZ 128 /* On-stack buffer for add/delete state */ -void -rollback_toperation_state(struct ip_fw_chain *ch, void *object) -{ - struct tables_config *tcfg; - struct op_state *os; - - tcfg = CHAIN_TO_TCFG(ch); - TAILQ_FOREACH(os, &tcfg->state_list, next) - os->func(object, os); -} - -void -add_toperation_state(struct ip_fw_chain *ch, struct tableop_state *ts) -{ - struct tables_config *tcfg; - - tcfg = CHAIN_TO_TCFG(ch); - TAILQ_INSERT_HEAD(&tcfg->state_list, &ts->opstate, next); -} - -void -del_toperation_state(struct ip_fw_chain *ch, struct tableop_state *ts) -{ - struct tables_config *tcfg; - - tcfg = CHAIN_TO_TCFG(ch); - TAILQ_REMOVE(&tcfg->state_list, &ts->opstate, next); -} - -void -tc_ref(struct table_config *tc) -{ - - tc->no.refcnt++; -} - -void -tc_unref(struct table_config *tc) -{ - - tc->no.refcnt--; -} - static struct table_value * get_table_value(struct ip_fw_chain *ch, struct table_config *tc, uint32_t kidx) { @@ -277,7 +206,6 @@ * creating new one. * * Saves found table config into @ptc. - * Note function may drop/acquire UH_WLOCK. * Returns 0 if table was found/created and referenced * or non-zero return code. */ @@ -321,9 +249,7 @@ if ((tei->flags & TEI_FLAGS_COMPAT) == 0) return (ESRCH); - IPFW_UH_WUNLOCK(ch); error = create_table_compat(ch, ti, &kidx); - IPFW_UH_WLOCK(ch); if (error != 0) return (error); @@ -476,57 +402,9 @@ free(ta_buf_m, M_TEMP); } -static void -rollback_add_entry(void *object, struct op_state *_state) -{ - struct ip_fw_chain *ch __diagused; - struct tableop_state *ts; - - ts = (struct tableop_state *)_state; - - if (ts->tc != object && ts->ch != object) - return; - - ch = ts->ch; - - IPFW_UH_WLOCK_ASSERT(ch); - - /* Call specifid unlockers */ - rollback_table_values(ts); - - /* Indicate we've called */ - ts->modified = 1; -} - /* * Adds/updates one or more entries in table @ti. * - * Function may drop/reacquire UH wlock multiple times due to - * items alloc, algorithm callbacks (check_space), value linkage - * (new values, value storage realloc), etc.. - * Other processes like other adds (which may involve storage resize), - * table swaps (which changes table data and may change algo type), - * table modify (which may change value mask) may be executed - * simultaneously so we need to deal with it. - * - * The following approach was implemented: - * we have per-chain linked list, protected with UH lock. - * add_table_entry prepares special on-stack structure wthich is passed - * to its descendants. Users add this structure to this list before unlock. - * After performing needed operations and acquiring UH lock back, each user - * checks if structure has changed. If true, it rolls local state back and - * returns without error to the caller. - * add_table_entry() on its own checks if structure has changed and restarts - * its operation from the beginning (goto restart). - * - * Functions which are modifying fields of interest (currently - * resize_shared_value_storage() and swap_tables() ) - * traverses given list while holding UH lock immediately before - * performing their operations calling function provided be list entry - * ( currently rollback_add_entry ) which performs rollback for all necessary - * state and sets appropriate values in structure indicating rollback - * has happened. - * * Algo interaction: * Function references @ti first to ensure table won't * disappear or change its type. @@ -545,92 +423,47 @@ struct table_config *tc; struct table_algo *ta; struct tentry_info *ptei; - struct tableop_state ts; char ta_buf[TA_BUF_SZ]; caddr_t ta_buf_m, v; uint32_t kidx, num, numadd; - int error, first_error, i, rollback; + int error, first_error, i, rollback = 0; - memset(&ts, 0, sizeof(ts)); - ta = NULL; IPFW_UH_WLOCK(ch); /* * Find and reference existing table. */ -restart: - if (ts.modified != 0) { - IPFW_UH_WUNLOCK(ch); - flush_batch_buffer(ch, ta, tei, count, rollback, - ta_buf_m, ta_buf); - memset(&ts, 0, sizeof(ts)); - ta = NULL; - IPFW_UH_WLOCK(ch); - } - error = find_ref_table(ch, ti, tei, count, OP_ADD, &tc); if (error != 0) { IPFW_UH_WUNLOCK(ch); return (error); } + /* Drop reference we've used in first search */ + tc->no.refcnt--; ta = tc->ta; - /* Fill in tablestate */ - ts.ch = ch; - ts.opstate.func = rollback_add_entry; - ts.tc = tc; - ts.vshared = tc->vshared; - ts.vmask = tc->vmask; - ts.ta = ta; - ts.tei = tei; - ts.count = count; - rollback = 0; - add_toperation_state(ch, &ts); - IPFW_UH_WUNLOCK(ch); - /* Allocate memory and prepare record(s) */ /* Pass stack buffer by default */ ta_buf_m = ta_buf; error = prepare_batch_buffer(ch, ta, tei, count, OP_ADD, &ta_buf_m); - - IPFW_UH_WLOCK(ch); - del_toperation_state(ch, &ts); - /* Drop reference we've used in first search */ - tc->no.refcnt--; - - /* Check prepare_batch_buffer() error */ if (error != 0) goto cleanup; - /* - * Check if table swap has happened. - * (so table algo might be changed). - * Restart operation to achieve consistent behavior. - */ - if (ts.modified != 0) - goto restart; - /* * Link all values values to shared/per-table value array. - * - * May release/reacquire UH_WLOCK. */ - error = ipfw_link_table_values(ch, &ts, flags); + error = ipfw_link_table_values(ch, tc, tei, count, flags); if (error != 0) goto cleanup; - if (ts.modified != 0) - goto restart; /* * Ensure we are able to add all entries without additional - * memory allocations. May release/reacquire UH_WLOCK. + * memory allocations. */ kidx = tc->no.kidx; - error = check_table_space(ch, &ts, tc, KIDX_TO_TI(ch, kidx), count); + error = check_table_space(ch, tc, KIDX_TO_TI(ch, kidx), count); if (error != 0) goto cleanup; - if (ts.modified != 0) - goto restart; /* We've got valid table in @tc. Let's try to add data */ kidx = tc->no.kidx; @@ -690,7 +523,7 @@ /* Permit post-add algorithm grow/rehash. */ if (numadd != 0) - check_table_space(ch, NULL, tc, KIDX_TO_TI(ch, kidx), 0); + check_table_space(ch, tc, KIDX_TO_TI(ch, kidx), 0); /* Return first error to user, if any */ error = first_error; @@ -730,7 +563,6 @@ return (error); } ta = tc->ta; - IPFW_UH_WUNLOCK(ch); /* Allocate memory and prepare record(s) */ /* Pass stack buffer by default */ @@ -739,8 +571,6 @@ if (error != 0) goto cleanup; - IPFW_UH_WLOCK(ch); - /* Drop reference we've used in first search */ tc->no.refcnt--; @@ -779,7 +609,7 @@ if (numdel != 0) { /* Run post-del hook to permit shrinking */ - check_table_space(ch, NULL, tc, KIDX_TO_TI(ch, kidx), 0); + check_table_space(ch, tc, KIDX_TO_TI(ch, kidx), 0); } IPFW_UH_WUNLOCK(ch); @@ -808,8 +638,8 @@ * Returns 0 on success. */ static int -check_table_space(struct ip_fw_chain *ch, struct tableop_state *ts, - struct table_config *tc, struct table_info *ti, uint32_t count) +check_table_space(struct ip_fw_chain *ch, struct table_config *tc, + struct table_info *ti, uint32_t count) { struct table_algo *ta; uint64_t pflags; @@ -838,36 +668,14 @@ break; } - /* We have to shrink/grow table */ - if (ts != NULL) - add_toperation_state(ch, ts); - IPFW_UH_WUNLOCK(ch); - memset(&ta_buf, 0, sizeof(ta_buf)); error = ta->prepare_mod(ta_buf, &pflags); - - IPFW_UH_WLOCK(ch); - if (ts != NULL) - del_toperation_state(ch, ts); - if (error != 0) break; - if (ts != NULL && ts->modified != 0) { - /* - * Swap operation has happened - * so we're currently operating on other - * table data. Stop doing this. - */ - ta->flush_mod(ta_buf); - break; - } - /* Check if we still need to alter table */ ti = KIDX_TO_TI(ch, tc->no.kidx); if (ta->need_modify(tc->astate, ti, count, &pflags) == 0) { - IPFW_UH_WUNLOCK(ch); - /* * Other thread has already performed resize. * Flush our state and return. @@ -1031,7 +839,6 @@ ipfw_obj_header *oh; struct tid_info ti; struct table_config *tc; - struct table_algo *ta; struct table_info *kti; struct table_value *pval; struct namedobj_instance *ni; @@ -1060,7 +867,6 @@ /* * Find existing table and check its type . */ - ta = NULL; if ((tc = find_table(ni, &ti)) == NULL) { IPFW_UH_RUNLOCK(ch); return (ESRCH); @@ -1073,12 +879,8 @@ } kti = KIDX_TO_TI(ch, tc->no.kidx); - ta = tc->ta; - - if (ta->find_tentry == NULL) - return (ENOTSUP); - error = ta->find_tentry(tc->astate, kti, tent); + error = tc->ta->find_tentry(tc->astate, kti, tent); if (error == 0) { pval = get_table_value(ch, tc, tent->v.kidx); ipfw_export_table_value_v1(pval, &tent->v.value); @@ -1119,20 +921,6 @@ return (error); } -static void -restart_flush(void *object, struct op_state *_state) -{ - struct tableop_state *ts; - - ts = (struct tableop_state *)_state; - - if (ts->tc != object) - return; - - /* Indicate we've called */ - ts->modified = 1; -} - /* * Flushes given table. * @@ -1151,8 +939,7 @@ struct table_info ti_old, ti_new, *tablestate; void *astate_old, *astate_new; char algostate[64], *pstate; - struct tableop_state ts; - int error, need_gc; + int error; uint32_t kidx; uint8_t tflags; @@ -1166,15 +953,8 @@ IPFW_UH_WUNLOCK(ch); return (ESRCH); } - need_gc = 0; astate_new = NULL; memset(&ti_new, 0, sizeof(ti_new)); -restart: - /* Set up swap handler */ - memset(&ts, 0, sizeof(ts)); - ts.opstate.func = restart_flush; - ts.tc = tc; - ta = tc->ta; /* Do not flush readonly tables */ if ((ta->flags & TA_FLAG_READONLY) != 0) { @@ -1189,17 +969,6 @@ } else pstate = NULL; tflags = tc->tflags; - tc->no.refcnt++; - add_toperation_state(ch, &ts); - IPFW_UH_WUNLOCK(ch); - - /* - * Stage 1.5: if this is not the first attempt, destroy previous state - */ - if (need_gc != 0) { - ta->destroy(astate_new, &ti_new); - need_gc = 0; - } /* * Stage 2: allocate new table instance using same algo. @@ -1211,27 +980,11 @@ * Stage 3: swap old state pointers with newly-allocated ones. * Decrease refcount. */ - IPFW_UH_WLOCK(ch); - tc->no.refcnt--; - del_toperation_state(ch, &ts); - if (error != 0) { IPFW_UH_WUNLOCK(ch); return (error); } - /* - * Restart operation if table swap has happened: - * even if algo may be the same, algo init parameters - * may change. Restart operation instead of doing - * complex checks. - */ - if (ts.modified != 0) { - /* Delay destroying data since we're holding UH lock */ - need_gc = 1; - goto restart; - } - ni = CHAIN_TO_NI(ch); kidx = tc->no.kidx; tablestate = (struct table_info *)ch->tablestate; @@ -1371,10 +1124,6 @@ return (EACCES); } - /* Notify we're going to swap */ - rollback_toperation_state(ch, tc_a); - rollback_toperation_state(ch, tc_b); - /* Everything is fine, prepare to swap */ tablestate = (struct table_info *)ch->tablestate; ti = tablestate[tc_a->no.kidx]; @@ -1565,7 +1314,7 @@ if (tc == NULL) return (ESRCH); - tc_ref(tc); + tc->no.refcnt++; *kidx = tc->no.kidx; return (0); @@ -1748,6 +1497,7 @@ char *tname, *aname; struct tid_info ti; struct namedobj_instance *ni; + int rv; if (sd->valsize != sizeof(*oh) + sizeof(ipfw_xtable_info)) return (EINVAL); @@ -1775,14 +1525,15 @@ ni = CHAIN_TO_NI(ch); - IPFW_UH_RLOCK(ch); + IPFW_UH_WLOCK(ch); if (find_table(ni, &ti) != NULL) { - IPFW_UH_RUNLOCK(ch); + IPFW_UH_WUNLOCK(ch); return (EEXIST); } - IPFW_UH_RUNLOCK(ch); + rv = create_table_internal(ch, &ti, aname, i, NULL, 0); + IPFW_UH_WUNLOCK(ch); - return (create_table_internal(ch, &ti, aname, i, NULL, 0)); + return (rv); } /* @@ -1803,6 +1554,8 @@ struct table_algo *ta; uint32_t kidx; + IPFW_UH_WLOCK_ASSERT(ch); + ni = CHAIN_TO_NI(ch); ta = find_table_algo(CHAIN_TO_TCFG(ch), ti, aname); @@ -1820,8 +1573,6 @@ else tc->locked = (i->flags & IPFW_TGFLAGS_LOCKED) != 0; - IPFW_UH_WLOCK(ch); - /* Check if table has been already created */ tc_new = find_table(ni, ti); if (tc_new != NULL) { @@ -1831,7 +1582,6 @@ * which has the same type */ if (compat == 0 || tc_new->no.subtype != tc->no.subtype) { - IPFW_UH_WUNLOCK(ch); free_table_config(ni, tc); return (EEXIST); } @@ -1843,7 +1593,6 @@ } else { /* New table */ if (ipfw_objhash_alloc_idx(ni, &kidx) != 0) { - IPFW_UH_WUNLOCK(ch); printf("Unable to allocate table index." " Consider increasing net.inet.ip.fw.tables_max"); free_table_config(ni, tc); @@ -1860,8 +1609,6 @@ if (pkidx != NULL) *pkidx = tc->no.kidx; - IPFW_UH_WUNLOCK(ch); - if (tc_new != NULL) free_table_config(ni, tc_new); diff --git a/sys/netpfil/ipfw/ip_fw_table_value.c b/sys/netpfil/ipfw/ip_fw_table_value.c --- a/sys/netpfil/ipfw/ip_fw_table_value.c +++ b/sys/netpfil/ipfw/ip_fw_table_value.c @@ -125,13 +125,13 @@ } static void -get_value_ptrs(struct ip_fw_chain *ch, struct table_config *tc, int vshared, +get_value_ptrs(struct ip_fw_chain *ch, struct table_config *tc, struct table_value **ptv, struct namedobj_instance **pvi) { struct table_value *pval; struct namedobj_instance *vi; - if (vshared != 0) { + if (tc->vshared != 0) { pval = (struct table_value *)ch->valuestate; vi = CHAIN_TO_VI(ch); } else { @@ -147,7 +147,7 @@ } /* - * Update pointers to real vaues after @pval change. + * Update pointers to real values after @pval change. */ static int update_tvalue(struct namedobj_instance *ni, struct named_object *no, void *arg) @@ -167,7 +167,6 @@ /* * Grows value storage shared among all tables. - * Drops/reacquires UH locks. * Notifies other running adds on @ch shared storage resize. * Note function does not guarantee that free space * will be available after invocation, so one caller needs @@ -200,15 +199,11 @@ if (val_size == (1 << 30)) return (ENOSPC); - IPFW_UH_WUNLOCK(ch); - valuestate = malloc(sizeof(struct table_value) * val_size, M_IPFW, M_WAITOK | M_ZERO); ipfw_objhash_bitmap_alloc(val_size, (void *)&new_idx, &new_blocks); - IPFW_UH_WLOCK(ch); - /* * Check if we still need to resize */ @@ -217,7 +212,6 @@ /* Update pointers and notify everyone we're changing @ch */ pval = (struct table_value *)ch->valuestate; - rollback_toperation_state(ch, ch); /* Good. Let's merge */ memcpy(valuestate, pval, sizeof(struct table_value) * tcfg->val_size); @@ -322,49 +316,13 @@ ta->foreach(astate, ti, unref_table_value_cb, &fa); } -/* - * Table operation state handler. - * Called when we are going to change something in @tc which - * may lead to inconsistencies in on-going table data addition. - * - * Here we rollback all already committed state (table values, currently) - * and set "modified" field to non-zero value to indicate - * that we need to restart original operation. - */ -void -rollback_table_values(struct tableop_state *ts) -{ - struct ip_fw_chain *ch; - struct table_value *pval; - struct tentry_info *ptei; - struct namedobj_instance *vi; - int i; - - ch = ts->ch; - - IPFW_UH_WLOCK_ASSERT(ch); - - /* Get current table value pointer */ - get_value_ptrs(ch, ts->tc, ts->vshared, &pval, &vi); - - for (i = 0; i < ts->count; i++) { - ptei = &ts->tei[i]; - - if (ptei->value == 0) - continue; - - unref_table_value(vi, pval, ptei->value); - } -} - /* * Allocate new value index in either shared or per-table array. - * Function may drop/reacquire UH lock. * * Returns 0 on success. */ static int -alloc_table_vidx(struct ip_fw_chain *ch, struct tableop_state *ts, +alloc_table_vidx(struct ip_fw_chain *ch, struct table_config *tc, struct namedobj_instance *vi, uint32_t *pvidx, uint8_t flags) { int error, vlimit; @@ -372,19 +330,11 @@ IPFW_UH_WLOCK_ASSERT(ch); - error = ipfw_objhash_alloc_idx(vi, &vidx); - if (error != 0) { - /* - * We need to resize array. This involves - * lock/unlock, so we need to check "modified" - * state. - */ - ts->opstate.func(ts->tc, &ts->opstate); - error = resize_shared_value_storage(ch); - return (error); /* ts->modified should be set, we will restart */ - } + if ((error = ipfw_objhash_alloc_idx(vi, &vidx)) != 0 && + (error = resize_shared_value_storage(ch)) != 0) + return (error); - vlimit = ts->ta->vlimit; + vlimit = tc->ta->vlimit; if (vlimit != 0 && vidx >= vlimit && !(flags & IPFW_CTF_ATOMIC)) { /* * Algorithm is not able to store given index. @@ -392,7 +342,7 @@ * per-table value array or return error * if we're already using it. */ - if (ts->vshared != 0) { + if (tc->vshared != 0) { /* shared -> per-table */ return (ENOSPC); /* TODO: proper error */ } @@ -437,9 +387,8 @@ /* * Get current table value pointers. - * XXX: Properly read vshared */ - get_value_ptrs(ch, tc, 1, &pval, &vi); + get_value_ptrs(ch, tc, &pval, &vi); for (i = 0; i < count; i++) { ptei = &tei[i]; @@ -470,14 +419,13 @@ * Success: return 0. */ int -ipfw_link_table_values(struct ip_fw_chain *ch, struct tableop_state *ts, - uint8_t flags) +ipfw_link_table_values(struct ip_fw_chain *ch, struct table_config *tc, + struct tentry_info *tei, uint32_t count, uint8_t flags) { int error, i, found; struct namedobj_instance *vi; - struct table_config *tc; - struct tentry_info *tei, *ptei; - uint32_t count, vidx, vlimit; + struct tentry_info *ptei; + uint32_t vidx, vlimit; struct table_val_link *ptv; struct table_value tval, *pval; @@ -486,19 +434,16 @@ * save their indices. */ IPFW_UH_WLOCK_ASSERT(ch); - get_value_ptrs(ch, ts->tc, ts->vshared, &pval, &vi); + get_value_ptrs(ch, tc, &pval, &vi); error = 0; found = 0; - vlimit = ts->ta->vlimit; + vlimit = tc->ta->vlimit; vidx = 0; - tc = ts->tc; - tei = ts->tei; - count = ts->count; for (i = 0; i < count; i++) { ptei = &tei[i]; ptei->value = 0; /* Ensure value is always 0 in the beginning */ - mask_table_value(ptei->pvalue, &tval, ts->vmask); + mask_table_value(ptei->pvalue, &tval, tc->vmask); ptv = (struct table_val_link *)ipfw_objhash_lookup_name(vi, 0, (char *)&tval); if (ptv == NULL) @@ -513,20 +458,11 @@ found++; } - if (ts->count == found) { - /* We've found all values , no need ts create new ones */ + if (count == found) { + /* We've found all values, no need to create new ones. */ return (0); } - /* - * we have added some state here, let's attach operation - * state ts the list ts be able ts rollback if necessary. - */ - add_toperation_state(ch, ts); - /* Ensure table won't disappear */ - tc_ref(tc); - IPFW_UH_WUNLOCK(ch); - /* * Stage 2: allocate objects for non-existing values. */ @@ -544,18 +480,6 @@ * Stage 3: allocate index numbers for new values * and link them to index. */ - IPFW_UH_WLOCK(ch); - tc_unref(tc); - del_toperation_state(ch, ts); - if (ts->modified != 0) { - /* - * In general, we should free all state/indexes here - * and return. However, we keep allocated state instead - * to ensure we achieve some progress on each restart. - */ - return (0); - } - KASSERT(pval == ch->valuestate, ("resize_storage() notify failure")); /* Let's try to link values */ @@ -563,7 +487,7 @@ ptei = &tei[i]; /* Check if record has appeared */ - mask_table_value(ptei->pvalue, &tval, ts->vmask); + mask_table_value(ptei->pvalue, &tval, tc->vmask); ptv = (struct table_val_link *)ipfw_objhash_lookup_name(vi, 0, (char *)&tval); if (ptv != NULL) { @@ -572,15 +496,8 @@ continue; } - /* May perform UH unlock/lock */ - error = alloc_table_vidx(ch, ts, vi, &vidx, flags); - if (error != 0) { - ts->opstate.func(ts->tc, &ts->opstate); + if ((error = alloc_table_vidx(ch, tc, vi, &vidx, flags)) != 0) return (error); - } - /* value storage resize has happened, return */ - if (ts->modified != 0) - return (0); /* Finally, we have allocated valid index, let's add entry */ ptei->value = vidx; diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -501,6 +501,11 @@ #define PF_ANCHOR_HIWAT 512 #define PF_OPTIMIZER_TABLE_PFX "__automatic_" +enum { + PF_LIMITER_NOMATCH, + PF_LIMITER_BLOCK +}; + struct pf_rule { struct pf_rule_addr src; struct pf_rule_addr dst; diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -360,6 +360,8 @@ struct pf_pdesc *, u_short *, struct pf_state_peer *, struct pf_state_peer *, u_int8_t, u_int8_t); +static __inline int pf_synproxy_ack(struct pf_krule *, struct pf_pdesc *, + struct pf_kstate **, struct pf_rule_actions *); static int pf_test_state(struct pf_kstate **, struct pf_pdesc *, u_short *); int pf_icmp_state_lookup(struct pf_state_key_cmp *, @@ -426,6 +428,269 @@ int in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len); +static inline int +pf_statelim_id_cmp(const struct pf_statelim *a, const struct pf_statelim *b) +{ + if (a->pfstlim_id > b->pfstlim_id) + return (1); + if (a->pfstlim_id < b->pfstlim_id) + return (-1); + + return (0); +} + +RB_GENERATE(pf_statelim_id_tree, pf_statelim, pfstlim_id_tree, + pf_statelim_id_cmp); + +static inline int +pf_statelim_nm_cmp(const struct pf_statelim *a, const struct pf_statelim *b) +{ + return (strncmp(a->pfstlim_nm, b->pfstlim_nm, sizeof(a->pfstlim_nm))); +} + +RB_GENERATE(pf_statelim_nm_tree, pf_statelim, pfstlim_nm_tree, + pf_statelim_nm_cmp); + +VNET_DEFINE(struct pf_statelim_id_tree, pf_statelim_id_tree_active); +VNET_DEFINE(struct pf_statelim_list, pf_statelim_list_active); +VNET_DEFINE(struct pf_statelim_id_tree, pf_statelim_id_tree_inactive); +VNET_DEFINE(struct pf_statelim_nm_tree, pf_statelim_nm_tree_inactive); +VNET_DEFINE(struct pf_statelim_list, pf_statelim_list_inactive); + +static inline int +pf_sourcelim_id_cmp(const struct pf_sourcelim *a, const struct pf_sourcelim *b) +{ + if (a->pfsrlim_id > b->pfsrlim_id) + return (1); + if (a->pfsrlim_id < b->pfsrlim_id) + return (-1); + + return (0); +} + +RB_GENERATE(pf_sourcelim_id_tree, pf_sourcelim, pfsrlim_id_tree, + pf_sourcelim_id_cmp); + +static inline int +pf_sourcelim_nm_cmp(const struct pf_sourcelim *a, const struct pf_sourcelim *b) +{ + return (strncmp(a->pfsrlim_nm, b->pfsrlim_nm, sizeof(a->pfsrlim_nm))); +} + +RB_GENERATE(pf_sourcelim_nm_tree, pf_sourcelim, pfsrlim_nm_tree, + pf_sourcelim_nm_cmp); + +static inline int +pf_source_cmp(const struct pf_source *a, const struct pf_source *b) +{ + if (a->pfsr_af > b->pfsr_af) + return (1); + if (a->pfsr_af < b->pfsr_af) + return (-1); + if (a->pfsr_rdomain > b->pfsr_rdomain) + return (1); + if (a->pfsr_rdomain < b->pfsr_rdomain) + return (-1); + + return (pf_addr_cmp(&a->pfsr_addr, &b->pfsr_addr, a->pfsr_af)); +} + +RB_GENERATE(pf_source_tree, pf_source, pfsr_tree, pf_source_cmp); + +static inline int +pf_source_ioc_cmp(const struct pf_source *a, const struct pf_source *b) +{ + size_t i; + + if (a->pfsr_af > b->pfsr_af) + return (1); + if (a->pfsr_af < b->pfsr_af) + return (-1); + if (a->pfsr_rdomain > b->pfsr_rdomain) + return (1); + if (a->pfsr_rdomain < b->pfsr_rdomain) + return (-1); + + for (i = 0; i < nitems(a->pfsr_addr.addr32); i++) { + uint32_t wa = ntohl(a->pfsr_addr.addr32[i]); + uint32_t wb = ntohl(b->pfsr_addr.addr32[i]); + + if (wa > wb) + return (1); + if (wa < wb) + return (-1); + } + + return (0); +} + +RB_GENERATE(pf_source_ioc_tree, pf_source, pfsr_ioc_tree, pf_source_ioc_cmp); + +VNET_DEFINE(struct pf_sourcelim_id_tree, pf_sourcelim_id_tree_active); +VNET_DEFINE(struct pf_sourcelim_list, pf_sourcelim_list_active); + +VNET_DEFINE(struct pf_sourcelim_id_tree, pf_sourcelim_id_tree_inactive); +VNET_DEFINE(struct pf_sourcelim_nm_tree, pf_sourcelim_nm_tree_inactive); +VNET_DEFINE(struct pf_sourcelim_list, pf_sourcelim_list_inactive); + +static inline struct pf_statelim * +pf_statelim_find(uint32_t id) +{ + struct pf_statelim key; + + /* only the id is used in cmp, so don't have to zero all the things */ + key.pfstlim_id = id; + + return (RB_FIND(pf_statelim_id_tree, + &V_pf_statelim_id_tree_active, &key)); +} + +static inline struct pf_sourcelim * +pf_sourcelim_find(uint32_t id) +{ + struct pf_sourcelim key; + + /* only the id is used in cmp, so don't have to zero all the things */ + key.pfsrlim_id = id; + + return (RB_FIND(pf_sourcelim_id_tree, + &V_pf_sourcelim_id_tree_active, &key)); +} + +struct pf_source_list pf_source_gc = TAILQ_HEAD_INITIALIZER(pf_source_gc); + +static void +pf_source_purge(void) +{ + struct pf_source *sr, *nsr; + + TAILQ_FOREACH_SAFE(sr, &pf_source_gc, pfsr_empty_gc, nsr) { + struct pf_sourcelim *srlim = sr->pfsr_parent; + + if (time_uptime <= sr->pfsr_empty_ts + + srlim->pfsrlim_rate.seconds + 1) + continue; + + TAILQ_REMOVE(&pf_source_gc, sr, pfsr_empty_gc); + + RB_REMOVE(pf_source_tree, &srlim->pfsrlim_sources, sr); + RB_REMOVE(pf_source_ioc_tree, &srlim->pfsrlim_ioc_sources, sr); + srlim->pfsrlim_nsources--; + + free(sr, M_PF_SOURCE_LIM); + } +} + +static void +pf_source_pfr_addr(struct pfr_addr *p, const struct pf_source *sr) +{ + struct pf_sourcelim *srlim = sr->pfsr_parent; + + memset(p, 0, sizeof(*p)); + + p->pfra_af = sr->pfsr_af; + switch (sr->pfsr_af) { + case AF_INET: + p->pfra_net = srlim->pfsrlim_ipv4_prefix; + p->pfra_ip4addr = sr->pfsr_addr.v4; + break; +#ifdef INET6 + case AF_INET6: + p->pfra_net = srlim->pfsrlim_ipv6_prefix; + p->pfra_ip6addr = sr->pfsr_addr.v6; + break; +#endif /* INET6 */ + } +} + +static void +pf_source_used(struct pf_source *sr) +{ + struct pf_sourcelim *srlim = sr->pfsr_parent; + struct pfr_ktable *t; + unsigned int used; + + used = sr->pfsr_inuse++; + sr->pfsr_rate_ts += srlim->pfsrlim_rate_token; + + if (used == 0) + TAILQ_REMOVE(&pf_source_gc, sr, pfsr_empty_gc); + else if ((t = srlim->pfsrlim_overload.table) != NULL && + used >= srlim->pfsrlim_overload.hwm && !sr->pfsr_intable) { + struct pfr_addr p; + + pf_source_pfr_addr(&p, sr); + + pfr_insert_kentry(t, &p, time_second); + sr->pfsr_intable = 1; + } +} + +static void +pf_source_rele(struct pf_source *sr) +{ + struct pf_sourcelim *srlim = sr->pfsr_parent; + struct pfr_ktable *t; + unsigned int used; + + used = --sr->pfsr_inuse; + + t = srlim->pfsrlim_overload.table; + if (t != NULL && sr->pfsr_intable && + used < srlim->pfsrlim_overload.lwm) { + struct pfr_addr p; + + pf_source_pfr_addr(&p, sr); + + pfr_remove_kentry(t, &p); + sr->pfsr_intable = 0; + } + + if (used == 0) { + TAILQ_INSERT_TAIL(&pf_source_gc, sr, pfsr_empty_gc); + sr->pfsr_empty_ts = time_uptime + srlim->pfsrlim_rate.seconds; + } +} + +static inline void +pf_source_key(struct pf_sourcelim *srlim, struct pf_source *key, + sa_family_t af, const struct pf_addr *addr) +{ + size_t i; + + /* only af+addr is used for lookup. */ + key->pfsr_af = af; + key->pfsr_rdomain = 0; + switch (af) { + case AF_INET: + key->pfsr_addr.addr32[0] = + srlim->pfsrlim_ipv4_mask.v4.s_addr & + addr->v4.s_addr; + + for (i = 1; i < nitems(key->pfsr_addr.addr32); i++) + key->pfsr_addr.addr32[i] = htonl(0); + break; +#ifdef INET6 + case AF_INET6: + for (i = 0; i < nitems(key->pfsr_addr.addr32); i++) { + key->pfsr_addr.addr32[i] = + srlim->pfsrlim_ipv6_mask.addr32[i] & + addr->addr32[i]; + } + break; +#endif + default: + unhandled_af(af); + /* NOTREACHED */ + } +} + +static inline struct pf_source * +pf_source_find(struct pf_sourcelim *srlim, struct pf_source *key) +{ + return (RB_FIND(pf_source_tree, &srlim->pfsrlim_sources, key)); +} + extern int pf_end_threads; extern struct proc *pf_purge_proc; @@ -519,6 +784,8 @@ MALLOC_DEFINE(M_PFHASH, "pf_hash", "pf(4) hash header structures"); MALLOC_DEFINE(M_PF_RULE_ITEM, "pf_krule_item", "pf(4) rule items"); +MALLOC_DEFINE(M_PF_STATE_LINK, "pf_state_link", "pf(4) state links"); +MALLOC_DEFINE(M_PF_SOURCE_LIM, "pf_source_lim", "pf(4) source limiter"); VNET_DEFINE(struct pf_keyhash *, pf_keyhash); VNET_DEFINE(struct pf_idhash *, pf_idhash); VNET_DEFINE(struct pf_srchash *, pf_srchash); @@ -1295,6 +1562,22 @@ /* Unlinked, but may be referenced rules. */ TAILQ_INIT(&V_pf_unlinked_rules); + + /* State limiters */ + RB_INIT(&V_pf_statelim_id_tree_inactive); + RB_INIT(&V_pf_statelim_nm_tree_inactive); + TAILQ_INIT(&V_pf_statelim_list_inactive); + + RB_INIT(&V_pf_statelim_id_tree_active); + TAILQ_INIT(&V_pf_statelim_list_active); + + /* Source limiters */ + RB_INIT(&V_pf_sourcelim_id_tree_active); + TAILQ_INIT(&V_pf_sourcelim_list_active); + + RB_INIT(&V_pf_sourcelim_id_tree_inactive); + RB_INIT(&V_pf_sourcelim_nm_tree_inactive); + TAILQ_INIT(&V_pf_sourcelim_list_inactive); } void @@ -2680,6 +2963,7 @@ pf_purge_expired_fragments(); pf_purge_expired_src_nodes(); pf_purge_unlinked_rules(); + pf_source_purge(); pfi_kkif_purge(); } CURVNET_RESTORE(); @@ -2712,6 +2996,7 @@ pf_purge_expired_states(0, V_pf_hashmask); pf_purge_fragments(UINT_MAX); pf_purge_expired_src_nodes(); + pf_source_purge(); /* * Now all kifs & rules should be unreferenced, @@ -2817,6 +3102,7 @@ pf_remove_state(struct pf_kstate *s) { struct pf_idhash *ih = &V_pf_idhash[PF_IDHASH(s)]; + struct pf_state_link *pfl; NET_EPOCH_ASSERT(); PF_HASHROW_ASSERT(ih); @@ -2858,6 +3144,63 @@ s->key[PF_SK_STACK]->proto == IPPROTO_TCP) pf_set_protostate(s, PF_PEER_BOTH, TCPS_CLOSED); + while ((pfl = SLIST_FIRST(&s->linkage)) != NULL) { + struct pf_state_link_list *list; + unsigned int gen; + + SLIST_REMOVE_HEAD(&s->linkage, pfl_linkage); + + switch (pfl->pfl_type) { + case PF_STATE_LINK_TYPE_STATELIM: { + struct pf_statelim *stlim; + + stlim = pf_statelim_find(s->statelim); + KASSERT(stlim != NULL, + ("pf_state %p pfl %p cannot find statelim %u", s, + pfl, s->statelim)); + + gen = pf_statelim_enter(stlim); + stlim->pfstlim_inuse--; + pf_statelim_leave(stlim, gen); + + list = &stlim->pfstlim_states; + break; + } + case PF_STATE_LINK_TYPE_SOURCELIM: { + struct pf_sourcelim *srlim; + struct pf_source key, *sr; + + srlim = pf_sourcelim_find(s->sourcelim); + KASSERT(srlim != NULL, + ("pf_state %p pfl %p cannot find sourcelim %u", s, + pfl, s->sourcelim)); + + pf_source_key(srlim, &key, s->key[PF_SK_WIRE]->af, + &s->key[PF_SK_WIRE]->addr[0 /* XXX or 1? */]); + + sr = pf_source_find(srlim, &key); + KASSERT(sr != NULL, + ("pf_state %p pfl %p cannot find source in %u", s, + pfl, s->sourcelim)); + + gen = pf_sourcelim_enter(srlim); + srlim->pfsrlim_counters.inuse--; + pf_sourcelim_leave(srlim, gen); + pf_source_rele(sr); + + list = &sr->pfsr_states; + break; + } + default: + panic("%s: unexpected link type on pfl %p", __func__, + pfl); + } + + PF_STATE_LOCK_ASSERT(s); + TAILQ_REMOVE(list, pfl, pfl_link); + free(pfl, M_PF_STATE_LINK); + } + PF_HASHROW_UNLOCK(ih); pf_detach_state(s); @@ -5656,6 +5999,11 @@ r = TAILQ_FIRST(ruleset->rules[PF_RULESET_FILTER].active.ptr); while (r != NULL) { + struct pf_statelim *stlim = NULL; + struct pf_sourcelim *srlim = NULL; + struct pf_source *sr = NULL; + unsigned int gen; + if (ctx->pd->related_rule) { *ctx->rm = ctx->pd->related_rule; break; @@ -5757,6 +6105,153 @@ pf_osfp_fingerprint(pd, ctx->th), r->os_fingerprint)), TAILQ_NEXT(r, entries)); + if (r->statelim.id != PF_STATELIM_ID_NONE) { + stlim = pf_statelim_find(r->statelim.id); + + /* + * Treat a missing limiter like an exhausted limiter. + * There is no "backend" to get a resource out of + * so the rule can't create state. + */ + PF_TEST_ATTRIB(stlim == NULL, TAILQ_NEXT(r, entries)); + + /* + * An overcommitted pool means this rule + * can't create state. + */ + if (stlim->pfstlim_inuse >= stlim->pfstlim_limit) { + gen = pf_statelim_enter(stlim); + stlim->pfstlim_counters.hardlimited++; + pf_statelim_leave(stlim, gen); + if (r->statelim.limiter_action == PF_LIMITER_BLOCK) { + ctx->limiter_drop = 1; + REASON_SET(&ctx->reason, PFRES_MAXSTATES); + break; /* stop rule processing */ + } + r = TAILQ_NEXT(r, entries); + continue; + } + + /* + * Is access to the pool rate limited? + */ + if (stlim->pfstlim_rate.limit != 0) { + struct timespec ts; + getnanouptime(&ts); + uint64_t diff = SEC_TO_NSEC(ts.tv_sec) + + ts.tv_nsec - stlim->pfstlim_rate_ts; + + if (diff < stlim->pfstlim_rate_token) { + gen = pf_statelim_enter(stlim); + stlim->pfstlim_counters.ratelimited++; + pf_statelim_leave(stlim, gen); + if (r->statelim.limiter_action == + PF_LIMITER_BLOCK) { + ctx->limiter_drop = 1; + REASON_SET(&ctx->reason, + PFRES_MAXSTATES); + /* stop rule processing */ + break; + } + r = TAILQ_NEXT(r, entries); + continue; + } + + if (diff > stlim->pfstlim_rate_bucket) { + stlim->pfstlim_rate_ts = + SEC_TO_NSEC(ts.tv_sec) + ts.tv_nsec - + stlim->pfstlim_rate_bucket; + } + } + } + + if (r->sourcelim.id != PF_SOURCELIM_ID_NONE) { + struct pf_source key; + + srlim = pf_sourcelim_find(r->sourcelim.id); + + /* + * Treat a missing pool like an overcommitted pool. + * There is no "backend" to get a resource out of + * so the rule can't create state. + */ + PF_TEST_ATTRIB(srlim == NULL, TAILQ_NEXT(r, entries)); + + pf_source_key(srlim, &key, ctx->pd->af, + ctx->pd->src); + sr = pf_source_find(srlim, &key); + if (sr != NULL) { + /* + * An overcommitted limiter means this rule + * can't create state. + */ + if (sr->pfsr_inuse >= srlim->pfsrlim_limit) { + sr->pfsr_counters.hardlimited++; + gen = pf_sourcelim_enter(srlim); + srlim->pfsrlim_counters.hardlimited++; + pf_sourcelim_leave(srlim, gen); + if (r->sourcelim.limiter_action == + PF_LIMITER_BLOCK) { + ctx->limiter_drop = 1; + REASON_SET(&ctx->reason, + PFRES_SRCLIMIT); + /* stop rule processing */ + break; + } + r = TAILQ_NEXT(r, entries); + continue; + } + + /* + * Is access to the pool rate limited? + */ + if (srlim->pfsrlim_rate.limit != 0) { + struct timespec ts; + getnanouptime(&ts); + uint64_t diff = SEC_TO_NSEC(ts.tv_sec) + + ts.tv_nsec - sr->pfsr_rate_ts; + + if (diff < srlim->pfsrlim_rate_token) { + sr->pfsr_counters.ratelimited++; + gen = pf_sourcelim_enter(srlim); + srlim->pfsrlim_counters + .ratelimited++; + pf_sourcelim_leave(srlim, gen); + if (r->sourcelim.limiter_action == + PF_LIMITER_BLOCK) { + ctx->limiter_drop = 1; + REASON_SET(&ctx->reason, + PFRES_SRCLIMIT); + /* stop rules */ + break; + } + r = TAILQ_NEXT(r, entries); + continue; + } + + if (diff > srlim->pfsrlim_rate_bucket) { + sr->pfsr_rate_ts = + SEC_TO_NSEC(ts.tv_sec) + ts.tv_nsec - + srlim->pfsrlim_rate_bucket; + } + } + } else { + /* + * a new source entry will (should) + * admit a state. + */ + + if (srlim->pfsrlim_nsources >= + srlim->pfsrlim_entries) { + gen = pf_sourcelim_enter(srlim); + srlim->pfsrlim_counters.addrlimited++; + pf_sourcelim_leave(srlim, gen); + r = TAILQ_NEXT(r, entries); + continue; + } + } + } + /* must be last! */ if (r->pktrate.limit) { PF_TEST_ATTRIB((pf_check_threshold(&r->pktrate)), @@ -5833,6 +6328,13 @@ * ruleset, where anchor belongs to. */ ctx->arsm = ctx->aruleset; + /* + * state/source pools + */ + + ctx->statelim = stlim; + ctx->sourcelim = srlim; + ctx->source = sr; } if (pd->act.log & PF_LOG_MATCHES) pf_log_matches(pd, r, ctx->a, ruleset, match_rules); @@ -5987,10 +6489,8 @@ } else { ruleset = &pf_main_ruleset; rv = pf_match_rule(&ctx, ruleset, match_rules); - if (rv == PF_TEST_FAIL) { - /* - * Reason has been set in pf_match_rule() already. - */ + if (rv == PF_TEST_FAIL || ctx.limiter_drop == 1) { + REASON_SET(reason, ctx.reason); goto cleanup; } @@ -6085,6 +6585,13 @@ return (action); } + if (pd->proto == IPPROTO_TCP && + r->keep_state == PF_STATE_SYNPROXY && pd->dir == PF_IN) { + action = pf_synproxy_ack(r, pd, sm, &ctx.act); + if (action != PF_PASS) + goto cleanup; /* PF_SYNPROXY_DROP */ + } + nat64 = pd->af != pd->naf; if (nat64) { int ret; @@ -6157,6 +6664,10 @@ { struct pf_pdesc *pd = ctx->pd; struct pf_kstate *s = NULL; + struct pf_statelim *stlim = NULL; + struct pf_sourcelim *srlim = NULL; + struct pf_source *sr = NULL; + struct pf_state_link *pfl; struct pf_ksrc_node *sns[PF_SN_MAX] = { NULL }; /* * XXXKS: The hash for PF_SN_LIMIT and PF_SN_ROUTE should be the same @@ -6219,6 +6730,7 @@ s->nat_rule = ctx->nr; s->anchor = ctx->a; s->match_rules = *match_rules; + SLIST_INIT(&s->linkage); memcpy(&s->act, &pd->act, sizeof(struct pf_rule_actions)); if (pd->act.allow_opts) @@ -6334,6 +6846,98 @@ KASSERT((ctx->sk != NULL && ctx->nk != NULL), ("%s: nr %p sk %p, nk %p", __func__, ctx->nr, ctx->sk, ctx->nk)); + stlim = ctx->statelim; + if (stlim != NULL) { + unsigned int gen; + + pfl = malloc(sizeof(*pfl), M_PF_STATE_LINK, M_NOWAIT); + if (pfl == NULL) { + REASON_SET(&ctx->reason, PFRES_MEMORY); + goto csfailed; + } + + gen = pf_statelim_enter(stlim); + stlim->pfstlim_counters.admitted++; + stlim->pfstlim_inuse++; + pf_statelim_leave(stlim, gen); + + stlim->pfstlim_rate_ts += stlim->pfstlim_rate_token; + + s->statelim = stlim->pfstlim_id; + pfl->pfl_state = s; + pfl->pfl_type = PF_STATE_LINK_TYPE_STATELIM; + + TAILQ_INSERT_TAIL(&stlim->pfstlim_states, pfl, pfl_link); + SLIST_INSERT_HEAD(&s->linkage, pfl, pfl_linkage); + } + + srlim = ctx->sourcelim; + if (srlim != NULL) { + unsigned int gen; + + sr = ctx->source; + if (sr == NULL) { + sr = malloc(sizeof(*sr), M_PF_SOURCE_LIM, M_NOWAIT | M_ZERO); + if (sr == NULL) { + gen = pf_sourcelim_enter(srlim); + srlim->pfsrlim_counters.addrnomem++; + pf_sourcelim_leave(srlim, gen); + REASON_SET(&ctx->reason, PFRES_MEMORY); + goto csfailed; + } + + sr->pfsr_parent = srlim; + pf_source_key(srlim, sr, ctx->pd->af, ctx->pd->src); + TAILQ_INIT(&sr->pfsr_states); + + if (RB_INSERT(pf_source_tree, &srlim->pfsrlim_sources, + sr) != NULL) { + panic("%s: source pool %u (%p) " + "insert collision %p?!", + __func__, srlim->pfsrlim_id, srlim, sr); + } + + if (RB_INSERT(pf_source_ioc_tree, + &srlim->pfsrlim_ioc_sources, sr) != NULL) { + panic("%s: source pool %u (%p) ioc " + "insert collision (%p)?!", + __func__, srlim->pfsrlim_id, srlim, sr); + } + + sr->pfsr_empty_ts = time_uptime; + TAILQ_INSERT_TAIL(&pf_source_gc, sr, pfsr_empty_gc); + + gen = pf_sourcelim_enter(srlim); + srlim->pfsrlim_nsources++; + srlim->pfsrlim_counters.addrallocs++; + pf_sourcelim_leave(srlim, gen); + } else { + MPASS(sr->pfsr_parent == srlim); + } + + pfl = malloc(sizeof(*pfl), M_PF_STATE_LINK, M_NOWAIT); + if (pfl == NULL) { + REASON_SET(&ctx->reason, PFRES_MEMORY); + goto csfailed; + } + + pf_source_used(sr); + + sr->pfsr_counters.admitted++; + + gen = pf_sourcelim_enter(srlim); + srlim->pfsrlim_counters.inuse++; + srlim->pfsrlim_counters.admitted++; + pf_sourcelim_leave(srlim, gen); + + s->sourcelim = srlim->pfsrlim_id; + pfl->pfl_state = s; + pfl->pfl_type = PF_STATE_LINK_TYPE_SOURCELIM; + + TAILQ_INSERT_TAIL(&sr->pfsr_states, pfl, pfl_link); + SLIST_INSERT_HEAD(&s->linkage, pfl, pfl_linkage); + } + /* Swap sk/nk for PF_OUT. */ if (pf_state_insert(BOUND_IFACE(s, pd), pd->kif, (pd->dir == PF_IN) ? ctx->sk : ctx->nk, @@ -6400,6 +7004,44 @@ drop: if (s != NULL) { + struct pf_state_link *npfl; + + SLIST_FOREACH_SAFE(pfl, &s->linkage, pfl_linkage, npfl) { + struct pf_state_link_list *list; + unsigned int gen; + + /* who needs KASSERTS when we have NULL derefs */ + + switch (pfl->pfl_type) { + case PF_STATE_LINK_TYPE_STATELIM: + gen = pf_statelim_enter(stlim); + stlim->pfstlim_inuse--; + pf_statelim_leave(stlim, gen); + + stlim->pfstlim_rate_ts -= + stlim->pfstlim_rate_token; + list = &stlim->pfstlim_states; + break; + case PF_STATE_LINK_TYPE_SOURCELIM: + gen = pf_sourcelim_enter(srlim); + srlim->pfsrlim_counters.inuse--; + pf_sourcelim_leave(srlim, gen); + + sr->pfsr_rate_ts -= srlim->pfsrlim_rate_token; + pf_source_rele(sr); + + list = &sr->pfsr_states; + break; + default: + panic("%s: unexpected link type on pfl %p", + __func__, pfl); + } + + TAILQ_REMOVE(list, pfl, pfl_link); + PF_STATE_LOCK_ASSERT(s); + free(pfl, M_PF_STATE_LINK); + } + pf_src_tree_remove_state(s); s->timeout = PFTM_UNLINKED; pf_free_state(s); @@ -7164,6 +7806,38 @@ return (PF_PASS); } +static __inline int +pf_synproxy_ack(struct pf_krule *r, struct pf_pdesc *pd, struct pf_kstate **sm, + struct pf_rule_actions *act) +{ + struct tcphdr *th = &pd->hdr.tcp; + struct pf_kstate *s; + u_int16_t mss; + int rtid; + u_short reason; + + if ((th->th_flags & (TH_SYN | TH_ACK)) != TH_SYN) + return (PF_PASS); + + s = *sm; + rtid = act->rtableid; + + pf_set_protostate(s, PF_PEER_SRC, PF_TCPS_PROXY_SRC); + s->src.seqhi = arc4random(); + /* Find mss option */ + mss = pf_get_mss(pd); + mss = pf_calc_mss(pd->src, pd->af, rtid, mss); + mss = pf_calc_mss(pd->dst, pd->af, rtid, mss); + s->src.mss = mss; + + pf_send_tcp(r, pd->af, pd->dst, pd->src, th->th_dport, + th->th_sport, s->src.seqhi, ntohl(th->th_seq) + 1, + TH_SYN | TH_ACK, 0, s->src.mss, 0, 1, 0, 0, r->rtableid, NULL); + + REASON_SET(&reason, PFRES_SYNPROXY); + return (PF_SYNPROXY_DROP); +} + static int pf_test_state(struct pf_kstate **state, struct pf_pdesc *pd, u_short *reason) { diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -136,6 +136,12 @@ struct pf_altq *, size_t); #endif /* ALTQ */ +static void pf_statelim_commit(void); +static void pf_statelim_rollback(void); +static int pf_sourcelim_check(void); +static void pf_sourcelim_commit(void); +static void pf_sourcelim_rollback(void); + VNET_DEFINE(struct pf_krule, pf_default_rule); static __inline int pf_krule_compare(struct pf_krule *, @@ -187,6 +193,7 @@ static MALLOC_DEFINE(M_PFALTQ, "pf_altq", "pf(4) altq configuration db"); static MALLOC_DEFINE(M_PFRULE, "pf_rule", "pf(4) rules"); MALLOC_DEFINE(M_PF, "pf", "pf(4)"); +MALLOC_DEFINE(M_PF_STATE_LIM, "pf_state_lim", "pf(4) state limiter"); #if (PF_QNAME_SIZE != PF_TAG_NAME_SIZE) #error PF_QNAME_SIZE must be equal to PF_TAG_NAME_SIZE @@ -969,12 +976,6 @@ return (tagname2tag(&V_pf_qids, qname, add_new)); } -static const char * -pf_qid2qname(uint16_t qid) -{ - return (tag2tagname(&V_pf_qids, qid)); -} - static void pf_qid_unref(uint16_t qid) { @@ -1318,6 +1319,12 @@ rs->rules[rs_num].inactive.rcount--; } rs->rules[rs_num].inactive.open = 0; + + if (anchor[0]) + return (0); + + pf_statelim_rollback(); + pf_sourcelim_rollback(); return (0); } @@ -1437,6 +1444,7 @@ struct pf_krule_global *old_tree; int error; u_int32_t old_rcount; + bool is_main_ruleset = anchor[0] == '\0'; PF_RULES_WASSERT(); @@ -1449,6 +1457,9 @@ /* Calculate checksum for the main ruleset */ if (rs == &pf_main_ruleset) { + error = pf_sourcelim_check(); + if (error != 0) + return (error); error = pf_setup_pfsync_matching(rs); if (error != 0) return (error); @@ -1507,6 +1518,13 @@ pf_remove_if_empty_kruleset(rs); pf_rule_tree_free(old_tree); + /* statelim/sourcelim/queue defs only in the main ruleset */ + if (! is_main_ruleset || rs_num != PF_RULESET_FILTER) + return (0); + + pf_statelim_commit(); + pf_sourcelim_commit(); + return (0); } @@ -1589,6 +1607,748 @@ } } +int +pf_statelim_add(const struct pfioc_statelim *ioc) +{ + struct pf_statelim *pfstlim; + int error; + size_t namelen; + + if (ioc->id < PF_STATELIM_ID_MIN || + ioc->id > PF_STATELIM_ID_MAX) + return (EINVAL); + + if (ioc->limit < PF_STATELIM_LIMIT_MIN || + ioc->limit > PF_STATELIM_LIMIT_MAX) + return (EINVAL); + + if ((ioc->rate.limit == 0) != (ioc->rate.seconds == 0)) + return (EINVAL); + + namelen = strnlen(ioc->name, sizeof(ioc->name)); + /* is the name from userland nul terminated? */ + if (namelen == sizeof(ioc->name)) + return (EINVAL); + + pfstlim = malloc(sizeof(*pfstlim), M_PF_STATE_LIM, M_WAITOK | M_ZERO); + if (pfstlim == NULL) + return (ENOMEM); + + pfstlim->pfstlim_id = ioc->id; + if (strlcpy(pfstlim->pfstlim_nm, ioc->name, + sizeof(pfstlim->pfstlim_nm)) >= sizeof(pfstlim->pfstlim_nm)) { + error = EINVAL; + goto free; + } + pfstlim->pfstlim_limit = ioc->limit; + pfstlim->pfstlim_rate.limit = ioc->rate.limit; + pfstlim->pfstlim_rate.seconds = ioc->rate.seconds; + + if (pfstlim->pfstlim_rate.limit) { + uint64_t bucket = SEC_TO_NSEC(pfstlim->pfstlim_rate.seconds); + struct timespec ts; + + getnanouptime(&ts); + + pfstlim->pfstlim_rate_ts = SEC_TO_NSEC(ts.tv_sec) + ts.tv_nsec - + bucket; + pfstlim->pfstlim_rate_token = bucket / + pfstlim->pfstlim_rate.limit; + pfstlim->pfstlim_rate_bucket = bucket; + } + + TAILQ_INIT(&pfstlim->pfstlim_states); + mtx_init(&pfstlim->pfstlim_lock, "pf state limit", NULL, MTX_DEF); + + PF_RULES_WLOCK(); + if (ioc->ticket != pf_main_ruleset.rules[PF_RULESET_FILTER].inactive.ticket) { + error = EBUSY; + goto unlock; + } + + if (RB_INSERT(pf_statelim_id_tree, &V_pf_statelim_id_tree_inactive, + pfstlim) != NULL) { + error = EBUSY; + goto unlock; + } + + if (RB_INSERT(pf_statelim_nm_tree, &V_pf_statelim_nm_tree_inactive, + pfstlim) != NULL) { + RB_REMOVE(pf_statelim_id_tree, &V_pf_statelim_id_tree_inactive, + pfstlim); + error = EBUSY; + goto unlock; + } + + TAILQ_INSERT_HEAD(&V_pf_statelim_list_inactive, pfstlim, pfstlim_list); + + PF_RULES_WUNLOCK(); + + return (0); + +unlock: + PF_RULES_WUNLOCK(); + +free: + free(pfstlim, M_PF_STATE_LIM); + + return (error); +} + +static void +pf_statelim_unlink(struct pf_statelim *pfstlim, + struct pf_state_link_list *garbage) +{ + struct pf_state_link *pfl; + + + /* unwire the links */ + TAILQ_FOREACH(pfl, &pfstlim->pfstlim_states, pfl_link) { + struct pf_kstate *s = pfl->pfl_state; + + /* if !rmst */ + PF_STATE_LOCK(s); + s->statelim = 0; + SLIST_REMOVE(&s->linkage, pfl, pf_state_link, pfl_linkage); + PF_STATE_UNLOCK(s); + } + + /* take the list away */ + TAILQ_CONCAT(garbage, &pfstlim->pfstlim_states, pfl_link); + pfstlim->pfstlim_inuse = 0; +} + +void +pf_statelim_commit(void) +{ + struct pf_statelim *pfstlim, *npfstlim, *opfstlim; + struct pf_statelim_list l = TAILQ_HEAD_INITIALIZER(l); + struct pf_state_link_list garbage = TAILQ_HEAD_INITIALIZER(garbage); + struct pf_state_link *pfl, *npfl; + + PF_RULES_WASSERT(); + + /* merge the new statelims into the current set */ + + /* start with an empty active list */ + TAILQ_CONCAT(&l, &V_pf_statelim_list_active, pfstlim_list); + + /* beware, the inactive bits gets messed up here */ + + /* try putting pending statelims into the active tree */ + TAILQ_FOREACH_SAFE(pfstlim, &V_pf_statelim_list_inactive, pfstlim_list, + npfstlim) { + opfstlim = RB_INSERT(pf_statelim_id_tree, + &V_pf_statelim_id_tree_active, pfstlim); + if (opfstlim != NULL) { + /* this statelim already exists, merge */ + opfstlim->pfstlim_limit = pfstlim->pfstlim_limit; + opfstlim->pfstlim_rate.limit = + pfstlim->pfstlim_rate.limit; + opfstlim->pfstlim_rate.seconds = + pfstlim->pfstlim_rate.seconds; + + opfstlim->pfstlim_rate_ts = pfstlim->pfstlim_rate_ts; + opfstlim->pfstlim_rate_token = + pfstlim->pfstlim_rate_token; + opfstlim->pfstlim_rate_bucket = + pfstlim->pfstlim_rate_bucket; + + memcpy(opfstlim->pfstlim_nm, pfstlim->pfstlim_nm, + sizeof(opfstlim->pfstlim_nm)); + + /* use the existing statelim instead */ + free(pfstlim, M_PF_STATE_LIM); + TAILQ_REMOVE(&l, opfstlim, pfstlim_list); + pfstlim = opfstlim; + } + + TAILQ_INSERT_TAIL(&V_pf_statelim_list_active, pfstlim, + pfstlim_list); + } + + /* clean up the now unused statelims from the old set */ + TAILQ_FOREACH_SAFE(pfstlim, &l, pfstlim_list, npfstlim) { + pf_statelim_unlink(pfstlim, &garbage); + + RB_REMOVE(pf_statelim_id_tree, &V_pf_statelim_id_tree_active, + pfstlim); + + free(pfstlim, M_PF_STATE_LIM); + } + + /* fix up the inactive tree */ + RB_INIT(&V_pf_statelim_id_tree_inactive); + RB_INIT(&V_pf_statelim_nm_tree_inactive); + TAILQ_INIT(&V_pf_statelim_list_inactive); + + TAILQ_FOREACH_SAFE(pfl, &garbage, pfl_link, npfl) + free(pfl, M_PF_STATE_LINK); +} + +static void +pf_sourcelim_unlink(struct pf_sourcelim *pfsrlim, + struct pf_state_link_list *garbage) +{ + extern struct pf_source_list pf_source_gc; + struct pf_source *pfsr; + struct pf_state_link *pfl; + + PF_RULES_WASSERT(); + + while ((pfsr = RB_ROOT(&pfsrlim->pfsrlim_sources)) != NULL) { + RB_REMOVE(pf_source_tree, &pfsrlim->pfsrlim_sources, pfsr); + RB_REMOVE(pf_source_ioc_tree, &pfsrlim->pfsrlim_ioc_sources, + pfsr); + if (pfsr->pfsr_inuse == 0) + TAILQ_REMOVE(&pf_source_gc, pfsr, pfsr_empty_gc); + + /* unwire the links */ + TAILQ_FOREACH(pfl, &pfsr->pfsr_states, pfl_link) { + struct pf_kstate *s = pfl->pfl_state; + + PF_STATE_LOCK(s); + /* if !rmst */ + s->sourcelim = 0; + SLIST_REMOVE(&s->linkage, pfl, pf_state_link, + pfl_linkage); + PF_STATE_UNLOCK(s); + } + + /* take the list away */ + TAILQ_CONCAT(garbage, &pfsr->pfsr_states, pfl_link); + + free(pfsr, M_PF_SOURCE_LIM); + } +} + +int +pf_sourcelim_check(void) +{ + struct pf_sourcelim *pfsrlim, *npfsrlim; + + PF_RULES_WASSERT(); + + /* check if we can merge */ + + TAILQ_FOREACH(pfsrlim, &V_pf_sourcelim_list_inactive, pfsrlim_list) { + npfsrlim = RB_FIND(pf_sourcelim_id_tree, + &V_pf_sourcelim_id_tree_active, pfsrlim); + + /* new config, no conflict */ + if (npfsrlim == NULL) + continue; + + /* nothing is tracked at the moment, no conflict */ + if (RB_EMPTY(&npfsrlim->pfsrlim_sources)) + continue; + + if (strcmp(npfsrlim->pfsrlim_overload.name, + pfsrlim->pfsrlim_overload.name) != 0) + return (EBUSY); + + /* + * we should allow the prefixlens to get shorter + * and merge pf_source entries. + */ + + if ((npfsrlim->pfsrlim_ipv4_prefix != + pfsrlim->pfsrlim_ipv4_prefix) || + (npfsrlim->pfsrlim_ipv6_prefix != + pfsrlim->pfsrlim_ipv6_prefix)) + return (EBUSY); + } + + return (0); +} + +void +pf_sourcelim_commit(void) +{ + struct pf_sourcelim *pfsrlim, *npfsrlim, *opfsrlim; + struct pf_sourcelim_list l = TAILQ_HEAD_INITIALIZER(l); + struct pf_state_link_list garbage = TAILQ_HEAD_INITIALIZER(garbage); + struct pf_state_link *pfl, *npfl; + + PF_RULES_WASSERT(); + + /* merge the new sourcelims into the current set */ + + /* start with an empty active list */ + TAILQ_CONCAT(&l, &V_pf_sourcelim_list_active, pfsrlim_list); + + /* beware, the inactive bits gets messed up here */ + + /* try putting pending sourcelims into the active tree */ + TAILQ_FOREACH_SAFE(pfsrlim, &V_pf_sourcelim_list_inactive, pfsrlim_list, + npfsrlim) { + opfsrlim = RB_INSERT(pf_sourcelim_id_tree, + &V_pf_sourcelim_id_tree_active, pfsrlim); + if (opfsrlim != NULL) { + /* this sourcelim already exists, merge */ + opfsrlim->pfsrlim_entries = pfsrlim->pfsrlim_entries; + opfsrlim->pfsrlim_limit = pfsrlim->pfsrlim_limit; + opfsrlim->pfsrlim_ipv4_prefix = + pfsrlim->pfsrlim_ipv4_prefix; + opfsrlim->pfsrlim_ipv6_prefix = + pfsrlim->pfsrlim_ipv6_prefix; + opfsrlim->pfsrlim_rate.limit = + pfsrlim->pfsrlim_rate.limit; + opfsrlim->pfsrlim_rate.seconds = + pfsrlim->pfsrlim_rate.seconds; + + opfsrlim->pfsrlim_ipv4_mask = + pfsrlim->pfsrlim_ipv4_mask; + opfsrlim->pfsrlim_ipv6_mask = + pfsrlim->pfsrlim_ipv6_mask; + + /* keep the existing pfstlim_rate_ts */ + + opfsrlim->pfsrlim_rate_token = + pfsrlim->pfsrlim_rate_token; + opfsrlim->pfsrlim_rate_bucket = + pfsrlim->pfsrlim_rate_bucket; + + if (opfsrlim->pfsrlim_overload.table != NULL) { + pfr_detach_table( + opfsrlim->pfsrlim_overload.table); + } + + strlcpy(opfsrlim->pfsrlim_overload.name, + pfsrlim->pfsrlim_overload.name, + sizeof(opfsrlim->pfsrlim_overload.name)); + opfsrlim->pfsrlim_overload.hwm = + pfsrlim->pfsrlim_overload.hwm; + opfsrlim->pfsrlim_overload.lwm = + pfsrlim->pfsrlim_overload.lwm; + opfsrlim->pfsrlim_overload.table = + pfsrlim->pfsrlim_overload.table, + + memcpy(opfsrlim->pfsrlim_nm, pfsrlim->pfsrlim_nm, + sizeof(opfsrlim->pfsrlim_nm)); + + /* use the existing sourcelim instead */ + free(pfsrlim, M_PF_SOURCE_LIM); + TAILQ_REMOVE(&l, opfsrlim, pfsrlim_list); + pfsrlim = opfsrlim; + } + + TAILQ_INSERT_TAIL(&V_pf_sourcelim_list_active, pfsrlim, + pfsrlim_list); + } + + /* clean up the now unused sourcelims from the old set */ + TAILQ_FOREACH_SAFE(pfsrlim, &l, pfsrlim_list, npfsrlim) { + pf_sourcelim_unlink(pfsrlim, &garbage); + + RB_REMOVE(pf_sourcelim_id_tree, &V_pf_sourcelim_id_tree_active, + pfsrlim); + + if (pfsrlim->pfsrlim_overload.table != NULL) + pfr_detach_table(pfsrlim->pfsrlim_overload.table); + + free(pfsrlim, M_PF_SOURCE_LIM); + } + + /* fix up the inactive tree */ + RB_INIT(&V_pf_sourcelim_id_tree_inactive); + RB_INIT(&V_pf_sourcelim_nm_tree_inactive); + TAILQ_INIT(&V_pf_sourcelim_list_inactive); + + TAILQ_FOREACH_SAFE(pfl, &garbage, pfl_link, npfl) + free(pfl, M_PF_STATE_LINK); +} + +void +pf_statelim_rollback(void) +{ + struct pf_statelim *pfstlim, *npfstlim; + + PF_RULES_WASSERT(); + + TAILQ_FOREACH_SAFE(pfstlim, &V_pf_statelim_list_inactive, pfstlim_list, + npfstlim) + free(pfstlim, M_PF_STATE_LIM); + + TAILQ_INIT(&V_pf_statelim_list_inactive); + RB_INIT(&V_pf_statelim_id_tree_inactive); + RB_INIT(&V_pf_statelim_nm_tree_inactive); +} + +struct pf_statelim * +pf_statelim_rb_find(struct pf_statelim_id_tree *tree, struct pf_statelim *key) +{ + PF_RULES_ASSERT(); + + return (RB_FIND(pf_statelim_id_tree, tree, key)); +} + +struct pf_statelim * +pf_statelim_rb_nfind(struct pf_statelim_id_tree *tree, struct pf_statelim *key) +{ + PF_RULES_ASSERT(); + + return (RB_NFIND(pf_statelim_id_tree, tree, key)); +} + +int +pf_statelim_get(struct pfioc_statelim *ioc, + struct pf_statelim *(*rbt_op)(struct pf_statelim_id_tree *, + struct pf_statelim *)) +{ + struct pf_statelim key = { .pfstlim_id = ioc->id }; + struct pf_statelim *pfstlim; + int error = 0; + PF_RULES_RLOCK_TRACKER; + + PF_RULES_RLOCK(); + + pfstlim = (*rbt_op)(&V_pf_statelim_id_tree_active, &key); + if (pfstlim == NULL) { + error = ENOENT; + goto unlock; + } + + ioc->id = pfstlim->pfstlim_id; + ioc->limit = pfstlim->pfstlim_limit; + ioc->rate.limit = pfstlim->pfstlim_rate.limit; + ioc->rate.seconds = pfstlim->pfstlim_rate.seconds; + CTASSERT(sizeof(ioc->name) == sizeof(pfstlim->pfstlim_nm)); + memcpy(ioc->name, pfstlim->pfstlim_nm, sizeof(ioc->name)); + + ioc->inuse = pfstlim->pfstlim_inuse; + ioc->admitted = pfstlim->pfstlim_counters.admitted; + ioc->hardlimited = pfstlim->pfstlim_counters.hardlimited; + ioc->ratelimited = pfstlim->pfstlim_counters.ratelimited; + +unlock: + PF_RULES_RUNLOCK(); + + return (error); +} + +int +pf_sourcelim_add(const struct pfioc_sourcelim *ioc) +{ + struct pf_sourcelim *pfsrlim; + int error; + size_t namelen, tablelen; + unsigned int prefix; + size_t i; + + if (ioc->id < PF_SOURCELIM_ID_MIN || + ioc->id > PF_SOURCELIM_ID_MAX) + return (EINVAL); + + if (ioc->entries < 1) + return (EINVAL); + + if (ioc->limit < 1) + return (EINVAL); + + if ((ioc->rate.limit == 0) != (ioc->rate.seconds == 0)) + return (EINVAL); + + if (ioc->inet_prefix > 32) + return (EINVAL); + if (ioc->inet6_prefix > 128) + return (EINVAL); + + namelen = strnlen(ioc->name, sizeof(ioc->name)); + /* is the name from userland nul terminated? */ + if (namelen == sizeof(ioc->name)) + return (EINVAL); + + tablelen = strnlen(ioc->overload_tblname, + sizeof(ioc->overload_tblname)); + /* is the name from userland nul terminated? */ + if (tablelen == sizeof(ioc->overload_tblname)) + return (EINVAL); + if (tablelen != 0) { + if (ioc->overload_hwm == 0) + return (EINVAL); + + if (ioc->overload_hwm < ioc->overload_lwm) + return (EINVAL); + } + + pfsrlim = malloc(sizeof(*pfsrlim), M_PF_SOURCE_LIM, M_WAITOK | M_ZERO); + if (pfsrlim == NULL) + return (ENOMEM); + + pfsrlim->pfsrlim_id = ioc->id; + pfsrlim->pfsrlim_entries = ioc->entries; + pfsrlim->pfsrlim_limit = ioc->limit; + pfsrlim->pfsrlim_ipv4_prefix = ioc->inet_prefix; + pfsrlim->pfsrlim_ipv6_prefix = ioc->inet6_prefix; + pfsrlim->pfsrlim_rate.limit = ioc->rate.limit; + pfsrlim->pfsrlim_rate.seconds = ioc->rate.seconds; + if (strlcpy(pfsrlim->pfsrlim_overload.name, ioc->overload_tblname, + sizeof(pfsrlim->pfsrlim_overload.name)) >= + sizeof(pfsrlim->pfsrlim_overload.name)) { + error = EINVAL; + goto free; + } + pfsrlim->pfsrlim_overload.hwm = ioc->overload_hwm; + pfsrlim->pfsrlim_overload.lwm = ioc->overload_lwm; + if (strlcpy(pfsrlim->pfsrlim_nm, ioc->name, + sizeof(pfsrlim->pfsrlim_nm)) >= sizeof(pfsrlim->pfsrlim_nm)) { + error = EINVAL; + goto free; + } + + if (pfsrlim->pfsrlim_rate.limit) { + uint64_t bucket = pfsrlim->pfsrlim_rate.seconds * 1000000000ULL; + + pfsrlim->pfsrlim_rate_token = bucket / + pfsrlim->pfsrlim_rate.limit; + pfsrlim->pfsrlim_rate_bucket = bucket; + } + + pfsrlim->pfsrlim_ipv4_mask.v4.s_addr = htonl( + 0xffffffff << (32 - pfsrlim->pfsrlim_ipv4_prefix)); + + prefix = pfsrlim->pfsrlim_ipv6_prefix; + for (i = 0; i < nitems(pfsrlim->pfsrlim_ipv6_mask.addr32); i++) { + if (prefix == 0) { + /* the memory is already zeroed */ + break; + } + if (prefix < 32) { + pfsrlim->pfsrlim_ipv6_mask.addr32[i] = htonl( + 0xffffffff << (32 - prefix)); + break; + } + + pfsrlim->pfsrlim_ipv6_mask.addr32[i] = htonl(0xffffffff); + prefix -= 32; + } + + RB_INIT(&pfsrlim->pfsrlim_sources); + mtx_init(&pfsrlim->pfsrlim_lock, "pf source limit", NULL, MTX_DEF); + + PF_RULES_WLOCK(); + if (ioc->ticket != pf_main_ruleset.rules[PF_RULESET_FILTER].inactive.ticket) { + error = EBUSY; + goto unlock; + } + + if (pfsrlim->pfsrlim_overload.name[0] != '\0') { + pfsrlim->pfsrlim_overload.table = pfr_attach_table( + &pf_main_ruleset, pfsrlim->pfsrlim_overload.name); + if (pfsrlim->pfsrlim_overload.table == NULL) { + error = EINVAL; + goto unlock; + } + } + + if (RB_INSERT(pf_sourcelim_id_tree, &V_pf_sourcelim_id_tree_inactive, + pfsrlim) != NULL) { + error = EBUSY; + goto unlock; + } + + if (RB_INSERT(pf_sourcelim_nm_tree, &V_pf_sourcelim_nm_tree_inactive, + pfsrlim) != NULL) { + RB_INSERT(pf_sourcelim_nm_tree, &V_pf_sourcelim_nm_tree_inactive, + pfsrlim); + error = EBUSY; + goto unlock; + } + + TAILQ_INSERT_HEAD(&V_pf_sourcelim_list_inactive, pfsrlim, pfsrlim_list); + + PF_RULES_WUNLOCK(); + + return (0); + +unlock: + PF_RULES_WUNLOCK(); + +free: + free(pfsrlim, M_PF_SOURCE_LIM); + + return (error); +} + +void +pf_sourcelim_rollback(void) +{ + struct pf_sourcelim *pfsrlim, *npfsrlim; + + PF_RULES_WASSERT(); + + TAILQ_FOREACH_SAFE(pfsrlim, &V_pf_sourcelim_list_inactive, pfsrlim_list, + npfsrlim) { + if (pfsrlim->pfsrlim_overload.table != NULL) + pfr_detach_table(pfsrlim->pfsrlim_overload.table); + + free(pfsrlim, M_PF_SOURCE_LIM); + } + + TAILQ_INIT(&V_pf_sourcelim_list_inactive); + RB_INIT(&V_pf_sourcelim_id_tree_inactive); + RB_INIT(&V_pf_sourcelim_nm_tree_inactive); +} + +struct pf_sourcelim * +pf_sourcelim_rb_find(struct pf_sourcelim_id_tree *tree, + struct pf_sourcelim *key) +{ + PF_RULES_ASSERT(); + return (RB_FIND(pf_sourcelim_id_tree, tree, key)); +} + +struct pf_sourcelim * +pf_sourcelim_rb_nfind(struct pf_sourcelim_id_tree *tree, + struct pf_sourcelim *key) +{ + PF_RULES_ASSERT(); + return (RB_NFIND(pf_sourcelim_id_tree, tree, key)); +} + +int +pf_sourcelim_get(struct pfioc_sourcelim *ioc, + struct pf_sourcelim *(*rbt_op)(struct pf_sourcelim_id_tree *, + struct pf_sourcelim *)) +{ + struct pf_sourcelim key = { .pfsrlim_id = ioc->id }; + struct pf_sourcelim *pfsrlim; + int error = 0; + PF_RULES_RLOCK_TRACKER; + + PF_RULES_RLOCK(); + + pfsrlim = (*rbt_op)(&V_pf_sourcelim_id_tree_active, &key); + if (pfsrlim == NULL) { + error = ESRCH; + goto unlock; + } + + ioc->id = pfsrlim->pfsrlim_id; + ioc->entries = pfsrlim->pfsrlim_entries; + ioc->limit = pfsrlim->pfsrlim_limit; + ioc->inet_prefix = pfsrlim->pfsrlim_ipv4_prefix; + ioc->inet6_prefix = pfsrlim->pfsrlim_ipv6_prefix; + ioc->rate.limit = pfsrlim->pfsrlim_rate.limit; + ioc->rate.seconds = pfsrlim->pfsrlim_rate.seconds; + + CTASSERT(sizeof(ioc->overload_tblname) == + sizeof(pfsrlim->pfsrlim_overload.name)); + memcpy(ioc->overload_tblname, pfsrlim->pfsrlim_overload.name, + sizeof(pfsrlim->pfsrlim_overload.name)); + ioc->overload_hwm = pfsrlim->pfsrlim_overload.hwm; + ioc->overload_lwm = pfsrlim->pfsrlim_overload.lwm; + + CTASSERT(sizeof(ioc->name) == sizeof(pfsrlim->pfsrlim_nm)); + memcpy(ioc->name, pfsrlim->pfsrlim_nm, sizeof(ioc->name)); + /* XXX overload table thing */ + + ioc->nentries = pfsrlim->pfsrlim_nsources; + + ioc->inuse = pfsrlim->pfsrlim_counters.inuse; + ioc->addrallocs = pfsrlim->pfsrlim_counters.addrallocs; + ioc->addrnomem = pfsrlim->pfsrlim_counters.addrnomem; + ioc->admitted = pfsrlim->pfsrlim_counters.admitted; + ioc->addrlimited = pfsrlim->pfsrlim_counters.addrlimited; + ioc->hardlimited = pfsrlim->pfsrlim_counters.hardlimited; + ioc->ratelimited = pfsrlim->pfsrlim_counters.ratelimited; + +unlock: + PF_RULES_RUNLOCK(); + + return (error); +} + +struct pf_source * +pf_source_rb_find(struct pf_source_ioc_tree *tree, + struct pf_source *key) +{ + PF_RULES_ASSERT(); + + return (RB_FIND(pf_source_ioc_tree, tree, key)); +} + +struct pf_source * +pf_source_rb_nfind(struct pf_source_ioc_tree *tree, + struct pf_source *key) +{ + PF_RULES_ASSERT(); + + return (RB_NFIND(pf_source_ioc_tree, tree, key)); +} + +int +pf_source_clr(struct pfioc_source_kill *ioc) +{ + extern struct pf_source_list pf_source_gc; + struct pf_sourcelim plkey = { + .pfsrlim_id = ioc->id, + }; + struct pf_source skey = { + .pfsr_af = ioc->af, + .pfsr_rdomain = ioc->rdomain, + .pfsr_addr = ioc->addr, + }; + struct pf_sourcelim *pfsrlim; + struct pf_source *pfsr; + struct pf_state_link *pfl, *npfl; + int error = 0; + unsigned int gen; + + if (ioc->rmstates) { + /* XXX userland wants the states removed too */ + return (EOPNOTSUPP); + } + + PF_RULES_WLOCK(); + + pfsrlim = pf_sourcelim_rb_find(&V_pf_sourcelim_id_tree_active, &plkey); + if (pfsrlim == NULL) { + error = ESRCH; + goto unlock; + } + + pfsr = pf_source_rb_find(&pfsrlim->pfsrlim_ioc_sources, &skey); + if (pfsr == NULL) { + error = ENOENT; + goto unlock; + } + + RB_REMOVE(pf_source_tree, &pfsrlim->pfsrlim_sources, pfsr); + RB_REMOVE(pf_source_ioc_tree, &pfsrlim->pfsrlim_ioc_sources, pfsr); + if (pfsr->pfsr_inuse == 0) + TAILQ_REMOVE(&pf_source_gc, pfsr, pfsr_empty_gc); + + gen = pf_sourcelim_enter(pfsrlim); + pfsrlim->pfsrlim_nsources--; + pfsrlim->pfsrlim_counters.inuse -= pfsr->pfsr_inuse; + pf_sourcelim_leave(pfsrlim, gen); + + /* unwire the links */ + TAILQ_FOREACH(pfl, &pfsr->pfsr_states, pfl_link) { + struct pf_kstate *st = pfl->pfl_state; + + /* if !rmst */ + st->sourcelim = 0; + SLIST_REMOVE(&st->linkage, pfl, pf_state_link, pfl_linkage); + } + + PF_RULES_WUNLOCK(); + + TAILQ_FOREACH_SAFE(pfl, &pfsr->pfsr_states, pfl_link, npfl) + free(pfl, M_PF_STATE_LINK); + + free(pfsr, M_PF_SOURCE_LIM); + + return (0); + +unlock: + PF_RULES_WUNLOCK(); + + return (error); +} + static void pf_src_node_copy(const struct pf_ksrc_node *in, struct pf_src_node *out) { @@ -2156,6 +2916,23 @@ return 0; } +static int +pf_chk_limiter_action(int limiter_action) +{ + int rv; + + switch (limiter_action) { + case PF_LIMITER_NOMATCH: + case PF_LIMITER_BLOCK: + rv = 0; + break; + default: + rv = 1; + } + + return (rv); +} + int pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket, uint32_t pool_ticket, const char *anchor, const char *anchor_call, @@ -2180,6 +2957,9 @@ ERROUT_UNLOCKED(EINVAL); if (pf_validate_range(rule->dst.port_op, rule->dst.port)) ERROUT_UNLOCKED(EINVAL); + if (pf_chk_limiter_action(rule->statelim.limiter_action) || + pf_chk_limiter_action(rule->sourcelim.limiter_action)) + ERROUT_UNLOCKED(EINVAL); if (rule->ifname[0]) kif = pf_kkif_create(M_WAITOK); diff --git a/sys/netpfil/pf/pf_nl.h b/sys/netpfil/pf/pf_nl.h --- a/sys/netpfil/pf/pf_nl.h +++ b/sys/netpfil/pf/pf_nl.h @@ -73,6 +73,15 @@ PFNL_CMD_TABLE_GET_ADDR = 35, PFNL_CMD_TABLE_GET_ASTATS = 36, PFNL_CMD_TABLE_CLEAR_ASTATS = 37, + PFNL_CMD_STATE_LIMITER_ADD = 38, + PFNL_CMD_STATE_LIMITER_GET = 39, + PFNL_CMD_STATE_LIMITER_NGET = 40, + PFNL_CMD_SOURCE_LIMITER_ADD = 41, + PFNL_CMD_SOURCE_LIMITER_GET = 42, + PFNL_CMD_SOURCE_LIMITER_NGET = 43, + PFNL_CMD_SOURCE_GET = 44, + PFNL_CMD_SOURCE_NGET = 45, + PFNL_CMD_SOURCE_CLEAR = 46, __PFNL_CMD_MAX, }; #define PFNL_CMD_MAX (__PFNL_CMD_MAX -1) @@ -290,6 +299,10 @@ PF_RT_TYPE_2 = 84, /* u16 */ PF_RT_CODE_2 = 85, /* u16 */ PF_RT_EXPTIME = 86, /* time_t */ + PF_RT_STATE_LIMIT = 87, /* u8 */ + PF_RT_SOURCE_LIMIT = 88, /* u8 */ + PF_RT_STATE_LIMIT_ACTION = 89, /* u32 */ + PF_RT_SOURCE_LIMIT_ACTION = 90, /* u32 */ }; enum pf_addrule_type_t { @@ -507,6 +520,76 @@ PF_TAS_ASTATS_COUNT = 4, /* u32 */ PF_TAS_ASTATS_ZEROED = 5, /* u32 */ }; + +enum pf_limit_rate_t { + PF_LR_UNSPEC, + PF_LR_LIMIT = 1, /* u32 */ + PF_LR_SECONDS = 2, /* u32 */ +}; + +enum pf_state_limit_t { + PF_SL_UNSPEC, + PF_SL_TICKET = 1, /* u32 */ + PF_SL_NAME = 2, /* string */ + PF_SL_ID = 3, /* u32 */ + PF_SL_LIMIT = 4, /* u32 */ + PF_SL_RATE = 5, /* nested, pf_limit_rate_t */ + PF_SL_DESCR = 6, /* string */ + PF_SL_INUSE = 7, /* u32 */ + PF_SL_ADMITTED = 8, /* u64 */ + PF_SL_HARDLIMITED = 9, /* u64 */ + PF_SL_RATELIMITED = 10, /* u64 */ +}; + +enum pf_source_limit_t { + PF_SCL_UNSPEC, + PF_SCL_TICKET = 1, /* u32 */ + PF_SCL_NAME = 2, /* string */ + PF_SCL_ID = 3, /* u32 */ + PF_SCL_ENTRIES = 4, /* u32 */ + PF_SCL_LIMIT = 5, /* u32 */ + PF_SCL_RATE = 6, /* nested, pf_limit_rate_t */ + PF_SCL_OVERLOAD_TBL_NAME = 7, /* string*/ + PF_SCL_OVERLOAD_HIGH_WM = 8, /* u32 */ + PF_SCL_OVERLOAD_LOW_WM = 9, /* u32 */ + PF_SCL_INET_PREFIX = 10, /* u32 */ + PF_SCL_INET6_PREFIX = 11, /* u32 */ + PF_SCL_DESCR = 12, /* string */ + PF_SCL_NENTRIES = 13, /* u32 */ + PF_SCL_INUSE = 14, /* u32 */ + PF_SCL_ADDR_ALLOCS = 15, /* u64 */ + PF_SCL_ADDR_NOMEM = 16, /* u64 */ + PF_SCL_ADMITTED = 17, /* u64 */ + PF_SCL_ADDRLIMITED = 18, /* u64 */ + PF_SCL_HARDLIMITED = 19, /* u64 */ + PF_SCL_RATELIMITED = 20, /* u64 */ +}; + +enum pf_source_t { + PF_SRC_UNSPEC, + PF_SRC_NAME = 1, /* string */ + PF_SRC_ID = 2, /* u32 */ + PF_SRC_AF = 3, /* u8 */ + PF_SRC_RDOMAIN = 4, /* u32 */ + PF_SRC_ADDR = 5, /* in6_addr */ + PF_SRC_INUSE = 6, /* u32 */ + PF_SRC_ADMITTED = 7, /* u64 */ + PF_SRC_HARDLIMITED = 8, /* u64 */ + PF_SRC_RATELIMITED = 9, /* u64 */ + PF_SRC_LIMIT = 10, /* u32 */ + PF_SRC_INET_PREFIX = 11, /* u32 */ + PF_SRC_INET6_PREFIX = 12, /* u32 */ +}; + +enum pf_source_clear_t { + PF_SC_UNSPEC, + PF_SC_NAME = 1, /* string */ + PF_SC_ID = 2, /* u32*/ + PF_SC_RDOMAIN = 3, /* u32 */ + PF_SC_AF = 4, /* u8 */ + PF_SC_ADDR = 5, /* in6_addr */ +}; + #ifdef _KERNEL void pf_nl_register(void); diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c --- a/sys/netpfil/pf/pf_nl.c +++ b/sys/netpfil/pf/pf_nl.c @@ -784,6 +784,10 @@ { .type = PF_RT_MAX_PKT_SIZE, .off = _OUT(max_pkt_size), .cb = nlattr_get_uint16 }, { .type = PF_RT_TYPE_2, .off = _OUT(type), .cb = nlattr_get_uint16 }, { .type = PF_RT_CODE_2, .off = _OUT(code), .cb = nlattr_get_uint16 }, + { .type = PF_RT_STATE_LIMIT, .off = _OUT(statelim.id), .cb = nlattr_get_uint8 }, + { .type = PF_RT_SOURCE_LIMIT, .off = _OUT(sourcelim.id), .cb = nlattr_get_uint8 }, + { .type = PF_RT_STATE_LIMIT_ACTION, .off = _OUT(statelim.limiter_action), .cb = nlattr_get_uint32 }, + { .type = PF_RT_SOURCE_LIMIT_ACTION, .off = _OUT(sourcelim.limiter_action), .cb = nlattr_get_uint32 }, }; NL_DECLARE_ATTR_PARSER(rule_parser, nla_p_rule); #undef _OUT @@ -1041,6 +1045,10 @@ nlattr_add_u64(nw, PF_RT_SRC_NODES_ROUTE, counter_u64_fetch(rule->src_nodes[PF_SN_ROUTE])); nlattr_add_pf_threshold(nw, PF_RT_PKTRATE, &rule->pktrate); nlattr_add_time_t(nw, PF_RT_EXPTIME, time_second - (time_uptime - rule->exptime)); + nlattr_add_u8(nw, PF_RT_STATE_LIMIT, rule->statelim.id); + nlattr_add_u32(nw, PF_RT_STATE_LIMIT_ACTION, rule->statelim.limiter_action); + nlattr_add_u8(nw, PF_RT_SOURCE_LIMIT, rule->sourcelim.id); + nlattr_add_u32(nw, PF_RT_SOURCE_LIMIT_ACTION, rule->sourcelim.limiter_action); error = pf_kanchor_copyout(ruleset, rule, anchor_call, sizeof(anchor_call)); MPASS(error == 0); @@ -2459,6 +2467,346 @@ return (error); } +static const struct nlattr_parser nla_p_rate[] = { + { .type = PF_LR_LIMIT, .off = 0, .cb = nlattr_get_uint32 }, + { .type = PF_LR_SECONDS, .off = sizeof(unsigned int), .cb = nlattr_get_uint32 }, +}; +NL_DECLARE_ATTR_PARSER(rate_parser, nla_p_rate); + +#define _OUT(_field) offsetof(struct pfioc_statelim, _field) +static const struct nlattr_parser nla_p_state_limiter[] = { + { .type = PF_SL_TICKET, .off = _OUT(ticket), .cb = nlattr_get_uint32 }, + { .type = PF_SL_NAME, .off = _OUT(name), .arg = (void *)PF_STATELIM_NAME_LEN, .cb = nlattr_get_chara }, + { .type = PF_SL_ID, .off = _OUT(id), .cb = nlattr_get_uint32 }, + { .type = PF_SL_LIMIT, .off = _OUT(limit), .cb = nlattr_get_uint32 }, + { .type = PF_SL_RATE, .off = _OUT(rate), .arg = &rate_parser, .cb = nlattr_get_nested }, + { .type = PF_SL_DESCR, .off = _OUT(description), .arg = (void *)PF_STATELIM_DESCR_LEN, .cb = nlattr_get_chara }, +}; +NL_DECLARE_PARSER(state_limiter_parser, struct genlmsghdr, nlf_p_empty, nla_p_state_limiter); +#undef _OUT + +static int +pf_handle_state_limiter_add(struct nlmsghdr *hdr, struct nl_pstate *npt) +{ + struct pfioc_statelim attrs = { 0 }; + struct nl_writer *nw = npt->nw; + struct genlmsghdr *ghdr_new; + int error; + + error = nl_parse_nlmsg(hdr, &state_limiter_parser, npt, &attrs); + if (error != 0) + return (error); + + error = pf_statelim_add(&attrs); + if (error != 0) + return (error); + + if (!nlmsg_reply(nw, hdr, sizeof(struct genlmsghdr))) + return (ENOMEM); + + ghdr_new = nlmsg_reserve_object(nw, struct genlmsghdr); + ghdr_new->cmd = PFNL_CMD_STATE_LIMITER_ADD; + + nlattr_add_u32(nw, PF_SL_ID, attrs.id); + + if (!nlmsg_end(nw)) + return (ENOMEM); + + return (error); +} + +static bool +nlattr_add_limiter_rate(struct nl_writer *nw, int attrtype, + const struct pf_limiter_rate *rate) +{ + int off = nlattr_add_nested(nw, attrtype); + if (off == 0) + return (false); + + nlattr_add_u32(nw, PF_LR_LIMIT, rate->limit); + nlattr_add_u32(nw, PF_LR_SECONDS, rate->seconds); + + nlattr_set_len(nw, off); + + return (true); +} + +static int +pf_handle_state_limiter_get(struct nlmsghdr *hdr, struct nl_pstate *npt) +{ + struct pfioc_statelim attrs = { 0 }; + struct nl_writer *nw = npt->nw; + struct genlmsghdr *ghdr = (struct genlmsghdr *)(hdr + 1); + struct genlmsghdr *ghdr_new; + int error; + + error = nl_parse_nlmsg(hdr, &state_limiter_parser, npt, &attrs); + if (error != 0) + return (error); + + error = pf_statelim_get(&attrs, + ghdr->cmd == PFNL_CMD_STATE_LIMITER_GET ? pf_statelim_rb_find : + pf_statelim_rb_nfind); + if (error != 0) + return (error); + + if (!nlmsg_reply(nw, hdr, sizeof(struct genlmsghdr))) + return (ENOMEM); + + ghdr_new = nlmsg_reserve_object(nw, struct genlmsghdr); + ghdr_new->cmd = PFNL_CMD_STATE_LIMITER_GET; + + nlattr_add_string(nw, PF_SL_NAME, attrs.name); + nlattr_add_u32(nw, PF_SL_ID, attrs.id); + nlattr_add_u32(nw, PF_SL_LIMIT, attrs.limit); + nlattr_add_limiter_rate(nw, PF_SL_RATE, &attrs.rate); + nlattr_add_string(nw, PF_SL_DESCR, attrs.description); + nlattr_add_u32(nw, PF_SL_INUSE, attrs.inuse); + nlattr_add_u64(nw, PF_SL_ADMITTED, attrs.admitted); + nlattr_add_u64(nw, PF_SL_HARDLIMITED, attrs.hardlimited); + nlattr_add_u64(nw, PF_SL_RATELIMITED, attrs.ratelimited); + + if (!nlmsg_end(nw)) + return (ENOMEM); + + return (error); +} + +#define _OUT(_field) offsetof(struct pfioc_sourcelim, _field) +static const struct nlattr_parser nla_p_source_limiter[] = { + { .type = PF_SCL_TICKET, .off = _OUT(ticket), .cb = nlattr_get_uint32 }, + { .type = PF_SCL_NAME, .off = _OUT(name), .arg = (void *)PF_STATELIM_NAME_LEN, .cb = nlattr_get_chara }, + { .type = PF_SCL_ID, .off = _OUT(id), .cb = nlattr_get_uint32 }, + { .type = PF_SCL_ENTRIES, .off = _OUT(entries), .cb = nlattr_get_uint32 }, + { .type = PF_SCL_LIMIT, .off = _OUT(limit), .cb = nlattr_get_uint32 }, + { .type = PF_SCL_RATE, .off = _OUT(rate), .arg = &rate_parser, .cb = nlattr_get_nested }, + { .type = PF_SCL_OVERLOAD_TBL_NAME, .off = _OUT(overload_tblname), .arg = (void *)PF_TABLE_NAME_SIZE, .cb = nlattr_get_chara }, + { .type = PF_SCL_OVERLOAD_HIGH_WM, .off = _OUT(overload_hwm), .cb = nlattr_get_uint32 }, + { .type = PF_SCL_OVERLOAD_LOW_WM, .off = _OUT(overload_lwm), .cb = nlattr_get_uint32 }, + { .type = PF_SCL_INET_PREFIX, .off = _OUT(inet_prefix), .cb = nlattr_get_uint32 }, + { .type = PF_SCL_INET6_PREFIX, .off = _OUT(inet6_prefix), .cb = nlattr_get_uint32 }, + { .type = PF_SCL_DESCR, .off = _OUT(description), .arg = (void *)PF_STATELIM_DESCR_LEN, .cb = nlattr_get_chara }, +}; +#undef _OUT +NL_DECLARE_PARSER(source_limiter_parser, struct genlmsghdr, nlf_p_empty, nla_p_source_limiter); + +static int +pf_handle_source_limiter_add(struct nlmsghdr *hdr, struct nl_pstate *npt) +{ + struct pfioc_sourcelim attrs = { 0 }; + struct nl_writer *nw = npt->nw; + struct genlmsghdr *ghdr_new; + int error; + + error = nl_parse_nlmsg(hdr, &source_limiter_parser, npt, &attrs); + if (error != 0) + return (error); + + error = pf_sourcelim_add(&attrs); + if (error != 0) + return (error); + + if (!nlmsg_reply(nw, hdr, sizeof(struct genlmsghdr))) + return (ENOMEM); + + ghdr_new = nlmsg_reserve_object(nw, struct genlmsghdr); + ghdr_new->cmd = PFNL_CMD_SOURCE_LIMITER_ADD; + + nlattr_add_u32(nw, PF_SCL_ID, attrs.id); + + if (!nlmsg_end(nw)) + return (ENOMEM); + + return (error); +} + +static int +pf_handle_source_limiter_get(struct nlmsghdr *hdr, struct nl_pstate *npt) +{ + struct pfioc_sourcelim attrs = { 0 }; + struct nl_writer *nw = npt->nw; + struct genlmsghdr *ghdr = (struct genlmsghdr *)(hdr + 1); + struct genlmsghdr *ghdr_new; + int error; + + error = nl_parse_nlmsg(hdr, &source_limiter_parser, npt, &attrs); + if (error != 0) + return (error); + + error = pf_sourcelim_get(&attrs, + ghdr->cmd == PFNL_CMD_SOURCE_LIMITER_GET ? pf_sourcelim_rb_find : + pf_sourcelim_rb_nfind); + if (error != 0) + return (error); + + if (!nlmsg_reply(nw, hdr, sizeof(struct genlmsghdr))) + return (ENOMEM); + + ghdr_new = nlmsg_reserve_object(nw, struct genlmsghdr); + ghdr_new->cmd = ghdr->cmd; + + nlattr_add_string(nw, PF_SCL_NAME, attrs.name); + nlattr_add_u32(nw, PF_SCL_ID, attrs.id); + nlattr_add_u32(nw, PF_SCL_ENTRIES, attrs.entries); + nlattr_add_u32(nw, PF_SCL_LIMIT, attrs.limit); + nlattr_add_limiter_rate(nw, PF_SCL_RATE, &attrs.rate); + nlattr_add_string(nw, PF_SCL_OVERLOAD_TBL_NAME, attrs.overload_tblname); + nlattr_add_u32(nw, PF_SCL_OVERLOAD_HIGH_WM, attrs.overload_hwm); + nlattr_add_u32(nw, PF_SCL_OVERLOAD_LOW_WM, attrs.overload_lwm); + nlattr_add_u32(nw, PF_SCL_INET_PREFIX, attrs.inet_prefix); + nlattr_add_u32(nw, PF_SCL_INET6_PREFIX, attrs.inet6_prefix); + nlattr_add_string(nw, PF_SCL_DESCR, attrs.description); + nlattr_add_u32(nw, PF_SCL_NENTRIES, attrs.nentries); + nlattr_add_u32(nw, PF_SCL_INUSE, attrs.inuse); + nlattr_add_u64(nw, PF_SCL_ADDR_ALLOCS, attrs.addrallocs); + nlattr_add_u64(nw, PF_SCL_ADDR_NOMEM, attrs.addrnomem); + nlattr_add_u64(nw, PF_SCL_ADMITTED, attrs.admitted); + nlattr_add_u64(nw, PF_SCL_ADDRLIMITED, attrs.addrlimited); + nlattr_add_u64(nw, PF_SCL_HARDLIMITED, attrs.hardlimited); + nlattr_add_u64(nw, PF_SCL_RATELIMITED, attrs.ratelimited); + + if (!nlmsg_end(nw)) + return (ENOMEM); + + return (error); +} + +struct nlattr_source { + char name[PF_SOURCELIM_NAME_LEN]; + uint32_t id; + sa_family_t af; + unsigned int rdomain; + struct pf_addr addr; +}; +#define _OUT(_field) offsetof(struct nlattr_source, _field) +static const struct nlattr_parser nla_p_source[] = { + { .type = PF_SRC_NAME, .off = _OUT(name), .arg = (void *)PF_SOURCELIM_NAME_LEN, .cb = nlattr_get_chara }, + { .type = PF_SRC_ID, .off = _OUT(id), .cb = nlattr_get_uint32 }, + { .type = PF_SRC_AF, .off = _OUT(af), .cb = nlattr_get_uint8 }, + { .type = PF_SRC_RDOMAIN, .off = _OUT(rdomain), .cb = nlattr_get_uint32 }, + { .type = PF_SRC_ADDR, .off = _OUT(addr), .cb = nlattr_get_in6_addr }, +}; +#undef _OUT +NL_DECLARE_PARSER(source_parser, struct genlmsghdr, nlf_p_empty, nla_p_source); + +static int +pf_handle_source_get(struct nlmsghdr *hdr, struct nl_pstate *npt) +{ + struct nlattr_source attrs = { 0 }; + struct pf_source key; + struct pf_sourcelim plkey; + struct nl_writer *nw = npt->nw; + struct genlmsghdr *ghdr = (struct genlmsghdr *)(hdr + 1); + struct genlmsghdr *ghdr_new; + struct pf_sourcelim *pfsrlim; + struct pf_source *pfsr; + int error; + PF_RULES_RLOCK_TRACKER; + + error = nl_parse_nlmsg(hdr, &source_parser, npt, &attrs); + if (error != 0) + return (error); + + PF_RULES_RLOCK(); + plkey.pfsrlim_id = attrs.id; + pfsrlim = pf_sourcelim_rb_find(&V_pf_sourcelim_id_tree_active, &plkey); + if (pfsrlim == NULL) { + error = ESRCH; + goto out; + } + + key.pfsr_af = attrs.af; + key.pfsr_rdomain = attrs.rdomain; + key.pfsr_addr = attrs.addr; + + pfsr = (ghdr->cmd == PFNL_CMD_SOURCE_GET ? pf_source_rb_find : + pf_source_rb_nfind)(&pfsrlim->pfsrlim_ioc_sources, &key); + if (pfsr == NULL) { + error = ENOENT; + goto out; + } + + for (;;) { + if (!nlmsg_reply(nw, hdr, sizeof(struct genlmsghdr))) { + error = ENOMEM; + goto out; + } + + ghdr_new = nlmsg_reserve_object(nw, struct genlmsghdr); + ghdr_new->cmd = ghdr->cmd; + + nlattr_add_u8(nw, PF_SRC_AF, pfsr->pfsr_af); + nlattr_add_u32(nw, PF_SRC_RDOMAIN, pfsr->pfsr_rdomain); + nlattr_add_in6_addr(nw, PF_SRC_ADDR, &pfsr->pfsr_addr.v6); + + nlattr_add_u32(nw, PF_SRC_INUSE, pfsr->pfsr_inuse); + nlattr_add_u64(nw, PF_SRC_ADMITTED, pfsr->pfsr_counters.admitted); + nlattr_add_u64(nw, PF_SRC_HARDLIMITED, pfsr->pfsr_counters.hardlimited); + nlattr_add_u64(nw, PF_SRC_RATELIMITED, pfsr->pfsr_counters.ratelimited); + + nlattr_add_u32(nw, PF_SRC_LIMIT, pfsrlim->pfsrlim_limit); + nlattr_add_u32(nw, PF_SRC_INET_PREFIX, pfsrlim->pfsrlim_ipv4_prefix); + nlattr_add_u32(nw, PF_SRC_INET6_PREFIX, pfsrlim->pfsrlim_ipv6_prefix); + + if (!nlmsg_end(nw)) { + nlmsg_abort(nw); + error = ENOMEM; + goto out; + } + + pfsr = RB_NEXT(pf_source_ioc_tree, srlim->pfsrlim_ioc_sources, pfsr); + if (pfsr == NULL) + break; + } + +out: + PF_RULES_RUNLOCK(); + return (error); +} + + +#define _OUT(_field) offsetof(struct pfioc_source_kill, _field) +static const struct nlattr_parser nla_p_source_clear[] = { + { .type = PF_SC_NAME, .off = _OUT(name), .arg = (void *)PF_SOURCELIM_NAME_LEN, .cb = nlattr_get_chara }, + { .type = PF_SC_ID, .off = _OUT(id), .cb = nlattr_get_uint32 }, + { .type = PF_SC_RDOMAIN, .off = _OUT(rdomain), .cb = nlattr_get_uint32 }, + { .type = PF_SC_AF, .off = _OUT(af), .cb = nlattr_get_uint8 }, + { .type = PF_SC_ADDR, .off = _OUT(addr), .cb = nlattr_get_in6_addr }, +}; +#undef _OUT +NL_DECLARE_PARSER(source_clear_parser, struct genlmsghdr, nlf_p_empty, nla_p_source_clear); + +static int +pf_handle_source_clear(struct nlmsghdr *hdr, struct nl_pstate *npt) +{ + struct pfioc_source_kill attrs = { 0 }; + struct nl_writer *nw = npt->nw; + struct genlmsghdr *ghdr = (struct genlmsghdr *)(hdr + 1); + struct genlmsghdr *ghdr_new; + int error; + + error = nl_parse_nlmsg(hdr, &source_clear_parser, npt, &attrs); + if (error != 0) + return (error); + + error = pf_source_clr(&attrs); + if (error != 0) + return (error); + + if (!nlmsg_reply(nw, hdr, sizeof(struct genlmsghdr))) + return (ENOMEM); + + ghdr_new = nlmsg_reserve_object(nw, struct genlmsghdr); + ghdr_new->cmd = ghdr->cmd; + + nlattr_add_string(nw, PF_SCL_NAME, attrs.name); + + if (!nlmsg_end(nw)) + return (ENOMEM); + + return (error); +} + static const struct nlhdr_parser *all_parsers[] = { &state_parser, &addrule_parser, @@ -2475,6 +2823,10 @@ &table_parser, &table_addr_parser, &table_astats_parser, + &state_limiter_parser, + &source_limiter_parser, + &source_parser, + &source_clear_parser, }; static uint16_t family_id; @@ -2739,6 +3091,69 @@ .cmd_flags = GENL_CMD_CAP_DUMP | GENL_CMD_CAP_HASPOL, .cmd_priv = PRIV_NETINET_PF, }, + { + .cmd_num = PFNL_CMD_STATE_LIMITER_ADD, + .cmd_name = "STATE_LIMITER_ADD", + .cmd_cb = pf_handle_state_limiter_add, + .cmd_flags = GENL_CMD_CAP_DO | GENL_CMD_CAP_HASPOL, + .cmd_priv = PRIV_NETINET_PF, + }, + { + .cmd_num = PFNL_CMD_STATE_LIMITER_GET, + .cmd_name = "STATE_LIMITER_GET", + .cmd_cb = pf_handle_state_limiter_get, + .cmd_flags = GENL_CMD_CAP_DUMP | GENL_CMD_CAP_HASPOL, + .cmd_priv = PRIV_NETINET_PF, + }, + { + .cmd_num = PFNL_CMD_STATE_LIMITER_NGET, + .cmd_name = "STATE_LIMITER_NGET", + .cmd_cb = pf_handle_state_limiter_get, + .cmd_flags = GENL_CMD_CAP_DUMP | GENL_CMD_CAP_HASPOL, + .cmd_priv = PRIV_NETINET_PF, + }, + { + .cmd_num = PFNL_CMD_SOURCE_LIMITER_ADD, + .cmd_name = "SOURCE_LIMITER_ADD", + .cmd_cb = pf_handle_source_limiter_add, + .cmd_flags = GENL_CMD_CAP_DO | GENL_CMD_CAP_HASPOL, + .cmd_priv = PRIV_NETINET_PF, + }, + { + .cmd_num = PFNL_CMD_SOURCE_LIMITER_GET, + .cmd_name = "SOURCE_LIMITER_GET", + .cmd_cb = pf_handle_source_limiter_get, + .cmd_flags = GENL_CMD_CAP_DUMP | GENL_CMD_CAP_HASPOL, + .cmd_priv = PRIV_NETINET_PF, + }, + { + .cmd_num = PFNL_CMD_SOURCE_LIMITER_NGET, + .cmd_name = "SOURCE_LIMITER_NGET", + .cmd_cb = pf_handle_source_limiter_get, + .cmd_flags = GENL_CMD_CAP_DUMP | GENL_CMD_CAP_HASPOL, + .cmd_priv = PRIV_NETINET_PF, + }, + { + .cmd_num = PFNL_CMD_SOURCE_GET, + .cmd_name = "SOURCE_GET", + .cmd_cb = pf_handle_source_get, + .cmd_flags = GENL_CMD_CAP_DUMP | GENL_CMD_CAP_HASPOL, + .cmd_priv = PRIV_NETINET_PF, + }, + { + .cmd_num = PFNL_CMD_SOURCE_NGET, + .cmd_name = "SOURCE_NGET", + .cmd_cb = pf_handle_source_get, + .cmd_flags = GENL_CMD_CAP_DUMP | GENL_CMD_CAP_HASPOL, + .cmd_priv = PRIV_NETINET_PF, + }, + { + .cmd_num = PFNL_CMD_SOURCE_CLEAR, + .cmd_name = "SOURCE_CLEAR", + .cmd_cb = pf_handle_source_clear, + .cmd_flags = GENL_CMD_CAP_DO | GENL_CMD_CAP_HASPOL, + .cmd_priv = PRIV_NETINET_PF, + }, }; void diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -882,6 +882,26 @@ return (0); } +int +pfr_remove_kentry(struct pfr_ktable *kt, struct pfr_addr *ad) +{ + struct pfr_kentryworkq workq = SLIST_HEAD_INITIALIZER(workq); + struct pfr_kentry *p; + + p = pfr_lookup_addr(kt, ad, 1); + if (p == NULL || p->pfrke_not) + return (ESRCH); + + if (p->pfrke_mark) + return (0); + + p->pfrke_mark = 1; + SLIST_INSERT_HEAD(&workq, p, pfrke_workq); + pfr_remove_kentries(kt, &workq); + + return (0); +} + static void pfr_remove_kentries(struct pfr_ktable *kt, struct pfr_kentryworkq *workq) diff --git a/sys/powerpc/booke/booke_machdep.c b/sys/powerpc/booke/booke_machdep.c --- a/sys/powerpc/booke/booke_machdep.c +++ b/sys/powerpc/booke/booke_machdep.c @@ -187,10 +187,6 @@ extern void *int_debug_ed; extern void *int_vec; extern void *int_vecast; -#ifdef __SPE__ -extern void *int_spe_fpdata; -extern void *int_spe_fpround; -#endif #ifdef HWPMC_HOOKS extern void *int_performance_counter; #endif @@ -278,10 +274,6 @@ case FSL_E500v1: case FSL_E500v2: SET_TRAP(SPR_IVOR32, int_vec); -#ifdef __SPE__ - SET_TRAP(SPR_IVOR33, int_spe_fpdata); - SET_TRAP(SPR_IVOR34, int_spe_fpround); -#endif break; } diff --git a/sys/powerpc/booke/trap_subr.S b/sys/powerpc/booke/trap_subr.S --- a/sys/powerpc/booke/trap_subr.S +++ b/sys/powerpc/booke/trap_subr.S @@ -636,28 +636,6 @@ b trap_common -#ifdef __SPE__ -/***************************************************************************** - * Floating point Assist interrupt - ****************************************************************************/ -INTERRUPT(int_spe_fpdata) - STANDARD_PROLOG(SPR_SPRG1, PC_TEMPSAVE, SPR_SRR0, SPR_SRR1) - FRAME_SETUP(SPR_SPRG1, PC_TEMPSAVE, EXC_SPFPD) - addi %r3, %r1, CALLSIZE - bl spe_handle_fpdata - FRAME_LEAVE(SPR_SRR0, SPR_SRR1) - rfi - -INTERRUPT(int_spe_fpround) - STANDARD_PROLOG(SPR_SPRG1, PC_TEMPSAVE, SPR_SRR0, SPR_SRR1) - FRAME_SETUP(SPR_SPRG1, PC_TEMPSAVE, EXC_SPFPR) - addi %r3, %r1, CALLSIZE - bl spe_handle_fpround - FRAME_LEAVE(SPR_SRR0, SPR_SRR1) - rfi -#endif - - #ifdef HWPMC_HOOKS /***************************************************************************** * PMC Interrupt diff --git a/sys/powerpc/include/atomic.h b/sys/powerpc/include/atomic.h --- a/sys/powerpc/include/atomic.h +++ b/sys/powerpc/include/atomic.h @@ -165,6 +165,28 @@ * { *p &= ~v; } */ +#ifdef ISA_206_ATOMICS +#define __atomic_clear_char(p, v, t) \ + __asm __volatile( \ + "1: lbarx %0, 0, %2\n" \ + " andc %0, %0, %3\n" \ + " stbcx. %0, 0, %2\n" \ + " bne- 1b\n" \ + : "=&r" (t), "=m" (*p) \ + : "r" (p), "r" (v), "m" (*p) \ + : "cr0", "memory") \ + /* __atomic_clear_short */ +#define __atomic_clear_short(p, v, t) \ + __asm __volatile( \ + "1: lharx %0, 0, %2\n" \ + " andc %0, %0, %3\n" \ + " sthcx. %0, 0, %2\n" \ + " bne- 1b\n" \ + : "=&r" (t), "=m" (*p) \ + : "r" (p), "r" (v), "m" (*p) \ + : "cr0", "memory") \ + /* __atomic_clear_short */ +#endif #define __atomic_clear_int(p, v, t) \ __asm __volatile( \ "1: lwarx %0, 0, %2\n" \ @@ -222,6 +244,11 @@ } \ /* _ATOMIC_CLEAR */ +#ifdef ISA_206_ATOMICS +_ATOMIC_CLEAR(char) +_ATOMIC_CLEAR(short) +#endif + _ATOMIC_CLEAR(int) _ATOMIC_CLEAR(long) @@ -265,6 +292,28 @@ * atomic_set(p, v) * { *p |= v; } */ +#ifdef ISA_206_ATOMICS +#define __atomic_set_char(p, v, t) \ + __asm __volatile( \ + "1: lbarx %0, 0, %2\n" \ + " or %0, %3, %0\n" \ + " stbcx. %0, 0, %2\n" \ + " bne- 1b\n" \ + : "=&r" (t), "=m" (*p) \ + : "r" (p), "r" (v), "m" (*p) \ + : "cr0", "memory") \ + /* __atomic_set_char */ +#define __atomic_set_short(p, v, t) \ + __asm __volatile( \ + "1: lharx %0, 0, %2\n" \ + " or %0, %3, %0\n" \ + " sthcx. %0, 0, %2\n" \ + " bne- 1b\n" \ + : "=&r" (t), "=m" (*p) \ + : "r" (p), "r" (v), "m" (*p) \ + : "cr0", "memory") \ + /* __atomic_set_short */ +#endif #define __atomic_set_int(p, v, t) \ __asm __volatile( \ @@ -323,6 +372,11 @@ } \ /* _ATOMIC_SET */ +#ifdef ISA_206_ATOMICS +_ATOMIC_SET(char) +_ATOMIC_SET(short) +#endif + _ATOMIC_SET(int) _ATOMIC_SET(long) @@ -1140,34 +1194,10 @@ #define atomic_set_short atomic_set_16 #define atomic_clear_short atomic_clear_16 #else - -static __inline void -atomic_set_short(volatile u_short *p, u_short bit) -{ - u_short v; - - v = atomic_load_short(p); - for (;;) { - if (atomic_fcmpset_16(p, &v, v | bit)) - break; - } -} - -static __inline void -atomic_clear_short(volatile u_short *p, u_short bit) -{ - u_short v; - - v = atomic_load_short(p); - for (;;) { - if (atomic_fcmpset_16(p, &v, v & ~bit)) - break; - } -} - +#define atomic_set_8 atomic_set_char +#define atomic_clear_8 atomic_clear_char #define atomic_set_16 atomic_set_short #define atomic_clear_16 atomic_clear_short - #endif /* ISA_206_ATOMICS */ /* These need sys/_atomic_subword.h on non-ISA-2.06-atomic platforms. */ diff --git a/sys/powerpc/include/ieeefp.h b/sys/powerpc/include/ieeefp.h --- a/sys/powerpc/include/ieeefp.h +++ b/sys/powerpc/include/ieeefp.h @@ -10,19 +10,11 @@ /* Deprecated historical FPU control interface */ typedef int fp_except_t; -#ifdef __SPE__ -#define FP_X_OFL 0x01 /* overflow exception */ -#define FP_X_UFL 0x02 /* underflow exception */ -#define FP_X_DZ 0x04 /* divide-by-zero exception */ -#define FP_X_INV 0x08 /* invalid operation exception */ -#define FP_X_IMP 0x10 /* imprecise (loss of precision) */ -#else #define FP_X_IMP 0x01 /* imprecise (loss of precision) */ #define FP_X_DZ 0x02 /* divide-by-zero exception */ #define FP_X_UFL 0x04 /* underflow exception */ #define FP_X_OFL 0x08 /* overflow exception */ #define FP_X_INV 0x10 /* invalid operation exception */ -#endif typedef enum { FP_RN=0, /* round to nearest representable number */ diff --git a/sys/powerpc/powerpc/exec_machdep.c b/sys/powerpc/powerpc/exec_machdep.c --- a/sys/powerpc/powerpc/exec_machdep.c +++ b/sys/powerpc/powerpc/exec_machdep.c @@ -646,18 +646,6 @@ pcb->pcb_dscr = mfspr(SPR_DSCRP); #endif -#if defined(__SPE__) - /* - * On E500v2, single-precision scalar instructions and access to - * SPEFSCR may be used without PSL_VEC turned on, as long as they - * limit themselves to the low word of the registers. - * - * As such, we need to unconditionally save SPEFSCR, even though - * it is also updated in save_vec_nodrop(). - */ - pcb->pcb_vec.vscr = mfspr(SPR_SPEFSCR); -#endif - if (pcb_flags & PCB_FPU) save_fpu_nodrop(td); @@ -1155,9 +1143,6 @@ pcb2->pcb_context[0] = pcb2->pcb_lr; #endif pcb2->pcb_cpu.aim.usr_vsid = 0; -#ifdef __SPE__ - pcb2->pcb_vec.vscr = SPEFSCR_DFLT; -#endif /* Setup to release spin count in fork_exit(). */ td->td_md.md_spinlock_count = 1; @@ -1215,9 +1200,6 @@ } td->td_pcb->pcb_flags = 0; -#ifdef __SPE__ - td->td_pcb->pcb_vec.vscr = SPEFSCR_DFLT; -#endif td->td_retval[0] = (register_t)entry; td->td_retval[1] = 0; diff --git a/sys/powerpc/powerpc/fpu.c b/sys/powerpc/powerpc/fpu.c --- a/sys/powerpc/powerpc/fpu.c +++ b/sys/powerpc/powerpc/fpu.c @@ -317,7 +317,6 @@ pcb->pcb_flags &= ~(PCB_FPU | PCB_VSX); } -#ifndef __SPE__ /* * XXX: Implement fpu_kern_alloc_ctx/fpu_kern_free_ctx once fpu_kern_enter and * fpu_kern_leave can handle !FPU_KERN_NOCTX. @@ -403,5 +402,3 @@ curpcb = curthread->td_pcb; return ((curpcb->pcb_flags & PCB_KERN_FPU) != 0); } - -#endif /* !__SPE__ */ diff --git a/sys/powerpc/powerpc/ptrace_machdep.c b/sys/powerpc/powerpc/ptrace_machdep.c --- a/sys/powerpc/powerpc/ptrace_machdep.c +++ b/sys/powerpc/powerpc/ptrace_machdep.c @@ -37,11 +37,7 @@ #include #include -#ifdef __SPE__ -#define PPC_FEATURE_VECTOR PPC_FEATURE_HAS_SPE -#else #define PPC_FEATURE_VECTOR PPC_FEATURE_HAS_ALTIVEC -#endif int cpu_ptrace(struct thread *td, int req, void *addr, int data) diff --git a/sys/powerpc/powerpc/swtch32.S b/sys/powerpc/powerpc/swtch32.S --- a/sys/powerpc/powerpc/swtch32.S +++ b/sys/powerpc/powerpc/swtch32.S @@ -119,10 +119,6 @@ bl save_vec .L2: -#if defined(__SPE__) - mfspr %r3,SPR_SPEFSCR - stw %r3,PCB_VSCR(%r17) -#endif mr %r3,%r14 /* restore old thread ptr */ bl pmap_deactivate /* Deactivate the current pmap */ @@ -176,10 +172,6 @@ bl enable_vec .L4: -#if defined(__SPE__) - lwz %r3,PCB_VSCR(%r17) - mtspr SPR_SPEFSCR,%r3 -#endif /* thread to restore is in r3 */ mr %r3,%r17 /* Recover PCB ptr */ lmw %r12,PCB_CONTEXT(%r3) /* Load the non-volatile GP regs */ @@ -224,9 +216,5 @@ trapframe to simulate FRAME_SETUP does when allocating space for a frame pointer/saved LR */ -#ifdef __SPE__ - li %r3,SPEFSCR_DFLT - mtspr SPR_SPEFSCR, %r3 -#endif b trapexit END(fork_trampoline) diff --git a/sys/powerpc/powerpc/trap.c b/sys/powerpc/powerpc/trap.c --- a/sys/powerpc/powerpc/trap.c +++ b/sys/powerpc/powerpc/trap.c @@ -861,41 +861,6 @@ int indicator, reg; double *fpr; -#ifdef __SPE__ - indicator = (frame->cpu.booke.esr & (ESR_ST|ESR_SPE)); - if (indicator & ESR_SPE) { - if (copyin((void *)frame->srr0, &inst, sizeof(inst)) != 0) - return (-1); - reg = EXC_ALI_INST_RST(inst); - fpr = (double *)td->td_pcb->pcb_vec.vr[reg]; - fputhread = PCPU_GET(vecthread); - - /* Juggle the SPE to ensure that we've initialized - * the registers, and that their current state is in - * the PCB. - */ - if (fputhread != td) { - if (fputhread) - save_vec(fputhread); - enable_vec(td); - } - save_vec(td); - - if (!(indicator & ESR_ST)) { - if (copyin((void *)frame->dar, fpr, - sizeof(double)) != 0) - return (-1); - frame->fixreg[reg] = td->td_pcb->pcb_vec.vr[reg][1]; - enable_vec(td); - } else { - td->td_pcb->pcb_vec.vr[reg][1] = frame->fixreg[reg]; - if (copyout(fpr, (void *)frame->dar, - sizeof(double)) != 0) - return (-1); - } - return (0); - } -#else #ifdef BOOKE indicator = (frame->cpu.booke.esr & ESR_ST) ? EXC_ALI_STFD : EXC_ALI_LFD; #else @@ -939,7 +904,6 @@ return (0); break; } -#endif return (-1); } diff --git a/sys/riscv/include/acpica_machdep.h b/sys/riscv/include/acpica_machdep.h new file mode 100644 --- /dev/null +++ b/sys/riscv/include/acpica_machdep.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2026 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb + * under sponsorship from the FreeBSD Foundation. + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#ifndef __ACPICA_MACHDEP_H__ +#define __ACPICA_MACHDEP_H__ + +/* + * This is a placeholder until full ACPI support for RISC-V emerges. + * With is we can include acpi.h from LinuxKPI and avoid (major) local changes + * to compile drivers otherwise fine on RISC-V. + */ + +#endif /* __ACPICA_MACHDEP_H__ */ diff --git a/sys/security/mac/mac_framework.h b/sys/security/mac/mac_framework.h --- a/sys/security/mac/mac_framework.h +++ b/sys/security/mac/mac_framework.h @@ -73,6 +73,7 @@ struct msg; struct msqid_kernel; struct pipepair; +struct prison; struct proc; struct semid_kernel; struct shmfd; @@ -85,6 +86,7 @@ struct timespec; struct ucred; struct vattr; +struct vfsoptlist; struct vnode; struct vop_setlabel_args; @@ -346,6 +348,22 @@ void mac_posixshm_destroy(struct shmfd *); void mac_posixshm_init(struct shmfd *); +int mac_prison_init(struct prison *pr, int flag); +void mac_prison_relabel(struct ucred *cred, struct prison *pr, + struct label *newlabel); +void mac_prison_destroy(struct prison *pr); +int mac_prison_check_attach(struct ucred *cred, struct prison *pr); +int mac_prison_check_create(struct ucred *cred, struct vfsoptlist *opts, + int flags); +int mac_prison_check_get(struct ucred *cred, struct prison *pr, + struct vfsoptlist *opts, int flags); +int mac_prison_check_set(struct ucred *cred, struct prison *pr, + struct vfsoptlist *opts, int flags); +int mac_prison_check_remove(struct ucred *cred, struct prison *pr); +void mac_prison_created(struct ucred *cred, struct prison *pr); +void mac_prison_attached(struct ucred *cred, struct prison *pr, + struct proc *p); + int mac_priv_check_impl(struct ucred *cred, int priv); #ifdef MAC extern bool mac_priv_check_fp_flag; diff --git a/sys/security/mac/mac_framework.c b/sys/security/mac/mac_framework.c --- a/sys/security/mac/mac_framework.c +++ b/sys/security/mac/mac_framework.c @@ -374,6 +374,7 @@ MPC_FLAG(mount_init_label, MPC_OBJECT_MOUNT); MPC_FLAG(posixsem_init_label, MPC_OBJECT_POSIXSEM); MPC_FLAG(posixshm_init_label, MPC_OBJECT_POSIXSHM); + MPC_FLAG(prison_init_label, MPC_OBJECT_PRISON); MPC_FLAG(sysvmsg_init_label, MPC_OBJECT_SYSVMSG); MPC_FLAG(sysvmsq_init_label, MPC_OBJECT_SYSVMSQ); MPC_FLAG(sysvsem_init_label, MPC_OBJECT_SYSVSEM); diff --git a/sys/security/mac/mac_internal.h b/sys/security/mac/mac_internal.h --- a/sys/security/mac/mac_internal.h +++ b/sys/security/mac/mac_internal.h @@ -64,6 +64,12 @@ SDT_PROVIDER_DECLARE(mac); /* MAC Framework-level events. */ SDT_PROVIDER_DECLARE(mac_framework); /* Entry points to MAC. */ +#define MAC_CHECK_PROBE_DEFINE5(name, arg0, arg1, arg2, arg3, arg4) \ + SDT_PROBE_DEFINE6(mac_framework, , name, mac__check__err, \ + "int", arg0, arg1, arg2, arg3, arg4); \ + SDT_PROBE_DEFINE6(mac_framework, , name, mac__check__ok, \ + "int", arg0, arg1, arg2, arg3, arg4); + #define MAC_CHECK_PROBE_DEFINE4(name, arg0, arg1, arg2, arg3) \ SDT_PROBE_DEFINE5(mac_framework, , name, mac__check__err, \ "int", arg0, arg1, arg2, arg3); \ @@ -88,18 +94,20 @@ SDT_PROBE_DEFINE2(mac_framework, , name, mac__check__ok, \ "int", arg0); -#define MAC_CHECK_PROBE4(name, error, arg0, arg1, arg2, arg3) do { \ +#define MAC_CHECK_PROBE5(name, error, arg0, arg1, arg2, arg3, arg4) do { \ if (SDT_PROBES_ENABLED()) { \ if (error) { \ - SDT_PROBE5(mac_framework, , name, mac__check__err,\ - error, arg0, arg1, arg2, arg3); \ + SDT_PROBE6(mac_framework, , name, mac__check__err,\ + error, arg0, arg1, arg2, arg3, arg4); \ } else { \ - SDT_PROBE5(mac_framework, , name, mac__check__ok,\ - 0, arg0, arg1, arg2, arg3); \ + SDT_PROBE6(mac_framework, , name, mac__check__ok,\ + 0, arg0, arg1, arg2, arg3, arg4); \ } \ } \ } while (0) +#define MAC_CHECK_PROBE4(name, error, arg0, arg1, arg2, arg3) \ + MAC_CHECK_PROBE5(name, error, arg0, arg1, arg2, arg3, 0) #define MAC_CHECK_PROBE3(name, error, arg0, arg1, arg2) \ MAC_CHECK_PROBE4(name, error, arg0, arg1, arg2, 0) #define MAC_CHECK_PROBE2(name, error, arg0, arg1) \ @@ -177,6 +185,7 @@ #define MPC_OBJECT_SYSVSHM 0x0000000000020000 #define MPC_OBJECT_SYNCACHE 0x0000000000040000 #define MPC_OBJECT_IP6Q 0x0000000000080000 +#define MPC_OBJECT_PRISON 0x0000000000100000 /* * MAC Framework global variables. @@ -233,6 +242,8 @@ void mac_cred_label_free(struct label *label); struct label *mac_pipe_label_alloc(void); void mac_pipe_label_free(struct label *label); +struct label *mac_prison_label_alloc(int flags); +void mac_prison_label_free(struct label *label); struct label *mac_socket_label_alloc(int flag); void mac_socket_label_free(struct label *label); void mac_socketpeer_label_free(struct label *label); @@ -252,6 +263,17 @@ char *outbuf, size_t outbuflen); int mac_pipe_internalize_label(struct label *label, char *string); +int mac_prison_label_set(struct ucred *cred, struct prison *pr, + struct label *label); +int mac_prison_check_relabel(struct ucred *cred, struct prison *pr, + struct label *newlabel); +void mac_prison_copy_label(struct label *src, struct label *dest); +int mac_prison_externalize_label(struct label *label, char *elements, + char *outbuf, size_t outbuflen); +int mac_prison_internalize_label(struct label *label, char *string); +void mac_prison_relabel(struct ucred *cred, struct prison *pr, + struct label *newlabel); + int mac_socket_label_set(struct ucred *cred, struct socket *so, struct label *label); void mac_socket_copy_label(struct label *src, struct label *dest); diff --git a/sys/security/mac/mac_policy.h b/sys/security/mac/mac_policy.h --- a/sys/security/mac/mac_policy.h +++ b/sys/security/mac/mac_policy.h @@ -88,6 +88,7 @@ struct msg; struct msqid_kernel; struct pipepair; +struct prison; struct proc; struct sbuf; struct semid_kernel; @@ -100,6 +101,7 @@ struct thread; struct ucred; struct vattr; +struct vfsoptlist; struct vnode; struct in_addr; @@ -407,6 +409,37 @@ typedef void (*mpo_posixshm_destroy_label_t)(struct label *label); typedef void (*mpo_posixshm_init_label_t)(struct label *label); +typedef int (*mpo_prison_init_label_t)(struct label *label, int flag); +typedef int (*mpo_prison_check_relabel_t)(struct ucred *cred, + struct prison *pr, struct label *prlabel, + struct label *newlabel); +typedef void (*mpo_prison_destroy_label_t)(struct label *label); +typedef void (*mpo_prison_copy_label_t)(struct label *src, + struct label *dest); +typedef int (*mpo_prison_externalize_label_t)(struct label *label, + char *element_name, struct sbuf *sb, int *claimed); +typedef int (*mpo_prison_internalize_label_t)(struct label *label, + char *element_name, char *element_data, int *claimed); +typedef void (*mpo_prison_relabel_t)(struct ucred *cred, struct prison *pr, + struct label *prlabel, struct label *newlabel); +typedef int (*mpo_prison_check_attach_t)(struct ucred *cred, + struct prison *pr, struct label *prlabel); +typedef int (*mpo_prison_check_create_t)(struct ucred *cred, + struct vfsoptlist *opts, int flags); +typedef int (*mpo_prison_check_get_t)(struct ucred *cred, + struct prison *pr, struct label *prlabel, + struct vfsoptlist *opts, int flags); +typedef int (*mpo_prison_check_set_t)(struct ucred *cred, + struct prison *pr, struct label *prlabel, + struct vfsoptlist *opts, int flags); +typedef int (*mpo_prison_check_remove_t)(struct ucred *cred, + struct prison *pr, struct label *prlabel); +typedef void (*mpo_prison_created_t)(struct ucred *cred, + struct prison *pr, struct label *prlabel); +typedef void (*mpo_prison_attached_t)(struct ucred *cred, + struct prison *pr, struct label *prlabel, struct proc *p, + struct label *proclabel); + typedef int (*mpo_priv_check_t)(struct ucred *cred, int priv); typedef int (*mpo_priv_grant_t)(struct ucred *cred, int priv); @@ -863,6 +896,21 @@ mpo_posixshm_destroy_label_t mpo_posixshm_destroy_label; mpo_posixshm_init_label_t mpo_posixshm_init_label; + mpo_prison_init_label_t mpo_prison_init_label; + mpo_prison_check_relabel_t mpo_prison_check_relabel; + mpo_prison_destroy_label_t mpo_prison_destroy_label; + mpo_prison_copy_label_t mpo_prison_copy_label; + mpo_prison_externalize_label_t mpo_prison_externalize_label; + mpo_prison_internalize_label_t mpo_prison_internalize_label; + mpo_prison_relabel_t mpo_prison_relabel; + mpo_prison_check_attach_t mpo_prison_check_attach; + mpo_prison_check_create_t mpo_prison_check_create; + mpo_prison_check_get_t mpo_prison_check_get; + mpo_prison_check_set_t mpo_prison_check_set; + mpo_prison_check_remove_t mpo_prison_check_remove; + mpo_prison_created_t mpo_prison_created; + mpo_prison_attached_t mpo_prison_attached; + mpo_priv_check_t mpo_priv_check; mpo_priv_grant_t mpo_priv_grant; diff --git a/sys/security/mac/mac_prison.c b/sys/security/mac/mac_prison.c new file mode 100644 --- /dev/null +++ b/sys/security/mac/mac_prison.c @@ -0,0 +1,255 @@ +/*- + * Copyright (c) 2025 Kyle Evans + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include "opt_mac.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +void +mac_prison_label_free(struct label *label) +{ + if (label == NULL) + return; + + MAC_POLICY_PERFORM_NOSLEEP(prison_destroy_label, label); + mac_labelzone_free(label); +} + +struct label * +mac_prison_label_alloc(int flag) +{ + struct label *label; + int error; + + label = mac_labelzone_alloc(flag); + if (label == NULL) + return (NULL); + + if (flag & M_WAITOK) + MAC_POLICY_CHECK(prison_init_label, label, flag); + else + MAC_POLICY_CHECK_NOSLEEP(prison_init_label, label, flag); + if (error) { + mac_prison_label_free(label); + return (NULL); + } + return (label); +} + +/* + * The caller's expecting us to return with the prison locked if we were + * successful, since we're also setting pr->pr_label. On error, it remains + * unlocked. + */ +int +mac_prison_init(struct prison *pr, int flag) +{ + struct label *prlabel; + + mtx_assert(&pr->pr_mtx, MA_NOTOWNED); + if ((mac_labeled & MPC_OBJECT_PRISON) == 0) { + mtx_lock(&pr->pr_mtx); + pr->pr_label = NULL; + return (0); + } + + prlabel = mac_prison_label_alloc(flag); + if (prlabel == NULL) { + KASSERT((flag & M_WAITOK) == 0, + ("MAC policy prison_init_label failed under M_WAITOK")); + return (ENOMEM); + } + + mtx_lock(&pr->pr_mtx); + pr->pr_label = prlabel; + return (0); +} + +void +mac_prison_destroy(struct prison *pr) +{ + mtx_assert(&pr->pr_mtx, MA_OWNED); + mac_prison_label_free(pr->pr_label); + pr->pr_label = NULL; +} + +void +mac_prison_copy_label(struct label *src, struct label *dest) +{ + + MAC_POLICY_PERFORM_NOSLEEP(prison_copy_label, src, dest); +} + +int +mac_prison_externalize_label(struct label *label, char *elements, + char *outbuf, size_t outbuflen) +{ + int error; + + MAC_POLICY_EXTERNALIZE(prison, label, elements, outbuf, outbuflen); + return (error); +} + +int +mac_prison_internalize_label(struct label *label, char *string) +{ + int error; + + MAC_POLICY_INTERNALIZE(prison, label, string); + return (error); +} + +void +mac_prison_relabel(struct ucred *cred, struct prison *pr, + struct label *newlabel) +{ + mtx_assert(&pr->pr_mtx, MA_OWNED); + MAC_POLICY_PERFORM_NOSLEEP(prison_relabel, cred, pr, pr->pr_label, + newlabel); +} + +int +mac_prison_label_set(struct ucred *cred, struct prison *pr, + struct label *label) +{ + int error; + + mtx_assert(&pr->pr_mtx, MA_OWNED); + + error = mac_prison_check_relabel(cred, pr, label); + if (error) + return (error); + + mac_prison_relabel(cred, pr, label); + + return (0); +} + +MAC_CHECK_PROBE_DEFINE4(prison_check_relabel, "struct ucred *", + "struct prison *", "struct label *", "struct label *"); +int +mac_prison_check_relabel(struct ucred *cred, struct prison *pr, + struct label *newlabel) +{ + int error; + + mtx_assert(&pr->pr_mtx, MA_OWNED); + MAC_POLICY_CHECK_NOSLEEP(prison_check_relabel, cred, pr, + pr->pr_label, newlabel); + MAC_CHECK_PROBE4(prison_check_relabel, error, cred, pr, + pr->pr_label, newlabel); + + return (error); +} + +MAC_CHECK_PROBE_DEFINE3(prison_check_attach, "struct ucred *", + "struct prison *", "struct label *"); +int +mac_prison_check_attach(struct ucred *cred, struct prison *pr) +{ + int error; + + MAC_POLICY_CHECK_NOSLEEP(prison_check_attach, cred, pr, pr->pr_label); + MAC_CHECK_PROBE3(prison_check_attach, error, cred, pr, pr->pr_label); + + return (error); +} + +MAC_CHECK_PROBE_DEFINE3(prison_check_create, "struct ucred *", + "struct vfsoptlist *", "int"); +int +mac_prison_check_create(struct ucred *cred, struct vfsoptlist *opts, + int flags) +{ + int error; + + MAC_POLICY_CHECK_NOSLEEP(prison_check_create, cred, opts, flags); + MAC_CHECK_PROBE3(prison_check_create, error, cred, opts, flags); + + return (error); +} + +MAC_CHECK_PROBE_DEFINE5(prison_check_get, "struct ucred *", + "struct prison *", "struct label *", "struct vfsoptlist *", "int"); +int +mac_prison_check_get(struct ucred *cred, struct prison *pr, + struct vfsoptlist *opts, int flags) +{ + int error; + + MAC_POLICY_CHECK_NOSLEEP(prison_check_get, cred, pr, pr->pr_label, + opts, flags); + MAC_CHECK_PROBE5(prison_check_get, error, cred, pr, pr->pr_label, opts, + flags); + + return (error); +} + +MAC_CHECK_PROBE_DEFINE5(prison_check_set, "struct ucred *", + "struct prison *", "struct label *", "struct vfsoptlist *", "int"); +int +mac_prison_check_set(struct ucred *cred, struct prison *pr, + struct vfsoptlist *opts, int flags) +{ + int error; + + MAC_POLICY_CHECK_NOSLEEP(prison_check_set, cred, pr, pr->pr_label, + opts, flags); + MAC_CHECK_PROBE5(prison_check_set, error, cred, pr, pr->pr_label, opts, + flags); + + return (error); +} + +MAC_CHECK_PROBE_DEFINE3(prison_check_remove, "struct ucred *", + "struct prison *", "struct label *"); +int +mac_prison_check_remove(struct ucred *cred, struct prison *pr) +{ + int error; + + MAC_POLICY_CHECK_NOSLEEP(prison_check_remove, cred, pr, pr->pr_label); + MAC_CHECK_PROBE3(prison_check_remove, error, cred, pr, pr->pr_label); + + return (error); +} + +void +mac_prison_created(struct ucred *cred, struct prison *pr) +{ + + MAC_POLICY_PERFORM(prison_created, cred, pr, pr->pr_label); +} + +void +mac_prison_attached(struct ucred *cred, struct prison *pr, struct proc *p) +{ + + MAC_POLICY_PERFORM(prison_attached, cred, pr, pr->pr_label, p, + p->p_label); +} diff --git a/sys/security/mac/mac_syscalls.h b/sys/security/mac/mac_syscalls.h --- a/sys/security/mac/mac_syscalls.h +++ b/sys/security/mac/mac_syscalls.h @@ -30,4 +30,14 @@ void mac_set_proc_finish(struct thread *const td, bool proc_label_set, void *const mac_set_proc_data); +struct vfsoptlist; +int mac_get_prison(struct thread *const td, struct prison *pr, + struct vfsoptlist *opts); +int mac_set_prison_prepare(struct thread *const td, struct vfsoptlist *opts, + void **const mac_set_prison_data); +int mac_set_prison_core(struct thread *const td, struct prison *pr, + void *const mac_set_prison_data); +void mac_set_prison_finish(struct thread *const td, bool prison_label_set, + void *const mac_set_prison_data); + #endif /* !_SECURITY_MAC_MAC_SYSCALLS_H_ */ diff --git a/sys/security/mac/mac_syscalls.c b/sys/security/mac/mac_syscalls.c --- a/sys/security/mac/mac_syscalls.c +++ b/sys/security/mac/mac_syscalls.c @@ -49,6 +49,8 @@ #include #include #include +#include +#include #include #include #include @@ -88,6 +90,35 @@ }; #endif +static int +mac_label_copyin_string(struct mac *const mac, char **const u_string, + int flag) +{ + char *buffer; + int error; + + error = mac_check_structmac_consistent(mac); + if (error != 0) + return (error); + + /* 'm_buflen' not too big checked by function call above. */ + buffer = malloc(mac->m_buflen, M_MACTEMP, flag); + if (buffer == NULL) + return (ENOMEM); + + error = copyinstr(mac->m_string, buffer, mac->m_buflen, NULL); + if (error != 0) { + free(buffer, M_MACTEMP); + return (error); + } + + MPASS(error == 0); + if (u_string != NULL) + *u_string = mac->m_string; + mac->m_string = buffer; + return (0); +} + /* * Copyin a 'struct mac', including the string pointed to by 'm_string'. * @@ -99,7 +130,6 @@ mac_label_copyin(const void *const u_mac, struct mac *const mac, char **const u_string) { - char *buffer; int error; #ifdef COMPAT_FREEBSD32 @@ -120,23 +150,7 @@ return (error); } - error = mac_check_structmac_consistent(mac); - if (error != 0) - return (error); - - /* 'm_buflen' not too big checked by function call above. */ - buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); - error = copyinstr(mac->m_string, buffer, mac->m_buflen, NULL); - if (error != 0) { - free(buffer, M_MACTEMP); - return (error); - } - - MPASS(error == 0); - if (u_string != NULL) - *u_string = mac->m_string; - mac->m_string = buffer; - return (0); + return (mac_label_copyin_string(mac, u_string, M_WAITOK)); } void @@ -288,6 +302,160 @@ mac_cred_label_free(intlabel); } +int +mac_get_prison(struct thread *const td, struct prison *pr, + struct vfsoptlist *opts) +{ + char *buffer = NULL, *u_buffer; + struct label *intlabel = NULL; + struct mac mac; + int error; + bool locked = true; + + mtx_assert(&pr->pr_mtx, MA_OWNED); +#ifdef COMPAT_FREEBSD32 + if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) { + struct mac32 mac32; + + error = vfs_copyopt(opts, "mac.label", &mac32, sizeof(mac32)); + if (error == 0) { + CP(mac32, mac, m_buflen); + PTRIN_CP(mac32, mac, m_string); + } + } else +#endif + error = vfs_copyopt(opts, "mac.label", &mac, sizeof(mac)); + if (error) { + if (error != ENOENT) + vfs_opterror(opts, "bad mac.label"); + goto out_nomac; + } + + if (!(mac_labeled & MPC_OBJECT_PRISON)) { + error = EINVAL; + goto out; + } + + intlabel = mac_prison_label_alloc(M_NOWAIT); + if (intlabel == NULL) { + error = ENOMEM; + goto out; + } + + mac_prison_copy_label(pr->pr_label, intlabel); + + /* + * Externalization may want to acquire an rmlock. We already tapped out + * a copy of the label from when the jail_get(2) operation started and + * we're expected to be called near the end of jail_get(2) when the lock + * is about to be dropped anyways, so this is safe. + */ + mtx_unlock(&pr->pr_mtx); + locked = false; + + error = mac_label_copyin_string(&mac, &u_buffer, M_WAITOK); + if (error) { + vfs_opterror(opts, "mac.label: string copy failure"); + goto out; + } + + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); + if (buffer == NULL) { + error = ENOMEM; + goto out; + } + + error = mac_prison_externalize_label(intlabel, mac.m_string, + buffer, mac.m_buflen); + + if (error == 0) + error = copyout(buffer, u_buffer, strlen(buffer)+1); + +out: + mac_prison_label_free(intlabel); + free_copied_label(&mac); + free(buffer, M_MACTEMP); + +out_nomac: + if (locked) { + MPASS(error != 0); + mtx_unlock(&pr->pr_mtx); + } + + return (error); +} + +int +mac_set_prison_prepare(struct thread *const td, struct vfsoptlist *opts, + void **const mac_set_prison_data) +{ + struct mac mac; + struct label *intlabel; + int error; + +#ifdef COMPAT_FREEBSD32 + if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) { + struct mac32 mac32; + + error = vfs_copyopt(opts, "mac.label", &mac32, sizeof(mac32)); + if (error == 0) { + CP(mac32, mac, m_buflen); + PTRIN_CP(mac32, mac, m_string); + } + } else +#endif + error = vfs_copyopt(opts, "mac.label", &mac, sizeof(mac)); + if (error) { + if (error != ENOENT) + vfs_opterror(opts, "bad mac.label"); + return (error); + } + + error = mac_label_copyin_string(&mac, NULL, M_WAITOK); + if (error) { + vfs_opterror(opts, "mac.label: string copy failure"); + return (error); + } + + /* + * If the option wasn't set, then we return ENOENT above. If we don't + * have any policies applicable to prisons, we can return EINVAL early. + */ + if (!(mac_labeled & MPC_OBJECT_PRISON)) { + vfs_opterror(opts, "no labelled jail policies"); + return (EINVAL); + } + + intlabel = mac_prison_label_alloc(M_WAITOK); + error = mac_prison_internalize_label(intlabel, mac.m_string); + if (error) { + mac_prison_label_free(intlabel); + vfs_opterror(opts, "internalize_label error"); + return (error); + } + + *mac_set_prison_data = intlabel; + return (0); +} + +int +mac_set_prison_core(struct thread *const td, struct prison *pr, + void *const mac_set_prison_data) +{ + struct label *const intlabel = mac_set_prison_data; + + return (mac_prison_label_set(td->td_ucred, pr, intlabel)); +} + +void +mac_set_prison_finish(struct thread *const td, bool prison_label_set __unused, + void *const mac_set_prison_data) +{ + struct label *const intlabel = mac_set_prison_data; + + mac_prison_label_free(intlabel); +} + int sys___mac_set_proc(struct thread *td, struct __mac_set_proc_args *uap) { @@ -339,6 +507,7 @@ struct mac mac; struct vnode *vp; struct pipe *pipe; + struct prison *pr; struct socket *so; cap_rights_t rights; int error; @@ -400,6 +569,25 @@ mac_socket_label_free(intlabel); break; + case DTYPE_JAILDESC: + if (!(mac_labeled & MPC_OBJECT_PRISON)) { + error = EINVAL; + goto out_fdrop; + } + + error = jaildesc_get_prison(fp, &pr); + if (error != 0) + goto out_fdrop; + + intlabel = mac_prison_label_alloc(M_WAITOK); + mac_prison_copy_label(pr->pr_label, intlabel); + prison_free(pr); + + error = mac_prison_externalize_label(intlabel, mac.m_string, + buffer, mac.m_buflen); + mac_prison_label_free(intlabel); + break; + default: error = EINVAL; } @@ -473,6 +661,7 @@ { struct label *intlabel; struct pipe *pipe; + struct prison *pr; struct socket *so; struct file *fp; struct mount *mp; @@ -548,6 +737,27 @@ mac_socket_label_free(intlabel); break; + case DTYPE_JAILDESC: + if (!(mac_labeled & MPC_OBJECT_PRISON)) { + error = EINVAL; + goto out_fdrop; + } + + pr = NULL; + intlabel = mac_prison_label_alloc(M_WAITOK); + error = mac_prison_internalize_label(intlabel, mac.m_string); + if (error == 0) + error = jaildesc_get_prison(fp, &pr); + if (error == 0) { + prison_lock(pr); + error = mac_prison_label_set(td->td_ucred, pr, + intlabel); + prison_free_locked(pr); + } + + mac_prison_label_free(intlabel); + break; + default: error = EINVAL; } diff --git a/sys/security/mac_stub/mac_stub.c b/sys/security/mac_stub/mac_stub.c --- a/sys/security/mac_stub/mac_stub.c +++ b/sys/security/mac_stub/mac_stub.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -852,6 +853,74 @@ } +static void +stub_prison_relabel(struct ucred *cred, struct prison *pr, + struct label *prlabel, struct label *newlabel) +{ + +} + +static int +stub_prison_check_relabel(struct ucred *cred, struct prison *pr, + struct label *prlabel, struct label *newlabel) +{ + + return (0); +} + +static int +stub_prison_check_attach(struct ucred *cred, struct prison *pr, + struct label *prlabel) +{ + + return (0); +} + +static int +stub_prison_check_create(struct ucred *cred, struct vfsoptlist *opts, int flags) +{ + + return (0); +} + +static int +stub_prison_check_get(struct ucred *cred, struct prison *pr, + struct label *prlabel, struct vfsoptlist *opts, int flags) +{ + + return (0); +} + +static int +stub_prison_check_set(struct ucred *cred, struct prison *pr, + struct label *prlabel, struct vfsoptlist *opts, int flags) +{ + + return (0); +} + +static int +stub_prison_check_remove(struct ucred *cred, struct prison *pr, + struct label *prlabel) +{ + + return (0); +} + +static void +stub_prison_created(struct ucred *cred, struct prison *pr, + struct label *prlabel) +{ + +} + +static void +stub_prison_attached(struct ucred *cred, struct prison *pr, + struct label *prlabel, struct proc *p, struct label *proclabel) +{ + +} + static int stub_priv_check(struct ucred *cred, int priv) { @@ -1841,6 +1910,21 @@ .mpo_posixshm_destroy_label = stub_destroy_label, .mpo_posixshm_init_label = stub_init_label, + .mpo_prison_init_label = stub_init_label_waitcheck, + .mpo_prison_destroy_label = stub_destroy_label, + .mpo_prison_copy_label = stub_copy_label, + .mpo_prison_externalize_label = stub_externalize_label, + .mpo_prison_internalize_label = stub_internalize_label, + .mpo_prison_relabel = stub_prison_relabel, + .mpo_prison_check_relabel = stub_prison_check_relabel, + .mpo_prison_check_attach = stub_prison_check_attach, + .mpo_prison_check_create = stub_prison_check_create, + .mpo_prison_check_get = stub_prison_check_get, + .mpo_prison_check_set = stub_prison_check_set, + .mpo_prison_check_remove = stub_prison_check_remove, + .mpo_prison_created = stub_prison_created, + .mpo_prison_attached = stub_prison_attached, + .mpo_priv_check = stub_priv_check, .mpo_priv_grant = stub_priv_grant, diff --git a/sys/security/mac_test/mac_test.c b/sys/security/mac_test/mac_test.c --- a/sys/security/mac_test/mac_test.c +++ b/sys/security/mac_test/mac_test.c @@ -51,6 +51,7 @@ #include #include +#include #include #include #include @@ -99,6 +100,7 @@ #define MAGIC_PIPE 0xdc6c9919 #define MAGIC_POSIX_SEM 0x78ae980c #define MAGIC_POSIX_SHM 0x4e853fc9 +#define MAGIC_PRISON 0x9639acdb #define MAGIC_PROC 0x3b4be98f #define MAGIC_CRED 0x9a5a4987 #define MAGIC_VNODE 0x1a67a45c @@ -1591,6 +1593,161 @@ COUNTER_INC(posixshm_init_label); } +COUNTER_DECL(prison_init_label); +static int +test_prison_init_label(struct label *label, int flag) +{ + + if (flag & M_WAITOK) + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, + "test_prison_init_label() at %s:%d", __FILE__, + __LINE__); + + LABEL_INIT(label, MAGIC_PRISON); + COUNTER_INC(prison_init_label); + return (0); +} + +COUNTER_DECL(prison_destroy_label); +static void +test_prison_destroy_label(struct label *label) +{ + + LABEL_DESTROY(label, MAGIC_PRISON); + COUNTER_INC(prison_destroy_label); +} + +COUNTER_DECL(prison_copy_label); +static void +test_prison_copy_label(struct label *src, struct label *dest) +{ + + LABEL_CHECK(src, MAGIC_PRISON); + LABEL_CHECK(dest, MAGIC_PRISON); + COUNTER_INC(prison_copy_label); +} + +COUNTER_DECL(prison_externalize_label); +static int +test_prison_externalize_label(struct label *label, char *element_name, + struct sbuf *sb, int *claimed) +{ + + LABEL_CHECK(label, MAGIC_PRISON); + COUNTER_INC(prison_externalize_label); + + return (0); +} + +COUNTER_DECL(prison_internalize_label); +static int +test_prison_internalize_label(struct label *label, char *element_name, + char *element_data, int *claimed) +{ + + LABEL_CHECK(label, MAGIC_PRISON); + COUNTER_INC(prison_internalize_label); + + return (0); +} + +COUNTER_DECL(prison_relabel); +static void +test_prison_relabel(struct ucred *cred, struct prison *pr, + struct label *prlabel, struct label *newlabel) +{ + + LABEL_CHECK(prlabel, MAGIC_PRISON); + LABEL_CHECK(newlabel, MAGIC_PRISON); + COUNTER_INC(prison_relabel); +} + +COUNTER_DECL(prison_check_relabel); +static int +test_prison_check_relabel(struct ucred *cred, struct prison *pr, + struct label *prlabel, struct label *newlabel) +{ + + LABEL_CHECK(prlabel, MAGIC_PRISON); + LABEL_CHECK(newlabel, MAGIC_PRISON); + COUNTER_INC(prison_check_relabel); + return (0); +} + +COUNTER_DECL(prison_check_attach); +static int +test_prison_check_attach(struct ucred *cred, struct prison *pr, + struct label *prlabel) +{ + + LABEL_CHECK(prlabel, MAGIC_PRISON); + COUNTER_INC(prison_check_attach); + return (0); +} + +COUNTER_DECL(prison_check_create); +static int +test_prison_check_create(struct ucred *cred, struct vfsoptlist *opts, int flags) +{ + + COUNTER_INC(prison_check_create); + return (0); +} + +COUNTER_DECL(prison_check_get); +static int +test_prison_check_get(struct ucred *cred, struct prison *pr, + struct label *prlabel, struct vfsoptlist *opts, int flags) +{ + + LABEL_CHECK(prlabel, MAGIC_PRISON); + COUNTER_INC(prison_check_get); + return (0); +} + +COUNTER_DECL(prison_check_set); +static int +test_prison_check_set(struct ucred *cred, struct prison *pr, + struct label *prlabel, struct vfsoptlist *opts, int flags) +{ + + LABEL_CHECK(prlabel, MAGIC_PRISON); + COUNTER_INC(prison_check_set); + return (0); +} + +COUNTER_DECL(prison_check_remove); +static int +test_prison_check_remove(struct ucred *cred, struct prison *pr, + struct label *prlabel) +{ + + LABEL_CHECK(prlabel, MAGIC_PRISON); + COUNTER_INC(prison_check_remove); + return (0); +} + +COUNTER_DECL(prison_created); +static void +test_prison_created(struct ucred *cred, struct prison *pr, + struct label *prlabel) +{ + + LABEL_CHECK(prlabel, MAGIC_PRISON); + COUNTER_INC(prison_created); +} + +COUNTER_DECL(prison_attached); +static void +test_prison_attached(struct ucred *cred, struct prison *pr, + struct label *prlabel, struct proc *p, struct label *proclabel) +{ + + LABEL_CHECK(prlabel, MAGIC_PRISON); + LABEL_CHECK(proclabel, MAGIC_PROC); + COUNTER_INC(prison_attached); +} + COUNTER_DECL(proc_check_debug); static int test_proc_check_debug(struct ucred *cred, struct proc *p) @@ -3208,6 +3365,21 @@ .mpo_posixshm_destroy_label = test_posixshm_destroy_label, .mpo_posixshm_init_label = test_posixshm_init_label, + .mpo_prison_init_label = test_prison_init_label, + .mpo_prison_destroy_label = test_prison_destroy_label, + .mpo_prison_copy_label = test_prison_copy_label, + .mpo_prison_externalize_label = test_prison_externalize_label, + .mpo_prison_internalize_label = test_prison_internalize_label, + .mpo_prison_relabel = test_prison_relabel, + .mpo_prison_check_relabel = test_prison_check_relabel, + .mpo_prison_check_attach = test_prison_check_attach, + .mpo_prison_check_create = test_prison_check_create, + .mpo_prison_check_get = test_prison_check_get, + .mpo_prison_check_set = test_prison_check_set, + .mpo_prison_check_remove = test_prison_check_remove, + .mpo_prison_created = test_prison_created, + .mpo_prison_attached = test_prison_attached, + .mpo_proc_check_debug = test_proc_check_debug, .mpo_proc_check_sched = test_proc_check_sched, .mpo_proc_check_signal = test_proc_check_signal, diff --git a/sys/sys/jail.h b/sys/sys/jail.h --- a/sys/sys/jail.h +++ b/sys/sys/jail.h @@ -198,6 +198,7 @@ struct prison_ip *pr_addrs[PR_FAMILY_MAX]; /* (p,n) IPs of jail */ struct prison_racct *pr_prison_racct; /* (c) racct jail proxy */ struct knlist *pr_klist; /* (m) attached knotes */ + struct label *pr_label; /* (m) MAC label */ LIST_HEAD(, jaildesc) pr_descs; /* (a) attached descriptors */ void *pr_sparep; int pr_childcount; /* (a) number of child jails */ diff --git a/sys/sys/jaildesc.h b/sys/sys/jaildesc.h --- a/sys/sys/jaildesc.h +++ b/sys/sys/jaildesc.h @@ -78,6 +78,7 @@ int jaildesc_find(struct thread *td, int fd, struct prison **prp, struct ucred **ucredp); int jaildesc_alloc(struct thread *td, struct file **fpp, int *fdp, int owning); +int jaildesc_get_prison(struct file *jd, struct prison **prp); void jaildesc_set_prison(struct file *jd, struct prison *pr); void jaildesc_prison_cleanup(struct prison *pr); void jaildesc_knote(struct prison *pr, long hint); diff --git a/sys/sys/param.h b/sys/sys/param.h --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -74,7 +74,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1600007 +#define __FreeBSD_version 1600009 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/sys/sys/sdt.h b/sys/sys/sdt.h --- a/sys/sys/sdt.h +++ b/sys/sys/sdt.h @@ -447,7 +447,7 @@ const char *mod; const char *func; const char *name; - id_t id; /* DTrace probe ID. */ + uint32_t id; /* DTrace probe ID. */ int n_args; /* Number of arguments. */ struct linker_file *sdtp_lf; /* Module in which we're defined. */ }; diff --git a/sys/sys/smp.h b/sys/sys/smp.h --- a/sys/sys/smp.h +++ b/sys/sys/smp.h @@ -16,6 +16,7 @@ #ifndef LOCORE +#include #include #include @@ -278,7 +279,12 @@ void (*)(void *), void *arg); void smp_rendezvous_cpus(cpuset_t, - void (*)(void *), + void (*)(void *), + void (*)(void *), + void (*)(void *), + void *arg); +void smp_rendezvous_cpu(u_int, + void (*)(void *), void (*)(void *), void (*)(void *), void *arg); diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -239,7 +239,8 @@ #ifdef INVARIANTS prev = atomic_fetchadd_long(&uip->ui_vmsize, -pdecr); KASSERT(prev >= pdecr, - ("negative vmsize for uid %d\n", uip->ui_uid)); + ("negative vmsize for uid %d, prev %#jx decr %#jx\n", + uip->ui_uid, (uintmax_t)prev, (uintmax_t)pdecr)); #else atomic_subtract_long(&uip->ui_vmsize, pdecr); #endif @@ -329,7 +330,7 @@ } void -swap_reserve_force(vm_ooffset_t incr) +swap_reserve_force_by_cred(vm_ooffset_t incr, struct ucred *cred) { u_long pincr; @@ -345,7 +346,13 @@ #endif pincr = atop(incr); atomic_add_long(&swap_reserved, pincr); - swap_reserve_force_rlimit(pincr, curthread->td_ucred); + swap_reserve_force_rlimit(pincr, cred); +} + +void +swap_reserve_force(vm_ooffset_t incr) +{ + swap_reserve_force_by_cred(incr, curthread->td_ucred); } void @@ -373,7 +380,8 @@ pdecr = atop(decr); #ifdef INVARIANTS prev = atomic_fetchadd_long(&swap_reserved, -pdecr); - KASSERT(prev >= pdecr, ("swap_reserved < decr")); + KASSERT(prev >= pdecr, ("swap_reserved %#jx < decr %#jx", + (uintmax_t)prev, (uintmax_t)pdecr)); #else atomic_subtract_long(&swap_reserved, pdecr); #endif @@ -776,10 +784,7 @@ object->un_pager.swp.writemappings = 0; object->handle = handle; - if (cred != NULL) { - object->cred = cred; - object->charge = size; - } + object->cred = cred; return (true); } @@ -892,8 +897,7 @@ * Release the allocation charge. */ if (object->cred != NULL) { - swap_release_by_cred(object->charge, object->cred); - object->charge = 0; + swap_release_by_cred(ptoa(object->size), object->cred); crfree(object->cred); object->cred = NULL; } @@ -1358,14 +1362,22 @@ swap_pager_getpages_locked(struct pctrie_iter *blks, vm_object_t object, vm_page_t *ma, int count, int *a_rbehind, int *a_rahead, struct buf *bp) { + vm_page_t m; vm_pindex_t pindex; - int rahead, rbehind; + int i, rahead, rbehind; VM_OBJECT_ASSERT_WLOCKED(object); KASSERT((object->flags & OBJ_SWAP) != 0, ("%s: object not swappable", __func__)); - pindex = ma[0]->pindex; + for (pindex = 0, i = 0; i < count; i++) { + m = ma[i]; + if (m != bogus_page) { + pindex = m->pindex - i; + break; + } + } + MPASS(i != count); if (!swp_pager_haspage_iter(pindex, &rbehind, &rahead, blks)) { VM_OBJECT_WUNLOCK(object); uma_zfree(swrbuf_zone, bp); @@ -1392,8 +1404,14 @@ vm_object_prepare_buf_pages(object, bp->b_pages, count, &rbehind, &rahead, ma); bp->b_npages = rbehind + count + rahead; - for (int i = 0; i < bp->b_npages; i++) - bp->b_pages[i]->oflags |= VPO_SWAPINPROG; + KASSERT(bp->b_npages <= PBUF_PAGES, + ("bp_npages %d (rb %d c %d ra %d) not less than PBUF_PAGES %jd", + bp->b_npages, rbehind, count, rahead, (uintmax_t)PBUF_PAGES)); + for (i = 0; i < bp->b_npages; i++) { + m = bp->b_pages[i]; + if (m != bogus_page) + m->oflags |= VPO_SWAPINPROG; + } bp->b_blkno = swp_pager_meta_lookup(blks, pindex - rbehind); KASSERT(bp->b_blkno != SWAPBLK_NONE, ("no swap blocking containing %p(%jx)", object, (uintmax_t)pindex)); @@ -1441,8 +1459,14 @@ */ VM_OBJECT_WLOCK(object); /* This could be implemented more efficiently with aflags */ - while ((ma[0]->oflags & VPO_SWAPINPROG) != 0) { - ma[0]->oflags |= VPO_SWAPSLEEP; + for (i = 0; i < count; i++) { + m = ma[i]; + if (m != bogus_page) + break; + } + MPASS(i != count); + while ((m->oflags & VPO_SWAPINPROG) != 0) { + m->oflags |= VPO_SWAPSLEEP; VM_CNT_INC(v_intrans); if (VM_OBJECT_SLEEP(object, &object->handle, PSWP, "swread", hz * 20)) { @@ -1456,9 +1480,10 @@ /* * If we had an unrecoverable read error pages will not be valid. */ - for (int i = 0; i < count; i++) - if (ma[i]->valid != VM_PAGE_BITS_ALL) + for (i = 0; i < count; i++) { + if (ma[i] != bogus_page && ma[i]->valid != VM_PAGE_BITS_ALL) return (VM_PAGER_ERROR); + } return (VM_PAGER_OK); @@ -1723,6 +1748,9 @@ for (i = 0; i < bp->b_npages; ++i) { vm_page_t m = bp->b_pages[i]; + if (m == bogus_page) + continue; + m->oflags &= ~VPO_SWAPINPROG; if (m->oflags & VPO_SWAPSLEEP) { m->oflags &= ~VPO_SWAPSLEEP; diff --git a/sys/vm/vm.h b/sys/vm/vm.h --- a/sys/vm/vm.h +++ b/sys/vm/vm.h @@ -168,6 +168,7 @@ bool swap_reserve(vm_ooffset_t incr); bool swap_reserve_by_cred(vm_ooffset_t incr, struct ucred *cred); void swap_reserve_force(vm_ooffset_t incr); +void swap_reserve_force_by_cred(vm_ooffset_t incr, struct ucred *cred); void swap_release(vm_ooffset_t decr); void swap_release_by_cred(vm_ooffset_t decr, struct ucred *cred); diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -2310,13 +2310,12 @@ * directly. */ dst_object = vm_object_allocate_anon(atop(dst_entry->end - - dst_entry->start), NULL, NULL, 0); + dst_entry->start), NULL, NULL); #if VM_NRESERVLEVEL > 0 dst_object->flags |= OBJ_COLORED; dst_object->pg_color = atop(dst_entry->start); #endif dst_object->domain = src_object->domain; - dst_object->charge = dst_entry->end - dst_entry->start; dst_entry->object.vm_object = dst_object; dst_entry->offset = 0; @@ -2329,7 +2328,7 @@ ("vm_fault_copy_entry: leaked swp charge")); dst_object->cred = curthread->td_ucred; crhold(dst_object->cred); - *fork_charge += dst_object->charge; + *fork_charge += ptoa(dst_object->size); } else if ((dst_object->flags & OBJ_SWAP) != 0 && dst_object->cred == NULL) { KASSERT(dst_entry->cred != NULL, ("no cred for entry %p", diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -2428,7 +2428,7 @@ KASSERT((entry->eflags & MAP_ENTRY_IS_SUB_MAP) == 0, ("map entry %p is a submap", entry)); object = vm_object_allocate_anon(atop(entry->end - entry->start), NULL, - entry->cred, entry->end - entry->start); + entry->cred); entry->object.vm_object = object; entry->offset = 0; entry->cred = NULL; @@ -2443,21 +2443,26 @@ static inline void vm_map_entry_charge_object(vm_map_t map, vm_map_entry_t entry) { + vm_object_t object; VM_MAP_ASSERT_LOCKED(map); KASSERT((entry->eflags & MAP_ENTRY_IS_SUB_MAP) == 0, ("map entry %p is a submap", entry)); - if (entry->object.vm_object == NULL && !vm_map_is_system(map) && + object = entry->object.vm_object; + if (object == NULL && !vm_map_is_system(map) && (entry->eflags & MAP_ENTRY_GUARD) == 0) vm_map_entry_back(entry); - else if (entry->object.vm_object != NULL && + else if (object != NULL && ((entry->eflags & MAP_ENTRY_NEEDS_COPY) == 0) && entry->cred != NULL) { - VM_OBJECT_WLOCK(entry->object.vm_object); - KASSERT(entry->object.vm_object->cred == NULL, + VM_OBJECT_WLOCK(object); + KASSERT(object->cred == NULL, ("OVERCOMMIT: %s: both cred e %p", __func__, entry)); - entry->object.vm_object->cred = entry->cred; - entry->object.vm_object->charge = entry->end - entry->start; + object->cred = entry->cred; + if (entry->end - entry->start < ptoa(object->size)) { + swap_reserve_force_by_cred(ptoa(object->size) - + entry->end + entry->start, object->cred); + } VM_OBJECT_WUNLOCK(entry->object.vm_object); entry->cred = NULL; } @@ -2956,7 +2961,7 @@ * we cannot distinguish between non-charged and * charged clipped mapping of the same object later. */ - KASSERT(obj->charge == 0, + KASSERT(obj->cred == NULL, ("vm_map_protect: object %p overcharged (entry %p)", obj, entry)); if (!swap_reserve(ptoa(obj->size))) { @@ -2968,7 +2973,6 @@ crhold(cred); obj->cred = cred; - obj->charge = ptoa(obj->size); VM_OBJECT_WUNLOCK(obj); } @@ -3942,7 +3946,7 @@ vm_map_entry_delete(vm_map_t map, vm_map_entry_t entry) { vm_object_t object; - vm_pindex_t offidxstart, offidxend, size1; + vm_pindex_t offidxstart, offidxend, oldsize; vm_size_t size; vm_map_entry_unlink(map, entry, UNLINK_MERGE_NONE); @@ -3989,15 +3993,11 @@ OBJPR_NOTMAPPED); if (offidxend >= object->size && offidxstart < object->size) { - size1 = object->size; + oldsize = object->size; object->size = offidxstart; if (object->cred != NULL) { - size1 -= object->size; - KASSERT(object->charge >= ptoa(size1), - ("object %p charge < 0", object)); - swap_release_by_cred(ptoa(size1), - object->cred); - object->charge -= ptoa(size1); + swap_release_by_cred(ptoa(oldsize - + object->size), object->cred); } } } @@ -4198,7 +4198,7 @@ ("OVERCOMMIT: vm_map_copy_anon_entry: cred %p", src_object)); src_object->cred = src_entry->cred; - src_object->charge = size; + *fork_charge += ptoa(src_object->size) - size; } dst_entry->object.vm_object = src_object; if (charged) { @@ -4455,7 +4455,7 @@ KASSERT(object->cred == NULL, ("vmspace_fork both cred")); object->cred = old_entry->cred; - object->charge = old_entry->end - + *fork_charge += old_entry->end - old_entry->start; old_entry->cred = NULL; } @@ -4957,6 +4957,13 @@ if (newvmspace == NULL) return (ENOMEM); if (!swap_reserve_by_cred(fork_charge, p->p_ucred)) { + /* + * The swap reservation failed. The accounting from + * the entries of the copied newvmspace will be + * subtracted in vmspace_free(), so force the + * reservation there. + */ + swap_reserve_force_by_cred(fork_charge, p->p_ucred); vmspace_free(newvmspace); return (ENOMEM); } @@ -5138,7 +5145,7 @@ if (vm_map_lock_upgrade(map)) goto RetryLookup; entry->object.vm_object = vm_object_allocate_anon(atop(size), - NULL, entry->cred, size); + NULL, entry->cred); entry->offset = 0; entry->cred = NULL; vm_map_lock_downgrade(map); @@ -5396,9 +5403,8 @@ (void *)entry->object.vm_object, (uintmax_t)entry->offset); if (entry->object.vm_object && entry->object.vm_object->cred) - db_printf(", obj ruid %d charge %jx", - entry->object.vm_object->cred->cr_ruid, - (uintmax_t)entry->object.vm_object->charge); + db_printf(", obj ruid %d ", + entry->object.vm_object->cred->cr_ruid); if (entry->eflags & MAP_ENTRY_COW) db_printf(", copy (%s)", (entry->eflags & MAP_ENTRY_NEEDS_COPY) ? "needed" : "done"); diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -175,7 +175,6 @@ } phys; } un_pager; struct ucred *cred; - vm_ooffset_t charge; void *umtx_data; }; @@ -356,8 +355,7 @@ extern int umtx_shm_vnobj_persistent; vm_object_t vm_object_allocate (objtype_t, vm_pindex_t); -vm_object_t vm_object_allocate_anon(vm_pindex_t, vm_object_t, struct ucred *, - vm_size_t); +vm_object_t vm_object_allocate_anon(vm_pindex_t, vm_object_t, struct ucred *); vm_object_t vm_object_allocate_dyn(objtype_t, vm_pindex_t, u_short); boolean_t vm_object_coalesce(vm_object_t, vm_ooffset_t, vm_size_t, vm_size_t, int); diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -196,9 +196,9 @@ KASSERT(object->type == OBJT_DEAD, ("object %p has non-dead type %d", object, object->type)); - KASSERT(object->charge == 0 && object->cred == NULL, - ("object %p has non-zero charge %ju (%p)", - object, (uintmax_t)object->charge, object->cred)); + KASSERT(object->cred == NULL, + ("object %p has non-zero charge cred %p", + object, object->cred)); } #endif @@ -254,7 +254,6 @@ refcount_init(&object->ref_count, 1); object->memattr = VM_MEMATTR_DEFAULT; object->cred = NULL; - object->charge = 0; object->handle = handle; object->backing_object = NULL; object->backing_object_offset = (vm_ooffset_t) 0; @@ -452,7 +451,7 @@ */ vm_object_t vm_object_allocate_anon(vm_pindex_t size, vm_object_t backing_object, - struct ucred *cred, vm_size_t charge) + struct ucred *cred) { vm_object_t handle, object; @@ -466,7 +465,6 @@ _vm_object_allocate(OBJT_SWAP, size, OBJ_ANON | OBJ_ONEMAPPING | OBJ_SWAP, object, handle); object->cred = cred; - object->charge = cred != NULL ? charge : 0; return (object); } @@ -1448,7 +1446,7 @@ /* * Allocate a new object with the given length. */ - result = vm_object_allocate_anon(atop(length), source, cred, length); + result = vm_object_allocate_anon(atop(length), source, cred); /* * Store the offset into the source object, and fix up the offset into @@ -1511,6 +1509,7 @@ struct pctrie_iter pages; vm_page_t m; vm_object_t orig_object, new_object, backing_object; + struct ucred *cred; vm_pindex_t offidxstart; vm_size_t size; @@ -1525,9 +1524,26 @@ offidxstart = OFF_TO_IDX(entry->offset); size = atop(entry->end - entry->start); + if (orig_object->cred != NULL) { + /* + * vm_object_split() is currently called from + * vmspace_fork(), and it might be tempting to add the + * charge for the split object to fork_charge. But + * fork_charge is discharged on error when the copied + * vmspace is destroyed. Since the split object is + * inserted into the shadow hierarchy serving the + * source vm_map, it is kept even after the + * unsuccessful fork, meaning that we have to force + * its swap usage. + */ + cred = curthread->td_ucred; + crhold(cred); + swap_reserve_force_by_cred(ptoa(size), cred); + } else { + cred = NULL; + } - new_object = vm_object_allocate_anon(size, orig_object, - orig_object->cred, ptoa(size)); + new_object = vm_object_allocate_anon(size, orig_object, cred); /* * We must wait for the orig_object to complete any in-progress @@ -1550,12 +1566,6 @@ new_object->backing_object_offset = orig_object->backing_object_offset + entry->offset; } - if (orig_object->cred != NULL) { - crhold(orig_object->cred); - KASSERT(orig_object->charge >= ptoa(size), - ("orig_object->charge < 0")); - orig_object->charge -= ptoa(size); - } /* * Mark the split operation so that swap_pager_getpages() knows @@ -2233,7 +2243,6 @@ swap_release_by_cred(ptoa(prev_object->size - next_pindex), prev_object->cred); } - prev_object->charge += charge; } else if ((cflags & OBJCO_CHARGED) != 0) { /* * The caller charged, but the object has @@ -2786,9 +2795,8 @@ db_iprintf("Object %p: type=%d, size=0x%jx, res=%d, ref=%d, flags=0x%x", object, (int)object->type, (uintmax_t)object->size, object->resident_page_count, object->ref_count, object->flags); - db_iprintf(" ruid %d charge %jx\n", - object->cred ? object->cred->cr_ruid : -1, - (uintmax_t)object->charge); + db_iprintf(" ruid %d\n", + object->cred ? object->cred->cr_ruid : -1); db_iprintf(" sref=%d, backing_object(%d)=(%p)+0x%jx\n", atomic_load_int(&object->shadow_count), object->backing_object ? object->backing_object->ref_count : 0, diff --git a/sys/x86/conf/NOTES b/sys/x86/conf/NOTES --- a/sys/x86/conf/NOTES +++ b/sys/x86/conf/NOTES @@ -329,7 +329,6 @@ # vt(4) drivers. device vt_vga # VGA device vt_vbefb # VBE framebuffer -device vt_efifb # EFI framebuffer # Linear framebuffer driver for S3 VESA 1.2 cards. Works on top of VESA. device s3pci diff --git a/sys/x86/cpufreq/hwpstate_amd.c b/sys/x86/cpufreq/hwpstate_amd.c --- a/sys/x86/cpufreq/hwpstate_amd.c +++ b/sys/x86/cpufreq/hwpstate_amd.c @@ -198,6 +198,26 @@ {0, 0} }; +struct amdhwp_dump_sysctl_handler_request { + uint64_t enable; + uint64_t caps; + uint64_t req; + int res; +}; + +static void +amdhwp_dump_sysctl_handler_cb(void *args) +{ + struct amdhwp_dump_sysctl_handler_request *req = + (struct amdhwp_dump_sysctl_handler_request *)args; + + req->res = rdmsr_safe(MSR_AMD_CPPC_ENABLE, &req->enable); + if (req->res == 0) + req->res = rdmsr_safe(MSR_AMD_CPPC_CAPS_1, &req->caps); + if (req->res == 0) + req->res = rdmsr_safe(MSR_AMD_CPPC_REQUEST, &req->req); +} + static int amdhwp_dump_sysctl_handler(SYSCTL_HANDLER_ARGS) { @@ -205,6 +225,7 @@ struct pcpu *pc; struct sbuf *sb; struct hwpstate_softc *sc; + struct amdhwp_dump_sysctl_handler_request request; uint64_t data; int ret; @@ -217,20 +238,19 @@ sb = sbuf_new(NULL, NULL, 1024, SBUF_FIXEDLEN | SBUF_INCLUDENUL); sbuf_putc(sb, '\n'); - thread_lock(curthread); - sched_bind(curthread, pc->pc_cpuid); - thread_unlock(curthread); + smp_rendezvous_cpu(pc->pc_cpuid, smp_no_rendezvous_barrier, + amdhwp_dump_sysctl_handler_cb, smp_no_rendezvous_barrier, &request); + ret = request.res; + if (ret) + goto out; - rdmsr_safe(MSR_AMD_CPPC_ENABLE, &data); + data = request.enable; sbuf_printf(sb, "CPU%d: HWP %sabled\n", pc->pc_cpuid, ((data & 1) ? "En" : "Dis")); - - if (data == 0) { - ret = 0; + if (data == 0) goto out; - } - rdmsr_safe(MSR_AMD_CPPC_CAPS_1, &data); + data = request.caps; sbuf_printf(sb, "\tHighest Performance: %03ju\n", BITS_VALUE(AMD_CPPC_CAPS_1_HIGH_PERF_BITS, data)); sbuf_printf(sb, "\tGuaranteed Performance: %03ju\n", @@ -241,8 +261,7 @@ BITS_VALUE(AMD_CPPC_CAPS_1_LOW_PERF_BITS, data)); sbuf_putc(sb, '\n'); - rdmsr_safe(MSR_AMD_CPPC_REQUEST, &data); - + data = request.req; #define pkg_print(name, offset) \ do { \ sbuf_printf(sb, "\t%s: %03u\n", name, \ @@ -258,11 +277,8 @@ sbuf_putc(sb, '\n'); out: - thread_lock(curthread); - sched_unbind(curthread); - thread_unlock(curthread); - - ret = sbuf_finish(sb); + if (ret == 0) + ret = sbuf_finish(sb); if (ret == 0) ret = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb)); sbuf_delete(sb); @@ -270,44 +286,29 @@ return (ret); } -static bool -sysctl_epp_select_per_core(const device_t hwp_device, uint32_t val) +static void +sysctl_epp_select_per_core(device_t hwp_device, uint32_t val) { struct hwpstate_softc *sc; - bool success = true; - int ret, cpuid; - cpuid = cpu_get_pcpu(hwp_device)->pc_cpuid; - thread_lock(curthread); - sched_bind(curthread, cpuid); - thread_unlock(curthread); sc = device_get_softc(hwp_device); if (BITS_VALUE(AMD_CPPC_REQUEST_ENERGY_PERF_BITS, sc->req) == val) - goto end; + return; SET_BITS_VALUE(sc->req, AMD_CPPC_REQUEST_ENERGY_PERF_BITS, val); - ret = wrmsr_safe(MSR_AMD_CPPC_REQUEST, sc->req); - if (ret != 0) { - success = false; - device_printf(hwp_device, "Failed to set EPP to %u", val); - goto end; - } - -end: - thread_lock(curthread); - sched_unbind(curthread); - thread_unlock(curthread); - - return (success); + x86_msr_op(MSR_AMD_CPPC_REQUEST, + MSR_OP_RENDEZVOUS_ONE | MSR_OP_WRITE | + MSR_OP_CPUID(cpu_get_pcpu(hwp_device)->pc_cpuid), + sc->req, NULL); } static int sysctl_epp_select(SYSCTL_HANDLER_ARGS) { device_t dev, hwp_dev; + devclass_t dc; struct hwpstate_softc *sc; const uint32_t max_energy_perf = BITS_VALUE(AMD_CPPC_REQUEST_ENERGY_PERF_BITS, (uint64_t)-1); - devclass_t dc; uint32_t val; int ret = 0; int cpu; @@ -577,44 +578,45 @@ device_printf(parent, "hwpstate: add child failed\n"); } -static int -amd_set_autonomous_hwp(struct hwpstate_softc *sc) +struct amd_set_autonomous_hwp_request { + device_t dev; + int res; +}; + +static void +amd_set_autonomous_hwp_cb(void *args) { - struct pcpu *pc; + struct hwpstate_softc *sc; + struct amd_set_autonomous_hwp_request *req = + (struct amd_set_autonomous_hwp_request *)args; device_t dev; uint64_t caps; int ret; - dev = sc->dev; - pc = cpu_get_pcpu(dev); - if (pc == NULL) - return (ENXIO); - - thread_lock(curthread); - sched_bind(curthread, pc->pc_cpuid); - thread_unlock(curthread); - + dev = req->dev; + sc = device_get_softc(dev); ret = wrmsr_safe(MSR_AMD_CPPC_ENABLE, 1); if (ret != 0) { device_printf(dev, "Failed to enable cppc for cpu%d (%d)\n", - pc->pc_cpuid, ret); - goto out; + curcpu, ret); + req->res = ret; } ret = rdmsr_safe(MSR_AMD_CPPC_REQUEST, &sc->req); if (ret != 0) { device_printf(dev, - "Failed to read CPPC request MSR for cpu%d (%d)\n", - pc->pc_cpuid, ret); - goto out; + "Failed to read CPPC request MSR for cpu%d (%d)\n", curcpu, + ret); + req->res = ret; } ret = rdmsr_safe(MSR_AMD_CPPC_CAPS_1, &caps); if (ret != 0) { device_printf(dev, "Failed to read HWP capabilities MSR for cpu%d (%d)\n", - pc->pc_cpuid, ret); - goto out; + curcpu, ret); + req->res = ret; + return; } /* @@ -632,17 +634,27 @@ ret = wrmsr_safe(MSR_AMD_CPPC_REQUEST, sc->req); if (ret) { - device_printf(dev, - "Failed to setup autonomous HWP for cpu%d\n", - pc->pc_cpuid); - goto out; + device_printf(dev, "Failed to setup autonomous HWP for cpu%d\n", + curcpu); + req->res = ret; + return; } -out: - thread_lock(curthread); - sched_unbind(curthread); - thread_unlock(curthread); + req->res = 0; +} - return (ret); +static int +amd_set_autonomous_hwp(struct hwpstate_softc *sc) +{ + struct amd_set_autonomous_hwp_request req; + device_t dev; + + dev = sc->dev; + req.dev = dev; + smp_rendezvous_cpu(cpu_get_pcpu(dev)->pc_cpuid, + smp_no_rendezvous_barrier, amd_set_autonomous_hwp_cb, + smp_no_rendezvous_barrier, &req); + + return (req.res); } static int diff --git a/sys/x86/include/intr_machdep.h b/sys/x86/include/intr_machdep.h --- a/sys/x86/include/intr_machdep.h +++ b/sys/x86/include/intr_machdep.h @@ -151,6 +151,7 @@ int intr_remove_handler(void *cookie); void intr_resume(bool suspend_cancelled); void intr_suspend(void); +void intr_enable_src(u_int irq); void intr_reprogram(void); void intrcnt_add(const char *name, u_long **countp); void nexus_add_irq(u_long irq); diff --git a/sys/x86/x86/intr_machdep.c b/sys/x86/x86/intr_machdep.c --- a/sys/x86/x86/intr_machdep.c +++ b/sys/x86/x86/intr_machdep.c @@ -405,6 +405,15 @@ mtx_unlock(&intrpic_lock); } +void +intr_enable_src(u_int irq) +{ + struct intsrc *is; + + is = interrupt_sources[irq]; + is->is_pic->pic_enable_source(is); +} + static int intr_assign_cpu(void *arg, int cpu) { diff --git a/tests/sys/fs/tarfs/tarfs_test.sh b/tests/sys/fs/tarfs/tarfs_test.sh --- a/tests/sys/fs/tarfs/tarfs_test.sh +++ b/tests/sys/fs/tarfs/tarfs_test.sh @@ -401,7 +401,7 @@ atf_set "descr" "Test support for large files" atf_set "require.user" "root" atf_set "require.kmods" "tarfs" - atf_set "timeout" "900" + atf_set "timeout" "2400" } tarfs_large_body() { tarfs_setup diff --git a/tests/sys/net/bpf/Makefile b/tests/sys/net/bpf/Makefile --- a/tests/sys/net/bpf/Makefile +++ b/tests/sys/net/bpf/Makefile @@ -14,4 +14,7 @@ ATF_TESTS_SH= bpf +TEST_METADATA.bpf+= execenv="jail" \ + execenv_jail_params="vnet allow.raw_sockets" + .include diff --git a/tests/sys/net/if_ovpn/if_ovpn.sh b/tests/sys/net/if_ovpn/if_ovpn.sh --- a/tests/sys/net/if_ovpn/if_ovpn.sh +++ b/tests/sys/net/if_ovpn/if_ovpn.sh @@ -99,6 +99,31 @@ # Test routing loop protection jexec b route add 192.0.2.1 198.51.100.1 atf_check -s exit:2 -o ignore jexec b ping -t 1 -c 1 198.51.100.1 + + jexec a netstat -I ovpn0 -n -b + ipkts=$(jexec a netstat -I ovpn0 -n -b | awk 'NR == 2 { print($5); }') + echo "$ipkts input packets" + if [ $ipkts -eq 0 ]; then + atf_fail "Input packets were not counted" + fi + + ibytes=$(jexec a netstat -I ovpn0 -n -b | awk 'NR == 2 { print($8); }') + echo "$ibytes input bytes" + if [ $ibytes -eq 0 ]; then + atf_fail "Input bytes were not counted" + fi + + opkts=$(jexec a netstat -I ovpn0 -n -b | awk 'NR == 2 { print($9); }') + echo "$opkts output packets" + if [ $obytes -eq 0 ]; then + atf_fail "Output packets were not counted" + fi + + obytes=$(jexec a netstat -I ovpn0 -n -b | awk 'NR == 2 { print($11); }') + echo "$obytes output bytes" + if [ $obytes -eq 0 ]; then + atf_fail "Output bytes were not counted" + fi } 4in4_cleanup() @@ -1308,6 +1333,7 @@ pft_cleanup } +atf_test_case "multihome6" "cleanup" multihome6_head() { atf_set descr 'Test multihome IPv6 with OpenVPN' @@ -1388,6 +1414,7 @@ multihome6_cleanup() { ovpn_cleanup + pft_cleanup } atf_test_case "float" "cleanup" diff --git a/tests/sys/netinet6/ndp.sh b/tests/sys/netinet6/ndp.sh --- a/tests/sys/netinet6/ndp.sh +++ b/tests/sys/netinet6/ndp.sh @@ -287,6 +287,81 @@ vnet_cleanup } +atf_test_case "ndp_prefix_lifetime_extend" +ndp_prefix_lifetime_extend_head() { + atf_set descr 'Test prefix lifetime updates via ifconfig' + atf_set require.user root + atf_set require.progs jq +} + +get_prefix_attr() { + local prefix=$1 + local attr=$2 + + ndp -p --libxo json | \ + jq -r '.ndp.["prefix-list"][] | + select(.prefix == "'${prefix}'") | .["'${attr}'"]' +} + +# Given a prefix, return its expiry time in seconds. +prefix_expiry() { + get_prefix_attr $1 "expires_sec" +} + +# Given a prefix, return its valid and preferred lifetimes. +prefix_lifetimes() { + local p v + + v=$(get_prefix_attr $1 "valid-lifetime") + p=$(get_prefix_attr $1 "preferred-lifetime") + echo $v $p +} + +ndp_prefix_lifetime_extend_body() { + local epair ex1 ex2 ex3 prefix pltime vltime + + atf_check -o save:epair ifconfig epair create + epair=$(cat epair) + atf_check ifconfig ${epair} up + + prefix="2001:db8:ffff:1000::" + + atf_check ifconfig ${epair} inet6 ${prefix}1/64 pltime 5 vltime 10 + t=$(prefix_lifetimes ${prefix}/64) + if [ "${t}" != "10 5" ]; then + atf_fail "Unexpected lifetimes: ${t}" + fi + ex1=$(prefix_expiry ${prefix}/64) + if [ "${ex1}" -gt 10 ]; then + atf_fail "Unexpected expiry time: ${ex1}" + fi + + # Double the address lifetime and verify that the prefix is + # updated. + atf_check ifconfig ${epair} inet6 ${prefix}1/64 pltime 10 vltime 20 + t=$(prefix_lifetimes ${prefix}/64) + if [ "${t}" != "20 10" ]; then + atf_fail "Unexpected lifetimes: ${t}" + fi + ex2=$(prefix_expiry ${prefix}/64) + if [ "${ex2}" -le "${ex1}" ]; then + atf_fail "Expiry time was not extended: ${ex1} <= ${ex2}" + fi + + # Add a second address from the same prefix with a shorter + # lifetime, and make sure that the prefix lifetime is not + # shortened. + atf_check ifconfig ${epair} inet6 ${prefix}2/64 pltime 5 vltime 10 + t=$(prefix_lifetimes ${prefix}/64) + if [ "${t}" != "20 10" ]; then + atf_fail "Unexpected lifetimes: ${t}" + fi + ex3=$(prefix_expiry ${prefix}/64) + if [ "${ex3}" -lt "${ex2}" ]; then + atf_fail "Expiry time was shortened: ${ex2} <= ${ex3}" + fi +} + atf_init_test_cases() { atf_add_test_case "ndp_add_gu_success" @@ -294,4 +369,5 @@ atf_add_test_case "ndp_slaac_default_route" atf_add_test_case "ndp_prefix_len_mismatch" atf_add_test_case "ndp_prefix_lifetime" + atf_add_test_case "ndp_prefix_lifetime_extend" } diff --git a/tests/sys/netpfil/ipfw/Makefile b/tests/sys/netpfil/ipfw/Makefile --- a/tests/sys/netpfil/ipfw/Makefile +++ b/tests/sys/netpfil/ipfw/Makefile @@ -3,7 +3,9 @@ TESTSDIR= ${TESTSBASE}/sys/netpfil/ipfw ATF_TESTS_SH+= fwd \ - divert + divert \ + log \ + table ${PACKAGE}FILES+= fwd_inetd.conf diff --git a/tests/sys/netpfil/ipfw/log.sh b/tests/sys/netpfil/ipfw/log.sh new file mode 100755 --- /dev/null +++ b/tests/sys/netpfil/ipfw/log.sh @@ -0,0 +1,95 @@ +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2026 Gleb Smirnoff +# +# 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. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + +. $(atf_get_srcdir)/../common/utils.subr + +atf_test_case "bpf" "cleanup" +bpf_head() +{ + atf_set descr 'Creates several rules with log and probes bpf taps' + atf_set require.user root +} + +bpf_body() +{ + firewall_init "ipfw" + + epair=$(vnet_mkepair) + vnet_mkjail alcatraz ${epair}b + ifconfig ${epair}a 192.0.2.0/31 up + jexec alcatraz ifconfig ${epair}b 192.0.2.1/31 up + + # Create a bunch of statically and auto numbered logging rules + rules="100 200 201" + for r in ${rules}; do + jexec alcatraz \ + ipfw add ${r} count log udp from any to any 10${r} + done + auto=$(jexec alcatraz ipfw add count log udp from any to any 10666 \ + | awk '{print $1}' | sed -Ee 's/^0+//') + + pids="" + for r in ${rules} ${auto}; do + jexec alcatraz tcpdump --immediate-mode -i ipfw${r} \ + -w ${PWD}/${r}.pcap -c 1 & + pids="${pids} $!" + done + + # wait for tcpdumps to attach, include netstat(1) header in ${count} + count=$(( $(echo ${rules} ${auto} | wc -w) + 1)) + while [ $(jexec alcatraz netstat -B | wc -l) -ne ${count} ]; do + sleep 0.01; + done + + for p in ${rules} 666; do + echo foo | nc -u 192.0.2.1 10${p} -w 0 + done + + for p in ${pids}; do + atf_check -s exit:0 sh -c "wait $pid; exit $?" + done + + # statically numbered taps + for p in ${rules}; do + atf_check -o match:"192.0.2.0.[0-9]+ > 192.0.2.1.10${p}: UDP" \ + -e match:"reading from file [a-zA-Z0-9/.]+${p}.pcap" \ + tcpdump -nr ${PWD}/${p}.pcap + done + + # autonumbered tap with 10666 port + atf_check -o match:"192.0.2.0.[0-9]+ > 192.0.2.1.10666: UDP" \ + -e match:"reading from file [a-zA-Z0-9/.]+${auto}.pcap" \ + tcpdump -nr ${PWD}/${auto}.pcap +} + +bpf_cleanup() +{ + firewall_cleanup $1 +} + +atf_init_test_cases() +{ + atf_add_test_case "bpf" +} diff --git a/tests/sys/netpfil/ipfw/table.sh b/tests/sys/netpfil/ipfw/table.sh new file mode 100755 --- /dev/null +++ b/tests/sys/netpfil/ipfw/table.sh @@ -0,0 +1,96 @@ +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2026 Gleb Smirnoff +# +# 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. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + +. $(atf_get_srcdir)/../common/utils.subr + +atf_test_case "fuzz" "cleanup" +fuzz_head() +{ + atf_set descr 'Create couple tables and fuzzes them' + atf_set require.user root +} + +fuzz_body() +{ + firewall_init "ipfw" + + epair=$(vnet_mkepair) + vnet_mkjail sender ${epair}a + jexec sender ifconfig ${epair}a 192.0.2.0/31 up + jexec sender route add 10.0.0.0/8 192.0.2.1 + + vnet_mkjail receiver ${epair}b + jexec receiver ifconfig lo0 127.0.0.1/8 up + jexec receiver ifconfig ${epair}b 192.0.2.1/31 up + jexec receiver route add 10.0.0.0/8 -blackhole -iface lo0 + + jexec receiver ipfw add 100 count ip from any to table\(tb0\) + jexec receiver ipfw add 200 count ip from any to table\(tb1\) + + ( jexec sender sh -c \ + 'while true; do \ + oct=$(od -An -N1 -tu1 < /dev/urandom); \ + oct=$(echo $oct); \ + ping -c 5 -i .01 -W .01 10.0.0.${oct} >/dev/null; \ + done' ) & + pinger=$! + + ( jexec receiver sh -c \ + 'while true; do \ + set -- $(od -An -N2 -tu1 < /dev/urandom); \ + ipfw -q table tb$(($1 % 2)) add 10.0.0.$2; \ + done' ) & + adder=$! + + ( jexec receiver sh -c \ + 'while true; do \ + set -- $(od -An -N2 -tu1 < /dev/urandom); \ + ipfw -q table tb$(($1 % 2)) del 10.0.0.$2; \ + done' ) & + deleter=$! + + ( jexec receiver sh -c \ + 'while true; do \ + ipfw table tb0 swap tb1; \ + sleep .25; \ + done' ) & + swapper=$! + + sleep 30 + kill $pinger + kill $adder + kill $deleter + kill $swapper +} + +fuzz_cleanup() +{ + firewall_cleanup $1 +} + +atf_init_test_cases() +{ + atf_add_test_case "fuzz" +} diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -19,6 +19,7 @@ icmp6 \ if_enc \ limits \ + limiters \ loginterface \ killstate \ macro \ diff --git a/tests/sys/netpfil/pf/limiters.sh b/tests/sys/netpfil/pf/limiters.sh new file mode 100644 --- /dev/null +++ b/tests/sys/netpfil/pf/limiters.sh @@ -0,0 +1,265 @@ +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2026 Rubicon Communications, LLC (Netgate) +# +# 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. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "state_basic" "cleanup" +state_basic_head() +{ + atf_set descr 'Basic state limiter test' + atf_set require.user root +} + +state_basic_body() +{ + pft_init + + epair=$(vnet_mkepair) + + ifconfig ${epair}a 192.0.2.2/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.1/24 up + + # Sanity check + atf_check -s exit:0 -o ignore \ + ping -c 1 192.0.2.1 + + jexec alcatraz pfctl -e + # Allow up to one ICMP state. + pft_set_rules alcatraz \ + "set timeout icmp.error 120" \ + "state limiter \"server\" id 1 limit 1" \ + "block in proto icmp" \ + "pass in proto icmp state limiter \"server\"" + + atf_check -s exit:0 -o ignore \ + ping -c 2 192.0.2.1 + + # This should now fail + atf_check -s exit:2 -o ignore \ + ping -c 2 192.0.2.1 + + jexec alcatraz pfctl -sLimiterStates + hardlim=$(jexec alcatraz pfctl -sLimiterStates | awk 'NR>1 { print $5; }') + if [ $hardlim -eq 0 ]; then + atf_fail "Hard limit not incremented" + fi +} + +state_basic_cleanup() +{ + pft_cleanup +} + +atf_test_case "state_rate" "cleanup" +state_rate_head() +{ + atf_set descr 'State rate limiting test' + atf_set require.user root +} + +state_rate_body() +{ + pft_init + + epair=$(vnet_mkepair) + + ifconfig ${epair}a 192.0.2.2/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.1/24 up + + # Sanity check + atf_check -s exit:0 -o ignore \ + ping -c 1 192.0.2.1 + + jexec alcatraz pfctl -e + # Allow one ICMP state per 5 seconds + pft_set_rules alcatraz \ + "set timeout icmp.error 120" \ + "state limiter \"server\" id 1 limit 1000 rate 1/5" \ + "block in proto icmp" \ + "pass in proto icmp state limiter \"server\"" + + atf_check -s exit:0 -o ignore \ + ping -c 2 192.0.2.1 + + # This should now fail + atf_check -s exit:2 -o ignore \ + ping -c 2 192.0.2.1 + + jexec alcatraz pfctl -sLimiterStates + ratelim=$(jexec alcatraz pfctl -sLimiterStates | awk 'NR>1 { print $6; }') + if [ $ratelim -eq 0 ]; then + atf_fail "Rate limit not incremented" + fi + + sleep 6 + + # We can now create another state + atf_check -s exit:0 -o ignore \ + ping -c 2 192.0.2.1 +} + +state_rate_cleanup() +{ + pft_cleanup +} + +atf_test_case "state_block" "cleanup" +state_block_head() +{ + atf_set descr 'Test block mode state limiter' + atf_set require.user root +} + +state_block_body() +{ + pft_init + + epair=$(vnet_mkepair) + + ifconfig ${epair}a 192.0.2.2/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.1/24 up + + # Sanity check + atf_check -s exit:0 -o ignore \ + ping -c 1 192.0.2.1 + + jexec alcatraz pfctl -e + # Allow one ICMP state per 5 seconds + pft_set_rules alcatraz \ + "set timeout icmp.error 120" \ + "state limiter \"server\" id 1 limit 1000 rate 1/5" \ + "pass" \ + "pass in proto icmp state limiter \"server\" (block)" + + atf_check -s exit:0 -o ignore \ + ping -c 2 192.0.2.1 + + # This should now fail + atf_check -s exit:2 -o ignore \ + ping -c 2 192.0.2.1 + + # However, if we set no-match and exceed the limit we just pass + pft_set_rules alcatraz \ + "set timeout icmp.error 120" \ + "state limiter \"server\" id 1 limit 1000 rate 1/5" \ + "pass" \ + "pass in proto icmp state limiter \"server\" (no-match)" + + atf_check -s exit:0 -o ignore \ + ping -c 2 192.0.2.1 + atf_check -s exit:0 -o ignore \ + ping -c 2 192.0.2.1 +} + +state_block_cleanup() +{ + pft_cleanup +} + +atf_test_case "source_basic" "cleanup" +source_basic_head() +{ + atf_set descr 'Basic source limiter test' + atf_set require.user root +} + +source_basic_body() +{ + pft_init + + epair=$(vnet_mkepair) + + ifconfig ${epair}a 192.0.2.2/24 up + ifconfig ${epair}a inet alias 192.0.2.3/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.1/24 up + + # Sanity check + atf_check -s exit:0 -o ignore \ + ping -S 192.0.2.2 -c 1 192.0.2.1 + atf_check -s exit:0 -o ignore \ + ping -S 192.0.2.3 -c 1 192.0.2.1 + + jexec alcatraz pfctl -e + + # Allow up to one source for ICMP. + pft_set_rules alcatraz \ + "set timeout icmp.error 120" \ + "source limiter \"server\" id 1 entries 128 limit 1" \ + "block in proto icmp" \ + "pass in proto icmp source limiter \"server\"" + + atf_check -s exit:0 -o ignore \ + ping -S 192.0.2.2 -c 2 192.0.2.1 + + # This should now fail + atf_check -s exit:2 -o ignore \ + ping -S 192.0.2.2 -c 2 192.0.2.1 + + jexec alcatraz pfctl -sLimiterSrcs + hardlim=$(jexec alcatraz pfctl -sLimiterSrcs | awk 'NR>1 { print $5; }') + if [ $hardlim -eq 0 ]; then + atf_fail "Hard limit not incremented" + fi + + # However, a different source will succeed + atf_check -s exit:0 -o ignore \ + ping -S 192.0.2.3 -c 2 192.0.2.1 + + atf_check -o match:"192.0.2.2/32 .*hardlim 2 ratelim 0" \ + -e ignore \ + jexec alcatraz pfctl -sLimiterSrcs -v + atf_check -o match:"192.0.2.3/32 .*hardlim 0 ratelim 0" \ + -e ignore \ + jexec alcatraz pfctl -sLimiterSrcs -v + + # Kill the source entry + atf_check -s exit:0 -e ignore \ + jexec alcatraz pfctl -I 1 -k source -k 192.0.2.2 + # Now we can ping again from it + atf_check -s exit:0 -o ignore \ + ping -S 192.0.2.2 -c 2 192.0.2.1 +} + +source_basic_cleanup() +{ + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "state_basic" + atf_add_test_case "state_rate" + atf_add_test_case "state_block" + atf_add_test_case "source_basic" +} diff --git a/tests/sys/netpfil/pf/pflog.sh b/tests/sys/netpfil/pf/pflog.sh --- a/tests/sys/netpfil/pf/pflog.sh +++ b/tests/sys/netpfil/pf/pflog.sh @@ -337,7 +337,7 @@ } atf_test_case "rdr_action" "cleanup" -rdr_head() +rdr_action_head() { atf_set descr 'Ensure that NAT rule actions are logged correctly' atf_set require.user root diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh --- a/tools/build/depend-cleanup.sh +++ b/tools/build/depend-cleanup.sh @@ -349,3 +349,9 @@ clean_dep lib/libc bcopy c "libc.string.bcopy.c" clean_dep lib/libc bzero c "libc.string.bzero.c" fi + +if [ ${MACHINE_ARCH} = "aarch64" ]; then + # 20260113 41ccf82b29f3 libc/aarch64: Use MOPS implementations of memcpy/memmove/memset where availble + clean_dep lib/libc memset S "[^/]memset.S" + run rm -fv "$OBJTOP"/lib/libc/memset.S +fi diff --git a/tools/build/make_libc_exterr_cat_filenames.sh b/tools/build/make_libc_exterr_cat_filenames.sh --- a/tools/build/make_libc_exterr_cat_filenames.sh +++ b/tools/build/make_libc_exterr_cat_filenames.sh @@ -14,7 +14,7 @@ echo " * tools/build/make_libc_exterr_cat_filenames.sh" >>"${target}" echo " */" >>"${target}" -(find sys -type f -name '*.c' | \ +(find -s sys -type f -name '*.c' | \ xargs grep -E '^#define[[:space:]]+EXTERR_CATEGORY[[:space:]]+EXTERR_CAT_' | \ sed -E 's/[[:space:]]+/:/g' | \ awk -F ':' '{filename = $1; sub(/^sys\//, "", filename); diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -2307,9 +2307,6 @@ .endif .if ${MK_HTML} == no -OLD_FILES+=usr/share/doc/ncurses/hackguide.html -OLD_FILES+=usr/share/doc/ncurses/ncurses-intro.html -OLD_DIRS+=usr/share/doc/ncurses OLD_FILES+=usr/share/doc/ntp/accopt.html OLD_FILES+=usr/share/doc/ntp/assoc.html OLD_FILES+=usr/share/doc/ntp/audio.html @@ -7387,6 +7384,19 @@ OLD_FILES+=var/db/services.db .endif +.if ${MK_SOUND} == no +OLD_DIRS+=lib/mixer +OLD_DIRS+=lib/virtual_oss +OLD_DIRS+=usr.bin/beep +OLD_DIRS+=usr.bin/mididump +OLD_DIRS+=usr.sbin/mixer +OLD_DIRS+=usr.sbin/sndctl +OLD_DIRS+=usr.sbin/virtual_oss +OLD_FILES+=libexec/rc/rc.d/mixer +OLD_FILES+=libexec/rc/rc.d/virtual_oss +OLD_FILES+=sbin/devd/snd.conf +.endif + .if ${MK_NUAGEINIT} == no OLD_FILES+=etc/rc.d/nuageinit OLD_FILES+=usr/libexec/nuageinit diff --git a/tools/build/options/WITHOUT_FP_LIBC b/tools/build/options/WITHOUT_FP_LIBC deleted file mode 100644 --- a/tools/build/options/WITHOUT_FP_LIBC +++ /dev/null @@ -1,3 +0,0 @@ -Build -.Nm libc -without floating-point support. diff --git a/tools/build/options/WITH_SOUND b/tools/build/options/WITH_SOUND new file mode 100644 --- /dev/null +++ b/tools/build/options/WITH_SOUND @@ -0,0 +1 @@ +Compile with sound utilities and libraries support. diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh --- a/tools/tools/nanobsd/defaults.sh +++ b/tools/tools/nanobsd/defaults.sh @@ -56,6 +56,9 @@ # directory located in Files. #NANO_CUST_FILES_MTREE="" +# Use the time of the last commit as a timestamp when doing a NO_PRIV build. +NANO_TIMESTAMP=$(git log -1 --format=%ct || true) + # Object tree directory # default is subdir of /usr/obj #NANO_OBJ="" @@ -104,6 +107,7 @@ # Newfs parameters to use NANO_NEWFS="-b 4096 -f 512 -i 8192 -U" +NANO_MAKEFS="-o bsize=4096,density=8192,fsize=512,softupdates=1,version=2" # The drive name of the media at runtime NANO_DRIVE=ada0 @@ -170,7 +174,7 @@ NANO_ROOT=s1a NANO_ALTROOT=s2a -# Default ownwership for nopriv build +# Default ownership for nopriv build NANO_DEF_UNAME=root NANO_DEF_GNAME=wheel @@ -188,9 +192,11 @@ # Directory to populate /cfg from NANO_CFGDIR="" +NANO_METALOG_CFG="" # Directory to populate /data from NANO_DATADIR="" +NANO_METALOG_DATA="" # We don't need SRCCONF or SRC_ENV_CONF. NanoBSD puts everything we # need for the build in files included with __MAKE_CONF. Override in your @@ -257,28 +263,70 @@ cd "${NANO_WORLDDIR}" for i; do touch $i - echo "./${i} type=file" >> ${NANO_METALOG} + if [ -n "$NANO_METALOG" ]; then + echo "./${i} type=file" \ + "uname=${NANO_DEF_UNAME} gname=${NANO_DEF_GNAME}" \ + "mode=0644" >> "${NANO_METALOG}" + fi done ) # -# Convert a directory into a symlink. Takes two arguments, the -# current directory and what it should become a symlink to. The -# directory is removed and a symlink is created. If we're doing +# Convert a directory into a symlink. Takes three arguments, the current +# directory, what it should become a symlink to, and optionally, the mode. +# The directory is removed and a symlink is created. If we're doing # a nopriv build, then append this fact to the metalog # tgt_dir2symlink() ( local dir=$1 local symlink=$2 + local mode=${3:-0777} cd "${NANO_WORLDDIR}" rm -xrf "$dir" - ln -s "$symlink" "$dir" + ln -sf "$symlink" "$dir" if [ -n "$NANO_METALOG" ]; then - echo "./${dir} type=link mode=0777 link=${symlink}" >> ${NANO_METALOG} + echo "./${dir} type=link" \ + "uname=${NANO_DEF_UNAME} gname=${NANO_DEF_GNAME}" \ + "mode=${mode} link=${symlink}" >> ${NANO_METALOG} fi ) +# +# Create directories in the target tree, and record the fact. All paths +# are relative to NANO_WORLDDIR. +# +tgt_dir() { + for i; do + mkdir -p "${NANO_WORLDDIR}/${i}" + + if [ -n "$NANO_METALOG" ]; then + path="" + for dir in $(echo "$i" | tr "/" " "); do + path="${path}/${dir}" + echo ".${path} type=dir uname=${NANO_DEF_UNAME}" \ + "gname=${NANO_DEF_GNAME} mode=0755" >> "${NANO_METALOG}" + done + fi + done +} + +# +# Switch the current root partition in the target file system tab. +# Takes two arguments: the current, and the new partition. +# +tgt_switch_root_fstab() +{ + local current new + current="$1" + new="$2" + + for f in ${NANO_WORLDDIR}/etc/fstab ${NANO_WORLDDIR}/conf/base/etc/fstab + do + sed -i "" "s=${NANO_DRIVE}${current}=${NANO_DRIVE}${new}=g" "${f}" + done +} + # run in the world chroot, errors fatal CR() { chroot "${NANO_WORLDDIR}" /bin/sh -exc "$*" @@ -310,6 +358,10 @@ nano_global_make_env echo "${CONF_WORLD}" echo "${CONF_BUILD}" + if [ -n "${NANO_NOPRIV_BUILD}" ]; then + echo NO_ROOT=true + echo METALOG="${NANO_METALOG}" + fi ) > ${NANO_MAKE_CONF_BUILD} } @@ -542,25 +594,38 @@ # are installed by this point, but are later in the process, # the symlink not being here causes problems. It never hurts # to have the symlink in error though. - ln -sf ../../etc/local usr/local/etc + tgt_dir2symlink usr/local/etc ../../etc/local 0755 for d in var etc do # link /$d under /conf # we use hard links so we have them both places. # the files in /$d will be hidden by the mount. - mkdir -p conf/base/$d conf/default/$d + tgt_dir conf/base/$d conf/default/$d find $d -print | cpio ${CPIO_SYMLINK} -dumpl conf/base/ + if [ -n "$NANO_METALOG" ]; then + grep "^.\/${d}\/" "${NANO_METALOG}" | + sed -e "s=^./${d}=./conf/base/${d}=g" | + sort | uniq >> "${NANO_METALOG}.conf" + fi done + if [ -n "$NANO_METALOG" ]; then + cat "${NANO_METALOG}.conf" >> "${NANO_METALOG}" + rm -f "${NANO_METALOG}.conf" + fi + echo "$NANO_RAM_ETCSIZE" > conf/base/etc/md_size echo "$NANO_RAM_TMPVARSIZE" > conf/base/var/md_size + tgt_touch conf/base/etc/md_size + tgt_touch conf/base/var/md_size # pick up config files from the special partition echo "mount -o ro /dev/${NANO_DRIVE}${NANO_SLICE_CFG}" > conf/default/etc/remount + tgt_touch conf/default/etc/remount # Put /tmp on the /var ramdisk (could be symlink already) - tgt_dir2symlink tmp var/tmp + tgt_dir2symlink tmp var/tmp 1777 ) > ${NANO_LOG}/_.dl 2>&1 } @@ -572,7 +637,7 @@ cd "${NANO_WORLDDIR}" # create diskless marker file - touch etc/diskless + tgt_touch etc/diskless [ -n "${NANO_NOPRIV_BUILD}" ] && chmod 666 boot/defaults/loader.conf { @@ -614,13 +679,15 @@ # save config file for scripts echo "NANO_DRIVE=${NANO_DRIVE}" > etc/nanobsd.conf + tgt_touch etc/nanobsd.conf echo "/dev/${NANO_DRIVE}${NANO_ROOT} / ufs ro 1 1" > etc/fstab echo "/dev/${NANO_DRIVE}${NANO_SLICE_CFG} /cfg ufs rw,noauto 2 2" >> etc/fstab - mkdir -p cfg + tgt_touch etc/fstab + tgt_dir cfg # Create directory for eventual /usr/local/etc contents - mkdir -p etc/local + tgt_dir etc/local ) } @@ -643,6 +710,18 @@ mount -o async ${dev} ${mnt} } +nano_makefs() { + local dir image metalog options size + options=$1 + metalog=$2 + size=$3 + image=$4 + dir=$5 + + makefs ${options} -F "${metalog}" -N "${NANO_WORLDDIR}/etc" \ + -s "${size}b" -T "${NANO_TIMESTAMP}" -t ffs "${image}" "${dir}" +} + # Convenient spot to work around any umount issues that your build environment # hits by overriding this method. nano_umount() { @@ -666,14 +745,66 @@ nano_umount ${mnt} } +_populate_part() ( + local dir fs lbl metalog size type + type=$1 + fs=$2 + dir=$3 + lbl=$4 + size=$5 + metalog=$6 + + echo "Creating ${fs}" + + # Use the directory provided, otherwise create an empty one temporarily. + if [ -n "${dir}" ] && [ -d "${dir}" ]; then + echo "Populating ${lbl} from ${dir}" + else + if [ "${type}" = "cfg" ]; then + dir=$(mktemp -d -p "${NANO_OBJ}" -t "${type}") + trap "rm -f ${dir}" 1 2 15 EXIT + fi + fi + + if [ -d "${dir}" ]; then + # If there is no metalog, create one using the default + # NANO_DEF_UNAME and NANO_DEF_GNAME for all entries in the spec. + if [ -z "${metalog}" ]; then + metalog=$(mktemp -p "${NANO_OBJ}" -t "${type}") + trap "rm -f ${metalog}" 1 2 15 EXIT + echo "/set type=dir uname=${NANO_DEF_UNAME}" \ + "gname=${NANO_DEF_GNAME} mode=0755" > "${metalog}" + echo ". type=dir uname=${NANO_DEF_UNAME}" \ + "gname=${NANO_DEF_GNAME} mode=0755" >> "${metalog}" + ( + cd "${dir}" + mtree -bc -k flags,gid,gname,link,mode,uid,uname | + mtree -C | tail -n +2 | + sed 's/uid=[[:digit:]]*/uname=root/g' | + sed 's/gid=[[:digit:]]*/gname=wheel/g' >> "${metalog}" + ) + fi + + nano_makefs "-DxZ ${NANO_MAKEFS}" "${metalog}" "${size}" "${fs}" "${dir}" + fi +) + populate_cfg_slice() { populate_slice "$1" "$2" "$3" "$4" } +_populate_cfg_part() { + _populate_part "cfg" "$1" "$2" "$3" "$4" "$5" +} + populate_data_slice() { populate_slice "$1" "$2" "$3" "$4" } +_populate_data_part() { + _populate_part "data" "$1" "$2" "$3" "$4" "$5" +} + last_orders() { # Redefine this function with any last orders you may have # after the build completed, for instance to copy the finished @@ -773,6 +904,8 @@ if [ -n "${NANO_CUST_FILES_MTREE}" -a -f ${NANO_CUST_FILES_MTREE} ]; then CR "mtree -eiU -p /" <${NANO_CUST_FILES_MTREE} fi + + tgt_touch $(find * -type f) ) ####################################################################### @@ -812,7 +945,7 @@ mount -t nullfs -o noatime -o ro ${NANO_PACKAGE_DIR} ${NANO_WORLDDIR}/_.p mount -t devfs devfs ${NANO_WORLDDIR}/dev - trap "umount ${NANO_WORLDDIR}/dev; umount ${NANO_WORLDDIR}/_.p ; rm -xrf ${NANO_WORLDDIR}/_.p" 1 2 15 EXIT + trap "nano_umount ${NANO_WORLDDIR}/dev; nano_umount ${NANO_WORLDDIR}/_.p ; rm -xrf ${NANO_WORLDDIR}/_.p" 1 2 15 EXIT # Install pkg-* package CR "${PKGCMD} add /_.p/${_NANO_PKG_PACKAGE}" @@ -837,8 +970,8 @@ CR0 "${PKGCMD} info" trap - 1 2 15 EXIT - umount ${NANO_WORLDDIR}/dev - umount ${NANO_WORLDDIR}/_.p + nano_umount ${NANO_WORLDDIR}/dev + nano_umount ${NANO_WORLDDIR}/_.p rm -xrf ${NANO_WORLDDIR}/_.p } @@ -885,7 +1018,7 @@ usage() { ( - echo "Usage: $0 [-BbfhIiKknpqvWwX] [-c config_file]" + echo "Usage: $0 [-BbfhIiKknpqUvWwX] [-c config_file]" echo " -B suppress installs (both kernel and world)" echo " -b suppress builds (both kernel and world)" echo " -c specify config file" @@ -898,6 +1031,7 @@ echo " -n add -DNO_CLEAN to buildworld, buildkernel, etc" echo " -p suppress preparing the image" echo " -q make output more quiet" + echo " -U add -DNO_ROOT to build without root privileges" echo " -v make output more verbose" echo " -W suppress installworld" echo " -w suppress buildworld" @@ -929,6 +1063,9 @@ if ! $do_clean; then NANO_PMAKE="${NANO_PMAKE} -DNO_CLEAN" fi + if ! $do_root; then + NANO_PMAKE="${NANO_PMAKE} -DNO_ROOT" + fi NANO_MAKE_CONF_BUILD=${MAKEOBJDIRPREFIX}/make.conf.build NANO_MAKE_CONF_INSTALL=${NANO_OBJ}/make.conf.install @@ -939,10 +1076,12 @@ [ ! -d "${NANO_TOOLS}" ] && [ -d "${NANO_SRC}/${NANO_TOOLS}" ] && \ NANO_TOOLS="${NANO_SRC}/${NANO_TOOLS}" || true - [ -n "${NANO_NOPRIV_BUILD}" ] && [ -z "${NANO_METALOG}" ] && \ - NANO_METALOG=${NANO_OBJ}/_.metalog || true + if [ -n "${NANO_NOPRIV_BUILD}" ] && [ -z "${NANO_METALOG}" ]; then + NANO_METALOG=${NANO_OBJ}/_.metalog + fi NANO_STARTTIME=`date +%s` + : ${NANO_TIMESTAMP:=${NANO_STARTTIME}} pprint 3 "Exporting NanoBSD variables" export_var MAKEOBJDIRPREFIX export_var NANO_ARCH @@ -956,6 +1095,7 @@ export_var NANO_IMGNAME export_var NANO_IMG1NAME export_var NANO_MAKE + export_var NANO_MAKEFS export_var NANO_MAKE_CONF_BUILD export_var NANO_MAKE_CONF_INSTALL export_var NANO_MEDIASIZE @@ -966,6 +1106,7 @@ export_var NANO_PMAKE export_var NANO_SECTS export_var NANO_SRC + export_var NANO_TIMESTAMP export_var NANO_TOOLS export_var NANO_WORLDDIR export_var NANO_BOOT0CFG diff --git a/tools/tools/nanobsd/dhcpd/common b/tools/tools/nanobsd/dhcpd/common --- a/tools/tools/nanobsd/dhcpd/common +++ b/tools/tools/nanobsd/dhcpd/common @@ -204,7 +204,7 @@ } # Need to check if this function works with cross-compiling architecture!!!! -# Recursive complex fonction: Generate one function for each ports +# Recursive complex function: Generate one function for each port add_port () { local port_path=$1 local port=`echo $1 | sed -e 's/\//_/'` diff --git a/tools/tools/nanobsd/embedded/common b/tools/tools/nanobsd/embedded/common --- a/tools/tools/nanobsd/embedded/common +++ b/tools/tools/nanobsd/embedded/common @@ -323,7 +323,7 @@ # Automatically include the packaging port here so it is always first so it # builds the port and adds the package so we can add other packages. -#XXX Doesn't work for cross build, so punting until I can integreate qemu-static +#XXX Doesn't work for cross build, so punting until I can integrate qemu-static #XXX or poudriere, both of which require priv'd execution. Or qemu-system, #XXX which is super, super slow. #add_port ports-mgmt/pkg @@ -386,7 +386,7 @@ echo "ifconfig_DEFAULT=DHCP" >> $rc echo "ntpdate_hosts='0.freebsd.pool.ntp.org 1.freebsd.pool.ntp.org'" >> $rc # Make sure that firstboot scripts run so growfs works. - # Note: still some issues remvoing this XXX + # Note: still some issues removing this XXX touch ${NANO_WORLDDIR}/firstboot } customize_cmd typical_embedded diff --git a/tools/tools/nanobsd/legacy.sh b/tools/tools/nanobsd/legacy.sh --- a/tools/tools/nanobsd/legacy.sh +++ b/tools/tools/nanobsd/legacy.sh @@ -92,6 +92,17 @@ ' > ${NANO_LOG}/_.partitioning } +_xxx_adjust_code_size() +{ + # XXX adjust the CODE_SIZE value by rounding it up to + # a bsize of 32768 (DFL_BLKSIZE). + # Otherwise makefs -s will fail because of the guard + # introduced in 5ad283b3c60d. + codesize=$1 + bsize=32768 + echo $(( ((codesize + (bsize - 1)) / bsize) * bsize )) +} + create_code_slice() { pprint 2 "build code slice" pprint 3 "log: ${NANO_OBJ}/_.cs" @@ -113,7 +124,7 @@ -y ${NANO_HEADS}` fi - trap "echo 'Running exit trap code' ; df -i ${MNT} ; umount ${MNT} || true ; mdconfig -d -u $MD" 1 2 15 EXIT + trap "echo 'Running exit trap code' ; df -i ${MNT} ; nano_umount ${MNT} || true ; mdconfig -d -u $MD" 1 2 15 EXIT gpart create -s bsd "${MD}" gpart add -t freebsd-ufs -b 16 "${MD}" @@ -144,6 +155,33 @@ ) > ${NANO_OBJ}/_.cs 2>&1 } +_create_code_slice ( ) ( + pprint 2 "build code slice" + pprint 3 "log: ${NANO_OBJ}/_.cs" + + ( + IMG=${NANO_DISKIMGDIR}/_.disk.image + CODE_SIZE=$(head -n 1 "${NANO_LOG}/_.partitioning" | awk '{ print $2 }') + CODE_SIZE=$(_xxx_adjust_code_size "$CODE_SIZE") + + echo "Writing code image..." + if [ -f "${NANO_WORLDDIR}/boot/boot" ]; then + echo "Making bootable partition" + bootcode="-b ${NANO_WORLDDIR}/boot/boot" + else + echo "Partition will not be bootable" + fi + nano_makefs "-DxZ ${NANO_MAKEFS} -o minfree=0,optimization=space" \ + "${NANO_METALOG}" "${CODE_SIZE}" "${NANO_OBJ}/_.disk.part" \ + "${NANO_WORLDDIR}" + mkimg -s bsd \ + ${bootcode} \ + -p freebsd-ufs:="${NANO_OBJ}/_.disk.part" \ + -o "${NANO_DISKIMGDIR}/_.disk.image" + rm -f "${NANO_OBJ}/_.disk.part" + + ) > ${NANO_OBJ}/_.cs 2>&1 +) create_diskimage() { pprint 2 "build diskimage" @@ -244,3 +282,76 @@ ) > ${NANO_LOG}/_.di 2>&1 } + +_create_diskimage() { + pprint 2 "build diskimage" + pprint 3 "log: ${NANO_OBJ}/_.di" + + ( + local altroot bootloader cfgimage dataimage diskimage + + CODE_SIZE=$(head -n 1 "${NANO_LOG}/_.partitioning" | awk '{ print $2 }') + CODE_SIZE=$(_xxx_adjust_code_size "$CODE_SIZE") + IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME} + + if [ -f "${NANO_WORLDDIR}/${NANO_BOOTLOADER}" ]; then + bootloader="-b ${NANO_WORLDDIR}/${NANO_BOOTLOADER}" + else + echo "Image will not be bootable" + fi + + diskimage="-p freebsd:=${NANO_DISKIMGDIR}/_.disk.image" + + if [ "$NANO_IMAGES" -gt 1 ] && [ "$NANO_INIT_IMG2" -gt 0 ] ; then + echo "Duplicating to second image..." + tgt_switch_root_fstab "${NANO_SLICE_ROOT}" "${NANO_SLICE_ALTROOT}" + nano_makefs "-DxZ ${NANO_MAKEFS} -o minfree=0,optimization=space" \ + "${NANO_METALOG}" "${CODE_SIZE}" "${NANO_OBJ}/_.altroot.part" \ + "${NANO_WORLDDIR}" + tgt_switch_root_fstab "${NANO_SLICE_ALTROOT}" "${NANO_SLICE_ROOT}" + if [ -f "${NANO_WORLDDIR}/boot/boot" ]; then + bootcode="-b ${NANO_WORLDDIR}/boot/boot" + fi + mkimg -s bsd \ + ${bootcode} \ + -p freebsd-ufs:="${NANO_OBJ}/_.altroot.part" \ + -o "${NANO_OBJ}/_.altroot.image" + altroot="-p freebsd:=${NANO_OBJ}/_.altroot.image" + rm -f "${NANO_OBJ}/_.altroot.part" + else + altroot="-p-" + fi + if [ "${NANO_INIT_IMG2}" -eq 0 ]; then + altroot="-p freebsd::${CODE_SIZE}b" + fi + + # Create Config slice + _populate_cfg_part "${NANO_OBJ}/_.cfg.part" "${NANO_CFGDIR}" \ + "${NANO_SLICE_CFG}" "${NANO_CONFSIZE}" "${NANO_METALOG_CFG}" + cfgimage="-p freebsd:=${NANO_OBJ}/_.cfg.part" + + # Create Data slice, if any. + if [ -n "${NANO_SLICE_DATA}" ] && + [ "${NANO_SLICE_CFG}" = "${NANO_SLICE_DATA}" ] && + [ "${NANO_DATASIZE}" -ne 0 ]; then + pprint 2 "NANO_SLICE_DATA is the same as NANO_SLICE_CFG, fix." + exit 2 + fi + if [ "${NANO_DATASIZE}" -ne 0 ] && [ -n "${NANO_SLICE_DATA}" ] ; then + _populate_data_part "${NANO_OBJ}/_.data.part" "${NANO_DATADIR}" \ + "${NANO_SLICE_DATA}" "${NANO_DATASIZE}" "${NANO_METALOG_DATA}" + dataimage="-p freebsd:=${NANO_OBJ}/_.data.part" + fi + + echo "Writing out ${NANO_IMGNAME}..." + mkimg -s mbr \ + ${bootloader} \ + ${diskimage} \ + ${altroot} \ + ${cfgimage} \ + ${dataimage} \ + -o ${IMG} + exit + + ) > ${NANO_LOG}/_.di 2>&1 +} diff --git a/tools/tools/nanobsd/nanobsd.sh b/tools/tools/nanobsd/nanobsd.sh --- a/tools/tools/nanobsd/nanobsd.sh +++ b/tools/tools/nanobsd/nanobsd.sh @@ -36,6 +36,7 @@ # Parse arguments do_clean=true +do_root=true do_kernel=true do_installkernel=true do_world=true @@ -49,7 +50,7 @@ . "${topdir}/legacy.sh" set +e -args=`getopt BKXWbc:fhiIknpqvw $*` +args=`getopt BKXWbc:fhiIknpqUvw $*` if [ $? -ne 0 ] ; then usage exit 2 @@ -133,6 +134,11 @@ PPLEVEL=$(($PPLEVEL + 1)) shift ;; + -U) + do_root=false + NANO_NOPRIV_BUILD=true + shift + ;; -w) do_world=false shift @@ -221,9 +227,17 @@ fi if $do_code ; then calculate_partitioning - create_code_slice + if [ -z "${NANO_NOPRIV_BUILD}" ]; then + create_code_slice + else + _create_code_slice + fi if $do_image ; then - create_diskimage + if [ -z "${NANO_NOPRIV_BUILD}" ]; then + create_diskimage + else + _create_diskimage + fi else pprint 2 "Skipping image build (as instructed)" fi diff --git a/usr.bin/Makefile b/usr.bin/Makefile --- a/usr.bin/Makefile +++ b/usr.bin/Makefile @@ -6,7 +6,6 @@ backlight \ banner \ basename \ - beep \ bintrans \ brandelf \ bsdcat \ @@ -86,7 +85,6 @@ mandoc \ mdo \ mesg \ - mididump \ ministat \ mkdep \ mkfifo \ @@ -240,6 +238,8 @@ SUBDIR.${MK_OPENSSH}+= ssh-copy-id SUBDIR.${MK_QUOTAS}+= quota SUBDIR.${MK_SENDMAIL}+= vacation +SUBDIR.${MK_SOUND}+= beep +SUBDIR.${MK_SOUND}+= mididump SUBDIR.${MK_TALK}+= talk SUBDIR.${MK_TELNET}+= telnet SUBDIR.${MK_TESTS_SUPPORT}+= kyua diff --git a/usr.bin/calendar/calendars/calendar.freebsd b/usr.bin/calendar/calendars/calendar.freebsd --- a/usr.bin/calendar/calendars/calendar.freebsd +++ b/usr.bin/calendar/calendars/calendar.freebsd @@ -280,6 +280,7 @@ 06/30 Guido van Rooij born in Best, Noord-Brabant, the Netherlands, 1965 07/01 Matthew Dillon born in San Francisco, California, United States, 1966 07/01 Mateusz Guzik born in Dołki Górne, Poland, 1986 +07/01 Pouria Mousavizadeh Tehrani born in Tehran, Iran, 2001 07/02 Mark Christopher Ovens born in Preston, Lancashire, United Kingdom, 1958 07/02 Vasil Venelinov Dimov born in Shumen, Bulgaria, 1982 07/04 Motoyuki Konno born in Musashino, Tokyo, Japan, 1969 diff --git a/usr.bin/gcore/elfcore.c b/usr.bin/gcore/elfcore.c --- a/usr.bin/gcore/elfcore.c +++ b/usr.bin/gcore/elfcore.c @@ -372,9 +372,7 @@ #endif #if defined(__powerpc__) elf_putnote(NT_PPC_VMX, elf_note_powerpc_vmx, tids + i, sb); -#ifndef __SPE__ elf_putnote(NT_PPC_VSX, elf_note_powerpc_vsx, tids + i, sb); -#endif #endif } diff --git a/usr.bin/grep/tests/grep_freebsd_test.sh b/usr.bin/grep/tests/grep_freebsd_test.sh --- a/usr.bin/grep/tests/grep_freebsd_test.sh +++ b/usr.bin/grep/tests/grep_freebsd_test.sh @@ -126,6 +126,16 @@ atf_check zgrep -q '1 2' in } +atf_test_case eflags +eflags_body() +{ + # Test use with more than one -e expression + printf "aaa bbb ccc\n111 222 333\ndon't match this line" > in + + atf_check -o 'inline:aaa bbb ccc\n111 222 333\n' \ + zgrep -eaaa -e333 in +} + atf_init_test_cases() { atf_add_test_case grep_r_implied @@ -134,4 +144,5 @@ atf_add_test_case zflag atf_add_test_case color_dupe atf_add_test_case qflag + atf_add_test_case eflags } diff --git a/usr.bin/grep/zgrep.1 b/usr.bin/grep/zgrep.1 --- a/usr.bin/grep/zgrep.1 +++ b/usr.bin/grep/zgrep.1 @@ -92,21 +92,3 @@ .Nm utility was written by .An Thomas Klausner Aq Mt wiz@NetBSD.org . -.Sh BUGS -.Xr zgrep 1 -does not handle flags that take arguments if there is no whitespace -between the flag and the argument, for example: -.Pp -.Dl "zgrep -enfs /etc/rpc" -.Pp -When more than one -.Fl e -flag is used matching -should occur for any of the patterns (similar to multiple patterns -supplied in a file with the -.Fl f -flag). -.Xr zgrep 1 -only matches the last -.Fl e -pattern. diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -541,11 +541,11 @@ } if (istcp) { if (cflag) - xo_emit(" {:stack/%-*.*s}", + xo_emit(" {t:stack/%-*.*s}", fnamelen, fnamelen, tp->xt_stack); if (Cflag) - xo_emit(" {:cc/%-*.*s}" + xo_emit(" {t:cc/%-*.*s}" " {:snd-cwnd/%10lu}" " {:snd-ssthresh/%10lu}" " {:t-maxseg/%5u} {:ecn/%3s}", diff --git a/usr.bin/sockstat/main.c b/usr.bin/sockstat/main.c --- a/usr.bin/sockstat/main.c +++ b/usr.bin/sockstat/main.c @@ -926,8 +926,8 @@ formataddr(struct sockaddr_storage *ss, char *buf, size_t bufsize) { struct sockaddr_un *sun; - char addrstr[NI_MAXHOST] = { '\0', '\0' }; int error, off, port = 0; + char addrstr[NI_MAXHOST] = ""; switch (ss->ss_family) { case AF_INET: @@ -960,11 +960,11 @@ if (is_xo_style_encoding) { xo_emit("{:address/%s}", addrstr); xo_emit("{:port/%d}", port); - return 0; + return (0); } if (port == 0) - return snprintf(buf, bufsize, "%s:*", addrstr); - return snprintf(buf, bufsize, "%s:%d", addrstr, port); + return (snprintf(buf, bufsize, "%s:*", addrstr)); + return (snprintf(buf, bufsize, "%s:%d", addrstr, port)); } static const char * diff --git a/usr.bin/vi/cl_extern.h b/usr.bin/vi/cl_extern.h new file mode 100644 --- /dev/null +++ b/usr.bin/vi/cl_extern.h @@ -0,0 +1,31 @@ +int cl_waddstr(SCR *, const CHAR_T *, size_t); +int cl_addstr(SCR *, const char *, size_t); +int cl_attr(SCR *, scr_attr_t, int); +int cl_baud(SCR *, u_long *); +int cl_bell(SCR *); +int cl_clrtoeol(SCR *); +int cl_cursor(SCR *, size_t *, size_t *); +int cl_deleteln(SCR *); +int cl_discard(SCR *, SCR **); +int cl_ex_adjust(SCR *, exadj_t); +int cl_insertln(SCR *); +int cl_keyval(SCR *, scr_keyval_t, CHAR_T *, int *); +int cl_move(SCR *, size_t, size_t); +int cl_refresh(SCR *, int); +int cl_rename(SCR *, char *, int); +void cl_setname(GS *, char *); +int cl_split(SCR *, SCR *); +int cl_suspend(SCR *, int *); +void cl_usage(void); +int sig_init(GS *, SCR *); +int cl_event(SCR *, EVENT *, u_int32_t, int); +int cl_screen(SCR *, u_int32_t); +int cl_quit(GS *); +int cl_getcap(SCR *, char *, char **); +int cl_term_init(SCR *); +int cl_term_end(GS *); +int cl_fmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t); +int cl_optchange(SCR *, int, char *, u_long *); +int cl_omesg(SCR *, CL_PRIVATE *, int); +int cl_ssize(SCR *, int, size_t *, size_t *, int *); +int cl_putchar(int); diff --git a/usr.bin/vi/common_extern.h b/usr.bin/vi/common_extern.h new file mode 100644 --- /dev/null +++ b/usr.bin/vi/common_extern.h @@ -0,0 +1,131 @@ +char * codeset(void); +void conv_init(SCR *, SCR *); +int conv_enc(SCR *, int, char *); +void conv_end(SCR *); +int cut(SCR *, CHAR_T *, MARK *, MARK *, int); +int cut_line(SCR *, recno_t, size_t, size_t, CB *); +void cut_close(GS *); +TEXT *text_init(SCR *, const CHAR_T *, size_t, size_t); +void text_lfree(TEXTH *); +void text_free(TEXT *); +int del(SCR *, MARK *, MARK *, int); +int looks_utf8(const char *, size_t); +int looks_utf16(const char *, size_t); +int decode_utf8(const char *); +int decode_utf16(const char *, int); +FREF *file_add(SCR *, char *); +int file_init(SCR *, FREF *, char *, int); +int file_end(SCR *, EXF *, int); +int file_write(SCR *, MARK *, MARK *, char *, int); +int file_m1(SCR *, int, int); +int file_m2(SCR *, int); +int file_m3(SCR *, int); +int file_aw(SCR *, int); +void set_alt_name(SCR *, char *); +lockr_t file_lock(SCR *, char *, int, int); +int v_key_init(SCR *); +void v_key_ilookup(SCR *); +size_t v_key_len(SCR *, ARG_CHAR_T); +char *v_key_name(SCR *, ARG_CHAR_T); +e_key_t v_key_val(SCR *, ARG_CHAR_T); +int v_event_push(SCR *, EVENT *, CHAR_T *, size_t, u_int); +int v_event_get(SCR *, EVENT *, int, u_int32_t); +void v_event_err(SCR *, EVENT *); +int v_event_flush(SCR *, u_int); +int db_eget(SCR *, recno_t, CHAR_T **, size_t *, int *); +int db_get(SCR *, recno_t, u_int32_t, CHAR_T **, size_t *); +int db_delete(SCR *, recno_t); +int db_append(SCR *, int, recno_t, CHAR_T *, size_t); +int db_insert(SCR *, recno_t, CHAR_T *, size_t); +int db_set(SCR *, recno_t, CHAR_T *, size_t); +int db_exist(SCR *, recno_t); +int db_last(SCR *, recno_t *); +int db_rget(SCR *, recno_t, char **, size_t *); +int db_rset(SCR *, recno_t, char *, size_t); +void db_err(SCR *, recno_t); +int log_init(SCR *, EXF *); +int log_end(SCR *, EXF *); +int log_cursor(SCR *); +int log_line(SCR *, recno_t, u_int); +int log_mark(SCR *, LMARK *); +int log_backward(SCR *, MARK *); +int log_setline(SCR *); +int log_forward(SCR *, MARK *); +int editor(GS *, int, char *[]); +void v_end(GS *); +int mark_init(SCR *, EXF *); +int mark_end(SCR *, EXF *); +int mark_get(SCR *, ARG_CHAR_T, MARK *, mtype_t); +int mark_set(SCR *, ARG_CHAR_T, MARK *, int); +int mark_insdel(SCR *, lnop_t, recno_t); +void msgq(SCR *, mtype_t, const char *, ...); +void msgq_wstr(SCR *, mtype_t, const CHAR_T *, const char *); +void msgq_str(SCR *, mtype_t, const char *, const char *); +void mod_rpt(SCR *); +void msgq_status(SCR *, recno_t, u_int); +int msg_open(SCR *, char *); +void msg_close(GS *); +const char *msg_cmsg(SCR *, cmsg_t, size_t *); +const char *msg_cat(SCR *, const char *, size_t *); +char *msg_print(SCR *, const char *, int *); +int opts_init(SCR *, int *); +int opts_set(SCR *, ARGS *[], char *); +int o_set(SCR *, int, u_int, char *, u_long); +int opts_empty(SCR *, int, int); +void opts_dump(SCR *, enum optdisp); +int opts_save(SCR *, FILE *); +OPTLIST const *opts_search(CHAR_T *); +void opts_nomatch(SCR *, CHAR_T *); +int opts_copy(SCR *, SCR *); +void opts_free(SCR *); +int f_altwerase(SCR *, OPTION *, char *, u_long *); +int f_columns(SCR *, OPTION *, char *, u_long *); +int f_lines(SCR *, OPTION *, char *, u_long *); +int f_lisp(SCR *, OPTION *, char *, u_long *); +int f_msgcat(SCR *, OPTION *, char *, u_long *); +int f_print(SCR *, OPTION *, char *, u_long *); +int f_readonly(SCR *, OPTION *, char *, u_long *); +int f_recompile(SCR *, OPTION *, char *, u_long *); +int f_reformat(SCR *, OPTION *, char *, u_long *); +int f_ttywerase(SCR *, OPTION *, char *, u_long *); +int f_w300(SCR *, OPTION *, char *, u_long *); +int f_w1200(SCR *, OPTION *, char *, u_long *); +int f_w9600(SCR *, OPTION *, char *, u_long *); +int f_window(SCR *, OPTION *, char *, u_long *); +int f_encoding(SCR *, OPTION *, char *, u_long *); +int put(SCR *, CB *, CHAR_T *, MARK *, MARK *, int, int); +int rcv_tmp(SCR *, EXF *, char *); +int rcv_init(SCR *); +int rcv_sync(SCR *, u_int); +int rcv_list(SCR *); +int rcv_read(SCR *, FREF *); +int screen_init(GS *, SCR *, SCR **); +int screen_end(SCR *); +SCR *screen_next(SCR *); +int f_search(SCR *, + MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int); +int b_search(SCR *, + MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int); +void search_busy(SCR *, busy_t); +int seq_set(SCR *, CHAR_T *, + size_t, CHAR_T *, size_t, CHAR_T *, size_t, seq_t, int); +int seq_delete(SCR *, CHAR_T *, size_t, seq_t); +int seq_free(SEQ *); +SEQ *seq_find + (SCR *, SEQ **, EVENT *, CHAR_T *, size_t, seq_t, int *); +void seq_close(GS *); +int seq_dump(SCR *, seq_t, int); +int seq_save(SCR *, FILE *, char *, seq_t); +int e_memcmp(CHAR_T *, EVENT *, size_t); +void *binc(SCR *, void *, size_t *, size_t); +int nonblank(SCR *, recno_t, size_t *); +char *join(char *, char *); +char *expanduser(char *); +char *quote(char *); +char *v_strdup(SCR *, const char *, size_t); +CHAR_T *v_wstrdup(SCR *, const CHAR_T *, size_t); +enum nresult nget_uslong(u_long *, const CHAR_T *, CHAR_T **, int); +enum nresult nget_slong(long *, const CHAR_T *, CHAR_T **, int); +void timepoint_steady(struct timespec *); +void timepoint_system(struct timespec *); +void TRACE(SCR *, const char *, ...); diff --git a/usr.bin/vi/ex/version.h b/usr.bin/vi/ex/version.h --- a/usr.bin/vi/ex/version.h +++ b/usr.bin/vi/ex/version.h @@ -1 +1 @@ -#define VI_VERSION "2.2.1 (2023-09-25)" +#define VI_VERSION "2.2.2 (2025-10-08)" diff --git a/usr.bin/vi/ex_extern.h b/usr.bin/vi/ex_extern.h new file mode 100644 --- /dev/null +++ b/usr.bin/vi/ex_extern.h @@ -0,0 +1,131 @@ +int ex(SCR **); +int ex_cmd(SCR *); +int ex_range(SCR *, EXCMD *, int *); +int ex_is_abbrev(CHAR_T *, size_t); +int ex_is_unmap(CHAR_T *, size_t); +void ex_badaddr + (SCR *, EXCMDLIST const *, enum badaddr, enum nresult); +int ex_abbr(SCR *, EXCMD *); +int ex_unabbr(SCR *, EXCMD *); +int ex_append(SCR *, EXCMD *); +int ex_change(SCR *, EXCMD *); +int ex_insert(SCR *, EXCMD *); +int ex_next(SCR *, EXCMD *); +int ex_prev(SCR *, EXCMD *); +int ex_rew(SCR *, EXCMD *); +int ex_args(SCR *, EXCMD *); +char **ex_buildargv(SCR *, EXCMD *, char *); +int argv_init(SCR *, EXCMD *); +int argv_exp0(SCR *, EXCMD *, CHAR_T *, size_t); +int argv_exp1(SCR *, EXCMD *, CHAR_T *, size_t, int); +int argv_exp2(SCR *, EXCMD *, CHAR_T *, size_t); +int argv_exp3(SCR *, EXCMD *, CHAR_T *, size_t); +int argv_flt_ex(SCR *, EXCMD *, CHAR_T *, size_t); +int argv_free(SCR *); +int argv_flt_path(SCR *, EXCMD *, CHAR_T *, size_t); +CHAR_T *argv_esc(SCR *, EXCMD *, CHAR_T *, size_t); +CHAR_T *argv_uesc(SCR *, EXCMD *, CHAR_T *, size_t); +int ex_at(SCR *, EXCMD *); +int ex_bang(SCR *, EXCMD *); +int ex_cd(SCR *, EXCMD *); +int ex_cscope(SCR *, EXCMD *); +int cscope_end(SCR *); +int cscope_display(SCR *); +int cscope_search(SCR *, TAGQ *, TAG *); +int ex_delete(SCR *, EXCMD *); +int ex_display(SCR *, EXCMD *); +int ex_edit(SCR *, EXCMD *); +int ex_equal(SCR *, EXCMD *); +int ex_file(SCR *, EXCMD *); +int ex_filter(SCR *, + EXCMD *, MARK *, MARK *, MARK *, CHAR_T *, enum filtertype); +int ex_global(SCR *, EXCMD *); +int ex_v(SCR *, EXCMD *); +int ex_g_insdel(SCR *, lnop_t, recno_t); +int ex_screen_copy(SCR *, SCR *); +int ex_screen_end(SCR *); +int ex_optchange(SCR *, int, char *, u_long *); +int ex_exrc(SCR *); +int ex_run_str(SCR *, char *, CHAR_T *, size_t, int, int); +int ex_join(SCR *, EXCMD *); +int ex_map(SCR *, EXCMD *); +int ex_unmap(SCR *, EXCMD *); +int ex_mark(SCR *, EXCMD *); +int ex_mkexrc(SCR *, EXCMD *); +int ex_copy(SCR *, EXCMD *); +int ex_move(SCR *, EXCMD *); +int ex_open(SCR *, EXCMD *); +int ex_preserve(SCR *, EXCMD *); +int ex_recover(SCR *, EXCMD *); +int ex_list(SCR *, EXCMD *); +int ex_number(SCR *, EXCMD *); +int ex_pr(SCR *, EXCMD *); +int ex_print(SCR *, EXCMD *, MARK *, MARK *, u_int32_t); +int ex_ldisplay(SCR *, const CHAR_T *, size_t, size_t, u_int); +int ex_scprint(SCR *, MARK *, MARK *); +int ex_printf(SCR *, const char *, ...); +int ex_puts(SCR *, const char *); +int ex_fflush(SCR *sp); +int ex_put(SCR *, EXCMD *); +int ex_quit(SCR *, EXCMD *); +int ex_read(SCR *, EXCMD *); +int ex_readfp(SCR *, char *, FILE *, MARK *, recno_t *, int); +int ex_bg(SCR *, EXCMD *); +int ex_fg(SCR *, EXCMD *); +int ex_resize(SCR *, EXCMD *); +int ex_sdisplay(SCR *); +int ex_script(SCR *, EXCMD *); +int sscr_exec(SCR *, recno_t); +int sscr_input(SCR *); +int sscr_end(SCR *); +int ex_set(SCR *, EXCMD *); +int ex_shell(SCR *, EXCMD *); +int ex_exec_proc(SCR *, EXCMD *, char *, const char *, int); +int proc_wait(SCR *, long, const char *, int, int); +int ex_shiftl(SCR *, EXCMD *); +int ex_shiftr(SCR *, EXCMD *); +int ex_retab(SCR *, EXCMD *); +int ex_source(SCR *, EXCMD *); +int ex_stop(SCR *, EXCMD *); +int ex_s(SCR *, EXCMD *); +int ex_subagain(SCR *, EXCMD *); +int ex_subtilde(SCR *, EXCMD *); +int re_compile(SCR *, + CHAR_T *, size_t, CHAR_T **, size_t *, regex_t *, u_int); +void re_error(SCR *, int, regex_t *); +int ex_tag_first(SCR *, CHAR_T *); +int ex_tag_push(SCR *, EXCMD *); +int ex_tag_next(SCR *, EXCMD *); +int ex_tag_prev(SCR *, EXCMD *); +int ex_tag_nswitch(SCR *, TAG *, int); +int ex_tag_Nswitch(SCR *, TAG *, int); +int ex_tag_pop(SCR *, EXCMD *); +int ex_tag_top(SCR *, EXCMD *); +int ex_tag_display(SCR *); +int ex_tag_copy(SCR *, SCR *); +int tagq_free(SCR *, TAGQ *); +int tagq_push(SCR*, TAGQ*, int, int ); +void tag_msg(SCR *, tagmsg_t, char *); +int ex_tagf_alloc(SCR *, char *); +int ex_tag_free(SCR *); +int ex_txt(SCR *, TEXTH *, ARG_CHAR_T, u_int32_t); +int ex_undo(SCR *, EXCMD *); +int ex_help(SCR *, EXCMD *); +int ex_usage(SCR *, EXCMD *); +int ex_viusage(SCR *, EXCMD *); +void ex_cinit(SCR *, EXCMD *, int, int, recno_t, recno_t, int); +int ex_getline(SCR *, FILE *, size_t *); +int ex_ncheck(SCR *, int); +int ex_init(SCR *); +void ex_wemsg(SCR *, CHAR_T *, exm_t); +void ex_emsg(SCR *, char *, exm_t); +int ex_version(SCR *, EXCMD *); +int ex_visual(SCR *, EXCMD *); +int ex_wn(SCR *, EXCMD *); +int ex_wq(SCR *, EXCMD *); +int ex_write(SCR *, EXCMD *); +int ex_xit(SCR *, EXCMD *); +int ex_writefp(SCR *, + char *, FILE *, MARK *, MARK *, u_long *, u_long *, int); +int ex_yank(SCR *, EXCMD *); +int ex_z(SCR *, EXCMD *); diff --git a/usr.bin/vi/extern.h b/usr.bin/vi/extern.h deleted file mode 100644 --- a/usr.bin/vi/extern.h +++ /dev/null @@ -1,444 +0,0 @@ -#ifdef CL_IN_EX /* cl.h */ -int cl_waddstr(SCR *, const CHAR_T *, size_t); -int cl_addstr(SCR *, const char *, size_t); -int cl_attr(SCR *, scr_attr_t, int); -int cl_baud(SCR *, u_long *); -int cl_bell(SCR *); -int cl_clrtoeol(SCR *); -int cl_cursor(SCR *, size_t *, size_t *); -int cl_deleteln(SCR *); -int cl_discard(SCR *, SCR **); -int cl_ex_adjust(SCR *, exadj_t); -int cl_insertln(SCR *); -int cl_keyval(SCR *, scr_keyval_t, CHAR_T *, int *); -int cl_move(SCR *, size_t, size_t); -int cl_refresh(SCR *, int); -int cl_rename(SCR *, char *, int); -void cl_setname(GS *, char *); -int cl_split(SCR *, SCR *); -int cl_suspend(SCR *, int *); -void cl_usage(void); -int sig_init(GS *, SCR *); -int cl_event(SCR *, EVENT *, u_int32_t, int); -int cl_screen(SCR *, u_int32_t); -int cl_quit(GS *); -int cl_getcap(SCR *, char *, char **); -int cl_term_init(SCR *); -int cl_term_end(GS *); -int cl_fmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t); -int cl_optchange(SCR *, int, char *, u_long *); -int cl_omesg(SCR *, CL_PRIVATE *, int); -int cl_ssize(SCR *, int, size_t *, size_t *, int *); -int cl_putchar(int); -#endif -#ifdef EXP /* ex.h */ -int ex(SCR **); -int ex_cmd(SCR *); -int ex_range(SCR *, EXCMD *, int *); -int ex_is_abbrev(CHAR_T *, size_t); -int ex_is_unmap(CHAR_T *, size_t); -void ex_badaddr - (SCR *, EXCMDLIST const *, enum badaddr, enum nresult); -int ex_abbr(SCR *, EXCMD *); -int ex_unabbr(SCR *, EXCMD *); -int ex_append(SCR *, EXCMD *); -int ex_change(SCR *, EXCMD *); -int ex_insert(SCR *, EXCMD *); -int ex_next(SCR *, EXCMD *); -int ex_prev(SCR *, EXCMD *); -int ex_rew(SCR *, EXCMD *); -int ex_args(SCR *, EXCMD *); -char **ex_buildargv(SCR *, EXCMD *, char *); -int argv_init(SCR *, EXCMD *); -int argv_exp0(SCR *, EXCMD *, CHAR_T *, size_t); -int argv_exp1(SCR *, EXCMD *, CHAR_T *, size_t, int); -int argv_exp2(SCR *, EXCMD *, CHAR_T *, size_t); -int argv_exp3(SCR *, EXCMD *, CHAR_T *, size_t); -int argv_flt_ex(SCR *, EXCMD *, CHAR_T *, size_t); -int argv_free(SCR *); -int argv_flt_path(SCR *, EXCMD *, CHAR_T *, size_t); -CHAR_T *argv_esc(SCR *, EXCMD *, CHAR_T *, size_t); -CHAR_T *argv_uesc(SCR *, EXCMD *, CHAR_T *, size_t); -int ex_at(SCR *, EXCMD *); -int ex_bang(SCR *, EXCMD *); -int ex_cd(SCR *, EXCMD *); -int ex_cscope(SCR *, EXCMD *); -int cscope_end(SCR *); -int cscope_display(SCR *); -int cscope_search(SCR *, TAGQ *, TAG *); -int ex_delete(SCR *, EXCMD *); -int ex_display(SCR *, EXCMD *); -int ex_edit(SCR *, EXCMD *); -int ex_equal(SCR *, EXCMD *); -int ex_file(SCR *, EXCMD *); -int ex_filter(SCR *, - EXCMD *, MARK *, MARK *, MARK *, CHAR_T *, enum filtertype); -int ex_global(SCR *, EXCMD *); -int ex_v(SCR *, EXCMD *); -int ex_g_insdel(SCR *, lnop_t, recno_t); -int ex_screen_copy(SCR *, SCR *); -int ex_screen_end(SCR *); -int ex_optchange(SCR *, int, char *, u_long *); -int ex_exrc(SCR *); -int ex_run_str(SCR *, char *, CHAR_T *, size_t, int, int); -int ex_join(SCR *, EXCMD *); -int ex_map(SCR *, EXCMD *); -int ex_unmap(SCR *, EXCMD *); -int ex_mark(SCR *, EXCMD *); -int ex_mkexrc(SCR *, EXCMD *); -int ex_copy(SCR *, EXCMD *); -int ex_move(SCR *, EXCMD *); -int ex_open(SCR *, EXCMD *); -int ex_preserve(SCR *, EXCMD *); -int ex_recover(SCR *, EXCMD *); -int ex_list(SCR *, EXCMD *); -int ex_number(SCR *, EXCMD *); -int ex_pr(SCR *, EXCMD *); -int ex_print(SCR *, EXCMD *, MARK *, MARK *, u_int32_t); -int ex_ldisplay(SCR *, const CHAR_T *, size_t, size_t, u_int); -int ex_scprint(SCR *, MARK *, MARK *); -int ex_printf(SCR *, const char *, ...); -int ex_puts(SCR *, const char *); -int ex_fflush(SCR *sp); -int ex_put(SCR *, EXCMD *); -int ex_quit(SCR *, EXCMD *); -int ex_read(SCR *, EXCMD *); -int ex_readfp(SCR *, char *, FILE *, MARK *, recno_t *, int); -int ex_bg(SCR *, EXCMD *); -int ex_fg(SCR *, EXCMD *); -int ex_resize(SCR *, EXCMD *); -int ex_sdisplay(SCR *); -int ex_script(SCR *, EXCMD *); -int sscr_exec(SCR *, recno_t); -int sscr_input(SCR *); -int sscr_end(SCR *); -int ex_set(SCR *, EXCMD *); -int ex_shell(SCR *, EXCMD *); -int ex_exec_proc(SCR *, EXCMD *, char *, const char *, int); -int proc_wait(SCR *, long, const char *, int, int); -int ex_shiftl(SCR *, EXCMD *); -int ex_shiftr(SCR *, EXCMD *); -int ex_retab(SCR *, EXCMD *); -int ex_source(SCR *, EXCMD *); -int ex_stop(SCR *, EXCMD *); -int ex_s(SCR *, EXCMD *); -int ex_subagain(SCR *, EXCMD *); -int ex_subtilde(SCR *, EXCMD *); -int re_compile(SCR *, - CHAR_T *, size_t, CHAR_T **, size_t *, regex_t *, u_int); -void re_error(SCR *, int, regex_t *); -int ex_tag_first(SCR *, CHAR_T *); -int ex_tag_push(SCR *, EXCMD *); -int ex_tag_next(SCR *, EXCMD *); -int ex_tag_prev(SCR *, EXCMD *); -int ex_tag_nswitch(SCR *, TAG *, int); -int ex_tag_Nswitch(SCR *, TAG *, int); -int ex_tag_pop(SCR *, EXCMD *); -int ex_tag_top(SCR *, EXCMD *); -int ex_tag_display(SCR *); -int ex_tag_copy(SCR *, SCR *); -int tagq_free(SCR *, TAGQ *); -int tagq_push(SCR*, TAGQ*, int, int ); -void tag_msg(SCR *, tagmsg_t, char *); -int ex_tagf_alloc(SCR *, char *); -int ex_tag_free(SCR *); -int ex_txt(SCR *, TEXTH *, ARG_CHAR_T, u_int32_t); -int ex_undo(SCR *, EXCMD *); -int ex_help(SCR *, EXCMD *); -int ex_usage(SCR *, EXCMD *); -int ex_viusage(SCR *, EXCMD *); -void ex_cinit(SCR *, EXCMD *, int, int, recno_t, recno_t, int); -int ex_getline(SCR *, FILE *, size_t *); -int ex_ncheck(SCR *, int); -int ex_init(SCR *); -void ex_wemsg(SCR *, CHAR_T *, exm_t); -void ex_emsg(SCR *, char *, exm_t); -int ex_version(SCR *, EXCMD *); -int ex_visual(SCR *, EXCMD *); -int ex_wn(SCR *, EXCMD *); -int ex_wq(SCR *, EXCMD *); -int ex_write(SCR *, EXCMD *); -int ex_xit(SCR *, EXCMD *); -int ex_writefp(SCR *, - char *, FILE *, MARK *, MARK *, u_long *, u_long *, int); -int ex_yank(SCR *, EXCMD *); -int ex_z(SCR *, EXCMD *); -#endif -#ifdef V_ABS /* vi.h */ -int cs_init(SCR *, VCS *); -int cs_next(SCR *, VCS *); -int cs_fspace(SCR *, VCS *); -int cs_fblank(SCR *, VCS *); -int cs_prev(SCR *, VCS *); -int cs_bblank(SCR *, VCS *); -int v_at(SCR *, VICMD *); -int v_chrepeat(SCR *, VICMD *); -int v_chrrepeat(SCR *, VICMD *); -int v_cht(SCR *, VICMD *); -int v_chf(SCR *, VICMD *); -int v_chT(SCR *, VICMD *); -int v_chF(SCR *, VICMD *); -int v_delete(SCR *, VICMD *); -int v_again(SCR *, VICMD *); -int v_exmode(SCR *, VICMD *); -int v_join(SCR *, VICMD *); -int v_shiftl(SCR *, VICMD *); -int v_shiftr(SCR *, VICMD *); -int v_suspend(SCR *, VICMD *); -int v_switch(SCR *, VICMD *); -int v_tagpush(SCR *, VICMD *); -int v_tagpop(SCR *, VICMD *); -int v_filter(SCR *, VICMD *); -int v_ex(SCR *, VICMD *); -int v_ecl_exec(SCR *); -int v_increment(SCR *, VICMD *); -int v_screen_copy(SCR *, SCR *); -int v_screen_end(SCR *); -int v_optchange(SCR *, int, char *, u_long *); -int v_iA(SCR *, VICMD *); -int v_ia(SCR *, VICMD *); -int v_iI(SCR *, VICMD *); -int v_ii(SCR *, VICMD *); -int v_iO(SCR *, VICMD *); -int v_io(SCR *, VICMD *); -int v_change(SCR *, VICMD *); -int v_Replace(SCR *, VICMD *); -int v_subst(SCR *, VICMD *); -int v_left(SCR *, VICMD *); -int v_cfirst(SCR *, VICMD *); -int v_first(SCR *, VICMD *); -int v_ncol(SCR *, VICMD *); -int v_zero(SCR *, VICMD *); -int v_mark(SCR *, VICMD *); -int v_bmark(SCR *, VICMD *); -int v_fmark(SCR *, VICMD *); -int v_emark(SCR *, VICMD *); -int v_match(SCR *, VICMD *); -int v_buildmcs(SCR *, char *); -int v_paragraphf(SCR *, VICMD *); -int v_paragraphb(SCR *, VICMD *); -int v_buildps(SCR *, char *, char *); -int v_Put(SCR *, VICMD *); -int v_put(SCR *, VICMD *); -int v_redraw(SCR *, VICMD *); -int v_replace(SCR *, VICMD *); -int v_right(SCR *, VICMD *); -int v_dollar(SCR *, VICMD *); -int v_screen(SCR *, VICMD *); -int v_lgoto(SCR *, VICMD *); -int v_home(SCR *, VICMD *); -int v_middle(SCR *, VICMD *); -int v_bottom(SCR *, VICMD *); -int v_up(SCR *, VICMD *); -int v_cr(SCR *, VICMD *); -int v_down(SCR *, VICMD *); -int v_hpageup(SCR *, VICMD *); -int v_hpagedown(SCR *, VICMD *); -int v_pagedown(SCR *, VICMD *); -int v_pageup(SCR *, VICMD *); -int v_lineup(SCR *, VICMD *); -int v_linedown(SCR *, VICMD *); -int v_searchb(SCR *, VICMD *); -int v_searchf(SCR *, VICMD *); -int v_searchN(SCR *, VICMD *); -int v_searchn(SCR *, VICMD *); -int v_searchw(SCR *, VICMD *); -int v_correct(SCR *, VICMD *, int); -int v_sectionf(SCR *, VICMD *); -int v_sectionb(SCR *, VICMD *); -int v_sentencef(SCR *, VICMD *); -int v_sentenceb(SCR *, VICMD *); -int v_status(SCR *, VICMD *); -int v_tcmd(SCR *, VICMD *, ARG_CHAR_T, u_int); -int v_txt(SCR *, VICMD *, MARK *, - const CHAR_T *, size_t, ARG_CHAR_T, recno_t, u_long, u_int32_t); -int v_txt_auto(SCR *, recno_t, TEXT *, size_t, TEXT *); -int v_ulcase(SCR *, VICMD *); -int v_mulcase(SCR *, VICMD *); -int v_Undo(SCR *, VICMD *); -int v_undo(SCR *, VICMD *); -void v_eof(SCR *, MARK *); -void v_eol(SCR *, MARK *); -void v_nomove(SCR *); -void v_sof(SCR *, MARK *); -void v_sol(SCR *); -int v_isempty(CHAR_T *, size_t); -void v_emsg(SCR *, char *, vim_t); -int v_wordW(SCR *, VICMD *); -int v_wordw(SCR *, VICMD *); -int v_wordE(SCR *, VICMD *); -int v_worde(SCR *, VICMD *); -int v_wordB(SCR *, VICMD *); -int v_wordb(SCR *, VICMD *); -int v_xchar(SCR *, VICMD *); -int v_Xchar(SCR *, VICMD *); -int v_yank(SCR *, VICMD *); -int v_z(SCR *, VICMD *); -int vs_crel(SCR *, long); -int v_zexit(SCR *, VICMD *); -int vi(SCR **); -int v_curword(SCR *); -int vs_line(SCR *, SMAP *, size_t *, size_t *); -int vs_number(SCR *); -void vs_busy(SCR *, const char *, busy_t); -void vs_home(SCR *); -void vs_update(SCR *, const char *, const CHAR_T *); -void vs_msg(SCR *, mtype_t, char *, size_t); -int vs_ex_resolve(SCR *, int *); -int vs_resolve(SCR *, SCR *, int); -int vs_repaint(SCR *, EVENT *); -int vs_refresh(SCR *, int); -int vs_column(SCR *, size_t *); -size_t vs_screens(SCR *, recno_t, size_t *); -size_t vs_columns(SCR *, CHAR_T *, recno_t, size_t *, size_t *); -size_t vs_rcm(SCR *, recno_t, int); -size_t vs_colpos(SCR *, recno_t, size_t); -int vs_change(SCR *, recno_t, lnop_t); -int vs_sm_fill(SCR *, recno_t, pos_t); -int vs_sm_scroll(SCR *, MARK *, recno_t, scroll_t); -int vs_sm_1up(SCR *); -int vs_sm_1down(SCR *); -int vs_sm_next(SCR *, SMAP *, SMAP *); -int vs_sm_prev(SCR *, SMAP *, SMAP *); -int vs_sm_cursor(SCR *, SMAP **); -int vs_sm_position(SCR *, MARK *, u_long, pos_t); -recno_t vs_sm_nlines(SCR *, SMAP *, recno_t, size_t); -int vs_split(SCR *, SCR *, int); -int vs_vsplit(SCR *, SCR *); -int vs_discard(SCR *, SCR **); -int vs_fg(SCR *, SCR **, CHAR_T *, int); -int vs_bg(SCR *); -int vs_swap(SCR *, SCR **, char *); -int vs_resize(SCR *, long, adj_t); -#endif /* common.h */ -char * codeset(void); -void conv_init(SCR *, SCR *); -int conv_enc(SCR *, int, char *); -void conv_end(SCR *); -int cut(SCR *, CHAR_T *, MARK *, MARK *, int); -int cut_line(SCR *, recno_t, size_t, size_t, CB *); -void cut_close(GS *); -TEXT *text_init(SCR *, const CHAR_T *, size_t, size_t); -void text_lfree(TEXTH *); -void text_free(TEXT *); -int del(SCR *, MARK *, MARK *, int); -int looks_utf8(const char *, size_t); -int looks_utf16(const char *, size_t); -int decode_utf8(const char *); -int decode_utf16(const char *, int); -FREF *file_add(SCR *, char *); -int file_init(SCR *, FREF *, char *, int); -int file_end(SCR *, EXF *, int); -int file_write(SCR *, MARK *, MARK *, char *, int); -int file_m1(SCR *, int, int); -int file_m2(SCR *, int); -int file_m3(SCR *, int); -int file_aw(SCR *, int); -void set_alt_name(SCR *, char *); -lockr_t file_lock(SCR *, char *, int, int); -int v_key_init(SCR *); -void v_key_ilookup(SCR *); -size_t v_key_len(SCR *, ARG_CHAR_T); -char *v_key_name(SCR *, ARG_CHAR_T); -e_key_t v_key_val(SCR *, ARG_CHAR_T); -int v_event_push(SCR *, EVENT *, CHAR_T *, size_t, u_int); -int v_event_get(SCR *, EVENT *, int, u_int32_t); -void v_event_err(SCR *, EVENT *); -int v_event_flush(SCR *, u_int); -int db_eget(SCR *, recno_t, CHAR_T **, size_t *, int *); -int db_get(SCR *, recno_t, u_int32_t, CHAR_T **, size_t *); -int db_delete(SCR *, recno_t); -int db_append(SCR *, int, recno_t, CHAR_T *, size_t); -int db_insert(SCR *, recno_t, CHAR_T *, size_t); -int db_set(SCR *, recno_t, CHAR_T *, size_t); -int db_exist(SCR *, recno_t); -int db_last(SCR *, recno_t *); -int db_rget(SCR *, recno_t, char **, size_t *); -int db_rset(SCR *, recno_t, char *, size_t); -void db_err(SCR *, recno_t); -int log_init(SCR *, EXF *); -int log_end(SCR *, EXF *); -int log_cursor(SCR *); -int log_line(SCR *, recno_t, u_int); -int log_mark(SCR *, LMARK *); -int log_backward(SCR *, MARK *); -int log_setline(SCR *); -int log_forward(SCR *, MARK *); -int editor(GS *, int, char *[]); -void v_end(GS *); -int mark_init(SCR *, EXF *); -int mark_end(SCR *, EXF *); -int mark_get(SCR *, ARG_CHAR_T, MARK *, mtype_t); -int mark_set(SCR *, ARG_CHAR_T, MARK *, int); -int mark_insdel(SCR *, lnop_t, recno_t); -void msgq(SCR *, mtype_t, const char *, ...); -void msgq_wstr(SCR *, mtype_t, const CHAR_T *, const char *); -void msgq_str(SCR *, mtype_t, const char *, const char *); -void mod_rpt(SCR *); -void msgq_status(SCR *, recno_t, u_int); -int msg_open(SCR *, char *); -void msg_close(GS *); -const char *msg_cmsg(SCR *, cmsg_t, size_t *); -const char *msg_cat(SCR *, const char *, size_t *); -char *msg_print(SCR *, const char *, int *); -int opts_init(SCR *, int *); -int opts_set(SCR *, ARGS *[], char *); -int o_set(SCR *, int, u_int, char *, u_long); -int opts_empty(SCR *, int, int); -void opts_dump(SCR *, enum optdisp); -int opts_save(SCR *, FILE *); -OPTLIST const *opts_search(CHAR_T *); -void opts_nomatch(SCR *, CHAR_T *); -int opts_copy(SCR *, SCR *); -void opts_free(SCR *); -int f_altwerase(SCR *, OPTION *, char *, u_long *); -int f_columns(SCR *, OPTION *, char *, u_long *); -int f_lines(SCR *, OPTION *, char *, u_long *); -int f_lisp(SCR *, OPTION *, char *, u_long *); -int f_msgcat(SCR *, OPTION *, char *, u_long *); -int f_print(SCR *, OPTION *, char *, u_long *); -int f_readonly(SCR *, OPTION *, char *, u_long *); -int f_recompile(SCR *, OPTION *, char *, u_long *); -int f_reformat(SCR *, OPTION *, char *, u_long *); -int f_ttywerase(SCR *, OPTION *, char *, u_long *); -int f_w300(SCR *, OPTION *, char *, u_long *); -int f_w1200(SCR *, OPTION *, char *, u_long *); -int f_w9600(SCR *, OPTION *, char *, u_long *); -int f_window(SCR *, OPTION *, char *, u_long *); -int f_encoding(SCR *, OPTION *, char *, u_long *); -int put(SCR *, CB *, CHAR_T *, MARK *, MARK *, int); -int rcv_tmp(SCR *, EXF *, char *); -int rcv_init(SCR *); -int rcv_sync(SCR *, u_int); -int rcv_list(SCR *); -int rcv_read(SCR *, FREF *); -int screen_init(GS *, SCR *, SCR **); -int screen_end(SCR *); -SCR *screen_next(SCR *); -int f_search(SCR *, - MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int); -int b_search(SCR *, - MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int); -void search_busy(SCR *, busy_t); -int seq_set(SCR *, CHAR_T *, - size_t, CHAR_T *, size_t, CHAR_T *, size_t, seq_t, int); -int seq_delete(SCR *, CHAR_T *, size_t, seq_t); -int seq_free(SEQ *); -SEQ *seq_find - (SCR *, SEQ **, EVENT *, CHAR_T *, size_t, seq_t, int *); -void seq_close(GS *); -int seq_dump(SCR *, seq_t, int); -int seq_save(SCR *, FILE *, char *, seq_t); -int e_memcmp(CHAR_T *, EVENT *, size_t); -void *binc(SCR *, void *, size_t *, size_t); -int nonblank(SCR *, recno_t, size_t *); -char *join(char *, char *); -char *expanduser(char *); -char *quote(char *); -char *v_strdup(SCR *, const char *, size_t); -CHAR_T *v_wstrdup(SCR *, const CHAR_T *, size_t); -enum nresult nget_uslong(u_long *, const CHAR_T *, CHAR_T **, int); -enum nresult nget_slong(long *, const CHAR_T *, CHAR_T **, int); -void timepoint_steady(struct timespec *); -void timepoint_system(struct timespec *); -void TRACE(SCR *, const char *, ...); diff --git a/usr.bin/vi/pathnames.h b/usr.bin/vi/pathnames.h --- a/usr.bin/vi/pathnames.h +++ b/usr.bin/vi/pathnames.h @@ -1,4 +1,3 @@ - /* Read standard system paths first. */ #include diff --git a/usr.bin/vi/version.h b/usr.bin/vi/version.h new file mode 100644 --- /dev/null +++ b/usr.bin/vi/version.h @@ -0,0 +1 @@ +#define VI_VERSION "2.2.2 (2025-10-08)" diff --git a/usr.bin/vi/vi_extern.h b/usr.bin/vi/vi_extern.h new file mode 100644 --- /dev/null +++ b/usr.bin/vi/vi_extern.h @@ -0,0 +1,145 @@ +int cs_init(SCR *, VCS *); +int cs_next(SCR *, VCS *); +int cs_fspace(SCR *, VCS *); +int cs_fblank(SCR *, VCS *); +int cs_prev(SCR *, VCS *); +int cs_bblank(SCR *, VCS *); +int v_at(SCR *, VICMD *); +int v_chrepeat(SCR *, VICMD *); +int v_chrrepeat(SCR *, VICMD *); +int v_cht(SCR *, VICMD *); +int v_chf(SCR *, VICMD *); +int v_chT(SCR *, VICMD *); +int v_chF(SCR *, VICMD *); +int v_delete(SCR *, VICMD *); +int v_again(SCR *, VICMD *); +int v_exmode(SCR *, VICMD *); +int v_join(SCR *, VICMD *); +int v_shiftl(SCR *, VICMD *); +int v_shiftr(SCR *, VICMD *); +int v_suspend(SCR *, VICMD *); +int v_switch(SCR *, VICMD *); +int v_tagpush(SCR *, VICMD *); +int v_tagpop(SCR *, VICMD *); +int v_filter(SCR *, VICMD *); +int v_ex(SCR *, VICMD *); +int v_ecl_exec(SCR *); +int v_increment(SCR *, VICMD *); +int v_screen_copy(SCR *, SCR *); +int v_screen_end(SCR *); +int v_optchange(SCR *, int, char *, u_long *); +int v_iA(SCR *, VICMD *); +int v_ia(SCR *, VICMD *); +int v_iI(SCR *, VICMD *); +int v_ii(SCR *, VICMD *); +int v_iO(SCR *, VICMD *); +int v_io(SCR *, VICMD *); +int v_change(SCR *, VICMD *); +int v_Replace(SCR *, VICMD *); +int v_subst(SCR *, VICMD *); +int v_left(SCR *, VICMD *); +int v_cfirst(SCR *, VICMD *); +int v_first(SCR *, VICMD *); +int v_ncol(SCR *, VICMD *); +int v_zero(SCR *, VICMD *); +int v_mark(SCR *, VICMD *); +int v_bmark(SCR *, VICMD *); +int v_fmark(SCR *, VICMD *); +int v_emark(SCR *, VICMD *); +int v_match(SCR *, VICMD *); +int v_buildmcs(SCR *, char *); +int v_paragraphf(SCR *, VICMD *); +int v_paragraphb(SCR *, VICMD *); +int v_buildps(SCR *, char *, char *); +int v_Put(SCR *, VICMD *); +int v_put(SCR *, VICMD *); +int v_redraw(SCR *, VICMD *); +int v_replace(SCR *, VICMD *); +int v_right(SCR *, VICMD *); +int v_dollar(SCR *, VICMD *); +int v_screen(SCR *, VICMD *); +int v_lgoto(SCR *, VICMD *); +int v_home(SCR *, VICMD *); +int v_middle(SCR *, VICMD *); +int v_bottom(SCR *, VICMD *); +int v_up(SCR *, VICMD *); +int v_cr(SCR *, VICMD *); +int v_down(SCR *, VICMD *); +int v_hpageup(SCR *, VICMD *); +int v_hpagedown(SCR *, VICMD *); +int v_pagedown(SCR *, VICMD *); +int v_pageup(SCR *, VICMD *); +int v_lineup(SCR *, VICMD *); +int v_linedown(SCR *, VICMD *); +int v_searchb(SCR *, VICMD *); +int v_searchf(SCR *, VICMD *); +int v_searchN(SCR *, VICMD *); +int v_searchn(SCR *, VICMD *); +int v_searchw(SCR *, VICMD *); +int v_correct(SCR *, VICMD *, int); +int v_sectionf(SCR *, VICMD *); +int v_sectionb(SCR *, VICMD *); +int v_sentencef(SCR *, VICMD *); +int v_sentenceb(SCR *, VICMD *); +int v_status(SCR *, VICMD *); +int v_tcmd(SCR *, VICMD *, ARG_CHAR_T, u_int); +int v_txt(SCR *, VICMD *, MARK *, + const CHAR_T *, size_t, ARG_CHAR_T, recno_t, u_long, u_int32_t); +int v_txt_auto(SCR *, recno_t, TEXT *, size_t, TEXT *); +int v_ulcase(SCR *, VICMD *); +int v_mulcase(SCR *, VICMD *); +int v_Undo(SCR *, VICMD *); +int v_undo(SCR *, VICMD *); +void v_eof(SCR *, MARK *); +void v_eol(SCR *, MARK *); +void v_nomove(SCR *); +void v_sof(SCR *, MARK *); +void v_sol(SCR *); +int v_isempty(CHAR_T *, size_t); +void v_emsg(SCR *, char *, vim_t); +int v_wordW(SCR *, VICMD *); +int v_wordw(SCR *, VICMD *); +int v_wordE(SCR *, VICMD *); +int v_worde(SCR *, VICMD *); +int v_wordB(SCR *, VICMD *); +int v_wordb(SCR *, VICMD *); +int v_xchar(SCR *, VICMD *); +int v_Xchar(SCR *, VICMD *); +int v_yank(SCR *, VICMD *); +int v_z(SCR *, VICMD *); +int vs_crel(SCR *, long); +int v_zexit(SCR *, VICMD *); +int vi(SCR **); +int v_curword(SCR *); +int vs_line(SCR *, SMAP *, size_t *, size_t *); +int vs_number(SCR *); +void vs_busy(SCR *, const char *, busy_t); +void vs_home(SCR *); +void vs_update(SCR *, const char *, const CHAR_T *); +void vs_msg(SCR *, mtype_t, char *, size_t); +int vs_ex_resolve(SCR *, int *); +int vs_resolve(SCR *, SCR *, int); +int vs_repaint(SCR *, EVENT *); +int vs_refresh(SCR *, int); +int vs_column(SCR *, size_t *); +size_t vs_screens(SCR *, recno_t, size_t *); +size_t vs_columns(SCR *, CHAR_T *, recno_t, size_t *, size_t *); +size_t vs_rcm(SCR *, recno_t, int); +size_t vs_colpos(SCR *, recno_t, size_t); +int vs_change(SCR *, recno_t, lnop_t); +int vs_sm_fill(SCR *, recno_t, pos_t); +int vs_sm_scroll(SCR *, MARK *, recno_t, scroll_t); +int vs_sm_1up(SCR *); +int vs_sm_1down(SCR *); +int vs_sm_next(SCR *, SMAP *, SMAP *); +int vs_sm_prev(SCR *, SMAP *, SMAP *); +int vs_sm_cursor(SCR *, SMAP **); +int vs_sm_position(SCR *, MARK *, u_long, pos_t); +recno_t vs_sm_nlines(SCR *, SMAP *, recno_t, size_t); +int vs_split(SCR *, SCR *, int); +int vs_vsplit(SCR *, SCR *); +int vs_discard(SCR *, SCR **); +int vs_fg(SCR *, SCR **, CHAR_T *, int); +int vs_bg(SCR *); +int vs_swap(SCR *, SCR **, char *); +int vs_resize(SCR *, long, adj_t); diff --git a/usr.bin/wc/wc.1 b/usr.bin/wc/wc.1 --- a/usr.bin/wc/wc.1 +++ b/usr.bin/wc/wc.1 @@ -1,3 +1,6 @@ +.\" +.\" SPDX-License-Identifier: BSD-3-Clause +.\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" @@ -37,7 +40,8 @@ .Sh SYNOPSIS .Nm .Op Fl -libxo -.Op Fl Lclmw +.Op Fl c | Fl m +.Op Fl Llw .Op Ar .Sh DESCRIPTION The @@ -47,10 +51,10 @@ .Ar file , or standard input (if no file is specified) to the standard output. A line is defined as a string of characters delimited by a -.Aq newline +.Dq newline character. Characters beyond the final -.Aq newline +.Dq newline character will not be included in the line count. .Pp @@ -64,7 +68,7 @@ the last file. .Pp The following options are available: -.Bl -tag -width indent +.Bl -tag -width "--libxo" .It Fl -libxo Generate output via .Xr libxo 3 diff --git a/usr.bin/wc/wc.c b/usr.bin/wc/wc.c --- a/usr.bin/wc/wc.c +++ b/usr.bin/wc/wc.c @@ -353,6 +353,6 @@ static void usage(void) { - xo_error("usage: wc [-Lclmw] [file ...]\n"); + xo_error("usage: wc [-c | -m] [-Llw] [file ...]\n"); exit(EXIT_FAILURE); } diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -41,7 +41,6 @@ makefs \ memcontrol \ mfiutil \ - mixer \ mlxcontrol \ mountd \ mount_smbfs \ @@ -84,7 +83,6 @@ setpmac \ smbmsg \ snapinfo \ - sndctl \ spi \ spray \ syslogd \ @@ -131,7 +129,6 @@ .if ${MK_CAROOT} != "no" SUBDIR.${MK_OPENSSL}+= certctl .endif -SUBDIR.${MK_CUSE}+= virtual_oss SUBDIR.${MK_CXGBETOOL}+= cxgbetool SUBDIR.${MK_EFI}+= efivar efidp efibootmgr efitable efiwake .if ${MK_OPENSSL} != "no" @@ -200,6 +197,9 @@ SUBDIR.${MK_SENDMAIL}+= makemap SUBDIR.${MK_SENDMAIL}+= praliases SUBDIR.${MK_SENDMAIL}+= sendmail +SUBDIR.${MK_SOUND}+= mixer +SUBDIR.${MK_SOUND}+= sndctl +SUBDIR.${MK_CUSE}.${MK_SOUND}+= virtual_oss SUBDIR.${MK_TCP_WRAPPERS}+= tcpdchk SUBDIR.${MK_TCP_WRAPPERS}+= tcpdmatch SUBDIR.${MK_TOOLCHAIN}+= config diff --git a/usr.sbin/bhyve/config.h b/usr.sbin/bhyve/config.h --- a/usr.sbin/bhyve/config.h +++ b/usr.sbin/bhyve/config.h @@ -2,6 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2021 John H. Baldwin + * Copyright 2026 Hans Rosenfeld * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -45,6 +46,14 @@ * OIDs. */ +/* + * Walk the nodes under a parent nvlist. For each node found, call the given + * callback function passing the current prefix, nvlist, node name and type, + * and the given argument. + */ +int walk_config_nodes(const char *, const nvlist_t *, void *, + int (*cb)(const char *, const nvlist_t *, const char *, int, void *)); + /* * Fetches the value of a configuration variable. If the "raw" value * contains references to other configuration variables, this function diff --git a/usr.sbin/bhyve/config.c b/usr.sbin/bhyve/config.c --- a/usr.sbin/bhyve/config.c +++ b/usr.sbin/bhyve/config.c @@ -2,6 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2021 John H. Baldwin + * Copyright 2026 Hans Rosenfeld * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -434,31 +435,47 @@ set_config_value_node(parent, name, value ? "true" : "false"); } -static void -dump_tree(const char *prefix, const nvlist_t *nvl) +int +walk_config_nodes(const char *prefix, const nvlist_t *parent, void *arg, + int (*cb)(const char *, const nvlist_t *, const char *, int, void *)) { + void *cookie = NULL; const char *name; - void *cookie; int type; - cookie = NULL; - while ((name = nvlist_next(nvl, &type, &cookie)) != NULL) { - if (type == NV_TYPE_NVLIST) { - char *new_prefix; + while ((name = nvlist_next(parent, &type, &cookie)) != NULL) { + int ret; - asprintf(&new_prefix, "%s%s.", prefix, name); - dump_tree(new_prefix, nvlist_get_nvlist(nvl, name)); - free(new_prefix); - } else { - assert(type == NV_TYPE_STRING); - printf("%s%s=%s\n", prefix, name, - nvlist_get_string(nvl, name)); - } + ret = cb(prefix, parent, name, type, arg); + if (ret != 0) + return (ret); + } + + return (0); +} + +static int +dump_node_cb(const char *prefix, const nvlist_t *parent, const char *name, + int type, void *arg) +{ + if (type == NV_TYPE_NVLIST) { + char *new_prefix; + int ret; + + asprintf(&new_prefix, "%s%s.", prefix, name); + ret = walk_config_nodes(new_prefix, + nvlist_get_nvlist(parent, name), arg, dump_node_cb); + free(new_prefix); + return (ret); } + + assert(type == NV_TYPE_STRING); + printf("%s%s=%s\n", prefix, name, nvlist_get_string(parent, name)); + return (0); } void dump_config(void) { - dump_tree("", config_root); + (void)walk_config_nodes("", config_root, NULL, dump_node_cb); } diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto --- a/usr.sbin/bsdinstall/scripts/auto +++ b/usr.sbin/bsdinstall/scripts/auto @@ -209,9 +209,9 @@ PKGBASE=yes else bsddialog --backtitle "$OSNAME Installer" --title "Select Installation Type" \ - --yes-label "Distribution Sets" --no-label "Packages (Tech Preview)" --yesno \ + --yes-label "Distribution Sets" --no-label "Packages" --yesno \ $PKGBASE_DEFAULT_BUTTON \ - "Would you like to install the base system using traditional distribution sets or packages (technology preview)?" 0 0 + "Would you like to install the base system using legacy distribution sets or packages?" 0 0 if [ $? -eq 1 ]; then PKGBASE=yes fi diff --git a/usr.sbin/bsdinstall/scripts/jail b/usr.sbin/bsdinstall/scripts/jail --- a/usr.sbin/bsdinstall/scripts/jail +++ b/usr.sbin/bsdinstall/scripts/jail @@ -175,8 +175,8 @@ if [ ! "$nonInteractive" == "YES" ]; then bsddialog --backtitle "$OSNAME Installer" --title "Select Installation Type" \ - --yes-label "Distribution Sets" --no-label "Packages (Tech Preview)" --yesno \ - "Would you like to install the base system using traditional distribution sets or packages (technology preview)?" 0 0 + --yes-label "Distribution Sets" --no-label "Packages" --yesno \ + "Would you like to install the base system using legacy distribution sets or packages?" 0 0 if [ $? -eq 1 ]; then PKGBASE=yes fi diff --git a/usr.sbin/etcupdate/tests/conflicts_test.sh b/usr.sbin/etcupdate/tests/conflicts_test.sh --- a/usr.sbin/etcupdate/tests/conflicts_test.sh +++ b/usr.sbin/etcupdate/tests/conflicts_test.sh @@ -80,6 +80,7 @@ cat > $NEW/etc/login.conf < $TEST/etc/login.conf </dev/null -file /etc/login.conf "" 7774a0f9a3a372c7c109c32fd31c4b6b +file /etc/login.conf "" b139b1ab44a6933659246ac4401fcbe4 file /etc/login.conf.db resolved /etc/login.conf @@ -251,7 +252,7 @@ echo 'r' | $COMMAND resolve -d $WORKDIR -D $TEST >/dev/null -file /etc/login.conf "" 966e25984b9b63da8eaac8479dcb0d4d +file /etc/login.conf "" 95de92ea3f1bb1bf4f612a8b5908cddd file /etc/login.conf.db resolved /etc/login.conf diff --git a/usr.sbin/etcupdate/tests/tests_test.sh b/usr.sbin/etcupdate/tests/tests_test.sh --- a/usr.sbin/etcupdate/tests/tests_test.sh +++ b/usr.sbin/etcupdate/tests/tests_test.sh @@ -596,6 +596,7 @@ cat > $NEW/etc/login.conf < 1) { if (execvp(argv[1], argv + 1) < 0) @@ -192,7 +213,7 @@ { fprintf(stderr, "%s\n", - "usage: jexec [-l] [-d working-directory] [-u username | -U username] jail\n" - " [command ...]"); + "usage: jexec [-l] [-d working-directory] [[-e name=value] ...]\n" + " [-u username | -U username] jail [command ...]"); exit(1); } diff --git a/usr.sbin/sndctl/Makefile b/usr.sbin/sndctl/Makefile --- a/usr.sbin/sndctl/Makefile +++ b/usr.sbin/sndctl/Makefile @@ -5,6 +5,6 @@ PROG= sndctl SRCS= ${PROG}.c MAN= ${PROG}.8 -LDFLAGS+= -lnv -lmixer +LDFLAGS+= -lnv -lmixer -lxo -lsbuf .include diff --git a/usr.sbin/sndctl/sndctl.8 b/usr.sbin/sndctl/sndctl.8 --- a/usr.sbin/sndctl/sndctl.8 +++ b/usr.sbin/sndctl/sndctl.8 @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 5, 2025 +.Dd December 2, 2025 .Dt SNDCTL 8 .Os .Sh NAME @@ -35,6 +35,7 @@ .Nd list and modify soundcard properties .Sh SYNOPSIS .Nm +.Op Fl -libxo .Op Fl f Ar device .Op Fl hov .Op Ar control Ns Oo = Ns Ar value Oc Ar ... @@ -46,6 +47,13 @@ .Pp The options are as follows: .Bl -tag -width "-f device" +.It Fl -libxo +Generate output via +.Xr libxo 3 +in a selection of different human and machine readable formats. +See +.Xr xo_options 7 +for details on command line arguments. .It Fl f Ar device Choose a specific audio device .Pq see Sx FILES . @@ -175,6 +183,7 @@ .Sh SEE ALSO .Xr sndstat 4 , .Xr sound 4 , +.Xr xo_options 7 , .Xr mixer 8 , .Xr sysctl 8 .Sh AUTHORS diff --git a/usr.sbin/sndctl/sndctl.c b/usr.sbin/sndctl/sndctl.c --- a/usr.sbin/sndctl/sndctl.c +++ b/usr.sbin/sndctl/sndctl.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -45,6 +46,9 @@ #include #include #include +#include + +#define SNDCTL_XO_VERSION "1" /* Taken from sys/dev/sound/pcm/ */ #define STATUS_LEN 64 @@ -171,7 +175,7 @@ static struct snd_ctl chan_ctls[] = { #define F(member) offsetof(struct snd_chan, member) - /*{ "name", F(name), STR, NULL },*/ + { "name", F(name), STR, NULL }, { "parentchan", F(parentchan), STR, NULL }, { "unit", F(unit), NUM, NULL }, { "caps", F(caps), STR, NULL }, @@ -342,7 +346,7 @@ size = sizeof(int); /* Read current value. */ if (sysctlbyname(buf, &prev, &size, NULL, 0) < 0) { - warn("sysctlbyname(%s)", buf); + xo_warn("sysctlbyname(%s)", buf); return (-1); } @@ -351,24 +355,24 @@ errno = 0; n = strtol(arg, NULL, 10); if (errno == EINVAL || errno == ERANGE) { - warn("strtol(%s)", arg); + xo_warn("strtol(%s)", arg); return (-1); } /* Apply new value. */ if (sysctlbyname(buf, NULL, 0, &n, size) < 0) { - warn("sysctlbyname(%s, %d)", buf, n); + xo_warn("sysctlbyname(%s, %d)", buf, n); return (-1); } } /* Read back applied value for good measure. */ if (sysctlbyname(buf, &n, &size, NULL, 0) < 0) { - warn("sysctlbyname(%s)", buf); + xo_warn("sysctlbyname(%s)", buf); return (-1); } - if (arg != NULL) + if (arg != NULL && xo_get_style(NULL) == XO_STYLE_TEXT) printf("%s: %d -> %d\n", buf, prev, n); if (var != NULL) *var = n; @@ -386,7 +390,7 @@ /* Read current value. */ size = sizeof(prev); if (sysctlbyname(buf, prev, &size, NULL, 0) < 0) { - warn("sysctlbyname(%s)", buf); + xo_warn("sysctlbyname(%s)", buf); return (-1); } @@ -395,26 +399,26 @@ size = strlen(arg); /* Apply new value. */ if (sysctlbyname(buf, NULL, 0, arg, size) < 0) { - warn("sysctlbyname(%s, %s)", buf, arg); + xo_warn("sysctlbyname(%s, %s)", buf, arg); return (-1); } /* Get size of new string. */ if (sysctlbyname(buf, NULL, &size, NULL, 0) < 0) { - warn("sysctlbyname(%s)", buf); + xo_warn("sysctlbyname(%s)", buf); return (-1); } } if ((tmp = calloc(1, size)) == NULL) - err(1, "calloc"); + xo_err(1, "calloc"); /* Read back applied value for good measure. */ if (sysctlbyname(buf, tmp, &size, NULL, 0) < 0) { - warn("sysctlbyname(%s)", buf); + xo_warn("sysctlbyname(%s)", buf); free(tmp); return (-1); } - if (arg != NULL) + if (arg != NULL && xo_get_style(NULL) == XO_STYLE_TEXT) printf("%s: %s -> %s\n", buf, prev, tmp); if (var != NULL) strlcpy(var, tmp, varsz); @@ -436,27 +440,27 @@ int fd, caps, unit, t1, t2, t3; if ((fd = open("/dev/sndstat", O_RDONLY)) < 0) - err(1, "open(/dev/sndstat)"); + xo_err(1, "open(/dev/sndstat)"); if (ioctl(fd, SNDSTIOC_REFRESH_DEVS, NULL) < 0) - err(1, "ioctl(SNDSTIOC_REFRESH_DEVS)"); + xo_err(1, "ioctl(SNDSTIOC_REFRESH_DEVS)"); arg.nbytes = 0; arg.buf = NULL; if (ioctl(fd, SNDSTIOC_GET_DEVS, &arg) < 0) - err(1, "ioctl(SNDSTIOC_GET_DEVS#1)"); + xo_err(1, "ioctl(SNDSTIOC_GET_DEVS#1)"); if ((arg.buf = malloc(arg.nbytes)) == NULL) - err(1, "malloc"); + xo_err(1, "malloc"); if (ioctl(fd, SNDSTIOC_GET_DEVS, &arg) < 0) - err(1, "ioctl(SNDSTIOC_GET_DEVS#2)"); + xo_err(1, "ioctl(SNDSTIOC_GET_DEVS#2)"); if ((nvl = nvlist_unpack(arg.buf, arg.nbytes, 0)) == NULL) - err(1, "nvlist_unpack"); + xo_err(1, "nvlist_unpack"); if (nvlist_empty(nvl) || !nvlist_exists(nvl, SNDST_DSPS)) - errx(1, "no soundcards attached"); + xo_errx(1, "no soundcards attached"); if (path == NULL || (path != NULL && strcmp(basename(path), "dsp") == 0)) unit = mixer_get_dunit(); @@ -475,12 +479,12 @@ break;; } if (i == nitems) - errx(1, "device not found"); + xo_errx(1, "device not found"); #define NV(type, item) \ nvlist_get_ ## type (di[i], SNDST_DSPS_ ## item) if ((dp = calloc(1, sizeof(struct snd_dev))) == NULL) - err(1, "calloc"); + xo_err(1, "calloc"); dp->unit = -1; strlcpy(dp->name, NV(string, NAMEUNIT), sizeof(dp->name)); @@ -492,9 +496,9 @@ #undef NV if (dp->play.pchans && !nvlist_exists(di[i], SNDST_DSPS_INFO_PLAY)) - errx(1, "%s: playback channel list empty", dp->name); + xo_errx(1, "%s: playback channel list empty", dp->name); if (dp->rec.pchans && !nvlist_exists(di[i], SNDST_DSPS_INFO_REC)) - errx(1, "%s: recording channel list empty", dp->name); + xo_errx(1, "%s: recording channel list empty", dp->name); #define NV(type, mode, item) \ nvlist_get_ ## type (nvlist_get_nvlist(di[i], \ @@ -526,7 +530,7 @@ goto done; if (!nvlist_exists(di[i], SNDST_DSPS_PROVIDER_INFO)) - errx(1, "%s: provider_info list empty", dp->name); + xo_errx(1, "%s: provider_info list empty", dp->name); #define NV(type, item) \ nvlist_get_ ## type (nvlist_get_nvlist(di[i], \ @@ -549,13 +553,13 @@ if (sysctl_int("hw.snd.latency", NULL, &t1) || sysctl_int("hw.snd.latency_profile", NULL, &t2) || sysctl_int("kern.timecounter.alloweddeviation", NULL, &t3)) - err(1, "%s: sysctl", dp->name); + xo_err(1, "%s: sysctl", dp->name); if (t1 == 0 && t2 == 0 && t3 == 0) dp->realtime = 1; if (!nvlist_exists(nvlist_get_nvlist(di[i], SNDST_DSPS_PROVIDER_INFO), SNDST_DSPS_SOUND4_CHAN_INFO)) - errx(1, "%s: channel info list empty", dp->name); + xo_errx(1, "%s: channel info list empty", dp->name); cdi = nvlist_get_nvlist_array( nvlist_get_nvlist(di[i], SNDST_DSPS_PROVIDER_INFO), @@ -567,7 +571,7 @@ #define NV(type, item) \ nvlist_get_ ## type (cdi[j], SNDST_DSPS_SOUND4_CHAN_ ## item) if ((ch = calloc(1, sizeof(struct snd_chan))) == NULL) - err(1, "calloc"); + xo_err(1, "calloc"); strlcpy(ch->name, NV(string, NAME), sizeof(ch->name)); strlcpy(ch->parentchan, NV(string, PARENTCHAN), @@ -654,7 +658,7 @@ struct snd_ctl *cp; size_t len; - if (ctl->type != GRP) { + if (ctl->type != GRP && xo_get_style(NULL) == XO_STYLE_TEXT) { if (simple) printf("%s=", ctl->name); else @@ -663,10 +667,10 @@ switch (ctl->type) { case STR: - printf("%s\n", (char *)dp + ctl->off); + xo_emit("{a:%s/%s}\n", ctl->name, (char *)dp + ctl->off); break; case NUM: - printf("%d\n", *(int *)((intptr_t)dp + ctl->off)); + xo_emit("{a:%s/%d}\n", ctl->name, *(int *)((intptr_t)dp + ctl->off)); break; case VOL: break; @@ -691,7 +695,7 @@ size_t len; int v; - if (ctl->type != GRP) { + if (ctl->type != GRP && xo_get_style(NULL) == XO_STYLE_TEXT) { if (simple) printf("%s.%s=", ch->name, ctl->name); else @@ -700,14 +704,14 @@ switch (ctl->type) { case STR: - printf("%s\n", (char *)ch + ctl->off); + xo_emit("{a:%s/%s}\n", ctl->name, (char *)ch + ctl->off); break; case NUM: - printf("%d\n", *(int *)((intptr_t)ch + ctl->off)); + xo_emit("{a:%s/%d}\n", ctl->name, *(int *)((intptr_t)ch + ctl->off)); break; case VOL: v = *(int *)((intptr_t)ch + ctl->off); - printf("%.2f:%.2f\n", + xo_emit("{a:%s/%.2f:%.2f}\n", ctl->name, MIX_VOLNORM(v & 0x00ff), MIX_VOLNORM((v >> 8) & 0x00ff)); break; case GRP: @@ -728,31 +732,46 @@ { struct snd_chan *ch; struct snd_ctl *ctl; + struct sbuf sb; + char buf[16]; - if (!oflag) { - printf("%s: <%s> %s", dp->name, dp->desc, dp->status); + xo_open_instance("devices"); - printf(" ("); + if (!oflag || xo_get_style(NULL) != XO_STYLE_TEXT) { + sbuf_new(&sb, buf, sizeof(buf), SBUF_FIXEDLEN); + + sbuf_printf(&sb, "("); if (dp->play.pchans) - printf("play"); + sbuf_printf(&sb, "play"); if (dp->play.pchans && dp->rec.pchans) - printf("/"); + sbuf_printf(&sb, "/"); if (dp->rec.pchans) - printf("rec"); - printf(")\n"); + sbuf_printf(&sb, "rec"); + sbuf_printf(&sb, ")"); + + xo_emit("{:header/%s: <%s> %s %s}\n", + dp->name, dp->desc, dp->status, sbuf_data(&sb)); + + sbuf_delete(&sb); } for (ctl = dev_ctls; ctl->name != NULL; ctl++) print_dev_ctl(dp, ctl, oflag, false); if (vflag) { + xo_open_list("channels"); TAILQ_FOREACH(ch, &dp->chans, next) { - if (!oflag) + xo_open_instance("channels"); + if (!oflag && xo_get_style(NULL) == XO_STYLE_TEXT) printf(" %s\n", ch->name); for (ctl = chan_ctls; ctl->name != NULL; ctl++) print_chan_ctl(ch, ctl, oflag, false); + xo_close_instance("channels"); } + xo_close_list("channels"); } + + xo_close_instance("devices"); } static int @@ -916,8 +935,9 @@ static void __dead2 usage(void) { - fprintf(stderr, "usage: %s [-f device] [-hov] [control[=value] ...]\n", + xo_error("usage: %s [--libxo] [-f device] [-hov] [control[=value] ...]\n", getprogname()); + xo_finish(); exit(1); } @@ -932,6 +952,10 @@ bool show = true, found; int c; + argc = xo_parse_args(argc, argv); + if (argc < 0) + exit(1); + while ((c = getopt(argc, argv, "f:hov")) != -1) { switch (c) { case 'f': @@ -952,11 +976,20 @@ argc -= optind; argv += optind; + xo_set_version(SNDCTL_XO_VERSION); + xo_open_container("sndctl"); + dp = read_dev(path); + xo_open_container("executed_controls"); while (argc > 0) { - if ((s = strdup(*argv)) == NULL) - err(1, "strdup(%s)", *argv); + if ((s = strdup(*argv)) == NULL) { + xo_close_container("executed_controls"); + xo_close_container("sndctl"); + if (xo_finish() < 0) + xo_err(1, "xo_finish"); + xo_err(1, "strdup(%s)", *argv); + } propstr = strsep(&s, "="); if (propstr == NULL) @@ -966,11 +999,19 @@ for (ctl = dev_ctls; ctl->name != NULL; ctl++) { if (strcmp(ctl->name, propstr) != 0) continue; - if (s == NULL) { - print_dev_ctl(dp, ctl, true, true); + if (s == NULL) show = false; - } else if (ctl->mod != NULL && ctl->mod(dp, s) < 0) - warnx("%s(%s) failed", ctl->name, s); + else if (ctl->mod != NULL && ctl->mod(dp, s) < 0) + xo_warnx("%s(%s) failed", ctl->name, s); + if (s == NULL || xo_get_style(NULL) != XO_STYLE_TEXT) { + /* + * Print the control in libxo mode in all + * cases, otherwise we'll not be printing any + * controls that were modified or whose + * ctl->mod() failed. + */ + print_dev_ctl(dp, ctl, true, true); + } found = true; break; } @@ -985,17 +1026,25 @@ } } if (!found) - warnx("%s: no such property", propstr); + xo_warnx("%s: no such property", propstr); next: free(s); argc--; argv++; } + xo_close_container("executed_controls"); - if (show) { + if (show || xo_get_style(NULL) != XO_STYLE_TEXT) { + xo_open_list("devices"); print_dev(dp); + xo_close_list("devices"); } free_dev(dp); + + xo_close_container("sndctl"); + if (xo_finish() < 0) + xo_err(1, "xo_finish"); + return (0); } diff --git a/usr.sbin/spi/spi.8 b/usr.sbin/spi/spi.8 --- a/usr.sbin/spi/spi.8 +++ b/usr.sbin/spi/spi.8 @@ -38,6 +38,7 @@ .Op Fl d Cm r Ns | Ns Cm w Ns | Ns Cm rw .Op Fl f Ar device .Op Fl m Ar mode +.Op Fl S .Op Fl s Ar max-speed .Nm .Op Fl i @@ -145,6 +146,12 @@ SPI mode, 0 through 3. This defines the clock phase and timing with respect to reading and writing data, as per the SPI specification. +.It Fl S +Constantly stream from +.Xr stdin 3 +to the +.Nm +bus. .It Fl s Ar speed Specify the maximum speed, in Hz, for the SPI clock. The bus will operate at its highest available speed which does not diff --git a/usr.sbin/spi/spi.c b/usr.sbin/spi/spi.c --- a/usr.sbin/spi/spi.c +++ b/usr.sbin/spi/spi.c @@ -129,7 +129,7 @@ fputs(" - communicate on SPI bus with slave devices\n" "Usage:\n" " spi [-f device] [-d r|w|rw] [-m mode] [-s max-speed] [-c count]\n" - " [-C \"command bytes\"] [-A] [-b] [-L] [-v]\n" + " [-C \"command bytes\"] [-A] [-b] [-L] [-S] [-v]\n" " spi -i [-f device] [-v]\n" " spi -h\n" " where\n" @@ -145,6 +145,7 @@ " -i query information about the device\n" " -A uses ASCII for input/output as 2-digit hex values\n" " -b Override output format as binary (only valid with '-A')\n" + " -S constantly stream from stdin to bus\n" " -v verbose output\n" " -h prints this message\n" "\n" @@ -158,11 +159,12 @@ main(int argc, char *argv[], char *envp[] __unused) { struct spi_options opt; - int err, ch, hdev, finfo, fdir; + int err, ch, hdev, finfo, stream, fdir; char *pstr; char dev_name[PATH_MAX * 2 + 5]; finfo = 0; + stream = 0; fdir = DIR_NONE; hdev = -1; @@ -180,7 +182,7 @@ opt.ncmd = 0; opt.pcmd = NULL; - while (!err && (ch = getopt(argc, argv, "f:d:m:s:c:C:AbLvih")) != -1) { + while (!err && (ch = getopt(argc, argv, "f:d:m:s:c:C:AbLviSh")) != -1) { switch (ch) { case 'd': if (optarg[0] == 'r') { @@ -275,6 +277,10 @@ finfo = 1; break; + case 'S': + stream = 1; + break; + default: err = 1; /* FALLTHROUGH */ @@ -358,14 +364,29 @@ /* do data transfer */ - if (fdir == DIR_READ) { - err = perform_read(hdev, &opt); - } - else if (fdir == DIR_WRITE) { - err = perform_write(hdev, &opt); + if (stream) { + while (!err && !feof(stdin)) { + if (fdir == DIR_READ) { + err = perform_read(hdev, &opt); + } + else if (fdir == DIR_WRITE) { + err = perform_write(hdev, &opt); + } + else if (fdir == DIR_READWRITE) { + err = perform_readwrite(hdev, &opt); + } + } } - else if (fdir == DIR_READWRITE) { - err = perform_readwrite(hdev, &opt); + else { + if (fdir == DIR_READ) { + err = perform_read(hdev, &opt); + } + else if (fdir == DIR_WRITE) { + err = perform_write(hdev, &opt); + } + else if (fdir == DIR_READWRITE) { + err = perform_readwrite(hdev, &opt); + } } the_end: diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -370,43 +370,19 @@ static void close_filed(struct filed *f) { - switch (f->f_type) { - case F_FORW: - if (f->f_addr_fds != NULL) { - free(f->f_addrs); - for (size_t i = 0; i < f->f_num_addr_fds; ++i) - close(f->f_addr_fds[i]); - free(f->f_addr_fds); - f->f_addr_fds = NULL; - f->f_num_addr_fds = 0; - } - /* FALLTHROUGH */ - case F_FILE: - case F_TTY: - case F_CONSOLE: - f->f_type = F_UNUSED; - break; - case F_PIPE: - if (f->f_procdesc != -1) { - /* - * Close the procdesc, killing the underlying - * process (if it is still alive). - */ - (void)close(f->f_procdesc); - f->f_procdesc = -1; - /* - * The pipe process is guaranteed to be dead now, - * so remove it from the deadq. - */ - if (f->f_dq != NULL) { - deadq_remove(f->f_dq); - f->f_dq = NULL; - } - } - break; - default: - break; + if (f->f_type == F_FORW && f->f_addr_fds != NULL) { + free(f->f_addrs); + for (size_t i = 0; i < f->f_num_addr_fds; ++i) + close(f->f_addr_fds[i]); + free(f->f_addr_fds); + f->f_addr_fds = NULL; + f->f_num_addr_fds = 0; + } else if (f->f_type == F_PIPE && f->f_procdesc != -1) { + f->f_dq = deadq_enter(f->f_procdesc); } + + f->f_type = F_UNUSED; + if (f->f_file != -1) (void)close(f->f_file); f->f_file = -1; @@ -820,8 +796,23 @@ break; case EVFILT_PROCDESC: if ((ev.fflags & NOTE_EXIT) != 0) { - log_deadchild(ev.ident, ev.data, ev.udata); - close_filed(ev.udata); + struct filed *f = ev.udata; + + log_deadchild(f->f_procdesc, ev.data, f); + (void)close(f->f_procdesc); + + f->f_procdesc = -1; + if (f->f_dq != NULL) { + deadq_remove(f->f_dq); + f->f_dq = NULL; + } + + /* + * If it is unused, then it was already closed. + * Free the file data in this case. + */ + if (f->f_type == F_UNUSED) + free(f); } break; } @@ -2272,9 +2263,6 @@ /* flush any pending output */ if (f->f_prevcount) fprintlog_successive(f, 0); - /* terminate existing pipe processes */ - if (f->f_type == F_PIPE) - close_filed(f); } if (signo) { dprintf("syslogd: exiting on signal %d\n", signo); @@ -2517,23 +2505,7 @@ case F_FORW: case F_CONSOLE: case F_TTY: - close_filed(f); - break; case F_PIPE: - if (f->f_procdesc != -1) { - struct kevent ev; - /* - * This filed is going to be freed. - * Delete procdesc kevents that reference it. - */ - EV_SET(&ev, f->f_procdesc, EVFILT_PROCDESC, - EV_DELETE, NOTE_EXIT, 0, f); - if (kevent(kq, &ev, 1, NULL, 0, NULL) == -1) { - logerror("failed to delete procdesc" - "kevent"); - exit(1); - } - } close_filed(f); break; default: @@ -2554,7 +2526,13 @@ } free(f->f_prop_filter); } - free(f); + + /* + * If a piped process is running, then defer the filed + * cleanup until it exits. + */ + if (f->f_type != F_PIPE || f->f_procdesc == -1) + free(f); } } diff --git a/usr.sbin/syslogd/tests/syslogd_test.sh b/usr.sbin/syslogd/tests/syslogd_test.sh --- a/usr.sbin/syslogd/tests/syslogd_test.sh +++ b/usr.sbin/syslogd/tests/syslogd_test.sh @@ -313,6 +313,39 @@ syslogd_stop } +atf_test_case "pipe_action_reload" "cleanup" +pipe_action_reload_head() +{ + atf_set descr "Pipe processes terminate gracefully on reload" +} +pipe_action_reload_body() +{ + local logfile="${PWD}/pipe_reload.log" + local pipecmd="${PWD}/pipe_cmd.sh" + + cat <<__EOF__ > "${pipecmd}" +#!/bin/sh +echo START > ${logfile} +while read msg; do + echo \${msg} >> ${logfile} +done +echo END >> ${logfile} +exit 0 +__EOF__ + chmod +x "${pipecmd}" + + printf "!pipe\nuser.debug\t| %s\n" "${pipecmd}" > "${SYSLOGD_CONFIG}" + syslogd_start + + syslogd_log -p user.debug -t "pipe" -h "${SYSLOGD_LOCAL_SOCKET}" "MSG" + syslogd_reload + atf_check -s exit:0 -o match:"END" tail -n 1 "${logfile}" +} +pipe_action_reload_cleanup() +{ + syslogd_stop +} + atf_test_case "jail_noinet" "cleanup" jail_noinet_head() { @@ -561,6 +594,7 @@ atf_add_test_case "prop_filter" atf_add_test_case "host_action" atf_add_test_case "pipe_action" + atf_add_test_case "pipe_action_reload" atf_add_test_case "jail_noinet" atf_add_test_case "allowed_peer" atf_add_test_case "allowed_peer_forwarding" diff --git a/usr.sbin/virtual_oss/Makefile b/usr.sbin/virtual_oss/Makefile --- a/usr.sbin/virtual_oss/Makefile +++ b/usr.sbin/virtual_oss/Makefile @@ -5,5 +5,6 @@ SUBDIR.${MK_BLUETOOTH}+= virtual_bt_speaker -.include "Makefile.inc" +SUBDIR_PARALLEL= + .include diff --git a/usr.sbin/virtual_oss/virtual_bt_speaker/Makefile b/usr.sbin/virtual_oss/virtual_bt_speaker/Makefile --- a/usr.sbin/virtual_oss/virtual_bt_speaker/Makefile +++ b/usr.sbin/virtual_oss/virtual_bt_speaker/Makefile @@ -6,6 +6,6 @@ CFLAGS+= -I${SRCTOP}/usr.sbin/virtual_oss/virtual_oss \ -I${SRCTOP}/lib/virtual_oss/bt -LDFLAGS+= -lm -lbluetooth -lsdp +LIBADD= bluetooth m sdp .include diff --git a/usr.sbin/virtual_oss/virtual_oss/Makefile b/usr.sbin/virtual_oss/virtual_oss/Makefile --- a/usr.sbin/virtual_oss/virtual_oss/Makefile +++ b/usr.sbin/virtual_oss/virtual_oss/Makefile @@ -12,13 +12,12 @@ ring.c \ virtual_oss.c -CFLAGS+= -I${SRCTOP}/contrib/libsamplerate +CFLAGS+= -I${SYSROOT:U${DESTDIR}}/${INCLUDEDIR}/private/samplerate + +LIBADD= cuse m nv pthread samplerate # The --export-dynamic-symbol flags below are needed because some backends make # use of those symbols. -LDFLAGS+= -lpthread -lcuse -lnv -lm \ - -Wl,--export-dynamic-symbol=virtual_oss_wait \ +LDFLAGS+= -Wl,--export-dynamic-symbol=virtual_oss_wait \ -Wl,--export-dynamic-symbol=voss_has_synchronization -LIBADD= samplerate -LDFLAGS+= -L${.OBJDIR:H:H}/libsamplerate .include