termdef

Display or set the terminal type (QNX)

Syntax:

termdef [-c command] [-I] [-e] [terminal_type]

termdef -s [terminal_type]

termdef - [terminal_type]

Runs on:

QNX Neutrino

Options:

-
Write the current terminal type to the standard output. If a terminal type is specified, write the new type to the standard output.
-c command
After setting up the terminal type, start up command instead of invoking the /bin/login -p command.
-e
Instead of prompting for a terminal type, use the terminal type currently defined by the TERM environment variable. With this option, termdef leaves the TERM variable alone, but sends any necessary initialization sequences to the terminal and sets the appropriate stty sequences for command-line editing.
-I
Don't send terminal initialization sequences. When -I isn't given, termdef writes any terminal initialization sequences to the standard output, if required for the terminal type.
-s
Write to the standard output the Shell command for setting TERM to the new terminal type. If no terminal type is specified, you'll be prompted for one. If you enclose the termdef command in backquotes, this option will let you set the TERM variable without exiting the Shell (see examples).
terminal_type
The terminal type to be used. If terminal_type is included, the user isn't prompted for a terminal type. This overrides the -e option.

Description:

The termdef utility is used for setting and querying the terminal type. It can be used from tinit, where it will establish the terminal type and then exec() into another command (usually login). It can also be used inside the shell to set or query the terminal type currently being used (termdef - or termdef -s).

Using the specified terminal type (or the type currently defined by the TERM environment variable if -e is given), termdef:

Having configured the tty, termdef exec()s into a command that inherits the TERM environment variable from termdef. By default, this command is:

/bin/login -p

To use another command, you specify the -c option.

If a terminal type isn't specified or if -e isn't given, the user will be prompted for the terminal type. The user can obtain a list of valid terminal types by pressing Enter or by entering an invalid terminal type.

Specifying the -e option or a terminal type on the command line normally prevents the user from being prompted. However, if the terminal type defined by TERM is invalid, termdef displays a warning message and the user is prompted for a terminal type, as if -e weren't specified.

When invoked without the - or -s options, termdef establishes a terminal type and exec()s into another command (login, by default).

Using termdef from the shell

You can use termdef from the shell in a manner similar to the UNIX tset utility. To display the current terminal type, use:

termdef -

To change the terminal type, use one of the following:

This command: Will:
termdef - terminal_type Write the new terminal_type to the standard output
termdef -s terminal_type Write the shell command for setting TERM to the standard output
termdef -s Do the same as the above command but prompt for the terminal type

Examples:

sysinit examples in conjunction with tinit

Set up ser2 and ser3 to prompt for a terminal type, and exec() into login once the terminal type is established:

tinit -c "termdef" -T ser2 ser3 &

Assuming ser1 has a VT100 terminal on it (hardwired), have termdef set up the tty and TERM variable, then exec() into login, without prompting for terminal type:

tinit -c "termdef vt100" -T ser1 &

or:

tinit -c "termdef -e" -T ser1 TERM=vt100 &

Command-line examples

Display the terminal type:

termdef -

or:

echo $TERM

Change the terminal type to VT100:

export TERM=`termdef - vt100`

or:

`termdef -s vt100`

Prompt the user to specify a new terminal type:

`termdef -s`

Exit status:

0
The termdef command was started with valid command parameters, but may or may not have been successful. If unsuccessful, termdef writes diagnostic messages to standard error.
>0
Invalid command-line options were supplied.

See also:

infocmp, stty, tic, tinit