anatoly techtonik anatoly techtonik - 2 months ago 7
Bash Question

Features obligatory for TERM=dumb terminal

I am looking to implement a Linux client in which connects to it through

and starts
. So I need to tell
what features I can parse from its
and how I am going to send keycodes and other stuff to its
, so that it could parse them too.

This is done with
environment variable, which I need to set to some value. If I don't set it, then programs like
start to complain:

$ mc
The TERM environment variable is unset!
$ export TERM=dumb
$ mc
Your terminal lacks the ability to clear the screen or position the cursor.

From here it is clear that
terminal don't have these two abilities, but what abilities it is still expected to have? Is there a specification or some de-facto standard about it?


Going to the source can help. The terminal database has comments. Here is a slice from that:

#### Specials
# Special "terminals".  These are used to label tty lines when you don't
# know what kind of terminal is on it.  The characteristics of an unknown
# terminal are the lowest common denominator - they look about like a ti 700.

dumb|80-column dumb tty,
        bel=^G, cr=^M, cud1=^J, ind=^J,
unknown|unknown terminal type,
        gn, use=dumb,

The "dumb" and "unknown" terminal types are assumed, but rarely used:

  • "dumb" has automargins (text "wraps" at the right margin), is assumed to have 80 columns, and an ASCII BEL and carriage return. For lack of something better, cud1 (cursor down) is an ASCII line-feed. The ind (index) value is the same, implying that text scrolls up when you reach the bottom of the screen.

    There is no cursor-addressing (cup) nor alternates (such as moving along a row or column arbitrarily).

  • "unknown" adds the "generic" flag, which marks it as unsuitable for use by curses applications. Think of it as a printer.

As for minimum requirements, that actually depends upon the individual application. ncurses can manage to move around the screen without actually having cup. It works with a half-dozen strategies. If you read the source for mvcur, you can get an idea of what it needs.

However, applications such as mc do not simply rely upon ncurses to decide if it works, since (in this case) it may link with slang (which doesn't check that closely). So mc does its own checks, which may add restrictions.

In practice, unless you choose a limited terminal description such as "dumb", most of the terminals you are likely to encounter will work.

Further reading: