1 | /* |
|
|
2 | * $Id: init.h,v 1.3 2003/11/25 15:25:17 pcg Exp $ |
|
|
3 | */ |
|
|
4 | |
|
|
5 | #ifndef _INIT_H_ |
1 | #ifndef INIT_H_ |
6 | #define _INIT_H_ |
2 | #define INIT_H_ |
7 | |
3 | |
8 | #undef CERASE /* TODO */ |
4 | #undef CERASE /* TODO */ |
9 | #define CERASE '\010' /* ^H */ |
5 | #define CERASE '\010' /* ^H */ |
10 | |
6 | |
11 | #ifdef HAVE_XSETLOCALE |
7 | #ifdef HAVE_XSETLOCALE |
12 | # define X_LOCALE |
8 | # define X_LOCALE |
13 | # include <X11/Xlocale.h> |
9 | # include <X11/Xlocale.h> |
14 | #else |
10 | #else |
15 | # ifdef HAVE_SETLOCALE |
11 | # ifdef HAVE_SETLOCALE |
16 | # include <locale.h> |
12 | # include <clocale> |
17 | # endif |
13 | # endif |
18 | #endif /* HAVE_XLOCALE */ |
14 | #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 | |
15 | |
29 | #ifdef TTY_GID_SUPPORT |
16 | #ifdef TTY_GID_SUPPORT |
30 | # include <grp.h> |
17 | # include <grp.h> |
31 | #endif |
18 | #endif |
32 | |
19 | |
33 | /* ways to deal with getting/setting termios structure */ |
20 | /* ways to deal with getting/setting termios structure */ |
34 | |
21 | |
35 | #ifdef HAVE_TERMIOS_H |
|
|
36 | /* termios interface */ |
22 | /* termios interface */ |
37 | # ifdef TCSANOW /* POSIX */ |
23 | # ifdef TCSANOW /* POSIX */ |
38 | # define GET_TERMIOS(fd,tios) tcgetattr (fd, tios) |
24 | # define GET_TERMIOS(fd,tios) tcgetattr (fd, tios) |
39 | # define SET_TERMIOS(fd,tios) \ |
25 | # define SET_TERMIOS(fd,tios) \ |
40 | cfsetospeed (tios, BAUDRATE), \ |
26 | cfsetospeed (tios, BAUDRATE), \ |
41 | cfsetispeed (tios, BAUDRATE), \ |
27 | cfsetispeed (tios, BAUDRATE), \ |
42 | tcsetattr (fd, TCSANOW, tios) |
28 | tcsetattr (fd, TCSANOW, tios) |
43 | # else |
29 | # else |
44 | # ifdef TIOCSETA |
30 | # ifdef TIOCSETA |
45 | # define GET_TERMIOS(fd,tios) ioctl (fd, TIOCGETA, tios) |
31 | # define GET_TERMIOS(fd,tios) ioctl (fd, TIOCGETA, tios) |
46 | # define SET_TERMIOS(fd,tios) \ |
32 | # define SET_TERMIOS(fd,tios) \ |
47 | tios->c_cflag |= BAUDRATE, \ |
33 | tios->c_cflag |= BAUDRATE, \ |
48 | ioctl (fd, TIOCSETA, tios) |
34 | ioctl (fd, TIOCSETA, tios) |
49 | # else |
35 | # else |
50 | # define GET_TERMIOS(fd,tios) ioctl (fd, TCGETS, tios) |
36 | # define GET_TERMIOS(fd,tios) ioctl (fd, TCGETS, tios) |
51 | # define SET_TERMIOS(fd,tios) \ |
37 | # define SET_TERMIOS(fd,tios) \ |
52 | tios->c_cflag |= BAUDRATE, \ |
38 | tios->c_cflag |= BAUDRATE, \ |
53 | ioctl (fd, TCSETS, tios) |
39 | ioctl (fd, TCSETS, tios) |
54 | # endif |
40 | # endif |
55 | # endif |
41 | # endif |
56 | # define SET_TTYMODE(fd,tios) SET_TERMIOS (fd, tios) |
42 | # 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 | |
43 | |
69 | /* use the fastest baud-rate */ |
44 | /* use the fastest baud-rate */ |
70 | #ifdef B38400 |
45 | #ifdef B38400 |
71 | # define BAUDRATE B38400 |
46 | # define BAUDRATE B38400 |
72 | #else |
47 | #else |
… | |
… | |
145 | |
120 | |
146 | #ifndef O_NOCTTY |
121 | #ifndef O_NOCTTY |
147 | # define O_NOCTTY 0 |
122 | # define O_NOCTTY 0 |
148 | #endif |
123 | #endif |
149 | #ifndef ONLCR |
124 | #ifndef ONLCR |
150 | # define ONLCR 0 /* QNX, at least */ |
125 | # define ONLCR 0 |
151 | #endif |
126 | #endif |
152 | |
127 | |
153 | #define CONSOLE "/dev/console" /* console device */ |
128 | #define CONSOLE "/dev/console" /* console device */ |
154 | |
129 | |
155 | #include "init.intpro" /* PROTOS for internal routines */ |
|
|
156 | #endif /* _INIT_H_ */ |
130 | #endif /* _INIT_H_ */ |