1
2
3
4
5
6
7 #ifndef MC_GLOBAL_H
8 #define MC_GLOBAL_H
9
10 #if defined(HAVE_STRING_H)
11 #include <string.h>
12
13 #elif defined(HAVE_MEMORY_H)
14 #include <memory.h>
15 #else
16 #include <strings.h>
17
18 #endif
19
20 #ifdef HAVE_SYS_PARAM_H
21 #include <sys/param.h>
22 #endif
23
24
25 #include <fcntl.h>
26
27
28 #include <signal.h>
29
30 #ifdef HAVE_FUNC_ATTRIBUTE_FALLTHROUGH
31 #define MC_FALLTHROUGH __attribute__((fallthrough))
32 #else
33 #define MC_FALLTHROUGH
34 #endif
35
36
37
38
39 #if !defined O_BINARY && defined _O_BINARY
40
41 #define O_BINARY _O_BINARY
42 #endif
43 #ifdef __BEOS__
44
45 #undef O_BINARY
46 #endif
47
48 #ifndef O_BINARY
49 #define O_BINARY 0
50 #endif
51
52
53 #ifndef O_NONBLOCK
54 #ifdef O_NDELAY
55 #define O_NONBLOCK O_NDELAY
56 #else
57 #define O_NONBLOCK FNDELAY
58 #endif
59 #endif
60
61 #if defined(__QNX__) && !defined(__QNXNTO__)
62
63 #include <unix.h>
64 #endif
65
66 #include <glib.h>
67 #include "glibcompat.h"
68
69
70 #ifndef PRIXMAX
71 #define PRIXMAX PRIxMAX
72 #endif
73
74 #ifdef ENABLE_NLS
75 #include <libintl.h>
76 #define _(String) gettext (String)
77 #ifdef gettext_noop
78 #define N_(String) gettext_noop (String)
79 #else
80 #define N_(String) (String)
81 #endif
82 #else
83 #define textdomain(String) 1
84 #define gettext(String) (String)
85 #define ngettext(String1,String2,Num) (((Num) == 1) ? (String1) : (String2))
86 #define dgettext(Domain,Message) (Message)
87 #define dcgettext(Domain,Message,Type) (Message)
88 #define bindtextdomain(Domain,Directory) 1
89 #define _(String) (String)
90 #define N_(String) (String)
91 #endif
92
93 #include "fs.h"
94 #include "shell.h"
95 #include "mcconfig.h"
96
97 #ifdef USE_MAINTAINER_MODE
98 #include "lib/logging.h"
99 #endif
100
101
102 #define BUF_10K 10240L
103 #define BUF_8K 8192L
104 #define BUF_4K 4096L
105 #define BUF_1K 1024L
106
107 #define BUF_LARGE BUF_1K
108 #define BUF_MEDIUM 512
109 #define BUF_SMALL 128
110 #define BUF_TINY 64
111
112
113 #ifdef ESC_CHAR
114 #undef ESC_CHAR
115 #endif
116
117 #define ESC_CHAR '\033'
118 #define ESC_STR "\033"
119
120
121 #define PATH_SEP '/'
122 #define PATH_SEP_STR "/"
123 #define IS_PATH_SEP(c) ((c) == PATH_SEP)
124 #define PATH_ENV_SEP ':'
125 #define TMPDIR_DEFAULT "/tmp"
126 #define SCRIPT_SUFFIX ""
127 #define get_default_editor() "vi"
128 #define OS_SORT_CASE_SENSITIVE_DEFAULT TRUE
129 #define UTF8_CHAR_LEN 6
130
131
132 #ifdef __APPLE__
133 #define st_atim st_atimespec
134 #define st_ctim st_ctimespec
135 #define st_mtim st_mtimespec
136 #endif
137
138
139
140 #define SUBSHELL_EXIT 128
141
142 #define MC_ERROR g_quark_from_static_string (PACKAGE)
143
144 #define DEFAULT_CHARSET "ASCII"
145
146
147
148
149 typedef enum
150 {
151 MC_RUN_FULL = 0,
152 MC_RUN_EDITOR,
153 MC_RUN_VIEWER,
154 MC_RUN_DIFFVIEWER
155 } mc_run_mode_t;
156
157
158
159 typedef struct
160 {
161 const char *mc_version;
162
163 mc_run_mode_t mc_run_mode;
164 gboolean run_from_parent_mc;
165
166 gboolean midnight_shutdown;
167
168
169
170 char *sysconfig_dir;
171
172 char *share_data_dir;
173
174 char *profile_name;
175
176 mc_config_t *main_config;
177 mc_config_t *panels_config;
178
179 #ifdef HAVE_CHARSET
180
181 int source_codepage;
182 int display_codepage;
183 #else
184
185 gboolean eight_bit_clean;
186
187
188
189
190 gboolean full_eight_bits;
191 #endif
192
193
194
195
196 gboolean utf8_display;
197
198
199 gboolean message_visible;
200
201 gboolean keybar_visible;
202
203 #ifdef ENABLE_BACKGROUND
204
205 gboolean we_are_background;
206 #endif
207
208 struct
209 {
210
211 gboolean confirm_history_cleanup;
212
213
214 gboolean show_all_if_ambiguous;
215
216
217
218 gboolean is_right;
219 } widget;
220
221
222 mc_shell_t *shell;
223
224 struct
225 {
226
227 char *skin;
228
229 gboolean shadows;
230
231 char *setup_color_string;
232 char *term_color_string;
233 char *color_terminal_string;
234
235 char *command_line_colors;
236
237 #ifndef LINUX_CONS_SAVER_C
238
239 char console_flag;
240 #endif
241
242 gboolean use_subshell;
243
244 #ifdef ENABLE_SUBSHELL
245
246 int subshell_pty;
247 #endif
248
249
250
251 gboolean xterm_flag;
252
253
254 gboolean disable_x11;
255
256
257
258 gboolean slow_terminal;
259
260
261 gboolean disable_colors;
262
263
264 gboolean ugly_line_drawing;
265
266
267 gboolean old_mouse;
268
269
270
271 gboolean alternate_plus_minus;
272 } tty;
273
274 struct
275 {
276
277 gboolean cd_symlinks;
278
279
280 gboolean preallocate_space;
281
282 } vfs;
283 } mc_global_t;
284
285
286
287 extern mc_global_t mc_global;
288
289
290
291
292 #endif