1 /* system-dependent definitions for fileutils programs.
2 Copyright (C) 89, 91, 92, 93, 94, 1996 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software Foundation,
16 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
26 #include <sys/types.h>
29 #ifdef HAVE_SYS_PARAM_H
30 #include <sys/param.h>
33 /* <unistd.h> should be included before any preprocessor test
36 /*@-skipposixheaders@*/
38 /*@=skipposixheaders@*/
41 #if TIME_WITH_SYS_TIME
42 # include <sys/time.h>
46 # include <sys/time.h>
53 extern time_t timezone;
57 /* Since major is a function on SVR4, we can't use `ifndef major'. */
59 #include <sys/mkdev.h>
62 #if MAJOR_IN_SYSMACROS
63 #include <sys/sysmacros.h>
66 #ifdef major /* Might be defined in sys/types.h. */
71 #define major(dev) (((dev) >> 8) & 0xff)
72 #define minor(dev) ((dev) & 0xff)
73 #define makedev(maj, min) (((maj) << 8) | (min))
81 /* Don't use bcopy! Use memmove if source and destination may overlap,
85 # if !STDC_HEADERS && HAVE_MEMORY_H
100 #define getopt system_getopt
101 /*@-skipansiheaders@*/
103 /*@=skipansiheaders@*/
105 #else /* not STDC_HEADERS */
106 char *getenv (const char *name);
107 #endif /* STDC_HEADERS */
112 #include <sys/file.h>
129 # define NLENGTH(direct) (strlen((direct)->d_name))
130 #else /* not HAVE_DIRENT_H */
131 # define dirent direct
132 # define NLENGTH(direct) ((direct)->d_namlen)
133 # ifdef HAVE_SYS_NDIR_H
134 # include <sys/ndir.h>
135 # endif /* HAVE_SYS_NDIR_H */
136 # ifdef HAVE_SYS_DIR_H
137 # include <sys/dir.h>
138 # endif /* HAVE_SYS_DIR_H */
141 # endif /* HAVE_NDIR_H */
142 #endif /* HAVE_DIRENT_H */
146 # define alloca __builtin_alloca
148 # ifdef HAVE_ALLOCA_H
152 /* AIX alloca decl has to be the first thing in the file, bletch! */
161 #include <sys/mman.h>
164 /* XXX FIXME: popt on sunos4.1.3: <sys/resource.h> requires <sys/time.h> */
165 #if HAVE_SYS_RESOURCE_H && HAVE_SYS_TIME_H
166 #include <sys/resource.h>
169 #if HAVE_SYS_UTSNAME_H
170 #include <sys/utsname.h>
174 #include <sys/wait.h>
201 /* Take care of NLS matters. */
207 # define setlocale(Category, Locale) /* empty */
210 #if ENABLE_NLS && !defined(__LCLINT__)
211 # include <libintl.h>
212 # define _(Text) gettext (Text)
214 # undef bindtextdomain
215 # define bindtextdomain(Domain, Directory) /* empty */
217 # define textdomain(Domain) /* empty */
218 # define _(Text) Text
221 #define N_(Text) Text
223 /* ============== from misc/miscfn.h */
228 #include "misc/fnmatch.h"
234 #include "misc/glob.h"
238 #define S_IFSOCK (0xC000)
242 #define S_ISLNK(mode) ((mode & 0xF000) == S_IFLNK)
246 #define S_ISSOCK(mode) ((mode & 0xF000) == S_IFSOCK)
254 char *realpath(const char *path, char resolved_path []);
258 #define realloc(ptr,size) myrealloc(ptr,size)
259 extern void *myrealloc(void *, size_t);
262 #if HAVE_SYS_SOCKET_H
263 #include <sys/types.h>
264 #include <sys/socket.h>
267 #if HAVE_SYS_SELECT_H
268 #include <sys/select.h>
275 #if HAVE_GETMNTINFO_R || HAVE_MNTCTL
276 # define GETMNTENT_ONE 0
277 # define GETMNTENT_TWO 0
278 # if HAVE_SYS_MNTCTL_H
279 # include <sys/mntctl.h>
281 # if HAVE_SYS_VMOUNT_H
282 # include <sys/vmount.h>
284 # if HAVE_SYS_MOUNT_H
285 # include <sys/mount.h>
287 #elif HAVE_MNTENT_H || !(HAVE_GETMNTENT) || HAVE_STRUCT_MNTTAB
291 # define our_mntent struct mntent
292 # define our_mntdir mnt_dir
293 # elif HAVE_STRUCT_MNTTAB
299 struct our_mntent *getmntent(FILE *filep);
300 # define our_mntent struct our_mntent
306 struct our_mntent *getmntent(FILE *filep);
307 # define our_mntent struct our_mntent
309 # define GETMNTENT_ONE 1
310 # define GETMNTENT_TWO 0
311 #elif HAVE_SYS_MNTTAB_H
313 # include <sys/mnttab.h>
314 # define GETMNTENT_ONE 0
315 # define GETMNTENT_TWO 1
316 # define our_mntent struct mnttab
317 # define our_mntdir mnt_mountp
318 #else /* if !HAVE_MNTCTL */
319 # error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system.
323 #define MOUNTED "/etc/mnttab"
325 #endif /* H_SYSTEM */