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 /* Since major is a function on SVR4, we can't use `ifndef major'. */
44 #include <sys/mkdev.h>
47 #if MAJOR_IN_SYSMACROS
48 #include <sys/sysmacros.h>
51 #ifdef major /* Might be defined in sys/types.h. */
56 #define major(dev) (((dev) >> 8) & 0xff)
57 #define minor(dev) ((dev) & 0xff)
58 #define makedev(maj, min) (((maj) << 8) | (min))
66 /* Don't use bcopy! Use memmove if source and destination may overlap,
70 # if !STDC_HEADERS && HAVE_MEMORY_H
79 #if !defined(HAVE_STPCPY) || defined(__LCLINT__)
80 char * stpcpy(char * dest, const char * src);
83 #if !defined(HAVE_STPNCPY) || defined(__LCLINT__)
84 char * stpncpy(char * dest, const char * src, size_t n);
93 #define getopt system_getopt
94 /*@-skipansiheaders@*/
96 /*@=skipansiheaders@*/
98 #else /* not STDC_HEADERS */
99 char *getenv (const char *name);
100 #endif /* STDC_HEADERS */
102 /* XXX solaris2.5.1 has not */
103 #if !defined(EXIT_FAILURE)
104 #define EXIT_FAILURE 1
110 #include <sys/file.h>
127 # define NLENGTH(direct) (strlen((direct)->d_name))
128 #else /* not HAVE_DIRENT_H */
129 # define dirent direct
130 # define NLENGTH(direct) ((direct)->d_namlen)
131 # ifdef HAVE_SYS_NDIR_H
132 # include <sys/ndir.h>
133 # endif /* HAVE_SYS_NDIR_H */
134 # ifdef HAVE_SYS_DIR_H
135 # include <sys/dir.h>
136 # endif /* HAVE_SYS_DIR_H */
139 # endif /* HAVE_NDIR_H */
140 #endif /* HAVE_DIRENT_H */
144 # define alloca __builtin_alloca
146 # ifdef HAVE_ALLOCA_H
150 /* AIX alloca decl has to be the first thing in the file, bletch! */
159 #include <sys/mman.h>
162 /* XXX FIXME: popt on sunos4.1.3: <sys/resource.h> requires <sys/time.h> */
163 #if HAVE_SYS_RESOURCE_H && HAVE_SYS_TIME_H
164 #include <sys/resource.h>
167 #if HAVE_SYS_UTSNAME_H
168 #include <sys/utsname.h>
172 #include <sys/wait.h>
195 /*@only@*/ void * xmalloc (size_t size);
196 /*@only@*/ void * xcalloc (size_t nmemb, size_t size);
197 /*@only@*/ void * xrealloc (/*@only@*/ /*@null@*/ void * ptr, size_t size);
198 /*@only@*/ char * xstrdup (const char *str);
199 /*@only@*/ void *vmefail(size_t size);
206 /* Memory allocation via macro defs to get meaningful locations from mtrace() */
207 #if HAVE_MCHECK_H && defined(__GNUC__)
208 #define xmalloc(_size) (malloc(_size) ? : vmefail(_size))
209 #define xcalloc(_nmemb, _size) (calloc((_nmemb), (_size)) ? : vmefail(_size))
210 #define xrealloc(_ptr, _size) (realloc((_ptr), (_size)) ? : vmefail(_size))
211 #define xstrdup(_str) (strcpy((malloc(strlen(_str)+1) ? : vmefail(strlen(_str)+1)), (_str)))
212 #endif /* HAVE_MCHECK_H && defined(__GNUC__) */
214 /* Retrofit glibc __progname */
215 #if defined __GLIBC__ && __GLIBC__ >= 2
216 #if __GLIBC_MINOR__ >= 1
217 #define __progname __assert_program_name
219 #define setprogname(pn)
221 #define __progname program_name
222 #define setprogname(pn) \
223 { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
224 else __progname = pn; \
227 const char *__progname;
232 #endif /* __LCLINT__ */
239 /* Take care of NLS matters. */
245 # define setlocale(Category, Locale) /* empty */
248 #if ENABLE_NLS && !defined(__LCLINT__)
249 # include <libintl.h>
250 # define _(Text) gettext (Text)
252 # undef bindtextdomain
253 # define bindtextdomain(Domain, Directory) /* empty */
255 # define textdomain(Domain) /* empty */
256 # define _(Text) Text
258 # define dgettext(DomainName, Text) Text
261 #define N_(Text) Text
263 /* ============== from misc/miscfn.h */
265 #if !defined(USE_GNU_GLOB)
274 #include "misc/glob.h"
275 #include "misc/fnmatch.h"
279 #define S_IFSOCK (0xC000)
283 #define S_ISLNK(mode) ((mode & 0xF000) == S_IFLNK)
287 #define S_ISSOCK(mode) ((mode & 0xF000) == S_IFSOCK)
295 char *realpath(const char *path, char resolved_path []);
299 #define realloc(ptr,size) myrealloc(ptr,size)
300 extern void *myrealloc(void *, size_t);
304 extern int setenv(const char *name, const char *value, int replace);
305 extern void unsetenv(const char *name);
308 #if HAVE_SYS_SOCKET_H
309 #include <sys/types.h>
311 #include <sys/socket.h>
312 #endif /* __LCLINT__ */
315 #if HAVE_SYS_SELECT_H
316 #include <sys/select.h>
319 /* Solaris <= 2.6 limits getpass return to only 8 chars */
320 #if HAVE_GETPASSPHRASE
321 #define getpass getpassphrase
328 #if HAVE_GETMNTINFO_R || HAVE_MNTCTL
329 # define GETMNTENT_ONE 0
330 # define GETMNTENT_TWO 0
331 # if HAVE_SYS_MNTCTL_H
332 # include <sys/mntctl.h>
334 # if HAVE_SYS_VMOUNT_H
335 # include <sys/vmount.h>
337 # if HAVE_SYS_MOUNT_H
338 # include <sys/mount.h>
340 #elif HAVE_MNTENT_H || !(HAVE_GETMNTENT) || HAVE_STRUCT_MNTTAB
344 # define our_mntent struct mntent
345 # define our_mntdir mnt_dir
346 # elif HAVE_STRUCT_MNTTAB
352 struct our_mntent *getmntent(FILE *filep);
353 # define our_mntent struct our_mntent
359 struct our_mntent *getmntent(FILE *filep);
360 # define our_mntent struct our_mntent
362 # define GETMNTENT_ONE 1
363 # define GETMNTENT_TWO 0
364 #elif HAVE_SYS_MNTTAB_H
366 # include <sys/mnttab.h>
367 # define GETMNTENT_ONE 0
368 # define GETMNTENT_TWO 1
369 # define our_mntent struct mnttab
370 # define our_mntdir mnt_mountp
371 #else /* if !HAVE_MNTCTL */
372 # error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system.
376 #define MOUNTED "/etc/mnttab"
378 #endif /* H_SYSTEM */