14192
|
1 /* This file is part of the Project Athena Zephyr Notification System.
|
|
2 * It contains system-dependent header code.
|
|
3 *
|
|
4 * Created by: Greg Hudson
|
|
5 *
|
|
6 * Copyright (c) 1988,1991 by the Massachusetts Institute of Technology.
|
|
7 * For copying and distribution information, see the file
|
|
8 * "mit-copyright.h".
|
|
9 */
|
|
10
|
|
11 #ifndef __SYSDEP_H__
|
|
12 #define __SYSDEP_H__
|
|
13
|
|
14 #include <config.h>
|
|
15 #include <stdio.h>
|
|
16 #include <errno.h>
|
|
17 #include <ctype.h>
|
|
18 #include <time.h>
|
|
19 #include <signal.h>
|
|
20 #ifndef WIN32
|
|
21 #include <syslog.h>
|
|
22 #endif
|
|
23
|
|
24 #include <sys/types.h>
|
|
25 #include <sys/stat.h>
|
|
26 #include <sys/param.h>
|
|
27 #include <sys/time.h>
|
|
28
|
|
29 #if defined(STDC_HEADERS) || defined(HAVE_STDLIB_H)
|
|
30 # include <stdlib.h>
|
|
31 #else
|
|
32 # ifdef HAVE_MALLOC_H
|
|
33 # include <malloc.h>
|
|
34 # else
|
|
35 char *malloc(), *realloc(void);
|
|
36 # endif
|
|
37 char *getenv(), *strerror(), *ctime(), *strcpy(void);
|
|
38 time_t time(void);
|
|
39 ZEPHYR_INT32 random(void);
|
|
40 #endif
|
|
41
|
|
42 #ifndef HAVE_RANDOM
|
|
43 #ifdef HAVE_LRAND48
|
|
44 #define random lrand48
|
|
45 #define srandom srand48
|
|
46 #else
|
|
47 #define random rand
|
|
48 #define srandom srand
|
|
49 #endif
|
|
50 #endif
|
|
51
|
|
52 #ifndef HAVE_STRERROR
|
|
53 extern char *sys_errlist[];
|
|
54 # define strerror(x) (sys_errlist[(x)])
|
|
55 #endif
|
|
56
|
|
57 /* Strings. */
|
|
58 #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
|
|
59 # include <string.h>
|
|
60 #else
|
|
61 # ifndef HAVE_STRCHR
|
|
62 # define strchr index
|
|
63 # define strrchr rindex
|
|
64 # endif
|
|
65 char *strchr(), *strrchr(void);
|
|
66 # ifndef HAVE_MEMCPY
|
|
67 # define memcpy(d, s, n) bcopy ((s), (d), (n))
|
|
68 # define memcmp bcmp
|
|
69 # endif
|
|
70 # ifndef HAVE_MEMMOVE
|
|
71 # define memmove(d, s, n) bcopy ((s), (d), (n))
|
|
72 # endif
|
|
73 #endif
|
|
74
|
|
75 /* Exit status handling and wait(). */
|
|
76 #ifdef HAVE_SYS_WAIT_H
|
|
77 # include <sys/wait.h>
|
|
78 #endif
|
|
79 #ifndef WEXITSTATUS
|
|
80 # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
|
|
81 #endif
|
|
82 #ifndef WIFEXITED
|
|
83 # define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
|
|
84 #endif
|
|
85
|
|
86 #ifdef HAVE_SYS_CDEFS_H
|
|
87 #include <sys/cdefs.h>
|
|
88 #endif
|
|
89
|
|
90 /* Because we have public header files (and our prototypes need to agree with
|
|
91 * those header files, use __STDC__ to guess whether the compiler can handle
|
|
92 * stdarg, const, and prototypes. */
|
|
93 #ifdef __STDC__
|
|
94 # include <stdarg.h>
|
|
95 # define VA_START(ap, last) va_start(ap, last)
|
|
96 # ifndef __P
|
|
97 # define __P(x) x
|
|
98 # endif
|
|
99 #else
|
|
100 # include <varargs.h>
|
|
101 # define VA_START(ap, last) va_start(ap)
|
|
102 # define const
|
|
103 # ifndef __P
|
|
104 # define __P(x) ()
|
|
105 # endif
|
|
106 #endif
|
|
107
|
|
108 /* openlog(). */
|
|
109 #ifdef LOG_AUTH
|
|
110 /* A decent syslog */
|
|
111 #define OPENLOG(str, opts, facility) openlog(str, opts, facility)
|
|
112 #else
|
|
113 /* Probably a 4.2-type syslog */
|
|
114 #define OPENLOG(str, opts, facility) openlog(str, opts)
|
|
115 #endif
|
|
116
|
|
117 #ifdef HAVE_FCNTL_H
|
|
118 # include <fcntl.h>
|
|
119 #endif
|
|
120
|
|
121 #ifdef HAVE_PATHS_H
|
|
122 # include <paths.h>
|
|
123 # define TEMP_DIRECTORY _PATH_VARTMP
|
|
124 #else
|
|
125 # define TEMP_DIRECTORY FOUND_TMP
|
|
126 #endif
|
|
127
|
|
128 #ifdef HAVE_UNISTD_H
|
|
129 # include <unistd.h>
|
|
130 #else
|
|
131 # ifdef HAVE_SYS_FILE_H
|
|
132 # include <sys/file.h>
|
|
133 # endif
|
|
134 uid_t getuid(void);
|
|
135 char *ttyname(void);
|
|
136 #ifdef HAVE_GETHOSTID
|
|
137 ZEPHYR_INT32 gethostid(void);
|
|
138 #endif
|
|
139 #endif
|
|
140
|
|
141 #ifndef STDIN_FILENO
|
|
142 #define STDIN_FILENO 0
|
|
143 #define STDOUT_FILENO 1
|
|
144 #define STDERR_FILENO 2
|
|
145 #endif
|
|
146
|
|
147 #ifdef HAVE_TERMIOS_H
|
|
148 # include <termios.h>
|
|
149 #else
|
|
150 # ifdef HAVE_SYS_FILIO_H
|
|
151 # include <sys/filio.h>
|
|
152 # else
|
|
153 # ifdef HAVE_SGTTY_H
|
|
154 # include <sgtty.h>
|
|
155 # endif
|
|
156 # ifdef HAVE_SYS_IOCTL_H
|
|
157 # include <sys/ioctl.h>
|
|
158 # endif
|
|
159 # endif
|
|
160 #endif
|
|
161
|
|
162 /* Kerberos compatibility. */
|
|
163 #ifdef ZEPHYR_USES_KERBEROS
|
|
164 # include <krb.h>
|
|
165 #ifdef WIN32
|
|
166
|
|
167 #else
|
|
168 # include <krb_err.h>
|
|
169 #endif /* WIN32 */
|
|
170 # include <des.h>
|
|
171 #ifndef WIN32
|
|
172 # ifndef HAVE_KRB_GET_ERR_TEXT
|
|
173 # define krb_get_err_text(n) krb_err_txt[n]
|
|
174 # endif
|
|
175 #endif /* WIN32 */
|
|
176 # ifndef HAVE_KRB_LOG
|
|
177 # define krb_log log
|
|
178 # endif
|
|
179 #endif /* ZEPHYR_USES_KERBEROS */
|
|
180
|
|
181 #ifdef HAVE_SYS_UIO_H
|
|
182 # include <sys/uio.h>
|
|
183 #endif
|
|
184
|
|
185 #ifdef HAVE_SYS_UTSNAME_H
|
|
186 # include <sys/utsname.h>
|
|
187 #endif
|
|
188
|
|
189 #ifdef HAVE_SYS_SELECT_H
|
|
190 # include <sys/select.h>
|
|
191 #endif
|
|
192
|
|
193 #ifdef HAVE_SYS_MSGBUF_H
|
|
194 #include <sys/msgbuf.h>
|
|
195 #endif
|
|
196
|
|
197 #ifndef MSG_BSIZE
|
|
198 #define MSG_BSIZE BUFSIZ
|
|
199 #endif
|
|
200
|
|
201 #endif /* __SYSDEP_H__ */
|
|
202
|