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 getfilecon(_fn, _c) (-1)
122 #define lgetfilecon(_fn, _c) (-1)
123 #define fgetfilecon(_fd, _c) (-1)
125 #define setfilecon(_fn, _c) (-1)
126 #define lsetfilecon(_fn, _c) (-1)
127 #define fsetfilecon(_fd, _c) (-1)
129 #define security_check_context(_c) (0)
131 #define is_selinux_enabled() (0)
133 #define matchpathcon_init(_fn) (-1)
134 #define matchpathcon_fini() (0)
135 #define matchpathcon(_fn, _fm, _c) (-1)
137 #define rpm_execcon(_v, _fn, _av, _envp) (0)
141 #include <sys/capability.h>
143 typedef void * cap_t;
146 #include "rpmio/rpmutil.h"
147 /* compatibility macros to avoid a mass-renaming all over the codebase */
148 #define xmalloc(_size) rmalloc((_size))
149 #define xcalloc(_nmemb, _size) rcalloc((_nmemb), (_size))
150 #define xrealloc(_ptr, _size) rrealloc((_ptr), (_size))
151 #define xstrdup(_str) rstrdup((_str))
152 #define _free(_ptr) rfree((_ptr))
154 /* Retrofit glibc __progname */
155 #if defined __GLIBC__ && __GLIBC__ >= 2
156 #if __GLIBC_MINOR__ >= 1
157 #define __progname __assert_program_name
159 #define setprogname(pn)
161 #define __progname program_name
162 #define setprogname(pn) \
163 { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
164 else __progname = pn; \
167 extern const char *__progname;
169 /* Take care of NLS matters. */
175 # define setlocale(Category, Locale) /* empty */
179 # include <libintl.h>
180 # define _(Text) dgettext (PACKAGE, Text)
182 # undef bindtextdomain
183 # define bindtextdomain(Domain, Directory) /* empty */
185 # define textdomain(Domain) /* empty */
186 # define _(Text) Text
188 # define dgettext(DomainName, Text) Text
191 #define N_(Text) Text
193 /* ============== from misc/miscfn.h */
195 #if !defined(USE_GNU_GLOB)
204 #include "misc/glob.h"
205 #include "misc/fnmatch.h"
212 #if HAVE_GETMNTINFO || HAVE_GETMNTINFO_R || HAVE_MNTCTL
213 # define GETMNTENT_ONE 0
214 # define GETMNTENT_TWO 0
215 # if HAVE_SYS_MNTCTL_H
216 # include <sys/mntctl.h>
218 # if HAVE_SYS_VMOUNT_H
219 # include <sys/vmount.h>
221 # if HAVE_SYS_MOUNT_H
222 # include <sys/mount.h>
224 #elif HAVE_MNTENT_H || !(HAVE_GETMNTENT) || HAVE_STRUCT_MNTTAB
228 # define our_mntent struct mntent
229 # define our_mntdir mnt_dir
230 # elif HAVE_STRUCT_MNTTAB
236 struct our_mntent *getmntent(FILE *filep);
237 # define our_mntent struct our_mntent
243 struct our_mntent *getmntent(FILE *filep);
244 # define our_mntent struct our_mntent
246 # define GETMNTENT_ONE 1
247 # define GETMNTENT_TWO 0
248 #elif HAVE_SYS_MNTTAB_H
250 # include <sys/mnttab.h>
251 # define GETMNTENT_ONE 0
252 # define GETMNTENT_TWO 1
253 # define our_mntent struct mnttab
254 # define our_mntdir mnt_mountp
255 #else /* if !HAVE_MNTCTL */
256 # error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system.
260 #define MOUNTED "/etc/mnttab"
263 #endif /* H_SYSTEM */