nuttx-apps/system/termcurses
Xiang Xiao df48f0bb73 system/termcurses: Fix the compiler warning
tcurses_vt100.c: In function 'tcurses_vt100_move':
Error: tcurses_vt100.c:121:48: error: '%d' directive writing between 1 and 11 bytes into a region of size between 2 and 12 [-Werror=format-overflow=]
  121 | static const char *g_movecurs       = "\033[%d;%dH";  /* Move cursor to x,y */
      |                                                ^~
tcurses_vt100.c:121:39: note: directive argument in the range [-2147483647, 2147483647]
  121 | static const char *g_movecurs       = "\033[%d;%dH";  /* Move cursor to x,y */
      |                                       ^~~~~~~~~~~~~
tcurses_vt100.c:795:9: note: 'sprintf' output between 7 and 27 bytes into a destination of size 16
  795 |         sprintf(str, g_movecurs, row + 1, col + 1);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-07 00:58:19 +08:00
..
Kconfig apps/: Removed all references to CONFIG_DISABLE_POLL. The standard POSIX poll() can not longer be disabled. 2019-05-21 19:08:12 -06:00
Make.defs Makefile: Ken Pettit: update licenses to Apache 2021-06-07 21:35:33 -05:00
Makefile Makefile: Ken Pettit: update licenses to Apache 2021-06-07 21:35:33 -05:00
README.md Rewritten READMEs to Markdown 2020-07-25 01:01:51 -07:00
tcurses_priv.h system: update licenses to Apache 2021-06-11 02:42:05 -05:00
tcurses_vt100.c system/termcurses: Fix the compiler warning 2022-03-07 00:58:19 +08:00
termcurses.c system/termcurses: Add terminate operation into the termcurses_ops_s interface 2021-08-28 21:12:40 +08:00

System / termcurses Termcurses

Terminal emulation library for NuttX

Author: Ken Pettit
  Date: 2018-2019

The Termcurses library provides terminal emulation support for performing common screen actions such as cursor movement, foreground / background color control 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.

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.

Usage

To use the termcurses library, the routines must be initialized by calling the 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.

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.

Use with telnetd

When using termcurses with the telnet daemon, the telnet config option CONFIG_TELNET_SUPPORT_NAWS should be enabled. This option adds code to the telnet library for terminal size negotiation. Without this option, the telnet routines have no concept of the terminal size, and therefore the termcurses routines must default to 80x24 screen mode.

Use with pdcurses

When using the pdcurses termcurses support (i.e you have enabled both the 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.