Fixed filan -s, added -S
[socat.git] / procan-cdefs.c
blob19a3fceb7900f5ea1fa3010eea5d0c24601c659c
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 /* termios constants */
45 #ifdef CRDLY
46 fprintf(outfile, "#define CRDLY 0%011o\n", CRDLY);
47 #endif
48 #ifdef CR0
49 fprintf(outfile, "#define CR0 0%011o\n", CR0);
50 #endif
51 #ifdef CR1
52 fprintf(outfile, "#define CR1 0%011o\n", CR1);
53 #endif
54 #ifdef CR2
55 fprintf(outfile, "#define CR2 0%011o\n", CR2);
56 #endif
57 #ifdef CR3
58 fprintf(outfile, "#define CR3 0%011o\n", CR3);
59 #endif
60 #ifdef TABDLY
61 fprintf(outfile, "#define TABDLY 0%011o\n", TABDLY);
62 #endif
63 #ifdef TAB0
64 fprintf(outfile, "#define TAB0 0%011o\n", TAB0);
65 #endif
66 #ifdef TAB1
67 fprintf(outfile, "#define TAB1 0%011o\n", TAB1);
68 #endif
69 #ifdef TAB2
70 fprintf(outfile, "#define TAB2 0%011o\n", TAB2);
71 #endif
72 #ifdef TAB3
73 fprintf(outfile, "#define TAB3 0%011o\n", TAB3);
74 #endif
75 #ifdef CSIZE
76 fprintf(outfile, "#define CSIZE 0%011o\n", CSIZE);
77 #endif
78 #ifdef TIOCEXCL
79 fprintf(outfile, "#define TIOCEXCL 0x%lx\n", (unsigned long)TIOCEXCL);
80 #endif
82 /* stdio constants */
83 #ifdef FOPEN_MAX
84 fprintf(outfile, "#define FOPEN_MAX %u\n", FOPEN_MAX);
85 #endif
87 /* socket constants */
88 #ifdef PF_UNIX
89 fprintf(outfile, "#define PF_UNIX %d\n", PF_UNIX);
90 #elif defined(PF_LOCAL)
91 fprintf(outfile, "#define PF_LOCAL %d\n", PF_LOCAL);
92 #endif
93 #ifdef PF_INET
94 fprintf(outfile, "#define PF_INET %d\n", PF_INET);
95 #endif
96 #ifdef PF_INET6
97 fprintf(outfile, "#define PF_INET6 %d\n", PF_INET6);
98 #endif
99 #ifdef PF_APPLETALK
100 fprintf(outfile, "#define PF_APPLETALK %d\n", PF_APPLETALK);
101 #endif
102 #ifdef PF_PACKET
103 fprintf(outfile, "#define PF_PACKET %d\n", PF_PACKET);
104 #endif
105 #ifdef SOCK_STREAM
106 fprintf(outfile, "#define SOCK_STREAM %d\n", SOCK_STREAM);
107 #endif
108 #ifdef SOCK_DGRAM
109 fprintf(outfile, "#define SOCK_DGRAM %d\n", SOCK_DGRAM);
110 #endif
111 #ifdef SOCK_RAW
112 fprintf(outfile, "#define SOCK_RAW %d\n", SOCK_RAW);
113 #endif
114 #ifdef SOCK_SEQPACKET
115 fprintf(outfile, "#define SOCK_SEQPACKET %d\n", SOCK_SEQPACKET);
116 #endif
117 #ifdef SOCK_PACKET
118 fprintf(outfile, "#define SOCK_PACKET %d\n", SOCK_PACKET);
119 #endif
120 #ifdef IPPROTO_IP
121 fprintf(outfile, "#define IPPROTO_IP %d\n", IPPROTO_IP);
122 #endif
123 #ifdef IPPROTO_TCP
124 fprintf(outfile, "#define IPPROTO_TCP %d\n", IPPROTO_TCP);
125 #endif
126 #ifdef IPPROTO_UDP
127 fprintf(outfile, "#define IPPROTO_UDP %d\n", IPPROTO_UDP);
128 #endif
129 #ifdef IPPROTO_SCTP
130 fprintf(outfile, "#define IPPROTO_SCTP %d\n", IPPROTO_SCTP);
131 #endif
132 #ifdef IPPROTO_DCCP
133 fprintf(outfile, "#define IPPROTO_DCCP %d\n", IPPROTO_DCCP);
134 #endif
135 #ifdef SOL_SOCKET
136 fprintf(outfile, "#define SOL_SOCKET 0x%x\n", SOL_SOCKET);
137 #endif
138 #ifdef SOL_PACKET
139 fprintf(outfile, "#define SOL_PACKET 0x%x\n", SOL_PACKET);
140 #endif
141 #ifdef SOL_IP
142 fprintf(outfile, "#define SOL_IP 0x%x\n", SOL_IP);
143 #endif
144 #ifdef SOL_IPV6
145 fprintf(outfile, "#define SOL_IPV6 0x%x\n", SOL_IPV6);
146 #endif
147 #ifdef SOL_TCP
148 fprintf(outfile, "#define SOL_TCP 0x%x\n", SOL_TCP);
149 #endif
150 #ifdef SOL_UDP
151 fprintf(outfile, "#define SOL_UDP 0x%x\n", SOL_UDP);
152 #endif
153 #ifdef SOL_SCTP
154 fprintf(outfile, "#define SOL_SCTP 0x%x\n", SOL_SCTP);
155 #endif
156 #ifdef SOL_DCCP
157 fprintf(outfile, "#define SOL_DCCP 0x%x\n", SOL_DCCP);
158 #endif
159 #ifdef SO_REUSEADDR
160 fprintf(outfile, "#define SO_REUSEADDR %d\n", SO_REUSEADDR);
161 #endif
162 #ifdef TCP_MAXSEG
163 fprintf(outfile, "#define TCP_MAXSEG %d\n", TCP_MAXSEG);
164 #endif
165 return 0;