Remove backlinks from lib to src - move global variables(used in lib) to mc_global structure (see lib/global.c)
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Этот коммит содержится в:
родитель
6c5f5bf768
Коммит
6016620f42
@ -25,7 +25,7 @@ libmc_la_SOURCES = \
|
||||
fs.h \
|
||||
hook.c hook.h \
|
||||
glibcompat.c glibcompat.h \
|
||||
global.h \
|
||||
global.c global.h \
|
||||
keybind.c keybind.h \
|
||||
lock.c lock.h \
|
||||
timefmt.c timefmt.h
|
||||
|
@ -34,8 +34,6 @@
|
||||
#include "lib/fileloc.h"
|
||||
#include "lib/charsets.h"
|
||||
|
||||
#include "src/main.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
GPtrArray *codepages = NULL;
|
||||
@ -163,7 +161,7 @@ load_codepages_list_from_file (GPtrArray ** list, const char *fname)
|
||||
|
||||
if (default_codepage != NULL)
|
||||
{
|
||||
display_codepage = get_codepage_index (default_codepage);
|
||||
mc_global.display_codepage = get_codepage_index (default_codepage);
|
||||
g_free (default_codepage);
|
||||
}
|
||||
|
||||
@ -200,12 +198,12 @@ load_codepages_list (void)
|
||||
char *fname;
|
||||
|
||||
/* 1: try load /usr/share/mc/mc.charsets */
|
||||
fname = g_build_filename (mc_share_data_dir, CHARSETS_LIST, (char *) NULL);
|
||||
fname = g_build_filename (mc_global.share_data_dir, CHARSETS_LIST, (char *) NULL);
|
||||
load_codepages_list_from_file (&codepages, fname);
|
||||
g_free (fname);
|
||||
|
||||
/* 2: try load /etc/mc/mc.charsets */
|
||||
fname = g_build_filename (mc_sysconfig_dir, CHARSETS_LIST, (char *) NULL);
|
||||
fname = g_build_filename (mc_global.sysconfig_dir, CHARSETS_LIST, (char *) NULL);
|
||||
load_codepages_list_from_file (&codepages, fname);
|
||||
g_free (fname);
|
||||
|
||||
@ -435,7 +433,7 @@ convert_from_utf_to_current (const char *str)
|
||||
if (!str)
|
||||
return '.';
|
||||
|
||||
cp_to = get_codepage_id (source_codepage);
|
||||
cp_to = get_codepage_id (mc_global.source_codepage);
|
||||
conv = str_crt_conv_to (cp_to);
|
||||
|
||||
if (conv != INVALID_CONV)
|
||||
@ -537,7 +535,7 @@ convert_from_8bit_to_utf_c2 (const char input_char)
|
||||
str[0] = (unsigned char) input_char;
|
||||
str[1] = '\0';
|
||||
|
||||
cp_from = get_codepage_id (source_codepage);
|
||||
cp_from = get_codepage_id (mc_global.source_codepage);
|
||||
conv = str_crt_conv_to (cp_from);
|
||||
|
||||
if (conv != INVALID_CONV)
|
||||
|
@ -54,14 +54,14 @@ void convert_string (unsigned char *str);
|
||||
/*
|
||||
* Converter from utf to selected codepage
|
||||
* param str, utf char
|
||||
* return char in needle codepage (by global int source_codepage)
|
||||
* return char in needle codepage (by global int mc_global.source_codepage)
|
||||
*/
|
||||
unsigned char convert_from_utf_to_current (const char *str);
|
||||
|
||||
/*
|
||||
* Converter from utf to selected codepage
|
||||
* param input_char, gunichar
|
||||
* return char in needle codepage (by global int source_codepage)
|
||||
* return char in needle codepage (by global int mc_global.source_codepage)
|
||||
*/
|
||||
unsigned char convert_from_utf_to_current_c (const int input_char, GIConv conv);
|
||||
|
||||
|
@ -35,8 +35,6 @@
|
||||
#include "lib/util.h" /* exist_file() */
|
||||
#include "lib/filehighlight.h"
|
||||
|
||||
#include "src/main.h"
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
@ -209,14 +207,14 @@ mc_fhl_init_from_standard_files (mc_fhl_t * fhl)
|
||||
return TRUE;
|
||||
|
||||
/* ${sysconfdir}/mc/filehighlight.ini */
|
||||
name = g_build_filename (mc_sysconfig_dir, MC_FHL_INI_FILE, (char *) NULL);
|
||||
name = g_build_filename (mc_global.sysconfig_dir, MC_FHL_INI_FILE, (char *) NULL);
|
||||
ok = mc_fhl_read_ini_file (fhl, name);
|
||||
g_free (name);
|
||||
if (ok)
|
||||
return TRUE;
|
||||
|
||||
/* ${datadir}/mc/filehighlight.ini */
|
||||
name = g_build_filename (mc_share_data_dir, MC_FHL_INI_FILE, (char *) NULL);
|
||||
name = g_build_filename (mc_global.share_data_dir, MC_FHL_INI_FILE, (char *) NULL);
|
||||
ok = mc_fhl_read_ini_file (fhl, name);
|
||||
g_free (name);
|
||||
return ok;
|
||||
|
127
lib/global.c
Обычный файл
127
lib/global.c
Обычный файл
@ -0,0 +1,127 @@
|
||||
/* GLIB - Library of useful routines for C programming
|
||||
Copyright (C) 2009
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
The Midnight Commander is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Midnight Commander is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/** \file glibcompat.c
|
||||
* \brief Source: compatibility with older versions of glib
|
||||
*
|
||||
* Following code was copied from glib to GNU Midnight Commander to
|
||||
* provide compatibility with older versions of glib.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "global.h"
|
||||
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
# ifdef SUBSHELL_OPTIONAL
|
||||
# define SUBSHELL_USE FALSE
|
||||
# else /* SUBSHELL_OPTIONAL */
|
||||
# define SUBSHELL_USE TRUE
|
||||
# endif /* SUBSHELL_OPTIONAL */
|
||||
#else /* !HAVE_SUBSHELL_SUPPORT */
|
||||
# define SUBSHELL_USE FALSE
|
||||
#endif /* !HAVE_SUBSHELL_SUPPORT */
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
mc_global_t mc_global = {
|
||||
#ifdef WITH_BACKGROUND
|
||||
.we_are_background = 0,
|
||||
#endif /* WITH_BACKGROUND */
|
||||
|
||||
.message_visible = 1,
|
||||
.keybar_visible = 1,
|
||||
.mc_run_mode = MC_RUN_FULL,
|
||||
|
||||
#ifdef HAVE_CHARSET
|
||||
.source_codepage = -1,
|
||||
.display_codepage = -1,
|
||||
#else
|
||||
.eight_bit_clean = 1,
|
||||
.full_eight_bits = 0,
|
||||
#endif /* !HAVE_CHARSET */
|
||||
|
||||
.utf8_display = 0,
|
||||
.sysconfig_dir = NULL,
|
||||
.share_data_dir = NULL,
|
||||
|
||||
.args =
|
||||
{
|
||||
.disable_colors = FALSE,
|
||||
.skin = NULL,
|
||||
.ugly_line_drawing = FALSE,
|
||||
.slow_terminal = FALSE
|
||||
},
|
||||
|
||||
.widget =
|
||||
{
|
||||
.midnight_shutdown = FALSE,
|
||||
.confirm_history_cleanup = TRUE,
|
||||
.show_all_if_ambiguous = FALSE
|
||||
},
|
||||
|
||||
.tty =
|
||||
{
|
||||
.setup_color_string = NULL,
|
||||
.term_color_string = NULL,
|
||||
.color_terminal_string = NULL,
|
||||
#ifndef LINUX_CONS_SAVER_C
|
||||
.console_flag = '\0',
|
||||
#endif /* !LINUX_CONS_SAVER_C */
|
||||
|
||||
.use_subshell = SUBSHELL_USE,
|
||||
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
.subshell_pty = 0,
|
||||
#endif /* !HAVE_SUBSHELL_SUPPORT */
|
||||
|
||||
.winch_flag = FALSE,
|
||||
.command_line_colors = NULL,
|
||||
},
|
||||
|
||||
.vfs =
|
||||
{
|
||||
.cd_symlinks = TRUE
|
||||
}
|
||||
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
#undef SUBSHELL_USE
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
||||
/*** file scope functions ************************************************************************/
|
||||
|
||||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
116
lib/global.h
116
lib/global.h
@ -145,10 +145,126 @@
|
||||
|
||||
/*** enums ***************************************************************************************/
|
||||
|
||||
/* run mode and params */
|
||||
typedef enum
|
||||
{
|
||||
MC_RUN_FULL = 0,
|
||||
MC_RUN_EDITOR,
|
||||
MC_RUN_VIEWER,
|
||||
MC_RUN_DIFFVIEWER
|
||||
} mc_run_mode_t;
|
||||
|
||||
/*** structures declarations (and typedefs of structures)*****************************************/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#ifdef WITH_BACKGROUND
|
||||
/* If true, this is a background process */
|
||||
int we_are_background;
|
||||
#endif /* WITH_BACKGROUND */
|
||||
|
||||
/*
|
||||
* If utf-8 terminal utf8_display = 1
|
||||
* Display bits set UTF-8
|
||||
*/
|
||||
int utf8_display;
|
||||
|
||||
/* Set if the nice message (hint) bar is visible */
|
||||
int message_visible;
|
||||
|
||||
/* Set if the nice and useful keybar is visible */
|
||||
int keybar_visible;
|
||||
|
||||
mc_run_mode_t mc_run_mode;
|
||||
|
||||
#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 */
|
||||
int eight_bit_clean;
|
||||
/*
|
||||
* If true, also allow characters in the range 128-159.
|
||||
* This is reported to break on many terminals (xterm, qansi-m).
|
||||
*/
|
||||
int full_eight_bits;
|
||||
#endif /* !HAVE_CHARSET */
|
||||
|
||||
/* 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;
|
||||
|
||||
struct
|
||||
{
|
||||
/* Use the specified skin */
|
||||
char *skin;
|
||||
|
||||
/* Set to force black and white display at program startup */
|
||||
gboolean disable_colors;
|
||||
|
||||
/* If true use +, -, | for line drawing */
|
||||
gboolean ugly_line_drawing;
|
||||
|
||||
/* For slow terminals */
|
||||
gboolean slow_terminal;
|
||||
|
||||
} args;
|
||||
|
||||
struct
|
||||
{
|
||||
/* Used so that widgets know if they are being destroyed or shut down */
|
||||
gboolean midnight_shutdown;
|
||||
|
||||
/* 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;
|
||||
|
||||
} widget;
|
||||
|
||||
struct
|
||||
{
|
||||
char *setup_color_string;
|
||||
char *term_color_string;
|
||||
char *color_terminal_string;
|
||||
|
||||
/* Set if the window has changed it's size */
|
||||
gboolean winch_flag;
|
||||
|
||||
#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;
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
/* File descriptors of the pseudoterminal used by the subshell */
|
||||
int subshell_pty;
|
||||
#endif /* !HAVE_SUBSHELL_SUPPORT */
|
||||
|
||||
/* colors specified on the command line: they override any other setting */
|
||||
char *command_line_colors;
|
||||
|
||||
} tty;
|
||||
|
||||
struct
|
||||
{
|
||||
/* Set when cd symlink following is desirable (bash mode) */
|
||||
gboolean cd_symlinks;
|
||||
} vfs;
|
||||
|
||||
} mc_global_t;
|
||||
|
||||
/*** global variables defined in .c file *********************************************************/
|
||||
|
||||
extern mc_global_t mc_global;
|
||||
|
||||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
void refresh_screen (void *);
|
||||
|
@ -25,8 +25,6 @@
|
||||
|
||||
/*** global variables **************************************************/
|
||||
|
||||
extern int utf8_display;
|
||||
|
||||
/*** file scope macro definitions **************************************/
|
||||
|
||||
/*** file scope type declarations **************************************/
|
||||
@ -103,7 +101,7 @@ mc_config_get_string (mc_config_t * mc_config, const gchar * group,
|
||||
if (ret == NULL)
|
||||
ret = g_strdup (def);
|
||||
|
||||
if (utf8_display)
|
||||
if (mc_global.utf8_display)
|
||||
return ret;
|
||||
|
||||
conv = str_crt_conv_from ("UTF-8");
|
||||
|
@ -25,8 +25,6 @@
|
||||
|
||||
/*** global variables **************************************************/
|
||||
|
||||
extern int utf8_display;
|
||||
|
||||
/*** file scope macro definitions **************************************/
|
||||
|
||||
/*** file scope type declarations **************************************/
|
||||
@ -42,7 +40,7 @@ mc_config_normalize_before_save (const gchar * value)
|
||||
GIConv conv;
|
||||
GString *buffer;
|
||||
|
||||
if (utf8_display)
|
||||
if (mc_global.utf8_display)
|
||||
return g_strdup (value);
|
||||
|
||||
conv = str_crt_conv_to ("UTF-8");
|
||||
|
@ -35,8 +35,6 @@
|
||||
|
||||
#include "lib/tty/color.h"
|
||||
|
||||
#include "src/setup.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
@ -160,8 +158,7 @@ mc_skin_colors_old_configure_one (mc_skin_t * mc_skin, const char *the_color_str
|
||||
if (key_val == NULL)
|
||||
continue;
|
||||
|
||||
if (key_val[1] != NULL
|
||||
&& mc_skin_colors_old_transform (key_val[0], &skin_group, &skin_key))
|
||||
if (key_val[1] != NULL && mc_skin_colors_old_transform (key_val[0], &skin_group, &skin_key))
|
||||
{
|
||||
gchar *skin_val;
|
||||
|
||||
@ -188,10 +185,10 @@ mc_skin_colors_old_configure_one (mc_skin_t * mc_skin, const char *the_color_str
|
||||
void
|
||||
mc_skin_colors_old_configure (mc_skin_t * mc_skin)
|
||||
{
|
||||
mc_skin_colors_old_configure_one (mc_skin, setup_color_string);
|
||||
mc_skin_colors_old_configure_one (mc_skin, term_color_string);
|
||||
mc_skin_colors_old_configure_one (mc_skin, mc_global.tty.setup_color_string);
|
||||
mc_skin_colors_old_configure_one (mc_skin, mc_global.tty.term_color_string);
|
||||
mc_skin_colors_old_configure_one (mc_skin, getenv ("MC_COLOR_TABLE"));
|
||||
mc_skin_colors_old_configure_one (mc_skin, command_line_colors);
|
||||
mc_skin_colors_old_configure_one (mc_skin, mc_global.tty.command_line_colors);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -33,8 +33,6 @@
|
||||
|
||||
#include "lib/tty/color.h"
|
||||
|
||||
#include "src/args.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
int mc_skin_color__cache[MC_SKIN_COLOR_CACHE_COUNT];
|
||||
@ -273,7 +271,7 @@ mc_skin_color_check_bw_mode (mc_skin_t * mc_skin)
|
||||
{
|
||||
gchar **groups, **orig_groups;
|
||||
|
||||
if (tty_use_colors () && !mc_args__disable_colors)
|
||||
if (tty_use_colors () && !mc_global.args.disable_colors)
|
||||
return;
|
||||
|
||||
orig_groups = groups = mc_config_get_groups (mc_skin->config, NULL);
|
||||
|
@ -33,8 +33,6 @@
|
||||
|
||||
#include "lib/tty/color.h" /* tty_use_256colors(); */
|
||||
|
||||
#include "src/args.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
mc_skin_t mc_skin__default;
|
||||
@ -69,8 +67,8 @@ mc_skin_get_default_name (void)
|
||||
char *tmp_str;
|
||||
|
||||
/* from command line */
|
||||
if (mc_args__skin != NULL)
|
||||
return g_strdup (mc_args__skin);
|
||||
if (mc_global.args.skin != NULL)
|
||||
return g_strdup (mc_global.args.skin);
|
||||
|
||||
/* from envirovement variable */
|
||||
tmp_str = getenv ("MC_SKIN");
|
||||
@ -146,7 +144,7 @@ mc_skin_init (GError ** error)
|
||||
(void) mc_skin_ini_file_parse (&mc_skin__default);
|
||||
is_good_init = FALSE;
|
||||
}
|
||||
if ( is_good_init && !tty_use_256colors () && mc_skin__default.have_256_colors )
|
||||
if (is_good_init && !tty_use_256colors () && mc_skin__default.have_256_colors)
|
||||
{
|
||||
if (*error == NULL)
|
||||
*error = g_error_new (MC_ERROR, 0,
|
||||
@ -187,7 +185,7 @@ mc_skin_deinit (void)
|
||||
gchar *
|
||||
mc_skin_get (const gchar * group, const gchar * key, const gchar * default_value)
|
||||
{
|
||||
if (mc_args__ugly_line_drawing)
|
||||
if (mc_global.args.ugly_line_drawing)
|
||||
{
|
||||
return g_strdup (default_value);
|
||||
}
|
||||
|
@ -32,8 +32,6 @@
|
||||
#include "lib/fileloc.h"
|
||||
#include "lib/util.h" /* exist_file() */
|
||||
|
||||
#include "src/main.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
@ -102,11 +100,11 @@ mc_skin_ini_file_load (mc_skin_t * mc_skin)
|
||||
return TRUE;
|
||||
|
||||
/* /etc/mc/skins/ */
|
||||
if (mc_skin_ini_file_load_search_in_dir (mc_skin, mc_sysconfig_dir))
|
||||
if (mc_skin_ini_file_load_search_in_dir (mc_skin, mc_global.sysconfig_dir))
|
||||
return TRUE;
|
||||
|
||||
/* /usr/share/mc/skins/ */
|
||||
return mc_skin_ini_file_load_search_in_dir (mc_skin, mc_share_data_dir);
|
||||
return mc_skin_ini_file_load_search_in_dir (mc_skin, mc_global.share_data_dir);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -31,8 +31,6 @@
|
||||
#include "internal.h"
|
||||
#include "lib/tty/tty.h"
|
||||
|
||||
#include "src/args.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
@ -98,9 +96,9 @@ mc_skin_lines_load_frm (mc_skin_t * mc_skin, const char *name)
|
||||
void
|
||||
mc_skin_lines_parse_ini_file (mc_skin_t * mc_skin)
|
||||
{
|
||||
if (mc_args__slow_terminal)
|
||||
if (mc_global.args.slow_terminal)
|
||||
mc_skin_hardcoded_space_lines (mc_skin);
|
||||
else if (mc_args__ugly_line_drawing)
|
||||
else if (mc_global.args.ugly_line_drawing)
|
||||
mc_skin_hardcoded_ugly_lines (mc_skin);
|
||||
|
||||
/* single lines */
|
||||
|
@ -37,8 +37,6 @@
|
||||
#include "color.h" /* variables */
|
||||
#include "color-internal.h"
|
||||
|
||||
#include "src/setup.h" /* color_terminal_string */
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
@ -63,11 +61,11 @@ has_colors (gboolean disable, gboolean force)
|
||||
const char *terminal = getenv ("TERM");
|
||||
const size_t len = strlen (terminal);
|
||||
|
||||
char *cts = color_terminal_string;
|
||||
char *cts = mc_global.tty.color_terminal_string;
|
||||
char *s;
|
||||
size_t i;
|
||||
|
||||
/* check color_terminal_string */
|
||||
/* check mc_global.tty.color_terminal_string */
|
||||
while (*cts != '\0')
|
||||
{
|
||||
while (*cts == ' ' || *cts == '\t')
|
||||
|
@ -44,8 +44,6 @@
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
char *command_line_colors = NULL;
|
||||
|
||||
static char *tty_color_defaults__fg = NULL;
|
||||
static char *tty_color_defaults__bg = NULL;
|
||||
static char *tty_color_defaults__attrs = NULL;
|
||||
|
@ -29,9 +29,6 @@
|
||||
|
||||
/*** global variables defined in .c file *********************************************************/
|
||||
|
||||
/* colors specified on the command line: they override any other setting */
|
||||
extern char *command_line_colors;
|
||||
|
||||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
void tty_init_colors (gboolean disable, gboolean force);
|
||||
|
@ -48,10 +48,7 @@
|
||||
#include "key.h"
|
||||
#include "win.h" /* xterm_flag */
|
||||
|
||||
#include "src/main.h"
|
||||
#include "src/filemanager/layout.h" /* winch_flag, mc_refresh() */
|
||||
#include "src/consaver/cons.saver.h"
|
||||
|
||||
#include "src/filemanager/layout.h" /* mc_refresh() */
|
||||
|
||||
#ifdef HAVE_TEXTMODE_X11_SUPPORT
|
||||
#include "x11conn.h"
|
||||
@ -1959,7 +1956,7 @@ tty_get_event (struct Gpm_Event *event, gboolean redo_event, gboolean block)
|
||||
}
|
||||
}
|
||||
|
||||
if (!block || winch_flag)
|
||||
if (!block || mc_global.tty.winch_flag)
|
||||
{
|
||||
time_addr = &time_out;
|
||||
time_out.tv_sec = 0;
|
||||
@ -1979,7 +1976,7 @@ tty_get_event (struct Gpm_Event *event, gboolean redo_event, gboolean block)
|
||||
{
|
||||
if (redo_event)
|
||||
return EV_MOUSE;
|
||||
if (!block || winch_flag)
|
||||
if (!block || mc_global.tty.winch_flag)
|
||||
return EV_NONE;
|
||||
vfs_timeout_handler ();
|
||||
}
|
||||
@ -2106,7 +2103,7 @@ learn_key (void)
|
||||
void
|
||||
numeric_keypad_mode (void)
|
||||
{
|
||||
if (console_flag || xterm_flag)
|
||||
if (mc_global.tty.console_flag || xterm_flag)
|
||||
{
|
||||
fputs ("\033>", stdout);
|
||||
fflush (stdout);
|
||||
@ -2118,7 +2115,7 @@ numeric_keypad_mode (void)
|
||||
void
|
||||
application_keypad_mode (void)
|
||||
{
|
||||
if (console_flag || xterm_flag)
|
||||
if (mc_global.tty.console_flag || xterm_flag)
|
||||
{
|
||||
fputs ("\033=", stdout);
|
||||
fflush (stdout);
|
||||
|
@ -39,8 +39,6 @@
|
||||
#include "lib/global.h"
|
||||
#include "lib/strutil.h" /* str_term_form */
|
||||
|
||||
#include "src/main.h"
|
||||
|
||||
#ifndef WANT_TERM_H
|
||||
#define WANT_TERM_H
|
||||
#endif
|
||||
@ -396,7 +394,7 @@ tty_print_anychar (int c)
|
||||
{
|
||||
unsigned char str[6 + 1];
|
||||
|
||||
if (utf8_display || c > 255)
|
||||
if (mc_global.utf8_display || c > 255)
|
||||
{
|
||||
int res = g_unichar_to_utf8 (c, (char *) str);
|
||||
if (res == 0)
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "lib/util.h" /* is_printable() */
|
||||
#include "tty.h" /* tty_gotoyx, tty_print_char */
|
||||
#include "win.h"
|
||||
#include "src/consaver/cons.saver.h" /* console_flag */
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
@ -44,8 +43,6 @@
|
||||
/* It is used by function view_other_cmd() */
|
||||
int xterm_flag = 0;
|
||||
|
||||
extern int keybar_visible;
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
@ -122,8 +119,8 @@ show_rxvt_contents (int starty, unsigned char y1, unsigned char y2)
|
||||
unsigned char *k;
|
||||
int bytes, i, j, cols = 0;
|
||||
|
||||
y1 += (keybar_visible != 0); /* i don't knwo why we need this - paul */
|
||||
y2 += (keybar_visible != 0);
|
||||
y1 += (mc_global.keybar_visible != 0); /* i don't knwo why we need this - paul */
|
||||
y2 += (mc_global.keybar_visible != 0);
|
||||
while (anything_ready ())
|
||||
tty_lowlevel_getch ();
|
||||
|
||||
@ -174,7 +171,7 @@ look_for_rxvt_extensions (void)
|
||||
}
|
||||
|
||||
if (rxvt_extensions)
|
||||
console_flag = 4;
|
||||
mc_global.tty.console_flag = '\004';
|
||||
|
||||
return rxvt_extensions;
|
||||
}
|
||||
|
@ -50,7 +50,6 @@
|
||||
|
||||
#include "src/filemanager/filegui.h"
|
||||
#include "src/filemanager/file.h" /* copy_file_file() */
|
||||
#include "src/main.h" /* eight_bit_clean */
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
@ -221,10 +220,10 @@ is_printable (int c)
|
||||
by setting the output codepage */
|
||||
return is_8bit_printable (c);
|
||||
#else
|
||||
if (!eight_bit_clean)
|
||||
if (!mc_global.eight_bit_clean)
|
||||
return is_7bit_printable (c);
|
||||
|
||||
if (full_eight_bits)
|
||||
if (mc_global.full_eight_bits)
|
||||
{
|
||||
return is_8bit_printable (c);
|
||||
}
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include "lib/global.h"
|
||||
|
||||
#include "src/filemanager/midnight.h" /* current_panel */
|
||||
#include "src/filemanager/layout.h" /* get_current_type(), get_other_type() */
|
||||
|
||||
#include "vfs.h"
|
||||
#include "utilvfs.h"
|
||||
|
@ -40,8 +40,6 @@
|
||||
#include "lib/util.h" /* mc_mkstemps() */
|
||||
#include "lib/widget.h" /* message() */
|
||||
|
||||
#include "src/history.h"
|
||||
|
||||
#include "vfs.h"
|
||||
#include "utilvfs.h"
|
||||
|
||||
@ -62,6 +60,8 @@
|
||||
/* Parsing code is used by ftpfs, fish and extfs */
|
||||
#define MAXCOLS 30
|
||||
|
||||
#define MC_HISTORY_VFS_PASSWORD "mc.vfs.password"
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
@ -58,7 +58,6 @@
|
||||
#ifdef HAVE_CHARSET
|
||||
#include "lib/charsets.h"
|
||||
#endif
|
||||
#include "src/setup.h" /* cd_symlinks */
|
||||
|
||||
#include "vfs.h"
|
||||
#include "utilvfs.h"
|
||||
@ -413,7 +412,7 @@ _vfs_get_cwd (void)
|
||||
{
|
||||
struct stat my_stat, my_stat2;
|
||||
/* Check if it is O.K. to use the current_dir */
|
||||
if (cd_symlinks
|
||||
if (mc_global.vfs.cd_symlinks
|
||||
&& mc_stat (sys_cwd, &my_stat) == 0
|
||||
&& mc_stat (current_dir, &my_stat2) == 0
|
||||
&& my_stat.st_ino == my_stat2.st_ino && my_stat.st_dev == my_stat2.st_dev)
|
||||
|
@ -33,7 +33,6 @@
|
||||
/* TODO: these includes should be removed! */
|
||||
#include "src/filemanager/layout.h" /* repaint_screen() */
|
||||
#include "src/filemanager/midnight.h" /* midnight_dlg */
|
||||
#include "src/main.h" /* midnight_shutdown */
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
@ -148,7 +147,7 @@ dialog_switch_next (void)
|
||||
{
|
||||
GList *next;
|
||||
|
||||
if (midnight_shutdown || mc_current == NULL)
|
||||
if (mc_global.widget.midnight_shutdown || mc_current == NULL)
|
||||
return;
|
||||
|
||||
next = g_list_next (mc_current);
|
||||
@ -165,7 +164,7 @@ dialog_switch_prev (void)
|
||||
{
|
||||
GList *prev;
|
||||
|
||||
if (midnight_shutdown || mc_current == NULL)
|
||||
if (mc_global.widget.midnight_shutdown || mc_current == NULL)
|
||||
return;
|
||||
|
||||
prev = g_list_previous (mc_current);
|
||||
@ -187,7 +186,7 @@ dialog_switch_list (void)
|
||||
int i = 0;
|
||||
int rv;
|
||||
|
||||
if (midnight_shutdown || mc_current == NULL)
|
||||
if (mc_global.widget.midnight_shutdown || mc_current == NULL)
|
||||
return;
|
||||
|
||||
lines = min ((size_t) (LINES * 2 / 3), dlg_num);
|
||||
@ -240,7 +239,7 @@ dialog_switch_process_pending (void)
|
||||
{
|
||||
destroy_dlg (h);
|
||||
/* return to panels */
|
||||
if (mc_run_mode == MC_RUN_FULL)
|
||||
if (mc_global.mc_run_mode == MC_RUN_FULL)
|
||||
{
|
||||
mc_current = g_list_find (mc_dialogs, midnight_dlg);
|
||||
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
|
||||
|
@ -498,7 +498,7 @@ frontend_run_dlg (Dlg_head * h)
|
||||
event.x = -1;
|
||||
|
||||
/* close opened editors, viewers, etc */
|
||||
if (!h->modal && midnight_shutdown)
|
||||
if (!h->modal && mc_global.widget.midnight_shutdown)
|
||||
{
|
||||
h->callback (h, NULL, DLG_VALIDATE, 0, NULL);
|
||||
return;
|
||||
@ -506,7 +506,7 @@ frontend_run_dlg (Dlg_head * h)
|
||||
|
||||
while (h->state == DLG_ACTIVE)
|
||||
{
|
||||
if (winch_flag)
|
||||
if (mc_global.tty.winch_flag)
|
||||
change_screen_size ();
|
||||
|
||||
if (is_idle ())
|
||||
|
@ -49,9 +49,6 @@
|
||||
#include "lib/util.h" /* list_append_unique */
|
||||
#include "lib/widget.h"
|
||||
|
||||
/* TODO: these includes should be removed! */
|
||||
#include "src/setup.h" /* num_history_items_recorded */
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
int num_history_items_recorded = 60;
|
||||
@ -163,7 +160,7 @@ history_get (const char *input_name)
|
||||
|
||||
/* create charset conversion handler to convert strings
|
||||
from utf-8 to system codepage */
|
||||
if (!utf8_display)
|
||||
if (!mc_global.utf8_display)
|
||||
conv = str_crt_conv_from ("UTF-8");
|
||||
|
||||
buffer = g_string_sized_new (64);
|
||||
@ -254,7 +251,7 @@ history_put (const char *input_name, GList * h)
|
||||
|
||||
/* create charset conversion handler to convert strings
|
||||
from system codepage to UTF-8 */
|
||||
if (!utf8_display)
|
||||
if (!mc_global.utf8_display)
|
||||
conv = str_crt_conv_to ("UTF-8");
|
||||
|
||||
buffer = g_string_sized_new (64);
|
||||
|
@ -46,7 +46,6 @@
|
||||
|
||||
/* TODO: these includes should be removed! */
|
||||
#include "src/keybind-defaults.h" /* listbox_map */
|
||||
#include "src/setup.h" /* confirm_history_cleanup */
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
@ -269,7 +268,7 @@ listbox_execute_cmd (WListbox * l, unsigned long command)
|
||||
}
|
||||
break;
|
||||
case CK_Clear:
|
||||
if (l->deletable && confirm_history_cleanup
|
||||
if (l->deletable && mc_global.widget.confirm_history_cleanup
|
||||
/* TRANSLATORS: no need to translate 'DialogTitle', it's just a context prefix */
|
||||
&& (query_dialog (Q_ ("DialogTitle|History cleanup"),
|
||||
_("Do you want clean this history?"),
|
||||
|
@ -386,7 +386,7 @@ message (int flags, const char *title, const char *text, ...)
|
||||
title = _("Error");
|
||||
|
||||
#ifdef WITH_BACKGROUND
|
||||
if (we_are_background)
|
||||
if (mc_global.we_are_background)
|
||||
{
|
||||
func.f = bg_message;
|
||||
parent_call (func.p, NULL, 3, sizeof (flags), &flags, strlen (title), title, strlen (p), p);
|
||||
@ -416,7 +416,7 @@ input_dialog_help (const char *header, const char *text, const char *help,
|
||||
char *(*f) (const char *, const char *, const char *, const char *, const char *);
|
||||
} func;
|
||||
#ifdef WITH_BACKGROUND
|
||||
if (we_are_background)
|
||||
if (mc_global.we_are_background)
|
||||
{
|
||||
func.f = fg_input_dialog_help;
|
||||
return parent_call_string (func.p, 5,
|
||||
|
52
src/args.c
52
src/args.c
@ -30,19 +30,17 @@
|
||||
|
||||
#include "lib/global.h"
|
||||
#include "lib/tty/tty.h"
|
||||
#include "lib/tty/color.h" /* command_line_colors */
|
||||
#include "lib/tty/mouse.h"
|
||||
#include "lib/strutil.h"
|
||||
#include "lib/vfs/vfs.h"
|
||||
#include "lib/util.h" /* x_basename() */
|
||||
|
||||
#ifdef ENABLE_VFS_SMB
|
||||
#include "src/vfs/smbfs/smbfs.h" /* smbfs_set_debugf() */
|
||||
#include "src/vfs/smbfs/smbfs.h" /* smbfs_set_debugf() */
|
||||
#endif
|
||||
|
||||
#include "src/main.h"
|
||||
#include "src/textconf.h"
|
||||
#include "src/subshell.h" /* use_subshell */
|
||||
|
||||
#include "src/args.h"
|
||||
|
||||
@ -58,15 +56,6 @@ gboolean mc_args__force_xterm = FALSE;
|
||||
|
||||
gboolean mc_args__nomouse = FALSE;
|
||||
|
||||
/* For slow terminals */
|
||||
gboolean mc_args__slow_terminal = FALSE;
|
||||
|
||||
/* If true use +, -, | for line drawing */
|
||||
gboolean mc_args__ugly_line_drawing = FALSE;
|
||||
|
||||
/* Set to force black and white display at program startup */
|
||||
gboolean mc_args__disable_colors = FALSE;
|
||||
|
||||
/* Force colors, only used by Slang */
|
||||
gboolean mc_args__force_colors = FALSE;
|
||||
|
||||
@ -76,9 +65,6 @@ gboolean mc_args__nokeymap = FALSE;
|
||||
/* Line to start the editor on */
|
||||
int mc_args__edit_start_line = 0;
|
||||
|
||||
/* Use the specified skin */
|
||||
char *mc_args__skin = NULL;
|
||||
|
||||
char *mc_args__last_wd_file = NULL;
|
||||
|
||||
/* when enabled NETCODE, use folowing file as logfile */
|
||||
@ -137,7 +123,7 @@ static const GOptionEntry argument_main_table[] = {
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
{
|
||||
"subshell", 'U', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
|
||||
&use_subshell,
|
||||
&mc_global.tty.use_subshell,
|
||||
N_("Enables subshell support (default)"),
|
||||
NULL
|
||||
},
|
||||
@ -218,14 +204,14 @@ static const GOptionEntry argument_terminal_table[] = {
|
||||
|
||||
{
|
||||
"slow", 's', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
||||
&mc_args__slow_terminal,
|
||||
&mc_global.args.slow_terminal,
|
||||
N_("To run on slow terminals"),
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
"stickchars", 'a', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
||||
&mc_args__ugly_line_drawing,
|
||||
&mc_global.args.ugly_line_drawing,
|
||||
N_("Use stickchars to draw"),
|
||||
NULL
|
||||
},
|
||||
@ -261,13 +247,13 @@ static const GOptionEntry argument_terminal_table[] = {
|
||||
|
||||
GOptionGroup *color_group;
|
||||
#define ARGS_COLOR_OPTIONS 0
|
||||
// #define ARGS_COLOR_OPTIONS G_OPTION_FLAG_IN_MAIN
|
||||
/* #define ARGS_COLOR_OPTIONS G_OPTION_FLAG_IN_MAIN */
|
||||
static const GOptionEntry argument_color_table[] = {
|
||||
/* *INDENT-OFF* */
|
||||
/* color options */
|
||||
{
|
||||
"nocolor", 'b', ARGS_COLOR_OPTIONS, G_OPTION_ARG_NONE,
|
||||
&mc_args__disable_colors,
|
||||
&mc_global.args.disable_colors,
|
||||
N_("Requests to run in black and white"),
|
||||
NULL
|
||||
},
|
||||
@ -281,14 +267,14 @@ static const GOptionEntry argument_color_table[] = {
|
||||
|
||||
{
|
||||
"colors", 'C', ARGS_COLOR_OPTIONS, G_OPTION_ARG_STRING,
|
||||
&command_line_colors,
|
||||
&mc_global.tty.command_line_colors,
|
||||
N_("Specifies a color configuration"),
|
||||
"<string>"
|
||||
},
|
||||
|
||||
{
|
||||
"skin", 'S', ARGS_COLOR_OPTIONS, G_OPTION_ARG_STRING,
|
||||
&mc_args__skin,
|
||||
&mc_global.args.skin,
|
||||
N_("Show mc with specified skin"),
|
||||
"<string>"
|
||||
},
|
||||
@ -330,6 +316,7 @@ mc_args_clean_temp_help_strings (void)
|
||||
static GOptionGroup *
|
||||
mc_args_new_color_group (void)
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
/* FIXME: to preserve translations, lines should be split. */
|
||||
mc_args__loc__colors_string = g_strdup_printf ("%s\n%s",
|
||||
/* TRANSLATORS: don't translate keywords */
|
||||
@ -358,6 +345,7 @@ mc_args_new_color_group (void)
|
||||
"Attributes:\n"
|
||||
" bold, underline, reverse, blink; append more with '+'\n")
|
||||
);
|
||||
/* *INDENT-ON* */
|
||||
|
||||
return g_option_group_new ("color", mc_args__loc__colors_string,
|
||||
_("Color options"), NULL, NULL);
|
||||
@ -499,7 +487,7 @@ mc_setup_by_args (int argc, char *argv[])
|
||||
mc_run_param0 = g_strdup (tmp);
|
||||
}
|
||||
}
|
||||
mc_run_mode = MC_RUN_EDITOR;
|
||||
mc_global.mc_run_mode = MC_RUN_EDITOR;
|
||||
}
|
||||
else if (strncmp (base, "mcv", 3) == 0 || strcmp (base, "view") == 0)
|
||||
{
|
||||
@ -512,7 +500,7 @@ mc_setup_by_args (int argc, char *argv[])
|
||||
fprintf (stderr, "%s\n", _("No arguments given to the viewer."));
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
mc_run_mode = MC_RUN_VIEWER;
|
||||
mc_global.mc_run_mode = MC_RUN_VIEWER;
|
||||
}
|
||||
#ifdef USE_DIFF_VIEW
|
||||
else if (strncmp (base, "mcd", 3) == 0 || strcmp (base, "diff") == 0)
|
||||
@ -531,7 +519,7 @@ mc_setup_by_args (int argc, char *argv[])
|
||||
tmp = (argc > 1) ? argv[2] : NULL;
|
||||
if (tmp != NULL)
|
||||
mc_run_param1 = g_strdup (tmp);
|
||||
mc_run_mode = MC_RUN_DIFFVIEWER;
|
||||
mc_global.mc_run_mode = MC_RUN_DIFFVIEWER;
|
||||
}
|
||||
}
|
||||
#endif /* USE_DIFF_VIEW */
|
||||
@ -539,7 +527,7 @@ mc_setup_by_args (int argc, char *argv[])
|
||||
{
|
||||
/* MC is run as mc */
|
||||
|
||||
switch (mc_run_mode)
|
||||
switch (mc_global.mc_run_mode)
|
||||
{
|
||||
case MC_RUN_EDITOR:
|
||||
case MC_RUN_VIEWER:
|
||||
@ -560,7 +548,7 @@ mc_setup_by_args (int argc, char *argv[])
|
||||
if (tmp != NULL)
|
||||
mc_run_param1 = g_strdup (tmp);
|
||||
}
|
||||
mc_run_mode = MC_RUN_FULL;
|
||||
mc_global.mc_run_mode = MC_RUN_FULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -578,16 +566,16 @@ mc_args_process (int argc, char *argv[])
|
||||
}
|
||||
if (mc_args__show_datadirs)
|
||||
{
|
||||
printf ("%s (%s)\n", mc_sysconfig_dir, mc_share_data_dir);
|
||||
printf ("%s (%s)\n", mc_global.sysconfig_dir, mc_global.share_data_dir);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (mc_args__force_colors)
|
||||
mc_args__disable_colors = FALSE;
|
||||
mc_global.args.disable_colors = FALSE;
|
||||
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
if (mc_args__nouse_subshell)
|
||||
use_subshell = 0;
|
||||
mc_global.tty.use_subshell = FALSE;
|
||||
#endif /* HAVE_SUBSHELL_SUPPORT */
|
||||
|
||||
mc_setup_by_args (argc, argv);
|
||||
@ -622,7 +610,7 @@ parse_mc_e_argument (const gchar * option_name, const gchar * value, gpointer da
|
||||
(void) data;
|
||||
(void) error;
|
||||
|
||||
mc_run_mode = MC_RUN_EDITOR;
|
||||
mc_global.mc_run_mode = MC_RUN_EDITOR;
|
||||
mc_run_param0 = g_strdup (value);
|
||||
|
||||
return TRUE;
|
||||
@ -637,7 +625,7 @@ parse_mc_v_argument (const gchar * option_name, const gchar * value, gpointer da
|
||||
(void) data;
|
||||
(void) error;
|
||||
|
||||
mc_run_mode = MC_RUN_VIEWER;
|
||||
mc_global.mc_run_mode = MC_RUN_VIEWER;
|
||||
mc_run_param0 = g_strdup (value);
|
||||
|
||||
return TRUE;
|
||||
|
@ -13,12 +13,8 @@
|
||||
|
||||
extern gboolean mc_args__force_xterm;
|
||||
extern gboolean mc_args__nomouse;
|
||||
extern gboolean mc_args__slow_terminal;
|
||||
extern gboolean mc_args__ugly_line_drawing;
|
||||
extern gboolean mc_args__disable_colors;
|
||||
extern gboolean mc_args__force_colors;
|
||||
extern gboolean mc_args__nokeymap;
|
||||
extern char *mc_args__skin;
|
||||
extern gboolean mc_args__version;
|
||||
extern int mc_args__edit_start_line;
|
||||
extern char *mc_args__last_wd_file;
|
||||
|
@ -56,9 +56,6 @@
|
||||
|
||||
#define MAXCALLARGS 4 /* Number of arguments supported */
|
||||
|
||||
/* If true, this is a background process */
|
||||
int we_are_background = 0;
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
@ -475,7 +472,7 @@ do_background (struct FileOpContext *ctx, char *info)
|
||||
parent_fd = comm[1];
|
||||
from_parent_fd = back_comm[0];
|
||||
|
||||
we_are_background = 1;
|
||||
mc_global.we_are_background = 1;
|
||||
top_dlg = NULL;
|
||||
|
||||
/* Make stdin/stdout/stderr point somewhere */
|
||||
|
@ -37,8 +37,6 @@ struct FileOpContext;
|
||||
|
||||
extern struct TaskList *task_list;
|
||||
|
||||
extern int we_are_background;
|
||||
|
||||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
int do_background (struct FileOpContext *ctx, char *info);
|
||||
|
@ -45,8 +45,6 @@
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
signed char console_flag = 0;
|
||||
|
||||
#ifdef __linux__
|
||||
int cons_saver_pid = 1;
|
||||
#endif /* __linux__ */
|
||||
@ -90,13 +88,13 @@ show_console_contents_linux (int starty, unsigned char begin_line, unsigned char
|
||||
ssize_t ret;
|
||||
|
||||
/* Is tty console? */
|
||||
if (!console_flag)
|
||||
if (!mc_global.tty.console_flag)
|
||||
return;
|
||||
/* Paranoid: Is the cons.saver still running? */
|
||||
if (cons_saver_pid < 1 || kill (cons_saver_pid, SIGCONT))
|
||||
{
|
||||
cons_saver_pid = 0;
|
||||
console_flag = 0;
|
||||
mc_global.tty.console_flag = '\0';
|
||||
return;
|
||||
}
|
||||
|
||||
@ -123,7 +121,7 @@ show_console_contents_linux (int starty, unsigned char begin_line, unsigned char
|
||||
tty_print_char (message);
|
||||
}
|
||||
|
||||
/* Read the value of the console_flag */
|
||||
/* Read the value of the mc_global.tty.console_flag */
|
||||
ret = read (pipefd2[0], &message, 1);
|
||||
}
|
||||
|
||||
@ -145,7 +143,7 @@ handle_console_linux (unsigned char action)
|
||||
/* Create two pipes for communication */
|
||||
if (!((pipe (pipefd1) == 0) && ((pipe (pipefd2)) == 0)))
|
||||
{
|
||||
console_flag = 0;
|
||||
mc_global.tty.console_flag = '\0';
|
||||
break;
|
||||
}
|
||||
/* Get the console saver running */
|
||||
@ -158,7 +156,7 @@ handle_console_linux (unsigned char action)
|
||||
status = close (pipefd1[0]);
|
||||
status = close (pipefd2[1]);
|
||||
status = close (pipefd2[0]);
|
||||
console_flag = 0;
|
||||
mc_global.tty.console_flag = '\0';
|
||||
}
|
||||
else if (cons_saver_pid > 0)
|
||||
{
|
||||
@ -167,8 +165,8 @@ handle_console_linux (unsigned char action)
|
||||
status = close (pipefd1[0]);
|
||||
status = close (pipefd2[1]);
|
||||
/* Was the child successful? */
|
||||
status = read (pipefd2[0], &console_flag, 1);
|
||||
if (!console_flag)
|
||||
status = read (pipefd2[0], &mc_global.tty.console_flag, 1);
|
||||
if (!mc_global.tty.console_flag)
|
||||
{
|
||||
pid_t ret;
|
||||
status = close (pipefd1[1]);
|
||||
@ -208,8 +206,8 @@ handle_console_linux (unsigned char action)
|
||||
/* Console is not a tty or execl() failed */
|
||||
}
|
||||
while (0);
|
||||
console_flag = 0;
|
||||
status = write (1, &console_flag, 1);
|
||||
mc_global.tty.console_flag = '\0';
|
||||
status = write (1, &mc_global.tty.console_flag, 1);
|
||||
_exit (3);
|
||||
} /* if (cons_saver_pid ...) */
|
||||
break;
|
||||
@ -218,13 +216,13 @@ handle_console_linux (unsigned char action)
|
||||
case CONSOLE_SAVE:
|
||||
case CONSOLE_RESTORE:
|
||||
/* Is tty console? */
|
||||
if (!console_flag)
|
||||
if (!mc_global.tty.console_flag)
|
||||
return;
|
||||
/* Paranoid: Is the cons.saver still running? */
|
||||
if (cons_saver_pid < 1 || kill (cons_saver_pid, SIGCONT))
|
||||
{
|
||||
cons_saver_pid = 0;
|
||||
console_flag = 0;
|
||||
mc_global.tty.console_flag = '\0';
|
||||
return;
|
||||
}
|
||||
/* Send command to the console handler */
|
||||
@ -232,16 +230,16 @@ handle_console_linux (unsigned char action)
|
||||
if (action != CONSOLE_DONE)
|
||||
{
|
||||
/* Wait the console handler to do its job */
|
||||
status = read (pipefd2[0], &console_flag, 1);
|
||||
status = read (pipefd2[0], &mc_global.tty.console_flag, 1);
|
||||
}
|
||||
if (action == CONSOLE_DONE || !console_flag)
|
||||
if (action == CONSOLE_DONE || !mc_global.tty.console_flag)
|
||||
{
|
||||
/* We are done -> Let's clean up */
|
||||
pid_t ret;
|
||||
close (pipefd1[1]);
|
||||
close (pipefd2[0]);
|
||||
ret = waitpid (cons_saver_pid, &status, 0);
|
||||
console_flag = 0;
|
||||
mc_global.tty.console_flag = '\0';
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -258,7 +256,7 @@ handle_console_linux (unsigned char action)
|
||||
static void
|
||||
console_init (void)
|
||||
{
|
||||
if (console_flag)
|
||||
if (mc_global.tty.console_flag)
|
||||
return;
|
||||
|
||||
screen_info.size = sizeof (screen_info);
|
||||
@ -270,7 +268,7 @@ console_init (void)
|
||||
screen_shot.ysize = screen_info.mv_rsz;
|
||||
screen_shot.buf = g_try_malloc (screen_info.mv_csz * screen_info.mv_rsz * 2);
|
||||
if (screen_shot.buf != NULL)
|
||||
console_flag = 1;
|
||||
mc_global.tty.console_flag = '\001';
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -299,7 +297,7 @@ console_restore (void)
|
||||
{
|
||||
int i, last;
|
||||
|
||||
if (!console_flag)
|
||||
if (!mc_global.tty.console_flag)
|
||||
return;
|
||||
|
||||
cursor_to (0, 0);
|
||||
@ -323,12 +321,12 @@ console_restore (void)
|
||||
static void
|
||||
console_shutdown (void)
|
||||
{
|
||||
if (!console_flag)
|
||||
if (!mc_global.tty.console_flag)
|
||||
return;
|
||||
|
||||
g_free (screen_shot.buf);
|
||||
|
||||
console_flag = 0;
|
||||
mc_global.tty.console_flag = '\0';
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -340,7 +338,7 @@ console_save (void)
|
||||
scrmap_t map;
|
||||
scrmap_t revmap;
|
||||
|
||||
if (!console_flag)
|
||||
if (!mc_global.tty.console_flag)
|
||||
return;
|
||||
|
||||
/* screen_info.size is already set in console_init() */
|
||||
@ -391,7 +389,7 @@ show_console_contents_freebsd (int starty, unsigned char begin_line, unsigned ch
|
||||
int col, line;
|
||||
char c;
|
||||
|
||||
if (!console_flag)
|
||||
if (!mc_global.tty.console_flag)
|
||||
return;
|
||||
|
||||
for (line = begin_line; line <= end_line; line++)
|
||||
@ -450,7 +448,7 @@ show_console_contents (int starty, unsigned char begin_line, unsigned char end_l
|
||||
#elif defined (__FreeBSD__)
|
||||
show_console_contents_freebsd (starty, begin_line, end_line);
|
||||
#else
|
||||
console_flag = 0;
|
||||
mc_global.tty.console_flag = '\0';
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,6 @@ enum
|
||||
|
||||
#ifndef LINUX_CONS_SAVER_C
|
||||
/* Used only in mc, not in cons.saver */
|
||||
extern signed char console_flag;
|
||||
extern int cons_saver_pid;
|
||||
#endif /* !LINUX_CONS_SAVER_C */
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include "lib/tty/color.h"
|
||||
#include "lib/tty/key.h"
|
||||
#include "lib/skin.h" /* EDITOR_NORMAL_COLOR */
|
||||
#include "lib/vfs/vfs.h" /* mc_opendir, mc_readdir, mc_closedir, */
|
||||
#include "lib/vfs/vfs.h" /* mc_opendir, mc_readdir, mc_closedir, */
|
||||
#include "lib/util.h"
|
||||
#include "lib/widget.h"
|
||||
#include "lib/charsets.h"
|
||||
@ -50,7 +50,6 @@
|
||||
#include "src/keybind-defaults.h"
|
||||
#include "src/help.h"
|
||||
#include "src/history.h"
|
||||
#include "src/main.h" /* mc_run_mode, midnight_shutdown */
|
||||
#include "src/selcodepage.h"
|
||||
|
||||
#include "ydiff.h"
|
||||
@ -119,7 +118,7 @@ dview_set_codeset (WDiff * dview)
|
||||
const char *encoding_id = NULL;
|
||||
|
||||
dview->utf8 = TRUE;
|
||||
encoding_id = get_codepage_id (source_codepage >= 0 ? source_codepage : display_codepage);
|
||||
encoding_id = get_codepage_id (mc_global.source_codepage >= 0 ? mc_global.source_codepage : mc_global.display_codepage);
|
||||
if (encoding_id != NULL)
|
||||
{
|
||||
GIConv conv;
|
||||
@ -2582,7 +2581,7 @@ dview_display_file (const WDiff * dview, int ord, int r, int c, int height, int
|
||||
{
|
||||
tty_setcolor (att[cnt] ? DFF_CHH_COLOR : DFF_CHG_COLOR);
|
||||
#ifdef HAVE_CHARSET
|
||||
if (utf8_display)
|
||||
if (mc_global.utf8_display)
|
||||
{
|
||||
if (!dview->utf8)
|
||||
{
|
||||
@ -2660,7 +2659,7 @@ dview_display_file (const WDiff * dview, int ord, int r, int c, int height, int
|
||||
if (ch_res)
|
||||
{
|
||||
#ifdef HAVE_CHARSET
|
||||
if (utf8_display)
|
||||
if (mc_global.utf8_display)
|
||||
{
|
||||
if (!dview->utf8)
|
||||
{
|
||||
@ -2943,13 +2942,13 @@ dview_ok_to_exit (WDiff * dview)
|
||||
if (!dview->merged)
|
||||
return res;
|
||||
|
||||
act = query_dialog (_("Quit"), !midnight_shutdown ?
|
||||
act = query_dialog (_("Quit"), !mc_global.widget.midnight_shutdown ?
|
||||
_("File was modified. Save with exit?") :
|
||||
_("Midnight Commander is being shut down.\nSave modified file?"),
|
||||
D_NORMAL, 2, _("&Yes"), _("&No"));
|
||||
|
||||
/* Esc is No */
|
||||
if (midnight_shutdown || (act == -1))
|
||||
if (mc_global.widget.midnight_shutdown || (act == -1))
|
||||
act = 1;
|
||||
|
||||
switch (act)
|
||||
@ -3235,7 +3234,7 @@ dview_dialog_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, v
|
||||
|
||||
case DLG_VALIDATE:
|
||||
dview = (WDiff *) find_widget_type (h, dview_callback);
|
||||
h->state = DLG_ACTIVE; /* don't stop the dialog before final decision */
|
||||
h->state = DLG_ACTIVE; /* don't stop the dialog before final decision */
|
||||
if (dview_ok_to_exit (dview))
|
||||
h->state = DLG_CLOSED;
|
||||
return MSG_HANDLED;
|
||||
@ -3357,7 +3356,7 @@ dview_diff_cmd (void)
|
||||
int is_dir0 = 0;
|
||||
int is_dir1 = 0;
|
||||
|
||||
if (mc_run_mode == MC_RUN_FULL)
|
||||
if (mc_global.mc_run_mode == MC_RUN_FULL)
|
||||
{
|
||||
const WPanel *panel0 = current_panel;
|
||||
const WPanel *panel1 = other_panel;
|
||||
|
@ -60,7 +60,6 @@
|
||||
#include "src/filemanager/cmd.h" /* view_other_cmd() */
|
||||
#include "src/filemanager/usermenu.h" /* user_menu_cmd() */
|
||||
|
||||
#include "src/main.h" /* source_codepage */
|
||||
#include "src/setup.h" /* option_tab_spacing */
|
||||
#include "src/learn.h" /* learn_keys */
|
||||
#include "src/keybind-defaults.h"
|
||||
@ -2322,7 +2321,7 @@ edit_set_codeset (WEdit * edit)
|
||||
#ifdef HAVE_CHARSET
|
||||
const char *cp_id;
|
||||
|
||||
cp_id = get_codepage_id (source_codepage >= 0 ? source_codepage : display_codepage);
|
||||
cp_id = get_codepage_id (mc_global.source_codepage >= 0 ? mc_global.source_codepage : mc_global.display_codepage);
|
||||
|
||||
if (cp_id != NULL)
|
||||
{
|
||||
@ -2937,7 +2936,7 @@ edit_move_forward3 (WEdit * edit, long current, int cols, long upto)
|
||||
int cw = 1;
|
||||
|
||||
utf_ch = edit_get_utf (edit, p, &cw);
|
||||
if (utf8_display)
|
||||
if (mc_global.utf8_display)
|
||||
{
|
||||
if (cw > 1)
|
||||
col -= cw - 1;
|
||||
@ -2960,7 +2959,7 @@ edit_move_forward3 (WEdit * edit, long current, int cols, long upto)
|
||||
else
|
||||
return p;
|
||||
}
|
||||
else if ((c < 32 || c == 127) && (orig_c == c || (!utf8_display && !edit->utf8)))
|
||||
else if ((c < 32 || c == 127) && (orig_c == c || (!mc_global.utf8_display && !edit->utf8)))
|
||||
/* '\r' is shown as ^M, so we must advance 2 characters */
|
||||
/* Caret notation for control characters */
|
||||
col += 2;
|
||||
@ -3499,14 +3498,14 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion)
|
||||
if (edit->overwrite)
|
||||
{
|
||||
/* remove char only one time, after input first byte, multibyte chars */
|
||||
if ((!utf8_display || edit->charpoint == 0)
|
||||
if ((!mc_global.utf8_display || edit->charpoint == 0)
|
||||
&& edit_get_byte (edit, edit->curs1) != '\n')
|
||||
edit_delete (edit, 0);
|
||||
}
|
||||
if (option_cursor_beyond_eol && edit->over_col > 0)
|
||||
edit_insert_over (edit);
|
||||
#ifdef HAVE_CHARSET
|
||||
if (char_for_insertion > 255 && utf8_display == 0)
|
||||
if (char_for_insertion > 255 && mc_global.utf8_display == 0)
|
||||
{
|
||||
unsigned char str[6 + 1];
|
||||
size_t i = 0;
|
||||
|
@ -60,7 +60,6 @@
|
||||
#include "src/filemanager/layout.h" /* clr_scr() */
|
||||
|
||||
#include "src/history.h"
|
||||
#include "src/main.h" /* mc_sysconfig_dir, midnight_shutdown */
|
||||
#include "src/setup.h" /* option_tab_spacing */
|
||||
#include "src/help.h" /* interactive_display() */
|
||||
#include "src/selcodepage.h"
|
||||
@ -515,11 +514,11 @@ edit_load_syntax_file (WEdit * edit)
|
||||
_("&User"), _("&System Wide"));
|
||||
}
|
||||
|
||||
extdir = g_build_filename (mc_sysconfig_dir, "syntax", "Syntax", (char *) NULL);
|
||||
extdir = g_build_filename (mc_global.sysconfig_dir, "syntax", "Syntax", (char *) NULL);
|
||||
if (!exist_file (extdir))
|
||||
{
|
||||
g_free (extdir);
|
||||
extdir = g_build_filename (mc_share_data_dir, "syntax", "Syntax", (char *) NULL);
|
||||
extdir = g_build_filename (mc_global.share_data_dir, "syntax", "Syntax", (char *) NULL);
|
||||
}
|
||||
|
||||
if (dir == 0)
|
||||
@ -550,12 +549,12 @@ edit_load_menu_file (WEdit * edit)
|
||||
_("Which menu file do you want to edit?"), D_NORMAL,
|
||||
geteuid () != 0 ? 2 : 3, _("&Local"), _("&User"), _("&System Wide"));
|
||||
|
||||
menufile = concat_dir_and_file (mc_sysconfig_dir, EDIT_GLOBAL_MENU);
|
||||
menufile = concat_dir_and_file (mc_global.sysconfig_dir, EDIT_GLOBAL_MENU);
|
||||
|
||||
if (!exist_file (menufile))
|
||||
{
|
||||
g_free (menufile);
|
||||
menufile = concat_dir_and_file (mc_share_data_dir, EDIT_GLOBAL_MENU);
|
||||
menufile = concat_dir_and_file (mc_global.share_data_dir, EDIT_GLOBAL_MENU);
|
||||
}
|
||||
|
||||
switch (dir)
|
||||
@ -572,11 +571,11 @@ edit_load_menu_file (WEdit * edit)
|
||||
break;
|
||||
|
||||
case 2:
|
||||
buffer = concat_dir_and_file (mc_sysconfig_dir, EDIT_GLOBAL_MENU);
|
||||
buffer = concat_dir_and_file (mc_global.sysconfig_dir, EDIT_GLOBAL_MENU);
|
||||
if (!exist_file (buffer))
|
||||
{
|
||||
g_free (buffer);
|
||||
buffer = concat_dir_and_file (mc_share_data_dir, EDIT_GLOBAL_MENU);
|
||||
buffer = concat_dir_and_file (mc_global.share_data_dir, EDIT_GLOBAL_MENU);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -2486,7 +2485,7 @@ edit_ok_to_exit (WEdit * edit)
|
||||
if (!edit->modified)
|
||||
return TRUE;
|
||||
|
||||
if (!midnight_shutdown)
|
||||
if (!mc_global.widget.midnight_shutdown)
|
||||
{
|
||||
if (!edit_check_newline (edit))
|
||||
return FALSE;
|
||||
@ -2512,8 +2511,8 @@ edit_ok_to_exit (WEdit * edit)
|
||||
case 0: /* Yes */
|
||||
edit_push_markers (edit);
|
||||
edit_set_markers (edit, 0, 0, 0, 0);
|
||||
if (!edit_save_cmd (edit) || midnight_shutdown)
|
||||
return (gboolean) midnight_shutdown;
|
||||
if (!edit_save_cmd (edit) || mc_global.widget.midnight_shutdown)
|
||||
return mc_global.widget.midnight_shutdown;
|
||||
break;
|
||||
case 1: /* No */
|
||||
break;
|
||||
|
@ -47,7 +47,6 @@
|
||||
#include "lib/widget.h" /* buttonbar_redraw() */
|
||||
#include "lib/charsets.h"
|
||||
|
||||
#include "src/main.h" /* source_codepage */
|
||||
#include "src/setup.h" /* edit_tab_spacing */
|
||||
|
||||
#include "edit-impl.h"
|
||||
@ -151,7 +150,7 @@ status_string (WEdit * edit, char *s, int w)
|
||||
edit->curs_line + 1,
|
||||
edit->total_lines + 1, edit->curs1, edit->last_byte, byte_str,
|
||||
#ifdef HAVE_CHARSET
|
||||
source_codepage >= 0 ? get_codepage_id (source_codepage) : ""
|
||||
mc_global.source_codepage >= 0 ? get_codepage_id (mc_global.source_codepage) : ""
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
@ -169,7 +168,7 @@ status_string (WEdit * edit, char *s, int w)
|
||||
edit->curs_line + 1,
|
||||
edit->total_lines + 1, edit->curs1, edit->last_byte, byte_str,
|
||||
#ifdef HAVE_CHARSET
|
||||
source_codepage >= 0 ? get_codepage_id (source_codepage) : ""
|
||||
mc_global.source_codepage >= 0 ? get_codepage_id (mc_global.source_codepage) : ""
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
@ -502,7 +501,7 @@ edit_draw_this_line (WEdit * edit, long b, long row, long start_col, long end_co
|
||||
/* fallthrough */
|
||||
default:
|
||||
#ifdef HAVE_CHARSET
|
||||
if (utf8_display)
|
||||
if (mc_global.utf8_display)
|
||||
{
|
||||
if (!edit->utf8)
|
||||
{
|
||||
@ -540,8 +539,8 @@ edit_draw_this_line (WEdit * edit, long b, long row, long start_col, long end_co
|
||||
}
|
||||
if (!edit->utf8)
|
||||
{
|
||||
if ((utf8_display && g_unichar_isprint (c)) ||
|
||||
(!utf8_display && is_printable (c)))
|
||||
if ((mc_global.utf8_display && g_unichar_isprint (c)) ||
|
||||
(!mc_global.utf8_display && is_printable (c)))
|
||||
{
|
||||
p->ch = c;
|
||||
p++;
|
||||
|
@ -51,7 +51,6 @@
|
||||
#include "editcmd_dialogs.h"
|
||||
|
||||
#include "src/keybind-defaults.h" /* keybind_lookup_keymap_command() */
|
||||
#include "src/main.h" /* display_codepage */
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
@ -95,7 +94,7 @@ edit_translate_key (WEdit * edit, long x_key, int *cmd, int *ch)
|
||||
}
|
||||
|
||||
/* input from 8-bit locale */
|
||||
if (!utf8_display)
|
||||
if (!mc_global.utf8_display)
|
||||
{
|
||||
/* source in 8-bit codeset */
|
||||
if (!edit->utf8)
|
||||
|
@ -57,8 +57,6 @@
|
||||
#include "lib/util.h"
|
||||
#include "lib/widget.h" /* message() */
|
||||
|
||||
#include "src/main.h" /* mc_sysconfig_dir */
|
||||
|
||||
#include "edit-impl.h"
|
||||
#include "edit-widget.h"
|
||||
|
||||
@ -859,13 +857,13 @@ open_include_file (const char *filename)
|
||||
return f;
|
||||
|
||||
g_free (error_file_name);
|
||||
error_file_name = g_build_filename (mc_sysconfig_dir, "syntax", filename, (char *) NULL);
|
||||
error_file_name = g_build_filename (mc_global.sysconfig_dir, "syntax", filename, (char *) NULL);
|
||||
f = fopen (error_file_name, "r");
|
||||
if (f != NULL)
|
||||
return f;
|
||||
|
||||
g_free (error_file_name);
|
||||
error_file_name = g_build_filename (mc_share_data_dir, "syntax", filename, (char *) NULL);
|
||||
error_file_name = g_build_filename (mc_global.share_data_dir, "syntax", filename, (char *) NULL);
|
||||
|
||||
return fopen (error_file_name, "r");
|
||||
}
|
||||
@ -1267,7 +1265,7 @@ edit_read_syntax_file (WEdit * edit, char ***pnames, const char *syntax_file,
|
||||
f = fopen (syntax_file, "r");
|
||||
if (f == NULL)
|
||||
{
|
||||
lib_file = g_build_filename (mc_share_data_dir, "syntax", "Syntax", (char *) NULL);
|
||||
lib_file = g_build_filename (mc_global.share_data_dir, "syntax", "Syntax", (char *) NULL);
|
||||
f = fopen (lib_file, "r");
|
||||
g_free (lib_file);
|
||||
if (f == NULL)
|
||||
|
@ -81,7 +81,7 @@ edition_pre_exec (void)
|
||||
clr_scr ();
|
||||
else
|
||||
{
|
||||
if (!(console_flag || xterm_flag))
|
||||
if (!(mc_global.tty.console_flag || xterm_flag))
|
||||
printf ("\n\n");
|
||||
}
|
||||
|
||||
@ -132,19 +132,19 @@ do_execute (const char *lc_shell, const char *command, int flags)
|
||||
if (!vfs_current_is_local ())
|
||||
old_vfs_dir = g_strdup (vfs_get_current_dir ());
|
||||
|
||||
if (mc_run_mode == MC_RUN_FULL)
|
||||
if (mc_global.mc_run_mode == MC_RUN_FULL)
|
||||
save_cwds_stat ();
|
||||
pre_exec ();
|
||||
if (console_flag)
|
||||
if (mc_global.tty.console_flag)
|
||||
handle_console (CONSOLE_RESTORE);
|
||||
|
||||
if (!use_subshell && command && !(flags & EXECUTE_INTERNAL))
|
||||
if (!mc_global.tty.use_subshell && command && !(flags & EXECUTE_INTERNAL))
|
||||
{
|
||||
printf ("%s%s\n", mc_prompt, command);
|
||||
fflush (stdout);
|
||||
}
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
if (use_subshell && !(flags & EXECUTE_INTERNAL))
|
||||
if (mc_global.tty.use_subshell && !(flags & EXECUTE_INTERNAL))
|
||||
{
|
||||
do_update_prompt ();
|
||||
|
||||
@ -159,7 +159,7 @@ do_execute (const char *lc_shell, const char *command, int flags)
|
||||
{
|
||||
if ((pause_after_run == pause_always
|
||||
|| (pause_after_run == pause_on_dumb_terminals && !xterm_flag
|
||||
&& !console_flag)) && quit == 0
|
||||
&& !mc_global.tty.console_flag)) && quit == 0
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
&& subshell_state != RUNNING_COMMAND
|
||||
#endif /* HAVE_SUBSHELL_SUPPORT */
|
||||
@ -172,9 +172,9 @@ do_execute (const char *lc_shell, const char *command, int flags)
|
||||
printf ("\r\n");
|
||||
fflush (stdout);
|
||||
}
|
||||
if (console_flag)
|
||||
if (mc_global.tty.console_flag)
|
||||
{
|
||||
if (output_lines && keybar_visible)
|
||||
if (output_lines && mc_global.keybar_visible)
|
||||
{
|
||||
putchar ('\n');
|
||||
fflush (stdout);
|
||||
@ -182,7 +182,7 @@ do_execute (const char *lc_shell, const char *command, int flags)
|
||||
}
|
||||
}
|
||||
|
||||
if (console_flag)
|
||||
if (mc_global.tty.console_flag)
|
||||
handle_console (CONSOLE_SAVE);
|
||||
edition_post_exec ();
|
||||
|
||||
@ -198,7 +198,7 @@ do_execute (const char *lc_shell, const char *command, int flags)
|
||||
g_free (old_vfs_dir);
|
||||
}
|
||||
|
||||
if (mc_run_mode == MC_RUN_FULL)
|
||||
if (mc_global.mc_run_mode == MC_RUN_FULL)
|
||||
{
|
||||
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
|
||||
update_xterm_title_path ();
|
||||
@ -215,7 +215,7 @@ do_suspend_cmd (void)
|
||||
{
|
||||
pre_exec ();
|
||||
|
||||
if (console_flag && !use_subshell)
|
||||
if (mc_global.tty.console_flag && !mc_global.tty.use_subshell)
|
||||
handle_console (CONSOLE_RESTORE);
|
||||
|
||||
#ifdef SIGTSTP
|
||||
@ -234,7 +234,7 @@ do_suspend_cmd (void)
|
||||
}
|
||||
#endif /* SIGTSTP */
|
||||
|
||||
if (console_flag && !use_subshell)
|
||||
if (mc_global.tty.console_flag && !mc_global.tty.use_subshell)
|
||||
handle_console (CONSOLE_SAVE);
|
||||
|
||||
edition_post_exec ();
|
||||
@ -277,7 +277,7 @@ shell_execute (const char *command, int flags)
|
||||
}
|
||||
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
if (use_subshell)
|
||||
if (mc_global.tty.use_subshell)
|
||||
if (subshell_state == INACTIVE)
|
||||
do_execute (shell, cmd ? cmd : command, flags | EXECUTE_AS_SHELL);
|
||||
else
|
||||
@ -324,11 +324,11 @@ toggle_panels (void)
|
||||
tty_reset_screen ();
|
||||
do_exit_ca_mode ();
|
||||
tty_raw_mode ();
|
||||
if (console_flag)
|
||||
if (mc_global.tty.console_flag)
|
||||
handle_console (CONSOLE_RESTORE);
|
||||
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
if (use_subshell)
|
||||
if (mc_global.tty.use_subshell)
|
||||
{
|
||||
new_dir_p = vfs_current_is_local ()? &new_dir : NULL;
|
||||
invoke_subshell (NULL, VISIBLY, new_dir_p);
|
||||
@ -347,7 +347,7 @@ toggle_panels (void)
|
||||
get_key_code (0);
|
||||
}
|
||||
|
||||
if (console_flag)
|
||||
if (mc_global.tty.console_flag)
|
||||
handle_console (CONSOLE_SAVE);
|
||||
|
||||
do_enter_ca_mode ();
|
||||
@ -366,7 +366,7 @@ toggle_panels (void)
|
||||
quit = 0;
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
/* restart subshell */
|
||||
if (use_subshell)
|
||||
if (mc_global.tty.use_subshell)
|
||||
init_subshell ();
|
||||
#endif /* HAVE_SUBSHELL_SUPPORT */
|
||||
}
|
||||
@ -377,19 +377,19 @@ toggle_panels (void)
|
||||
application_keypad_mode ();
|
||||
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
if (use_subshell)
|
||||
if (mc_global.tty.use_subshell)
|
||||
{
|
||||
load_prompt (0, NULL);
|
||||
if (new_dir)
|
||||
do_possible_cd (new_dir);
|
||||
if (console_flag && output_lines)
|
||||
if (mc_global.tty.console_flag && output_lines)
|
||||
show_console_contents (output_start_y,
|
||||
LINES - keybar_visible - output_lines -
|
||||
1, LINES - keybar_visible - 1);
|
||||
LINES - mc_global.keybar_visible - output_lines -
|
||||
1, LINES - mc_global.keybar_visible - 1);
|
||||
}
|
||||
#endif /* HAVE_SUBSHELL_SUPPORT */
|
||||
|
||||
if (mc_run_mode == MC_RUN_FULL)
|
||||
if (mc_global.mc_run_mode == MC_RUN_FULL)
|
||||
{
|
||||
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
|
||||
update_xterm_title_path ();
|
||||
@ -402,10 +402,10 @@ toggle_panels (void)
|
||||
void
|
||||
suspend_cmd (void)
|
||||
{
|
||||
if (mc_run_mode == MC_RUN_FULL)
|
||||
if (mc_global.mc_run_mode == MC_RUN_FULL)
|
||||
save_cwds_stat ();
|
||||
do_suspend_cmd ();
|
||||
if (mc_run_mode == MC_RUN_FULL)
|
||||
if (mc_global.mc_run_mode == MC_RUN_FULL)
|
||||
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
|
||||
do_refresh ();
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ sel_charset_button (WButton * button, int action)
|
||||
_("Other 8 bit") :
|
||||
((codepage_desc *) g_ptr_array_index (codepages, new_display_codepage))->name;
|
||||
if (cpname != NULL)
|
||||
utf8_display = str_isutf8 (cpname);
|
||||
mc_global.utf8_display = str_isutf8 (cpname);
|
||||
/* avoid strange bug with label repainting */
|
||||
g_snprintf (buf, sizeof (buf), "%-27s", cpname);
|
||||
label_set_text (cplabel, buf);
|
||||
@ -576,7 +576,7 @@ display_box (WPanel * panel, char **userp, char **minip, int *use_msformat, int
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
const panel_field_t *
|
||||
sort_box (panel_sort_info_t *info)
|
||||
sort_box (panel_sort_info_t * info)
|
||||
{
|
||||
int dlg_width = 40, dlg_height = 7;
|
||||
|
||||
@ -603,9 +603,11 @@ sort_box (panel_sort_info_t *info)
|
||||
/* 2 */
|
||||
QUICK_CHECKBOX (0, dlg_width, 5, dlg_height, N_("&Reverse"), &info->reverse),
|
||||
/* 3 */
|
||||
QUICK_CHECKBOX (0, dlg_width, 4, dlg_height, N_("Case sensi&tive"), &info->case_sensitive),
|
||||
QUICK_CHECKBOX (0, dlg_width, 4, dlg_height, N_("Case sensi&tive"),
|
||||
&info->case_sensitive),
|
||||
/* 4 */
|
||||
QUICK_CHECKBOX (0, dlg_width, 3, dlg_height, N_("Executable &first"), &info->exec_first),
|
||||
QUICK_CHECKBOX (0, dlg_width, 3, dlg_height, N_("Executable &first"),
|
||||
&info->exec_first),
|
||||
/* 5 */
|
||||
QUICK_RADIO (4, dlg_width, 3, dlg_height, 0, NULL, &sort_idx),
|
||||
QUICK_END
|
||||
@ -687,7 +689,7 @@ confirm_box (void)
|
||||
/* 1 */ QUICK_BUTTON (12, 46, 10, 13, N_("&OK"), B_ENTER, NULL),
|
||||
/* TRANSLATORS: no need to translate 'Confirmation', it's just a context prefix */
|
||||
/* 2 */ QUICK_CHECKBOX (3, 46, 8, 13, N_("Confirmation|&History cleanup"),
|
||||
&confirm_history_cleanup),
|
||||
&mc_global.widget.confirm_history_cleanup),
|
||||
/* 3 */ QUICK_CHECKBOX (3, 46, 7, 13, N_("Confirmation|Di&rectory hotlist delete"),
|
||||
&confirm_directory_hotlist_delete),
|
||||
/* 4 */ QUICK_CHECKBOX (3, 46, 6, 13, N_("Confirmation|E&xit"), &confirm_exit),
|
||||
@ -823,9 +825,9 @@ display_bits_box (void) /* AB:FIXME: test dialog */
|
||||
display_widgets[0].relative_x = display_bits.xlen * 2 / 3 - cancel_len / 2;
|
||||
display_widgets[1].relative_x = display_bits.xlen / 3 - ok_len / 2;
|
||||
|
||||
if (full_eight_bits)
|
||||
if (mc_global.full_eight_bits)
|
||||
current_mode = 0;
|
||||
else if (eight_bit_clean)
|
||||
else if (mc_global.eight_bit_clean)
|
||||
current_mode = 1;
|
||||
else
|
||||
current_mode = 2;
|
||||
@ -834,12 +836,12 @@ display_bits_box (void) /* AB:FIXME: test dialog */
|
||||
|
||||
if (quick_dialog (&display_bits) != B_CANCEL)
|
||||
{
|
||||
eight_bit_clean = current_mode < 3;
|
||||
full_eight_bits = current_mode < 2;
|
||||
mc_global.eight_bit_clean = current_mode < 3;
|
||||
mc_global.full_eight_bits = current_mode < 2;
|
||||
#ifndef HAVE_SLANG
|
||||
meta (stdscr, eight_bit_clean);
|
||||
meta (stdscr, mc_global.eight_bit_clean);
|
||||
#else
|
||||
SLsmg_Display_Eight_Bit = full_eight_bits ? 128 : 160;
|
||||
SLsmg_Display_Eight_Bit = mc_global.full_eight_bits ? 128 : 160;
|
||||
#endif
|
||||
use_8th_bit_as_meta = !new_meta;
|
||||
}
|
||||
@ -852,7 +854,7 @@ void
|
||||
display_bits_box (void)
|
||||
{
|
||||
Dlg_head *dbits_dlg;
|
||||
new_display_codepage = display_codepage;
|
||||
new_display_codepage = mc_global.display_codepage;
|
||||
|
||||
application_keypad_mode ();
|
||||
dbits_dlg = init_disp_bits_box ();
|
||||
@ -863,17 +865,17 @@ display_bits_box (void)
|
||||
{
|
||||
char *errmsg;
|
||||
|
||||
display_codepage = new_display_codepage;
|
||||
errmsg = init_translation_table (source_codepage, display_codepage);
|
||||
mc_global.display_codepage = new_display_codepage;
|
||||
errmsg = init_translation_table (mc_global.source_codepage, mc_global.display_codepage);
|
||||
if (errmsg != NULL)
|
||||
{
|
||||
message (D_ERROR, MSG_ERROR, "%s", errmsg);
|
||||
g_free (errmsg);
|
||||
}
|
||||
#ifdef HAVE_SLANG
|
||||
tty_display_8bit (display_codepage != 0 && display_codepage != 1);
|
||||
tty_display_8bit (mc_global.display_codepage != 0 && mc_global.display_codepage != 1);
|
||||
#else
|
||||
tty_display_8bit (display_codepage != 0);
|
||||
tty_display_8bit (mc_global.display_codepage != 0);
|
||||
#endif
|
||||
use_8th_bit_as_meta = !(inpcheck->state & C_BOOL);
|
||||
}
|
||||
|
@ -60,8 +60,6 @@
|
||||
#include "lib/widget.h"
|
||||
#include "lib/keybind.h" /* CK_Down, CK_History */
|
||||
|
||||
#include "src/subshell.h" /* use_subshell */
|
||||
#include "src/consaver/cons.saver.h" /* console_flag */
|
||||
#include "src/viewer/mcviewer.h"
|
||||
#include "src/help.h" /* interactive_display() */
|
||||
#include "src/setup.h"
|
||||
@ -767,7 +765,7 @@ do_edit_at_line (const char *what, gboolean internal, int start_line)
|
||||
execute_with_vfs_arg (editor, what);
|
||||
}
|
||||
|
||||
if (mc_run_mode == MC_RUN_FULL)
|
||||
if (mc_global.mc_run_mode == MC_RUN_FULL)
|
||||
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
|
||||
|
||||
#ifdef USE_INTERNAL_EDIT
|
||||
@ -804,7 +802,7 @@ void
|
||||
edit_cmd_new (void)
|
||||
{
|
||||
#if HAVE_CHARSET
|
||||
source_codepage = default_source_codepage;
|
||||
mc_global.source_codepage = default_source_codepage;
|
||||
#endif
|
||||
do_edit (NULL);
|
||||
}
|
||||
@ -1022,7 +1020,7 @@ ext_cmd (void)
|
||||
_("Which extension file you want to edit?"), D_NORMAL, 2,
|
||||
_("&User"), _("&System Wide"));
|
||||
}
|
||||
extdir = concat_dir_and_file (mc_sysconfig_dir, MC_LIB_EXT);
|
||||
extdir = concat_dir_and_file (mc_global.sysconfig_dir, MC_LIB_EXT);
|
||||
|
||||
if (dir == 0)
|
||||
{
|
||||
@ -1036,7 +1034,7 @@ ext_cmd (void)
|
||||
if (!exist_file (extdir))
|
||||
{
|
||||
g_free (extdir);
|
||||
extdir = concat_dir_and_file (mc_share_data_dir, MC_LIB_EXT);
|
||||
extdir = concat_dir_and_file (mc_global.share_data_dir, MC_LIB_EXT);
|
||||
}
|
||||
do_edit (extdir);
|
||||
}
|
||||
@ -1058,12 +1056,12 @@ edit_mc_menu_cmd (void)
|
||||
_("Which menu file do you want to edit?"),
|
||||
D_NORMAL, geteuid ()? 2 : 3, _("&Local"), _("&User"), _("&System Wide"));
|
||||
|
||||
menufile = concat_dir_and_file (mc_sysconfig_dir, MC_GLOBAL_MENU);
|
||||
menufile = concat_dir_and_file (mc_global.sysconfig_dir, MC_GLOBAL_MENU);
|
||||
|
||||
if (!exist_file (menufile))
|
||||
{
|
||||
g_free (menufile);
|
||||
menufile = concat_dir_and_file (mc_share_data_dir, MC_GLOBAL_MENU);
|
||||
menufile = concat_dir_and_file (mc_global.share_data_dir, MC_GLOBAL_MENU);
|
||||
}
|
||||
|
||||
switch (dir)
|
||||
@ -1080,11 +1078,11 @@ edit_mc_menu_cmd (void)
|
||||
break;
|
||||
|
||||
case 2:
|
||||
buffer = concat_dir_and_file (mc_sysconfig_dir, MC_GLOBAL_MENU);
|
||||
buffer = concat_dir_and_file (mc_global.sysconfig_dir, MC_GLOBAL_MENU);
|
||||
if (!exist_file (buffer))
|
||||
{
|
||||
g_free (buffer);
|
||||
buffer = concat_dir_and_file (mc_share_data_dir, MC_GLOBAL_MENU);
|
||||
buffer = concat_dir_and_file (mc_global.share_data_dir, MC_GLOBAL_MENU);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1116,7 +1114,7 @@ edit_fhl_cmd (void)
|
||||
_("Which highlighting file you want to edit?"), D_NORMAL, 2,
|
||||
_("&User"), _("&System Wide"));
|
||||
}
|
||||
fhlfile = concat_dir_and_file (mc_sysconfig_dir, MC_FHL_INI_FILE);
|
||||
fhlfile = concat_dir_and_file (mc_global.sysconfig_dir, MC_FHL_INI_FILE);
|
||||
|
||||
if (dir == 0)
|
||||
{
|
||||
@ -1130,7 +1128,7 @@ edit_fhl_cmd (void)
|
||||
if (!exist_file (fhlfile))
|
||||
{
|
||||
g_free (fhlfile);
|
||||
fhlfile = concat_dir_and_file (mc_sysconfig_dir, MC_FHL_INI_FILE);
|
||||
fhlfile = concat_dir_and_file (mc_global.sysconfig_dir, MC_FHL_INI_FILE);
|
||||
}
|
||||
do_edit (fhlfile);
|
||||
}
|
||||
@ -1217,7 +1215,7 @@ diff_view_cmd (void)
|
||||
{
|
||||
dview_diff_cmd ();
|
||||
|
||||
if (mc_run_mode == MC_RUN_FULL)
|
||||
if (mc_global.mc_run_mode == MC_RUN_FULL)
|
||||
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
|
||||
|
||||
dialog_switch_process_pending ();
|
||||
@ -1241,7 +1239,8 @@ view_other_cmd (void)
|
||||
{
|
||||
static int message_flag = TRUE;
|
||||
|
||||
if (!xterm_flag && !console_flag && !use_subshell && !output_starts_shell)
|
||||
if (!xterm_flag && !mc_global.tty.console_flag && !mc_global.tty.use_subshell
|
||||
&& !output_starts_shell)
|
||||
{
|
||||
if (message_flag)
|
||||
message (D_ERROR, MSG_ERROR,
|
||||
@ -1358,7 +1357,7 @@ get_random_hint (int force)
|
||||
return g_strdup ("");
|
||||
last_sec = tv.tv_sec;
|
||||
|
||||
data = load_mc_home_file (mc_share_data_dir, MC_HINT, NULL);
|
||||
data = load_mc_home_file (mc_global.share_data_dir, MC_HINT, NULL);
|
||||
if (data == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -215,7 +215,7 @@ enter (WInput * lc_cmdline)
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
/* Check this early before we clean command line
|
||||
* (will be checked again by shell_execute) */
|
||||
if (use_subshell && subshell_state != INACTIVE)
|
||||
if (mc_global.tty.use_subshell && subshell_state != INACTIVE)
|
||||
{
|
||||
message (D_ERROR, MSG_ERROR, _("The shell is already running a command"));
|
||||
return MSG_NOT_HANDLED;
|
||||
@ -254,11 +254,11 @@ enter (WInput * lc_cmdline)
|
||||
|
||||
quit = 0;
|
||||
/* restart subshell */
|
||||
if (use_subshell)
|
||||
if (mc_global.tty.use_subshell)
|
||||
init_subshell ();
|
||||
}
|
||||
|
||||
if (use_subshell)
|
||||
if (mc_global.tty.use_subshell)
|
||||
load_prompt (0, NULL);
|
||||
#endif
|
||||
}
|
||||
|
@ -46,8 +46,6 @@
|
||||
#include "lib/util.h"
|
||||
#include "lib/widget.h"
|
||||
|
||||
#include "src/setup.h" /* show_all_if_ambiguous */
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
/* Linux declares environ in <unistd.h>, so don't repeat it here. */
|
||||
@ -1343,7 +1341,7 @@ complete (WInput * in)
|
||||
{
|
||||
engine_flags = DO_INSERTION;
|
||||
|
||||
if (show_all_if_ambiguous)
|
||||
if (mc_global.widget.show_all_if_ambiguous)
|
||||
engine_flags |= DO_QUERY;
|
||||
}
|
||||
|
||||
|
@ -352,13 +352,13 @@ exec_extension (const char *filename, const char *lc_data, int *move_dir, int st
|
||||
else
|
||||
{
|
||||
shell_execute (cmd, EXECUTE_INTERNAL);
|
||||
if (console_flag)
|
||||
if (mc_global.tty.console_flag)
|
||||
{
|
||||
handle_console (CONSOLE_SAVE);
|
||||
if (output_lines && keybar_visible)
|
||||
if (output_lines && mc_global.keybar_visible)
|
||||
show_console_contents (output_start_y,
|
||||
LINES - keybar_visible -
|
||||
output_lines - 1, LINES - keybar_visible - 1);
|
||||
LINES - mc_global.keybar_visible -
|
||||
output_lines - 1, LINES - mc_global.keybar_visible - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -635,11 +635,11 @@ regex_command (const char *filename, const char *action, int *move_dir)
|
||||
{
|
||||
g_free (extension_file);
|
||||
check_stock_mc_ext:
|
||||
extension_file = concat_dir_and_file (mc_sysconfig_dir, MC_LIB_EXT);
|
||||
extension_file = concat_dir_and_file (mc_global.sysconfig_dir, MC_LIB_EXT);
|
||||
if (!exist_file (extension_file))
|
||||
{
|
||||
g_free (extension_file);
|
||||
extension_file = concat_dir_and_file (mc_share_data_dir, MC_LIB_EXT);
|
||||
extension_file = concat_dir_and_file (mc_global.share_data_dir, MC_LIB_EXT);
|
||||
}
|
||||
mc_user_ext = 0;
|
||||
}
|
||||
@ -663,12 +663,12 @@ regex_command (const char *filename, const char *action, int *move_dir)
|
||||
else
|
||||
{
|
||||
char *title = g_strdup_printf (_(" %s%s file error"),
|
||||
mc_sysconfig_dir, MC_LIB_EXT);
|
||||
mc_global.sysconfig_dir, MC_LIB_EXT);
|
||||
message (D_ERROR, title, _("The format of the %smc.ext "
|
||||
"file has changed with version 3.0. It seems that "
|
||||
"the installation failed. Please fetch a fresh "
|
||||
"copy from the Midnight Commander package."),
|
||||
mc_sysconfig_dir);
|
||||
mc_global.sysconfig_dir);
|
||||
g_free (title);
|
||||
return 0;
|
||||
}
|
||||
@ -683,7 +683,7 @@ regex_command (const char *filename, const char *action, int *move_dir)
|
||||
_("The format of the %s%s%s file has "
|
||||
"changed with version 3.0. You may either want to copy "
|
||||
"it from %smc.ext or use that file as an example of how to write it."),
|
||||
mc_config_get_data_path (), PATH_SEP_STR, MC_FILEBIND_FILE, mc_sysconfig_dir);
|
||||
mc_config_get_data_path (), PATH_SEP_STR, MC_FILEBIND_FILE, mc_global.sysconfig_dir);
|
||||
g_free (title);
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@
|
||||
#include "lib/widget.h"
|
||||
|
||||
#include "src/setup.h"
|
||||
#include "src/background.h" /* we_are_background */
|
||||
#include "src/background.h"
|
||||
|
||||
#include "layout.h" /* rotate_dash() */
|
||||
|
||||
@ -469,13 +469,13 @@ warn_same_file (const char *fmt, const char *a, const char *b)
|
||||
union
|
||||
{
|
||||
void *p;
|
||||
FileProgressStatus (*f) (enum OperationMode, const char *fmt,
|
||||
const char *a, const char *b);
|
||||
FileProgressStatus (*f) (enum OperationMode, const char *fmt,
|
||||
const char *a, const char *b);
|
||||
} pntr;
|
||||
|
||||
pntr.f = real_warn_same_file;
|
||||
|
||||
if (we_are_background)
|
||||
if (mc_global.we_are_background)
|
||||
return parent_call (pntr.p, NULL, 3, strlen (fmt), fmt, strlen (a), a, strlen (b), b);
|
||||
#endif
|
||||
return real_warn_same_file (Foreground, fmt, a, b);
|
||||
@ -1160,7 +1160,7 @@ do_file_error (const char *str)
|
||||
} pntr;
|
||||
pntr.f = real_do_file_error;
|
||||
|
||||
if (we_are_background)
|
||||
if (mc_global.we_are_background)
|
||||
return parent_call (pntr.p, NULL, 1, strlen (str), str);
|
||||
else
|
||||
return real_do_file_error (Foreground, str);
|
||||
@ -1178,7 +1178,7 @@ query_recursive (FileOpContext * ctx, const char *s)
|
||||
} pntr;
|
||||
pntr.f = real_query_recursive;
|
||||
|
||||
if (we_are_background)
|
||||
if (mc_global.we_are_background)
|
||||
return parent_call (pntr.p, ctx, 1, strlen (s), s);
|
||||
else
|
||||
return real_query_recursive (ctx, Foreground, s);
|
||||
@ -1198,7 +1198,7 @@ query_replace (FileOpContext * ctx, const char *destname, struct stat *_s_stat,
|
||||
} pntr;
|
||||
pntr.f = file_progress_real_query_replace;
|
||||
|
||||
if (we_are_background)
|
||||
if (mc_global.we_are_background)
|
||||
return parent_call (pntr.p, ctx, 3, strlen (destname), destname,
|
||||
sizeof (struct stat), _s_stat, sizeof (struct stat), _d_stat);
|
||||
else
|
||||
@ -2639,7 +2639,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
||||
|
||||
#ifdef WITH_BACKGROUND
|
||||
/* Let our parent know we are saying bye bye */
|
||||
if (we_are_background)
|
||||
if (mc_global.we_are_background)
|
||||
{
|
||||
int cur_pid = getpid ();
|
||||
/* Send pid to parent with child context, it is fork and
|
||||
|
@ -51,16 +51,15 @@
|
||||
#include "lib/tty/mouse.h"
|
||||
#include "lib/tty/win.h" /* do_enter_ca_mode() */
|
||||
#include "lib/mcconfig.h"
|
||||
#include "lib/vfs/vfs.h" /* For vfs_translate_url() */
|
||||
#include "lib/vfs/vfs.h" /* For vfs_translate_url() */
|
||||
#include "lib/strutil.h"
|
||||
#include "lib/widget.h"
|
||||
|
||||
#include "src/main.h"
|
||||
#include "src/consaver/cons.saver.h"
|
||||
#include "src/viewer/mcviewer.h" /* The view widget */
|
||||
#include "src/setup.h"
|
||||
#include "src/subshell.h" /* For use_subshell and resize_subshell() */
|
||||
#include "src/background.h" /* we_are_background */
|
||||
#include "src/subshell.h" /* For resize_subshell() */
|
||||
#include "src/background.h"
|
||||
|
||||
#include "command.h"
|
||||
#include "midnight.h"
|
||||
@ -79,9 +78,6 @@ int nice_rotating_dash = 1;
|
||||
/* Set if the panels are split horizontally */
|
||||
int horizontal_split = 0;
|
||||
|
||||
/* Set if the window has changed it's size */
|
||||
int winch_flag = 0;
|
||||
|
||||
/* Set if the split is the same */
|
||||
int equal_split = 1;
|
||||
|
||||
@ -97,12 +93,6 @@ int command_prompt = 1;
|
||||
/* Set if the main menu is visible */
|
||||
int menubar_visible = 1;
|
||||
|
||||
/* Set if the nice and useful keybar is visible */
|
||||
int keybar_visible = 1;
|
||||
|
||||
/* Set if the nice message (hint) bar is visible */
|
||||
int message_visible = 1;
|
||||
|
||||
/* Set to show current working dir in xterm window title */
|
||||
int xterm_title = 1;
|
||||
|
||||
@ -187,8 +177,8 @@ static struct
|
||||
/* *INDENT-OFF* */
|
||||
{ N_("Show free sp&ace"), &free_space, NULL},
|
||||
{ N_("&XTerm window title"), &xterm_title, NULL},
|
||||
{ N_("H&intbar visible"), &message_visible, NULL},
|
||||
{ N_("&Keybar visible"), &keybar_visible, NULL},
|
||||
{ N_("H&intbar visible"), &mc_global.message_visible, NULL},
|
||||
{ N_("&Keybar visible"), &mc_global.keybar_visible, NULL},
|
||||
{ N_("Command &prompt"), &command_prompt, NULL},
|
||||
{ N_("Menu&bar visible"), &menubar_visible, NULL},
|
||||
{ N_("&Equal split"), &equal_split, NULL}
|
||||
@ -319,7 +309,7 @@ layout_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *d
|
||||
if (old_output_lines != _output_lines)
|
||||
{
|
||||
old_output_lines = _output_lines;
|
||||
tty_setcolor (console_flag ? COLOR_NORMAL : DISABLED_COLOR);
|
||||
tty_setcolor (mc_global.tty.console_flag ? COLOR_NORMAL : DISABLED_COLOR);
|
||||
dlg_move (h, 9, 6);
|
||||
tty_print_string (output_lines_label);
|
||||
dlg_move (h, 9, 6 + 3 + output_lines_label_len);
|
||||
@ -335,7 +325,7 @@ layout_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *d
|
||||
_xterm_title = check_options[1].widget->state & C_BOOL;
|
||||
_free_space = check_options[0].widget->state & C_BOOL;
|
||||
|
||||
if (console_flag)
|
||||
if (mc_global.tty.console_flag)
|
||||
{
|
||||
int minimum;
|
||||
if (_output_lines < 0)
|
||||
@ -356,7 +346,7 @@ layout_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *d
|
||||
if (old_output_lines != _output_lines)
|
||||
{
|
||||
old_output_lines = _output_lines;
|
||||
tty_setcolor (console_flag ? COLOR_NORMAL : DISABLED_COLOR);
|
||||
tty_setcolor (mc_global.tty.console_flag ? COLOR_NORMAL : DISABLED_COLOR);
|
||||
dlg_move (h, 9, 6 + 3 + output_lines_label_len);
|
||||
tty_printf ("%02d", _output_lines);
|
||||
}
|
||||
@ -503,13 +493,13 @@ init_layout (void)
|
||||
_equal_split = equal_split;
|
||||
_menubar_visible = menubar_visible;
|
||||
_command_prompt = command_prompt;
|
||||
_keybar_visible = keybar_visible;
|
||||
_message_visible = message_visible;
|
||||
_keybar_visible = mc_global.keybar_visible;
|
||||
_message_visible = mc_global.message_visible;
|
||||
_xterm_title = xterm_title;
|
||||
_free_space = free_space;
|
||||
|
||||
{
|
||||
const int disabled = console_flag ? 0 : W_DISABLED;
|
||||
const int disabled = mc_global.tty.console_flag ? 0 : W_DISABLED;
|
||||
Widget *w;
|
||||
|
||||
w = (Widget *) groupbox_new (8, 4, 3, first_width, title2);
|
||||
@ -720,10 +710,10 @@ void
|
||||
mc_refresh (void)
|
||||
{
|
||||
#ifdef WITH_BACKGROUND
|
||||
if (we_are_background)
|
||||
if (mc_global.we_are_background)
|
||||
return;
|
||||
#endif /* WITH_BACKGROUND */
|
||||
if (winch_flag == 0)
|
||||
if (mc_global.tty.winch_flag == FALSE)
|
||||
tty_refresh ();
|
||||
else
|
||||
{
|
||||
@ -741,14 +731,14 @@ setup_panels (void)
|
||||
int start_y;
|
||||
int promptl; /* the prompt len */
|
||||
|
||||
if (console_flag)
|
||||
if (mc_global.tty.console_flag)
|
||||
{
|
||||
int minimum;
|
||||
if (output_lines < 0)
|
||||
output_lines = 0;
|
||||
height =
|
||||
LINES - keybar_visible - command_prompt - menubar_visible -
|
||||
output_lines - message_visible;
|
||||
LINES - mc_global.keybar_visible - command_prompt - menubar_visible -
|
||||
output_lines - mc_global.message_visible;
|
||||
minimum = MINHEIGHT * (1 + horizontal_split);
|
||||
if (height < minimum)
|
||||
{
|
||||
@ -758,7 +748,9 @@ setup_panels (void)
|
||||
}
|
||||
else
|
||||
{
|
||||
height = LINES - menubar_visible - command_prompt - keybar_visible - message_visible;
|
||||
height =
|
||||
LINES - menubar_visible - command_prompt - mc_global.keybar_visible -
|
||||
mc_global.message_visible;
|
||||
}
|
||||
check_split ();
|
||||
start_y = menubar_visible;
|
||||
@ -789,9 +781,10 @@ setup_panels (void)
|
||||
|
||||
if (command_prompt)
|
||||
{
|
||||
widget_set_size (&cmdline->widget, LINES - 1 - keybar_visible, promptl, 1, COLS - promptl);
|
||||
widget_set_size (&cmdline->widget, LINES - 1 - mc_global.keybar_visible, promptl, 1,
|
||||
COLS - promptl);
|
||||
input_set_origin (cmdline, promptl, COLS - promptl);
|
||||
widget_set_size (&the_prompt->widget, LINES - 1 - keybar_visible, 0, 1, promptl);
|
||||
widget_set_size (&the_prompt->widget, LINES - 1 - mc_global.keybar_visible, 0, 1, promptl);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -800,18 +793,18 @@ setup_panels (void)
|
||||
widget_set_size (&the_prompt->widget, LINES, COLS, 0, 0);
|
||||
}
|
||||
|
||||
widget_set_size (&the_bar->widget, LINES - 1, 0, keybar_visible, COLS);
|
||||
buttonbar_set_visible (the_bar, keybar_visible);
|
||||
widget_set_size (&the_bar->widget, LINES - 1, 0, mc_global.keybar_visible, COLS);
|
||||
buttonbar_set_visible (the_bar, mc_global.keybar_visible);
|
||||
|
||||
/* Output window */
|
||||
if (console_flag && output_lines)
|
||||
if (mc_global.tty.console_flag && output_lines)
|
||||
{
|
||||
output_start_y = LINES - command_prompt - keybar_visible - output_lines;
|
||||
output_start_y = LINES - command_prompt - mc_global.keybar_visible - output_lines;
|
||||
show_console_contents (output_start_y,
|
||||
LINES - output_lines - keybar_visible - 1,
|
||||
LINES - keybar_visible - 1);
|
||||
LINES - output_lines - mc_global.keybar_visible - 1,
|
||||
LINES - mc_global.keybar_visible - 1);
|
||||
}
|
||||
if (message_visible)
|
||||
if (mc_global.message_visible)
|
||||
widget_set_size (&the_hint->widget, height + start_y, 0, 1, COLS);
|
||||
else
|
||||
widget_set_size (&the_hint->widget, 0, 0, 0, 0);
|
||||
@ -828,7 +821,7 @@ sigwinch_handler (int dummy)
|
||||
#if !(defined(USE_NCURSES) || defined(USE_NCURSESW)) /* don't do malloc in a signal handler */
|
||||
low_level_change_screen_size ();
|
||||
#endif
|
||||
winch_flag = 1;
|
||||
mc_global.tty.winch_flag = TRUE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -836,7 +829,7 @@ sigwinch_handler (int dummy)
|
||||
void
|
||||
change_screen_size (void)
|
||||
{
|
||||
winch_flag = 0;
|
||||
mc_global.tty.winch_flag = FALSE;
|
||||
#if defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4
|
||||
#if defined TIOCGWINSZ
|
||||
|
||||
@ -903,10 +896,10 @@ print_vfs_message (const char *msg, ...)
|
||||
g_vsnprintf (str, sizeof (str), msg, ap);
|
||||
va_end (ap);
|
||||
|
||||
if (midnight_shutdown)
|
||||
if (mc_global.widget.midnight_shutdown)
|
||||
return;
|
||||
|
||||
if (!message_visible || !the_hint || !the_hint->widget.owner)
|
||||
if (!mc_global.message_visible || !the_hint || !the_hint->widget.owner)
|
||||
{
|
||||
int col, row;
|
||||
|
||||
@ -926,7 +919,7 @@ print_vfs_message (const char *msg, ...)
|
||||
return;
|
||||
}
|
||||
|
||||
if (message_visible)
|
||||
if (mc_global.message_visible)
|
||||
set_hintbar (str);
|
||||
}
|
||||
|
||||
@ -985,7 +978,7 @@ void
|
||||
set_display_type (int num, panel_view_mode_t type)
|
||||
{
|
||||
int x = 0, y = 0, cols = 0, lines = 0;
|
||||
unsigned int the_other = 0; /* Index to the other panel */
|
||||
unsigned int the_other = 0; /* Index to the other panel */
|
||||
const char *file_name = NULL; /* For Quick view */
|
||||
Widget *new_widget = NULL, *old_widget = NULL;
|
||||
WPanel *the_other_panel = NULL;
|
||||
@ -1106,6 +1099,7 @@ set_display_type (int num, panel_view_mode_t type)
|
||||
|
||||
g_free (old_widget);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
|
@ -18,15 +18,12 @@
|
||||
|
||||
/*** global variables defined in .c file *********************************************************/
|
||||
|
||||
extern int winch_flag;
|
||||
extern int equal_split;
|
||||
extern int first_panel_size;
|
||||
extern int output_lines;
|
||||
extern int command_prompt;
|
||||
extern int menubar_visible;
|
||||
extern int keybar_visible;
|
||||
extern int output_start_y;
|
||||
extern int message_visible;
|
||||
extern int xterm_title;
|
||||
extern int free_space;
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
||||
#include "lib/skin.h"
|
||||
#include "lib/util.h"
|
||||
|
||||
#include "lib/vfs/vfs.h" /* vfs_translate_url() */
|
||||
#include "lib/vfs/vfs.h" /* vfs_translate_url() */
|
||||
|
||||
#include "src/args.h"
|
||||
#include "src/subshell.h"
|
||||
@ -57,7 +57,6 @@
|
||||
#include "src/learn.h" /* learn_keys() */
|
||||
#include "src/execute.h" /* suspend_cmd() */
|
||||
#include "src/keybind-defaults.h"
|
||||
#include "src/main.h" /* quit */
|
||||
|
||||
#include "option.h" /* configure_box() */
|
||||
#include "tree.h"
|
||||
@ -81,7 +80,7 @@
|
||||
#include "src/diffviewer/ydiff.h"
|
||||
#endif
|
||||
|
||||
#include "src/consaver/cons.saver.h" /* console_flag */
|
||||
#include "src/consaver/cons.saver.h" /* show_console_contents */
|
||||
|
||||
#include "midnight.h"
|
||||
|
||||
@ -122,8 +121,6 @@ Dlg_head *midnight_dlg = NULL;
|
||||
* Don't restrict the output on the screen manager level,
|
||||
* the translation tables take care of it.
|
||||
*/
|
||||
#define full_eight_bits (1)
|
||||
#define eight_bit_clean (1)
|
||||
#endif /* !HAVE_CHARSET */
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
@ -552,7 +549,7 @@ create_panels (void)
|
||||
cmdline = command_new (0, 0, 0);
|
||||
the_prompt = label_new (0, 0, mc_prompt);
|
||||
the_prompt->transparent = 1;
|
||||
the_bar = buttonbar_new (keybar_visible);
|
||||
the_bar = buttonbar_new (mc_global.keybar_visible);
|
||||
|
||||
the_hint = label_new (0, 0, 0);
|
||||
the_hint->transparent = 1;
|
||||
@ -781,14 +778,24 @@ static void
|
||||
setup_mc (void)
|
||||
{
|
||||
#ifdef HAVE_SLANG
|
||||
#ifdef HAVE_CHARSET
|
||||
tty_display_8bit (TRUE);
|
||||
#else
|
||||
tty_display_8bit (full_eight_bits != 0);
|
||||
#endif /* HAVE_CHARSET */
|
||||
#else
|
||||
|
||||
#ifdef HAVE_CHARSET
|
||||
tty_display_8bit (TRUE);
|
||||
#else
|
||||
tty_display_8bit (eight_bit_clean != 0);
|
||||
#endif /* HAVE_CHARSET */
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
if (use_subshell)
|
||||
add_select_channel (subshell_pty, load_prompt, 0);
|
||||
if (mc_global.tty.use_subshell)
|
||||
add_select_channel (mc_global.tty.subshell_pty, load_prompt, 0);
|
||||
#endif /* !HAVE_SUBSHELL_SUPPORT */
|
||||
|
||||
tty_setup_sigwinch (sigwinch_handler);
|
||||
@ -906,7 +913,7 @@ prepend_cwd_on_local (const char *filename)
|
||||
static void
|
||||
mc_maybe_editor_or_viewer (void)
|
||||
{
|
||||
switch (mc_run_mode)
|
||||
switch (mc_global.mc_run_mode)
|
||||
{
|
||||
#ifdef USE_INTERNAL_EDIT
|
||||
case MC_RUN_EDITOR:
|
||||
@ -962,7 +969,7 @@ quit_cmd_internal (int quiet)
|
||||
if (q != 0)
|
||||
{
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
if (!use_subshell)
|
||||
if (!mc_global.tty.use_subshell)
|
||||
stop_dialogs ();
|
||||
else if ((q = exit_subshell ()))
|
||||
#endif
|
||||
@ -1305,10 +1312,10 @@ midnight_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void
|
||||
case DLG_DRAW:
|
||||
load_hint (1);
|
||||
/* We handle the special case of the output lines */
|
||||
if (console_flag && output_lines)
|
||||
if (mc_global.tty.console_flag && output_lines)
|
||||
show_console_contents (output_start_y,
|
||||
LINES - output_lines - keybar_visible -
|
||||
1, LINES - keybar_visible - 1);
|
||||
LINES - output_lines - mc_global.keybar_visible -
|
||||
1, LINES - mc_global.keybar_visible - 1);
|
||||
return MSG_HANDLED;
|
||||
|
||||
case DLG_RESIZE:
|
||||
@ -1378,7 +1385,7 @@ midnight_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void
|
||||
return MSG_HANDLED;
|
||||
}
|
||||
|
||||
if ((!alternate_plus_minus || !(console_flag || xterm_flag))
|
||||
if ((!alternate_plus_minus || !(mc_global.tty.console_flag || xterm_flag))
|
||||
&& !quote && !current_panel->searching)
|
||||
{
|
||||
if (!only_leading_plus_minus)
|
||||
@ -1530,7 +1537,7 @@ load_hint (gboolean force)
|
||||
if (the_hint->widget.owner == NULL)
|
||||
return;
|
||||
|
||||
if (!message_visible)
|
||||
if (!mc_global.message_visible)
|
||||
{
|
||||
label_set_text (the_hint, NULL);
|
||||
return;
|
||||
@ -1608,13 +1615,13 @@ do_nc (void)
|
||||
midnight_dlg = create_dlg (FALSE, 0, 0, LINES, COLS, midnight_colors, midnight_callback,
|
||||
"[main]", NULL, DLG_WANT_IDLE);
|
||||
|
||||
if (mc_run_mode == MC_RUN_FULL)
|
||||
if (mc_global.mc_run_mode == MC_RUN_FULL)
|
||||
setup_mc ();
|
||||
else
|
||||
setup_dummy_mc ();
|
||||
|
||||
/* Check if we were invoked as an editor or file viewer */
|
||||
if (mc_run_mode != MC_RUN_FULL)
|
||||
if (mc_global.mc_run_mode != MC_RUN_FULL)
|
||||
mc_maybe_editor_or_viewer ();
|
||||
else
|
||||
{
|
||||
@ -1626,7 +1633,7 @@ do_nc (void)
|
||||
}
|
||||
|
||||
/* Program end */
|
||||
midnight_shutdown = 1;
|
||||
mc_global.widget.midnight_shutdown = TRUE;
|
||||
dialog_switch_shutdown ();
|
||||
done_mc ();
|
||||
destroy_dlg (midnight_dlg);
|
||||
|
@ -119,11 +119,11 @@ configure_box (void)
|
||||
QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 11, dlg_height, N_("Sa&fe delete"),
|
||||
&safe_delete),
|
||||
QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 10, dlg_height, N_("Cd follows lin&ks"),
|
||||
&cd_symlinks),
|
||||
&mc_global.vfs.cd_symlinks),
|
||||
QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 9, dlg_height, N_("Rotating d&ash"),
|
||||
&nice_rotating_dash),
|
||||
QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 8, dlg_height, N_("Co&mplete: show all"),
|
||||
&show_all_if_ambiguous),
|
||||
&mc_global.widget.show_all_if_ambiguous),
|
||||
QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 7, dlg_height, N_("Shell &patterns"),
|
||||
&easy_patterns),
|
||||
QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 6, dlg_height, N_("&Drop down menus"),
|
||||
@ -439,7 +439,7 @@ panel_options_box (void)
|
||||
if ((qd_result == B_ENTER) || (qd_result == B_EXIT))
|
||||
{
|
||||
mc_config_set_bool (mc_main_config, CONFIG_PANELS_SECTION,
|
||||
"simple_swap", (gboolean) (simple_swap & C_BOOL));
|
||||
"simple_swap", (gboolean) (simple_swap & C_BOOL));
|
||||
|
||||
if (!panels_options.fast_reload_msg_shown && panels_options.fast_reload)
|
||||
{
|
||||
|
@ -53,7 +53,7 @@
|
||||
#include "src/execute.h"
|
||||
#include "src/selcodepage.h" /* select_charset (), SELECT_CHARSET_NO_TRANSLATE */
|
||||
#include "src/keybind-defaults.h" /* global_keymap_t */
|
||||
#include "src/subshell.h" /* use_subshell */
|
||||
#include "src/subshell.h" /* do_subshell_chdir() */
|
||||
|
||||
#include "dir.h"
|
||||
#include "boxes.h"
|
||||
@ -1181,7 +1181,7 @@ static char *
|
||||
panel_save_name (WPanel * panel)
|
||||
{
|
||||
/* If the program is shuting down */
|
||||
if ((midnight_shutdown && auto_save_setup) || saving_setup)
|
||||
if ((mc_global.widget.midnight_shutdown && auto_save_setup) || saving_setup)
|
||||
return g_strdup (panel->panel_name);
|
||||
else
|
||||
return g_strconcat ("Temporal:", panel->panel_name, (char *) NULL);
|
||||
@ -2264,7 +2264,7 @@ do_enter_on_file_entry (file_entry * fe)
|
||||
}
|
||||
|
||||
#if HAVE_CHARSET
|
||||
source_codepage = default_source_codepage;
|
||||
mc_global.source_codepage = default_source_codepage;
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
@ -2591,7 +2591,7 @@ static void
|
||||
subshell_chdir (const char *directory)
|
||||
{
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
if (use_subshell && vfs_current_is_local ())
|
||||
if (mc_global.tty.use_subshell && vfs_current_is_local ())
|
||||
do_subshell_chdir (directory, FALSE, TRUE);
|
||||
#endif /* HAVE_SUBSHELL_SUPPORT */
|
||||
}
|
||||
@ -3890,14 +3890,14 @@ panel_change_encoding (WPanel * panel)
|
||||
if (panel->codepage == SELECT_CHARSET_NO_TRANSLATE)
|
||||
{
|
||||
/* No translation */
|
||||
g_free (init_translation_table (display_codepage, display_codepage));
|
||||
g_free (init_translation_table (mc_global.display_codepage, mc_global.display_codepage));
|
||||
cd_path = remove_encoding_from_path (panel->cwd);
|
||||
do_panel_cd (panel, cd_path, cd_parse_command);
|
||||
g_free (cd_path);
|
||||
return;
|
||||
}
|
||||
|
||||
errmsg = init_translation_table (panel->codepage, display_codepage);
|
||||
errmsg = init_translation_table (panel->codepage, mc_global.display_codepage);
|
||||
if (errmsg != NULL)
|
||||
{
|
||||
message (D_ERROR, MSG_ERROR, "%s", errmsg);
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include "lib/widget.h"
|
||||
|
||||
#include "src/setup.h" /* For profile_bname */
|
||||
#include "src/main.h"
|
||||
#include "src/history.h"
|
||||
|
||||
#include "dir.h"
|
||||
@ -481,7 +480,7 @@ load_panelize (void)
|
||||
while (*profile_keys)
|
||||
{
|
||||
|
||||
if (utf8_display || conv == INVALID_CONV)
|
||||
if (mc_global.utf8_display || conv == INVALID_CONV)
|
||||
{
|
||||
buffer = g_string_new (*profile_keys);
|
||||
}
|
||||
|
@ -722,7 +722,7 @@ expand_format (struct WEdit *edit_widget, char c, gboolean do_quote)
|
||||
if (c == '%')
|
||||
return g_strdup ("%");
|
||||
|
||||
if (mc_run_mode == MC_RUN_FULL)
|
||||
if (mc_global.mc_run_mode == MC_RUN_FULL)
|
||||
{
|
||||
if (g_ascii_islower ((gchar) c))
|
||||
panel = current_panel;
|
||||
@ -735,7 +735,7 @@ expand_format (struct WEdit *edit_widget, char c, gboolean do_quote)
|
||||
fname = panel->dir.list[panel->selected].fname;
|
||||
}
|
||||
#ifdef USE_INTERNAL_EDIT
|
||||
else if (mc_run_mode == MC_RUN_EDITOR)
|
||||
else if (mc_global.mc_run_mode == MC_RUN_EDITOR)
|
||||
fname = (char *) edit_get_file_name (edit_widget);
|
||||
#endif
|
||||
|
||||
@ -906,13 +906,13 @@ user_menu_cmd (struct WEdit *edit_widget, const char *menu_file, int selected_en
|
||||
{
|
||||
g_free (menu);
|
||||
menu =
|
||||
concat_dir_and_file (mc_sysconfig_dir,
|
||||
concat_dir_and_file (mc_global.sysconfig_dir,
|
||||
edit_widget ? EDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
|
||||
if (!exist_file (menu))
|
||||
{
|
||||
g_free (menu);
|
||||
menu = concat_dir_and_file
|
||||
(mc_share_data_dir, edit_widget ? EDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
|
||||
(mc_global.share_data_dir, edit_widget ? EDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1047,7 +1047,7 @@ interactive_display (const char *filename, const char *node)
|
||||
if (filename != NULL)
|
||||
g_file_get_contents (filename, &filedata, NULL, NULL);
|
||||
else
|
||||
filedata = load_mc_home_file (mc_share_data_dir, MC_HELP, &hlpfile);
|
||||
filedata = load_mc_home_file (mc_global.share_data_dir, MC_HELP, &hlpfile);
|
||||
|
||||
if (filedata == NULL)
|
||||
message (D_ERROR, MSG_ERROR, _("Cannot open file %s\n%s"),
|
||||
|
@ -37,7 +37,6 @@
|
||||
#define MC_HISTORY_VIEW_SEARCH_REGEX "mc.view.search.regex"
|
||||
|
||||
#define MC_HISTORY_FTPFS_ACCOUNT "mc.vfs.ftp.account"
|
||||
#define MC_HISTORY_VFS_PASSWORD "mc.vfs.password"
|
||||
|
||||
#define MC_HISTORY_EXT_PARAMETER "mc.ext.parameter"
|
||||
|
||||
|
95
src/main.c
95
src/main.c
@ -50,7 +50,7 @@
|
||||
#include "lib/fileloc.h"
|
||||
#include "lib/strutil.h"
|
||||
#include "lib/util.h"
|
||||
#include "lib/vfs/vfs.h" /* vfs_init(), vfs_shut() */
|
||||
#include "lib/vfs/vfs.h" /* vfs_init(), vfs_shut() */
|
||||
|
||||
#include "filemanager/midnight.h" /* current_panel */
|
||||
#include "filemanager/treestore.h" /* tree_store_save */
|
||||
@ -70,7 +70,7 @@
|
||||
#include "selcodepage.h"
|
||||
#endif /* HAVE_CHARSET */
|
||||
|
||||
#include "consaver/cons.saver.h" /* console_flag */
|
||||
#include "consaver/cons.saver.h" /* cons_saver_pid */
|
||||
|
||||
#include "main.h"
|
||||
|
||||
@ -83,54 +83,25 @@ int quit = 0;
|
||||
|
||||
#ifdef HAVE_CHARSET
|
||||
/* Numbers of (file I/O) and (input/display) codepages. -1 if not selected */
|
||||
int source_codepage = -1;
|
||||
int default_source_codepage = -1;
|
||||
int display_codepage = -1;
|
||||
char *autodetect_codeset = NULL;
|
||||
gboolean is_autodetect_codeset_enabled = FALSE;
|
||||
#else
|
||||
/* If true, allow characters in the range 160-255 */
|
||||
int eight_bit_clean = 1;
|
||||
/*
|
||||
* If true, also allow characters in the range 128-159.
|
||||
* This is reported to break on many terminals (xterm, qansi-m).
|
||||
*/
|
||||
int full_eight_bits = 0;
|
||||
#endif /* !HAVE_CHARSET */
|
||||
|
||||
/*
|
||||
* If utf-8 terminal utf8_display = 1
|
||||
* Display bits set UTF-8
|
||||
*/
|
||||
int utf8_display = 0;
|
||||
|
||||
/* If true use the internal viewer */
|
||||
int use_internal_view = 1;
|
||||
/* If set, use the builtin editor */
|
||||
int use_internal_edit = 1;
|
||||
|
||||
mc_run_mode_t mc_run_mode = MC_RUN_FULL;
|
||||
char *mc_run_param0 = NULL;
|
||||
char *mc_run_param1 = NULL;
|
||||
|
||||
/* Used so that widgets know if they are being destroyed or
|
||||
shut down */
|
||||
int midnight_shutdown = 0;
|
||||
|
||||
/* The user's shell */
|
||||
char *shell = NULL;
|
||||
|
||||
/* The prompt */
|
||||
const char *mc_prompt = NULL;
|
||||
|
||||
/* mc_sysconfig_dir: Area for default settings from maintainers of distributuves
|
||||
default is /etc/mc or may be defined by MC_DATADIR
|
||||
*/
|
||||
char *mc_sysconfig_dir = NULL;
|
||||
|
||||
/* mc_share_data_dir: Area for default settings from developers */
|
||||
char *mc_share_data_dir = NULL;
|
||||
|
||||
/* Set to TRUE to suppress printing the last directory */
|
||||
int print_last_revert = FALSE;
|
||||
|
||||
@ -162,20 +133,20 @@ check_codeset (void)
|
||||
{
|
||||
const char *_display_codepage;
|
||||
|
||||
_display_codepage = get_codepage_id (display_codepage);
|
||||
_display_codepage = get_codepage_id (mc_global.display_codepage);
|
||||
|
||||
if (strcmp (_display_codepage, current_system_codepage) != 0)
|
||||
{
|
||||
display_codepage = get_codepage_index (current_system_codepage);
|
||||
if (display_codepage == -1)
|
||||
display_codepage = 0;
|
||||
mc_global.display_codepage = get_codepage_index (current_system_codepage);
|
||||
if (mc_global.display_codepage == -1)
|
||||
mc_global.display_codepage = 0;
|
||||
|
||||
mc_config_set_string (mc_main_config, "Misc", "display_codepage", cp_display);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
utf8_display = str_isutf8 (current_system_codepage);
|
||||
mc_global.utf8_display = str_isutf8 (current_system_codepage);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -208,13 +179,13 @@ OS_Setup (void)
|
||||
mc_libdir = getenv ("MC_DATADIR");
|
||||
if (mc_libdir != NULL)
|
||||
{
|
||||
mc_sysconfig_dir = g_strdup (mc_libdir);
|
||||
mc_share_data_dir = g_strdup (SYSCONFDIR);
|
||||
mc_global.sysconfig_dir = g_strdup (mc_libdir);
|
||||
mc_global.share_data_dir = g_strdup (SYSCONFDIR);
|
||||
}
|
||||
else
|
||||
{
|
||||
mc_sysconfig_dir = g_strdup (SYSCONFDIR);
|
||||
mc_share_data_dir = g_strdup (DATADIR);
|
||||
mc_global.sysconfig_dir = g_strdup (SYSCONFDIR);
|
||||
mc_global.share_data_dir = g_strdup (DATADIR);
|
||||
}
|
||||
|
||||
}
|
||||
@ -227,12 +198,12 @@ sigchld_handler_no_subshell (int sig)
|
||||
#ifdef __linux__
|
||||
int pid, status;
|
||||
|
||||
if (!console_flag)
|
||||
if (!mc_global.tty.console_flag)
|
||||
return;
|
||||
|
||||
/* COMMENT: if it were true that after the call to handle_console(..INIT)
|
||||
the value of console_flag never changed, we could simply not install
|
||||
this handler at all if (!console_flag && !use_subshell). */
|
||||
the value of mc_global.tty.console_flag never changed, we could simply not install
|
||||
this handler at all if (!mc_global.tty.console_flag && !mc_global.tty.use_subshell). */
|
||||
|
||||
/* That comment is no longer true. We need to wait() on a sigchld
|
||||
handler (that's at least what the tarfs code expects currently). */
|
||||
@ -251,7 +222,7 @@ sigchld_handler_no_subshell (int sig)
|
||||
{
|
||||
/* cons.saver has died - disable console saving */
|
||||
handle_console (CONSOLE_DONE);
|
||||
console_flag = 0;
|
||||
mc_global.tty.console_flag = '\0';
|
||||
}
|
||||
}
|
||||
/* If we got here, some other child exited; ignore it */
|
||||
@ -269,7 +240,7 @@ init_sigchld (void)
|
||||
|
||||
sigchld_action.sa_handler =
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
use_subshell ? sigchld_handler :
|
||||
mc_global.tty.use_subshell ? sigchld_handler :
|
||||
#endif /* HAVE_SUBSHELL_SUPPORT */
|
||||
sigchld_handler_no_subshell;
|
||||
|
||||
@ -288,7 +259,7 @@ init_sigchld (void)
|
||||
* This may happen on QNX Neutrino 6, where SA_RESTART
|
||||
* is defined but not implemented. Fallback to no subshell.
|
||||
*/
|
||||
use_subshell = 0;
|
||||
mc_global.tty.use_subshell = FALSE;
|
||||
#endif /* HAVE_SUBSHELL_SUPPORT */
|
||||
}
|
||||
}
|
||||
@ -447,7 +418,7 @@ main (int argc, char *argv[])
|
||||
str_init_strings (NULL);
|
||||
|
||||
vfs_init ();
|
||||
vfs_plugins_init();
|
||||
vfs_plugins_init ();
|
||||
vfs_setup_work_dir ();
|
||||
|
||||
if (!mc_args_handle (argc, argv, "mc"))
|
||||
@ -462,10 +433,10 @@ main (int argc, char *argv[])
|
||||
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
/* Don't use subshell when invoked as viewer or editor */
|
||||
if (mc_run_mode != MC_RUN_FULL)
|
||||
use_subshell = 0;
|
||||
if (mc_global.mc_run_mode != MC_RUN_FULL)
|
||||
mc_global.tty.use_subshell = FALSE;
|
||||
|
||||
if (use_subshell)
|
||||
if (mc_global.tty.use_subshell)
|
||||
subshell_get_console_attributes ();
|
||||
#endif /* HAVE_SUBSHELL_SUPPORT */
|
||||
|
||||
@ -488,11 +459,11 @@ main (int argc, char *argv[])
|
||||
|
||||
/* Must be done before init_subshell, to set up the terminal size: */
|
||||
/* FIXME: Should be removed and LINES and COLS computed on subshell */
|
||||
tty_init ((gboolean) mc_args__slow_terminal, (gboolean) mc_args__ugly_line_drawing);
|
||||
tty_init (mc_global.args.slow_terminal, mc_global.args.ugly_line_drawing);
|
||||
|
||||
load_setup ();
|
||||
|
||||
/* start check display_codepage and source_codepage */
|
||||
/* start check mc_global.display_codepage and mc_global.source_codepage */
|
||||
check_codeset ();
|
||||
|
||||
/* Removing this from the X code let's us type C-c */
|
||||
@ -502,7 +473,7 @@ main (int argc, char *argv[])
|
||||
|
||||
macros_list = g_array_new (TRUE, FALSE, sizeof (macros_t));
|
||||
|
||||
tty_init_colors (mc_args__disable_colors, mc_args__force_colors);
|
||||
tty_init_colors (mc_global.args.disable_colors, mc_args__force_colors);
|
||||
|
||||
{
|
||||
GError *error2 = NULL;
|
||||
@ -529,20 +500,20 @@ main (int argc, char *argv[])
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
/* Done here to ensure that the subshell doesn't */
|
||||
/* inherit the file descriptors opened below, etc */
|
||||
if (use_subshell)
|
||||
if (mc_global.tty.use_subshell)
|
||||
init_subshell ();
|
||||
|
||||
#endif /* HAVE_SUBSHELL_SUPPORT */
|
||||
|
||||
/* Also done after init_subshell, to save any shell init file messages */
|
||||
if (console_flag)
|
||||
if (mc_global.tty.console_flag)
|
||||
handle_console (CONSOLE_SAVE);
|
||||
|
||||
if (alternate_plus_minus)
|
||||
application_keypad_mode ();
|
||||
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
if (use_subshell)
|
||||
if (mc_global.tty.use_subshell)
|
||||
{
|
||||
mc_prompt = strip_ctrl_codes (subshell_prompt);
|
||||
if (mc_prompt == NULL)
|
||||
@ -553,7 +524,7 @@ main (int argc, char *argv[])
|
||||
mc_prompt = (geteuid () == 0) ? "# " : "$ ";
|
||||
|
||||
/* Program main loop */
|
||||
if (!midnight_shutdown)
|
||||
if (!mc_global.widget.midnight_shutdown)
|
||||
do_nc ();
|
||||
|
||||
/* Save the tree store */
|
||||
@ -574,17 +545,17 @@ main (int argc, char *argv[])
|
||||
|
||||
done_setup ();
|
||||
|
||||
if (console_flag && (quit & SUBSHELL_EXIT) == 0)
|
||||
if (mc_global.tty.console_flag && (quit & SUBSHELL_EXIT) == 0)
|
||||
handle_console (CONSOLE_RESTORE);
|
||||
if (alternate_plus_minus)
|
||||
numeric_keypad_mode ();
|
||||
|
||||
signal (SIGCHLD, SIG_DFL); /* Disable the SIGCHLD handler */
|
||||
|
||||
if (console_flag)
|
||||
if (mc_global.tty.console_flag)
|
||||
handle_console (CONSOLE_DONE);
|
||||
|
||||
if (mc_run_mode == MC_RUN_FULL && mc_args__last_wd_file != NULL
|
||||
if (mc_global.mc_run_mode == MC_RUN_FULL && mc_args__last_wd_file != NULL
|
||||
&& last_wd_string != NULL && !print_last_revert)
|
||||
{
|
||||
int last_wd_fd;
|
||||
@ -601,8 +572,8 @@ main (int argc, char *argv[])
|
||||
}
|
||||
g_free (last_wd_string);
|
||||
|
||||
g_free (mc_share_data_dir);
|
||||
g_free (mc_sysconfig_dir);
|
||||
g_free (mc_global.share_data_dir);
|
||||
g_free (mc_global.sysconfig_dir);
|
||||
g_free (shell);
|
||||
|
||||
done_key ();
|
||||
|
20
src/main.h
20
src/main.h
@ -14,13 +14,6 @@
|
||||
/*** enums ***************************************************************************************/
|
||||
|
||||
/* run mode and params */
|
||||
typedef enum
|
||||
{
|
||||
MC_RUN_FULL = 0,
|
||||
MC_RUN_EDITOR,
|
||||
MC_RUN_VIEWER,
|
||||
MC_RUN_DIFFVIEWER
|
||||
} mc_run_mode_t;
|
||||
|
||||
enum cd_enum
|
||||
{
|
||||
@ -49,7 +42,6 @@ struct mc_fhl_struct;
|
||||
|
||||
/*** global variables defined in .c file *********************************************************/
|
||||
|
||||
extern mc_run_mode_t mc_run_mode;
|
||||
/*
|
||||
* MC_RUN_FULL: dir for left panel
|
||||
* MC_RUN_EDITOR: file to edit
|
||||
@ -77,26 +69,14 @@ extern int use_internal_view;
|
||||
extern int use_internal_edit;
|
||||
|
||||
#ifdef HAVE_CHARSET
|
||||
extern int source_codepage;
|
||||
extern int default_source_codepage;
|
||||
extern int display_codepage;
|
||||
extern char *autodetect_codeset;
|
||||
extern gboolean is_autodetect_codeset_enabled;
|
||||
#else
|
||||
extern int eight_bit_clean;
|
||||
extern int full_eight_bits;
|
||||
#endif /* !HAVE_CHARSET */
|
||||
|
||||
extern int utf8_display;
|
||||
|
||||
extern int midnight_shutdown;
|
||||
|
||||
extern char *shell;
|
||||
extern const char *mc_prompt;
|
||||
|
||||
extern char *mc_sysconfig_dir;
|
||||
extern char *mc_share_data_dir;
|
||||
|
||||
/* index to record_macro_buf[], -1 if not recording a macro */
|
||||
extern int macro_index;
|
||||
|
||||
|
@ -136,9 +136,9 @@ do_set_codepage (int codepage)
|
||||
char *errmsg;
|
||||
gboolean ret;
|
||||
|
||||
source_codepage = codepage;
|
||||
mc_global.source_codepage = codepage;
|
||||
errmsg = init_translation_table (codepage == SELECT_CHARSET_NO_TRANSLATE ?
|
||||
display_codepage : source_codepage, display_codepage);
|
||||
mc_global.display_codepage : mc_global.source_codepage, mc_global.display_codepage);
|
||||
ret = errmsg == NULL;
|
||||
|
||||
if (!ret)
|
||||
|
88
src/setup.c
88
src/setup.c
@ -84,10 +84,6 @@ char *global_profile_name; /* mc.lib */
|
||||
/* Only used at program boot */
|
||||
gboolean boot_current_is_left = TRUE;
|
||||
|
||||
char *setup_color_string;
|
||||
char *term_color_string;
|
||||
char *color_terminal_string;
|
||||
|
||||
/* If on, default for "No" in delete operations */
|
||||
int safe_delete = 0;
|
||||
|
||||
@ -104,8 +100,6 @@ int confirm_overwrite = 1;
|
||||
int confirm_execute = 0;
|
||||
/* Asks for confirmation before leaving the program */
|
||||
int confirm_exit = 1;
|
||||
/* Asks for confirmation before clean up of history */
|
||||
int confirm_history_cleanup = 1;
|
||||
|
||||
/* If true, at startup the user-menu is invoked */
|
||||
int auto_menu = 0;
|
||||
@ -158,12 +152,6 @@ int auto_save_setup = 1;
|
||||
*/
|
||||
int only_leading_plus_minus = 1;
|
||||
|
||||
/* Set when cd symlink following is desirable (bash mode) */
|
||||
int cd_symlinks = 1;
|
||||
|
||||
/* Set if you want the possible completions dialog for the first time */
|
||||
int show_all_if_ambiguous = 0;
|
||||
|
||||
/* Automatically fills name with current selected item name on mkdir */
|
||||
int auto_fill_mkdir_name = 1;
|
||||
|
||||
@ -226,8 +214,8 @@ static const struct
|
||||
} layout [] = {
|
||||
{ "equal_split", &equal_split },
|
||||
{ "first_panel_size", &first_panel_size },
|
||||
{ "message_visible", &message_visible },
|
||||
{ "keybar_visible", &keybar_visible },
|
||||
{ "message_visible", &mc_global.message_visible },
|
||||
{ "keybar_visible", &mc_global.keybar_visible },
|
||||
{ "xterm_title", &xterm_title },
|
||||
{ "output_lines", &output_lines },
|
||||
{ "command_prompt", &command_prompt },
|
||||
@ -252,15 +240,15 @@ static const struct
|
||||
{ "confirm_delete", &confirm_delete },
|
||||
{ "confirm_overwrite", &confirm_overwrite },
|
||||
{ "confirm_execute", &confirm_execute },
|
||||
{ "confirm_history_cleanup", &confirm_history_cleanup },
|
||||
{ "confirm_history_cleanup", &mc_global.widget.confirm_history_cleanup },
|
||||
{ "confirm_exit", &confirm_exit },
|
||||
{ "confirm_directory_hotlist_delete", &confirm_directory_hotlist_delete },
|
||||
{ "safe_delete", &safe_delete },
|
||||
{ "mouse_repeat_rate", &mou_auto_repeat },
|
||||
{ "double_click_speed", &double_click_speed },
|
||||
#ifndef HAVE_CHARSET
|
||||
{ "eight_bit_clean", &eight_bit_clean },
|
||||
{ "full_eight_bits", &full_eight_bits },
|
||||
{ "eight_bit_clean", &mc_global.eight_bit_clean },
|
||||
{ "full_eight_bits", &mc_global.full_eight_bits },
|
||||
#endif /* !HAVE_CHARSET */
|
||||
{ "use_8th_bit_as_meta", &use_8th_bit_as_meta },
|
||||
{ "confirm_view_dir", &confirm_view_dir },
|
||||
@ -271,8 +259,8 @@ static const struct
|
||||
{ "wrap_mode", &mcview_global_wrap_mode},
|
||||
{ "old_esc_mode", &old_esc_mode },
|
||||
{ "old_esc_mode_timeout", &old_esc_mode_timeout },
|
||||
{ "cd_symlinks", &cd_symlinks },
|
||||
{ "show_all_if_ambiguous", &show_all_if_ambiguous },
|
||||
{ "cd_symlinks", &mc_global.vfs.cd_symlinks },
|
||||
{ "show_all_if_ambiguous", &mc_global.widget.show_all_if_ambiguous },
|
||||
{ "max_dirt_limit", &mcview_max_dirt_limit },
|
||||
{ "use_file_to_guess_type", &use_file_to_check_type },
|
||||
{ "alternate_plus_minus", &alternate_plus_minus },
|
||||
@ -418,9 +406,9 @@ load_setup_get_full_config_name (const char *subdir, const char *config_file_nam
|
||||
g_free (ret);
|
||||
|
||||
if (subdir != NULL)
|
||||
ret = g_build_filename (mc_sysconfig_dir, subdir, lc_basename, NULL);
|
||||
ret = g_build_filename (mc_global.sysconfig_dir, subdir, lc_basename, NULL);
|
||||
else
|
||||
ret = g_build_filename (mc_sysconfig_dir, lc_basename, NULL);
|
||||
ret = g_build_filename (mc_global.sysconfig_dir, lc_basename, NULL);
|
||||
|
||||
if (exist_file (ret))
|
||||
{
|
||||
@ -430,9 +418,9 @@ load_setup_get_full_config_name (const char *subdir, const char *config_file_nam
|
||||
g_free (ret);
|
||||
|
||||
if (subdir != NULL)
|
||||
ret = g_build_filename (mc_share_data_dir, subdir, lc_basename, NULL);
|
||||
ret = g_build_filename (mc_global.share_data_dir, subdir, lc_basename, NULL);
|
||||
else
|
||||
ret = g_build_filename (mc_share_data_dir, lc_basename, NULL);
|
||||
ret = g_build_filename (mc_global.share_data_dir, lc_basename, NULL);
|
||||
|
||||
g_free (lc_basename);
|
||||
|
||||
@ -677,13 +665,13 @@ load_setup_get_keymap_profile_config (gboolean load_from_file)
|
||||
if (!load_from_file)
|
||||
return keymap_config;
|
||||
|
||||
/* 1) /usr/share/mc (mc_share_data_dir) */
|
||||
fname = g_build_filename (mc_share_data_dir, GLOBAL_KEYMAP_FILE, NULL);
|
||||
/* 1) /usr/share/mc (mc_global.share_data_dir) */
|
||||
fname = g_build_filename (mc_global.share_data_dir, GLOBAL_KEYMAP_FILE, NULL);
|
||||
load_setup_init_config_from_file (&keymap_config, fname);
|
||||
g_free (fname);
|
||||
|
||||
/* 2) /etc/mc (mc_sysconfig_dir) */
|
||||
fname = g_build_filename (mc_sysconfig_dir, GLOBAL_KEYMAP_FILE, NULL);
|
||||
/* 2) /etc/mc (mc_global.sysconfig_dir) */
|
||||
fname = g_build_filename (mc_global.sysconfig_dir, GLOBAL_KEYMAP_FILE, NULL);
|
||||
load_setup_init_config_from_file (&keymap_config, fname);
|
||||
g_free (fname);
|
||||
|
||||
@ -769,7 +757,7 @@ save_panel_types (void)
|
||||
{
|
||||
panel_view_mode_t type;
|
||||
|
||||
if (mc_run_mode != MC_RUN_FULL)
|
||||
if (mc_global.mc_run_mode != MC_RUN_FULL)
|
||||
return;
|
||||
|
||||
type = get_display_type (0);
|
||||
@ -812,7 +800,7 @@ setup_init (void)
|
||||
profile = g_build_filename (mc_config_get_path (), MC_CONFIG_FILE, NULL);
|
||||
if (!exist_file (profile))
|
||||
{
|
||||
inifile = concat_dir_and_file (mc_sysconfig_dir, "mc.ini");
|
||||
inifile = concat_dir_and_file (mc_global.sysconfig_dir, "mc.ini");
|
||||
if (exist_file (inifile))
|
||||
{
|
||||
g_free (profile);
|
||||
@ -821,7 +809,7 @@ setup_init (void)
|
||||
else
|
||||
{
|
||||
g_free (inifile);
|
||||
inifile = concat_dir_and_file (mc_share_data_dir, "mc.ini");
|
||||
inifile = concat_dir_and_file (mc_global.share_data_dir, "mc.ini");
|
||||
if (exist_file (inifile))
|
||||
{
|
||||
g_free (profile);
|
||||
@ -855,11 +843,13 @@ load_setup (void)
|
||||
|
||||
/* mc.lib is common for all users, but has priority lower than
|
||||
${XDG_CONFIG_HOME}/mc/ini. FIXME: it's only used for keys and treestore now */
|
||||
global_profile_name = g_build_filename (mc_sysconfig_dir, MC_GLOBAL_CONFIG_FILE, (char *) NULL);
|
||||
global_profile_name =
|
||||
g_build_filename (mc_global.sysconfig_dir, MC_GLOBAL_CONFIG_FILE, (char *) NULL);
|
||||
if (!exist_file (global_profile_name))
|
||||
{
|
||||
g_free (global_profile_name);
|
||||
global_profile_name = g_build_filename (mc_share_data_dir, MC_GLOBAL_CONFIG_FILE, (char *) NULL);
|
||||
global_profile_name =
|
||||
g_build_filename (mc_global.share_data_dir, MC_GLOBAL_CONFIG_FILE, (char *) NULL);
|
||||
}
|
||||
|
||||
panels_profile_name = g_build_filename (mc_config_get_cache_path (), MC_PANELS_FILE, NULL);
|
||||
@ -931,9 +921,12 @@ load_setup (void)
|
||||
#endif /* ENABLE_VFS_FTP */
|
||||
|
||||
/* The default color and the terminal dependent color */
|
||||
setup_color_string = mc_config_get_string (mc_main_config, "Colors", "base_color", "");
|
||||
term_color_string = mc_config_get_string (mc_main_config, "Colors", getenv ("TERM"), "");
|
||||
color_terminal_string = mc_config_get_string (mc_main_config, "Colors", "color_terminals", "");
|
||||
mc_global.tty.setup_color_string =
|
||||
mc_config_get_string (mc_main_config, "Colors", "base_color", "");
|
||||
mc_global.tty.term_color_string =
|
||||
mc_config_get_string (mc_main_config, "Colors", getenv ("TERM"), "");
|
||||
mc_global.tty.color_terminal_string =
|
||||
mc_config_get_string (mc_main_config, "Colors", "color_terminals", "");
|
||||
|
||||
/* Load the directory history */
|
||||
/* directory_history_load (); */
|
||||
@ -945,16 +938,16 @@ load_setup (void)
|
||||
buffer = mc_config_get_string (mc_main_config, "Misc", "display_codepage", "");
|
||||
if (buffer[0] != '\0')
|
||||
{
|
||||
display_codepage = get_codepage_index (buffer);
|
||||
cp_display = get_codepage_id (display_codepage);
|
||||
mc_global.display_codepage = get_codepage_index (buffer);
|
||||
cp_display = get_codepage_id (mc_global.display_codepage);
|
||||
}
|
||||
g_free (buffer);
|
||||
buffer = mc_config_get_string (mc_main_config, "Misc", "source_codepage", "");
|
||||
if (buffer[0] != '\0')
|
||||
{
|
||||
default_source_codepage = get_codepage_index (buffer);
|
||||
source_codepage = default_source_codepage; /* May be source_codepage doesn't need this */
|
||||
cp_source = get_codepage_id (source_codepage);
|
||||
mc_global.source_codepage = default_source_codepage; /* May be source_codepage doesn't need this */
|
||||
cp_source = get_codepage_id (mc_global.source_codepage);
|
||||
}
|
||||
g_free (buffer);
|
||||
}
|
||||
@ -963,10 +956,10 @@ load_setup (void)
|
||||
if ((autodetect_codeset[0] != '\0') && (strcmp (autodetect_codeset, "off") != 0))
|
||||
is_autodetect_codeset_enabled = TRUE;
|
||||
|
||||
g_free (init_translation_table (source_codepage, display_codepage));
|
||||
buffer = (char *) get_codepage_id (display_codepage);
|
||||
g_free (init_translation_table (mc_global.source_codepage, mc_global.display_codepage));
|
||||
buffer = (char *) get_codepage_id (mc_global.display_codepage);
|
||||
if (buffer != NULL)
|
||||
utf8_display = str_isutf8 (buffer);
|
||||
mc_global.utf8_display = str_isutf8 (buffer);
|
||||
#endif /* HAVE_CHARSET */
|
||||
|
||||
clipboard_store_path = mc_config_get_string (mc_main_config, "Misc", "clipboard_store", "");
|
||||
@ -1005,7 +998,7 @@ save_setup (gboolean save_options, gboolean save_panel_options)
|
||||
|
||||
#ifdef HAVE_CHARSET
|
||||
mc_config_set_string (mc_main_config, "Misc", "display_codepage",
|
||||
get_codepage_id (display_codepage));
|
||||
get_codepage_id (mc_global.display_codepage));
|
||||
mc_config_set_string (mc_main_config, "Misc", "source_codepage",
|
||||
get_codepage_id (default_source_codepage));
|
||||
mc_config_set_string (mc_main_config, "Misc", "autodetect_codeset", autodetect_codeset);
|
||||
@ -1035,9 +1028,9 @@ done_setup (void)
|
||||
g_free (clipboard_paste_path);
|
||||
g_free (profile_name);
|
||||
g_free (global_profile_name);
|
||||
g_free (color_terminal_string);
|
||||
g_free (term_color_string);
|
||||
g_free (setup_color_string);
|
||||
g_free (mc_global.tty.color_terminal_string);
|
||||
g_free (mc_global.tty.term_color_string);
|
||||
g_free (mc_global.tty.setup_color_string);
|
||||
g_free (panels_profile_name);
|
||||
mc_config_deinit (mc_main_config);
|
||||
mc_config_deinit (mc_panels_config);
|
||||
@ -1327,7 +1320,8 @@ panel_save_setup (struct WPanel *panel, const char *section)
|
||||
size_t i;
|
||||
|
||||
mc_config_set_int (mc_panels_config, section, "reverse", panel->sort_info.reverse);
|
||||
mc_config_set_int (mc_panels_config, section, "case_sensitive", panel->sort_info.case_sensitive);
|
||||
mc_config_set_int (mc_panels_config, section, "case_sensitive",
|
||||
panel->sort_info.case_sensitive);
|
||||
mc_config_set_int (mc_panels_config, section, "exec_first", panel->sort_info.exec_first);
|
||||
|
||||
mc_config_set_string (mc_panels_config, section, "sort_order", panel->sort_info.sort_field->id);
|
||||
|
@ -49,7 +49,7 @@ typedef struct
|
||||
gboolean filetype_mode; /* If TRUE then add per file type hilighting */
|
||||
gboolean permission_mode; /* If TRUE, we use permission hilighting */
|
||||
qsearch_mode_t qsearch_mode; /* Quick search mode */
|
||||
gboolean torben_fj_mode; /* If TRUE, use some usability hacks by Torben */
|
||||
gboolean torben_fj_mode; /* If TRUE, use some usability hacks by Torben */
|
||||
} panels_options_t;
|
||||
|
||||
/*** global variables defined in .c file *********************************************************/
|
||||
@ -57,15 +57,11 @@ typedef struct
|
||||
/* global paremeters */
|
||||
extern char *profile_name;
|
||||
extern char *global_profile_name;
|
||||
extern char *setup_color_string;
|
||||
extern char *term_color_string;
|
||||
extern char *color_terminal_string;
|
||||
extern int confirm_delete;
|
||||
extern int confirm_directory_hotlist_delete;
|
||||
extern int confirm_execute;
|
||||
extern int confirm_exit;
|
||||
extern int confirm_overwrite;
|
||||
extern int confirm_history_cleanup;
|
||||
extern int confirm_view_dir;
|
||||
extern int safe_delete;
|
||||
extern int clear_before_exec;
|
||||
@ -81,7 +77,6 @@ extern int option_tab_spacing;
|
||||
extern int auto_save_setup;
|
||||
extern int only_leading_plus_minus;
|
||||
extern int cd_symlinks;
|
||||
extern int show_all_if_ambiguous;
|
||||
extern int auto_fill_mkdir_name;
|
||||
extern int output_starts_shell;
|
||||
extern int use_file_to_check_type;
|
||||
|
@ -59,23 +59,11 @@
|
||||
|
||||
#include "filemanager/midnight.h" /* current_panel */
|
||||
|
||||
#include "main.h" /* home_dir */
|
||||
#include "consaver/cons.saver.h" /* handle_console() */
|
||||
#include "subshell.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
/* If using a subshell for evaluating commands this is true */
|
||||
int use_subshell =
|
||||
#ifdef SUBSHELL_OPTIONAL
|
||||
FALSE;
|
||||
#else
|
||||
TRUE;
|
||||
#endif
|
||||
|
||||
/* File descriptors of the pseudoterminal used by the subshell */
|
||||
int subshell_pty = 0;
|
||||
|
||||
/* State of the subshell:
|
||||
* INACTIVE: the default state; awaiting a command
|
||||
* ACTIVE: remain in the shell until the user hits `subshell_switch_key'
|
||||
@ -338,7 +326,7 @@ init_subshell_child (const char *pty_name)
|
||||
/* means that when MC exits, the subshell will get a SIGHUP and */
|
||||
/* exit too, because there will be no more descriptors pointing */
|
||||
/* at the master side of the pty and so it will disappear. */
|
||||
close (subshell_pty);
|
||||
close (mc_global.tty.subshell_pty);
|
||||
|
||||
/* Execute the subshell at last */
|
||||
|
||||
@ -469,9 +457,9 @@ feed_subshell (int how, int fail_on_error)
|
||||
/* Prepare the file-descriptor set and call `select' */
|
||||
|
||||
FD_ZERO (&read_set);
|
||||
FD_SET (subshell_pty, &read_set);
|
||||
FD_SET (mc_global.tty.subshell_pty, &read_set);
|
||||
FD_SET (subshell_pipe[READ], &read_set);
|
||||
maxfdp = max (subshell_pty, subshell_pipe[READ]);
|
||||
maxfdp = max (mc_global.tty.subshell_pty, subshell_pipe[READ]);
|
||||
if (how == VISIBLY)
|
||||
{
|
||||
FD_SET (STDIN_FILENO, &read_set);
|
||||
@ -490,7 +478,7 @@ feed_subshell (int how, int fail_on_error)
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (FD_ISSET (subshell_pty, &read_set))
|
||||
if (FD_ISSET (mc_global.tty.subshell_pty, &read_set))
|
||||
/* Read from the subshell, write to stdout */
|
||||
|
||||
/* This loop improves performance by reducing context switches
|
||||
@ -498,7 +486,7 @@ feed_subshell (int how, int fail_on_error)
|
||||
randomly, because of an apparent Linux bug. Investigate. */
|
||||
/* for (i=0; i<5; ++i) * FIXME -- experimental */
|
||||
{
|
||||
bytes = read (subshell_pty, pty_buffer, sizeof (pty_buffer));
|
||||
bytes = read (mc_global.tty.subshell_pty, pty_buffer, sizeof (pty_buffer));
|
||||
|
||||
/* The subshell has died */
|
||||
if (bytes == -1 && errno == EIO && !subshell_alive)
|
||||
@ -554,13 +542,13 @@ feed_subshell (int how, int fail_on_error)
|
||||
for (i = 0; i < bytes; ++i)
|
||||
if (pty_buffer[i] == subshell_switch_key)
|
||||
{
|
||||
write_all (subshell_pty, pty_buffer, i);
|
||||
write_all (mc_global.tty.subshell_pty, pty_buffer, i);
|
||||
if (subshell_ready)
|
||||
subshell_state = INACTIVE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
write_all (subshell_pty, pty_buffer, bytes);
|
||||
write_all (mc_global.tty.subshell_pty, pty_buffer, bytes);
|
||||
|
||||
if (pty_buffer[bytes - 1] == '\n' || pty_buffer[bytes - 1] == '\r')
|
||||
subshell_ready = FALSE;
|
||||
@ -770,7 +758,7 @@ pty_open_slave (const char *pty_name)
|
||||
*
|
||||
* Possibly modifies the global variables:
|
||||
* subshell_type, subshell_alive, subshell_stopped, subshell_pid
|
||||
* use_subshell - Is set to FALSE if we can't run the subshell
|
||||
* mc_global.tty.use_subshell - Is set to FALSE if we can't run the subshell
|
||||
* quit - Can be set to SUBSHELL_EXIT by the SIGCHLD handler
|
||||
*/
|
||||
|
||||
@ -784,11 +772,11 @@ init_subshell (void)
|
||||
switch (check_sid ())
|
||||
{
|
||||
case 1:
|
||||
use_subshell = FALSE;
|
||||
mc_global.tty.use_subshell = FALSE;
|
||||
return;
|
||||
case 2:
|
||||
use_subshell = FALSE;
|
||||
midnight_shutdown = 1;
|
||||
mc_global.tty.use_subshell = FALSE;
|
||||
mc_global.widget.midnight_shutdown = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -796,7 +784,7 @@ init_subshell (void)
|
||||
/* a raw mode based on it now, before we do anything else with it */
|
||||
init_raw_mode ();
|
||||
|
||||
if (subshell_pty == 0)
|
||||
if (mc_global.tty.subshell_pty == 0)
|
||||
{ /* First time through */
|
||||
/* Find out what type of shell we have */
|
||||
|
||||
@ -812,7 +800,7 @@ init_subshell (void)
|
||||
subshell_type = FISH;
|
||||
else
|
||||
{
|
||||
use_subshell = FALSE;
|
||||
mc_global.tty.use_subshell = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -820,11 +808,11 @@ init_subshell (void)
|
||||
|
||||
/* FIXME: We may need to open a fresh pty each time on SVR4 */
|
||||
|
||||
subshell_pty = pty_open_master (pty_name);
|
||||
if (subshell_pty == -1)
|
||||
mc_global.tty.subshell_pty = pty_open_master (pty_name);
|
||||
if (mc_global.tty.subshell_pty == -1)
|
||||
{
|
||||
fprintf (stderr, "Cannot open master side of pty: %s\r\n", unix_error_string (errno));
|
||||
use_subshell = FALSE;
|
||||
mc_global.tty.use_subshell = FALSE;
|
||||
return;
|
||||
}
|
||||
subshell_pty_slave = pty_open_slave (pty_name);
|
||||
@ -832,7 +820,7 @@ init_subshell (void)
|
||||
{
|
||||
fprintf (stderr, "Cannot open slave side of pty %s: %s\r\n",
|
||||
pty_name, unix_error_string (errno));
|
||||
use_subshell = FALSE;
|
||||
mc_global.tty.use_subshell = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -845,7 +833,7 @@ init_subshell (void)
|
||||
if (mkfifo (tcsh_fifo, 0600) == -1)
|
||||
{
|
||||
fprintf (stderr, "mkfifo(%s) failed: %s\r\n", tcsh_fifo, unix_error_string (errno));
|
||||
use_subshell = FALSE;
|
||||
mc_global.tty.use_subshell = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -856,14 +844,14 @@ init_subshell (void)
|
||||
{
|
||||
fprintf (stderr, _("Cannot open named pipe %s\n"), tcsh_fifo);
|
||||
perror (__FILE__ ": open");
|
||||
use_subshell = FALSE;
|
||||
mc_global.tty.use_subshell = FALSE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else /* subshell_type is BASH or ZSH */ if (pipe (subshell_pipe))
|
||||
{
|
||||
perror (__FILE__ ": couldn't create pipe");
|
||||
use_subshell = FALSE;
|
||||
mc_global.tty.use_subshell = FALSE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -914,7 +902,7 @@ init_subshell (void)
|
||||
break;
|
||||
|
||||
}
|
||||
write_all (subshell_pty, precmd, strlen (precmd));
|
||||
write_all (mc_global.tty.subshell_pty, precmd, strlen (precmd));
|
||||
|
||||
/* Wait until the subshell has started up and processed the command */
|
||||
|
||||
@ -922,11 +910,11 @@ init_subshell (void)
|
||||
tty_enable_interrupt_key ();
|
||||
if (!feed_subshell (QUIETLY, TRUE))
|
||||
{
|
||||
use_subshell = FALSE;
|
||||
mc_global.tty.use_subshell = FALSE;
|
||||
}
|
||||
tty_disable_interrupt_key ();
|
||||
if (!subshell_alive)
|
||||
use_subshell = FALSE; /* Subshell died instantly, so don't use it */
|
||||
mc_global.tty.use_subshell = FALSE; /* Subshell died instantly, so don't use it */
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -951,16 +939,16 @@ invoke_subshell (const char *command, int how, char **new_dir)
|
||||
/* FIXME: possibly take out this hack; the user can
|
||||
re-play it by hitting C-hyphen a few times! */
|
||||
if (subshell_ready)
|
||||
write_all (subshell_pty, " \b", 2); /* Hack to make prompt reappear */
|
||||
write_all (mc_global.tty.subshell_pty, " \b", 2); /* Hack to make prompt reappear */
|
||||
}
|
||||
}
|
||||
else /* MC has passed us a user command */
|
||||
{
|
||||
if (how == QUIETLY)
|
||||
write_all (subshell_pty, " ", 1);
|
||||
write_all (mc_global.tty.subshell_pty, " ", 1);
|
||||
/* FIXME: if command is long (>8KB ?) we go comma */
|
||||
write_all (subshell_pty, command, strlen (command));
|
||||
write_all (subshell_pty, "\n", 1);
|
||||
write_all (mc_global.tty.subshell_pty, command, strlen (command));
|
||||
write_all (mc_global.tty.subshell_pty, "\n", 1);
|
||||
subshell_state = RUNNING_COMMAND;
|
||||
subshell_ready = FALSE;
|
||||
}
|
||||
@ -973,7 +961,7 @@ invoke_subshell (const char *command, int how, char **new_dir)
|
||||
g_free (pcwd);
|
||||
|
||||
/* Restart the subshell if it has died by SIGHUP, SIGQUIT, etc. */
|
||||
while (!subshell_alive && quit == 0 && use_subshell)
|
||||
while (!subshell_alive && quit == 0 && mc_global.tty.use_subshell)
|
||||
init_subshell ();
|
||||
|
||||
prompt_pos = 0;
|
||||
@ -993,7 +981,7 @@ read_subshell_prompt (void)
|
||||
|
||||
fd_set tmp;
|
||||
FD_ZERO (&tmp);
|
||||
FD_SET (subshell_pty, &tmp);
|
||||
FD_SET (mc_global.tty.subshell_pty, &tmp);
|
||||
|
||||
if (subshell_prompt == NULL)
|
||||
{ /* First time through */
|
||||
@ -1002,7 +990,8 @@ read_subshell_prompt (void)
|
||||
prompt_pos = 0;
|
||||
}
|
||||
|
||||
while (subshell_alive && (rc = select (subshell_pty + 1, &tmp, NULL, NULL, &timeleft)))
|
||||
while (subshell_alive
|
||||
&& (rc = select (mc_global.tty.subshell_pty + 1, &tmp, NULL, NULL, &timeleft)))
|
||||
{
|
||||
/* Check for `select' errors */
|
||||
if (rc == -1)
|
||||
@ -1016,7 +1005,7 @@ read_subshell_prompt (void)
|
||||
}
|
||||
}
|
||||
|
||||
bytes = read (subshell_pty, pty_buffer, sizeof (pty_buffer));
|
||||
bytes = read (mc_global.tty.subshell_pty, pty_buffer, sizeof (pty_buffer));
|
||||
|
||||
/* Extract the prompt from the shell output */
|
||||
|
||||
@ -1075,15 +1064,15 @@ resize_tty (int fd)
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/** Resize subshell_pty */
|
||||
/** Resize mc_global.tty.subshell_pty */
|
||||
|
||||
void
|
||||
resize_subshell (void)
|
||||
{
|
||||
if (use_subshell == 0)
|
||||
if (!mc_global.tty.use_subshell)
|
||||
return;
|
||||
|
||||
resize_tty (subshell_pty);
|
||||
resize_tty (mc_global.tty.subshell_pty);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -1228,7 +1217,7 @@ do_subshell_chdir (const char *directory, gboolean update_prompt, gboolean reset
|
||||
|
||||
/* The initial space keeps this out of the command history (in bash
|
||||
because we set "HISTCONTROL=ignorespace") */
|
||||
write_all (subshell_pty, " cd ", 4);
|
||||
write_all (mc_global.tty.subshell_pty, " cd ", 4);
|
||||
if (*directory)
|
||||
{
|
||||
translate = vfs_translate_path_n (directory);
|
||||
@ -1237,27 +1226,27 @@ do_subshell_chdir (const char *directory, gboolean update_prompt, gboolean reset
|
||||
temp = subshell_name_quote (translate);
|
||||
if (temp)
|
||||
{
|
||||
write_all (subshell_pty, temp, strlen (temp));
|
||||
write_all (mc_global.tty.subshell_pty, temp, strlen (temp));
|
||||
g_free (temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Should not happen unless the directory name is so long
|
||||
that we don't have memory to quote it. */
|
||||
write_all (subshell_pty, ".", 1);
|
||||
write_all (mc_global.tty.subshell_pty, ".", 1);
|
||||
}
|
||||
g_free (translate);
|
||||
}
|
||||
else
|
||||
{
|
||||
write_all (subshell_pty, ".", 1);
|
||||
write_all (mc_global.tty.subshell_pty, ".", 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
write_all (subshell_pty, "/", 1);
|
||||
write_all (mc_global.tty.subshell_pty, "/", 1);
|
||||
}
|
||||
write_all (subshell_pty, "\n", 1);
|
||||
write_all (mc_global.tty.subshell_pty, "\n", 1);
|
||||
|
||||
subshell_state = RUNNING_COMMAND;
|
||||
feed_subshell (QUIETLY, FALSE);
|
||||
@ -1308,7 +1297,7 @@ subshell_get_console_attributes (void)
|
||||
if (tcgetattr (STDOUT_FILENO, &shell_mode))
|
||||
{
|
||||
fprintf (stderr, "Cannot get terminal settings: %s\r\n", unix_error_string (errno));
|
||||
use_subshell = FALSE;
|
||||
mc_global.tty.use_subshell = FALSE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1349,7 +1338,7 @@ sigchld_handler (int sig)
|
||||
{
|
||||
/* The subshell has either exited normally or been killed */
|
||||
subshell_alive = FALSE;
|
||||
delete_select_channel (subshell_pty);
|
||||
delete_select_channel (mc_global.tty.subshell_pty);
|
||||
if (WIFEXITED (status) && WEXITSTATUS (status) != FORK_FAILURE)
|
||||
quit |= SUBSHELL_EXIT; /* Exited normally */
|
||||
}
|
||||
@ -1367,7 +1356,7 @@ sigchld_handler (int sig)
|
||||
{
|
||||
/* cons.saver has died - disable confole saving */
|
||||
handle_console (CONSOLE_DONE);
|
||||
console_flag = 0;
|
||||
mc_global.tty.console_flag = '\0';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,12 +35,6 @@ enum
|
||||
|
||||
/*** global variables defined in .c file *********************************************************/
|
||||
|
||||
/* If using a subshell for evaluating commands this is true */
|
||||
extern int use_subshell;
|
||||
|
||||
/* File descriptor of the pseudoterminal used by the subshell */
|
||||
extern int subshell_pty;
|
||||
|
||||
extern enum subshell_state_enum subshell_state;
|
||||
|
||||
/* Holds the latest prompt captured from the subshell */
|
||||
@ -60,8 +54,6 @@ void do_subshell_chdir (const char *directory, gboolean update_prompt, gboolean
|
||||
void subshell_get_console_attributes (void);
|
||||
void sigchld_handler (int sig);
|
||||
|
||||
#else /* not HAVE_SUBSHELL_SUPPORT */
|
||||
#define use_subshell 0
|
||||
#endif /* HAVE_SUBSHELL_SUPPORT */
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
|
@ -663,7 +663,7 @@ ftpfs_load_no_proxy_list (void)
|
||||
if (mc_file)
|
||||
return;
|
||||
|
||||
mc_file = concat_dir_and_file (mc_sysconfig_dir, "mc.no_proxy");
|
||||
mc_file = concat_dir_and_file (mc_global.sysconfig_dir, "mc.no_proxy");
|
||||
if (exist_file (mc_file))
|
||||
{
|
||||
npf = fopen (mc_file, "r");
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include "lib/util.h"
|
||||
#include "lib/widget.h" /* D_ERROR, D_NORMAL */
|
||||
|
||||
#include "src/main.h" /* mc_sysconfig_dir */
|
||||
#include "src/execute.h" /* EXECUTE_AS_SHELL */
|
||||
|
||||
#include "lib/vfs/vfs.h"
|
||||
@ -417,7 +416,7 @@ sfs_init (struct vfs_class *me)
|
||||
|
||||
(void) me;
|
||||
|
||||
mc_sfsini = g_build_filename (mc_sysconfig_dir, "sfs.ini", (char *) NULL);
|
||||
mc_sfsini = g_build_filename (mc_global.sysconfig_dir, "sfs.ini", (char *) NULL);
|
||||
cfg = fopen (mc_sfsini, "r");
|
||||
|
||||
if (cfg == NULL)
|
||||
|
@ -66,7 +66,6 @@
|
||||
#include "src/execute.h"
|
||||
#include "src/help.h"
|
||||
#include "src/keybind-defaults.h"
|
||||
#include "src/main.h" /* midnight_shutdown */
|
||||
|
||||
#include "internal.h"
|
||||
#include "mcviewer.h"
|
||||
@ -494,7 +493,7 @@ mcview_callback (Widget * w, widget_msg_t msg, int parm)
|
||||
{
|
||||
delete_hook (&select_file_hook, mcview_hook);
|
||||
|
||||
if (midnight_shutdown)
|
||||
if (mc_global.widget.midnight_shutdown)
|
||||
mcview_ok_to_quit (view);
|
||||
}
|
||||
mcview_done (view);
|
||||
@ -525,7 +524,7 @@ mcview_dialog_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm,
|
||||
|
||||
case DLG_VALIDATE:
|
||||
view = (mcview_t *) find_widget_type (h, mcview_callback);
|
||||
h->state = DLG_ACTIVE; /* don't stop the dialog before final decision */
|
||||
h->state = DLG_ACTIVE; /* don't stop the dialog before final decision */
|
||||
if (mcview_ok_to_quit (view))
|
||||
h->state = DLG_CLOSED;
|
||||
else
|
||||
|
@ -158,7 +158,7 @@ mcview_display_status (mcview_t * view)
|
||||
tty_printf ("%9" PRIuMAX "/%s%s %s", (uintmax_t) view->dpy_end,
|
||||
buffer, mcview_may_still_grow (view) ? "+" : " ",
|
||||
#ifdef HAVE_CHARSET
|
||||
source_codepage >= 0 ? get_codepage_id (source_codepage) : ""
|
||||
mc_global.source_codepage >= 0 ? get_codepage_id (mc_global.source_codepage) : ""
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
|
@ -49,8 +49,6 @@
|
||||
#include "lib/widget.h"
|
||||
#include "lib/charsets.h"
|
||||
|
||||
#include "src/main.h"
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
@ -285,7 +283,7 @@ mcview_display_hex (mcview_t * view)
|
||||
|
||||
|
||||
#ifdef HAVE_CHARSET
|
||||
if (utf8_display)
|
||||
if (mc_global.utf8_display)
|
||||
{
|
||||
if (!view->utf8)
|
||||
{
|
||||
|
@ -149,7 +149,7 @@ mcview_ok_to_quit (mcview_t * view)
|
||||
if (view->change_list == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (!midnight_shutdown)
|
||||
if (!mc_global.widget.midnight_shutdown)
|
||||
{
|
||||
query_set_sel (2);
|
||||
r = query_dialog (_("Quit"),
|
||||
@ -169,7 +169,7 @@ mcview_ok_to_quit (mcview_t * view)
|
||||
switch (r)
|
||||
{
|
||||
case 0: /* Yes */
|
||||
return mcview_hexedit_save_changes (view) || midnight_shutdown;
|
||||
return mcview_hexedit_save_changes (view) || mc_global.widget.midnight_shutdown;
|
||||
case 1: /* No */
|
||||
mcview_hexedit_free_change_list (view);
|
||||
return TRUE;
|
||||
@ -290,7 +290,7 @@ mcview_set_codeset (mcview_t * view)
|
||||
const char *cp_id = NULL;
|
||||
|
||||
view->utf8 = TRUE;
|
||||
cp_id = get_codepage_id (source_codepage >= 0 ? source_codepage : display_codepage);
|
||||
cp_id = get_codepage_id (mc_global.source_codepage >= 0 ? mc_global.source_codepage : mc_global.display_codepage);
|
||||
if (cp_id != NULL)
|
||||
{
|
||||
GIConv conv;
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "lib/skin.h"
|
||||
#include "lib/charsets.h"
|
||||
|
||||
#include "src/main.h" /* utf8_display */
|
||||
#include "src/setup.h" /* option_tab_spacing */
|
||||
|
||||
#include "internal.h"
|
||||
@ -181,7 +180,7 @@ mcview_display_nroff (mcview_t * view)
|
||||
{
|
||||
widget_move (view, top + row, left + ((off_t) col - view->dpy_text_column));
|
||||
#ifdef HAVE_CHARSET
|
||||
if (utf8_display)
|
||||
if (mc_global.utf8_display)
|
||||
{
|
||||
if (!view->utf8)
|
||||
{
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include "lib/util.h" /* is_printable() */
|
||||
#include "lib/charsets.h"
|
||||
|
||||
#include "src/main.h" /* utf8_display */
|
||||
#include "src/setup.h" /* option_tab_spacing */
|
||||
|
||||
#include "internal.h"
|
||||
@ -159,7 +158,7 @@ mcview_display_text (mcview_t * view)
|
||||
{
|
||||
widget_move (view, top + row, left + ((off_t) col - view->dpy_text_column));
|
||||
#ifdef HAVE_CHARSET
|
||||
if (utf8_display)
|
||||
if (mc_global.utf8_display)
|
||||
{
|
||||
if (!view->utf8)
|
||||
c = convert_from_8bit_to_utf_c ((unsigned char) c, view->converter);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user