QTERM(1) General Commands Manual QTERM(1)
qterm - Query Terminal
qterm [ +|-alt ] [ +|-always ] [ +|-longname ] [ +|-quiet ] [ +|-sent ] [ +|-timeout ] [ +|-usrtab ] [ +|-watch ] [ +|-systab ] [ -wait
interval ] [ -file tabfile ]
Qterm is used to query a terminal to determine its name. This is done by sending a special sequence to the terminal, reading in a
response, and comparing it against a table of possible responses. The ``name'' printed to standard output should be one found in the term-
cap(5) (or terminfo(5) for System V systems) database.
For csh(1) users, putting a line in your .login file such as:
setenv TERM `qterm`
should automagically set your terminal type. For sh(1) users, putting these lines in your .profile file should set your terminal type:
By default, qterm uses the system tab file /usr/local/lib/qtermtab to obtain information for querying terminals.
+alt Use the alternate string ``<ESCAPE>[c'' when asking the terminal to identify itself. This string is recognized by most ANSI compat-
-alt Don't use the alternate string, but the string found in the tabfile being used. This is the default.
Always send the terminal query string. Normally the query string is only sent if it differs from the last string sent.
Only send the terminal query string if it differs from the last string sent. This is the default.
Use <tabfile> to find information for querying the terminal.
Print only the long (verbose) terminal name.
Don't print the long (verbose) terminal name. This is the default.
+quiet Be quiet and only print the terminal name to standard output.
-quiet Don't be quiet and only print the terminal name to standard output. This is the default.
+watch Watch the characters sent and recieved to the terminal.
-watch Don't watch the characters sent and recieved to the terminal. This is the default.
Wait for timeout when listening for response string. This is useful if the first entry in a qtermtab doesn't have a response string
with an ending character that is common with the rest of the qtermtab entries.
Disable waiting for timeout when listening for response string. This is the default.
Use $HOME/.qtermtab to find information for querying the terminal.
Don't use $HOME/.qtermtab to find information for querying the terminal. This is the default.
+sent Display the final response sent from the terminal in a ``nice'' fashion.
-sent Don't display the final response sent from the terminal. This is the default.
Use /usr/local/lib/qtermtab to find information for querying the terminal. This is the default
Don't use system tab file to find information for querying the terminal.
Set the wait (timeout) period to interval (in seconds).
The format of the file $HOME/.qtermtab and qterm's system tab file /usr/local/lib/qtermtab, consists of four fields each seperated by white
space (tabs and/or spaces). The first field is the string that should be used to query the terminal. The second field is the string to
expect in response to the query. The third field is the terminal name (compatible with termcap(5)) to print to standard output. The
fourth field is optional and may contain a description of the exact manufacturer and model name of the terminal to be used in a message
printed to standard error.
Blank lines or lines starting with the character ``#'' are ignored and may be used as comment lines. A character preceeded by a ``^'' is
taken to mean the control character. (i.e. ``^['' is interpretted as an <ESCAPE>). Both the send and receive (first and second) fields
may contain octal values preceeded by a `'. (i.e. <ESCAPE> can be represented by ` 33'.)
The ``expect'' (second) field can be a regular expression denoted by a leading backslash (`'). i.e. "^[[123" matches the string "^[[123",
whereas "^[" matches "^[1" or "^[2" or "^[3". See ed(1) for regular expression information.
Below is a sample file:
# QTerm File
^[Z ^[[?1;1c vt100 A vt100 with STP
^[Z ^[[?1;2c vt100 ANSI/VT100 Clone
^[Z ^[[?1;3c vt100 A vt100 with AVO and STP
^[Z ^[[?1;4c vt100 A vt100 with GPO
^[Z ^[iBO z29 Zenith in Zenith Mode
Michael A. Cooper,
University Computing Services,
University of Southern California.
/usr/local/lib/qtermtab - System table
$HOME/.qtermtab - User's table
/etc/termcap - termcap(5) database
csh(1), ed(1), sh(1), termcap(5)
Terminal not recognized - defaults to dumb.
QTerm did not receive a response from the terminal, or the response did not match any that qterm has stored internally. Use the
+watch option to check to see which is the case.
Many terminals do not send a response at all.
6 November 1990 QTERM(1)