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