vc-reset-tty — chain-load utility for resetting virtual console terminals
vc-reset-tty
[--hard-reset] [--no-newline] [--no-utf8] [--no-tostop] [--text-mode] {next-prog
}
vc-reset-tty is a chain-loading utility that attempts to initialize the terminal and line discipline state of the terminal that is on its standard output, and then (if successful) chain loads to next-prog
with the execvp(3) function.
If its standard output is not a terminal, it aborts without attempting to initialize anything.
next-prog
may contain its own command line options, which vc-reset-tty will ignore.
vc-reset-tty makes no alteration to process state.
It initializes the terminal by resetting the line discipline and then outputting the escape sequences appropriate to the terminal type. Unless the --no-newline option is set a newline is printed afterwards. This program is thus much the same as the BSD reset(1) command, except that it chain-loads to another command and has slightly different defaults.
The line discipline is reset to approximately the same state as would be done by the stty sane command, with several exceptions:
The istrip
option is not set.
8-bit cleanliness is the norm nowadays.
The tostop
option is set, unless the --no-tostop command-line option has been used.
Job control is the norm nowadays.
The iutf8
option is set, unless the --no-utf8 command-line option has been used.
UTF-8 is the norm nowadays, and console-terminal-emulator(1) sends UTF-8 input sequences to virtual terminals.
vc-reset-tty writes escape sequences to soft (re-)initialize the terminal state, including tabstops, margins, windows, scrolling mode, and overstrike mode. Tabstops are reset to every 8th column. If the --hard-reset command line option is used, additional escape sequences are written to hard reset the terminal from an unknown state, including resetting the palette.
vc-reset-tty ignores the TERM
environment variable and does not use terminfo(3).
Rather, it hardwires the terminal escape sequences to use to control the terminal, since they are fixed for each virtual console.
If the standard output is not a virtual console, odd things may happen.
If the --text-mode command line option is used, vc-reset-tty will use operating-system-specific ioctl(2) calls to attempt to switch the virtual console to text mode. This is only suitable for use with kernel virtual consoles.