Mercurial > hg > early-roguelike
comparison srogue/bsdtty.c @ 36:2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
author | elwin |
---|---|
date | Thu, 25 Nov 2010 12:21:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
35:05018c63a721 | 36:2128c7dc8a40 |
---|---|
1 /* | |
2 * Super-Rogue | |
3 * Copyright (C) 1984 Robert D. Kindelberger | |
4 * All rights reserved. | |
5 * | |
6 * See the file LICENSE.TXT for full copyright and licensing information. | |
7 */ | |
8 | |
9 #include "rogue.h" | |
10 | |
11 extern bool NONL; | |
12 | |
13 raw() | |
14 { | |
15 /* | |
16 VERSION 5.0 | |
17 _tty.c_lflag &= ~ICANON; | |
18 _tty.c_cc[VMIN] = 1; | |
19 _tty.c_cc[VTIME] = 255; | |
20 _tty.c_oflag &= ~OPOST; | |
21 */ | |
22 _rawmode = TRUE; | |
23 _tty.sg_flags |= CBREAK; | |
24 ioctl(_tty_ch, TIOCSETN, &_tty); | |
25 } | |
26 | |
27 | |
28 noraw() | |
29 { | |
30 /* | |
31 VERSION 5.0 | |
32 _tty.c_lflag |= ICANON; | |
33 _tty.c_cc[VMIN] = _res_flg.c_cc[VMIN]; | |
34 _tty.c_cc[VTIME] = _res_flg.c_cc[VTIME]; | |
35 _tty.c_oflag |= OPOST; | |
36 */ | |
37 _rawmode = FALSE; | |
38 _tty.sg_flags &= ~CBREAK; | |
39 ioctl(_tty_ch, TIOCSETN, &_tty); | |
40 } | |
41 | |
42 | |
43 crmode() | |
44 { | |
45 /* | |
46 VERSION 5.0 | |
47 _tty.c_lflag &= ~ICANON; | |
48 _tty.c_oflag |= ONLCR; | |
49 _tty.c_cc[VMIN] = 1; | |
50 _tty.c_cc[VTIME]=255; | |
51 */ | |
52 _rawmode = TRUE; | |
53 _tty.sg_flags |= (CBREAK | CRMOD); | |
54 ioctl(_tty_ch, TIOCSETN, &_tty); | |
55 } | |
56 | |
57 | |
58 nocrmode() | |
59 { | |
60 /* | |
61 _tty.c_lflag |= ICANON; | |
62 _tty.c_cc[VMIN]=_res_flg.c_cc[VMIN]; | |
63 _tty.c_cc[VTIME]=_res_flg.c_cc[VTIME]; | |
64 */ | |
65 _rawmode = FALSE; | |
66 _tty.sg_flags &= ~CBREAK; | |
67 ioctl(_tty_ch, TIOCSETN, &_tty); | |
68 } | |
69 | |
70 | |
71 echo() | |
72 { | |
73 _tty.sg_flags |= ECHO; | |
74 _echoit=TRUE; | |
75 ioctl(_tty_ch, TIOCSETN, &_tty); | |
76 } | |
77 | |
78 noecho() | |
79 { | |
80 _tty.sg_flags &= ~ECHO; | |
81 _echoit = FALSE; | |
82 ioctl(_tty_ch, TIOCSETN, &_tty); | |
83 } | |
84 | |
85 | |
86 nl() | |
87 { | |
88 /* | |
89 VERSION 5.0 | |
90 _tty.c_iflag |= ICRNL; | |
91 _tty.c_oflag |= ONLCR; | |
92 */ | |
93 _tty.sg_flags |= CRMOD; | |
94 NONL = TRUE; | |
95 ioctl(_tty_ch, TIOCSETN, &_tty); | |
96 } | |
97 | |
98 | |
99 nonl() | |
100 { | |
101 /* | |
102 VERSION 5.0 | |
103 _tty.c_iflag &= ~ICRNL; | |
104 _tty.c_oflag &= ~ONLCR; | |
105 */ | |
106 _tty.sg_flags &= ~CRMOD; | |
107 NONL = FALSE; | |
108 ioctl(_tty_ch, TIOCSETN, &_tty); | |
109 } | |
110 | |
111 savetty() | |
112 { | |
113 ioctl(_tty_ch, TIOCGETP, &_tty); | |
114 _res_flg = _tty; | |
115 } | |
116 | |
117 resetty() | |
118 { | |
119 _tty = _res_flg; | |
120 ioctl(_tty_ch, TIOCSETN, &_tty); | |
121 } |