12 #include <sys/types.h>
17 #ifdef HAVE_SYS_PARAM_H
18 #include <sys/param.h>
21 /* <unistd.h> should be included before any preprocessor test
25 #if !defined(__GLIBC__)
27 #include <crt_externs.h>
28 #define environ (*_NSGetEnviron())
30 extern char ** environ;
31 #endif /* __APPLE__ */
36 # if !STDC_HEADERS && HAVE_MEMORY_H
44 #if !defined(HAVE_STPCPY)
45 char * stpcpy(char * dest, const char * src);
48 #if !defined(HAVE_STPNCPY)
49 char * stpncpy(char * dest, const char * src, size_t n);
57 #if HAVE___SECURE_GETENV
58 #define getenv(_s) __secure_getenv(_s)
63 #define getopt system_getopt
66 #else /* not STDC_HEADERS */
67 char *getenv (const char *name);
68 #endif /* STDC_HEADERS */
70 /* XXX solaris2.5.1 has not */
71 #if !defined(EXIT_FAILURE)
72 #define EXIT_FAILURE 1
83 # define NLENGTH(direct) (strlen((direct)->d_name))
84 #else /* not HAVE_DIRENT_H */
85 # define dirent direct
86 # define NLENGTH(direct) ((direct)->d_namlen)
87 # ifdef HAVE_SYS_NDIR_H
88 # include <sys/ndir.h>
89 # endif /* HAVE_SYS_NDIR_H */
90 # ifdef HAVE_SYS_DIR_H
92 # endif /* HAVE_SYS_DIR_H */
95 # endif /* HAVE_NDIR_H */
96 #endif /* HAVE_DIRENT_H */
105 #ifdef _POSIX_PATH_MAX
106 #define PATH_MAX _POSIX_PATH_MAX
107 #elif defined MAXPATHLEN
108 #define PATH_MAX MAXPATHLEN
115 #include <selinux/selinux.h>
117 typedef char * security_context_t;
121 #define setfilecon(_fn, _c) (-1)
122 #define lsetfilecon(_fn, _c) (-1)
124 #define is_selinux_enabled() (0)
126 #define matchpathcon_init(_fn) (-1)
127 #define matchpathcon_fini() (0)
128 #define matchpathcon(_fn, _fm, _c) (-1)
130 #define rpm_execcon(_v, _fn, _av, _envp) (0)
133 #include "rpmio/rpmutil.h"
134 /* compatibility macros to avoid a mass-renaming all over the codebase */
135 #define xmalloc(_size) rmalloc((_size))
136 #define xcalloc(_nmemb, _size) rcalloc((_nmemb), (_size))
137 #define xrealloc(_ptr, _size) rrealloc((_ptr), (_size))
138 #define xstrdup(_str) rstrdup((_str))
139 #define _free(_ptr) rfree((_ptr))
141 /* Retrofit glibc __progname */
142 #if defined __GLIBC__ && __GLIBC__ >= 2
143 #if __GLIBC_MINOR__ >= 1
144 #define __progname __assert_program_name
146 #define setprogname(pn)
148 #define __progname program_name
149 #define setprogname(pn) \
150 { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
151 else __progname = pn; \
154 extern const char *__progname;
156 /* Take care of NLS matters. */
162 # define setlocale(Category, Locale) /* empty */
166 # include <libintl.h>
167 # define _(Text) dgettext (PACKAGE, Text)
169 # undef bindtextdomain
170 # define bindtextdomain(Domain, Directory) /* empty */
172 # define textdomain(Domain) /* empty */
173 # define _(Text) Text
175 # define dgettext(DomainName, Text) Text
178 #define N_(Text) Text
180 /* ============== from misc/miscfn.h */
182 #if !defined(USE_GNU_GLOB)
191 #include "misc/glob.h"
192 #include "misc/fnmatch.h"
199 #if HAVE_GETMNTINFO || HAVE_GETMNTINFO_R || HAVE_MNTCTL
200 # define GETMNTENT_ONE 0
201 # define GETMNTENT_TWO 0
202 # if HAVE_SYS_MNTCTL_H
203 # include <sys/mntctl.h>
205 # if HAVE_SYS_VMOUNT_H
206 # include <sys/vmount.h>
208 # if HAVE_SYS_MOUNT_H
209 # include <sys/mount.h>
211 #elif HAVE_MNTENT_H || !(HAVE_GETMNTENT) || HAVE_STRUCT_MNTTAB
215 # define our_mntent struct mntent
216 # define our_mntdir mnt_dir
217 # elif HAVE_STRUCT_MNTTAB
223 struct our_mntent *getmntent(FILE *filep);
224 # define our_mntent struct our_mntent
230 struct our_mntent *getmntent(FILE *filep);
231 # define our_mntent struct our_mntent
233 # define GETMNTENT_ONE 1
234 # define GETMNTENT_TWO 0
235 #elif HAVE_SYS_MNTTAB_H
237 # include <sys/mnttab.h>
238 # define GETMNTENT_ONE 0
239 # define GETMNTENT_TWO 1
240 # define our_mntent struct mnttab
241 # define our_mntdir mnt_mountp
242 #else /* if !HAVE_MNTCTL */
243 # error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system.
247 #define MOUNTED "/etc/mnttab"
250 #endif /* H_SYSTEM */