From nobody Thu Feb 23 23:30:45 2023 X-Original-To: questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PN8Qw6XYZz3svpc for ; Thu, 23 Feb 2023 23:30:48 +0000 (UTC) (envelope-from btv1==4186ac3e7a1==tom@invisible-island.net) Received: from smtp-1a.his.com (smtp-1a.his.com [216.194.196.25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN8Qw4Ncnz3tl9 for ; Thu, 23 Feb 2023 23:30:48 +0000 (UTC) (envelope-from btv1==4186ac3e7a1==tom@invisible-island.net) Authentication-Results: mx1.freebsd.org; none Received: from cuda501.his.com (cuda501.his.com [18.191.10.220]) by smtp-1a.his.com (Postfix) with ESMTPS id 9E46931B for ; Thu, 23 Feb 2023 18:30:47 -0500 (EST) X-ASG-Debug-ID: 1677195046-1f26af441e424520001-YuSLm7 Received: from smtp-nf-202.his.com (smtp-nf-202.his.com [216.194.196.20]) by cuda501.his.com with ESMTP id T6ne0LPIaTinHBxt; Thu, 23 Feb 2023 18:30:46 -0500 (EST) X-Barracuda-Envelope-From: tom@invisible-island.net X-Barracuda-RBL-Trusted-Forwarder: 216.194.196.20 Received: from zproxy101.his.com (zproxy101.his.com [18.218.2.49]) by smtp-nf-202.his.com (Postfix) with ESMTPS id 9C81160980; Thu, 23 Feb 2023 18:30:46 -0500 (EST) Received: from localhost (localhost.localdomain [127.0.0.1]) by zproxy101.his.com (Postfix) with ESMTP id 60D45178405; Thu, 23 Feb 2023 18:30:46 -0500 (EST) X-Barracuda-RBL-IP: 18.218.2.49 X-Barracuda-Effective-Source-IP: zproxy101.his.com[18.218.2.49] X-Barracuda-Apparent-Source-IP: 18.218.2.49 Received: from zproxy101.his.com ([127.0.0.1]) by localhost (zproxy101.his.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 6oCcVcrr8hu2; Thu, 23 Feb 2023 18:30:46 -0500 (EST) Received: from localhost (localhost.localdomain [127.0.0.1]) by zproxy101.his.com (Postfix) with ESMTP id 48135178DE3; Thu, 23 Feb 2023 18:30:46 -0500 (EST) X-Virus-Scanned: amavisd-new at zproxy101.his.com Received: from zproxy101.his.com ([127.0.0.1]) by localhost (zproxy101.his.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id qg_ff-Lxy23z; Thu, 23 Feb 2023 18:30:46 -0500 (EST) Received: from prl-debianold-64.jexium-island.net (static-96-255-221-90.washdc.fios.verizon.net [96.255.221.90]) by zproxy101.his.com (Postfix) with ESMTPSA id 33EEC178ACA; Thu, 23 Feb 2023 18:30:46 -0500 (EST) Received: from tom by prl-debianold-64.jexium-island.net with local (Exim 4.92) (envelope-from ) id 1pVL2z-0001ko-Sx; Thu, 23 Feb 2023 18:30:45 -0500 Date: Thu, 23 Feb 2023 18:30:45 -0500 From: Thomas Dickey To: Frank Leonhardt Cc: questions@freebsd.org Subject: Re: Cursing the tput utility - the penguin strikes again Message-ID: <20230223233045.GA6547@prl-debianold-64.jexium-island.net> X-ASG-Orig-Subj: Re: Cursing the tput utility - the penguin strikes again Reply-To: dickey@his.com References: <974a81c2-a92d-7f94-5f96-869bddfe21f3@fjl.co.uk> <20230223202622.GA4604@prl-debianold-64.jexium-island.net> <2c582ca1-9f61-a894-b3c6-c91e696fd3cf@fjl.co.uk> List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="PEIAKu/WMn1b1Hv9" Content-Disposition: inline In-Reply-To: <2c582ca1-9f61-a894-b3c6-c91e696fd3cf@fjl.co.uk> User-Agent: Mutt/1.10.1 (2018-07-13) X-Barracuda-Connect: smtp-nf-202.his.com[216.194.196.20] X-Barracuda-Start-Time: 1677195046 X-Barracuda-URL: https://spam.his.com:443/cgi-mod/mark.cgi X-Barracuda-BRTS-Status: 1 X-Virus-Scanned: by bsmtpd at his.com X-Barracuda-Scan-Msg-Size: 5315 X-Barracuda-Bayes: INNOCENT GLOBAL 0.1837 1.0000 -0.9150 X-Barracuda-Spam-Score: -0.91 X-Barracuda-Spam-Status: No, SCORE=-0.91 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=5.0 KILL_LEVEL=7.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.105185 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Rspamd-Queue-Id: 4PN8Qw4Ncnz3tl9 X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:11604, ipnet:216.194.196.0/24, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 23, 2023 at 09:20:10PM +0000, Frank Leonhardt wrote: > On 23/02/2023 20:26, Thomas Dickey wrote: > > On Thu, Feb 23, 2023 at 03:14:16PM -0500, Kurt Hackenberg wrote: > > > On Thu, Feb 23, 2023 at 04:45:21PM +0000, Frank Leonhardt wrote: > > >=20 > > > > So there's a tput utility for controlling the terminal in BSD. > > > ... > > > > Well use the tcap utility on non-BSD platforms and it suddenly does= n't > > > > work. It turns out that the penguinistas thought using the "Cap Nam= e" > > > > instead of the "TCap Code" was a good idea. Some of the codes are t= he > > > > same, some are not. In fact most are not. > > > The trouble is those are two different mechanisms, based on two diffe= rent > > > file formats, that do the same thing. > > >=20 > > > The two file formats are "termcap" and "terminfo", both from the defa= ult > > > names of the system files that use them. Manual section 5 has pages a= bout > > > both. They're similar, but different enough to be incompatible. > > >=20 > > > The "TCap codes" are the names used in termcap format; the "Capnames"= are > > > the names used in terminfo format. (A "cap" is a terminal "capability= ".) > > >=20 > > > I think termcap came first, and then somebody invented terminfo as an > > > improvement or a reimplementation of the same idea. I think termcap c= ame > > > from Berkeley Unix -- maybe invented for vi -- so FreeBSD more or less > > > stayed with it. Maybe terminfo came from Bell Labs; I think Linux pre= fers > > > it. > > most do (FreeBSD's userland is an exception) > >=20 > > It's actually ncurses (and terminfo) underneath the facade. > >=20 > > related - > >=20 > > https://invisible-island.net/ncurses/tctest.html > > > This is pointlessly incompatible, the result of haphazard evolution, = and > > > kind of a mess. It's all about 40 years old. > > >=20 > > > The library functions that use those terminal descriptions were in the > > > library "curses" (from "cursor"), long ago superseded by "ncurses" (n= ew > > > curses). Probably the program tput uses the library ncurses. You > > > might want > > > to look at that library; maybe there's a compatibility layer. Or, as > > > Daniel > > > Tameling suggested, maybe there are two different version of ncurses. > > just one - > >=20 > > https://invisible-island.net/ncurses/ncurses.faq.html#platform-portable > >=20 > > (but reading the FreeBSD sources would tell more) >=20 > The info you and Kurt have posted chimes with what I believe too. I start= ed > with System V ;-) I'm a little older than that - https://invisible-island.net/personal/oldprogs.html https://invisible-island.net/personal/twenties.html > It's pretty clear that BSD has stuck with termcap where tput is concerned. > Linux has broken this by using terminfo names instead. BSD presumably uh - no: tput was around for 5+ years before Keith Bostic adapted the command name to 4.3BSD (SVr4 was released in April 1984, with code from a year or more before, while Bostic's tput dates from October 1989 -- replaci= ng a "clear" program - if you look at the SCCS history, you'll see _that_). Linux happens to do what the vendor-Unix systems do/did (Solaris, HP-UX, AIX, IRIX/IRIX64, SCO, OSF1/Tru64). Ultimately that's because terminfo has a lot more customizability than termcap. My page on tctest gives a lot more information than you'll find in other places :-) > didn't, for compatibility.=C2=A0 I accept no excuses for breaking things = unless BSD didn't, for the obvious reason that it had no terminfo library. Bostic used termcap names, because that was what he had at hand. Once ncurses was available, Keith Bostic used that. It's a long story. > it's absolutely necessary - so anyone reading this has been warned! >=20 > I'm pretty sure (but don't quote me) that termcap came from the BSD side = (I > don't remember it on other Unix systems); terminfo was supposed to include > printer control codes as well, and I think it was there on SunOS (also BS= D. > Hmm) SunOS was basically 4.2BSD (for a starting point). A lot of that never changed (Sun didn't adopt improvements from 4.3BSD, though of course Sun did its _own_ improvements). I recall reading some details on contributions from Sun to 4.3BSD, but don't know of an accurate source of information to use as a tutorial. SunOS 4 did have a terminfo manpage, as part of System V compatibility. The manpage terminfo(5V) notes SYNOPSIS /usr/share/lib/terminfo/?/=E2=88=97 =20 AVAILABILITY This database is available with the System V software installation = op=E2=80=90 tion. Refer to for information on how to install optional software. The terminfo and termcap functions for SunOS 4 are documented in the curses manpage. It has a separate termcap.3x manpage, but no corresponding separate terminfo manpage. You may recall that Sun worked with AT&T to develop Solaris. =20 > Unless anything comes up I can see two solutions - a compatibility wrapper > for shell scripts or, perhaps, modifying BSD tput to accept both versions= of > the attribute name. Something to think about... I seem to recall that there's one ambiguity doing that, but don't see it offhand in terminfo(5). --=20 Thomas E. Dickey https://invisible-island.net --PEIAKu/WMn1b1Hv9 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGYgtkt2kxADCLA1WzCr0RyFnvgMFAmP39yIACgkQzCr0RyFn vgPRjAv+OCwPmqCy4tpuDYMsV4ecyzV9e34PKrdYuUJSYj4O/aF24C3eLKpaJ6js LyrBGejEO5AbWgtnU7pUh/ZsputaSAWeVjaSooLj+p3/qPhoB9nu95BEh8Luubbe Yqka9tzFA8ri/0CPC0D1vm74hKDOt7KQsRfGINwlA7bn9H1c6ifIifL8UsRcaWVL JzeO9QuHM9ihheVPuDUe6e2uTVQcRGUN8NEEPbmJqYtWHwlZm0lCD6xvkSmWkv/x WDoQJRQigpzafD8VGzZevEjD6zx366oUL6K2TKeITR7d/CXrZTapNLyOEh2YbBob vY9E7hwrU/kUcX9+X5kFzyLj4yYQWWlXVSnNT9fId4AqYIG3EXqVWbCAtU0JedKa Xx0bvpWEC+uRC8AxKPGKfRHJoed14vZLC4EYtoilIJL+E63EargleLglx7Ybhq3I SlSJWRBISDqVJ1luF4Hj+cIWXdyM79Ej6a0p3u+h0D6fLwR3Riv0/kEzAfmbfqqJ +Gv2rmkX =80Vz -----END PGP SIGNATURE----- --PEIAKu/WMn1b1Hv9--