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 #define PREREQ_FOR_SYS_TRANSLATION (HAVE_WCHAR_H && HAVE_WCRTOMB && HAVE_WCWIDTH && HAVE_MBSTOWCS && HAVE_LANGINFO_H && defined(CODESET) && !defined(_WINDOWS))
101 /* System uin32 definition */
107 # include <inttypes.h>
111 # include <sys/types.h>
115 # include <sys/wait.h>
118 /* set MAXPATH based on what's available */
125 # define MAXPATH PATH_MAX
127 # if HAVE_SYS_PARAM_H
128 # include <sys/param.h>
131 # define MAXPATH MAXPATHLEN
133 # define MAXPATH (512)
137 #if TIME_WITH_SYS_TIME
138 # include <sys/time.h>
142 # include <sys/time.h>
150 #elif HAVE_SYS_UTIME_H
151 # include <sys/utime.h>
159 #include <sys/stat.h>
166 #if defined(O_NONBLOCK)
167 # define NON_BLOCKING_IO O_NONBLOCK
168 #elif defined(FNDELAY)
169 # define NON_BLOCKING_IO FNDELAY
185 # include <termios.h>
200 #if GWINSZ_IN_SYS_IOCTL
201 # include <sys/ioctl.h>
204 #if HAVE_SYS_SOCKET_H
205 #include <sys/socket.h>
216 short sun_family
; /* AF_UNIX */
217 char sun_path
[108]; /* path name (gag) */
222 # include <pthread.h>
234 # include <langinfo.h>
243 # include <libintl.h>
245 # define _(String) gettext (String)
246 # define N_(String) String
248 #else /* !ENABLE_NLS */
250 # define _(String) String
251 # define N_(String) String
253 #endif /* !ENABLE_NLS */
262 # if defined(LDAP_API_VERSION) /* draft-ietf-ldapext-ldap-c-api-04 */
263 # define LDAPAPI LDAP_API_VERSION
264 # elif defined(LDAP_OPT_SIZELIMIT)
265 # define LDAPAPI 15 /* Netscape SDK */
266 # elif defined(LDAP_BEGIN_DECL)
267 # define LDAPAPI 11 /* OpenLDAP 1.x */
268 # else /* older version */
269 # define LDAPAPI 10 /* Umich */
273 # define LDAP_OPT_ON ((void *)1)
275 # ifndef LDAP_OPT_OFF
276 # define LDAP_OPT_OFF ((void *)0)
278 # ifndef LDAP_OPT_SIZELIMIT
279 # define LDAP_OPT_SIZELIMIT 1134 /* we're hacking now! */
281 # ifndef LDAP_OPT_TIMELIMIT
282 # define LDAP_OPT_TIMELIMIT 1135
284 # ifndef LDAP_OPT_PROTOCOL_VERSION
285 # define LDAP_OPT_PROTOCOL_VERSION 1136
288 # ifndef LDAP_MSG_ONE
289 # define LDAP_MSG_ONE (0x00)
290 # define LDAP_MSG_ALL (0x01)
291 # define LDAP_MSG_RECEIVED (0x02)
294 #endif /* ENABLE_LDAP */
297 #if defined(DOS) || defined(OS2)
298 # define NEWLINE "\r\n" /* local EOL convention... */
300 # define NEWLINE "\n" /* necessary for gf_* funcs */
304 # include <Carbon/Carbon.h>
305 # include <ApplicationServices/ApplicationServices.h>
307 /* Avoid OSX Conflicts */
308 #define Fixed PineFixed
309 #define Handle PineHandle
310 #define Comment PineComment
311 #define normal PineNormal
316 #elif HAVE_SYS_SYSLOG_H
317 # include <sys/syslog.h>
320 #ifdef ENABLE_DMALLOC
321 # include <dmalloc.h>
327 * Defining these turns generic data types and function calls
328 * into their unicode (wide) versions. Not defining it will
329 * break the code, so leave it defined.
338 #define _WIN32_WINNT WINVER
340 /*-------- Standard windows defines and then our window module defines. */
350 #include <shellapi.h>
351 #include <sys/timeb.h>
356 #if defined(WINVER) && WINVER >= 0x0501
357 # define WINCRED 1 /* WINCRED will work */
359 # define WINCRED 0 /* too old for WINCRED to work */
369 #define snprintf _snprintf
373 #define utimbuf _utimbuf
375 #endif /* _WINDOWS */
378 #if defined(PASSFILE) && defined(APPLEKEYCHAIN)
379 # error "Cant define both PASSFILE and APPLEKEYCHAIN"
381 #if defined(PASSFILE) && defined(WINCRED)
382 # error "Cant define both PASSFILE and WINCRED"
384 #if defined(APPLEKEYCHAIN) && defined(WINCRED)
385 # error "Cant define both APPLEKEYCHAIN and WINCRED"
388 #if defined(PASSFILE) || defined(APPLEKEYCHAIN) || defined(WINCRED)
389 # define LOCAL_PASSWD_CACHE
392 #endif /* _SYSTEM_INCLUDED */