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