1 |
#ifndef INIT_H_ |
2 |
#define INIT_H_ |
3 |
|
4 |
#undef CERASE /* TODO */ |
5 |
#define CERASE '\010' /* ^H */ |
6 |
|
7 |
#ifdef HAVE_XSETLOCALE |
8 |
# define X_LOCALE |
9 |
# include <X11/Xlocale.h> |
10 |
#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 |
52 |
# endif |
53 |
#endif |
54 |
|
55 |
/* Disable special character functions */ |
56 |
#ifdef _POSIX_VDISABLE |
57 |
# define VDISABLE _POSIX_VDISABLE |
58 |
#else |
59 |
# define VDISABLE 255 |
60 |
#endif |
61 |
|
62 |
/*----------------------------------------------------------------------* |
63 |
* system default characters if defined and reasonable |
64 |
*/ |
65 |
#ifndef CINTR |
66 |
# define CINTR '\003' /* ^C */ |
67 |
#endif |
68 |
#ifndef CQUIT |
69 |
# define CQUIT '\034' /* ^\ */ |
70 |
#endif |
71 |
#ifndef CERASE |
72 |
# ifdef linux |
73 |
# define CERASE '\177' /* ^? */ |
74 |
# else |
75 |
# define CERASE '\010' /* ^H */ |
76 |
# endif |
77 |
#endif |
78 |
#ifndef CKILL |
79 |
# define CKILL '\025' /* ^U */ |
80 |
#endif |
81 |
#ifndef CEOF |
82 |
# define CEOF '\004' /* ^D */ |
83 |
#endif |
84 |
#ifndef CSTART |
85 |
# define CSTART '\021' /* ^Q */ |
86 |
#endif |
87 |
#ifndef CSTOP |
88 |
# define CSTOP '\023' /* ^S */ |
89 |
#endif |
90 |
#ifndef CSUSP |
91 |
# define CSUSP '\032' /* ^Z */ |
92 |
#endif |
93 |
#ifndef CDSUSP |
94 |
# define CDSUSP '\031' /* ^Y */ |
95 |
#endif |
96 |
#ifndef CRPRNT |
97 |
# define CRPRNT '\022' /* ^R */ |
98 |
#endif |
99 |
#ifndef CFLUSH |
100 |
# define CFLUSH '\017' /* ^O */ |
101 |
#endif |
102 |
#ifndef CWERASE |
103 |
# define CWERASE '\027' /* ^W */ |
104 |
#endif |
105 |
#ifndef CLNEXT |
106 |
# define CLNEXT '\026' /* ^V */ |
107 |
#endif |
108 |
|
109 |
#ifndef VDISCRD |
110 |
# ifdef VDISCARD |
111 |
# define VDISCRD VDISCARD |
112 |
# endif |
113 |
#endif |
114 |
|
115 |
#ifndef VWERSE |
116 |
# ifdef VWERASE |
117 |
# define VWERSE VWERASE |
118 |
# endif |
119 |
#endif |
120 |
|
121 |
#ifndef O_NOCTTY |
122 |
# define O_NOCTTY 0 |
123 |
#endif |
124 |
#ifndef ONLCR |
125 |
# define ONLCR 0 |
126 |
#endif |
127 |
|
128 |
#define CONSOLE "/dev/console" /* console device */ |
129 |
|
130 |
#endif /* _INIT_H_ */ |