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__ */
35 #if !defined(HAVE_STPCPY)
36 char * stpcpy(char * dest, const char * src);
39 #if !defined(HAVE_STPNCPY)
40 char * stpncpy(char * dest, const char * src, size_t n);
43 #if HAVE___SECURE_GETENV
44 #define getenv(_s) __secure_getenv(_s)
55 # define NLENGTH(direct) (strlen((direct)->d_name))
56 #else /* not HAVE_DIRENT_H */
57 # define dirent direct
58 # define NLENGTH(direct) ((direct)->d_namlen)
59 # ifdef HAVE_SYS_NDIR_H
60 # include <sys/ndir.h>
61 # endif /* HAVE_SYS_NDIR_H */
62 # ifdef HAVE_SYS_DIR_H
64 # endif /* HAVE_SYS_DIR_H */
67 # endif /* HAVE_NDIR_H */
68 #endif /* HAVE_DIRENT_H */
75 #ifdef _POSIX_PATH_MAX
76 #define PATH_MAX _POSIX_PATH_MAX
77 #elif defined MAXPATHLEN
78 #define PATH_MAX MAXPATHLEN
85 #include <selinux/selinux.h>
87 typedef char * security_context_t;
91 #define setfilecon(_fn, _c) (-1)
92 #define lsetfilecon(_fn, _c) (-1)
94 #define is_selinux_enabled() (0)
96 #define matchpathcon_init(_fn) (-1)
97 #define matchpathcon_fini() (0)
98 #define matchpathcon(_fn, _fm, _c) (-1)
100 #define rpm_execcon(_v, _fn, _av, _envp) (0)
103 #include "rpmio/rpmutil.h"
104 /* compatibility macros to avoid a mass-renaming all over the codebase */
105 #define xmalloc(_size) rmalloc((_size))
106 #define xcalloc(_nmemb, _size) rcalloc((_nmemb), (_size))
107 #define xrealloc(_ptr, _size) rrealloc((_ptr), (_size))
108 #define xstrdup(_str) rstrdup((_str))
109 #define _free(_ptr) rfree((_ptr))
111 /* Retrofit glibc __progname */
112 #if defined __GLIBC__ && __GLIBC__ >= 2
113 #if __GLIBC_MINOR__ >= 1
114 #define __progname __assert_program_name
116 #define setprogname(pn)
118 #define __progname program_name
119 #define setprogname(pn) \
120 { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
121 else __progname = pn; \
124 extern const char *__progname;
126 /* Take care of NLS matters. */
129 # include <libintl.h>
130 # define _(Text) dgettext (PACKAGE, Text)
132 # define _(Text) Text
135 #define N_(Text) Text
137 /* ============== from misc/miscfn.h */
139 #if !defined(USE_GNU_GLOB)
148 #include "misc/glob.h"
149 #include "misc/fnmatch.h"
152 #endif /* H_SYSTEM */