Path: blob/master/Utilities/cmpdcurses/pdcurses/termattr.c
3153 views
/* PDCurses */12#include <curspriv.h>34/*man-start**************************************************************56termattr7--------89### Synopsis1011int baudrate(void);12char erasechar(void);13bool has_ic(void);14bool has_il(void);15char killchar(void);16char *longname(void);17chtype termattrs(void);18attr_t term_attrs(void);19char *termname(void);2021int erasewchar(wchar_t *ch);22int killwchar(wchar_t *ch);2324char wordchar(void);2526### Description2728baudrate() is supposed to return the output speed of the terminal. In29PDCurses, it simply returns INT_MAX.3031has_ic and has_il() return TRUE. These functions have meaning in some32other implementations of curses.3334erasechar() and killchar() return ^H and ^U, respectively -- the35ERASE and KILL characters. In other curses implementations, these may36vary by terminal type. erasewchar() and killwchar() are the wide-37character versions; they take a pointer to a location in which to38store the character, and return OK or ERR.3940longname() returns a pointer to a static area containing a verbose41description of the current terminal. The maximum length of the string42is 128 characters. It is defined only after the call to initscr() or43newterm().4445termname() returns a pointer to a static area containing a short46description of the current terminal (14 characters).4748termattrs() returns a logical OR of all video attributes supported by49the terminal.5051wordchar() is a PDCurses extension of the concept behind the52functions erasechar() and killchar(), returning the "delete word"53character, ^W.5455### Portability56X/Open ncurses NetBSD57baudrate Y Y Y58erasechar Y Y Y59has_ic Y Y Y60has_il Y Y Y61killchar Y Y Y62longname Y Y Y63termattrs Y Y Y64termname Y Y Y65erasewchar Y Y Y66killwchar Y Y Y67term_attrs Y Y Y68wordchar - - -6970**man-end****************************************************************/7172#include <string.h>73#include <limits.h>7475int baudrate(void)76{77PDC_LOG(("baudrate() - called\n"));7879return INT_MAX;80}8182char erasechar(void)83{84PDC_LOG(("erasechar() - called\n"));8586return _ECHAR; /* character delete char (^H) */87}8889bool has_ic(void)90{91PDC_LOG(("has_ic() - called\n"));9293return TRUE;94}9596bool has_il(void)97{98PDC_LOG(("has_il() - called\n"));99100return TRUE;101}102103char killchar(void)104{105PDC_LOG(("killchar() - called\n"));106107return _DLCHAR; /* line delete char (^U) */108}109110char *longname(void)111{112PDC_LOG(("longname() - called\n"));113114return ttytype + 9; /* skip "pdcurses|" */115}116117chtype termattrs(void)118{119PDC_LOG(("termattrs() - called\n"));120121return SP ? SP->termattrs : (chtype)0;122}123124attr_t term_attrs(void)125{126PDC_LOG(("term_attrs() - called\n"));127128return SP ? SP->termattrs : (attr_t)0;129}130131char *termname(void)132{133static char _termname[14] = "pdcurses";134135PDC_LOG(("termname() - called\n"));136137return _termname;138}139140char wordchar(void)141{142PDC_LOG(("wordchar() - called\n"));143144return _DWCHAR; /* word delete char */145}146147#ifdef PDC_WIDE148int erasewchar(wchar_t *ch)149{150PDC_LOG(("erasewchar() - called\n"));151152if (!ch)153return ERR;154155*ch = (wchar_t)_ECHAR;156157return OK;158}159160int killwchar(wchar_t *ch)161{162PDC_LOG(("killwchar() - called\n"));163164if (!ch)165return ERR;166167*ch = (wchar_t)_DLCHAR;168169return OK;170}171#endif172173174