1
2
3
4
5
6
7 #ifndef MC_GLOBAL_H
8 #define MC_GLOBAL_H
9
10 #include <glib.h>
11
12 #if defined(__has_attribute)
13 #define MC_HAS_ATTRIBUTE(ATTR) __has_attribute (ATTR)
14 #else
15 #define MC_HAS_ATTRIBUTE(ATTR) 0
16 #endif
17
18 #if MC_HAS_ATTRIBUTE(weak) && defined(HAVE_TESTS)
19 #define MC_MOCKABLE __attribute__ ((weak))
20 #else
21 #define MC_MOCKABLE
22 #endif
23
24 #include "glibcompat.h"
25
26 #include "unixcompat.h"
27
28 #include "fs.h"
29 #include "shell.h"
30 #include "mcconfig.h"
31
32
33
34 #ifdef ENABLE_NLS
35 #include <libintl.h>
36 #define _(String) gettext (String)
37 #ifdef gettext_noop
38 #define N_(String) gettext_noop (String)
39 #else
40 #define N_(String) (String)
41 #endif
42 #else
43 #define textdomain(String) 1
44 #define gettext(String) (String)
45 #define ngettext(String1, String2, Num) (((Num) == 1) ? (String1) : (String2))
46 #define dgettext(Domain, Message) (Message)
47 #define dcgettext(Domain, Message, Type) (Message)
48 #define bindtextdomain(Domain, Directory) 1
49 #define _(String) (String)
50 #define N_(String) (String)
51 #endif
52
53 #if MC_HAS_ATTRIBUTE(fallthrough)
54 #define MC_FALLTHROUGH __attribute__ ((fallthrough))
55 #else
56 #define MC_FALLTHROUGH
57 #endif
58
59 #if MC_HAS_ATTRIBUTE(unused)
60 #define MC_UNUSED __attribute__ ((unused))
61 #else
62 #define MC_UNUSED
63 #endif
64
65 #if MC_HAS_ATTRIBUTE(nonstring)
66 #define MC_NONSTRING __attribute__ ((nonstring))
67 #else
68 #define MC_NONSTRING
69 #endif
70
71 #ifdef USE_MAINTAINER_MODE
72 #include "lib/logging.h"
73 #endif
74
75
76 #define BUF_10K 10240L
77 #define BUF_8K 8192L
78 #define BUF_4K 4096L
79 #define BUF_2K 2048L
80 #define BUF_1K 1024L
81
82 #define BUF_LARGE BUF_1K
83 #define BUF_MEDIUM 512
84 #define BUF_SMALL 128
85 #define BUF_TINY 64
86
87
88
89 #define SUBSHELL_EXIT 128
90
91 #define MC_ERROR g_quark_from_static_string (PACKAGE)
92
93 #define DEFAULT_CHARSET "ASCII"
94
95
96
97
98 typedef enum
99 {
100 MC_RUN_FULL = 0,
101 MC_RUN_EDITOR,
102 MC_RUN_VIEWER,
103 MC_RUN_DIFFVIEWER
104 } mc_run_mode_t;
105
106
107
108 typedef struct
109 {
110 const char *mc_version;
111
112 mc_run_mode_t mc_run_mode;
113 gboolean run_from_parent_mc;
114
115 gboolean midnight_shutdown;
116
117
118
119 char *sysconfig_dir;
120
121 char *share_data_dir;
122
123 char *profile_name;
124
125 mc_config_t *main_config;
126 mc_config_t *panels_config;
127
128
129 int source_codepage;
130 int display_codepage;
131
132
133 gboolean utf8_display;
134
135
136 gboolean message_visible;
137
138 gboolean keybar_visible;
139
140 #ifdef ENABLE_BACKGROUND
141
142 gboolean we_are_background;
143 #endif
144
145 struct
146 {
147
148 gboolean confirm_history_cleanup;
149
150
151 gboolean show_all_if_ambiguous;
152
153
154
155 gboolean is_right;
156 } widget;
157
158
159 mc_shell_t *shell;
160
161 struct
162 {
163
164 char *skin;
165
166 gboolean shadows;
167
168 char *setup_color_string;
169 char *term_color_string;
170 char *color_terminal_string;
171
172 char *command_line_colors;
173
174 #ifndef LINUX_CONS_SAVER_C
175
176 char console_flag;
177 #endif
178
179 gboolean use_subshell;
180
181 #ifdef ENABLE_SUBSHELL
182
183 int subshell_pty;
184 #endif
185
186
187
188 gboolean xterm_flag;
189
190
191 gboolean disable_x11;
192
193
194
195 gboolean slow_terminal;
196
197
198 gboolean disable_colors;
199
200
201 gboolean ugly_line_drawing;
202
203
204 gboolean old_mouse;
205
206
207
208 gboolean alternate_plus_minus;
209 } tty;
210
211 struct
212 {
213
214 gboolean cd_symlinks;
215
216
217 gboolean preallocate_space;
218
219 } vfs;
220 } mc_global_t;
221
222
223
224 extern mc_global_t mc_global;
225 extern const char PACKAGE_COPYRIGHT[];
226
227
228
229
230 #endif