1 #ifndef _INCLUDES_H
2 #define _INCLUDES_H
3 
4 #include <string.h>
5 #include <stdlib.h>
6 #include <stdio.h>
7 #include <string.h>
8 #include <arpa/inet.h>
9 
10 
11 
12 /* the first OS dependent section is to setup what includes will be used.
13    the main OS dependent section comes later on
14 */
15 
16 #ifdef ALTOS
17 #define NO_UTIMEH
18 #endif
19 
20 #ifdef MIPS
21 #define POSIX_H
22 #define NO_UTIMEH
23 #endif
24 
25 #ifdef sun386
26 #define NO_UTIMEH
27 #endif
28 
29 #ifdef NEXT2
30 #define NO_UTIMEH
31 #endif
32 
33 #ifdef NEXT3_0
34 #define NO_UTIMEH
35 #define NO_UNISTDH
36 #endif
37 
38 #ifdef APOLLO
39 #define NO_UTIMEH
40 #define NO_SYSMOUNTH
41 #define NO_UNISTDH
42 #endif
43 
44 #ifdef AIX
45 #define NO_SYSMOUNTH
46 #endif
47 
48 #ifdef M88K_R3
49 #define SVR3H
50 #define NO_RESOURCEH
51 #endif
52 
53 #ifdef DNIX
54 #define NO_SYSMOUNTH
55 #define NO_NETIFH
56 #define NO_RESOURCEH
57 #define PRIME_NMBD 0
58 #define NO_SETGROUPS
59 #endif
60 
61 
62 #ifdef ISC
63 #define SYSSTREAMH
64 #define NO_RESOURCEH
65 #endif
66 
67 #ifdef QNX
68 #define NO_RESOURCEH
69 #define NO_SYSMOUNTH
70 #define USE_MMAP 1
71 #ifdef __386__
72    #define __i386__
73 #endif
74 #endif
75 
76 #ifdef NEWS42
77 #define NO_UTIMEH
78 #define NO_STRFTIME
79 #define NO_UTIMBUF
80 #define REPLACE_MKTIME
81 #define NO_TM_NAME
82 #endif
83 
84 #ifdef OS2
85 #define NO_SYSMOUNTH
86 #define NO_NETIFH
87 #endif
88 
89 #ifdef LYNX
90 #define NO_SYSMOUNTH
91 #endif
92 
93 
94 #if (defined(SHADOW_PWD)||defined(OSF1_ENH_SEC)||defined(SecureWare)||defined(PWDAUTH))
95 #define PASSWORD_LENGTH 16
96 #endif
97 
98 /* here is the general includes section - with some ifdefs generated
99    by the previous section
100 */
101 #include "local.h"
102 #include <stdio.h>
103 #ifdef POSIX_STDLIBH
104 #include <posix/stdlib.h>
105 #else
106 #include <stdlib.h>
107 #endif
108 #include <ctype.h>
109 #include <time.h>
110 #ifndef NO_UTIMEH
111 #include <utime.h>
112 #endif
113 #include <sys/types.h>
114 
115 #ifdef SVR3H
116 #include <sys/statfs.h>
117 #include <sys/stream.h>
118 #include <netinet/types.h>
119 #include <netinet/ether.h>
120 #include <netinet/ip_if.h>
121 #endif
122 
123 #include <sys/socket.h>
124 #ifdef AXPROC
125 #include <termio.h>
126 #endif
127 #include <sys/ioctl.h>
128 #include <stddef.h>
129 #ifdef POSIX_H
130 #include <posix/utime.h>
131 #include <bsd/sys/time.h>
132 #include <bsd/netinet/in.h>
133 #else
134 #include <sys/time.h>
135 #include <netinet/in.h>
136 #endif
137 #include <netdb.h>
138 #include <signal.h>
139 #include <errno.h>
140 #include <sys/file.h>
141 #include <sys/stat.h>
142 #include <sys/param.h>
143 #include <grp.h>
144 #ifndef NO_RESOURCEH
145 #include <sys/resource.h>
146 #endif
147 #ifndef NO_SYSMOUNTH
148 #include <sys/mount.h>
149 #endif
150 #include <pwd.h>
151 #ifdef __STDC__
152 #include <stdarg.h>
153 #else
154 #include <varargs.h>
155 #endif
156 #ifndef NO_UNISTDH
157 #include <unistd.h>
158 #endif
159 #include <sys/wait.h>
160 #ifdef SYSSTREAMH
161 #include <sys/stream.h>
162 #endif
163 #ifndef NO_NETIFH
164 #ifdef POSIX_H
165 #include <bsd/net/if.h>
166 #else
167 #include <net/if.h>
168 #endif
169 #endif
170 
171 #if defined(GETPWANAM)
172 #include <sys/types.h>
173 #include <sys/label.h>
174 #include <sys/audit.h>
175 #include <pwdadj.h>
176 #endif
177 
178 #if defined(SHADOW_PWD) && !defined(NETBSD) && !defined(FreeBSD) && !defined(CONVEX) && !defined(__OpenBSD__)
179 #include <shadow.h>
180 #endif
181 
182 #ifdef SYSLOG
183 #include <syslog.h>
184 #endif
185 
186 
187 
188 /***************************************************************************
189 Here come some platform specific sections
190 ***************************************************************************/
191 
192 
193 #ifdef LINUX
194 #include <arpa/inet.h>
195 #include <dirent.h>
196 #include <string.h>
197 #include <sys/vfs.h>
198 #include <netinet/in.h>
199 #ifdef GLIBC2
200 #define _LINUX_C_LIB_VERSION_MAJOR     6
201 #include <termios.h>
202 #include <rpcsvc/ypclnt.h>
203 #include <crypt.h>
204 #include <netinet/tcp.h>
205 #include <netinet/ip.h>
206 #endif
207 #ifndef QSORT_CAST
208 #define QSORT_CAST (int (*compar)(const void *, const void *))
209 #endif /* QSORT_CAST */
210 #define SIGNAL_CAST (__sighandler_t)
211 #define USE_GETCWD
212 #define USE_SETSID
213 #define HAVE_BZERO
214 #define HAVE_MEMMOVE
215 #define HAVE_VSNPRINTF
216 #define USE_SIGPROCMASK
217 #define USE_WAITPID
218 #define USE_SYSV_IPC
219 #if 0
220 /* SETFS disabled until we can check on some bug reports */
221 #if _LINUX_C_LIB_VERSION_MAJOR >= 5
222 #define USE_SETFS
223 #endif
224 #endif
225 #ifdef SHADOW_PWD
226 #if _LINUX_C_LIB_VERSION_MAJOR < 5
227 #ifndef crypt
228 #define crypt pw_encrypt
229 #endif
230 #endif
231 #endif
232 #endif
233 
234 #ifdef SUNOS4
235 #define SIGNAL_CAST (void (*)(int))
236 #include <netinet/tcp.h>
237 #include <dirent.h>
238 #include <sys/acct.h>
239 #include <sys/vfs.h>
240 #include <string.h>
241 #include <strings.h>
242 #include <errno.h>
243 #include <sys/wait.h>
244 #include <signal.h>
245 /* #include <termios.h> */
246 #ifdef sun386
247 #define NO_STRFTIME
248 #define NO_UTIMBUF
249 #define mktime timelocal
250 typedef unsigned short mode_t;
251 #else
252 #include <utime.h>
253 #define NO_STRERROR
254 #endif
255 #ifndef REPLACE_GETPASS
256 #define REPLACE_GETPASS
257 #endif
258 #ifndef BSD_TERMIO
259 #define BSD_TERMIO
260 #endif
261 #ifndef USE_SIGPROCMASK
262 #define USE_SIGPROCMASK
263 #endif
264 #ifndef USE_WAITPID
265 #define USE_WAITPID
266 #endif
267 #define USE_SYSV_IPC
268 /* SunOS doesn't have POSIX atexit */
269 #define atexit on_exit
270 #define NOSTRCASECMP
271 #endif
272 
273 
274 #ifdef SUNOS5
275 #include <fcntl.h>
276 #include <dirent.h>
277 #include <sys/acct.h>
278 #include <sys/statfs.h>
279 #include <sys/statvfs.h>
280 #include <sys/filio.h>
281 #include <sys/sockio.h>
282 #include <netinet/in_systm.h>
283 #include <netinet/tcp.h>
284 #include <netinet/ip.h>
285 #include <string.h>
286 #include <arpa/inet.h>
287 #include <rpcsvc/ypclnt.h>
288 #include <termios.h>
289 #include <sys/stropts.h>
290 #if !defined(USE_LIBDES) && !defined(KRB4_AUTH)
291 #include <crypt.h>
292 #endif /* !USE_LIBDES && !KRB4_AUTH */
293 extern int gettimeofday (struct timeval *, void *);
294 extern int gethostname (char *name, int namelen);
295 extern int innetgr (const char *, const char *, const char *, const char *);
296 #define USE_SETVBUF
297 #define SIGNAL_CAST (void (*)(int))
298 #ifndef SYSV
299 #define SYSV
300 #endif
301 #define USE_WAITPID
302 #define REPLACE_STRLEN
303 #define USE_STATVFS
304 #define USE_GETCWD
305 #define USE_SETSID
306 #define USE_SYSV_IPC
307 #define NO_SEMUN
308 #ifndef REPLACE_GETPASS
309 #define REPLACE_GETPASS
310 #endif /* REPLACE_GETPASS */
311 #define USE_SIGPROCMASK
312 #endif
313 
314 
315 #ifdef ULTRIX
316 #include <strings.h>
317 #include <nfs/nfs_clnt.h>
318 #include <nfs/vfs.h>
319 #include <netinet/tcp.h>
320 #ifdef ULTRIX_AUTH
321 #include <auth.h>
322 #endif
323 char *getwd(char *);
324 #define NOSTRDUP
325 #ifdef __STDC__
326 #define SIGNAL_CAST (void(*)(int))
327 #endif
328 #define USE_DIRECT
329 #define USE_WAITPID
330 #endif
331 
332 #ifdef SGI4
333 #include <netinet/tcp.h>
334 #include <sys/statfs.h>
335 #include <string.h>
336 #include <signal.h>
337 #ifndef SYSV
338 #define SYSV
339 #endif
340 #define SIGNAL_CAST (void (*)())
341 #define STATFS4
342 #define USE_WAITPID
343 #define USE_DIRECT
344 #define USE_SETSID
345 #define USE_SYSV_IPC
346 #endif
347 
348 #if defined(SGI5) || defined(SGI6)
349 #include <arpa/inet.h>
350 #include <netinet/tcp.h>
351 #include <netinet/in_systm.h>
352 #include <netinet/ip.h>
353 #include <sys/statvfs.h>
354 #include <string.h>
355 #include <signal.h>
356 #include <dirent.h>
357 #define USE_WAITPID
358 #define NETGROUP
359 #ifndef SYSV
360 #define SYSV
361 #endif
362 #define SIGNAL_CAST (void (*)())
363 #define USE_STATVFS
364 #define USE_WAITPID
365 #define USE_SETSID
366 #define USE_SYSV_IPC
367 #ifndef QSORT_CAST
368 #define QSORT_CAST (int (*compar)(const void *, const void *))
369 #endif /* QSORT_CAST */
370 #endif
371 
372 
373 #ifdef MIPS
374 #include <bsd/net/soioctl.h>
375 #include <string.h>
376 #include <dirent.h>
377 #include <fcntl.h>
378 #include <sys/statfs.h>
379 #include <sys/wait.h>
380 #include <sys/termio.h>
381 #define SIGNAL_CAST (void (*)())
382 typedef int mode_t;
383 extern struct group *getgrnam();
384 extern struct passwd *getpwnam();
385 #define STATFS4
386 #define NO_STRERROR
387 #define REPLACE_STRSTR
388 #endif /* MIPS */
389 
390 
391 
392 #ifdef DGUX
393 #include <string.h>
394 #include <dirent.h>
395 #include <sys/statfs.h>
396 #include <sys/statvfs.h>
397 #include <fcntl.h>
398 #include <termios.h>
399 #define SYSV
400 #define USE_WAITPID
401 #define SIGNAL_CAST (void (*)(int))
402 #define STATFS4
403 #define USE_GETCWD
404 #endif
405 
406 
407 #ifdef SVR4
408 #include <string.h>
409 #include <sys/dir.h>
410 #include <dirent.h>
411 #include <sys/statfs.h>
412 #include <sys/statvfs.h>
413 #include <sys/vfs.h>
414 #include <sys/filio.h>
415 #include <fcntl.h>
416 #include <sys/sockio.h>
417 #include <netinet/tcp.h>
418 #include <stropts.h>
419 #include <termios.h>
420 #define SYSV
421 #define USE_WAITPID
422 #define SIGNAL_CAST (void (*)(int))
423 #define USE_STATVFS
424 #define USE_GETCWD
425 #define USE_SETSID
426 #define USE_SYSV_IPC
427 #define NO_SEMUN
428 #endif
429 
430 
431 #ifdef OSF1
432 #include <termios.h>
433 #include <strings.h>
434 #include <dirent.h>
435 char *getwd(char *);
436 char *mktemp(char *); /* No standard include */
437 #include <netinet/in.h>
438 #include <arpa/inet.h> /* both for inet_ntoa */
439 #define SIGNAL_CAST ( void (*) (int) )
440 #define STATFS3
441 #define USE_F_FSIZE
442 #define USE_SETSID
443 #include <netinet/tcp.h>
444 #ifdef OSF1_ENH_SEC
445 #include <pwd.h>
446 #include <sys/types.h>
447 #include <sys/security.h>
448 #include <prot.h>
449 #include <unistd.h>
450 #define PASSWORD_LENGTH 16
451 #define NEED_AUTH_PARAMETERS
452 #endif  /* OSF1_ENH_SEC */
453 #define USE_SYSV_IPC
454 #define NO_SEMUN
455 #endif
456 
457 
458 #ifdef CLIX
459 #include <dirent.h>
460 #define SIGNAL_CAST	(void (*)())
461 #include <sys/fcntl.h>
462 #include <sys/statfs.h>
463 #include <string.h>
464 #define NO_EID
465 #define USE_WAITPID
466 #define STATFS4
467 #define NO_FSYNC
468 #define USE_GETCWD
469 #define USE_SETSID
470 #ifndef REPLACE_GETPASS
471 #define REPLACE_GETPASS
472 #endif /* REPLACE_GETPASS */
473 #define NO_GETRLIMIT
474 #endif	/* CLIX */
475 
476 
477 
478 #ifdef BSDI
479 #include <string.h>
480 #include <netinet/tcp.h>
481 #define SIGNAL_CAST (void (*)())
482 #define USE_DIRECT
483 #endif
484 
485 
486 #ifdef NETBSD
487 #ifdef NetBSD1_3
488 #include <string.h>
489 #ifdef ALLOW_CHANGE_PASSWORD
490 #include <termios.h>
491 #endif /* ALLOW_CHANGE_PASSWORD */
492 #else /* NetBSD1_3 */
493 #include <strings.h>
494 #endif /* NetBSD1_3 */
495 #include <netinet/tcp.h>
496 /* you may not need this */
497 #define NO_GETSPNAM
498 #define SIGNAL_CAST (void (*)())
499 #define USE_DIRECT
500 #define REPLACE_INNETGR
501 #endif
502 
503 
504 
505 #ifdef FreeBSD
506 #include <arpa/inet.h>
507 #include <strings.h>
508 #include <netinet/tcp.h>
509 #include <netinet/in_systm.h>
510 #include <netinet/ip.h>
511 #include <termios.h>
512 #if __FreeBSD__ >= 3
513 #include <dirent.h>
514 #else
515 #define USE_DIRECT
516 #endif
517 #define SIGNAL_CAST (void (*)(int))
518 #define USE_SETVBUF
519 #define USE_SETSID
520 #define USE_GETCWD
521 #define USE_WAITPID
522 #define HAVE_MEMMOVE
523 #define HAVE_BZERO
524 #define HAVE_GETTIMEOFDAY
525 #define HAVE_PATHCONF
526 #define HAVE_GETGRNAM 1
527 #ifndef QSORT_CAST
528 #define QSORT_CAST (int (*compar)(const void *, const void *))
529 #endif /* QSORT_CAST */
530 #if !defined(O_SYNC)
531 #if defined(O_FSYNC)
532 #define O_SYNC O_FSYNC
533 #else /* defined(O_FSYNC) */
534 #define O_SYNC 0
535 #endif /* defined(O_FSYNC) */
536 #endif /* !defined(O_SYNC) */
537 #define HAVE_VSNPRINTF
538 #endif /* FreeBSD */
539 
540 #ifdef __OpenBSD__
541 #include <strings.h>
542 #include <netinet/tcp.h>
543 #define NO_GETSPNAM
544 #define SIGNAL_CAST (void (*)())
545 #ifndef QSORT_CAST
546 #define QSORT_CAST (int (*compar)(const void *, const void *))
547 #endif /* QSORT_CAST */
548 #define USE_DIRECT
549 #define REPLACE_INNETGR
550 #define HAVE_BZERO
551 #define HAVE_PATHCONF
552 #define HAVE_GETGRNAM 1
553 #define HAVE_GETTIMEOFDAY
554 #define HAVE_MEMMOVE
555 #define USE_GETCWD
556 #define USE_SETSID
557 #endif
558 
559 #ifdef AIX
560 #include <strings.h>
561 #include <sys/dir.h>
562 #include <sys/select.h>
563 #include <dirent.h>
564 #include <sys/statfs.h>
565 #include <sys/vfs.h>
566 #include <sys/id.h>
567 #include <sys/priv.h>
568 /* According to AIX 4.1 man pages, inet_ntoa needs the following headers */
569 #include <sys/socket.h>
570 #include <netinet/in.h>
571 #include <arpa/inet.h>
572 #include <netinet/tcp.h>
573 #include <locale.h>
574 #define SYSV
575 #define USE_WAITPID
576 #define USE_SIGBLOCK
577 #define SIGNAL_CAST (void (*)())
578 #define DEFAULT_PRINTING PRINT_AIX
579 /* we undef this because sys/param.h is broken in aix. uggh. */
580 #undef MAXHOSTNAMELEN
581 #endif
582 
583 
584 #ifdef HPUX
585 #include <string.h>
586 #include <dirent.h>
587 #include <fcntl.h>
588 #include <sys/vfs.h>
589 #include <sys/types.h>
590 #include <sys/termios.h>
591 #include <netinet/tcp.h>
592 #include <arpa/inet.h>                /* needed for inet_ntoa proto */
593 #include <stropts.h>
594 #ifdef HPUX_10_TRUSTED
595 #include <hpsecurity.h>
596 #include <prot.h>
597 #define NEED_AUTH_PARAMETERS
598 #endif
599 #define SIGNAL_CAST (void (*)(__harg))
600 #ifndef HPUX10 /* This is only needed for HPUX 9.x */
601 #define SELECT_CAST (int *)
602 #endif /* HPUX10 */
603 #define SYSV
604 #define USE_WAITPID
605 #define WAIT3_CAST2 (int *)
606 #define USE_GETCWD
607 #define USE_SETSID
608 #define USE_SETRES
609 #define USE_SYSV_IPC
610 #define NO_SEMUN
611 #define DEFAULT_PRINTING PRINT_HPUX
612 /* Ken Weiss <krweiss@ucdavis.edu> tells us that SIGCLD_IGNORE is
613    not good for HPUX */
614 /* #define SIGCLD_IGNORE */
615 #define USE_SIGPROCMASK /* Needed to stop zombie processes on HPUX 9.x and 10.x.*/
616 #endif /* HPUX */
617 
618 
619 #ifdef SEQUENT
620 #include <signal.h>
621 #include <string.h>
622 #include <dirent.h>
623 #include <sys/types.h>
624 #include <sys/statfs.h>
625 #include <sys/stat.h>
626 #include <sys/buf.h>
627 #include <sys/socket.h>
628 #include <unistd.h>
629 #include <fcntl.h>
630 #define SIGNAL_CAST (void (*)(int))
631 #define USE_WAITPID
632 #define USE_GETCWD
633 #define NO_EID
634 #define STATFS4
635 #define USE_DIRECT
636 #ifdef PTX4
637 #undef USE_DIRECT
638 #endif
639 #endif
640 
641 
642 
643 #ifdef SEQUENT_PTX4
644 #include <string.h>
645 #include <sys/dir.h>
646 #include <dirent.h>
647 #include <sys/statfs.h>
648 #include <sys/statvfs.h>
649 #include <sys/vfs.h>
650 #include <fcntl.h>
651 #include <sys/sockio.h>
652 #include <netinet/tcp.h>
653 #include <stropts.h>
654 #include <termios.h>
655 #define SYSV
656 #define USE_WAITPID
657 #define SIGNAL_CAST (void (*)(int))
658 #define USE_STATVFS
659 #define USE_GETCWD
660 #ifndef seteuid
661 #define seteuid(uid) setreuid(-1,uid)
662 #endif
663 #ifndef setegid
664 #define setegid(gid) setregid(-1,gid)
665 #endif
666 #endif
667 
668 
669 #ifdef NEXT2
670 #include <sys/types.h>
671 #include <strings.h>
672 #include <dirent.h>
673 #include <sys/vfs.h>
674 #define bzero(b,len) memset(b,0,len)
675 #define mode_t int
676 #define NO_UTIMBUF
677 #include <libc.h>
678 #define NOSTRDUP
679 #define USE_DIRECT
680 #define USE_WAITPID
681 #endif
682 
683 
684 #ifdef NEXT3_0
685 #include <strings.h>
686 #include <sys/dir.h>
687 #include <sys/vfs.h>
688 #define bzero(b,len) memset(b,0,len)
689 #define NO_UTIMBUF
690 #include <libc.h>
691 #define NOSTRDUP
692 #define USE_DIRECT
693 #define mode_t int
694 #define GID_TYPE int
695 #define gid_t int
696 #define pid_t int
697 #define SIGNAL_CAST (void (*)(int))
698 #define WAIT3_CAST1 (union wait *)
699 #define HAVE_GMTOFF
700 #endif
701 
702 
703 
704 #ifdef APOLLO
705 #include <string.h>
706 #include <fcntl.h>
707 #include <sys/statfs.h>
708 #define NO_UTIMBUF
709 #define USE_DIRECT
710 #define USE_GETCWD
711 #define SIGNAL_CAST     (void (*)())
712 #define HAVE_FCNTL_LOCK 0
713 #define HAVE_GETTIMEOFDAY
714 #define STATFS4
715 #endif
716 
717 
718 
719 #ifdef SCO
720 #include <sys/netinet/tcp.h>
721 #include <sys/netinet/in_systm.h>
722 #include <sys/netinet/ip.h>
723 #include <dirent.h>
724 #include <string.h>
725 #include <termios.h>
726 #include <fcntl.h>
727 #include <sys/statfs.h>
728 #include <sys/stropts.h>
729 #include <limits.h>
730 #include <locale.h>
731 #ifdef EVEREST
732 #include <unistd.h>
733 #endif /* EVEREST */
734 #ifdef NETGROUP
735 #include <rpcsvc/ypclnt.h>
736 #endif /* NETGROUP */
737 #ifdef SecureWare
738 #include <sys/security.h>
739 #include <sys/audit.h>
740 #include <prot.h>
741 #define crypt bigcrypt
742 #endif /* SecureWare */
743 #define SIGNAL_CAST (void (*)(int))
744 #define USE_WAITPID
745 #define USE_GETCWD
746 #define USE_SETSID
747 #ifdef SCO3_2_2
748 #define setuid(u) setreuid(u,-1)
749 #define seteuid(u) setreuid(-1,u)
750 #else /* SCO3_2_2 */
751 #ifndef EVEREST
752 #define ftruncate(f,l) syscall(0x0a28,f,l)
753 #define USE_IFREQ
754 #define NO_INITGROUPS
755 #endif /* EVEREST */
756 #endif /* SCO3_2_2 */
757 #define STATFS4
758 #define NO_FSYNC
759 #define HAVE_PATHCONF
760 #define NO_GETRLIMIT
761 #endif /* SCO */
762 
763 
764 
765 /* Definitions for RiscIX */
766 #ifdef RiscIX
767 #define SIGNAL_CAST (void (*)(int))
768 #include <sys/dirent.h>
769 #include <sys/acct.h>
770 #include <sys/vfs.h>
771 #include <string.h>
772 #include <utime.h>
773 #include <signal.h>
774 #define HAVE_GETTIMEOFDAY
775 #define NOSTRCASECMP
776 #define NOSTRDUP
777 #endif
778 
779 
780 
781 #ifdef ISC
782 #include <net/errno.h>
783 #include <string.h>
784 #include <sys/dir.h>
785 #include <dirent.h>
786 #include <sys/statfs.h>
787 #include <fcntl.h>
788 #include <sys/sioctl.h>
789 #include <stropts.h>
790 #include <limits.h>
791 #include <netinet/tcp.h>
792 #define FIONREAD FIORDCHK
793 #define SYSV
794 #define USE_WAITPID
795 #define SIGNAL_CAST (void (*)(int))
796 #define USE_GETCWD
797 #define USE_SETSID
798 #define USE_IFREQ
799 #define NO_FTRUNCATE
800 #define STATFS4
801 #define NO_FSYNC
802 #endif
803 
804 
805 
806 #ifdef AUX
807 #include <fstab.h>
808 #include <string.h>
809 #include <dirent.h>
810 #include <sys/vfs.h>
811 #include <fcntl.h>
812 #include <termios.h>
813 #define SYSV
814 #define USE_WAITPID
815 #define SIGNAL_CAST (void (*)(int))
816 char *strdup (char *);
817 #define USE_GETCWD
818 #endif
819 
820 
821 #ifdef M88K_R3
822 #include <string.h>
823 #include <dirent.h>
824 #include <fcntl.h>
825 #include <termios.h>
826 #define STATFS4
827 #define SYSV
828 #define USE_WAITPID
829 #define SIGNAL_CAST (void (*)(int))
830 char *strdup (char *);
831 #define USE_GETCWD
832 #define NO_FSYNC
833 #define NO_EID
834 #endif
835 
836 
837 #ifdef DNIX
838 #include <dirent.h>
839 #include <string.h>
840 #include <fcntl.h>
841 #include <sys/statfs.h>
842 #include <sys/stropts.h>
843 #define NO_GET_BROADCAST
844 #define USE_WAITPID
845 #define USE_GETCWD
846 #define USE_SETSID
847 #define STATFS4
848 #define NO_EID
849 #define PF_INET AF_INET
850 #define NO_STRERROR
851 #define ftruncate(f,l) chsize(f,l)
852 #endif /* DNIX */
853 
854 #ifdef CONVEX
855 #include <netinet/tcp.h>
856 #include <arpa/inet.h>
857 #include <dirent.h>
858 #include <string.h>
859 #include <sys/vfs.h>
860 #include <fcntl.h>
861 #define DONT_REINSTALL_SIG
862 #define USE_SIGBLOCK
863 #define USE_WAITPID
864 #define SIGNAL_CAST (_SigFunc_Ptr_t)
865 #define NO_GETSPNAM
866 #define HAVE_MEMMOVE
867 extern char *mktemp(char *);
868 extern int  fsync(int);
869 extern int  seteuid(uid_t);
870 extern int  setgroups(int, int *);
871 extern int  initgroups(char *, int);
872 extern int  statfs(char *, struct statfs *);
873 extern int  setegid(gid_t);
874 extern int  getopt(int, char *const *, const char *);
875 extern int  chroot(char *);
876 extern int  gettimeofday(struct timeval *, struct timezone *);
877 extern int  gethostname(char *, int);
878 extern char *crypt(char *, char *);
879 extern char *getpass(char *);
880 #endif
881 
882 
883 #ifdef CRAY
884 #define MAXPATHLEN 1024
885 #include <dirent.h>
886 #include <string.h>
887 #include <fcntl.h>
888 #include <sys/statfs.h>
889 #define SIGNAL_CAST (void (*)(int))
890 #define SIGCLD_IGNORE
891 #define HAVE_FCNTL_LOCK 1
892 #define USE_SETSID
893 #define STATFS4
894 #endif
895 
896 
897 #ifdef ALTOS
898 #include <unistd.h>
899 #include <string.h>
900 #include <dirent.h>
901 #include <sys/fcntl.h>
902 #include <sys/statfs.h>
903 #define        const
904 #define        uid_t           int
905 #define        gid_t           int
906 #define        mode_t          int
907 #define        ptrdiff_t       int
908 #define HAVE_GETGRNAM  0
909 #define NO_EID
910 #define NO_FSYNC
911 #define        NO_FTRUNCATE
912 #define        NO_GETRLIMIT
913 #define        NO_INITGROUPS
914 #define NO_SELECT
915 #define NO_SETGROUPS
916 #define NO_STRERROR
917 #define NO_STRFTIME
918 #define        NO_TM_NAME
919 #define NO_UTIMEH
920 #define NOSTRCASECMP
921 #define REPLACE_MKTIME
922 #define REPLACE_RENAME
923 #define REPLACE_STRSTR
924 #define STATFS4
925 #define        USE_GETCWD
926 #endif
927 
928 #ifdef QNX
929 #define STATFS4
930 #include <sys/statfs.h>
931 #include <sys/select.h>
932 #include <signal.h>
933 #include <sys/dir.h>
934 #define SIGNAL_CAST (void (*)())
935 #define USE_WAITPID
936 #define NO_INITGROUPS
937 #define NO_SETGROUPS
938 #define HAVE_TIMEZONE
939 #define USE_GETCWD
940 #define USE_SETSID
941 #define HAVE_FCNTL_LOCK 1
942 #define DEFAULT_PRINTING PRINT_QNX
943 #endif
944 
945 
946 #ifdef NEWS42
947 #include <string.h>
948 #include <dirent.h>
949 #include <sys/vfs.h>
950 #include <sys/timeb.h>
951 typedef int mode_t;
952 #endif
953 
954 #ifdef OS2
955 #include <dirent.h>
956 #include <sys/statfs.h>
957 #include <string.h>
958 #include <limits.h>
959 #define SIGNAL_CAST (void (*)())
960 #define HAVE_FCNTL_LOCK 0
961 #define USE_WAITPID
962 #define NO_GET_BROADCAST
963 #define NO_EID
964 #define NO_SETGROUPS
965 #define NO_INITGROUPS
966 #define NO_CRYPT
967 #define NO_STATFS
968 #define NO_CHROOT
969 #define NO_CHOWN
970 #define strcasecmp stricmp
971 #define strncasecmp strnicmp
972 #endif
973 
974 
975 #ifdef LYNX
976 #define SIGNAL_CAST (void (*)())
977 #define WAIT3_CAST1 (union wait *)
978 #define STATFS4
979 #include <fcntl.h>
980 #include <resource.h>
981 #include <stat.h>
982 #include <string.h>
983 #include <dirent.h>
984 #include <sys/statfs.h>
985 #define USE_GETCWD
986 #define USE_GETSID
987 #endif
988 
989 
990 #ifdef BOS
991 #define SIGNAL_CAST (void (*)(int))
992 #include <string.h>
993 #include <sys/dir.h>
994 #include <sys/select.h>
995 #include <dirent.h>
996 #include <fcntl.h>
997 #include <signal.h>
998 #include <sys/statfs.h>
999 #include <sys/bsdioctl.h>
1000 #endif
1001 
1002 #ifdef AMIGA
1003 #include <arpa/inet.h>
1004 #include <dirent.h>
1005 #include <string.h>
1006 #include <netinet/tcp.h>
1007 #include <sys/acct.h>
1008 #include <sys/fcntl.h>
1009 #include <sys/filio.h>
1010 #include <sys/sockio.h>
1011 #include <netinet/in_systm.h>
1012 #include <netinet/ip.h>
1013 #include <sys/termios.h>
1014 #include <limits.h>
1015 #include <sys/timeb.h>
1016 
1017 #define SIGNAL_CAST (void (*)(int))
1018 #define USE_GETCWD
1019 #define HAVE_BZERO
1020 #define HAVE_MEMMOVE
1021 #define USE_SIGPROCMASK
1022 #define USE_WAITPID
1023 #define USE_DIRECT
1024 #define USE_F_FSIZE
1025 #define HAVE_FCNTL_LOCK 0
1026 #define HAVE_GETTIMEOFDAY
1027 #define HAVE_PATHCONF
1028 
1029 #define HAVE_NO_PROC
1030 #define NO_FORK_DEBUG
1031 #define HAVE_FORK 0
1032 #define HAVE_VFORK 1
1033 #endif
1034 
1035 /* For UnixWare 2.x's ia_uinfo routines. (tangent@cyberport.com) */
1036 #ifdef IA_UINFO
1037 #include <iaf.h>
1038 #include <ia.h>
1039 #endif
1040 
1041 
1042 /*******************************************************************
1043 end of the platform specific sections
1044 ********************************************************************/
1045 
1046 #if defined(USE_MMAP) || defined(FAST_SHARE_MODES)
1047 #include <sys/mman.h>
1048 #endif
1049 
1050 #ifdef SecureWare
1051 #define NEED_AUTH_PARAMETERS
1052 #endif
1053 
1054 #ifdef REPLACE_GETPASS
1055 extern char    *getsmbpass(char *);
1056 #define getpass(s) getsmbpass(s)
1057 #endif
1058 
1059 #ifdef REPLACE_INNETGR
1060 #define innetgr(group,host,user,dom) InNetGr(group,host,user,dom)
1061 #endif
1062 
1063 #ifndef FD_SETSIZE
1064 #define FD_SETSIZE 255
1065 #endif
1066 
1067 #ifndef __STDC__
1068 #define const
1069 #endif
1070 
1071 /* Now for some other grungy stuff */
1072 #ifdef NO_GETSPNAM
1073 struct spwd { /* fake shadow password structure */
1074        char *sp_pwdp;
1075 };
1076 #endif
1077 
1078 #ifndef HAVE_BZERO
1079 #ifndef bzero
1080 #define bzero(p,s) memset(p,0,s)
1081 #endif
1082 #endif
1083 
1084 #ifndef HAVE_MEMMOVE
1085 #ifndef memmove
1086 #define memmove(d,s,n) MemMove(d,s,n)
1087 #endif
1088 #endif
1089 
1090 #ifdef USE_DIRECT
1091 #include <sys/dir.h>
1092 #endif
1093 
1094 /* some unixes have ENOTTY instead of TIOCNOTTY */
1095 #ifndef TIOCNOTTY
1096 #ifdef ENOTTY
1097 #define TIOCNOTTY ENOTTY
1098 #endif
1099 #endif
1100 
1101 #ifndef SIGHUP
1102 #define SIGHUP 1
1103 #endif
1104 
1105 /* if undefined then use bsd or sysv printing */
1106 #ifndef DEFAULT_PRINTING
1107 #ifdef SYSV
1108 #define DEFAULT_PRINTING PRINT_SYSV
1109 #else
1110 #define DEFAULT_PRINTING PRINT_BSD
1111 #endif
1112 #endif
1113 
1114 /* This defines the name of the printcap file. It is MOST UNLIKELY that
1115    this will change BUT! Specifying a file with the format of a printcap
1116    file but containing only a subset of the printers actually in your real
1117    printcap file is a quick-n-dirty way to allow dynamic access to a subset
1118    of available printers.
1119 */
1120 #ifndef PRINTCAP_NAME
1121 #ifdef AIX
1122 #define PRINTCAP_NAME "/etc/qconfig"
1123 #elif defined(SYSV)
1124 #define PRINTCAP_NAME "lpstat"
1125 #else
1126 #define PRINTCAP_NAME "/etc/printcap"
1127 #endif
1128 #endif
1129 
1130 
1131 #ifdef USE_SYSV_IPC
1132 #include <sys/ipc.h>
1133 #include <sys/sem.h>
1134 #include <sys/shm.h>
1135 #ifdef NO_SEMUN
1136 union semun {
1137 	int val;
1138 	struct semid_ds *buf;
1139 	unsigned short *array;
1140 };
1141 #endif
1142 #if defined(HPUX) && defined(HPUX10)
1143 #ifdef SEMMSL
1144 #undef SEMMSL
1145 #endif /* SEMMSL */
1146 #endif /* HPUX && HPUX10 */
1147 #endif
1148 
1149 #ifdef AFS_AUTH
1150 #include <afs/stds.h>
1151 #include <afs/kautils.h>
1152 #endif
1153 
1154 #ifdef DFS_AUTH
1155 #include <dce/dce_error.h>
1156 #include <dce/sec_login.h>
1157 #endif
1158 
1159 #ifdef KRB5_AUTH
1160 #include <krb5.h>
1161 #endif
1162 
1163 #ifdef KRB4_AUTH
1164 #include <krb.h>
1165 #endif
1166 
1167 #ifdef NO_UTIMBUF
1168 struct utimbuf {
1169   time_t actime;
1170   time_t modtime;
1171 };
1172 #endif
1173 
1174 #ifdef NO_STRERROR
1175 #ifndef strerror
1176 extern char *sys_errlist[];
1177 #define strerror(i) sys_errlist[i]
1178 #endif
1179 #endif
1180 
1181 #ifndef perror
1182 #define perror(m) printf("%s: %s\n",m,strerror(errno))
1183 #endif
1184 
1185 #ifndef MAXHOSTNAMELEN
1186 #define MAXHOSTNAMELEN 255
1187 #endif
1188 
1189 #include "version.h"
1190 #include "smb.h"
1191 #include "nameserv.h"
1192 #include "ubiqx/ubi_dLinkList.h"
1193 
1194 #include "byteorder.h"
1195 
1196 #include "kanji.h"
1197 #include "charset.h"
1198 
1199 #ifndef MAXCODEPAGELINES
1200 #define MAXCODEPAGELINES 256
1201 #endif
1202 
1203 /***** automatically generated prototypes *****/
1204 #include "proto.h"
1205 
1206 
1207 
1208 #ifndef S_IFREG
1209 #define S_IFREG 0100000
1210 #endif
1211 
1212 #ifndef S_ISREG
1213 #define S_ISREG(x) ((S_IFREG & (x))!=0)
1214 #endif
1215 
1216 #ifndef S_ISDIR
1217 #define S_ISDIR(x) ((S_IFDIR & (x))!=0)
1218 #endif
1219 
1220 #if !defined(S_ISLNK) && defined(S_IFLNK)
1221 #define S_ISLNK(x) ((S_IFLNK & (x))!=0)
1222 #endif
1223 
1224 #ifdef UFC_CRYPT
1225 #define crypt ufc_crypt
1226 #endif
1227 
1228 #ifdef REPLACE_STRLEN
1229 #define strlen(s) Strlen(s)
1230 #endif
1231 
1232 #ifdef REPLACE_STRSTR
1233 #define strstr(s,p) Strstr(s,p)
1234 #endif
1235 
1236 #ifdef REPLACE_MKTIME
1237 #define mktime(t) Mktime(t)
1238 #endif
1239 
1240 #ifndef NGROUPS_MAX
1241 #define NGROUPS_MAX 128
1242 #endif
1243 
1244 #ifndef EDQUOT
1245 #define EDQUOT ENOSPC
1246 #endif
1247 
1248 #ifndef HAVE_GETGRNAM
1249 #define HAVE_GETGRNAM 1
1250 #endif
1251 
1252 #ifndef SOL_TCP
1253 #define SOL_TCP 6
1254 #endif
1255 
1256 /* default to using ftruncate workaround as this is safer than assuming
1257 it works and getting lots of bug reports */
1258 #ifndef FTRUNCATE_CAN_EXTEND
1259 #define FTRUNCATE_CAN_EXTEND 0
1260 #endif
1261 
1262 /* maybe this unix doesn't separate RD and WR locks? */
1263 #ifndef F_RDLCK
1264 #define F_RDLCK F_WRLCK
1265 #endif
1266 
1267 #ifndef ENOTSOCK
1268 #define ENOTSOCK EINVAL
1269 #endif
1270 
1271 #ifndef SIGCLD
1272 #define SIGCLD SIGCHLD
1273 #endif
1274 
1275 #ifndef MAP_FILE
1276 #define MAP_FILE 0
1277 #endif
1278 
1279 #ifndef HAVE_FCNTL_LOCK
1280 #define HAVE_FCNTL_LOCK 1
1281 #endif
1282 
1283 #ifndef WAIT3_CAST2
1284 #define WAIT3_CAST2 (struct rusage *)
1285 #endif
1286 
1287 #ifndef WAIT3_CAST1
1288 #define WAIT3_CAST1 (int *)
1289 #endif
1290 
1291 #ifndef QSORT_CAST
1292 #define QSORT_CAST (int (*compar)(const void *, const void *))
1293 #endif
1294 
1295 #ifndef INADDR_LOOPBACK
1296 #define INADDR_LOOPBACK 0x7f000001
1297 #endif /* INADDR_LOOPBACK */
1298 
1299 /* this is a rough check to see if this machine has a lstat() call.
1300    it is not guaranteed to work */
1301 #if !defined(S_ISLNK)
1302 #define lstat stat
1303 #endif
1304 
1305 /* Not all systems declare ERRNO in errno.h... and some systems #define it! */
1306 #ifndef errno
1307 extern int errno;
1308 #endif
1309 
1310 
1311 #ifdef NO_EID
1312 #define geteuid() getuid()
1313 #define getegid() getgid()
1314 #define seteuid(x) setuid(x)
1315 #define setegid(x) setgid(x)
1316 #endif
1317 
1318 
1319 #if (HAVE_FCNTL_LOCK == 0)
1320 /* since there is no locking available, system includes  */
1321 /* for DomainOS 10.4 do not contain any of the following */
1322 /* #define's. So, to satisfy the compiler, add these     */
1323 /* #define's, although they arn't really necessary.      */
1324 #define F_GETLK 0
1325 #define F_SETLK 0
1326 #define F_WRLCK 0
1327 #define F_UNLCK 0
1328 #endif /* HAVE_FCNTL_LOCK == 0 */
1329 
1330 #ifdef NOSTRCASECMP
1331 #define strcasecmp(s1,s2) StrCaseCmp(s1,s2)
1332 #define strncasecmp(s1,s2,n) StrnCaseCmp(s1,s2,n)
1333 #endif
1334 
1335 #ifdef strcpy
1336 #undef strcpy
1337 #endif /* strcpy */
1338 #define strcpy(dest,src) __ERROR__XX__NEVER_USE_STRCPY___;
1339 
1340 #ifdef strcat
1341 #undef strcat
1342 #endif /* strcat */
1343 #define strcat(dest,src) __ERROR__XX__NEVER_USE_STRCAT___;
1344 
1345 #ifdef sprintf
1346 #undef sprintf
1347 #endif /* sprintf */
1348 #define sprintf __ERROR__XX__NEVER_USE_SPRINTF__;
1349 
1350 #define pstrcpy(d,s) safe_strcpy((d),(s),sizeof(pstring)-1)
1351 #define pstrcat(d,s) safe_strcat((d),(s),sizeof(pstring)-1)
1352 #define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1)
1353 #define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-1)
1354 
1355 #if MEM_MAN
1356 #include "mem_man/mem_man.h"
1357 #endif
1358 
1359 #endif
1360