vt/ansi codes

Malcolm Kay malcolm.kay at internode.on.net
Tue Jul 1 07:56:24 PDT 2003


I wonder with this is really relavent to FreeBSD questions.
But in any case here is my 2 cents worth.

On Tue, 1 Jul 2003 16:59, abc at ai1.anchorage.mtaonline.net wrote:
> i am trying to develop terminal I/O based code,
> and found myself meandering down a path
> to acquire terminal knowledge (i don't
> need to be told of SLang/ncurses/...).
>

Have you looked at termcap and terminfo,
which of course underpin curses/ncurses.

> i can't readily find an answer to this, but
> i am assuming DEC terminals don't scroll left/right?
> i've never used a "terminal", so i wouldn't know.
>
> there are ANSI escape codes that would be great to use,
> but from the knowledge i have been able to acquire, it
> appears vtXXX stuff is a fairly "lacking" subset of
> ANSI 3.64 terminal display functions.  there's many
> aspects of ANSI 3.64 that would make display updates
> over serial connections MUCH more efficient than
> using vtXXX only codes.  any comments providing

It doesn't really matter what standards might be defined;
the important issue is what functions commonly available
terminals and terminal emulations have.

> a better understanding about this would be
> appreciated - cuz i'd hate to write a bunch
> of inefficient code just to find out i *could*
> scroll left/right with an ANSI escape sequence, etc.
>
> my goal is to generate a minimal set of
> reliable cross-platform ANSI escape codes
> one can use without fear of incompatibility.
> maybe this is an impossibility - i dunno - but
> there are a few sequences that seem to permeate
> most data sheets.

There are an enormous variety of terminals and terminal 
emulations which have very little in the way of a common 
subset of functions. If you must use one common subset
then you had best stick to VT100, I guess that will get you 
into between 1/3 and 2/3 of the terminals and emulations 
out there.

Unix and same other OS have dealt with the problem 
by using databases of terminal information - termcap 
and/or terminfo - so that terminals with different control 
sequences can be managed by the same software and 
the software doesn't  need prior knowledge of the specific 
control codes.

>
> as i read that this ANSI stuff was done way
> back in 1979 - before i bought my Apple 2e,
> i can't help but "gawk" with disbelief as
> i find UNIX vtXXX terminal stuff to still be
> fairly primitive a quarter century later.
> i mean, an entire screen shouldn't have to
> be sent over a serial line just to move a
> cursor past the rightmost column in 2003 :)
>

In 1979 to send a full screen of say 2000 characters 
took perhaps 1 to 5 minutes, now in a similar situation we
commonly send that in 20 to 100 milliseconds so the 
problem of dealing with different standards is largely 
circumvented by using less in the way
of fancy functions and instead just redrawing the screen.

Now-a-days graphic displays generally get more attention
(not that I think this is necessarily good) and means of updating 
these with respect to the available bandwidth is receiving 
considerable attention.

> also, i assume:
>
>     ioctl.h     struct winsize, and
>     termios.h   struct termios
>
> are available in one form or another on most
> platforms?  is the "RAW" termios state
> a cross-platform state?  or is it a
> BSD specific state?
>
> thank you (please ditto any replies off-list).


Malcolm Kay


More information about the freebsd-questions mailing list