rpm
4.13.0
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(__OS2__)
91
#if defined __GLIBC__ && __GLIBC__ >= 2
92
#if __GLIBC_MINOR__ >= 1
93
#define __progname __assert_program_name
94
#endif
95
#define setprogname(pn)
96
#else
97
#define __progname program_name
98
#define setprogname(pn) \
99
{ if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
100
else __progname = pn; \
101
}
102
#endif
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 */
stpcpy
char * stpcpy(char *dest, const char *src)
environ
char ** environ
Definition:
rpmdb.c:10
__progname
#define __progname
Definition:
system.h:97
stpncpy
char * stpncpy(char *dest, const char *src, size_t n)
config.h
rpmutil.h
Generated by
1.8.17