[TUHS] Seeking wisdom from Unix Greybeards

Grant Taylor cctalk at gtaylor.tnetconsulting.net
Thu Nov 26 14:27:01 CST 2020


On 11/26/20 11:35 AM, Tony Aiuto via cctalk wrote:
> Every time I see discussions about terminal control sequences 
> and Unix, I can not help but be reminded of Johnny Zweig's 
> eloquent analysis, as quoted in The Unix Haters Handboodk. 
> https://web.mit.edu/~simsong/www/ugh.pdf

~chuckle~

I'm going to leave that one alone.

> Forcing programmers to be aware of how their programs talk to terminals 
> is medieval, to say the least. Johnny Zweig put it rather bluntly:

I don't know if that's a fair characterization.  Especially when my use 
case context is either a shell echo or an awk print(f) statement.  The 
"how do I give the terminal data?" question is relatively easy.

Perhaps the "how" refers more to "what is said" to the terminal.  As in 
"^[[34m;bob^[[0m;" vs "bob".

Somewhat ironically, it's my caring about doing things properly that has 
me asking the question that prompted reference to Unix Haters Handbook. 
;-)  If I didn't care, I'd just put out the colorized version and be 
done with it.

Aside:  I wonder how much similarity there is related to controlling old 
serial terminals and controlling various web browsers from the 
90s-2010s.  After all, web browsers are doing (at least) much the same 
thing that terminals used to do; displaying data with some amount of 
formatting.

Do to time constraints, I opted to just putting the raw ANSI control 
codes directly in the functions that do the printing.  But I have the 
code structured so that I can easily insert a minimal amount of code to 
interface with something like tput.

I do like how tput deals with all the smoke and mirrors of what control 
sequences need to be used, or not, so that I don't need to.

I do have a real world (at least for me) example of two different 
terminals that behave differently.  XTerm (et al.) do what I want them 
to do.  However, the Linux (virtual) console seems to be a subset 
thereof.  Notably the terminal control sequences meant to set the window 
title have an undesired behavior in on the Linux (virtual) console.  As 
such I do have some code in my profile to account for that when building 
PS1.  --  Should I need to do that?  Probably not.  Is it 
insurmountable?  No.  Would it be nicer to integrate something to make 
that decision for me?  Yes.  Would that be a worthwhile dependency?  I 
doubt it.



-- 
Grant. . . .
unix || die


More information about the cctalk mailing list