Last change
on this file was 272, checked in by bird, 22 years ago |
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
File size:
1.1 KB
|
Line | |
---|
1 | #include <io.h>
|
---|
2 | #include <fcntl.h>
|
---|
3 | #include <sys/termio.h>
|
---|
4 |
|
---|
5 | #include "curses.h"
|
---|
6 |
|
---|
7 |
|
---|
8 | static struct termio tio;
|
---|
9 |
|
---|
10 | int _setraw(int on)
|
---|
11 | {
|
---|
12 | if ( !(on & 2) )
|
---|
13 | {
|
---|
14 | setmode(0, (on & 1) ? O_BINARY : O_TEXT);
|
---|
15 | _pfast = (on & 1) || !(_tty.c_iflag & ICRNL);
|
---|
16 | }
|
---|
17 | _rawmode = (on & 1);
|
---|
18 | _tty.c_lflag &= ~IDEFAULT;
|
---|
19 | if ( (on & 1) )
|
---|
20 | _tty.c_lflag &= ~ICANON;
|
---|
21 | else
|
---|
22 | _tty.c_lflag |= ICANON;
|
---|
23 | ioctl(_tty_ch, TCSETA, &_tty);
|
---|
24 | return 0;
|
---|
25 | }
|
---|
26 |
|
---|
27 | int _setecho(int on)
|
---|
28 | {
|
---|
29 | _echoit = on;
|
---|
30 | if ( on )
|
---|
31 | _tty.c_lflag |= ECHO;
|
---|
32 | else
|
---|
33 | _tty.c_lflag &= ~ECHO;
|
---|
34 | ioctl (0, TCSETA, &_tty);
|
---|
35 | return 0;
|
---|
36 | }
|
---|
37 |
|
---|
38 | int _setnl(int on)
|
---|
39 | {
|
---|
40 | _pfast = on ? _rawmode : TRUE;
|
---|
41 | if ( on )
|
---|
42 | _tty.c_iflag |= ICRNL;
|
---|
43 | else
|
---|
44 | _tty.c_iflag &= ~ICRNL;
|
---|
45 | ioctl (0, TCSETA, &_tty);
|
---|
46 | return 0;
|
---|
47 | }
|
---|
48 |
|
---|
49 | savetty()
|
---|
50 | {
|
---|
51 | ioctl (0, TCGETA, &tio);
|
---|
52 | return 0;
|
---|
53 | }
|
---|
54 |
|
---|
55 | resetty()
|
---|
56 | {
|
---|
57 | ioctl (0, TCSETA, &tio);
|
---|
58 | _echoit = (tio.c_lflag & ECHO) == ECHO;
|
---|
59 | _rawmode = (tio.c_iflag & ICANON) == 0;
|
---|
60 | _pfast = (tio.c_iflag & ICRNL) ? _rawmode : TRUE;
|
---|
61 | return 0;
|
---|
62 | }
|
---|
63 |
|
---|
64 | erasechar()
|
---|
65 | {
|
---|
66 | return '\b';
|
---|
67 | }
|
---|
68 |
|
---|
69 | killchar()
|
---|
70 | {
|
---|
71 | return 127;
|
---|
72 | }
|
---|
73 |
|
---|
74 | baudrate()
|
---|
75 | {
|
---|
76 | return B38400;
|
---|
77 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.