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