2009-02-05 21:28:18 +03:00
|
|
|
/** \file global.h
|
2009-02-06 17:46:15 +03:00
|
|
|
* \brief Header: %global definitions for compatibility
|
2009-02-05 21:28:18 +03:00
|
|
|
*
|
|
|
|
* This file should be included after all system includes and before all local includes.
|
2001-09-07 20:46:31 +04:00
|
|
|
*/
|
|
|
|
|
2004-12-03 22:17:46 +03:00
|
|
|
#ifndef MC_GLOBAL_H
|
|
|
|
#define MC_GLOBAL_H
|
1998-02-27 07:54:42 +03:00
|
|
|
|
2024-03-10 20:40:27 +03:00
|
|
|
#include <glib.h>
|
2024-07-28 19:50:55 +03:00
|
|
|
|
|
|
|
#if defined(HAVE_FUNC_ATTRIBUTE_WEAK) && defined(HAVE_TESTS)
|
|
|
|
#define MC_MOCKABLE __attribute__((weak))
|
|
|
|
#else
|
|
|
|
#define MC_MOCKABLE
|
|
|
|
#endif
|
|
|
|
|
2024-03-10 20:40:27 +03:00
|
|
|
#include "glibcompat.h"
|
2015-04-11 12:30:34 +03:00
|
|
|
|
2024-03-10 20:40:27 +03:00
|
|
|
#include "unixcompat.h"
|
2012-10-31 10:48:56 +04:00
|
|
|
|
2024-03-10 20:40:27 +03:00
|
|
|
#include "fs.h"
|
|
|
|
#include "shell.h"
|
|
|
|
#include "mcconfig.h"
|
2017-12-16 20:52:39 +03:00
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
/*** typedefs(not structures) and defined constants **********************************************/
|
|
|
|
|
2003-10-26 07:11:12 +03:00
|
|
|
#ifdef ENABLE_NLS
|
2010-11-08 13:21:45 +03:00
|
|
|
#include <libintl.h>
|
|
|
|
#define _(String) gettext (String)
|
|
|
|
#ifdef gettext_noop
|
|
|
|
#define N_(String) gettext_noop (String)
|
|
|
|
#else
|
|
|
|
#define N_(String) (String)
|
|
|
|
#endif
|
2003-10-26 07:11:12 +03:00
|
|
|
#else /* Stubs that do something close enough. */
|
2011-10-23 16:21:36 +04:00
|
|
|
#define textdomain(String) 1
|
2010-11-08 13:21:45 +03:00
|
|
|
#define gettext(String) (String)
|
|
|
|
#define ngettext(String1,String2,Num) (((Num) == 1) ? (String1) : (String2))
|
|
|
|
#define dgettext(Domain,Message) (Message)
|
|
|
|
#define dcgettext(Domain,Message,Type) (Message)
|
2011-10-23 16:21:36 +04:00
|
|
|
#define bindtextdomain(Domain,Directory) 1
|
2010-11-08 13:21:45 +03:00
|
|
|
#define _(String) (String)
|
|
|
|
#define N_(String) (String)
|
2003-10-26 07:11:12 +03:00
|
|
|
#endif /* !ENABLE_NLS */
|
|
|
|
|
2024-03-10 20:40:27 +03:00
|
|
|
#ifdef HAVE_FUNC_ATTRIBUTE_FALLTHROUGH
|
|
|
|
#define MC_FALLTHROUGH __attribute__((fallthrough))
|
|
|
|
#else
|
|
|
|
#define MC_FALLTHROUGH
|
|
|
|
#endif
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
|
2024-10-26 19:06:58 +03:00
|
|
|
#ifdef HAVE_FUNC_ATTRIBUTE_UNUSED
|
|
|
|
#define MC_UNUSED __attribute__((unused))
|
|
|
|
#else
|
|
|
|
#define MC_UNUSED
|
|
|
|
#endif
|
|
|
|
|
2009-10-30 00:57:40 +03:00
|
|
|
#ifdef USE_MAINTAINER_MODE
|
2010-01-21 16:47:19 +03:00
|
|
|
#include "lib/logging.h"
|
2009-10-30 00:57:40 +03:00
|
|
|
#endif
|
|
|
|
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
/* Just for keeping Your's brains from invention a proper size of the buffer :-) */
|
2010-11-08 13:21:45 +03:00
|
|
|
#define BUF_10K 10240L
|
|
|
|
#define BUF_8K 8192L
|
|
|
|
#define BUF_4K 4096L
|
|
|
|
#define BUF_1K 1024L
|
1998-02-27 07:54:42 +03:00
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
#define BUF_LARGE BUF_1K
|
|
|
|
#define BUF_MEDIUM 512
|
|
|
|
#define BUF_SMALL 128
|
|
|
|
#define BUF_TINY 64
|
1998-02-27 07:54:42 +03:00
|
|
|
|
2011-10-15 16:42:43 +04:00
|
|
|
#define UTF8_CHAR_LEN 6
|
2010-11-11 16:14:22 +03:00
|
|
|
|
2012-10-19 19:24:57 +04:00
|
|
|
/* Used to distinguish between a normal MC termination and */
|
2013-05-26 10:11:06 +04:00
|
|
|
/* one caused by typing 'exit' or 'logout' in the subshell */
|
2012-10-19 19:24:57 +04:00
|
|
|
#define SUBSHELL_EXIT 128
|
|
|
|
|
2011-02-10 16:32:38 +03:00
|
|
|
#define MC_ERROR g_quark_from_static_string (PACKAGE)
|
2010-11-08 13:21:45 +03:00
|
|
|
|
2013-09-09 16:55:01 +04:00
|
|
|
#define DEFAULT_CHARSET "ASCII"
|
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
/*** enums ***************************************************************************************/
|
|
|
|
|
2011-02-10 18:02:54 +03:00
|
|
|
/* run mode and params */
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
MC_RUN_FULL = 0,
|
|
|
|
MC_RUN_EDITOR,
|
|
|
|
MC_RUN_VIEWER,
|
|
|
|
MC_RUN_DIFFVIEWER
|
|
|
|
} mc_run_mode_t;
|
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
/*** structures declarations (and typedefs of structures)*****************************************/
|
|
|
|
|
2011-02-10 18:02:54 +03:00
|
|
|
typedef struct
|
|
|
|
{
|
2021-03-18 15:28:35 +03:00
|
|
|
const char *mc_version;
|
|
|
|
|
2011-02-10 18:02:54 +03:00
|
|
|
mc_run_mode_t mc_run_mode;
|
2020-02-01 11:49:47 +03:00
|
|
|
gboolean run_from_parent_mc;
|
2012-01-28 14:13:32 +04:00
|
|
|
/* Used so that widgets know if they are being destroyed or shut down */
|
|
|
|
gboolean midnight_shutdown;
|
|
|
|
|
|
|
|
/* sysconfig_dir: Area for default settings from maintainers of distributuves
|
|
|
|
default is /etc/mc or may be defined by MC_DATADIR */
|
|
|
|
char *sysconfig_dir;
|
|
|
|
/* share_data_dir: Area for default settings from developers */
|
|
|
|
char *share_data_dir;
|
2011-02-10 18:02:54 +03:00
|
|
|
|
2023-01-03 09:10:51 +03:00
|
|
|
char *profile_name;
|
|
|
|
|
2016-04-26 09:30:42 +03:00
|
|
|
mc_config_t *main_config;
|
|
|
|
mc_config_t *panels_config;
|
|
|
|
|
2011-02-10 18:02:54 +03:00
|
|
|
#ifdef HAVE_CHARSET
|
|
|
|
/* Numbers of (file I/O) and (input/display) codepages. -1 if not selected */
|
|
|
|
int source_codepage;
|
|
|
|
int display_codepage;
|
|
|
|
#else
|
|
|
|
/* If true, allow characters in the range 160-255 */
|
2016-11-25 10:39:08 +03:00
|
|
|
gboolean eight_bit_clean;
|
2011-02-10 18:02:54 +03:00
|
|
|
/*
|
|
|
|
* If true, also allow characters in the range 128-159.
|
|
|
|
* This is reported to break on many terminals (xterm, qansi-m).
|
|
|
|
*/
|
2016-11-25 10:39:08 +03:00
|
|
|
gboolean full_eight_bits;
|
2011-02-10 18:02:54 +03:00
|
|
|
#endif /* !HAVE_CHARSET */
|
2012-01-28 14:13:32 +04:00
|
|
|
/*
|
|
|
|
* If utf-8 terminal utf8_display = TRUE
|
|
|
|
* Display bits set UTF-8
|
2011-02-10 18:02:54 +03:00
|
|
|
*/
|
2012-01-28 14:13:32 +04:00
|
|
|
gboolean utf8_display;
|
2011-02-10 18:02:54 +03:00
|
|
|
|
2012-01-28 14:13:32 +04:00
|
|
|
/* Set if the nice message (hint) bar is visible */
|
2019-12-02 21:58:58 +03:00
|
|
|
gboolean message_visible;
|
2012-01-28 14:13:32 +04:00
|
|
|
/* Set if the nice and useful keybar is visible */
|
2019-12-02 21:58:58 +03:00
|
|
|
gboolean keybar_visible;
|
2011-02-18 16:11:57 +03:00
|
|
|
|
2012-01-28 14:13:32 +04:00
|
|
|
#ifdef ENABLE_BACKGROUND
|
|
|
|
/* If true, this is a background process */
|
|
|
|
gboolean we_are_background;
|
|
|
|
#endif /* ENABLE_BACKGROUND */
|
2011-02-10 18:02:54 +03:00
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
/* Asks for confirmation before clean up of history */
|
|
|
|
gboolean confirm_history_cleanup;
|
|
|
|
|
|
|
|
/* Set if you want the possible completions dialog for the first time */
|
|
|
|
gboolean show_all_if_ambiguous;
|
|
|
|
|
2012-01-28 14:13:32 +04:00
|
|
|
/* Ugly hack in order to distinguish between left and right panel in menubar */
|
|
|
|
/* Set if the command is being run from the "Right" menu */
|
2012-07-06 14:56:29 +04:00
|
|
|
gboolean is_right; /* If the selected menu was the right */
|
2011-02-10 18:02:54 +03:00
|
|
|
} widget;
|
|
|
|
|
2015-11-10 17:23:09 +03:00
|
|
|
/* The user's shell */
|
|
|
|
mc_shell_t *shell;
|
|
|
|
|
2011-02-10 18:02:54 +03:00
|
|
|
struct
|
|
|
|
{
|
2012-01-28 14:13:32 +04:00
|
|
|
/* Use the specified skin */
|
|
|
|
char *skin;
|
Fix various typos in the source code (closes MidnightCommander/mc#177).
Found via `codespell -S
po,doc,./misc/syntax,./src/vfs/extfs/helpers/README.it -L
parm,rouge,sav,ect,vie,te,dum,clen,wee,dynamc,childs,ths,fo,nin,unx,nd,iif,iterm,ser,makrs,wil`
Co-authored-by: Yury V. Zaytsev <yury@shurup.com>
Signed-off-by: Kian-Meng Ang <kianmeng@cpan.org>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2023-01-10 06:02:52 +03:00
|
|
|
/* Dialog window and drop down menu have a shadow */
|
2020-07-19 19:47:15 +03:00
|
|
|
gboolean shadows;
|
2012-01-28 14:13:32 +04:00
|
|
|
|
2011-02-10 18:02:54 +03:00
|
|
|
char *setup_color_string;
|
|
|
|
char *term_color_string;
|
|
|
|
char *color_terminal_string;
|
2012-01-28 14:13:32 +04:00
|
|
|
/* colors specified on the command line: they override any other setting */
|
|
|
|
char *command_line_colors;
|
2011-02-10 18:02:54 +03:00
|
|
|
|
|
|
|
#ifndef LINUX_CONS_SAVER_C
|
|
|
|
/* Used only in mc, not in cons.saver */
|
|
|
|
char console_flag;
|
|
|
|
#endif /* !LINUX_CONS_SAVER_C */
|
|
|
|
/* If using a subshell for evaluating commands this is true */
|
|
|
|
gboolean use_subshell;
|
2015-11-10 17:23:09 +03:00
|
|
|
|
2012-10-19 19:24:57 +04:00
|
|
|
#ifdef ENABLE_SUBSHELL
|
2011-02-10 18:02:54 +03:00
|
|
|
/* File descriptors of the pseudoterminal used by the subshell */
|
|
|
|
int subshell_pty;
|
2012-10-19 19:24:57 +04:00
|
|
|
#endif /* !ENABLE_SUBSHELL */
|
2011-02-10 18:02:54 +03:00
|
|
|
|
2011-09-06 14:35:42 +04:00
|
|
|
/* This flag is set by xterm detection routine in function main() */
|
2019-08-10 11:57:31 +03:00
|
|
|
/* It is used by function toggle_subshell() */
|
2011-09-06 14:35:42 +04:00
|
|
|
gboolean xterm_flag;
|
2011-09-06 19:24:18 +04:00
|
|
|
|
2011-10-28 16:09:44 +04:00
|
|
|
/* disable x11 support */
|
|
|
|
gboolean disable_x11;
|
|
|
|
|
2011-09-06 19:24:18 +04:00
|
|
|
/* For slow terminals */
|
|
|
|
/* If true lines are shown by spaces */
|
|
|
|
gboolean slow_terminal;
|
|
|
|
|
2011-09-07 13:06:03 +04:00
|
|
|
/* Set to force black and white display at program startup */
|
|
|
|
gboolean disable_colors;
|
|
|
|
|
|
|
|
/* If true use +, -, | for line drawing */
|
|
|
|
gboolean ugly_line_drawing;
|
|
|
|
|
|
|
|
/* Tries to use old highlight mouse tracking */
|
|
|
|
gboolean old_mouse;
|
2011-09-14 02:07:31 +04:00
|
|
|
|
|
|
|
/* If true, use + and \ keys normally and select/unselect do if M-+ / M-\.
|
|
|
|
and M-- and keypad + / - */
|
|
|
|
gboolean alternate_plus_minus;
|
2011-02-10 18:02:54 +03:00
|
|
|
} tty;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
/* Set when cd symlink following is desirable (bash mode) */
|
|
|
|
gboolean cd_symlinks;
|
2011-09-20 14:27:04 +04:00
|
|
|
|
|
|
|
/* Preallocate space before file copying */
|
|
|
|
gboolean preallocate_space;
|
|
|
|
|
2011-02-10 18:02:54 +03:00
|
|
|
} vfs;
|
|
|
|
} mc_global_t;
|
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
/*** global variables defined in .c file *********************************************************/
|
|
|
|
|
2011-02-10 18:02:54 +03:00
|
|
|
extern mc_global_t mc_global;
|
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
/*** declarations of public functions ************************************************************/
|
|
|
|
|
|
|
|
/*** inline functions ****************************************************************************/
|
2004-12-03 22:17:46 +03:00
|
|
|
#endif
|