2 * Copyright (c) 1994 Regents of the University of Michigan.
5 * Redistribution and use in source and binary forms are permitted
6 * provided that this notice is preserved and that due credit is given
7 * to the University of Michigan at Ann Arbor. The name of the University
8 * may not be used to endorse or promote products derived from this
9 * software without specific prior written permission. This software
10 * is provided ``as is'' without express or implied warranty.
13 /* This file SHOULD go away !!! */
15 #ifndef _LDAP_BRIDGE_H
16 #define _LDAP_BRIDGE_H
19 * portable.h for LDAP -- this is where we define common stuff to make
20 * life easier on various Unix systems.
22 * Unless you are porting LDAP to a new platform, you should not need to
27 #ifndef NO_USERINTERFACE
28 #define NO_USERINTERFACE
33 #if defined( hpux ) || defined( sunos5 ) || defined ( sgi ) || defined( SVR4 )
40 * under System V, use sysconf() instead of getdtablesize
42 #if defined( HAVE_SYSCONF ) && !defined( HAVE_GETDTABLESIZE )
48 * under System V, daemons should use setsid() instead of detaching from their
51 #if defined( HAVE_SETSID )
57 * System V has socket options in filio.h
59 #if defined( HAVE_FILIO_H )
64 * use lockf() under System V
66 #if !defined( HAVE_LOCKF ) && !defined( HAVE_FLOCK )
71 * on most systems, we should use waitpid() instead of waitN()
73 #if defined( HAVE_WAITPID ) && !defined( nextstep )
79 * define the wait status argument type
81 #if !defined( WAITSTATUSTYPE )
82 #if !defined( HAVE_SYS_WAIT_H )
83 #define WAITSTATUSTYPE union wait
85 #define WAITSTATUSTYPE int
90 * define the flags for wait
92 #if !defined( WAIT_FLAGS )
94 #define WAIT_FLAGS ( WNOHANG | WUNTRACED | WCONTINUED )
96 #define WAIT_FLAGS ( WNOHANG | WUNTRACED )
102 * defined the options for openlog (syslog)
104 #if !defined( OPENLOG_OPTIONS )
106 #define OPENLOG_OPTIONS LOG_PID
108 #define OPENLOG_OPTIONS ( LOG_PID | LOG_NOWAIT )
114 * many systems do not have the setpwfile() library routine... we just
115 * enable use for those systems we know have it.
118 #ifndef HAVE_SETPWFILE
119 #if defined( sunos4 ) || defined( ultrix ) || defined( __osf__ )
120 #define HAVE_SETPWFILE
125 #ifndef DISABLE_BRIDGE
127 * Are sys_errlist and sys_nerr declared in stdio.h?
129 #ifndef SYSERRLIST_IN_STDIO
130 #if !defined( DECL_SYS_ERRLIST )
131 #define SYSERRLIST_IN_STDIO
138 #if !defined(FD_SET) && !defined(WINSOCK)
140 #define FD_SETSIZE 32
141 #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
142 #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
143 #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
144 #define FD_ZERO(p) bzero((char *)(p), sizeof(*(p)))
148 #if defined( hpux ) && defined( __STDC__ )
150 * Under HP/UX, select seems to want (int *) instead of fd_set. Non-ANSI
151 * compilers don't like recursive macros, so ignore the problem if __STDC__
154 #define select(a,b,c,d,e) select(a, (int *)b, (int *)c, (int *)d, e)
155 #endif /* hpux && __STDC__ */
159 * for signal() -- what do signal handling functions return?
162 #define SIG_FN RETSIGTYPE
167 * call signal or sigset (signal does not block the signal while
168 * in the handler on sys v and sigset does not exist on bsd)
172 #define SIGNAL sigset
174 #define SIGNAL signal
179 * toupper and tolower macros are different under bsd and sys v
181 #if defined( SYSV ) && !defined( hpux )
182 #define TOUPPER(c) (isascii(c) && islower(c) ? _toupper(c) : c)
183 #define TOLOWER(c) (isascii(c) && isupper(c) ? _tolower(c) : c)
185 #define TOUPPER(c) (isascii(c) && islower(c) ? toupper(c) : c)
186 #define TOLOWER(c) (isascii(c) && isupper(c) ? tolower(c) : c)
190 * put a cover on the tty-related ioctl calls we need to use
192 #if !defined( HAVE_TERMIOS_H )
193 #define TERMIO_TYPE struct sgttyb
194 #define TERMFLAG_TYPE int
195 #define GETATTR( fd, tiop ) ioctl((fd), TIOCGETP, (caddr_t)(tiop))
196 #define SETATTR( fd, tiop ) ioctl((fd), TIOCSETP, (caddr_t)(tiop))
197 #define GETFLAGS( tio ) (tio).sg_flags
198 #define SETFLAGS( tio, flags ) (tio).sg_flags = (flags)
201 #define TERMIO_TYPE struct termios
202 #define TERMFLAG_TYPE tcflag_t
203 #define GETATTR( fd, tiop ) tcgetattr((fd), (tiop))
204 #define SETATTR( fd, tiop ) tcsetattr((fd), TCSANOW /* 0 */, (tiop))
205 #define GETFLAGS( tio ) (tio).c_lflag
206 #define SETFLAGS( tio, flags ) (tio).c_lflag = (flags)
210 #if defined( ultrix ) || defined( nextstep )
211 extern char *strdup();
212 #endif /* ultrix || nextstep */
214 #endif /* _LDAP_BRIDGE_H */