source: trunk/minix/lib/curses/setterm.c@ 12

Last change on this file since 12 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 1.2 KB
Line 
1#include <curses.h>
2#include "curspriv.h"
3
4_PROTOTYPE( static void ttysetflags, (void) );
5
6static void ttysetflags()
7{
8 _tty.c_iflag |= ICRNL | IXON;
9 _tty.c_oflag |= OPOST | ONLCR;
10 _tty.c_lflag |= ECHO | ICANON | IEXTEN | ISIG;
11
12 if (_cursvar.rawmode) {
13 _tty.c_iflag &= ~(ICRNL | IXON);
14 _tty.c_oflag &= ~(OPOST);
15 _tty.c_lflag &= ~(ICANON | IEXTEN | ISIG);
16 }
17 if (_cursvar.cbrkmode) {
18 _tty.c_lflag &= ~(ICANON);
19 }
20 if (!_cursvar.echoit) {
21 _tty.c_lflag &= ~(ECHO | ECHONL);
22 }
23 if (NONL) {
24 _tty.c_iflag &= ~(ICRNL);
25 _tty.c_oflag &= ~(ONLCR);
26 }
27 tcsetattr(0, TCSANOW, &_tty);
28} /* ttysetflags */
29
30void raw()
31{
32 _cursvar.rawmode = TRUE;
33 ttysetflags();
34} /* raw */
35
36void noraw()
37{
38 _cursvar.rawmode = FALSE;
39 ttysetflags();
40} /* noraw */
41
42void echo()
43{
44 _cursvar.echoit = TRUE;
45 ttysetflags();
46}
47
48void noecho()
49{
50 _cursvar.echoit = FALSE;
51 ttysetflags();
52}
53
54void nl()
55{
56 NONL = FALSE;
57 ttysetflags();
58} /* nl */
59
60void nonl()
61{
62 NONL = TRUE;
63 ttysetflags();
64} /* nonl */
65
66void cbreak()
67{
68 _cursvar.cbrkmode = TRUE;
69 ttysetflags();
70} /* cbreak */
71
72void nocbreak()
73{
74 _cursvar.cbrkmode = FALSE;
75 ttysetflags();
76} /* nocbreak */
Note: See TracBrowser for help on using the repository browser.