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__ */
39 #if !defined(HAVE_STPCPY)
40 char * stpcpy(char * dest, const char * src);
43 #if !defined(HAVE_STPNCPY)
44 char * stpncpy(char * dest, const char * src, size_t n);
52 #if HAVE___SECURE_GETENV
53 #define getenv(_s) __secure_getenv(_s)
64 # define NLENGTH(direct) (strlen((direct)->d_name))
65 #else /* not HAVE_DIRENT_H */
66 # define dirent direct
67 # define NLENGTH(direct) ((direct)->d_namlen)
68 # ifdef HAVE_SYS_NDIR_H
69 # include <sys/ndir.h>
70 # endif /* HAVE_SYS_NDIR_H */
71 # ifdef HAVE_SYS_DIR_H
73 # endif /* HAVE_SYS_DIR_H */
76 # endif /* HAVE_NDIR_H */
77 #endif /* HAVE_DIRENT_H */
86 #ifdef _POSIX_PATH_MAX
87 #define PATH_MAX _POSIX_PATH_MAX
88 #elif defined MAXPATHLEN
89 #define PATH_MAX MAXPATHLEN
96 #include <selinux/selinux.h>
98 typedef char * security_context_t;
102 #define setfilecon(_fn, _c) (-1)
103 #define lsetfilecon(_fn, _c) (-1)
105 #define is_selinux_enabled() (0)
107 #define matchpathcon_init(_fn) (-1)
108 #define matchpathcon_fini() (0)
109 #define matchpathcon(_fn, _fm, _c) (-1)
111 #define rpm_execcon(_v, _fn, _av, _envp) (0)
114 #include "rpmio/rpmutil.h"
115 /* compatibility macros to avoid a mass-renaming all over the codebase */
116 #define xmalloc(_size) rmalloc((_size))
117 #define xcalloc(_nmemb, _size) rcalloc((_nmemb), (_size))
118 #define xrealloc(_ptr, _size) rrealloc((_ptr), (_size))
119 #define xstrdup(_str) rstrdup((_str))
120 #define _free(_ptr) rfree((_ptr))
122 /* Retrofit glibc __progname */
123 #if defined __GLIBC__ && __GLIBC__ >= 2
124 #if __GLIBC_MINOR__ >= 1
125 #define __progname __assert_program_name
127 #define setprogname(pn)
129 #define __progname program_name
130 #define setprogname(pn) \
131 { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
132 else __progname = pn; \
135 extern const char *__progname;
137 /* Take care of NLS matters. */
140 # include <libintl.h>
141 # define _(Text) dgettext (PACKAGE, Text)
143 # define _(Text) Text
146 #define N_(Text) Text
148 /* ============== from misc/miscfn.h */
150 #if !defined(USE_GNU_GLOB)
159 #include "misc/glob.h"
160 #include "misc/fnmatch.h"
163 #endif /* H_SYSTEM */