Removed type SHELL_ESCAPED_STR in favour of plain char*
[midnight-commander.git] / src / global.h
blob04ba14acac743e423e9e0d783876355813ffbbb5
1 /*
2 * This file should be included after all system includes and before
3 * all local includes.
4 */
6 #ifndef MC_GLOBAL_H
7 #define MC_GLOBAL_H
9 #include <stdlib.h> /* for free() and other useful routins */
11 #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
12 # include <string.h>
13 /* An ANSI string.h and pre-ANSI memory.h might conflict */
14 # if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
15 # include <memory.h>
16 # endif /* !STDC_HEADERS & HAVE_MEMORY_H */
18 #else /* !STDC_HEADERS & !HAVE_STRING_H */
19 # include <strings.h>
20 /* memory and strings.h conflict on other systems */
21 #endif /* !STDC_HEADERS & !HAVE_STRING_H */
23 #ifdef HAVE_SYS_PARAM_H
24 # include <sys/param.h>
25 #endif
27 #ifdef HAVE_FCNTL_H
28 # include <fcntl.h>
29 #endif
31 /* The O_BINARY definition was taken from gettext */
32 #if !defined O_BINARY && defined _O_BINARY
33 /* For MSC-compatible compilers. */
34 # define O_BINARY _O_BINARY
35 #endif
36 #ifdef __BEOS__
37 /* BeOS 5 has O_BINARY, but is has no effect. */
38 # undef O_BINARY
39 #endif
40 /* On reasonable systems, binary I/O is the default. */
41 #ifndef O_BINARY
42 # define O_BINARY 0
43 #endif
46 /* Replacement for O_NONBLOCK */
47 #ifndef O_NONBLOCK
48 #ifdef O_NDELAY /* SYSV */
49 #define O_NONBLOCK O_NDELAY
50 #else /* BSD */
51 #define O_NONBLOCK FNDELAY
52 #endif /* !O_NDELAY */
53 #endif /* !O_NONBLOCK */
56 #ifdef HAVE_SYS_TIMEB_H
57 # include <sys/timeb.h>
58 #endif
60 #ifdef TIME_WITH_SYS_TIME
61 # include <sys/time.h>
62 # include <time.h>
63 #else
64 # ifdef HAVE_SYS_TIME_H
65 # include <sys/time.h>
66 # else
67 # include <time.h>
68 # endif
69 #endif
71 #if !defined(HAVE_SYS_TIME_H)
72 struct timeval {
73 long int tv_sec; /* seconds */
74 long int tv_usec; /* microseconds */
76 #endif /* !HAVE_SYS_TIME_H */
78 #ifdef HAVE_UTIME_H
79 # include <utime.h>
80 #elif defined(HAVE_SYS_UTIME_H)
81 # include <sys/utime.h>
82 #endif
84 #ifdef HAVE_SYS_WAIT_H
85 # include <sys/wait.h>
86 #endif
88 #ifdef HAVE_SYS_SELECT_H
89 # include <sys/select.h>
90 #endif
92 #ifdef HAVE_GRP_H
93 # include <grp.h>
94 #endif
96 #ifdef HAVE_PWD_H
97 # include <pwd.h>
98 #endif
100 #if defined(__QNX__) && !defined(__QNXNTO__)
101 /* exec*() from <process.h> */
102 # include <unix.h>
103 #endif
105 #include <glib.h>
106 #include "glibcompat.h"
108 #if defined(HAVE_RX_H) && defined(HAVE_REGCOMP)
109 #include <rx.h>
110 #else
111 #include "eregex.h"
112 #endif
114 #ifndef __GNUC__
115 # define __attribute__(x)
116 #endif
118 #ifndef HAVE_GETUID
119 # define getuid() 0
120 #endif
121 #ifndef HAVE_GETGID
122 # define getgid() 0
123 #endif
124 #ifndef HAVE_GETEUID
125 # define geteuid() getuid()
126 #endif
127 #ifndef HAVE_GETEGID
128 # define getegid() getgid()
129 #endif
131 #ifdef ENABLE_NLS
132 # include <libintl.h>
133 # define _(String) gettext (String)
134 # ifdef gettext_noop
135 # define N_(String) gettext_noop (String)
136 # else
137 # define N_(String) (String)
138 # endif
139 #else /* Stubs that do something close enough. */
140 # define textdomain(String)
141 # define gettext(String) (String)
142 # define ngettext(String1,String2,Num) (((Num) == 1) ? (String1) : (String2))
143 # define dgettext(Domain,Message) (Message)
144 # define dcgettext(Domain,Message,Type) (Message)
145 # define bindtextdomain(Domain,Directory)
146 # define _(String) (String)
147 # define N_(String) (String)
148 #endif /* !ENABLE_NLS */
150 #include "fs.h"
151 #include "util.h"
153 #include "textconf.h"
155 #ifdef USE_VFS
156 #include "../vfs/vfs.h"
157 #else
158 #include "vfsdummy.h"
159 #endif
161 extern const char *home_dir;
163 #ifdef min
164 #undef min
165 #endif
167 #ifdef max
168 #undef max
169 #endif
171 #define min(x, y) ((x) > (y) ? (y) : (x))
172 #define max(x, y) ((x) > (y) ? (x) : (y))
174 /* Just for keeping Your's brains from invention a proper size of the buffer :-) */
175 #define BUF_10K 10240L
176 #define BUF_8K 8192L
177 #define BUF_4K 4096L
178 #define BUF_1K 1024L
180 #define BUF_LARGE BUF_1K
181 #define BUF_MEDIUM 512
182 #define BUF_SMALL 128
183 #define BUF_TINY 64
185 void refresh_screen (void *);
187 /* AIX compiler doesn't understand '\e' */
188 #define ESC_CHAR '\033'
189 #define ESC_STR "\033"
191 /* C++ style type casts */
192 #define const_cast(m_type, m_expr) ((m_type) (m_expr))
194 #if 0
195 #ifdef MC_ENABLE_DEBUGGING_CODE
196 # undef NDEBUG
197 #else
198 # define NDEBUG
199 #endif
200 #include <assert.h>
201 #endif
203 #endif