rpm: system.h Source File

rpm 4.12.0.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

system.h
Go to the documentation of this file.
1
5 #ifndef H_SYSTEM
6 #define H_SYSTEM
7
8 #ifdef HAVE_CONFIG_H
9 #include "config.h"
10 #endif
11
12 #ifdef HAVE_SYS_PARAM_H
13 #include <sys/param.h>
14 #endif
15
16 /* <unistd.h> should be included before any preprocessor test
17 of _POSIX_VERSION. */
18 #ifdef HAVE_UNISTD_H
19 #include <unistd.h>
20 #if !defined(__GLIBC__)
21 #ifdef __APPLE__
22 #include <crt_externs.h>
23 #define environ (*_NSGetEnviron())
24 #else
25 extern char ** environ;
26 #endif /* __APPLE__ */
27 #endif
28 #endif
29
30 #if !defined(HAVE_STPCPY)
31 char * stpcpy(char * dest, const char * src);
32 #endif
33
34 #if !defined(HAVE_STPNCPY)
35 char * stpncpy(char * dest, const char * src, size_t n);
36 #endif
37
38 #if HAVE_SECURE_GETENV
39 #define getenv(_s) secure_getenv(_s)
40 #elif HAVE___SECURE_GETENV
41 #define getenv(_s) __secure_getenv(_s)
42 #endif
43
44 #ifdef HAVE_FCNTL_H
45 #include <fcntl.h>
46 #else
47 #include <sys/file.h>
48 #endif
49
50 #ifdef HAVE_DIRENT_H
51 # include <dirent.h>
52 # define NLENGTH(direct) (strlen((direct)->d_name))
53 #else /* not HAVE_DIRENT_H */
54 # define dirent direct
55 # define NLENGTH(direct) ((direct)->d_namlen)
56 # ifdef HAVE_SYS_NDIR_H
57 # include <sys/ndir.h>
58 # endif /* HAVE_SYS_NDIR_H */
59 # ifdef HAVE_SYS_DIR_H
60 # include <sys/dir.h>
61 # endif /* HAVE_SYS_DIR_H */
62 # ifdef HAVE_NDIR_H
63 # include <ndir.h>
64 # endif /* HAVE_NDIR_H */
65 #endif /* HAVE_DIRENT_H */
66
67 #if HAVE_LIMITS_H
68 #include <limits.h>
69 #endif
70
71 #ifndef PATH_MAX
72 #ifdef _POSIX_PATH_MAX
73 #define PATH_MAX _POSIX_PATH_MAX
74 #elif defined MAXPATHLEN
75 #define PATH_MAX MAXPATHLEN
76 #else
77 #define PATH_MAX 256
78 #endif
79 #endif
80
81 #include "rpmio/rpmutil.h"
82 /* compatibility macros to avoid a mass-renaming all over the codebase */
83 #define xmalloc(_size) rmalloc((_size))
84 #define xcalloc(_nmemb, _size) rcalloc((_nmemb), (_size))
85 #define xrealloc(_ptr, _size) rrealloc((_ptr), (_size))
86 #define xstrdup(_str) rstrdup((_str))
87 #define _free(_ptr) rfree((_ptr))
88
89 /* Retrofit glibc __progname */
90 #if defined __GLIBC__ && __GLIBC__ >= 2
91 #if __GLIBC_MINOR__ >= 1
92 #define __progname __assert_program_name
93 #endif
94 #define setprogname(pn)
95 #else
96 #define __progname program_name
97 #define setprogname(pn) \
98 { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
99 else __progname = pn; \
100 }
101 #endif
102 extern const char *__progname;
103
104 /* Take care of NLS matters. */
105 #if ENABLE_NLS
106 # include <locale.h>
107 # include <libintl.h>
108 # define _(Text) dgettext (PACKAGE, Text)
109 #else
110 # define _(Text) Text
111 #endif
112
113 #define N_(Text) Text
114
115 /* ============== from misc/miscfn.h */
116
117 #include "misc/fnmatch.h"
118
119 #include <dlfcn.h>
120
121 #endif /* H_SYSTEM */
stpcpy
char * stpcpy(char *dest, const char *src)
config.h
environ
char ** environ
Definition: rpmdb.c:10
__progname
#define __progname
Definition: system.h:96
rpmutil.h
stpncpy
char * stpncpy(char *dest, const char *src, size_t n)