Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > T

ttytype(1)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

ttytype — terminal identification program

SYNOPSIS

ttytype [-apsv] [-t type]

DESCRIPTION

ttytype automatically identifies the current terminal type by sending an identification request sequence to the terminal. This method works for local, modem, and remote terminal connections, as well as for the hpterm and xterm terminal emulators.

Once the terminal has been identified, ttytype prints the terminal's type to the standard output (see terminfo(4)). This string is usually used as the value for the TERM environment variable.

If ttytype is unable to determine the correct terminal type, it prompts the user for the correct terminal identification string.

Options

ttytype recognizes the following options:

-a

Causes ttytype to return an ID of "unknown" instead of prompting for the terminal type if auto-identification fails. If this option is not present, ttytype interactively prompts the user for the terminal type if it is unable to determine the correct type automatically.

-p

Causes ttytype to prompt for the terminal type before it sends the terminal identification request sequence. If the user responds with only a carriage return, ttytype proceeds with the automatic terminal identification process. Any other response is taken as the correct terminal type. Note that the LINES and COLUMNS variables are not set if the user manually enters a terminal type.

The -p option is normally used only for terminals that do not behave well when presented with ttytype's terminal identification request sequence. It gives the user a chance to respond with the correct terminal type before any escape sequences are sent that could have an adverse effect on the terminal.

The -a option can be used in conjunction with the -p option. The -a option only inhibits interactive prompting after ttytype has failed to identify the terminal by other means.

-s

Tells ttytype to print a series of shell commands to set the TERM, LINES, and COLUMNS environment variables to appropriate values. In addition, the variable ERASE is set to the two-character sequence representing the appropriate erase character for the terminal (DEL for ANSI terminals, backspace for all others). This two-character sequence can then be used as an argument to stty or tset (see stty(1) and tset(1)).

The SHELL environment variable is consulted to see which shell syntax to use for setting the environment variables. This output is normally used with a command of the form:

eval `ttytype -s`

-t type

ttytype normally attempts identification of Wyse, ANSI and HP terminals. The -t type argument can be used to restrict the inquiry to that required for terminals of the specified type. The accepted types are ansi, hp, and wyse. Multiple -t options can be specified.

-v

Enable verbose messages to standard error.

Notes

Use of the -s option is highly recommended because many terminals support variable-size displays. This option provides the only means for automatically configuring the user environment in such a manner that applications can handle these terminals correctly. Note that LINES and COLUMNS are not set if the -p option is used and the user manually enters a terminal type.

The following steps are performed in the order indicated when identifying a terminal:

1.

ttytype tries the Wyse 30/50/60 id request sequence.

2.

ttytype tries the standard ANSI ID request sequence. If a response is received, it is converted to a string according to an internal table.

3.

ttytype tries the HP id request sequence.

4.

If none of the above steps succeed, ttytype prompts interactively for the correct terminal type unless the -a option has been given.

ttytype may skip one or more of the first three steps, depending on the presence of -t options.

The HP ID request sequence can switch some ANSI terminals into an unexpected operating mode. Recovery from such a condition sometimes requires cycling power on the terminal. To avoid this problem, ttytype always sends the HP identification sequence last.

EXAMPLES

ttytype is most commonly used as part of the login sequence. The following shell script fragment can be used during login shell initialization:

# # If TERM is not set, see if our port is listed in /etc/ttytype. # If /etc/ttytype doesn't have information for our port, run # ttytype(1) to try to determine the type of terminal we have. # # To have ttytype(1) prompt for the terminal type before trying # to automatically identify the terminal, add the "-p" option # to the "ttytype -s" command below. # if [ -z "$TERM" -o "$TERM" = network ]; then unset TERM eval `tset -s -Q` if [ -z "$TERM" -o "$TERM" = unknown ]; then eval `ttytype -s` tset -Q -e ${ERASE:-\^h} $TERM fi fi

WARNINGS

The terminal identification sequences sent by ttytype can cause unexpected behavior on terminals other than the Wyse 30/50/60, standard ANSI or HP terminals. If you have such terminals in your configuration, use the -t or -p options to prevent ttytype from sending sequences that cause unexpected behavior.

AUTHOR

ttytype was developed by HP.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.