curs_termattrs(3X)
π curs_termattrs β terminal attributes, but make it a group chat π
okay bestie, welcome to curs_termattrs from the ncurses library calls section β¨ this is the page where you find out literally everything about what your terminal can and can't do. baud rate, erase char, kill char, whether it can insert lines, what its long fancy name is β all of it. let's go π¦
πΈ NAME πΈ
baudrate, erasechar, erasewchar, has_ic, has_il, killchar, killwchar, longname, term_attrs, termattrs, termname β get and set terminal attributes with curses π
β¨ SYNOPSIS β¨
#include <curses.h>
int baudrate(void);
char erasechar(void);
int erasewchar(wchar_t * wc);
bool has_ic(void);
bool has_il(void);
char killchar(void);
int killwchar(wchar_t * wc);
char * longname(void);
attr_t term_attrs(void);
chtype termattrs(void);
char * termname(void);
π DESCRIPTION π
baudrate β how fast is she going ποΈ
baudrate returns the line speed of the terminal, an integer value measured in bits per second β like, say, 9600. no cap, that's the actual unit. π«
erasechar, erasewchar β the delete key energy
erasechar returns the terminal's erase character.
erasewchar stores the erase character in the location referenced by wc. and here's the thing bestie: if no erase character has been defined, it fails, and the location referenced by wc is not changed. so don't go assuming something got written there π
has_ic, has_il β capability check, main character edition
has_ic returns TRUE if the terminal has insert- and delete-character capabilities.
has_il returns TRUE if the terminal has insert- and delete-line capabilities, or can simulate them using scrolling regions. lowkey you might use this to figure out whether it would be appropriate to use scrollok(3X) to turn on scrolling. π
killchar, killwchar β the line-kill bestie
killchar returns the terminal's line kill character.
killwchar stores the line-kill character in the location referenced by wc. and same deal as before: if no line-kill character has been defined, it fails and the location referenced by wc is not changed. π«Ά
longname β the full government name, periodt
longname returns a pointer to static storage containing a verbose description of the terminal being managed by curses. the maximum length of a verbose description is 128 characters. π
now listen closely because this part matters: the storage is populated only after initscr(3X) or newterm(3X) is called. and it gets overwritten by each call to newterm and is not restored by set_term(3X). so if you're gonna use longname with multiple terminals, you better save its contents between calls to initscr or newterm. it's giving "shared locker, one key" π
termattrs, term_attrs β the vibe check of video attributes
so here's the situation: if a given terminal doesn't support a video attribute that an application program is trying to use, curses may substitute a different video attribute for it. termattrs and term_attrs return a logical "or" of all video attributes supported by the terminal, using A_ and WA_ constants respectively. π
this info is useful when a curses program needs complete control over the appearance of the screen. total main character energy over your own pixels. π
termname β who even are you
termname returns the terminal name used by setupterm(3X). iconic. β
π«Ά RETURN VALUE π«Ά
longname and termname return NULL on error.
Functions that return an integer return ERR upon failure and OK upon success. π (the ERR, not the OK, obviously)
π NOTES π
erasewchar, killwchar, and term_attrs are part of ncurses's wide-character API, and are not available in its non-wide-character configuration. so if you're running the narrow build, those three are simply not invited to the party π
termattrs may be implemented as a macro. iykyk. β οΈ
π PORTABILITY π
X/Open Curses Issue 4 describes these functions.
SVr4 describes a successful return value only as "an integer value other than ERR". like, okay, be vague about it then π
Most versions of curses truncate the string returned by termname to 14 characters. 14!! not 15, bestie. fourteen. π
π HISTORY π
- 4BSD (1980) introduced
longname. - SVr2 (1984) added
baudrate,erasechar,killchar,has_ic, andhas_il. - SVr3 (1987) supplied
termname. later that year, SVr3.1 broughttermattrs. - X/Open Curses Issue 4 (1995) specified
erasewchar,killwchar, andterm_attrs.
the way this page has been cooking since 1980 and is still relevantβ¦ ate and left no crumbs π
π SEE ALSO π
curses(3X)curs_initscr(3X)curs_outopts(3X)
and that's the whole page, bestie!! π¦ this was curs_termattrs(3X) from ncurses 6.6, dated 2025-08-23. go forth and interrogate your terminal about its baud rate, its kill char, and its full name. she'll tell you everything. mwah πβ¨π
π¦ where this page comes from
- alpine 3.24: ncurses-doc 6.6_p20260516-r0 Β· X11
- arch rolling: ncurses 6.6-2 Β· MIT-open-group
- fedora 44: ncurses-devel 6.6-1.fc44 Β· MIT-open-group
- fedora 44: ncurses-devel 6.6-1.fc44 Β· MIT-open-group
- Copyright 2018-2024,2025 Thomas E. Dickey
- Copyright 1998-2010,2015 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms