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