|
Teaching Old Terminals New Tricks, Part 1 of 2 |
|
By Walter Alan Zintz Questions regarding this article should be directed to the author at walter@ccnet.com . Can alphanumeric terminals and desktop PCs from the 1980s and early 1990s handle the features of today's full-screen applications? Not of Mosaic and the like, of course; just modern full-screen alphanumeric interfaces that come with programs like the Lynx Web browser and various front ends to Unix. Experience seems to say ``No; we've tried using them and they can't keep up''. But most often the limit ations are not in the terminal or the terminal section of the desktop system; they're in poorly- done configuration files and databases, especially Termcap and Terminfo entries. Necessary HazardsTermcap and the later Terminfo started out as a great concept, even a necessity. When display terminals moved beyond the ``glass TTY'' stage, more control of the screen was needed than could be provided by the 32 ASCII control characters, and every new terminal seemed to have a different set of escape control sequences for the additional functions. To let a full-screen program work with more than one or a few models of terminals, it was necessary to create a database of different terminals' idiosyncratic control sequences, so a program could look up what it needed to know about whatever terminal it was connected to. But these databases have been shakey from the start. Back then it was often the case that, while starry -eyed hardware engineers were building terminals with capabilities galore, the software department was more pessimistic. Someone in software would say, "Our customers don't need half those features --don't bother to write Termcap items for the stuff they won't use because it would only get them in trouble". That's if we were lucky--otherwise the terminal manufacturer wasn't concerned with Unix and released his product with no Termcap entry at all. Then one of the first Unix-using buyers would cobble up a bare-bones Termcap entry to meet personal needs, start passing it around among friends, eventually post it on the net--and so a miserably inadequate but quasi-official standard was born. When a terminal's performance is inadequate or erratic on full-screen programs, a little detective work starting with Termcap or Terminfo will very often set things right, and having no documentation for the terminal is usually not a fatal obstacle. Sherlock Takes the CaseA good example of all thi s was my recent effort to link some vintage desktop systems to the Internet. The desktop systems were AT&T PC7300s, with small monochrome screens and little more than alphanumeric capabilities. They had been purchased at a closeout sale, without manuals, and AT&T said it had no PC7300 manuals to sell. Nonetheless, with intuition and knowledge of Berkeley Unix we'd been able to do everything we wanted to with them, up to the present. But now I wanted to connect them to the Net, via shell accounts at an access provider running Sun servers. At first we couldn't even log into the system. As soon as the menu front end came up, it printed the start of an error message and disconnected the line. A system administrator there finally gave me direct access to command-line Unix, after which I could log in, at least. Both PC7300s and Sun servers are based on Berkeley Unix, which uses Termcap, but a look around showed that these Suns had no entry for the PC7300 in their Termcap files. This wa s a surprise--most vendors use the Berkeley-standard Termcap file for all but their own terminals, and the PC7300 has been in the standard file for years. I uploaded the Termcap entry the PC7300s use internally, the system administrator installed it, and then we could get into full-screen programs, including that menu front end. But running those full-screen programs generated problems. There was some strange behavior, mostly involving character attributes such as reverse video and underlining. Ominously, this strangeness was not consistent: various surprises cropped up while running different programs. The worst problem was with Lynx, a Web browser designed for alphanumeric terminals. A Web document may have several phrases the user can click on within a single page. Because Lynx is intended for systems without mouse pointers, it is supposed to use one attribute mode to display the phrase that would be activated by pressing the return key now, and another attribute to show the phrases the user could move to with the up and down arrow keys. With our PC7300s, unfortunately, Lynx usually displayed all the phrases in the same mode: reverse video. Discouraging? Actually, the problem was halfway to being diagnosed when I thought over that symptom list. When character attributes malfunction differently in different programs, the problem is almost certain to be missing information in the Termcap or Terminfo entry. Programs that fail to find an entry telling how to produce one character attribute mode must default to another mode or skip the attribute altogether. Each programmer makes his own decision about these substitutions, so each program defaults in its own way. The Lynx problem just as certainly indicated that character attribute information was present but not correct. No sane program replaces a missing attribute with one it already uses for another purpose on the same screen. Scrutinizing the EvidenceThe first thing to do was make a working copy of the PC7300
Termcap entry, reproduced below:
s4|PC7300|unixpc|pc7300|3b1|Safari 4:\ :md=\E[1m:me=\E[0m:\ :al=\E[1L:am:bs:\ :cd=\E[0J:ce=\E[0K:cl=\E[2J\E[H:cm=\E[%i%2;%2H:co#80:\ :dc=\E[1P:dl=\E[1M:do=\E[B:ei=:ho=\E[H:\ :ic=\E[1\@:im=:kb=\10:kd=\E[B:kl=\E[D:kr=\E[C:ku=\E[A:li#24:\ :k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:k5=\EOg:k6=\EOh:k7=\EOi:k8=\EOj:\ :nd=\E[C:se=\E[m:so=\E[7m:ue=\E[m:up=\E[A:us=\E[4m:\ :EE=\E[m:BO=\E[1m:DS=\E[2m:XS=\E[9m:CV=\E[=C:CI=\E[=1C:\ :KM=/usr/lib/ua/kmap.s4: That's not quite as cryptic as it looks. The items between
the vertical bar symbols (
A pound sign (
An equal si
gn shows the character string needed to produce an
effect. For instance, in
An item with neither a
Comparing lines 2 through 8 of the Termcap entry above to my
Termcap reference
showed that there were items giving the strings needed
to turn on underlining (
The last two lines contained items from a Termcap extension called Tam , used almost exclusively on AT&T systems for drawing windows and forms. One item gave again the string that starts extra-bright characters; two others enabled dim and overstruck characters, respectively. But most programs cannot read Tam capabilities. The next question was whether the additional character attributes were missing from the PC7300's capabilities, or only from the Termcap entry. I had no PC7300 manual to consult, but I did notice that the attribute-on strings I'd found in the Termcap entry were identical except for one numeric digit in each string. Might it be that substituting other digits would bring out other attributes? To test this idea I wrote a single-line file that read
One of the items in the Tam section,
Taking ActionNext I had to make use of all this new information. I started by writing a revised Termcap entry in which every attribute I'd found got an item in both the standard and Tam vocabularies. (As far as this was possible; there is no standard Termcap item for the overstruck attribute, for instance.) Not that we could expect to encounter Tam-using programs on a Sun server, but this would let us have identical Termcap entries on the Sun serv ers and our own PC7300s, which keeps things simple. Putting new items into the existing entry only required inserting each of them in one of the lines, with a colon before and after each new item. The order of the items in a Termcap entry is not significant in operation, and human readability was already hopeless in this entry. To keep the new Tam items with the existing ones I created a new line, which required putting 8 spaces at the start of the line and escaping the ending newline with a backslash. That left the problem of blinking mode. Some programs use
blinking text, and the PC7300 has no way to blink anything but
the cursor. In the end I resolved this by setting the Termcap
blink item to a string which turns on a combination of reverse
video and dim--this produces reverse video with a screened
background. It doesn't blink, of course, but it's visibly
different from any of the other character attributes. To remind
users that this mode is what they should look for when a program
di
splays messages about ``the blinking text'', I wrote a text
file that held just the single line ``Text in this typeface
should be regarded as blinking''--with the words ``this
typeface'' surrounded by the codes that would display them in my
pseudo blink mode--and I put a line in everyone's C shell
initialization file (
With reverse video declared as a mode of its own within my revised Termcap entry, having standout mode also be reverse video was redundant. Someday we might come across a program that used both those attributes, and there would be no way for users to tell the standout-highlighted characters from the ones using reverse video under its own identity. So I revised the entry again, to make reverse video combined with extra-bright the new standout mode. Although I had less to go on in tracing the other minor
problems--most often a few stray characters here and there--I
decided to make a cursory check of the Termcap entry
for possible
causes. The entry's assertions about what the PC7300 does--
automatically wraps overlength lines, backspaces, has 80 columns
and 24 lines--I knew to be correct. I knew nothing about the
strings to move the cursor, erase all or part of the screen,
etcetera, but those are easy to test. I only needed to put the
string alleged to perform a task into a file (using actual escape
characters instead of Termcap representations), then send the
contents of the file to the screen (with
Putting it to the TestThe last question was how to put my revised Termcap entry into
effect on the Sun servers. The
If the
What I'd done so far should have cleared up most of the
character attribute problems. Testing showed that it did--Hallelujah!
No new problems had cropped up along with the improvements, so I
set all our users'
But I'd found nothing that could be causing the Lynx attribute confusion or the other misce llaneous problems not involving attributes, so I wasn't disappointed when I didn't see any improvement there. Next time I'll explain how I cracked those problems. Termcap DocumentationIf you think you just need the
But if you are about to buy Termcap documentation, consider instead
termcap & terminfo
, a book by John Strang, Linda Mui
and Tim O'Reilly that is published by O'Reilly & Associates. This
book explains both the systems named in its title without the terseness
of
My other caveat regarding these books is that they don't even
mention
ad hoc
Termcap extensions such as Tam. You may
not need to know about Tam, but if you do you'll have to find the
online
You can order O'Reilly books directly from the publisher at:
Describing Tam CapabilitiesThe Tam capability items live inside the standard Termcap entry,
usually on a few lines by themselves at the end of the entry.
But they're used only by programs that understand
the
There are just a dozen Tam items for termcap entries, and all of
them are string variables. They're expressed in standard Termcap
style: first a two-letter code to indicate what capability is being
given, then an equal
Most of the items deal with character attributes. Tam uses
Tam's use of these attribute items interacts in complex ways
with the standard Termcap items
An item
Finally, the
Letter to the AuthorJune 10, 1995 Dear Mr. Zintz: I saw and enjoyed your article ``Teaching Old Terminals New Tricks'' in UnixWorld Online, but as a former AT&T UNIXpc enthusiast (I still have several of the poor dead things lying around my house), I feel I must object to the characterization: ` `The desktop systems were AT&T PC7300s, with small monochrome screens and little more than alphanumeric capabilities.'' Well, to be honest, I can't argue with the ``small monochrome screens'', but I will take issue with the latter part. The UNIXpc had full bitmap graphics, a mouse, and a desktop windowing environment with the stock OS. Also, MGR, the Bellcore window manager--now enjoying a small resurgence in popularity with some Linux users--was available and widely used. Actually, I prefer MGR to the X11 desktop I'm using right now; unfortunately, MGR never really took off, and so lacks clients, and other support that have made X popular. Anyway, while the UNIXpc is now well past its prime, it was at one time fairly advanced, quite useful, and certainly had more than ``little more than alphanumeric capabilities.'' John R. MacMillan / Toronto, Ontario, CANADA |
Print This Page Send as e-mail |
Best of the Web
Data deduplication: Declawing the clones
Data deduplication is emerging as a critically important new arrow in the storage administrator's quiver to answer hard questions about the increasing problem in storage growth costs.
Compression, Encryption, Deduplication, and Replication: Strange Bedfellows
One of the great ironies of storage technology is the inverse relationship between efficiency and security: Adding performance or reducing storage requirements almost always results in reducing the confidentiality, integrity, or availability of a system.
WAN Optimization Whitelists and Blacklists
Optimization is a fantastic way of saving money and creating really happy customers at the same time, but it doesn't work flawlessly for all applications.
WAN Optimization as a Managed Service: It's Not About the Cost
This insight examines how organizations outsourcing their WAN optimization initiatives to a third-party go about achieving their goals for application performance, reducing operational costs, and streamlining enterprise infrastructure.






