1#ifdef HAVE_CONFIG_H
2#include "config.h"
3#endif
4
5#if defined (__GLIBC__) && defined(__LCLINT__)
6/*@-declundef@*/
7/*@unchecked@*/
8extern __const __int32_t *__ctype_tolower;
9/*@unchecked@*/
10extern __const __int32_t *__ctype_toupper;
11/*@=declundef@*/
12#endif
13
14#include <ctype.h>
15
16#include <errno.h>
17#include <fcntl.h>
18#include <limits.h>
19
20#if HAVE_MCHECK_H
21#include <mcheck.h>
22#endif
23
24#include <stdio.h>
25#include <stdlib.h>
26#include <string.h>
27
28#if HAVE_UNISTD_H
29#include <unistd.h>
30#endif
31
32#ifdef __NeXT
33/* access macros are not declared in non posix mode in unistd.h -
34 don't try to use posix on NeXTstep 3.3 ! */
35#include <libc.h>
36#endif
37
38#if defined(__LCLINT__)
39/*@-declundef -incondefs @*/ /* LCL: missing annotation */
40/*@only@*/ /*@out@*/
41void * alloca (size_t __size)
42	/*@ensures MaxSet(result) == (__size - 1) @*/
43	/*@*/;
44/*@=declundef =incondefs @*/
45#endif
46
47/* AIX requires this to be the first thing in the file.  */
48#ifndef __GNUC__
49# if HAVE_ALLOCA_H
50#  include <alloca.h>
51# else
52#  ifdef _AIX
53#pragma alloca
54#  else
55#   ifndef alloca /* predefined by HP cc +Olibcalls */
56char *alloca ();
57#   endif
58#  endif
59# endif
60#elif defined(__GNUC__) && defined(__STRICT_ANSI__)
61#define alloca __builtin_alloca
62#endif
63
64/*@-redecl -redef@*/
65/*@mayexit@*/ /*@only@*/ /*@unused@*/
66char * xstrdup (const char *str)
67	/*@*/;
68/*@=redecl =redef@*/
69
70#if HAVE_MCHECK_H && defined(__GNUC__)
71#define	vmefail()	(fprintf(stderr, "virtual memory exhausted.\n"), exit(EXIT_FAILURE), NULL)
72#define xstrdup(_str)   (strcpy((malloc(strlen(_str)+1) ? : vmefail()), (_str)))
73#else
74#define	xstrdup(_str)	strdup(_str)
75#endif  /* HAVE_MCHECK_H && defined(__GNUC__) */
76
77#if HAVE___SECURE_GETENV && !defined(__LCLINT__)
78#define	getenv(_s)	__secure_getenv(_s)
79#endif
80
81#include "popt.h"
82