1 | #ifndef INIT_H_ |
1 | #ifndef INIT_H_ |
2 | #define INIT_H_ |
2 | #define INIT_H_ |
3 | |
3 | |
4 | #undef CERASE /* TODO */ |
4 | /* use the fastest baud-rate */ |
5 | #define CERASE '\010' /* ^H */ |
5 | //#if defined(B4000000) |
6 | |
6 | //# define BAUDRATE B4000000 |
7 | #ifdef HAVE_XSETLOCALE |
7 | //#elif defined(B921600) |
8 | # define X_LOCALE |
8 | //# define BAUDRATE B921600 |
9 | # include <X11/Xlocale.h> |
9 | //#elif defined(B115200) |
|
|
10 | //# define BAUDRATE B115200 |
|
|
11 | //#elif defined(B38400) |
|
|
12 | #if defined(B38400) |
|
|
13 | # define BAUDRATE B38400 |
|
|
14 | #elif defined(B19200) |
|
|
15 | # define BAUDRATE B19200 |
10 | #else |
16 | #else |
11 | # ifdef HAVE_SETLOCALE |
|
|
12 | # include <clocale> |
|
|
13 | # endif |
|
|
14 | #endif /* HAVE_XLOCALE */ |
|
|
15 | |
|
|
16 | #ifdef TTY_GID_SUPPORT |
|
|
17 | # include <grp.h> |
|
|
18 | #endif |
|
|
19 | |
|
|
20 | /* ways to deal with getting/setting termios structure */ |
|
|
21 | |
|
|
22 | /* termios interface */ |
|
|
23 | # ifdef TCSANOW /* POSIX */ |
|
|
24 | # define GET_TERMIOS(fd,tios) tcgetattr (fd, tios) |
|
|
25 | # define SET_TERMIOS(fd,tios) \ |
|
|
26 | cfsetospeed (tios, BAUDRATE), \ |
|
|
27 | cfsetispeed (tios, BAUDRATE), \ |
|
|
28 | tcsetattr (fd, TCSANOW, tios) |
|
|
29 | # else |
|
|
30 | # ifdef TIOCSETA |
|
|
31 | # define GET_TERMIOS(fd,tios) ioctl (fd, TIOCGETA, tios) |
|
|
32 | # define SET_TERMIOS(fd,tios) \ |
|
|
33 | tios->c_cflag |= BAUDRATE, \ |
|
|
34 | ioctl (fd, TIOCSETA, tios) |
|
|
35 | # else |
|
|
36 | # define GET_TERMIOS(fd,tios) ioctl (fd, TCGETS, tios) |
|
|
37 | # define SET_TERMIOS(fd,tios) \ |
|
|
38 | tios->c_cflag |= BAUDRATE, \ |
|
|
39 | ioctl (fd, TCSETS, tios) |
|
|
40 | # endif |
|
|
41 | # endif |
|
|
42 | # define SET_TTYMODE(fd,tios) SET_TERMIOS (fd, tios) |
|
|
43 | |
|
|
44 | /* use the fastest baud-rate */ |
|
|
45 | #ifdef B38400 |
|
|
46 | # define BAUDRATE B38400 |
|
|
47 | #else |
|
|
48 | # ifdef B19200 |
|
|
49 | # define BAUDRATE B19200 |
|
|
50 | # else |
|
|
51 | # define BAUDRATE B9600 |
17 | # define BAUDRATE B9600 |
52 | # endif |
|
|
53 | #endif |
18 | #endif |
54 | |
19 | |
55 | /* Disable special character functions */ |
20 | /* Disable special character functions */ |
56 | #ifdef _POSIX_VDISABLE |
21 | #ifdef _POSIX_VDISABLE |
57 | # define VDISABLE _POSIX_VDISABLE |
22 | # define VDISABLE _POSIX_VDISABLE |
… | |
… | |
67 | #endif |
32 | #endif |
68 | #ifndef CQUIT |
33 | #ifndef CQUIT |
69 | # define CQUIT '\034' /* ^\ */ |
34 | # define CQUIT '\034' /* ^\ */ |
70 | #endif |
35 | #endif |
71 | #ifndef CERASE |
36 | #ifndef CERASE |
72 | # ifdef linux |
37 | # ifdef __linux__ |
73 | # define CERASE '\177' /* ^? */ |
38 | # define CERASE '\177' /* ^? */ |
74 | # else |
39 | # else |
75 | # define CERASE '\010' /* ^H */ |
40 | # define CERASE '\010' /* ^H */ |
76 | # endif |
41 | # endif |
77 | #endif |
42 | #endif |
… | |
… | |
116 | # ifdef VWERASE |
81 | # ifdef VWERASE |
117 | # define VWERSE VWERASE |
82 | # define VWERSE VWERASE |
118 | # endif |
83 | # endif |
119 | #endif |
84 | #endif |
120 | |
85 | |
121 | #ifndef O_NOCTTY |
|
|
122 | # define O_NOCTTY 0 |
|
|
123 | #endif |
|
|
124 | #ifndef ONLCR |
86 | #ifndef ONLCR |
125 | # define ONLCR 0 |
87 | # define ONLCR 0 |
126 | #endif |
88 | #endif |
127 | |
89 | |
128 | #define CONSOLE "/dev/console" /* console device */ |
90 | #define CONSOLE "/dev/console" /* console device */ |
129 | |
91 | |
130 | #endif /* _INIT_H_ */ |
92 | #endif /* _INIT_H_ */ |