1 /*----------------------------------------------------------------------
2 $Id: system.h 776 2007-10-24 23:14:26Z hubert@u.washington.edu $
3 ----------------------------------------------------------------------*/
5 /* ========================================================================
6 * Copyright 2006-2007 University of Washington
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * ========================================================================
18 * System-Specific includes, macros and prototypes based on config.h definitions
22 #ifndef _SYSTEM_INCLUDED
23 #define _SYSTEM_INCLUDED
28 #include "config.wnt.h"
59 void *malloc (size_t);
60 void *realloc (void *, size_t);
62 size_t strlen (const char *);
63 int strcmp (const char *, const char *);
64 char *strcpy (char *, const char *);
65 char *strcat (char *, const char *);
66 char *strtok (char *, const char *);
68 # warn "No strchr(); trying to use index() instead."
70 # define strrchr rindex
73 # error "C library missing strdup()!"
75 char *strdup (const char *);
76 char *strstr (const char *, const char *);
81 void *memcpy(void *, const void *, size_t);
82 void *memmove(void *, const void *, size_t);
83 void *memset(void *, int, size_t);
85 # define memcpy(d, s, n) bcopy ((s), (d), (n))
86 # define memmove(d, s, n) bcopy ((s), (d), (n))
87 # define memset(d, c, n) bzero ((d), (n))
92 /* Set System Collator */
94 # define collator strcoll
96 # define collator strucmp
99 #if defined(CODESET) && !defined(_WINDOWS)
100 #define PREREQ_FOR_SYS_TRANSLATION (HAVE_WCHAR_H && HAVE_WCRTOMB && HAVE_WCWIDTH && HAVE_MBSTOWCS && HAVE_LANGINFO_H)
102 #define PREREQ_FOR_SYS_TRANSLATION (0)
105 /* System uin32 definition */
111 # include <inttypes.h>
115 # include <sys/types.h>
119 # include <sys/wait.h>
122 /* set MAXPATH based on what's available */
129 # define MAXPATH PATH_MAX
131 # if HAVE_SYS_PARAM_H
132 # include <sys/param.h>
135 # define MAXPATH MAXPATHLEN
137 # define MAXPATH (512)
141 #if TIME_WITH_SYS_TIME
142 # include <sys/time.h>
146 # include <sys/time.h>
154 #elif HAVE_SYS_UTIME_H
155 # include <sys/utime.h>
163 #include <sys/stat.h>
170 #if defined(O_NONBLOCK)
171 # define NON_BLOCKING_IO O_NONBLOCK
172 #elif defined(FNDELAY)
173 # define NON_BLOCKING_IO FNDELAY
189 # include <termios.h>
204 #if defined(GWINSZ_IN_SYS_IOCTL) || defined(HAVE_SYS_IOCTL_H)
205 # include <sys/ioctl.h>
208 #if HAVE_SYS_SOCKET_H
209 #include <sys/socket.h>
220 short sun_family
; /* AF_UNIX */
221 char sun_path
[108]; /* path name (gag) */
226 # include <pthread.h>
238 # include <langinfo.h>
247 # include <libintl.h>
249 # define _(String) gettext (String)
250 # define N_(String) String
252 #else /* !ENABLE_NLS */
254 # define _(String) String
255 # define N_(String) String
257 #endif /* !ENABLE_NLS */
266 # if defined(LDAP_API_VERSION) /* draft-ietf-ldapext-ldap-c-api-04 */
267 # define LDAPAPI LDAP_API_VERSION
268 # elif defined(LDAP_OPT_SIZELIMIT)
269 # define LDAPAPI 15 /* Netscape SDK */
270 # elif defined(LDAP_BEGIN_DECL)
271 # define LDAPAPI 11 /* OpenLDAP 1.x */
272 # else /* older version */
273 # define LDAPAPI 10 /* Umich */
277 # define LDAP_OPT_ON ((void *)1)
279 # ifndef LDAP_OPT_OFF
280 # define LDAP_OPT_OFF ((void *)0)
282 # ifndef LDAP_OPT_SIZELIMIT
283 # define LDAP_OPT_SIZELIMIT 1134 /* we're hacking now! */
285 # ifndef LDAP_OPT_TIMELIMIT
286 # define LDAP_OPT_TIMELIMIT 1135
288 # ifndef LDAP_OPT_PROTOCOL_VERSION
289 # define LDAP_OPT_PROTOCOL_VERSION 1136
292 # ifndef LDAP_MSG_ONE
293 # define LDAP_MSG_ONE (0x00)
294 # define LDAP_MSG_ALL (0x01)
295 # define LDAP_MSG_RECEIVED (0x02)
298 #endif /* ENABLE_LDAP */
301 #if defined(DOS) || defined(OS2)
302 # define NEWLINE "\r\n" /* local EOL convention... */
304 # define NEWLINE "\n" /* necessary for gf_* funcs */
308 # include <Carbon/Carbon.h>
309 # include <ApplicationServices/ApplicationServices.h>
311 /* Avoid OSX Conflicts */
312 #define Fixed PineFixed
313 #define Handle PineHandle
314 #define Comment PineComment
315 #define normal PineNormal
320 #elif HAVE_SYS_SYSLOG_H
321 # include <sys/syslog.h>
324 #ifdef ENABLE_DMALLOC
325 # include <dmalloc.h>
331 * Defining these turns generic data types and function calls
332 * into their unicode (wide) versions. Not defining it will
333 * break the code, so leave it defined.
342 #define _WIN32_WINNT WINVER
344 /*-------- Standard windows defines and then our window module defines. */
354 #include <shellapi.h>
355 #include <sys/timeb.h>
360 #if defined(WINVER) && WINVER >= 0x0501
361 # define WINCRED 1 /* WINCRED will work */
363 # define WINCRED 0 /* too old for WINCRED to work */
373 #define snprintf _snprintf
377 #define utimbuf _utimbuf
379 #endif /* _WINDOWS */
382 #if defined(PASSFILE) && defined(APPLEKEYCHAIN)
383 # error "Cannot define both PASSFILE and APPLEKEYCHAIN"
385 #if defined(PASSFILE) && defined(WINCRED)
386 # error "Cannot define both PASSFILE and WINCRED"
388 #if defined(APPLEKEYCHAIN) && defined(WINCRED)
389 # error "Cannot define both APPLEKEYCHAIN and WINCRED"
392 #if defined(PASSFILE) || defined(APPLEKEYCHAIN) || defined(WINCRED)
393 # define LOCAL_PASSWD_CACHE
396 #endif /* _SYSTEM_INCLUDED */