Initial import
[samba] / source / popt / system.h
1 #include "config.h"
2
3 #include <ctype.h>
4 #include <errno.h>
5 #include <fcntl.h>
6 #include <limits.h>
7
8 #if HAVE_MCHECK_H 
9 #include <mcheck.h>
10 #endif
11
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <string.h>
15
16 #if HAVE_UNISTD_H
17 #include <unistd.h>
18 #endif
19
20 #ifdef __NeXT
21 /* access macros are not declared in non posix mode in unistd.h -
22  don't try to use posix on NeXTstep 3.3 ! */
23 #include <libc.h>
24 #endif
25
26 /* AIX requires this to be the first thing in the file.  */ 
27 #ifndef __GNUC__
28 # if HAVE_ALLOCA_H
29 #  include <alloca.h>
30 # else
31 #  ifdef _AIX
32 #pragma alloca
33 #  else
34 #   ifndef alloca /* predefined by HP cc +Olibcalls */
35 char *alloca ();
36 #   endif
37 #  endif
38 # endif
39 #elif defined(__GNUC__) && defined(__STRICT_ANSI__)
40 #define alloca __builtin_alloca
41 #endif
42
43 /*@only@*/ char * xstrdup (const char *str);
44
45 #if HAVE_MCHECK_H && defined(__GNUC__)
46 #define vmefail()       (fprintf(stderr, "virtual memory exhausted.\n"), exit(EXIT_FAILURE), NULL)
47 #define xstrdup(_str)   (strcpy((malloc(strlen(_str)+1) ? : vmefail()), (_str)))
48 #else
49 #define xstrdup(_str)   strdup(_str)
50 #endif  /* HAVE_MCHECK_H && defined(__GNUC__) */
51
52
53 #include "popt.h"