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