diff options
Diffstat (limited to 'src/usr.bin/nc/generic.h')
-rw-r--r-- | src/usr.bin/nc/generic.h | 377 |
1 files changed, 377 insertions, 0 deletions
diff --git a/src/usr.bin/nc/generic.h b/src/usr.bin/nc/generic.h new file mode 100644 index 0000000000..b3dd5f5dc6 --- /dev/null +++ b/src/usr.bin/nc/generic.h | |||
@@ -0,0 +1,377 @@ | |||
1 | /* generic.h -- anything you don't #undef at the end remains in effect. | ||
2 | The ONLY things that go in here are generic indicator flags; it's up | ||
3 | to your programs to declare and call things based on those flags. | ||
4 | |||
5 | You should only need to make changes via a minimal system-specific section | ||
6 | at the end of this file. To build a new section, rip through this and | ||
7 | check everything it mentions on your platform, and #undef that which needs | ||
8 | it. If you generate a system-specific section you didn't find in here, | ||
9 | please mail me a copy so I can update the "master". | ||
10 | |||
11 | I realize I'm probably inventing another pseudo-standard here, but | ||
12 | goddamnit, everybody ELSE has already, and I can't include all of their | ||
13 | hairball schemes too. HAVE_xx conforms to the gnu/autoconf usage and | ||
14 | seems to be the most common format. In fact, I dug a lot of these out | ||
15 | of autoconf and tried to common them all together using "stupidh" to | ||
16 | collect data from platforms. | ||
17 | |||
18 | In disgust... _H* 940910, 941115, 950511. Pseudo-version: 1.3 | ||
19 | |||
20 | Updated 951104 with many patches from netcat feedback, and properly | ||
21 | closed a lot of slop in open-ended comments: version 1.4 | ||
22 | 960217 + nextstep: version 1.5 | ||
23 | */ | ||
24 | |||
25 | #ifndef GENERIC_H /* only run through this once */ | ||
26 | #define GENERIC_H | ||
27 | |||
28 | /* =============================== */ | ||
29 | /* System calls, lib routines, etc */ | ||
30 | /* =============================== */ | ||
31 | |||
32 | /* How does your system declare malloc, void or char? Usually void, but go | ||
33 | ask the SunOS people why they had to be different... */ | ||
34 | #define VOID_MALLOC | ||
35 | |||
36 | /* notably from fwtk/firewall.h: posix locking? */ | ||
37 | #define HAVE_FLOCK /* otherwise it's lockf() */ | ||
38 | |||
39 | /* if you don't have setsid(), you might have setpgrp(). */ | ||
40 | #define HAVE_SETSID | ||
41 | |||
42 | /* random() is generally considered better than rand() */ | ||
43 | #define HAVE_RANDOM | ||
44 | |||
45 | /* the srand48/lrand48/etc family is s'posedly even better */ | ||
46 | #define HAVE_RAND48 | ||
47 | /* bmc@telebase and others have suggested these macros if a box *does* have | ||
48 | rand48. Will consider for later if we're doing something that really | ||
49 | requires stronger random numbers, but netcat and such certainly doesn't. | ||
50 | #define srandom(seed) srand48((long) seed) | ||
51 | #define random() lrand48() */ | ||
52 | |||
53 | /* if your machine doesn't have lstat(), it should have stat() [dos...] */ | ||
54 | #define HAVE_LSTAT | ||
55 | |||
56 | /* different kinds of term ioctls. How to recognize them, very roughly: | ||
57 | sysv/POSIX_ME_HARDER: termio[s].h, struct termio[s], tty.c_*[] | ||
58 | bsd/old stuff: sgtty.h, ioctl(TIOCSETP), sgttyb.sg_*, tchars.t_* */ | ||
59 | #define HAVE_TERMIOS | ||
60 | |||
61 | /* dbm vs ndbm */ | ||
62 | #define HAVE_NDBM | ||
63 | |||
64 | /* extended utmp/wtmp stuff. MOST machines still do NOT have this SV-ism */ | ||
65 | #define UTMPX | ||
66 | |||
67 | /* some systems have nice() which takes *relative* values... [resource.h] */ | ||
68 | #define HAVE_SETPRIORITY | ||
69 | |||
70 | /* a sysvism, I think, but ... */ | ||
71 | #define HAVE_SYSINFO | ||
72 | |||
73 | /* ============= */ | ||
74 | /* Include files */ | ||
75 | /* ============= */ | ||
76 | |||
77 | /* Presence of these can be determined via a script that sniffs them | ||
78 | out if you aren't sure. See "stupidh"... */ | ||
79 | |||
80 | /* stdlib comes with most modern compilers, but ya never know */ | ||
81 | #define HAVE_STDLIB_H | ||
82 | |||
83 | /* not on a DOS box! */ | ||
84 | #define HAVE_UNISTD_H | ||
85 | |||
86 | /* stdarg is a weird one */ | ||
87 | #define HAVE_STDARG_H | ||
88 | |||
89 | /* dir.h or maybe ndir.h otherwise. */ | ||
90 | #define HAVE_DIRENT_H | ||
91 | |||
92 | /* string or strings */ | ||
93 | #define HAVE_STRINGS_H | ||
94 | |||
95 | /* if you don't have lastlog.h, what you want might be in login.h */ | ||
96 | #define HAVE_LASTLOG_H | ||
97 | |||
98 | /* predefines for _PATH_various */ | ||
99 | #define HAVE_PATHS_H | ||
100 | |||
101 | /* some SV-flavors break select stuff out separately */ | ||
102 | #define HAVE_SELECT_H | ||
103 | |||
104 | /* assorted others */ | ||
105 | #define HAVE_PARAM_H /* in sys/ */ | ||
106 | #define HAVE_SYSMACROS_H /* in sys/ */ | ||
107 | #define HAVE_TTYENT_H /* securetty et al */ | ||
108 | |||
109 | /* ==================== */ | ||
110 | |||
111 | /* Still maybe have to do something about the following, if it's even | ||
112 | worth it. I just grepped a lot of these out of various code, without | ||
113 | looking them up yet: | ||
114 | |||
115 | #define HAVE_EINPROGRESS | ||
116 | #define HAVE_F_SETOWN | ||
117 | HAVE_FILIO_H ... fionbio, fiosetown, etc... will need for hairier | ||
118 | select loops. | ||
119 | #define HAVE_SETENV ... now *there's* a hairy one; **environ is portable | ||
120 | #define BIG_ENDIAN/little_endian ... *please* try to avoid this stupidity | ||
121 | and LSBFIRST/MSBFIRST | ||
122 | #define HAVE_GETUSERSHELL ... you could always pull it out of getpwent() | ||
123 | #define HAVE_SETE[UG]ID ... lib or syscall, it varies on diff platforms | ||
124 | #define HAVE_STRCHR ... should actually be handled by string/strings | ||
125 | #define HAVE_PSTAT | ||
126 | #define HAVE_ST_BLKSIZE ... a stat() thing? | ||
127 | #define HAVE_IP_TOS | ||
128 | #define HAVE_STRFTIME ... screw this, we'll just INCLUDE one for lame | ||
129 | old boxes that don't have it [sunos 3.x, early 4.x?] | ||
130 | #define HAVE_VFPRINTF | ||
131 | #define HAVE_SHADOW_PASSWD ... in its multitudinous schemes?? ... how | ||
132 | about sumpin' like #define SHADOW_PASSWD_TYPE ... could get grody. | ||
133 | ... looks like sysv /etc/shadow, getspent() family is common. | ||
134 | #define SIG* ... what a swamp, punt for now; should all be in signal.h | ||
135 | #define HAVE_STRCSPN ... see larry wall's comment in the fwtk regex code | ||
136 | #define ULTRIX_AUTH ... bwahaha. | ||
137 | #define HAVE_YP or NIS or whatever you wanna call it this week | ||
138 | randomness about VARARGS?? | ||
139 | --- later stuff to be considered --- | ||
140 | #define UINT4 ... u-int on alpha/osf, i.e. __alpha/__osf__, ulong elsewhere? | ||
141 | dont name it that, though, it'll conflict with extant .h files like md5 | ||
142 | randomness about machine/endian.h, machine/inline.h -- bsdi, net/2 | ||
143 | randomness about _PATH_WTMP vs WTMP_FILE and where they even live!! | ||
144 | #define HAVE_SYS_ERRLIST ... whether it's in stdio.h or not [bsd 4.4] | ||
145 | --- still more stuff | ||
146 | #define HAVE_SETENV | ||
147 | #define _PATH_UTMP vs UTMP_FILE, a la deslogind?! | ||
148 | #define HAVE_DAEMON | ||
149 | #define HAVE_INETADDR [vixie bind?] | ||
150 | lseek: SEEK_SET vs L_SET and associated lossage [epi-notes, old 386Mach] | ||
151 | bsdi: ioctl_compat.h ? | ||
152 | --- takin' some ifdefs from CNS krb: | ||
153 | F_GETOWN/F_SETOWN | ||
154 | CRAY: long = 8 bytes, etc [class with alpha?] | ||
155 | CGETENT | ||
156 | SIGINFO | ||
157 | SIGTSTP SIGTTOU SIGWINCH | ||
158 | SPX? | ||
159 | SYSV_TERMIO -- covered elsewhere, I hope | ||
160 | TIOCEXT TIOCFLUSH TIOC[GS]WINSIZ | ||
161 | NEWINIT: something about init cleaning up dead login processes [telnet?] | ||
162 | PARENT_DOES_UTMP, too [telnet] | ||
163 | VDISCARD | ||
164 | VEOL/VEOL2/VLNEXT VREPRINT -- termios stuff?, and related... | ||
165 | STREAMSPTY/STREAMSPTYEM | ||
166 | AF_INET/AF_UNSPEC, PF_* | ||
167 | ECHOCTL/ECHOKE | ||
168 | F_ULOCK [?!] | ||
169 | setpgrp/getpgrp() ONEARG business.. | ||
170 | HAVE_ALLOCA | ||
171 | HAVE_GETUTENT | ||
172 | HAVE_SYS_SELECT_H [irix!] | ||
173 | HAVE_DIRENT [old 386mach has *direct.h*!] | ||
174 | HAVE_SIGSET | ||
175 | HAVE_VFORK_H and HAVE_VFORK | ||
176 | HAVE_VHANGUP | ||
177 | HAVE_VSPRINTF | ||
178 | HAVE_IPTOS_* | ||
179 | HAVE_STRCASECMP, STRNCASECMP | ||
180 | HAVE_SYS_FCNTL_H | ||
181 | HAVE_SYS_TIME_H | ||
182 | HAVE_UTIMES | ||
183 | NOTTYENT [?] | ||
184 | HAVE_FCHMOD | ||
185 | HAVE_GETUSERSHELL | ||
186 | HAVE_SIGCONTEXT [stack hair, very machine-specific] | ||
187 | YYLINENO? | ||
188 | POSIX_SIGNALS | ||
189 | POSIX_TERMIOS | ||
190 | SETPROCTITLE -- breaks some places, like fbsd sendmail | ||
191 | SIG* -- actual signal names? some are missing | ||
192 | SIOCGIFCONF | ||
193 | SO_BROADCAST | ||
194 | SHMEM [krb tickets] | ||
195 | VARARGS, or HAVE_VARARGS | ||
196 | CBAUD | ||
197 | ... and B300, B9600, etc etc | ||
198 | HAVE_BZERO vs memset/memcpy | ||
199 | HAVE_SETVBUF | ||
200 | HAVE_STRDUP | ||
201 | HAVE_GETENV | ||
202 | HAVE_STRSAVE | ||
203 | HAVE_STBLKSIZE [stat?] | ||
204 | HAVE_STREAM_H -- in sys/, ref sendmail 8.7 for IP_SRCROUTE | ||
205 | FCHMOD | ||
206 | INITGROUPS -- most machines seem to *have* | ||
207 | SETREUID | ||
208 | SNPRINTF | ||
209 | SETPGRP semantics bsd vs. sys5 style | ||
210 | |||
211 | There's also the issue about WHERE various .h files live, sys/ or otherwise. | ||
212 | There's a BIG swamp lurking where network code of any sort lives. | ||
213 | */ | ||
214 | |||
215 | /* ======================== */ | ||
216 | /* System-specific sections */ | ||
217 | /* ======================== */ | ||
218 | |||
219 | /* By turning OFF various bits of the above, you can customize for | ||
220 | a given platform. Yes, we're ignoring the stock compiler predefines | ||
221 | and using our own plugged in via the Makefile. */ | ||
222 | |||
223 | /* DOS boxes, with MSC; you may need to adapt to a different compiler. */ | ||
224 | /* looks like later ones *do* have dirent.h, for example */ | ||
225 | #ifdef MSDOS | ||
226 | #undef HAVE_FLOCK | ||
227 | #undef HAVE_RANDOM | ||
228 | #undef HAVE_LSTAT | ||
229 | #undef HAVE_TERMIOS | ||
230 | #undef UTMPX | ||
231 | #undef HAVE_SYSINFO | ||
232 | #undef HAVE_UNISTD_H | ||
233 | #undef HAVE_DIRENT_H /* unless you have the k00l little wrapper from L5!! */ | ||
234 | #undef HAVE_STRINGS_H | ||
235 | #undef HAVE_LASTLOG_H | ||
236 | #undef HAVE_PATHS_H | ||
237 | #undef HAVE_PARAM_H | ||
238 | #undef HAVE_SYSMACROS_H | ||
239 | #undef HAVE_SELECT_H | ||
240 | #undef HAVE_TTYENT_H | ||
241 | #endif /* MSDOS */ | ||
242 | |||
243 | /* buglix 4.x; dunno about 3.x on down. should be bsd4.2 */ | ||
244 | #ifdef ULTRIX | ||
245 | #undef UTMPX | ||
246 | #undef HAVE_PATHS_H | ||
247 | #undef HAVE_SYSMACROS_H | ||
248 | #undef HAVE_SELECT_H | ||
249 | #endif /* buglix */ | ||
250 | |||
251 | /* some of this might still be broken on older sunoses */ | ||
252 | #ifdef SUNOS | ||
253 | #undef VOID_MALLOC | ||
254 | #undef UTMPX | ||
255 | #undef HAVE_PATHS_H | ||
256 | #undef HAVE_SELECT_H | ||
257 | #endif /* sunos */ | ||
258 | |||
259 | /* "contact your vendor for a fix" */ | ||
260 | #ifdef SOLARIS | ||
261 | /* has UTMPX */ | ||
262 | #undef HAVE_RANDOM | ||
263 | #undef HAVE_SETPRIORITY | ||
264 | #undef HAVE_STRINGS_H /* this is genuinely the case, go figure */ | ||
265 | #undef HAVE_PATHS_H | ||
266 | #undef HAVE_SELECT_H | ||
267 | #undef HAVE_TTYENT_H | ||
268 | #endif /* SOLARIS */ | ||
269 | |||
270 | /* whatever aix variant MIT had at the time; 3.2.x?? */ | ||
271 | #ifdef AIX | ||
272 | #undef UTMPX | ||
273 | #undef HAVE_LASTLOG_H | ||
274 | #define HAVE_LOGIN_H /* "special", in the educational sense */ | ||
275 | #endif /* aix */ | ||
276 | |||
277 | /* linux, which is trying as desperately as the gnu folks can to be | ||
278 | POSIXLY_CORRECT. I think I'm gonna hurl... */ | ||
279 | #ifdef LINUX | ||
280 | #undef UTMPX | ||
281 | #undef HAVE_SYSINFO | ||
282 | #undef HAVE_SELECT_H | ||
283 | #undef HAVE_TTYENT_H | ||
284 | #endif /* linux */ | ||
285 | |||
286 | /* irix 5.x; may not be correct for earlier ones */ | ||
287 | #ifdef IRIX | ||
288 | /* wow, does irix really have everything?! */ | ||
289 | #endif /* irix */ | ||
290 | |||
291 | /* osf on alphas */ | ||
292 | #ifdef OSF | ||
293 | #undef UTMPX | ||
294 | #undef HAVE_SELECT_H | ||
295 | #endif /* osf */ | ||
296 | |||
297 | /* they's some FUCKED UP paths in this one! */ | ||
298 | #ifdef FREEBSD | ||
299 | #undef UTMPX | ||
300 | #undef HAVE_SYSINFO | ||
301 | #undef HAVE_LASTLOG_H | ||
302 | #undef HAVE_SYSMACROS_H | ||
303 | #undef HAVE_SELECT_H /* actually a lie, but only for kernel */ | ||
304 | #endif /* freebsd */ | ||
305 | |||
306 | /* Originally from the sidewinder site, of all places, but subsequently | ||
307 | checked further under a more normal bsdi 2.0 */ | ||
308 | #ifdef BSDI | ||
309 | #undef UTMPX | ||
310 | #undef HAVE_LASTLOG_H | ||
311 | #undef HAVE_SYSMACROS_H | ||
312 | /* and their malloc.h was in sys/ ?! */ | ||
313 | #undef HAVE_SELECT_H | ||
314 | #endif /* bsdi */ | ||
315 | |||
316 | /* netbsd/44lite, jives with amiga-netbsd from cactus */ | ||
317 | #ifdef NETBSD | ||
318 | #undef UTMPX | ||
319 | #undef HAVE_SYSINFO | ||
320 | #undef HAVE_LASTLOG_H | ||
321 | #undef HAVE_SELECT_H | ||
322 | #endif /* netbsd */ | ||
323 | |||
324 | /* Hpux 9.0x, from BBN and various patches sent in */ | ||
325 | #ifdef HPUX | ||
326 | #undef HAVE_RANDOM /* but *does* have ?rand48 -- need to consider.. */ | ||
327 | #undef HAVE_UTMPX | ||
328 | #undef HAVE_LASTLOG_H /* has utmp/wtmp/btmp nonsense, and pututline() */ | ||
329 | #undef HAVE_PATHS_H | ||
330 | #undef HAVE_SELECT_H | ||
331 | #undef HAVE_TTYENT_H | ||
332 | #endif /* hockeypux */ | ||
333 | |||
334 | /* Unixware [a loose definition of "unix", to be sure], 1.1.2 [at least] | ||
335 | from Brian Clapper. He wasn't sure about 2.0... */ | ||
336 | #ifdef UNIXWARE | ||
337 | /* has UTMPX */ | ||
338 | #undef HAVE_SETPRIORITY | ||
339 | /* NOTE: UnixWare does provide the BSD stuff, in "/usr/ucbinclude" (headers) | ||
340 | and "/usr/ucblib" (libraries). However, I've run into problems linking | ||
341 | stuff out of that version of the C library, when objects are also coming | ||
342 | out of the "regular" C library. My advice: Avoid the BSD compatibility | ||
343 | stuff wherever possible. Brian Clapper <bmc@telebase.com> */ | ||
344 | #undef HAVE_STRINGS_H | ||
345 | #undef HAVE_PATHS_H | ||
346 | #undef HAVE_TTYENT_H | ||
347 | #endif /* UNIXWARE */ | ||
348 | |||
349 | /* A/UX 3.1.x from darieb@sandia.gov */ | ||
350 | #ifdef AUX | ||
351 | #undef HAVE_RANDOM | ||
352 | #undef HAVE_SELECT_H /* xxx: untested */ | ||
353 | #endif /* a/ux */ | ||
354 | |||
355 | /* NeXTSTEP 3.2 motorola mudge@l0pht.com xxx should also work with | ||
356 | white hardware and Sparc/HPPA. Should work with 3.3 too as it's | ||
357 | 4.3 / 4.4 bsd wrapped around mach */ | ||
358 | #ifdef NEXT | ||
359 | #undef UTMPX | ||
360 | #undef HAVE_SELECT_X | ||
361 | #endif /* NeXTSTEP 3.2 motorola */ | ||
362 | |||
363 | /* Make some "generic" assumptions if all else fails */ | ||
364 | #ifdef GENERIC | ||
365 | #undef HAVE_FLOCK | ||
366 | #if defined(SYSV) && (SYSV < 4) /* TW leftover: old SV doesnt have symlinks */ | ||
367 | #undef HAVE_LSTAT | ||
368 | #endif /* old SYSV */ | ||
369 | #undef HAVE_TERMIOS | ||
370 | #undef UTMPX | ||
371 | #undef HAVE_PATHS_H | ||
372 | #undef HAVE_SELECT_H | ||
373 | #endif /* generic */ | ||
374 | |||
375 | /* ================ */ | ||
376 | #endif /* GENERIC_H */ | ||
377 | |||