Version 1.8.0.1
[socat.git] / procan-cdefs.c
blobd9587f80820f68df0890c639434392268c43680a
1 /* source: procan-cdefs.c */
2 /* Copyright Gerhard Rieger and contributors (see file CHANGES) */
3 /* Published under the GNU General Public License V.2, see file COPYING */
5 /* a function that prints compile time parameters */
6 /* the set of parameters is only a small subset of the available defines and
7 will be extended on demand */
10 #include "xiosysincludes.h"
11 #include "mytypes.h"
12 #include "compat.h"
13 #include "error.h"
15 #include "procan.h"
17 int procan_cdefs(FILE *outfile) {
18 /* basic C/system constants */
19 #ifdef FD_SETSIZE
20 fprintf(outfile, "#define FD_SETSIZE %u\n", FD_SETSIZE);
21 #endif
22 #ifdef NFDBITS
23 fprintf(outfile, "#define NFDBITS %d\n", (int)NFDBITS);
24 #endif
25 #ifdef O_RDONLY
26 fprintf(outfile, "#define O_RDONLY %u\n", O_RDONLY);
27 #endif
28 #ifdef O_WRONLY
29 fprintf(outfile, "#define O_WRONLY %u\n", O_WRONLY);
30 #endif
31 #ifdef O_RDWR
32 fprintf(outfile, "#define O_RDWR %u\n", O_RDWR);
33 #endif
34 #ifdef SHUT_RD
35 fprintf(outfile, "#define SHUT_RD %u\n", SHUT_RD);
36 #endif
37 #ifdef SHUT_WR
38 fprintf(outfile, "#define SHUT_WR %u\n", SHUT_WR);
39 #endif
40 #ifdef SHUT_RDWR
41 fprintf(outfile, "#define SHUT_RDWR %u\n", SHUT_RDWR);
42 #endif
44 /* Compile time controls */
45 #ifdef _FILE_OFFSET_BITS
46 fprintf(outfile, "#define _FILE_OFFSET_BITS %u\n", _FILE_OFFSET_BITS);
47 #endif
48 #ifdef _LARGE_FILES
49 fprintf(outfile, "#define _LARGE_FILES %u\n", _LARGE_FILES);
50 #endif
52 /* termios constants */
53 #ifdef CRDLY
54 fprintf(outfile, "#define CRDLY 0%011o\n", CRDLY);
55 #endif
56 #ifdef CR0
57 fprintf(outfile, "#define CR0 0%011o\n", CR0);
58 #endif
59 #ifdef CR1
60 fprintf(outfile, "#define CR1 0%011o\n", CR1);
61 #endif
62 #ifdef CR2
63 fprintf(outfile, "#define CR2 0%011o\n", CR2);
64 #endif
65 #ifdef CR3
66 fprintf(outfile, "#define CR3 0%011o\n", CR3);
67 #endif
68 #ifdef TABDLY
69 fprintf(outfile, "#define TABDLY 0%011o\n", TABDLY);
70 #endif
71 #ifdef TAB0
72 fprintf(outfile, "#define TAB0 0%011o\n", TAB0);
73 #endif
74 #ifdef TAB1
75 fprintf(outfile, "#define TAB1 0%011o\n", TAB1);
76 #endif
77 #ifdef TAB2
78 fprintf(outfile, "#define TAB2 0%011o\n", TAB2);
79 #endif
80 #ifdef TAB3
81 fprintf(outfile, "#define TAB3 0%011o\n", TAB3);
82 #endif
83 #ifdef CSIZE
84 fprintf(outfile, "#define CSIZE 0%011o\n", CSIZE);
85 #endif
86 #ifdef TIOCEXCL
87 fprintf(outfile, "#define TIOCEXCL 0x%lx\n", (unsigned long)TIOCEXCL);
88 #endif
90 /* stdio constants */
91 #ifdef FOPEN_MAX
92 fprintf(outfile, "#define FOPEN_MAX %u\n", FOPEN_MAX);
93 #endif
95 /* socket constants */
96 #ifdef PF_UNSPEC
97 fprintf(outfile, "#define PF_UNSPEC %d\n", PF_UNSPEC);
98 #endif
99 #ifdef PF_UNIX
100 fprintf(outfile, "#define PF_UNIX %d\n", PF_UNIX);
101 #elif defined(PF_LOCAL)
102 fprintf(outfile, "#define PF_LOCAL %d\n", PF_LOCAL);
103 #endif
104 #ifdef PF_INET
105 fprintf(outfile, "#define PF_INET %d\n", PF_INET);
106 #endif
107 #ifdef PF_INET6
108 fprintf(outfile, "#define PF_INET6 %d\n", PF_INET6);
109 #endif
110 #ifdef PF_APPLETALK
111 fprintf(outfile, "#define PF_APPLETALK %d\n", PF_APPLETALK);
112 #endif
113 #ifdef PF_PACKET
114 fprintf(outfile, "#define PF_PACKET %d\n", PF_PACKET);
115 #endif
116 #ifdef PF_VSOCK
117 fprintf(outfile, "#define PF_VSOCK %d\n", PF_VSOCK);
118 #endif
119 #ifdef SOCK_STREAM
120 fprintf(outfile, "#define SOCK_STREAM %d\n", SOCK_STREAM);
121 #endif
122 #ifdef SOCK_DGRAM
123 fprintf(outfile, "#define SOCK_DGRAM %d\n", SOCK_DGRAM);
124 #endif
125 #ifdef SOCK_RAW
126 fprintf(outfile, "#define SOCK_RAW %d\n", SOCK_RAW);
127 #endif
128 #ifdef SOCK_SEQPACKET
129 fprintf(outfile, "#define SOCK_SEQPACKET %d\n", SOCK_SEQPACKET);
130 #endif
131 #ifdef SOCK_PACKET
132 fprintf(outfile, "#define SOCK_PACKET %d\n", SOCK_PACKET);
133 #endif
134 #ifdef IPPROTO_IP
135 fprintf(outfile, "#define IPPROTO_IP %d\n", IPPROTO_IP);
136 #endif
137 #ifdef IPPROTO_TCP
138 fprintf(outfile, "#define IPPROTO_TCP %d\n", IPPROTO_TCP);
139 #endif
140 #ifdef IPPROTO_UDP
141 fprintf(outfile, "#define IPPROTO_UDP %d\n", IPPROTO_UDP);
142 #endif
143 #ifdef IPPROTO_DCCP
144 fprintf(outfile, "#define IPPROTO_DCCP %d\n", IPPROTO_DCCP);
145 #endif
146 #ifdef IPPROTO_SCTP
147 fprintf(outfile, "#define IPPROTO_SCTP %d\n", IPPROTO_SCTP);
148 #endif
149 #ifdef IPPROTO_UDPLITE
150 fprintf(outfile, "#define IPPROTO_UDPLITE %d\n", IPPROTO_UDPLITE);
151 #endif
152 #ifdef IPPROTO_RAW
153 fprintf(outfile, "#define IPPROTO_RAW %d\n", IPPROTO_RAW);
154 #endif
155 #ifdef SOL_SOCKET
156 fprintf(outfile, "#define SOL_SOCKET 0x%x\n", SOL_SOCKET);
157 #endif
158 #ifdef SOL_PACKET
159 fprintf(outfile, "#define SOL_PACKET 0x%x\n", SOL_PACKET);
160 #endif
161 #ifdef SOL_IP
162 fprintf(outfile, "#define SOL_IP 0x%x\n", SOL_IP);
163 #endif
164 #ifdef SOL_IPV6
165 fprintf(outfile, "#define SOL_IPV6 0x%x\n", SOL_IPV6);
166 #endif
167 #ifdef SOL_TCP
168 fprintf(outfile, "#define SOL_TCP 0x%x\n", SOL_TCP);
169 #endif
170 #ifdef SOL_UDP
171 fprintf(outfile, "#define SOL_UDP 0x%x\n", SOL_UDP);
172 #endif
173 #ifdef SOL_SCTP
174 fprintf(outfile, "#define SOL_SCTP 0x%x\n", SOL_SCTP);
175 #endif
176 #ifdef SOL_DCCP
177 fprintf(outfile, "#define SOL_DCCP 0x%x\n", SOL_DCCP);
178 #endif
179 #ifdef SO_PROTOCOL
180 fprintf(outfile, "#define SO_PROTOCOL %d\n", SO_PROTOCOL);
181 #endif
182 #ifdef SO_PROTOTYPE
183 fprintf(outfile, "#define SO_PROTOTYPE %d\n", SO_PROTOTYPE);
184 #endif
185 #ifdef SO_REUSEADDR
186 fprintf(outfile, "#define SO_REUSEADDR %d\n", SO_REUSEADDR);
187 #endif
188 #ifdef TCP_MAXSEG
189 fprintf(outfile, "#define TCP_MAXSEG %d\n", TCP_MAXSEG);
190 #endif
191 return 0;