The Magic of Curses 117 This state of affairs, like institutionalized bureaucracies, would be livable (though still not acceptable) if there were a workaround. Unix offers no workaround, indeed, it gets in the way by randomly permuting control commands that are sent to the VDT. A program that wants to manipulate the cursor directly must go through more gyrations than an Olympic gym- nast. For example, suppose that a program places a cursor at location (x, y) by sending an escape sequence followed by the binary encodings of x and y. Unix won’t allow arbitrary binary values to be sent unscathed to the termi- nal. The GNU Termcap documentation describes the problem and the workaround: Parameters encoded with ‘%.’ encoding can generate null charac- ters, tabs or newlines. These might cause trouble: the null character because tputs would think that was the end of the string, the tab because the kernel or other software might expand it into spaces, and the newline because the kernel might add a carriage-return, or pad- ding characters normally used for a newline. To prevent such prob- lems, tgoto is careful to avoid these characters. Here is how this works: if the target cursor position value is such as to cause a prob- lem (that is to say, zero, nine or ten), tgoto increments it by one, then compensates by appending a string to move the cursor back or up one position.
118 Terminal Insanity Alan Bawden has this to say about the situation: Date: Wed, 13 Nov 91 14:47:50 EST From: Alan Bawden Alan@lcs.mit.edu To: UNIX-HATERS Subject: Don’t tell me about curses What this is saying is so brain damaged it brings tears to my eyes. On the one hand, Unix requires every program to manually generate the escape sequences necessary to drive the user’s terminal, and then on the other hand Unix makes it hard to send them. It’s like going to a restaurant without a liquor license where you have to bring your own beer, and then the restaurant gives you a dribble-glass to drink it from. Customizing your terminal settings Try to make sense of this, and you’ll soon find your .cshrc and .login files accumulating crufty snippets of kludgy workarounds, each one designed to handle a different terminal or type of network connection. The problem is that without a single coherent model of terminals, the different programs that do different tasks must all be told different vital statistics. telnet and rlogin track one set of customizations, tset another set, and stty yet a third. These subsystems act as though they each belong to different labor unions. To compound the problem, especially in the case of stty, the subsystems take different commands and options depending on the local chapter they belong to, that is, which Unix they operate on. (The notion of a transparent networked environment in Unix is an oxymoron.) Our following correspon- dent got hit with shrapnel from all these programs: Date: Thu, 31 Jan 1991 11:06-0500 From: “John R. Dunning” jrd@stony-brook.scrc.symbolics.com To: UNIX-HATERS Subject: Unix vs terminal settings So the other day I tried to telnet into a local Sun box to do something or other, but when I brought up emacs, it displayed a little itty-bitty window at the top of my virtual terminal screen. I got out of it and verified that my TERM and TERMCAP environment variables were set right, and tried again, but nope, it was convinced my terminal was only a few lines high. I thrashed around for a while, to no avail, then finally gave up in disgust, sent mail off to the local Unix wizard (who shall remain nameless, though I think he's on this list) asked how the
Previous Page Next Page