]> asedeno.scripts.mit.edu Git - 1ts-debian.git/blob - zephyr/h/sysdep.h
unpack of new upstream
[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,v 1.3 1999/01/22 23:18:57 ghudson Exp $
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 #include <sys/types.h>
25 #include <sys/stat.h>
26 #include <sys/param.h>
27 #include <sys/time.h>
28
29 #ifdef STDC_HEADERS
30 # include <stdlib.h>
31 #else
32 # ifdef HAVE_MALLOC_H
33 #  include <malloc.h>
34 # else
35 char *malloc(), *realloc();
36 # endif
37 char *getenv(), *strerror(), *ctime(), *strcpy();
38 time_t time();
39 ZEPHYR_INT32 random();
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 #ifdef STDC_HEADERS
59 # include <string.h>
60 #else
61 # ifndef HAVE_STRCHR
62 #  define strchr index
63 #  define strrchr rindex
64 # endif
65 char *strchr(), *strrchr();
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();
135 char *ttyname();
136 #ifdef HAVE_GETHOSTID
137 ZEPHYR_INT32 gethostid();
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 HAVE_KRB4
164 # include <krb.h>
165 # include <krb_err.h>
166 # include <des.h>
167 # ifndef HAVE_KRB_GET_ERR_TEXT
168 #  define krb_get_err_text(n)   krb_err_txt[n]
169 # endif
170 # ifndef HAVE_KRB_LOG
171 #  define krb_log               log
172 # endif
173 #endif
174
175 #ifdef HAVE_SYS_UTSNAME_H
176 # include <sys/utsname.h>
177 #endif
178
179 #ifdef HAVE_SYS_SELECT_H
180 # include <sys/select.h>
181 #endif
182
183 #ifdef HAVE_SYS_MSGBUF_H
184 #include <sys/msgbuf.h>
185 #endif
186
187 #ifndef MSG_BSIZE
188 #define MSG_BSIZE BUFSIZ
189 #endif
190
191 #endif /* __SYSDEP_H__ */
192