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