4 /* Necessary headers */
6 #include <sys/types.h> /* For u_intXX_t */
7 #include <sys/socket.h> /* For SHUT_XXXX */
10 # include <paths.h> /* For _PATH_XXX */
14 # include <utmp.h> /* For _PATH_XXX */
17 #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
18 # include <utmpx.h> /* For _PATH_XXX */
21 #ifdef HAVE_SYS_TIME_H
22 # include <sys/time.h> /* For timersub */
25 #ifdef HAVE_MAILLOCK_H
26 # include <maillock.h> /* For _PATH_MAILDIR */
29 #ifdef HAVE_SYS_CDEFS_H
30 # include <sys/cdefs.h> /* For __P() */
38 SHUT_RD = 0, /* No more receptions. */
39 SHUT_WR, /* No more transmissions. */
40 SHUT_RDWR /* No more receptions or transmissions. */
42 # define SHUT_RD SHUT_RD
43 # define SHUT_WR SHUT_WR
44 # define SHUT_RDWR SHUT_RDWR
49 /* If sys/types.h does not supply intXX_t, supply them ourselves */
52 # if (SIZEOF_SHORT_INT == 2)
53 typedef short int int16_t;
55 # error "16 bit int type not found."
57 # if (SIZEOF_INT == 4)
60 # error "32 bit int type not found."
62 # if (SIZEOF_LONG_INT == 8)
63 typedef long int int64_t;
65 # if (SIZEOF_LONG_LONG_INT == 8)
66 typedef long long int int64_t;
67 # define HAVE_INTXX_T 1
69 # error "64 bit int type not found."
74 /* If sys/types.h does not supply u_intXX_t, supply them ourselves */
75 #ifndef HAVE_U_INTXX_T
77 typedef uint16_t u_int16_t;
78 typedef uint32_t u_int32_t;
79 typedef uint64_t u_int64_t;
80 # define HAVE_U_INTXX_T 1
82 # if (SIZEOF_SHORT_INT == 2)
83 typedef unsigned short int u_int16_t;
85 # error "16 bit int type not found."
87 # if (SIZEOF_INT == 4)
88 typedef unsigned int u_int32_t;
90 # error "32 bit int type not found."
92 # if (SIZEOF_LONG_INT == 8)
93 typedef unsigned long int u_int64_t;
95 # if (SIZEOF_LONG_LONG_INT == 8)
96 typedef unsigned long long int u_int64_t;
97 # define HAVE_U_INTXX_T 1
99 # error "64 bit int type not found."
105 #ifndef HAVE_SOCKLEN_T
106 typedef unsigned int socklen_t;
107 # define HAVE_SOCKLEN_T
108 #endif /* HAVE_SOCKLEN_T */
111 typedef unsigned int size_t;
113 #endif /* HAVE_SIZE_T */
117 /* If _PATH_LASTLOG is not defined by system headers, set it to the */
118 /* lastlog file detected by autoconf */
119 #ifndef _PATH_LASTLOG
120 # ifdef LASTLOG_LOCATION
121 # define _PATH_LASTLOG LASTLOG_LOCATION
127 # define _PATH_UTMP UTMP_FILE
129 # define _PATH_UTMP "/var/adm/utmp"
135 # define _PATH_WTMP WTMP_FILE
137 # define _PATH_WTMP "/var/adm/wtmp"
141 #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
144 # define _PATH_UTMPX UTMPX_FILE
146 # define _PATH_UTMPX "/var/adm/utmpx"
151 # define _PATH_WTMPX WTMPX_FILE
153 # define _PATH_WTMPX "/var/adm/wtmp"
159 # define _PATH_BSHELL "/bin/sh"
163 # ifdef _PATH_STDPATH
164 # undef _PATH_STDPATH
166 # define _PATH_STDPATH USER_PATH
169 #ifndef _PATH_STDPATH
170 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
173 #ifndef _PATH_DEVNULL
174 # define _PATH_DEVNULL "/dev/null"
178 # define MAILDIR MAIL_DIRECTORY
181 #if !defined(_PATH_MAILDIR) && defined(MAILDIR)
182 # define _PATH_MAILDIR MAILDIR
183 #endif /* !defined(_PATH_MAILDIR) && defined(MAILDIR) */
187 # define _PATH_RSH RSH_PATH
188 # endif /* RSH_PATH */
189 #endif /* _PATH_RSH */
194 # define MAX(a,b) (((a)>(b))?(a):(b))
195 # define MIN(a,b) (((a)<(b))?(a):(b))
199 #define timersub(a, b, result) \
201 (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
202 (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
203 if ((result)->tv_usec < 0) { \
204 --(result)->tv_sec; \
205 (result)->tv_usec += 1000000; \
214 #if !defined(__GNUC__) || (__GNUC__ < 2)
215 # define __attribute__(x)
216 #endif /* !defined(__GNUC__) || (__GNUC__ < 2) */
218 #if defined(HAVE_SECURITY_PAM_APPL_H) && !defined(DISABLE_PAM)
220 #endif /* defined(HAVE_SECURITY_PAM_APPL_H) && !defined(DISABLE_PAM) */
222 /* Function replacement / compatibility hacks */
224 /* In older versions of libpam, pam_strerror takes a single argument */
226 # define PAM_STRERROR(a,b) pam_strerror((b))
228 # define PAM_STRERROR(a,b) pam_strerror((a),(b))
231 #endif /* _DEFINES_H */