00001
00005 #ifdef HAVE_CONFIG_H
00006 #include "config.h"
00007 #endif
00008
00009 #if defined (__GLIBC__) && defined(__LCLINT__)
00010
00011
00012 extern __const __int32_t *__ctype_tolower;
00013
00014 extern __const __int32_t *__ctype_toupper;
00015
00016 #endif
00017
00018 #include <ctype.h>
00019
00020
00021 #define _isspaceptr(_chp) isspace((int)(*(unsigned char *)(_chp)))
00022
00023 #include <errno.h>
00024 #include <fcntl.h>
00025 #include <limits.h>
00026
00027 #ifdef HAVE_MCHECK_H
00028 #include <mcheck.h>
00029 #endif
00030
00031 #include <stdio.h>
00032 #include <stdlib.h>
00033 #include <string.h>
00034
00035 #if defined(HAVE_UNISTD_H) && !defined(__LCLINT__)
00036 #include <unistd.h>
00037 #endif
00038
00039 #ifdef __NeXT
00040
00041
00042 #include <libc.h>
00043 #endif
00044
00045
00046
00047 void * xmalloc (size_t size)
00048
00049
00050 ;
00051
00052
00053 void * xcalloc (size_t nmemb, size_t size)
00054
00055 ;
00056
00057
00058 void * xrealloc ( void * ptr, size_t size)
00059
00060 ;
00061
00062
00063 char * xstrdup (const char *str)
00064 ;
00065
00066
00067 #if !defined(HAVE_STPCPY)
00068
00069 static inline char * stpcpy (char *dest, const char * src) {
00070 register char *d = dest;
00071 register const char *s = src;
00072
00073 do
00074 *d++ = *s;
00075 while (*s++ != '\0');
00076 return d - 1;
00077 }
00078 #endif
00079
00080
00081 #if defined(HAVE_MCHECK_H) && defined(__GNUC__)
00082 #define vmefail() (fprintf(stderr, "virtual memory exhausted.\n"), exit(EXIT_FAILURE), NULL)
00083 #define xmalloc(_size) (malloc(_size) ? : vmefail())
00084 #define xcalloc(_nmemb, _size) (calloc((_nmemb), (_size)) ? : vmefail())
00085 #define xrealloc(_ptr, _size) (realloc((_ptr), (_size)) ? : vmefail())
00086 #define xstrdup(_str) (strcpy((malloc(strlen(_str)+1) ? : vmefail()), (_str)))
00087 #else
00088 #define xmalloc(_size) malloc(_size)
00089 #define xcalloc(_nmemb, _size) calloc((_nmemb), (_size))
00090 #define xrealloc(_ptr, _size) realloc((_ptr), (_size))
00091 #define xstrdup(_str) strdup(_str)
00092 #endif
00093
00094 #if defined(HAVE___SECURE_GETENV) && !defined(__LCLINT__)
00095 #define getenv(_s) __secure_getenv(_s)
00096 #endif
00097
00098 #if !defined(__GNUC__) && !defined(__attribute__)
00099 #define __attribute__(x)
00100 #endif
00101 #define UNUSED(x) x __attribute__((__unused__))
00102
00103 #include "popt.h"