"SfR Fresh" - the SfR Freeware/Shareware Archive 
Member "logserial-0.4.2/sysdep.h" of archive logserial-0.4.2.tar.gz:
As a special service "SfR Fresh" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting with prefixed line numbers.
Alternatively you can here view or download the uninterpreted source code file.
That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
1 /*
2 * sysdep.h
3 * This file was part of the minicom communications package,
4 * Copyright 1991-1995 Miquel van Smoorenburg.
5 *
6 * This file is part of the logserial package,
7 * Copyright 1998 Sinkovics Zoltan.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 *
14 */
15
16 #include <sys/types.h>
17 /* Include standard Posix header files. */
18 #if defined (_POSIX) || defined(_BSD43)
19 # include <stdlib.h>
20 # include <unistd.h>
21 #endif
22 #ifndef _COH3
23 # include <sys/wait.h>
24 #endif
25 /* Now see if we need to use sgtty, termio or termios. */
26 #ifdef _SCO
27 # define _IBCS2 /* So we get struct winsize :-) */
28 #endif
29 #if defined (_SYSV)
30 # if !defined(_POSIX) || defined(_NO_TERMIOS)
31 # include <sys/termio.h>
32 # else
33 # include <sys/termios.h>
34 # endif
35 #else
36 # if defined(_POSIX) && !defined(_NO_TERMIOS)
37 # include <termios.h>
38 # else
39 # define _V7
40 # include <sgtty.h>
41 # endif
42 #endif
43 /* Some system-specific include files for modem control. */
44 #ifdef _HPUX_SOURCE
45 # include <sys/modem.h>
46 #endif
47 #if defined(_BSD43) || defined (_SYSV)
48 # ifndef SUN
49 # include <sys/ioctl.h>
50 # endif
51 #endif
52 #ifdef _COHERENT
53 # include <sgtty.h>
54 #endif
55 #ifdef _DGUX_SOURCE
56 # include <sys/termiox.h>
57 #endif
58
59 /* And more "standard" include files. */
60 #include <stdio.h>
61 #include <setjmp.h>
62
63 /* Be sure we know WEXITSTATUS and WTERMSIG */
64 #if !defined(_BSD43)
65 # ifndef WEXITSTATUS
66 # define WEXITSTATUS(s) (((s) >> 8) & 0377)
67 # endif
68 # ifndef WTERMSIG
69 # define WTERMSIG(s) ((s) & 0177)
70 # endif
71 #endif
72
73 /* Some ancient SysV systems don't define these */
74 #ifndef VMIN
75 # define VMIN 4
76 #endif
77 #ifndef VTIME
78 # define VTIME 5
79 #endif
80 #ifndef IUCLC
81 # define IUCLC 0
82 #endif
83 #ifndef IXANY
84 # define IXANY 0
85 #endif
86
87 /* Different names for the same beast. */
88 #ifndef TIOCMODG /* BSD 4.3 */
89 # ifdef TIOCMGET
90 # define TIOCMODG TIOCMGET /* Posix */
91 # else
92 # ifdef MCGETA
93 # define TIOCMODG MCGETA /* HP/UX */
94 # endif
95 # endif
96 #endif
97
98 #ifndef TIOCMODS
99 # ifdef TIOCMSET
100 # define TIOCMODS TIOCMSET
101 # else
102 # ifdef MCSETA
103 # define TIOCMODS MCSETA
104 # endif
105 # endif
106 #endif
107
108 #ifndef TIOCM_CAR /* BSD + Posix */
109 # ifdef MDCD
110 # define TIOCM_CAR MDCD /* HP/UX */
111 # endif
112 #endif
113
114 /* Define some thing that might not be there */
115 #ifndef TANDEM
116 # define TANDEM 0
117 #endif
118 #ifndef BITS8
119 # define BITS8 0
120 #endif
121 #ifndef PASS8
122 # ifdef LLITOUT
123 # define PASS8 LLITOUT
124 # else
125 # define PASS8 0
126 # endif
127 #endif
128 #ifndef CRTSCTS
129 # define CRTSCTS 0
130 #endif
131
132 /* If this is SysV without Posix, emulate Posix. */
133 #if defined(_SYSV)
134 #if !defined(_POSIX) || defined(_NO_TERMIOS)
135 # define termios termio
136 # ifndef TCSANOW
137 # define TCSANOW 0
138 # endif
139 # define tcgetattr(fd, tty) ioctl(fd, TCGETA, tty)
140 # define tcsetattr(fd, flags, tty) ioctl(fd, TCSETA, tty)
141 # define tcsendbreak(fd, len) ioctl(fd, TCSBRK, 0)
142 # define speed_t int
143 # define cfsetispeed(xtty, xspd) \
144 ((xtty)->c_cflag = ((xtty)->c_cflag & ~CBAUD) | (xspd))
145 # define cfsetospeed(tty, spd)
146 #endif
147 #endif
148
149 /* Redefine cfset{i,o}speed for Linux > 1.1.68 && libc < 4.5.21 */
150 #if defined (__linux__) && defined(CBAUDEX)
151 # undef cfsetispeed
152 # undef cfsetospeed
153 # define cfsetispeed(xtty, xspd) \
154 ((xtty)->c_cflag = ((xtty)->c_cflag & ~CBAUD) | (xspd))
155 # define cfsetospeed(tty, spd)
156 #endif