3 ms·
O'Reilly's "Termcap and Terminfo" book was very helpful in filling in some of the random holes in my understanding of the tty and it's history.
by gooseyard 4y ago
O'Reilly's "Termcap and Terminfo" book was very helpful in filling in some of the random holes in my understanding of the tty and it's history.
- amelius 4y agoHow useful would you say this information is for the modern programmer?
- torstenvl 4y agoA lot more than it was 20 years ago? With multiplatform, CI/CD, cloud, Docker, etc. I spend way more of my time in a terminal than I used to.
- kevin_thibedeau 4y agoI ignore terminfo and just stick to the general VT100 escapes + ANSI. You can expect any decent terminal emulator to deal with them correctly. It isn't worth trying to work with a crusty abstraction mechanism that doesn't offer much benefits today and is largely opaque and hard to manage.
- serf 4y agoright, but the question was whether or not an understanding of terminfo would help general understanding behind the terminal and tty -- personally I think that still stands, even if you don't insist on using terminfo practically.
- amelius 4y agoBut how do you think the information in that book can be turned into practical use for the programmer that spends time in the terminal but doesn't need to write applications that work in (possibly) ancient terminals?
- Beltalowda 4y agoIt's useful if you want to write interactive applications from scratch ("curses-like"). Beyond that ... probably not so much.
- deleted 4y ago[deleted]
- kevin_thibedeau 4y agoRead ECMA-48 and DEC VT documentation. That will cover the bulk of what you need to know to operate a TTY style terminal. Terminfo is basically for smoothing over differences with terminal behaviors that aren't commonly used anymore. It only tells you there's a difference in capability. You still have to implement code to handle them which will never be invoked by anyone but a retro enthusiast plugging in obscure 70's hardware.
- cwalv 4y agoIt can definitely be useful, but there are also programming jobs/tasks where it's not useful at all. "modern programmer" covers a lot of different cases
- simonblack 4y agoIt's always useful. Not all programs work best as graphical interfaces. Quite often all that is needed is a text interface, and the easiest way to get one of those is with a terminal of some kind. In today's world, that 'terminal' is most likely to be a terminal-emulator running on a graphical Desktop. I generally have four or five xterms in use on my average Desktop. A curses-based text interface is a good substitute for some graphical programs where an addressable cursor is required. It's certainly faster and more light-weight. Programming for text-based programs also should involve the use of various options given in the terminfo, but most of us are lazy and only cater for one or two main cases. (Hiding behind curses/ncurses as those libraries do the thinking for us.)
- gooseyard 4y agoIf you, or some of the software that you deal with, work in a terminal, you'll have some value of $TERM set. If you use a terminal emulator which isn't one of the classic hits (eg xterm or rxvt), or if you use a terminal mux like screen or tmux, you'll want to have an entry in your terminfo database which describes the terminal accurately, so that simple things like backspace and delete work correctly, or snazzy stuff like 256 color support. So having some kind of general understanding of what terminal capabilities are, how they're expressed in termcap and terminfo, is helpful. In particular, I think having an understanding of the kinds of things that can go wrong in a terminal, for example if you've ever ran cat with a binary file to stdout, is very helpful. It's not the sort of topic you need to spend a lot of time studying, but if you're a UNIX user, I think its a good idea to consider it part of the canon.
- rahimnathwani 4y agoBack in 1994 or 1995, a department at my university was giving away some decommissioned terminals. I figured I'd pick one up so that two people could use my PC (running Linux) at the same time. There were two models available. One model's units all looked cleaner than those of the other, so I picked up one of those. I bought a cable (RS-232?) and plugged it in. It worked great for command line stuff, but pine (the email client) and pico looked off, with some parts of the screen being drawn over others. I knew nothing about termcap/terminfo. This was before Google (and even before Altavista). I spent hours trying different things (perhaps I got some pointers from helpful folks on a newsgroup?) and managed to improve the situation, but it never worked flawlessly. Looking back, what I was doing was a lot of random stuff without much understanding. I will probably never know whether what I was trying to do was impossible, or whether I failed just because I didn't know what I was doing and had no systematic approach to editing the termcap file.