Code cleanup after runing splint on src/main.c file
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Этот коммит содержится в:
родитель
1e9a3f5d2f
Коммит
a1e34b8dfa
@ -93,7 +93,7 @@ convert_to_display_c (int c)
|
|||||||
{
|
{
|
||||||
if (c < 0 || c >= 256)
|
if (c < 0 || c >= 256)
|
||||||
return c;
|
return c;
|
||||||
return conv_displ[c];
|
return (int) conv_displ[c];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
@ -101,7 +101,7 @@ convert_from_input_c (int c)
|
|||||||
{
|
{
|
||||||
if (c < 0 || c >= 256)
|
if (c < 0 || c >= 256)
|
||||||
return c;
|
return c;
|
||||||
return conv_input[c];
|
return (int) conv_input[c];
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_CHARSET */
|
#endif /* HAVE_CHARSET */
|
||||||
|
1
lib/fs.h
1
lib/fs.h
@ -88,6 +88,7 @@ static inline void
|
|||||||
compute_namelen (struct dirent *dent __attribute__ ((unused)))
|
compute_namelen (struct dirent *dent __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
#ifdef DIRENT_LENGTH_COMPUTED
|
#ifdef DIRENT_LENGTH_COMPUTED
|
||||||
|
(void) dent;
|
||||||
return;
|
return;
|
||||||
#else
|
#else
|
||||||
dent->d_namlen = strlen (dent);
|
dent->d_namlen = strlen (dent);
|
||||||
|
@ -104,6 +104,7 @@ mc_global_t mc_global = {
|
|||||||
.disable_colors = FALSE,
|
.disable_colors = FALSE,
|
||||||
.ugly_line_drawing = FALSE,
|
.ugly_line_drawing = FALSE,
|
||||||
.old_mouse = FALSE,
|
.old_mouse = FALSE,
|
||||||
|
.alternate_plus_minus = FALSE,
|
||||||
},
|
},
|
||||||
|
|
||||||
.vfs =
|
.vfs =
|
||||||
|
@ -258,6 +258,11 @@ typedef struct
|
|||||||
|
|
||||||
/* Tries to use old highlight mouse tracking */
|
/* Tries to use old highlight mouse tracking */
|
||||||
gboolean old_mouse;
|
gboolean old_mouse;
|
||||||
|
|
||||||
|
/* If true, use + and \ keys normally and select/unselect do if M-+ / M-\.
|
||||||
|
and M-- and keypad + / - */
|
||||||
|
gboolean alternate_plus_minus;
|
||||||
|
|
||||||
} tty;
|
} tty;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
|
@ -75,10 +75,6 @@
|
|||||||
|
|
||||||
/*** global variables ****************************************************************************/
|
/*** global variables ****************************************************************************/
|
||||||
|
|
||||||
/* If true, use + and \ keys normally and select/unselect do if M-+ / M-\.
|
|
||||||
and M-- and keypad + / - */
|
|
||||||
int alternate_plus_minus = 0;
|
|
||||||
|
|
||||||
int mou_auto_repeat = 100;
|
int mou_auto_repeat = 100;
|
||||||
int double_click_speed = 250;
|
int double_click_speed = 250;
|
||||||
int old_esc_mode = 0;
|
int old_esc_mode = 0;
|
||||||
@ -1058,7 +1054,7 @@ correct_key_code (int code)
|
|||||||
mod &= ~KEY_M_SHIFT;
|
mod &= ~KEY_M_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!alternate_plus_minus)
|
if (!mc_global.tty.alternate_plus_minus)
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case KEY_KP_ADD:
|
case KEY_KP_ADD:
|
||||||
@ -2102,7 +2098,7 @@ learn_key (void)
|
|||||||
void
|
void
|
||||||
numeric_keypad_mode (void)
|
numeric_keypad_mode (void)
|
||||||
{
|
{
|
||||||
if (mc_global.tty.console_flag || mc_global.tty.xterm_flag)
|
if (mc_global.tty.console_flag != '\0' || mc_global.tty.xterm_flag)
|
||||||
{
|
{
|
||||||
fputs (ESC_STR ">", stdout);
|
fputs (ESC_STR ">", stdout);
|
||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
@ -2114,7 +2110,7 @@ numeric_keypad_mode (void)
|
|||||||
void
|
void
|
||||||
application_keypad_mode (void)
|
application_keypad_mode (void)
|
||||||
{
|
{
|
||||||
if (mc_global.tty.console_flag || mc_global.tty.xterm_flag)
|
if (mc_global.tty.console_flag != '\0' || mc_global.tty.xterm_flag)
|
||||||
{
|
{
|
||||||
fputs (ESC_STR "=", stdout);
|
fputs (ESC_STR "=", stdout);
|
||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
|
@ -53,7 +53,6 @@ extern const key_code_name_t key_name_conv_tab[];
|
|||||||
|
|
||||||
extern int old_esc_mode_timeout;
|
extern int old_esc_mode_timeout;
|
||||||
|
|
||||||
extern int alternate_plus_minus;
|
|
||||||
extern int double_click_speed;
|
extern int double_click_speed;
|
||||||
extern int old_esc_mode;
|
extern int old_esc_mode;
|
||||||
extern int use_8th_bit_as_meta;
|
extern int use_8th_bit_as_meta;
|
||||||
@ -104,7 +103,7 @@ void application_keypad_mode (void);
|
|||||||
static inline gboolean
|
static inline gboolean
|
||||||
is_abort_char (int c)
|
is_abort_char (int c)
|
||||||
{
|
{
|
||||||
return ((c == ESC_CHAR) || (c == KEY_F (10)));
|
return ((c == (int) ESC_CHAR) || (c == (int) KEY_F (10)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* MC_KEY_H */
|
#endif /* MC_KEY_H */
|
||||||
|
@ -88,7 +88,7 @@ show_console_contents_linux (int starty, unsigned char begin_line, unsigned char
|
|||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
/* Is tty console? */
|
/* Is tty console? */
|
||||||
if (!mc_global.tty.console_flag)
|
if (mc_global.tty.console_flag == '\0')
|
||||||
return;
|
return;
|
||||||
/* Paranoid: Is the cons.saver still running? */
|
/* Paranoid: Is the cons.saver still running? */
|
||||||
if (cons_saver_pid < 1 || kill (cons_saver_pid, SIGCONT))
|
if (cons_saver_pid < 1 || kill (cons_saver_pid, SIGCONT))
|
||||||
@ -128,7 +128,7 @@ show_console_contents_linux (int starty, unsigned char begin_line, unsigned char
|
|||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_console_linux (unsigned char action)
|
handle_console_linux (console_action_t action)
|
||||||
{
|
{
|
||||||
char *tty_name;
|
char *tty_name;
|
||||||
char *mc_conssaver;
|
char *mc_conssaver;
|
||||||
@ -166,7 +166,7 @@ handle_console_linux (unsigned char action)
|
|||||||
status = close (pipefd2[1]);
|
status = close (pipefd2[1]);
|
||||||
/* Was the child successful? */
|
/* Was the child successful? */
|
||||||
status = read (pipefd2[0], &mc_global.tty.console_flag, 1);
|
status = read (pipefd2[0], &mc_global.tty.console_flag, 1);
|
||||||
if (!mc_global.tty.console_flag)
|
if (mc_global.tty.console_flag == '\0')
|
||||||
{
|
{
|
||||||
pid_t ret;
|
pid_t ret;
|
||||||
status = close (pipefd1[1]);
|
status = close (pipefd1[1]);
|
||||||
@ -216,7 +216,7 @@ handle_console_linux (unsigned char action)
|
|||||||
case CONSOLE_SAVE:
|
case CONSOLE_SAVE:
|
||||||
case CONSOLE_RESTORE:
|
case CONSOLE_RESTORE:
|
||||||
/* Is tty console? */
|
/* Is tty console? */
|
||||||
if (!mc_global.tty.console_flag)
|
if (mc_global.tty.console_flag == '\0')
|
||||||
return;
|
return;
|
||||||
/* Paranoid: Is the cons.saver still running? */
|
/* Paranoid: Is the cons.saver still running? */
|
||||||
if (cons_saver_pid < 1 || kill (cons_saver_pid, SIGCONT))
|
if (cons_saver_pid < 1 || kill (cons_saver_pid, SIGCONT))
|
||||||
@ -232,7 +232,7 @@ handle_console_linux (unsigned char action)
|
|||||||
/* Wait the console handler to do its job */
|
/* Wait the console handler to do its job */
|
||||||
status = read (pipefd2[0], &mc_global.tty.console_flag, 1);
|
status = read (pipefd2[0], &mc_global.tty.console_flag, 1);
|
||||||
}
|
}
|
||||||
if (action == CONSOLE_DONE || !mc_global.tty.console_flag)
|
if (action == CONSOLE_DONE || mc_global.tty.console_flag == '\0')
|
||||||
{
|
{
|
||||||
/* We are done -> Let's clean up */
|
/* We are done -> Let's clean up */
|
||||||
pid_t ret;
|
pid_t ret;
|
||||||
@ -242,6 +242,8 @@ handle_console_linux (unsigned char action)
|
|||||||
mc_global.tty.console_flag = '\0';
|
mc_global.tty.console_flag = '\0';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +258,7 @@ handle_console_linux (unsigned char action)
|
|||||||
static void
|
static void
|
||||||
console_init (void)
|
console_init (void)
|
||||||
{
|
{
|
||||||
if (mc_global.tty.console_flag)
|
if (mc_global.tty.console_flag != '\0')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
screen_info.size = sizeof (screen_info);
|
screen_info.size = sizeof (screen_info);
|
||||||
@ -297,7 +299,7 @@ console_restore (void)
|
|||||||
{
|
{
|
||||||
int i, last;
|
int i, last;
|
||||||
|
|
||||||
if (!mc_global.tty.console_flag)
|
if (mc_global.tty.console_flag == '\0')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cursor_to (0, 0);
|
cursor_to (0, 0);
|
||||||
@ -321,7 +323,7 @@ console_restore (void)
|
|||||||
static void
|
static void
|
||||||
console_shutdown (void)
|
console_shutdown (void)
|
||||||
{
|
{
|
||||||
if (!mc_global.tty.console_flag)
|
if (mc_global.tty.console_flag == '\0')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_free (screen_shot.buf);
|
g_free (screen_shot.buf);
|
||||||
@ -338,7 +340,7 @@ console_save (void)
|
|||||||
scrmap_t map;
|
scrmap_t map;
|
||||||
scrmap_t revmap;
|
scrmap_t revmap;
|
||||||
|
|
||||||
if (!mc_global.tty.console_flag)
|
if (mc_global.tty.console_flag == '\0')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* screen_info.size is already set in console_init() */
|
/* screen_info.size is already set in console_init() */
|
||||||
@ -376,8 +378,8 @@ console_save (void)
|
|||||||
for (i = 0; i < screen_shot.xsize * screen_shot.ysize; i++)
|
for (i = 0; i < screen_shot.xsize * screen_shot.ysize; i++)
|
||||||
{
|
{
|
||||||
screen_shot.buf[i] =
|
screen_shot.buf[i] =
|
||||||
(screen_shot.buf[i] & 0xff00) | (unsigned char) revmap.
|
(screen_shot.buf[i] & 0xff00) | (unsigned char) revmap.scrmap[screen_shot.
|
||||||
scrmap[screen_shot.buf[i] & 0xff];
|
buf[i] & 0xff];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,7 +391,7 @@ show_console_contents_freebsd (int starty, unsigned char begin_line, unsigned ch
|
|||||||
int col, line;
|
int col, line;
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
if (!mc_global.tty.console_flag)
|
if (mc_global.tty.console_flag == '\0')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (line = begin_line; line <= end_line; line++)
|
for (line = begin_line; line <= end_line; line++)
|
||||||
@ -406,7 +408,7 @@ show_console_contents_freebsd (int starty, unsigned char begin_line, unsigned ch
|
|||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_console_freebsd (unsigned char action)
|
handle_console_freebsd (console_action_t action)
|
||||||
{
|
{
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
@ -425,6 +427,8 @@ handle_console_freebsd (unsigned char action)
|
|||||||
case CONSOLE_RESTORE:
|
case CONSOLE_RESTORE:
|
||||||
console_restore ();
|
console_restore ();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* __FreeBSD__ */
|
#endif /* __FreeBSD__ */
|
||||||
@ -455,7 +459,7 @@ show_console_contents (int starty, unsigned char begin_line, unsigned char end_l
|
|||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void
|
void
|
||||||
handle_console (unsigned char action)
|
handle_console (console_action_t action)
|
||||||
{
|
{
|
||||||
(void) action;
|
(void) action;
|
||||||
|
|
||||||
|
@ -16,14 +16,14 @@
|
|||||||
|
|
||||||
/*** enums ***************************************************************************************/
|
/*** enums ***************************************************************************************/
|
||||||
|
|
||||||
enum
|
typedef enum
|
||||||
{
|
{
|
||||||
CONSOLE_INIT = '1',
|
CONSOLE_INIT = '1',
|
||||||
CONSOLE_DONE,
|
CONSOLE_DONE,
|
||||||
CONSOLE_SAVE,
|
CONSOLE_SAVE,
|
||||||
CONSOLE_RESTORE,
|
CONSOLE_RESTORE,
|
||||||
CONSOLE_CONTENTS
|
CONSOLE_CONTENTS
|
||||||
};
|
} console_action_t;
|
||||||
|
|
||||||
/*** structures declarations (and typedefs of structures)*****************************************/
|
/*** structures declarations (and typedefs of structures)*****************************************/
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ extern int cons_saver_pid;
|
|||||||
#ifndef LINUX_CONS_SAVER_C
|
#ifndef LINUX_CONS_SAVER_C
|
||||||
/* Used only in mc, not in cons.saver */
|
/* Used only in mc, not in cons.saver */
|
||||||
void show_console_contents (int starty, unsigned char begin_line, unsigned char end_line);
|
void show_console_contents (int starty, unsigned char begin_line, unsigned char end_line);
|
||||||
void handle_console (unsigned char action);
|
void handle_console (console_action_t action);
|
||||||
#endif /* !LINUX_CONS_SAVER_C */
|
#endif /* !LINUX_CONS_SAVER_C */
|
||||||
|
|
||||||
/*** inline functions ****************************************************************************/
|
/*** inline functions ****************************************************************************/
|
||||||
|
@ -68,7 +68,7 @@ edition_post_exec (void)
|
|||||||
tty_raw_mode ();
|
tty_raw_mode ();
|
||||||
channels_up ();
|
channels_up ();
|
||||||
enable_mouse ();
|
enable_mouse ();
|
||||||
if (alternate_plus_minus)
|
if (mc_global.tty.alternate_plus_minus)
|
||||||
application_keypad_mode ();
|
application_keypad_mode ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ edition_pre_exec (void)
|
|||||||
clr_scr ();
|
clr_scr ();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!(mc_global.tty.console_flag || mc_global.tty.xterm_flag))
|
if (!(mc_global.tty.console_flag != '\0' || mc_global.tty.xterm_flag))
|
||||||
printf ("\n\n");
|
printf ("\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ do_execute (const char *lc_shell, const char *command, int flags)
|
|||||||
if (mc_global.mc_run_mode == MC_RUN_FULL)
|
if (mc_global.mc_run_mode == MC_RUN_FULL)
|
||||||
save_cwds_stat ();
|
save_cwds_stat ();
|
||||||
pre_exec ();
|
pre_exec ();
|
||||||
if (mc_global.tty.console_flag)
|
if (mc_global.tty.console_flag != '\0')
|
||||||
handle_console (CONSOLE_RESTORE);
|
handle_console (CONSOLE_RESTORE);
|
||||||
|
|
||||||
if (!mc_global.tty.use_subshell && command && !(flags & EXECUTE_INTERNAL))
|
if (!mc_global.tty.use_subshell && command && !(flags & EXECUTE_INTERNAL))
|
||||||
@ -159,7 +159,7 @@ do_execute (const char *lc_shell, const char *command, int flags)
|
|||||||
{
|
{
|
||||||
if ((pause_after_run == pause_always
|
if ((pause_after_run == pause_always
|
||||||
|| (pause_after_run == pause_on_dumb_terminals && !mc_global.tty.xterm_flag
|
|| (pause_after_run == pause_on_dumb_terminals && !mc_global.tty.xterm_flag
|
||||||
&& !mc_global.tty.console_flag)) && quit == 0
|
&& mc_global.tty.console_flag == '\0')) && quit == 0
|
||||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||||
&& subshell_state != RUNNING_COMMAND
|
&& subshell_state != RUNNING_COMMAND
|
||||||
#endif /* HAVE_SUBSHELL_SUPPORT */
|
#endif /* HAVE_SUBSHELL_SUPPORT */
|
||||||
@ -172,7 +172,7 @@ do_execute (const char *lc_shell, const char *command, int flags)
|
|||||||
printf ("\r\n");
|
printf ("\r\n");
|
||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
}
|
}
|
||||||
if (mc_global.tty.console_flag)
|
if (mc_global.tty.console_flag != '\0')
|
||||||
{
|
{
|
||||||
if (output_lines && mc_global.keybar_visible)
|
if (output_lines && mc_global.keybar_visible)
|
||||||
{
|
{
|
||||||
@ -182,7 +182,7 @@ do_execute (const char *lc_shell, const char *command, int flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mc_global.tty.console_flag)
|
if (mc_global.tty.console_flag != '\0')
|
||||||
handle_console (CONSOLE_SAVE);
|
handle_console (CONSOLE_SAVE);
|
||||||
edition_post_exec ();
|
edition_post_exec ();
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ do_suspend_cmd (void)
|
|||||||
{
|
{
|
||||||
pre_exec ();
|
pre_exec ();
|
||||||
|
|
||||||
if (mc_global.tty.console_flag && !mc_global.tty.use_subshell)
|
if (mc_global.tty.console_flag != '\0' && !mc_global.tty.use_subshell)
|
||||||
handle_console (CONSOLE_RESTORE);
|
handle_console (CONSOLE_RESTORE);
|
||||||
|
|
||||||
#ifdef SIGTSTP
|
#ifdef SIGTSTP
|
||||||
@ -234,7 +234,7 @@ do_suspend_cmd (void)
|
|||||||
}
|
}
|
||||||
#endif /* SIGTSTP */
|
#endif /* SIGTSTP */
|
||||||
|
|
||||||
if (mc_global.tty.console_flag && !mc_global.tty.use_subshell)
|
if (mc_global.tty.console_flag != '\0' && !mc_global.tty.use_subshell)
|
||||||
handle_console (CONSOLE_SAVE);
|
handle_console (CONSOLE_SAVE);
|
||||||
|
|
||||||
edition_post_exec ();
|
edition_post_exec ();
|
||||||
@ -312,7 +312,7 @@ toggle_panels (void)
|
|||||||
disable_mouse ();
|
disable_mouse ();
|
||||||
if (clear_before_exec)
|
if (clear_before_exec)
|
||||||
clr_scr ();
|
clr_scr ();
|
||||||
if (alternate_plus_minus)
|
if (mc_global.tty.alternate_plus_minus)
|
||||||
numeric_keypad_mode ();
|
numeric_keypad_mode ();
|
||||||
#ifndef HAVE_SLANG
|
#ifndef HAVE_SLANG
|
||||||
/* With slang we don't want any of this, since there
|
/* With slang we don't want any of this, since there
|
||||||
@ -325,7 +325,7 @@ toggle_panels (void)
|
|||||||
tty_reset_screen ();
|
tty_reset_screen ();
|
||||||
do_exit_ca_mode ();
|
do_exit_ca_mode ();
|
||||||
tty_raw_mode ();
|
tty_raw_mode ();
|
||||||
if (mc_global.tty.console_flag)
|
if (mc_global.tty.console_flag != '\0')
|
||||||
handle_console (CONSOLE_RESTORE);
|
handle_console (CONSOLE_RESTORE);
|
||||||
|
|
||||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||||
@ -348,7 +348,7 @@ toggle_panels (void)
|
|||||||
get_key_code (0);
|
get_key_code (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mc_global.tty.console_flag)
|
if (mc_global.tty.console_flag != '\0')
|
||||||
handle_console (CONSOLE_SAVE);
|
handle_console (CONSOLE_SAVE);
|
||||||
|
|
||||||
do_enter_ca_mode ();
|
do_enter_ca_mode ();
|
||||||
@ -374,7 +374,7 @@ toggle_panels (void)
|
|||||||
|
|
||||||
enable_mouse ();
|
enable_mouse ();
|
||||||
channels_up ();
|
channels_up ();
|
||||||
if (alternate_plus_minus)
|
if (mc_global.tty.alternate_plus_minus)
|
||||||
application_keypad_mode ();
|
application_keypad_mode ();
|
||||||
|
|
||||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||||
@ -383,7 +383,7 @@ toggle_panels (void)
|
|||||||
load_prompt (0, NULL);
|
load_prompt (0, NULL);
|
||||||
if (new_dir)
|
if (new_dir)
|
||||||
do_possible_cd (new_dir);
|
do_possible_cd (new_dir);
|
||||||
if (mc_global.tty.console_flag && output_lines)
|
if (mc_global.tty.console_flag != '\0' && output_lines)
|
||||||
show_console_contents (output_start_y,
|
show_console_contents (output_start_y,
|
||||||
LINES - mc_global.keybar_visible - output_lines -
|
LINES - mc_global.keybar_visible - output_lines -
|
||||||
1, LINES - mc_global.keybar_visible - 1);
|
1, LINES - mc_global.keybar_visible - 1);
|
||||||
|
@ -1268,8 +1268,8 @@ view_other_cmd (void)
|
|||||||
{
|
{
|
||||||
static int message_flag = TRUE;
|
static int message_flag = TRUE;
|
||||||
|
|
||||||
if (!mc_global.tty.xterm_flag && !mc_global.tty.console_flag && !mc_global.tty.use_subshell
|
if (!mc_global.tty.xterm_flag && mc_global.tty.console_flag == '\0'
|
||||||
&& !output_starts_shell)
|
&& !mc_global.tty.use_subshell && !output_starts_shell)
|
||||||
{
|
{
|
||||||
if (message_flag)
|
if (message_flag)
|
||||||
message (D_ERROR, MSG_ERROR,
|
message (D_ERROR, MSG_ERROR,
|
||||||
|
@ -356,7 +356,7 @@ exec_extension (const char *filename, const char *lc_data, int *move_dir, int st
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
shell_execute (cmd, EXECUTE_INTERNAL);
|
shell_execute (cmd, EXECUTE_INTERNAL);
|
||||||
if (mc_global.tty.console_flag)
|
if (mc_global.tty.console_flag != '\0')
|
||||||
{
|
{
|
||||||
handle_console (CONSOLE_SAVE);
|
handle_console (CONSOLE_SAVE);
|
||||||
if (output_lines && mc_global.keybar_visible)
|
if (output_lines && mc_global.keybar_visible)
|
||||||
|
@ -75,13 +75,13 @@ int first_panel_size = 0;
|
|||||||
int output_lines = 0;
|
int output_lines = 0;
|
||||||
|
|
||||||
/* Set if the command prompt is to be displayed */
|
/* Set if the command prompt is to be displayed */
|
||||||
int command_prompt = 1;
|
gboolean command_prompt = TRUE;
|
||||||
|
|
||||||
/* Set if the main menu is visible */
|
/* Set if the main menu is visible */
|
||||||
int menubar_visible = 1;
|
int menubar_visible = 1;
|
||||||
|
|
||||||
/* Set to show current working dir in xterm window title */
|
/* Set to show current working dir in xterm window title */
|
||||||
int xterm_title = 1;
|
gboolean xterm_title = TRUE;
|
||||||
|
|
||||||
/* Set to show free space on device assigned to current directory */
|
/* Set to show free space on device assigned to current directory */
|
||||||
int free_space = 1;
|
int free_space = 1;
|
||||||
@ -143,7 +143,7 @@ static int _output_lines;
|
|||||||
static int _command_prompt;
|
static int _command_prompt;
|
||||||
static int _keybar_visible;
|
static int _keybar_visible;
|
||||||
static int _message_visible;
|
static int _message_visible;
|
||||||
static int _xterm_title;
|
static gboolean _xterm_title;
|
||||||
static int _free_space;
|
static int _free_space;
|
||||||
|
|
||||||
static int height;
|
static int height;
|
||||||
@ -300,7 +300,7 @@ layout_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *d
|
|||||||
if (old_output_lines != _output_lines)
|
if (old_output_lines != _output_lines)
|
||||||
{
|
{
|
||||||
old_output_lines = _output_lines;
|
old_output_lines = _output_lines;
|
||||||
tty_setcolor (mc_global.tty.console_flag ? COLOR_NORMAL : DISABLED_COLOR);
|
tty_setcolor (mc_global.tty.console_flag != '\0' ? COLOR_NORMAL : DISABLED_COLOR);
|
||||||
dlg_move (h, 9, 5);
|
dlg_move (h, 9, 5);
|
||||||
tty_print_string (output_lines_label);
|
tty_print_string (output_lines_label);
|
||||||
dlg_move (h, 9, 5 + 3 + output_lines_label_len);
|
dlg_move (h, 9, 5 + 3 + output_lines_label_len);
|
||||||
@ -316,7 +316,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;
|
_xterm_title = check_options[1].widget->state & C_BOOL;
|
||||||
_free_space = check_options[0].widget->state & C_BOOL;
|
_free_space = check_options[0].widget->state & C_BOOL;
|
||||||
|
|
||||||
if (mc_global.tty.console_flag)
|
if (mc_global.tty.console_flag != '\0')
|
||||||
{
|
{
|
||||||
int minimum;
|
int minimum;
|
||||||
if (_output_lines < 0)
|
if (_output_lines < 0)
|
||||||
@ -337,7 +337,7 @@ layout_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *d
|
|||||||
if (old_output_lines != _output_lines)
|
if (old_output_lines != _output_lines)
|
||||||
{
|
{
|
||||||
old_output_lines = _output_lines;
|
old_output_lines = _output_lines;
|
||||||
tty_setcolor (mc_global.tty.console_flag ? COLOR_NORMAL : DISABLED_COLOR);
|
tty_setcolor (mc_global.tty.console_flag != '\0' ? COLOR_NORMAL : DISABLED_COLOR);
|
||||||
dlg_move (h, 9, 5 + 3 + output_lines_label_len);
|
dlg_move (h, 9, 5 + 3 + output_lines_label_len);
|
||||||
tty_printf ("%02d", _output_lines);
|
tty_printf ("%02d", _output_lines);
|
||||||
}
|
}
|
||||||
@ -492,7 +492,7 @@ init_layout (void)
|
|||||||
|
|
||||||
/* "Console output" groupbox */
|
/* "Console output" groupbox */
|
||||||
{
|
{
|
||||||
const int disabled = mc_global.tty.console_flag ? 0 : W_DISABLED;
|
const int disabled = mc_global.tty.console_flag != '\0' ? 0 : W_DISABLED;
|
||||||
Widget *w;
|
Widget *w;
|
||||||
|
|
||||||
w = (Widget *) button_new (9, output_lines_label_len + 5 + 5, B_MINUS,
|
w = (Widget *) button_new (9, output_lines_label_len + 5 + 5, B_MINUS,
|
||||||
@ -639,7 +639,7 @@ setup_panels (void)
|
|||||||
int start_y;
|
int start_y;
|
||||||
int promptl; /* the prompt len */
|
int promptl; /* the prompt len */
|
||||||
|
|
||||||
if (mc_global.tty.console_flag)
|
if (mc_global.tty.console_flag != '\0')
|
||||||
{
|
{
|
||||||
int minimum;
|
int minimum;
|
||||||
if (output_lines < 0)
|
if (output_lines < 0)
|
||||||
@ -705,7 +705,7 @@ setup_panels (void)
|
|||||||
buttonbar_set_visible (the_bar, mc_global.keybar_visible);
|
buttonbar_set_visible (the_bar, mc_global.keybar_visible);
|
||||||
|
|
||||||
/* Output window */
|
/* Output window */
|
||||||
if (mc_global.tty.console_flag && output_lines)
|
if (mc_global.tty.console_flag != '\0' && output_lines)
|
||||||
{
|
{
|
||||||
output_start_y = LINES - command_prompt - mc_global.keybar_visible - output_lines;
|
output_start_y = LINES - command_prompt - mc_global.keybar_visible - output_lines;
|
||||||
show_console_contents (output_start_y,
|
show_console_contents (output_start_y,
|
||||||
|
@ -21,10 +21,10 @@
|
|||||||
extern int equal_split;
|
extern int equal_split;
|
||||||
extern int first_panel_size;
|
extern int first_panel_size;
|
||||||
extern int output_lines;
|
extern int output_lines;
|
||||||
extern int command_prompt;
|
extern gboolean command_prompt;
|
||||||
extern int menubar_visible;
|
extern int menubar_visible;
|
||||||
extern int output_start_y;
|
extern int output_start_y;
|
||||||
extern int xterm_title;
|
extern gboolean xterm_title;
|
||||||
extern int free_space;
|
extern int free_space;
|
||||||
|
|
||||||
extern int horizontal_split;
|
extern int horizontal_split;
|
||||||
|
@ -1334,7 +1334,7 @@ midnight_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void
|
|||||||
case DLG_DRAW:
|
case DLG_DRAW:
|
||||||
load_hint (1);
|
load_hint (1);
|
||||||
/* We handle the special case of the output lines */
|
/* We handle the special case of the output lines */
|
||||||
if (mc_global.tty.console_flag && output_lines)
|
if (mc_global.tty.console_flag != '\0' && output_lines)
|
||||||
show_console_contents (output_start_y,
|
show_console_contents (output_start_y,
|
||||||
LINES - output_lines - mc_global.keybar_visible -
|
LINES - output_lines - mc_global.keybar_visible -
|
||||||
1, LINES - mc_global.keybar_visible - 1);
|
1, LINES - mc_global.keybar_visible - 1);
|
||||||
@ -1407,8 +1407,9 @@ midnight_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void
|
|||||||
return MSG_HANDLED;
|
return MSG_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!alternate_plus_minus || !(mc_global.tty.console_flag || mc_global.tty.xterm_flag))
|
if ((!mc_global.tty.alternate_plus_minus
|
||||||
&& !quote && !current_panel->searching)
|
|| !(mc_global.tty.console_flag != '\0' || mc_global.tty.xterm_flag)) && !quote
|
||||||
|
&& !current_panel->searching)
|
||||||
{
|
{
|
||||||
if (!only_leading_plus_minus)
|
if (!only_leading_plus_minus)
|
||||||
{
|
{
|
||||||
|
13
src/learn.c
13
src/learn.c
@ -394,21 +394,24 @@ void
|
|||||||
learn_keys (void)
|
learn_keys (void)
|
||||||
{
|
{
|
||||||
int save_old_esc_mode = old_esc_mode;
|
int save_old_esc_mode = old_esc_mode;
|
||||||
int save_alternate_plus_minus = alternate_plus_minus;
|
gboolean save_alternate_plus_minus = mc_global.tty.alternate_plus_minus;
|
||||||
|
|
||||||
old_esc_mode = 0; /* old_esc_mode cannot work in learn keys dialog */
|
/* old_esc_mode cannot work in learn keys dialog */
|
||||||
alternate_plus_minus = 1; /* don't translate KP_ADD, KP_SUBTRACT and
|
old_esc_mode = 0;
|
||||||
|
|
||||||
|
/* don't translate KP_ADD, KP_SUBTRACT and
|
||||||
KP_MULTIPLY to '+', '-' and '*' in
|
KP_MULTIPLY to '+', '-' and '*' in
|
||||||
correct_key_code */
|
correct_key_code */
|
||||||
|
mc_global.tty.alternate_plus_minus = TRUE;
|
||||||
application_keypad_mode ();
|
application_keypad_mode ();
|
||||||
init_learn ();
|
init_learn ();
|
||||||
|
|
||||||
run_dlg (learn_dlg);
|
run_dlg (learn_dlg);
|
||||||
|
|
||||||
old_esc_mode = save_old_esc_mode;
|
old_esc_mode = save_old_esc_mode;
|
||||||
alternate_plus_minus = save_alternate_plus_minus;
|
mc_global.tty.alternate_plus_minus = save_alternate_plus_minus;
|
||||||
|
|
||||||
if (!alternate_plus_minus)
|
if (!mc_global.tty.alternate_plus_minus)
|
||||||
numeric_keypad_mode ();
|
numeric_keypad_mode ();
|
||||||
|
|
||||||
switch (learn_dlg->ret_value)
|
switch (learn_dlg->ret_value)
|
||||||
|
41
src/main.c
41
src/main.c
@ -32,12 +32,9 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <pwd.h> /* for username in xterm title */
|
#include <pwd.h> /* for username in xterm title */
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
#include "lib/global.h"
|
#include "lib/global.h"
|
||||||
|
|
||||||
@ -184,7 +181,7 @@ sigchld_handler_no_subshell (int sig)
|
|||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
int pid, status;
|
int pid, status;
|
||||||
|
|
||||||
if (!mc_global.tty.console_flag)
|
if (!mc_global.tty.console_flag != '\0')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* COMMENT: if it were true that after the call to handle_console(..INIT)
|
/* COMMENT: if it were true that after the call to handle_console(..INIT)
|
||||||
@ -362,9 +359,9 @@ update_xterm_title_path (void)
|
|||||||
fprintf (stdout, "\33]0;%s\7", str_term_form (p));
|
fprintf (stdout, "\33]0;%s\7", str_term_form (p));
|
||||||
g_free (login);
|
g_free (login);
|
||||||
g_free (p);
|
g_free (p);
|
||||||
if (!alternate_plus_minus)
|
if (!mc_global.tty.alternate_plus_minus)
|
||||||
numeric_keypad_mode ();
|
numeric_keypad_mode ();
|
||||||
fflush (stdout);
|
(void) fflush (stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,9 +374,9 @@ main (int argc, char *argv[])
|
|||||||
gboolean isInitialized;
|
gboolean isInitialized;
|
||||||
|
|
||||||
/* We had LC_CTYPE before, LC_ALL includs LC_TYPE as well */
|
/* We had LC_CTYPE before, LC_ALL includs LC_TYPE as well */
|
||||||
setlocale (LC_ALL, "");
|
(void) setlocale (LC_ALL, "");
|
||||||
bindtextdomain ("mc", LOCALEDIR);
|
(void) bindtextdomain ("mc", LOCALEDIR);
|
||||||
textdomain ("mc");
|
(void) textdomain ("mc");
|
||||||
|
|
||||||
if (!events_init (&error))
|
if (!events_init (&error))
|
||||||
{
|
{
|
||||||
@ -390,7 +387,7 @@ main (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Set up temporary directory */
|
/* Set up temporary directory */
|
||||||
mc_tmpdir ();
|
(void) mc_tmpdir ();
|
||||||
|
|
||||||
OS_Setup ();
|
OS_Setup ();
|
||||||
|
|
||||||
@ -488,10 +485,10 @@ main (int argc, char *argv[])
|
|||||||
#endif /* HAVE_SUBSHELL_SUPPORT */
|
#endif /* HAVE_SUBSHELL_SUPPORT */
|
||||||
|
|
||||||
/* Also done after init_subshell, to save any shell init file messages */
|
/* Also done after init_subshell, to save any shell init file messages */
|
||||||
if (mc_global.tty.console_flag)
|
if (mc_global.tty.console_flag != '\0')
|
||||||
handle_console (CONSOLE_SAVE);
|
handle_console (CONSOLE_SAVE);
|
||||||
|
|
||||||
if (alternate_plus_minus)
|
if (mc_global.tty.alternate_plus_minus)
|
||||||
application_keypad_mode ();
|
application_keypad_mode ();
|
||||||
|
|
||||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||||
@ -510,7 +507,7 @@ main (int argc, char *argv[])
|
|||||||
do_nc ();
|
do_nc ();
|
||||||
|
|
||||||
/* Save the tree store */
|
/* Save the tree store */
|
||||||
tree_store_save ();
|
(void) tree_store_save ();
|
||||||
|
|
||||||
free_keymap_defs ();
|
free_keymap_defs ();
|
||||||
|
|
||||||
@ -527,14 +524,14 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
done_setup ();
|
done_setup ();
|
||||||
|
|
||||||
if (mc_global.tty.console_flag && (quit & SUBSHELL_EXIT) == 0)
|
if (mc_global.tty.console_flag != '\0' && (quit & SUBSHELL_EXIT) == 0)
|
||||||
handle_console (CONSOLE_RESTORE);
|
handle_console (CONSOLE_RESTORE);
|
||||||
if (alternate_plus_minus)
|
if (mc_global.tty.alternate_plus_minus)
|
||||||
numeric_keypad_mode ();
|
numeric_keypad_mode ();
|
||||||
|
|
||||||
signal (SIGCHLD, SIG_DFL); /* Disable the SIGCHLD handler */
|
(void) signal (SIGCHLD, SIG_DFL); /* Disable the SIGCHLD handler */
|
||||||
|
|
||||||
if (mc_global.tty.console_flag)
|
if (mc_global.tty.console_flag != '\0')
|
||||||
handle_console (CONSOLE_DONE);
|
handle_console (CONSOLE_DONE);
|
||||||
|
|
||||||
if (mc_global.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
|
||||||
@ -566,9 +563,9 @@ main (int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
macros = &g_array_index (macros_list, struct macros_t, i);
|
macros = &g_array_index (macros_list, struct macros_t, i);
|
||||||
if (macros != NULL && macros->macro != NULL)
|
if (macros != NULL && macros->macro != NULL)
|
||||||
g_array_free (macros->macro, FALSE);
|
(void) g_array_free (macros->macro, FALSE);
|
||||||
}
|
}
|
||||||
g_array_free (macros_list, TRUE);
|
(void) g_array_free (macros_list, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
str_uninit_strings ();
|
str_uninit_strings ();
|
||||||
@ -576,7 +573,7 @@ main (int argc, char *argv[])
|
|||||||
g_free (mc_run_param0);
|
g_free (mc_run_param0);
|
||||||
g_free (mc_run_param1);
|
g_free (mc_run_param1);
|
||||||
|
|
||||||
mc_event_deinit (&error);
|
(void) mc_event_deinit (&error);
|
||||||
|
|
||||||
mc_config_deinit_config_paths ();
|
mc_config_deinit_config_paths ();
|
||||||
|
|
||||||
@ -587,7 +584,7 @@ main (int argc, char *argv[])
|
|||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
putchar ('\n'); /* Hack to make shell's prompt start at left of screen */
|
(void) putchar ('\n'); /* Hack to make shell's prompt start at left of screen */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -263,7 +263,7 @@ static const struct
|
|||||||
{ "show_all_if_ambiguous", &mc_global.widget.show_all_if_ambiguous },
|
{ "show_all_if_ambiguous", &mc_global.widget.show_all_if_ambiguous },
|
||||||
{ "max_dirt_limit", &mcview_max_dirt_limit },
|
{ "max_dirt_limit", &mcview_max_dirt_limit },
|
||||||
{ "use_file_to_guess_type", &use_file_to_check_type },
|
{ "use_file_to_guess_type", &use_file_to_check_type },
|
||||||
{ "alternate_plus_minus", &alternate_plus_minus },
|
{ "alternate_plus_minus", &mc_global.tty.alternate_plus_minus },
|
||||||
{ "only_leading_plus_minus", &only_leading_plus_minus },
|
{ "only_leading_plus_minus", &only_leading_plus_minus },
|
||||||
{ "show_output_starts_shell", &output_starts_shell },
|
{ "show_output_starts_shell", &output_starts_shell },
|
||||||
{ "xtree_mode", &xtree_mode },
|
{ "xtree_mode", &xtree_mode },
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user