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