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 |
#if defined(PTYS_ARE_PTMX) && !defined(__CYGWIN32__) |
17 |
# include <sys/resource.h> /* for struct rlimit */ |
18 |
# define _NEW_TTY_CTRL /* to get proper defines in <termios.h> */ |
19 |
#endif |
20 |
|
21 |
#ifdef TTY_GID_SUPPORT |
22 |
# include <grp.h> |
23 |
#endif |
24 |
|
25 |
/* ways to deal with getting/setting termios structure */ |
26 |
|
27 |
#ifdef HAVE_TERMIOS_H |
28 |
/* termios interface */ |
29 |
# ifdef TCSANOW /* POSIX */ |
30 |
# define GET_TERMIOS(fd,tios) tcgetattr (fd, tios) |
31 |
# define SET_TERMIOS(fd,tios) \ |
32 |
cfsetospeed (tios, BAUDRATE), \ |
33 |
cfsetispeed (tios, BAUDRATE), \ |
34 |
tcsetattr (fd, TCSANOW, tios) |
35 |
# else |
36 |
# ifdef TIOCSETA |
37 |
# define GET_TERMIOS(fd,tios) ioctl (fd, TIOCGETA, tios) |
38 |
# define SET_TERMIOS(fd,tios) \ |
39 |
tios->c_cflag |= BAUDRATE, \ |
40 |
ioctl (fd, TIOCSETA, tios) |
41 |
# else |
42 |
# define GET_TERMIOS(fd,tios) ioctl (fd, TCGETS, tios) |
43 |
# define SET_TERMIOS(fd,tios) \ |
44 |
tios->c_cflag |= BAUDRATE, \ |
45 |
ioctl (fd, TCSETS, tios) |
46 |
# endif |
47 |
# endif |
48 |
# define SET_TTYMODE(fd,tios) SET_TERMIOS (fd, tios) |
49 |
#else |
50 |
/* sgtty interface */ |
51 |
|
52 |
# define SET_TTYMODE(fd,tt) \ |
53 |
tt->sg.sg_ispeed = tt->sg.sg_ospeed = BAUDRATE, \ |
54 |
ioctl (fd, TIOCSETP, & (tt->sg)), \ |
55 |
ioctl (fd, TIOCSETC, & (tt->tc)), \ |
56 |
ioctl (fd, TIOCSLTC, & (tt->lc)), \ |
57 |
ioctl (fd, TIOCSETD, & (tt->line)), \ |
58 |
ioctl (fd, TIOCLSET, & (tt->local)) |
59 |
#endif /* HAVE_TERMIOS_H */ |
60 |
|
61 |
/* use the fastest baud-rate */ |
62 |
#ifdef B38400 |
63 |
# define BAUDRATE B38400 |
64 |
#else |
65 |
# ifdef B19200 |
66 |
# define BAUDRATE B19200 |
67 |
# else |
68 |
# define BAUDRATE B9600 |
69 |
# endif |
70 |
#endif |
71 |
|
72 |
/* Disable special character functions */ |
73 |
#ifdef _POSIX_VDISABLE |
74 |
# define VDISABLE _POSIX_VDISABLE |
75 |
#else |
76 |
# define VDISABLE 255 |
77 |
#endif |
78 |
|
79 |
/*----------------------------------------------------------------------* |
80 |
* system default characters if defined and reasonable |
81 |
*/ |
82 |
#ifndef CINTR |
83 |
# define CINTR '\003' /* ^C */ |
84 |
#endif |
85 |
#ifndef CQUIT |
86 |
# define CQUIT '\034' /* ^\ */ |
87 |
#endif |
88 |
#ifndef CERASE |
89 |
# ifdef linux |
90 |
# define CERASE '\177' /* ^? */ |
91 |
# else |
92 |
# define CERASE '\010' /* ^H */ |
93 |
# endif |
94 |
#endif |
95 |
#ifndef CKILL |
96 |
# define CKILL '\025' /* ^U */ |
97 |
#endif |
98 |
#ifndef CEOF |
99 |
# define CEOF '\004' /* ^D */ |
100 |
#endif |
101 |
#ifndef CSTART |
102 |
# define CSTART '\021' /* ^Q */ |
103 |
#endif |
104 |
#ifndef CSTOP |
105 |
# define CSTOP '\023' /* ^S */ |
106 |
#endif |
107 |
#ifndef CSUSP |
108 |
# define CSUSP '\032' /* ^Z */ |
109 |
#endif |
110 |
#ifndef CDSUSP |
111 |
# define CDSUSP '\031' /* ^Y */ |
112 |
#endif |
113 |
#ifndef CRPRNT |
114 |
# define CRPRNT '\022' /* ^R */ |
115 |
#endif |
116 |
#ifndef CFLUSH |
117 |
# define CFLUSH '\017' /* ^O */ |
118 |
#endif |
119 |
#ifndef CWERASE |
120 |
# define CWERASE '\027' /* ^W */ |
121 |
#endif |
122 |
#ifndef CLNEXT |
123 |
# define CLNEXT '\026' /* ^V */ |
124 |
#endif |
125 |
|
126 |
#ifndef VDISCRD |
127 |
# ifdef VDISCARD |
128 |
# define VDISCRD VDISCARD |
129 |
# endif |
130 |
#endif |
131 |
|
132 |
#ifndef VWERSE |
133 |
# ifdef VWERASE |
134 |
# define VWERSE VWERASE |
135 |
# endif |
136 |
#endif |
137 |
|
138 |
#ifndef O_NOCTTY |
139 |
# define O_NOCTTY 0 |
140 |
#endif |
141 |
#ifndef ONLCR |
142 |
# define ONLCR 0 |
143 |
#endif |
144 |
|
145 |
#define CONSOLE "/dev/console" /* console device */ |
146 |
|
147 |
#endif /* _INIT_H_ */ |