From owner-freebsd-arch Mon Oct 21 0:42: 1 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AC0EC37B401 for ; Mon, 21 Oct 2002 00:41:58 -0700 (PDT) Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id D7D8543E3B for ; Mon, 21 Oct 2002 00:41:51 -0700 (PDT) (envelope-from ru@whale.sunbay.crimea.ua) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.6/8.11.2) id g9L7eul25786; Mon, 21 Oct 2002 10:40:56 +0300 (EEST) (envelope-from ru) Date: Mon, 21 Oct 2002 10:40:56 +0300 From: Ruslan Ermilov To: Terry Lambert Cc: "Andrey A. Chernov" , "M. Warner Losh" , arch@FreeBSD.ORG Subject: Re: color, again, in grotty Message-ID: <20021021074056.GE14584@sunbay.com> References: <20021017.101833.110719994.imp@bsdimp.com> <20021018095026.GA3386@sunbay.com> <20021018.094801.123456703.imp@bsdimp.com> <3DB06A8B.E40B3004@mindspring.com> <20021018201919.GA15100@nagual.pp.ru> <20021021065156.GB14584@sunbay.com> <3DB3A962.9F26FCA0@mindspring.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="f61P+fpdnY2FZS1u" Content-Disposition: inline In-Reply-To: <3DB3A962.9F26FCA0@mindspring.com> User-Agent: Mutt/1.3.99i Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --f61P+fpdnY2FZS1u Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 21, 2002 at 12:14:42AM -0700, Terry Lambert wrote: > Ruslan Ermilov wrote: > > > > > : So we must either fix syscons(4) or to somehow tell grotty(1) to > > > > > : emit old sequences to print bold and italic characters. > > > > > > > > Fixing Grotty to use the termcap ("TermCap" -- Terminal Capabilitie= s) > > > > database is the correct approach, in almost all cases. > > > > > > I agree. Grotty should get termcap color capabilities using TERM env. > > > variable, if output isatty(). That is termcap purpose. > >=20 > > It is almost never isatty(), because the most typical scenario is > > to pass the output through a pipe to ${PAGER}, or to a compressor. >=20 > Pagers can't tell the difference between an escape sequence that > results in characters which are not displayable without the > escape sequence (and therefore take a character cell on the screen) > and those which manipulate display attributes (and therefore do not > take any screen space) from those which do cursor positioning in > place of "CR/LF" (e.g. "delete line" at the top of the page is > equivalent to scrolling) vs. those which do nothing apparent. >=20 Look at the -R option of less(1). The point I was trying to make is that the use of isatty(3) is no help here, because even if grotty(1) took the libtermcap(3) approach, the output would almost never be a TTY. > Therefore, it's unreasonable to run processed data through a > pager, if the results of that processing include terminal > implementation dependent escape sequences.. >=20 > The way this is normally dealt with is to use "_^HX" for underscore, > "X^HX" for bold, etc., utilizing "overstrike", and have the pager > convert it based on the pager's knowledge of the terminal display > sequences from the termcap. >=20 This only covers _attributes_, but not color sequences, which are the Subject: here. While we can still use an old scheme to produce device-independent sequences for attributes, we lose the color support completely: FreeBSD's man(1) will be black-n-white forever. > Note that, so long as ASCII (0x08) is backspace, and moves > the cursor one to the left, in the absence of additional terminal > interpretation, the resulting data will be displayed as readable > text, minus the attributes (e.g. even if the second character > replaces, rather than overstriking the first, the text will end > up being the same, without any display attributes at all). >=20 >=20 > I guess a lot of kids these days have grown up without having to > use real tty or terminal hardware, so they don't understand all > the work that has already gone into finding the correct way to > deal with these issues... >=20 Definitely not me. I have been involved into the development of the at386 compatible terminal back in early 90's. I also worked on Esprit 400 terminals which were vt100 based. So far nobody told me what would be the correct alternative way to support colors in grotty(1). I tried the isatty() + libtermcap approach first, but it died horribly because the output is almost never a TTY. It became apparent to me that grotty(1) cannot use libtermcap, because it never knows what TERM it will be displayed on -- quite often the grotty(1) output is saved for future reference (e.g., in the form of catpages). Such an alternative would be to write a filter (similar to or extending the functionality of ul(1)) that would be capable of parsing the ANSI SGR attribute/color sequences and translate them to the right sequences for a given output device, or to strip them off completely. Cheers, --=20 Ruslan Ermilov Sysadmin and DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age --f61P+fpdnY2FZS1u Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD) iD8DBQE9s6+IUkv4P6juNwoRAhFdAJ0dzOt13VcOpXOyQA49pHyP0cuNoQCfYzuX Ad5Rf79O8bOLs52m6JRtasU= =VQ0N -----END PGP SIGNATURE----- --f61P+fpdnY2FZS1u-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message