Merge branch 'master' of ctdb into 'master' of samba
[samba.git] / ctdb / lib / popt / system.h
1 #include "config.h"
2
3 #if defined (__GLIBC__) && defined(__LCLINT__)
4 /*@-declundef@*/
5 /*@unchecked@*/
6 extern __const __int32_t *__ctype_tolower;
7 /*@unchecked@*/
8 extern __const __int32_t *__ctype_toupper;
9 /*@=declundef@*/
10 #endif
11
12 #include <ctype.h>
13
14 #include <errno.h>
15 #include <fcntl.h>
16 #include <limits.h>
17
18 #if HAVE_MCHECK_H 
19 #include <mcheck.h>
20 #endif
21
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
25
26 #if HAVE_UNISTD_H
27 #include <unistd.h>
28 #endif
29
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
35
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
43
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 #   ifndef alloca /* predefined by HP cc +Olibcalls */
53 char *alloca ();
54 #   endif
55 #  endif
56 # endif
57 #elif defined(__GNUC__) && defined(__STRICT_ANSI__)
58 #define alloca __builtin_alloca
59 #endif
60
61 /*@-redecl -redef@*/
62 /*@mayexit@*/ /*@only@*/ char * xstrdup (const char *str)
63         /*@*/;
64 /*@=redecl =redef@*/
65
66 #if HAVE_MCHECK_H && defined(__GNUC__)
67 #define vmefail()       (fprintf(stderr, "virtual memory exhausted.\n"), exit(EXIT_FAILURE), NULL)
68 #define xstrdup(_str)   (strcpy((malloc(strlen(_str)+1) ? : vmefail()), (_str)))
69 #else
70 #define xstrdup(_str)   strdup(_str)
71 #endif  /* HAVE_MCHECK_H && defined(__GNUC__) */
72
73
74 #include "popt.h"