drivers/wifi: Remove unnecessary data structure copy
[coreboot2.git] / payloads / libpayload / curses / PDCurses / pdcurses / termattr.c
blob7e49047b7fdcb3be57dac6ba0d340748271cc71d
1 /* Public Domain Curses */
3 #include <curspriv.h>
5 RCSID("$Id: termattr.c,v 1.54 2008/07/13 16:08:18 wmcbrine Exp $")
7 /*man-start**************************************************************
9 Name: termattr
11 Synopsis:
12 int baudrate(void);
13 char erasechar(void);
14 bool has_ic(void);
15 bool has_il(void);
16 char killchar(void);
17 char *longname(void);
18 chtype termattrs(void);
19 attr_t term_attrs(void);
20 char *termname(void);
22 int erasewchar(wchar_t *ch);
23 int killwchar(wchar_t *ch);
25 char wordchar(void);
27 Description:
28 baudrate() is supposed to return the output speed of the
29 terminal. In PDCurses, it simply returns INT_MAX.
31 has_ic and has_il() return TRUE. These functions have meaning in
32 some other implementations of curses.
34 erasechar() and killchar() return ^H and ^U, respectively -- the
35 ERASE and KILL characters. In other curses implementations,
36 these may vary by terminal type. erasewchar() and killwchar()
37 are the wide-character versions; they take a pointer to a
38 location in which to store the character, and return OK or ERR.
40 longname() returns a pointer to a static area containing a
41 verbose description of the current terminal. The maximum length
42 of the string is 128 characters. It is defined only after the
43 call to initscr() or newterm().
45 termname() returns a pointer to a static area containing a
46 short description of the current terminal (14 characters).
48 termattrs() returns a logical OR of all video attributes
49 supported by the terminal.
51 wordchar() is a PDCurses extension of the concept behind the
52 functions erasechar() and killchar(), returning the "delete
53 word" character, ^W.
55 Portability X/Open BSD SYS V
56 baudrate Y Y Y
57 erasechar Y Y Y
58 has_ic Y Y Y
59 has_il Y Y Y
60 killchar Y Y Y
61 longname Y Y Y
62 termattrs Y Y Y
63 termname Y Y Y
64 erasewchar Y
65 killwchar Y
66 term_attrs Y
67 wordchar - - -
69 **man-end****************************************************************/
71 #include <string.h>
72 #include <limits.h>
74 int baudrate(void)
76 PDC_LOG(("baudrate() - called\n"));
78 return INT_MAX;
81 char erasechar(void)
83 PDC_LOG(("erasechar() - called\n"));
85 return _ECHAR; /* character delete char (^H) */
88 bool has_ic(void)
90 PDC_LOG(("has_ic() - called\n"));
92 return TRUE;
95 bool has_il(void)
97 PDC_LOG(("has_il() - called\n"));
99 return TRUE;
102 char killchar(void)
104 PDC_LOG(("killchar() - called\n"));
106 return _DLCHAR; /* line delete char (^U) */
109 char *longname(void)
111 PDC_LOG(("longname() - called\n"));
113 return ttytype + 9; /* skip "pdcurses|" */
116 chtype termattrs(void)
118 chtype temp = A_BLINK | A_BOLD | A_INVIS | A_REVERSE | A_UNDERLINE;
120 /* note: blink is bold background on some platforms */
122 PDC_LOG(("termattrs() - called\n"));
124 if (!SP->mono)
125 temp |= A_COLOR;
127 return temp;
130 attr_t term_attrs(void)
132 PDC_LOG(("term_attrs() - called\n"));
134 return WA_BLINK | WA_BOLD | WA_INVIS | WA_LEFT | WA_REVERSE |
135 WA_RIGHT | WA_UNDERLINE;
138 const char *termname(void)
140 PDC_LOG(("termname() - called\n"));
142 return "pdcurses";
145 char wordchar(void)
147 PDC_LOG(("wordchar() - called\n"));
149 return _DWCHAR; /* word delete char */
152 #ifdef PDC_WIDE
153 int erasewchar(wchar_t *ch)
155 PDC_LOG(("erasewchar() - called\n"));
157 if (!ch)
158 return ERR;
160 *ch = (wchar_t)_ECHAR;
162 return OK;
165 int killwchar(wchar_t *ch)
167 PDC_LOG(("killwchar() - called\n"));
169 if (!ch)
170 return ERR;
172 *ch = (wchar_t)_DLCHAR;
174 return OK;
176 #endif