12 #include <sys/types.h>
16 #ifdef HAVE_SYS_PARAM_H
17 #include <sys/param.h>
20 /* <unistd.h> should be included before any preprocessor test
26 #if TIME_WITH_SYS_TIME
27 # include <sys/time.h>
31 # include <sys/time.h>
38 extern time_t timezone;
42 typedef unsigned int u_int32_t;
43 typedef unsigned short u_int16_t;
44 typedef unsigned char u_int8_t;
48 /* Since major is a function on SVR4, we can't use `ifndef major'. */
50 #include <sys/mkdev.h>
53 #if MAJOR_IN_SYSMACROS
54 #include <sys/sysmacros.h>
57 #ifdef major /* Might be defined in sys/types.h. */
62 #define major(dev) (((dev) >> 8) & 0xff)
63 #define minor(dev) ((dev) & 0xff)
64 #define makedev(maj, min) (((maj) << 8) | (min))
72 /* Don't use bcopy! Use memmove if source and destination may overlap,
76 # if !STDC_HEADERS && HAVE_MEMORY_H
85 #if !defined(HAVE_STPCPY) || defined(__LCLINT__)
87 char * stpcpy(char * dest, const char * src) /*@modifies *dest @*/;
91 #if !defined(HAVE_STPNCPY) || defined(__LCLINT__)
93 char * stpncpy(char * dest, const char * src, size_t n) /*@modifies *dest @*/;
105 /*@-macrounrecog -incondefs -globuse@*/ /* FIX: shrug */
106 #define getopt system_getopt
107 /*@=macrounrecog =incondefs =globuse@*/
108 /*@-skipansiheaders@*/
110 /*@=skipansiheaders@*/
112 #else /* not STDC_HEADERS */
113 char *getenv (const char *name);
114 #endif /* STDC_HEADERS */
116 /* XXX solaris2.5.1 has not */
117 #if !defined(EXIT_FAILURE)
118 #define EXIT_FAILURE 1
124 #include <sys/file.h>
127 #if !defined(SEEK_SET) && !defined(__LCLINT__)
132 #if !defined(F_OK) && !defined(__LCLINT__)
141 # define NLENGTH(direct) (strlen((direct)->d_name))
142 #else /* not HAVE_DIRENT_H */
143 # define dirent direct
144 # define NLENGTH(direct) ((direct)->d_namlen)
145 # ifdef HAVE_SYS_NDIR_H
146 # include <sys/ndir.h>
147 # endif /* HAVE_SYS_NDIR_H */
148 # ifdef HAVE_SYS_DIR_H
149 # include <sys/dir.h>
150 # endif /* HAVE_SYS_DIR_H */
153 # endif /* HAVE_NDIR_H */
154 #endif /* HAVE_DIRENT_H */
158 # define alloca __builtin_alloca
160 # ifdef HAVE_ALLOCA_H
164 /* AIX alloca decl has to be the first thing in the file, bletch! */
173 #include <sys/mman.h>
176 /* XXX FIXME: popt on sunos4.1.3: <sys/resource.h> requires <sys/time.h> */
177 #if HAVE_SYS_RESOURCE_H && HAVE_SYS_TIME_H
178 #include <sys/resource.h>
181 #if HAVE_SYS_UTSNAME_H
182 #include <sys/utsname.h>
186 #include <sys/wait.h>
210 /*@mayexit@*/ /*@only@*/ void * xmalloc (size_t size) /*@*/;
211 /*@mayexit@*/ /*@only@*/ void * xcalloc (size_t nmemb, size_t size) /*@*/;
212 /*@mayexit@*/ /*@only@*/ void * xrealloc (/*@only@*//*@null@*/ void * ptr,
214 /*@mayexit@*/ /*@only@*/ char * xstrdup (const char *str) /*@*/;
216 /*@unused@*/ /*@exits@*/ /*@only@*/ void * vmefail(size_t size);
223 /* Memory allocation via macro defs to get meaningful locations from mtrace() */
224 #if HAVE_MCHECK_H && defined(__GNUC__)
225 #define xmalloc(_size) (malloc(_size) ? : vmefail(_size))
226 #define xcalloc(_nmemb, _size) (calloc((_nmemb), (_size)) ? : vmefail(_size))
227 #define xrealloc(_ptr, _size) (realloc((_ptr), (_size)) ? : vmefail(_size))
228 #define xstrdup(_str) (strcpy((malloc(strlen(_str)+1) ? : vmefail(strlen(_str)+1)), (_str)))
229 #endif /* HAVE_MCHECK_H && defined(__GNUC__) */
231 /* Retrofit glibc __progname */
232 #if defined __GLIBC__ && __GLIBC__ >= 2
233 #if __GLIBC_MINOR__ >= 1
234 #define __progname __assert_program_name
236 #define setprogname(pn)
238 #define __progname program_name
239 #define setprogname(pn) \
240 { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
241 else __progname = pn; \
244 const char *__progname;
249 #endif /* __LCLINT__ */
256 /* Take care of NLS matters. */
262 # define setlocale(Category, Locale) /* empty */
265 #if ENABLE_NLS && !defined(__LCLINT__)
266 # include <libintl.h>
267 # define _(Text) gettext (Text)
269 # undef bindtextdomain
270 # define bindtextdomain(Domain, Directory) /* empty */
272 # define textdomain(Domain) /* empty */
273 # define _(Text) Text
275 # define dgettext(DomainName, Text) Text
278 #define N_(Text) Text
280 /* ============== from misc/miscfn.h */
282 #if !defined(USE_GNU_GLOB)
291 #include "misc/glob.h"
292 #include "misc/fnmatch.h"
296 #define S_IFSOCK (0xC000)
300 #define S_ISLNK(mode) ((mode & 0xF000) == S_IFLNK)
304 #define S_ISSOCK(mode) ((mode & 0xF000) == S_IFSOCK)
312 char *realpath(const char *path, char resolved_path []);
316 #define realloc(ptr,size) myrealloc(ptr,size)
317 extern void *myrealloc(void *, size_t);
321 extern int setenv(const char *name, const char *value, int replace);
322 extern void unsetenv(const char *name);
325 #if HAVE_SYS_SOCKET_H
326 #include <sys/types.h>
328 #include <sys/socket.h>
329 #endif /* __LCLINT__ */
332 #if HAVE_SYS_SELECT_H
333 #include <sys/select.h>
336 /* Solaris <= 2.6 limits getpass return to only 8 chars */
337 #if HAVE_GETPASSPHRASE
338 #define getpass getpassphrase
345 #if HAVE_GETMNTINFO_R || HAVE_MNTCTL
346 # define GETMNTENT_ONE 0
347 # define GETMNTENT_TWO 0
348 # if HAVE_SYS_MNTCTL_H
349 # include <sys/mntctl.h>
351 # if HAVE_SYS_VMOUNT_H
352 # include <sys/vmount.h>
354 # if HAVE_SYS_MOUNT_H
355 # include <sys/mount.h>
357 #elif HAVE_MNTENT_H || !(HAVE_GETMNTENT) || HAVE_STRUCT_MNTTAB
361 # define our_mntent struct mntent
362 # define our_mntdir mnt_dir
363 # elif HAVE_STRUCT_MNTTAB
369 struct our_mntent *getmntent(FILE *filep);
370 # define our_mntent struct our_mntent
376 struct our_mntent *getmntent(FILE *filep);
377 # define our_mntent struct our_mntent
379 # define GETMNTENT_ONE 1
380 # define GETMNTENT_TWO 0
381 #elif HAVE_SYS_MNTTAB_H
383 # include <sys/mnttab.h>
384 # define GETMNTENT_ONE 0
385 # define GETMNTENT_TWO 1
386 # define our_mntent struct mnttab
387 # define our_mntdir mnt_mountp
388 #else /* if !HAVE_MNTCTL */
389 # error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system.
393 #define MOUNTED "/etc/mnttab"
395 #endif /* H_SYSTEM */