2020-07-23 15:19:35 +02:00
|
|
|
# System / `termcurses` Termcurses
|
2019-01-05 19:40:26 +01:00
|
|
|
|
2020-07-23 15:19:35 +02:00
|
|
|
Terminal emulation library for NuttX
|
|
|
|
|
|
|
|
```
|
|
|
|
Author: Ken Pettit
|
|
|
|
Date: 2018-2019
|
|
|
|
```
|
2019-01-05 19:40:26 +01:00
|
|
|
|
|
|
|
The Termcurses library provides terminal emulation support for performing common
|
|
|
|
screen actions such as cursor movement, foreground / background color control
|
2020-07-23 15:19:35 +02:00
|
|
|
and keyboard escape sequence mapping. The initial release supports only `vt100`
|
|
|
|
/ `ansi` terminal types, but the library architecture has an extensible
|
|
|
|
interface to allow support for additional emulation types if needed.
|
2019-01-05 19:40:26 +01:00
|
|
|
|
2020-07-23 15:19:35 +02:00
|
|
|
The library can be used standalone or in conjunction with the
|
|
|
|
`apps/graphics/pdcurses` libraries. The pdcurses libraries have been updated
|
|
|
|
with a _termcurses_ config option which fully integrates the termcurses library
|
|
|
|
automatically.
|
2019-01-05 19:40:26 +01:00
|
|
|
|
2020-07-23 15:19:35 +02:00
|
|
|
## Usage
|
2019-01-05 19:40:26 +01:00
|
|
|
|
2020-01-31 15:13:45 +01:00
|
|
|
To use the termcurses library, the routines must be initialized by calling the
|
2020-07-23 15:19:35 +02:00
|
|
|
`termcurses_initterm()` function. This routine accepts a terminal type string
|
|
|
|
identifying the type of terminal emulation support requested. If a `NULL`
|
|
|
|
pointer is passed, then the routine will check for a `TERM` environment variable
|
|
|
|
and set the terminal type based on that string. If the emulation type still
|
|
|
|
cannot be determined, the routine will default to `vt100` emulation type.
|
2019-01-05 19:40:26 +01:00
|
|
|
|
2020-07-23 15:19:35 +02:00
|
|
|
Upon successful initialization, the `termcurses_initterm()` function will
|
|
|
|
allocate an new terminal context which must be passed with all future termcurses
|
|
|
|
library functions. When this context is no longer needed, the
|
|
|
|
`termcurses_deinitterm()` routine should be called for proper freeing and
|
|
|
|
terminal teardown.
|
2019-01-05 19:40:26 +01:00
|
|
|
|
2020-07-23 15:19:35 +02:00
|
|
|
## Use with `telnetd`
|
2019-01-05 19:40:26 +01:00
|
|
|
|
2020-01-31 15:13:45 +01:00
|
|
|
When using termcurses with the telnet daemon, the telnet config option
|
2020-07-23 15:19:35 +02:00
|
|
|
`CONFIG_TELNET_SUPPORT_NAWS` should be enabled. This option adds code to the
|
|
|
|
telnet library for terminal size negotiation. Without this option, the telnet
|
2019-01-05 19:40:26 +01:00
|
|
|
routines have no concept of the terminal size, and therefore the termcurses
|
2020-07-23 15:19:35 +02:00
|
|
|
routines must default to `80x24` screen mode.
|
2019-01-05 19:40:26 +01:00
|
|
|
|
2020-07-23 15:19:35 +02:00
|
|
|
## Use with `pdcurses`
|
2019-01-05 19:40:26 +01:00
|
|
|
|
|
|
|
When using the pdcurses termcurses support (i.e you have enabled both the
|
2020-07-23 15:19:35 +02:00
|
|
|
`CONFIG_PDCURSES` and `CONFIG_TERMCURSES` options),, the pdcurses input device
|
|
|
|
should be selected to be `TERMINPUT` (i.e. set `CONFIG_PDCURSES_TERMINPUT=y`).
|
|
|
|
This causes the pdcurses keyboard input logic to use `termcurses_getkeycode()`
|
|
|
|
routine for curses input.
|