- Added set_io_timeout(), which sets all the timeout-dependent
[rsync.git] / popt / system.h
blob02f05c188ee718e479047f53724aa5fa6d014145
1 #ifdef HAVE_CONFIG_H
2 #include "config.h"
3 #endif
5 #include <ctype.h>
6 #include <errno.h>
7 #include <fcntl.h>
8 #include <limits.h>
10 #if HAVE_MCHECK_H
11 #include <mcheck.h>
12 #endif
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <string.h>
18 #if HAVE_UNISTD_H
19 #include <unistd.h>
20 #endif
22 #if !defined(__GNUC__) || defined(APPLE)
23 /* Apparently the OS X port of gcc gags on __attribute__.
25 * <http://www.opensource.apple.com/bugs/X/gcc/2512150.html> */
26 #define __attribute__(x)
28 #endif
30 #ifdef __NeXT
31 /* access macros are not declared in non posix mode in unistd.h -
32 don't try to use posix on NeXTstep 3.3 ! */
33 #include <libc.h>
34 #endif
36 #if defined(__LCLINT__)
37 /*@-declundef -incondefs -redecl@*/ /* LCL: missing annotation */
38 /*@only@*/ void * alloca (size_t __size)
39 /*@ensures MaxSet(result) == (__size - 1) @*/
40 /*@*/;
41 /*@=declundef =incondefs =redecl@*/
42 #endif
44 /* AIX requires this to be the first thing in the file. */
45 #ifndef __GNUC__
46 # if HAVE_ALLOCA_H
47 # include <alloca.h>
48 # else
49 # ifdef _AIX
50 #pragma alloca
51 # else
52 # if HAVE_ALLOCA
53 # ifndef alloca /* predefined by HP cc +Olibcalls */
54 char *alloca ();
55 # endif
56 # else
57 # ifdef alloca
58 # undef alloca
59 # endif
60 # define alloca(sz) malloc(sz) /* Kludge this for now */
61 # endif
62 # endif
63 # endif
64 #elif defined(__GNUC__) && defined(__STRICT_ANSI__)
65 #define alloca __builtin_alloca
66 #endif
68 /*@-redecl -redef@*/
69 /*@mayexit@*/ /*@only@*/ char * xstrdup (const char *str)
70 /*@*/;
71 /*@=redecl =redef@*/
73 #if HAVE_MCHECK_H && defined(__GNUC__)
74 #define vmefail() (fprintf(stderr, "virtual memory exhausted.\n"), exit(EXIT_FAILURE), NULL)
75 #define xstrdup(_str) (strcpy((malloc(strlen(_str)+1) ? : vmefail()), (_str)))
76 #else
77 #define xstrdup(_str) strdup(_str)
78 #endif /* HAVE_MCHECK_H && defined(__GNUC__) */
80 #define UNUSED(x) x __attribute__((__unused__))
82 #include "popt.h"