1
1
# By Andrew Borodin (10) and Slava Zanko (1)
# Via Slava Zanko
* 2944_cleanup:
  Avoid compiler errors like:  error: variable 'xxx' set but not used [-Werror=unused-but-set-variable]
  Clarify check of C compiler flags.
  Enable -Wunused-but-set-variable flag by default.
  Clarify usage of use_internal_edit variable
  Merge src/filemanager/option.[ch] to src/filemanager/boxes.[ch].
  Remove irrelevant comments about file_date() function.
  Avoid C++-style comments.
  (mc_global_t::shell): new member to store user's shell
  (subshell_prompt): changed to GString.
  (read_subshell_prompt): return gboolean instead of int.
  Ticket #2944: code cleanup before 4.8.8 release.
Этот коммит содержится в:
Andrew Borodin 2013-01-17 17:09:48 +04:00
родитель 64542733b6 ee8aaf6181
Коммит 0398c1370e
47 изменённых файлов: 335 добавлений и 442 удалений

Просмотреть файл

@ -94,6 +94,8 @@ mc_global_t mc_global = {
.subshell_pty = 0,
#endif /* !ENABLE_SUBSHELL */
.shell = NULL,
.xterm_flag = FALSE,
.disable_x11 = FALSE,
.slow_terminal = FALSE,

Просмотреть файл

@ -244,6 +244,9 @@ typedef struct
int subshell_pty;
#endif /* !ENABLE_SUBSHELL */
/* The user's shell */
char *shell;
/* This flag is set by xterm detection routine in function main() */
/* It is used by function view_other_cmd() */
gboolean xterm_flag;

Просмотреть файл

@ -15,9 +15,6 @@
Jakub Jelinek, 1994, 1995, 1996
Mauricio Plaza, 1994, 1995, 1996
The file_date routine is mostly from GNU's fileutils package,
written by Richard Stallman and David MacKenzie.
This file is part of the Midnight Commander.
The Midnight Commander is free software: you can redistribute it

Просмотреть файл

@ -7,9 +7,6 @@
Written by:
Rostislav Benes, 2007
The file_date routine is mostly from GNU's fileutils package,
written by Richard Stallman and David MacKenzie.
This file is part of the Midnight Commander.
The Midnight Commander is free software: you can redistribute it

Просмотреть файл

@ -7,9 +7,6 @@
Written by:
Rostislav Benes, 2007
The file_date routine is mostly from GNU's fileutils package,
written by Richard Stallman and David MacKenzie.
This file is part of the Midnight Commander.
The Midnight Commander is free software: you can redistribute it

Просмотреть файл

@ -7,9 +7,6 @@
Written by:
Rostislav Benes, 2007
The file_date routine is mostly from GNU's fileutils package,
written by Richard Stallman and David MacKenzie.
This file is part of the Midnight Commander.
The Midnight Commander is free software: you can redistribute it

Просмотреть файл

@ -7,9 +7,6 @@
Written by:
Rostislav Benes, 2007
The file_date routine is mostly from GNU's fileutils package,
written by Richard Stallman and David MacKenzie.
This file is part of the Midnight Commander.
The Midnight Commander is free software: you can redistribute it

Просмотреть файл

@ -12,9 +12,6 @@
Jakub Jelinek, 1994, 1995, 1996
Mauricio Plaza, 1994, 1995, 1996
The file_date routine is mostly from GNU's fileutils package,
written by Richard Stallman and David MacKenzie.
This file is part of the Midnight Commander.
The Midnight Commander is free software: you can redistribute it
@ -211,6 +208,7 @@ mc_util_write_backup_content (const char *from_file_name, const char *to_file_na
int ret2;
ret2 = fflush (backup_fd);
ret2 = fclose (backup_fd);
(void) ret2;
}
g_free (contents);
return ret1;
@ -1066,6 +1064,7 @@ list_append_unique (GList * list, char *text)
g_free (lc_link->data);
tmp = g_list_remove_link (list, lc_link);
(void) tmp;
g_list_free_1 (lc_link);
}
lc_link = newlink;

Просмотреть файл

@ -1512,6 +1512,8 @@ vfs_s_get_line (struct vfs_class *me, int sock, char *buf, int buf_len, char ter
int ret2;
ret1 = fwrite (buf, 1, 1, logfile);
ret2 = fflush (logfile);
(void) ret1;
(void) ret2;
}
if (*buf == term)
{
@ -1530,6 +1532,8 @@ vfs_s_get_line (struct vfs_class *me, int sock, char *buf, int buf_len, char ter
int ret2;
ret1 = fwrite (&c, 1, 1, logfile);
ret2 = fflush (logfile);
(void) ret1;
(void) ret2;
}
if (c == '\n')
return 1;

Просмотреть файл

@ -457,9 +457,6 @@ mc_readdir (DIR * dirp)
struct vfs_class *vfs;
struct dirent *entry = NULL;
vfs_path_element_t *vfs_path_element;
#ifdef HAVE_CHARSET
estr_t state;
#endif
if (!mc_readdir_result)
{
@ -496,8 +493,7 @@ mc_readdir (DIR * dirp)
g_string_set_size (vfs_str_buffer, 0);
#ifdef HAVE_CHARSET
state =
str_vfs_convert_from (vfs_path_element->dir.converter, entry->d_name, vfs_str_buffer);
str_vfs_convert_from (vfs_path_element->dir.converter, entry->d_name, vfs_str_buffer);
#else
g_string_assign (vfs_str_buffer, entry->d_name);
#endif

Просмотреть файл

@ -243,13 +243,12 @@ vfs_path_url_split (vfs_path_element_t * path_element, const char *path)
{
char *pcopy;
const char *pend;
char *dir, *colon, *inner_colon, *at, *rest;
char *colon, *inner_colon, *at, *rest;
path_element->port = 0;
pcopy = g_strdup (path);
pend = pcopy + strlen (pcopy);
dir = pcopy;
/* search for any possible user */
at = strrchr (pcopy, '@');

Просмотреть файл

@ -1,9 +1,9 @@
dnl @synopsis MC_CHECK_CFLAGS
dnl
dnl Check flags supported by compilator
dnl Check flags supported by C compiler
dnl
dnl @author Slava Zanko <slavazanko@gmail.com>
dnl @version 2009-10-29
dnl @version 2013-01-16
dnl @license GPL
dnl @copyright Free Software Foundation, Inc.
@ -14,15 +14,10 @@ AC_DEFUN([MC_CHECK_ONE_CFLAG],[
safe_CFLAGS=$CFLAGS
CFLAGS="$1"
AC_TRY_COMPILE(, [
return 0;
],
[
mc_check_one_cflag=yes
],
[
mc_check_one_cflag=no
])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([], [[return 0;]])],
[mc_check_one_cflag=yes],
[mc_check_one_cflag=no])
CFLAGS=$safe_CFLAGS
AC_MSG_RESULT([$mc_check_one_cflag])
@ -30,10 +25,11 @@ AC_DEFUN([MC_CHECK_ONE_CFLAG],[
if test x$mc_check_one_cflag = xyes; then
mc_configured_cflags="$mc_configured_cflags $1"
fi
])
AC_DEFUN([MC_CHECK_CFLAGS],[
AC_LANG_PUSH(C)
mc_configured_cflags=""
dnl Sorted -f options:
@ -73,7 +69,7 @@ dnl MC_CHECK_ONE_CFLAG([-Wstrict-aliasing])
MC_CHECK_ONE_CFLAG([-Wswitch])
MC_CHECK_ONE_CFLAG([-Wtype-limits])
MC_CHECK_ONE_CFLAG([-Wuninitialized])
dnl MC_CHECK_ONE_CFLAG([-Wunused-but-set-variable])
MC_CHECK_ONE_CFLAG([-Wunused-but-set-variable])
MC_CHECK_ONE_CFLAG([-Wunused-function])
MC_CHECK_ONE_CFLAG([-Wunused-label])
MC_CHECK_ONE_CFLAG([-Wunused-parameter])
@ -81,4 +77,6 @@ dnl MC_CHECK_ONE_CFLAG([-Wunused-but-set-variable])
MC_CHECK_ONE_CFLAG([-Wunused-value])
MC_CHECK_ONE_CFLAG([-Wunused-variable])
MC_CHECK_ONE_CFLAG([-Wwrite-strings])
AC_LANG_POP()
])

Просмотреть файл

@ -380,6 +380,7 @@ background_attention (int fd, void *closure)
g_free (data[i]);
repaint_screen ();
(void) ret;
return 0;
}
@ -409,6 +410,7 @@ parent_call_header (void *routine, int argc, enum ReturnType type, FileOpContext
if (have_ctx)
ret = write (parent_fd, ctx, sizeof (FileOpContext));
(void) ret;
}
/* --------------------------------------------------------------------------------------------- */
@ -436,6 +438,7 @@ parent_va_call (void *routine, gpointer data, int argc, va_list ap)
if (ctx)
ret = read (from_parent_fd, ctx, sizeof (FileOpContext));
(void) ret;
return i;
}

Просмотреть файл

@ -36,7 +36,6 @@
#include "lib/vfs/vfs.h"
#include "setup.h"
#include "src/execute.h"
#include "clipboard.h"
@ -66,7 +65,6 @@ clipboard_file_to_ext_clip (const gchar * event_group_name, const gchar * event_
gpointer init_data, gpointer data)
{
char *tmp, *cmd;
int res = 0;
const char *d = getenv ("DISPLAY");
(void) event_group_name;
@ -81,7 +79,7 @@ clipboard_file_to_ext_clip (const gchar * event_group_name, const gchar * event_
cmd = g_strconcat (clipboard_store_path, " ", tmp, " 2>/dev/null", (char *) NULL);
if (cmd != NULL)
res = my_system (EXECUTE_AS_SHELL, shell, cmd);
my_system (EXECUTE_AS_SHELL, mc_global.tty.shell, cmd);
g_free (cmd);
g_free (tmp);
@ -96,7 +94,6 @@ clipboard_file_from_ext_clip (const gchar * event_group_name, const gchar * even
gpointer init_data, gpointer data)
{
char *tmp, *cmd;
int res = 0;
const char *d = getenv ("DISPLAY");
(void) event_group_name;
@ -111,7 +108,7 @@ clipboard_file_from_ext_clip (const gchar * event_group_name, const gchar * even
cmd = g_strconcat (clipboard_paste_path, " > ", tmp, " 2>/dev/null", (char *) NULL);
if (cmd != NULL)
res = my_system (EXECUTE_AS_SHELL, shell, cmd);
my_system (EXECUTE_AS_SHELL, mc_global.tty.shell, cmd);
g_free (cmd);
g_free (tmp);
@ -127,7 +124,6 @@ clipboard_text_to_file (const gchar * event_group_name, const gchar * event_name
{
int file;
vfs_path_t *fname_vpath = NULL;
ssize_t ret;
size_t str_len;
const char *text = (const char *) data;
@ -147,7 +143,12 @@ clipboard_text_to_file (const gchar * event_group_name, const gchar * event_name
return TRUE;
str_len = strlen (text);
ret = mc_write (file, (char *) text, str_len);
{
ssize_t ret;
ret = mc_write (file, (char *) text, str_len);
(void) ret;
}
mc_close (file);
return TRUE;
}

Просмотреть файл

@ -130,6 +130,7 @@ show_console_contents_linux (int starty, unsigned char begin_line, unsigned char
/* Read the value of the mc_global.tty.console_flag */
ret = read (pipefd2[0], &message, 1);
(void) ret;
}
/* --------------------------------------------------------------------------------------------- */
@ -179,6 +180,7 @@ handle_console_linux (console_action_t action)
status = close (pipefd1[1]);
status = close (pipefd2[0]);
ret = waitpid (cons_saver_pid, &status, 0);
(void) ret;
}
}
else
@ -247,6 +249,7 @@ handle_console_linux (console_action_t action)
close (pipefd2[0]);
ret = waitpid (cons_saver_pid, &status, 0);
mc_global.tty.console_flag = '\0';
(void) ret;
}
break;
default:

Просмотреть файл

@ -145,6 +145,7 @@ static void __attribute__ ((noreturn)) die (void)
unsigned char zero = 0;
ssize_t ret;
ret = write (1, &zero, 1);
(void) ret;
exit (3);
}

Просмотреть файл

@ -2184,7 +2184,6 @@ static void
do_merge_hunk (WDiff * dview, action_direction_t merge_direction)
{
int from1, to1, from2, to2;
int res;
int hunk;
diff_place_t n_merge = (merge_direction == FROM_RIGHT_TO_LEFT) ? DIFF_RIGHT : DIFF_LEFT;
@ -2241,7 +2240,12 @@ do_merge_hunk (WDiff * dview, action_direction_t merge_direction)
}
fflush (merge_file);
fclose (merge_file);
res = rewrite_backup_content (merge_file_name_vpath, dview->file[n_merge]);
{
int res;
res = rewrite_backup_content (merge_file_name_vpath, dview->file[n_merge]);
(void) res;
}
mc_unlink (merge_file_name_vpath);
vfs_path_free (merge_file_name_vpath);
}

Просмотреть файл

@ -2033,7 +2033,6 @@ edit_get_word_from_pos (const WEdit * edit, off_t start_pos, off_t * start, gsiz
off_t word_start;
long cut_len = 0;
GString *match_expr;
unsigned char *bufpos;
int c1, c2;
for (word_start = start_pos; word_start != 0; word_start--, cut_len++)
@ -2045,7 +2044,6 @@ edit_get_word_from_pos (const WEdit * edit, off_t start_pos, off_t * start, gsiz
break;
}
bufpos = &edit->buffers1[word_start >> S_EDIT_BUF_SIZE][word_start & M_EDIT_BUF_SIZE];
match_expr = g_string_sized_new (16);
do

Просмотреть файл

@ -2439,7 +2439,6 @@ edit_block_move_cmd (WEdit * edit)
off_t current;
unsigned char *copy_buf = NULL;
off_t start_mark, end_mark;
long line;
if (eval_marks (edit, &start_mark, &end_mark))
return;
@ -2447,7 +2446,6 @@ edit_block_move_cmd (WEdit * edit)
if (!edit->column_highlight && edit->curs1 > start_mark && edit->curs1 < end_mark)
return;
line = edit->curs_line;
if (edit->mark2 < 0)
edit_mark_cmd (edit, FALSE);
edit_push_markers (edit);

Просмотреть файл

@ -307,11 +307,7 @@ aspell_init (void)
global_speller->speller = NULL;
if (spell_language != NULL)
{
int res;
res = mc_aspell_config_replace (global_speller->config, "lang", spell_language);
}
mc_aspell_config_replace (global_speller->config, "lang", spell_language);
error = mc_new_aspell_speller (global_speller->config);
@ -443,7 +439,6 @@ aspell_set_lang (const char *lang)
{
if (lang != NULL)
{
int res;
AspellCanHaveError *error;
const char *spell_codeset;
@ -457,8 +452,8 @@ aspell_set_lang (const char *lang)
#endif
spell_codeset = str_detect_termencoding ();
res = mc_aspell_config_replace (global_speller->config, "lang", lang);
res = mc_aspell_config_replace (global_speller->config, "encoding", spell_codeset);
mc_aspell_config_replace (global_speller->config, "lang", lang);
mc_aspell_config_replace (global_speller->config, "encoding", spell_codeset);
/* the returned pointer should _not_ need to be deleted */
if (global_speller->speller != NULL)

Просмотреть файл

@ -73,7 +73,6 @@ spell_dialog_spell_suggest_show (WEdit * edit, const char *word, char **new_word
WDialog *sug_dlg;
WListbox *sug_list;
int max_btn_len = 0;
int add_len;
int replace_len;
int skip_len;
int cancel_len;
@ -92,7 +91,6 @@ spell_dialog_spell_suggest_show (WEdit * edit, const char *word, char **new_word
ypos -= sug_dlg_h;
add_btn = button_new (5, 28, B_ADD_WORD, NORMAL_BUTTON, _("&Add word"), 0);
add_len = button_get_len (add_btn);
replace_btn = button_new (7, 28, B_ENTER, NORMAL_BUTTON, _("&Replace"), 0);
replace_len = button_get_len (replace_btn);
skip_btn = button_new (9, 28, B_SKIP_WORD, NORMAL_BUTTON, _("&Skip"), 0);

Просмотреть файл

@ -129,7 +129,7 @@ do_possible_cd (const vfs_path_t * new_dir_vpath)
/* --------------------------------------------------------------------------------------------- */
static void
do_execute (const char *lc_shell, const char *command, int flags)
do_execute (const char *shell, const char *command, int flags)
{
#ifdef ENABLE_SUBSHELL
vfs_path_t *new_dir_vpath = NULL;
@ -161,7 +161,7 @@ do_execute (const char *lc_shell, const char *command, int flags)
}
else
#endif /* ENABLE_SUBSHELL */
my_system (flags, lc_shell, command);
my_system (flags, shell, command);
if (!(flags & EXECUTE_INTERNAL))
{
@ -291,12 +291,12 @@ shell_execute (const char *command, int flags)
#ifdef ENABLE_SUBSHELL
if (mc_global.tty.use_subshell)
if (subshell_state == INACTIVE)
do_execute (shell, cmd ? cmd : command, flags | EXECUTE_AS_SHELL);
do_execute (mc_global.tty.shell, cmd ? cmd : command, flags | EXECUTE_AS_SHELL);
else
message (D_ERROR, MSG_ERROR, _("The shell is already running a command"));
else
#endif /* ENABLE_SUBSHELL */
do_execute (shell, cmd ? cmd : command, flags | EXECUTE_AS_SHELL);
do_execute (mc_global.tty.shell, cmd ? cmd : command, flags | EXECUTE_AS_SHELL);
g_free (cmd);
}
@ -306,7 +306,7 @@ shell_execute (const char *command, int flags)
void
exec_shell (void)
{
do_execute (shell, 0, 0);
do_execute (mc_global.tty.shell, 0, 0);
}
/* --------------------------------------------------------------------------------------------- */
@ -355,7 +355,7 @@ toggle_panels (void)
fprintf (stderr, _("Type `exit' to return to the Midnight Commander"));
fprintf (stderr, "\n\r\n\r");
my_system (EXECUTE_INTERNAL, shell, NULL);
my_system (EXECUTE_INTERNAL, mc_global.tty.shell, NULL);
}
else
get_key_code (0);

Просмотреть файл

@ -20,7 +20,6 @@ libmcfilemanager_la_SOURCES = \
layout.c layout.h \
midnight.h midnight.c \
mountlist.c mountlist.h \
option.c option.h \
panelize.c panelize.h \
panel.c panel.h \
tree.c tree.h \

Просмотреть файл

@ -2,13 +2,13 @@
Some misc dialog boxes for the program.
Copyright (C) 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2009, 2010, 2011, 2012
2005, 2006, 2009, 2010, 2011, 2012, 2013
The Free Software Foundation, Inc.
Written by:
Miguel de Icaza, 1994, 1995
Jakub Jelinek, 1995
Andrew Borodin <aborodin@vmail.ru>, 2009, 2010, 2011, 2012
Andrew Borodin <aborodin@vmail.ru>, 2009, 2010, 2011, 2012, 2013
This file is part of the Midnight Commander.
@ -60,6 +60,8 @@
#include "lib/widget.h"
#include "src/setup.h" /* For profile_name */
#include "src/history.h" /* MC_HISTORY_ESC_TIMEOUT */
#include "src/execute.h" /* pause_after_run */
#ifdef ENABLE_BACKGROUND
#include "src/background.h" /* task_list */
#endif
@ -92,6 +94,8 @@
/*** file scope variables ************************************************************************/
unsigned long configure_old_esc_mode_id, configure_time_out_id;
/* Index in list_types[] for "user defined" */
static const int panel_listing_user_idx = 3;
@ -117,6 +121,33 @@ static WListbox *bg_list = NULL;
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
configure_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
switch (msg)
{
case MSG_ACTION:
/* message from "Single press" checkbutton */
if (sender != NULL && sender->id == configure_old_esc_mode_id)
{
const gboolean not_single = !(CHECK (sender)->state & C_BOOL);
Widget *ww;
/* input line */
ww = dlg_find_by_id (DIALOG (w), configure_time_out_id);
widget_disable (ww, not_single);
return MSG_HANDLED;
}
return MSG_NOT_HANDLED;
default:
return dlg_default_callback (w, sender, msg, parm, data);
}
}
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
panel_listing_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
@ -402,6 +433,179 @@ task_cb (WButton * button, int action)
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
void
configure_box (void)
{
const char *pause_options[] = {
N_("&Never"),
N_("On dum&b terminals"),
N_("Alwa&ys")
};
int pause_options_num;
pause_options_num = G_N_ELEMENTS (pause_options);
{
char time_out[BUF_TINY] = "";
char *time_out_new;
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_START_COLUMNS,
QUICK_START_GROUPBOX (N_("File operations")),
QUICK_CHECKBOX (N_("&Verbose operation"), &verbose, NULL),
QUICK_CHECKBOX (N_("Compute tota&ls"), &file_op_compute_totals, NULL),
QUICK_CHECKBOX (N_("Classic pro&gressbar"), &classic_progressbar, NULL),
QUICK_CHECKBOX (N_("Mkdi&r autoname"), &auto_fill_mkdir_name, NULL),
QUICK_CHECKBOX (N_("Preallocate &space"), &mc_global.vfs.preallocate_space,
NULL),
QUICK_STOP_GROUPBOX,
QUICK_START_GROUPBOX (N_("Esc key mode")),
QUICK_CHECKBOX (N_("S&ingle press"), &old_esc_mode, &configure_old_esc_mode_id),
QUICK_LABELED_INPUT (N_("Timeout:"), input_label_left,
(const char *) time_out, 0, MC_HISTORY_ESC_TIMEOUT,
&time_out_new, &configure_time_out_id),
QUICK_STOP_GROUPBOX,
QUICK_START_GROUPBOX (N_("Pause after run")),
QUICK_RADIO (pause_options_num, pause_options, &pause_after_run, NULL),
QUICK_STOP_GROUPBOX,
QUICK_NEXT_COLUMN,
QUICK_START_GROUPBOX (N_("Other options")),
QUICK_CHECKBOX (N_("Use internal edi&t"), &use_internal_edit, NULL),
QUICK_CHECKBOX (N_("Use internal vie&w"), &use_internal_view, NULL),
QUICK_CHECKBOX (N_("Auto m&enus"), &auto_menu, NULL),
QUICK_CHECKBOX (N_("&Drop down menus"), &drop_menus, NULL),
QUICK_CHECKBOX (N_("Shell &patterns"), &easy_patterns, NULL),
QUICK_CHECKBOX (N_("Co&mplete: show all"),
&mc_global.widget.show_all_if_ambiguous, NULL),
QUICK_CHECKBOX (N_("Rotating d&ash"), &nice_rotating_dash, NULL),
QUICK_CHECKBOX (N_("Cd follows lin&ks"), &mc_global.vfs.cd_symlinks, NULL),
QUICK_CHECKBOX (N_("Sa&fe delete"), &safe_delete, NULL),
QUICK_CHECKBOX (N_("A&uto save setup"), &auto_save_setup, NULL),
QUICK_SEPARATOR (FALSE),
QUICK_SEPARATOR (FALSE),
QUICK_SEPARATOR (FALSE),
QUICK_SEPARATOR (FALSE),
QUICK_STOP_GROUPBOX,
QUICK_STOP_COLUMNS,
QUICK_BUTTONS_OK_CANCEL,
QUICK_END
/* *INDENT-ON* */
};
quick_dialog_t qdlg = {
-1, -1, 60,
N_("Configure options"), "[Configuration]",
quick_widgets, configure_callback, NULL
};
g_snprintf (time_out, sizeof (time_out), "%d", old_esc_mode_timeout);
#ifndef USE_INTERNAL_EDIT
quick_widgets[17].options = W_DISABLED;
#endif
if (!old_esc_mode)
quick_widgets[10].options = quick_widgets[11].options = W_DISABLED;
#ifndef HAVE_POSIX_FALLOCATE
mc_global.vfs.preallocate_space = FALSE;
quick_widgets[7].options = W_DISABLED;
#endif
if (quick_dialog (&qdlg) == B_ENTER)
old_esc_mode_timeout = atoi (time_out_new);
g_free (time_out_new);
}
}
/* --------------------------------------------------------------------------------------------- */
void
panel_options_box (void)
{
const char *qsearch_options[] = {
N_("Case &insensitive"),
N_("Cas&e sensitive"),
N_("Use panel sort mo&de")
};
int simple_swap;
simple_swap = mc_config_get_bool (mc_main_config, CONFIG_PANELS_SECTION,
"simple_swap", FALSE) ? 1 : 0;
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_START_COLUMNS,
QUICK_START_GROUPBOX (N_("Main options")),
QUICK_CHECKBOX (N_("Show mi&ni-status"), &panels_options.show_mini_info, NULL),
QUICK_CHECKBOX (N_("Use SI si&ze units"), &panels_options.kilobyte_si, NULL),
QUICK_CHECKBOX (N_("Mi&x all files"), &panels_options.mix_all_files, NULL),
QUICK_CHECKBOX (N_("Show &backup files"), &panels_options.show_backups, NULL),
QUICK_CHECKBOX (N_("Show &hidden files"), &panels_options.show_dot_files, NULL),
QUICK_CHECKBOX (N_("&Fast dir reload"), &panels_options.fast_reload, NULL),
QUICK_CHECKBOX (N_("Ma&rk moves down"), &panels_options.mark_moves_down, NULL),
QUICK_CHECKBOX (N_("Re&verse files only"), &panels_options.reverse_files_only,
NULL),
QUICK_CHECKBOX (N_("Simple s&wap"), &simple_swap, NULL),
QUICK_CHECKBOX (N_("A&uto save panels setup"), &panels_options.auto_save_setup,
NULL),
QUICK_SEPARATOR (FALSE),
QUICK_SEPARATOR (FALSE),
QUICK_STOP_GROUPBOX,
QUICK_NEXT_COLUMN,
QUICK_START_GROUPBOX (N_("Navigation")),
QUICK_CHECKBOX (N_("L&ynx-like motion"), &panels_options.navigate_with_arrows,
NULL),
QUICK_CHECKBOX (N_("Pa&ge scrolling"), &panels_options.scroll_pages, NULL),
QUICK_CHECKBOX (N_("&Mouse page scrolling"), &panels_options.mouse_move_pages,
NULL),
QUICK_STOP_GROUPBOX,
QUICK_START_GROUPBOX (N_("File highlight")),
QUICK_CHECKBOX (N_("File &types"), &panels_options.filetype_mode, NULL),
QUICK_CHECKBOX (N_("&Permissions"), &panels_options.permission_mode, NULL),
QUICK_STOP_GROUPBOX,
QUICK_START_GROUPBOX (N_("Quick search")),
QUICK_RADIO (QSEARCH_NUM, qsearch_options, (int *) &panels_options.qsearch_mode,
NULL),
QUICK_STOP_GROUPBOX,
QUICK_STOP_COLUMNS,
QUICK_BUTTONS_OK_CANCEL,
QUICK_END
/* *INDENT-ON* */
};
quick_dialog_t qdlg = {
-1, -1, 60,
N_("Panel options"), "[Panel options]",
quick_widgets, NULL, NULL
};
if (quick_dialog (&qdlg) != B_ENTER)
return;
}
mc_config_set_bool (mc_main_config, CONFIG_PANELS_SECTION,
"simple_swap", (gboolean) (simple_swap & C_BOOL));
if (!panels_options.fast_reload_msg_shown && panels_options.fast_reload)
{
message (D_NORMAL, _("Information"),
_("Using the fast reload option may not reflect the exact\n"
"directory contents. In this case you'll need to do a\n"
"manual reload of the directory. See the man page for\n" "the details."));
panels_options.fast_reload_msg_shown = TRUE;
}
update_panels (UP_RELOAD, UP_KEEPSEL);
}
/* --------------------------------------------------------------------------------------------- */
/* return list type */
int
panel_listing_box (WPanel * panel, char **userp, char **minip, int *use_msformat, int num)

Просмотреть файл

@ -18,6 +18,8 @@
/*** declarations of public functions ************************************************************/
void configure_box (void);
void panel_options_box (void);
int panel_listing_box (WPanel * p, char **user, char **mini, int *use_msformat, int num);
const panel_field_t *sort_box (panel_sort_info_t * info);
void confirm_box (void);

Просмотреть файл

@ -1785,6 +1785,7 @@ do_find (const char *start_dir, ssize_t start_dir_len, const char *ignore_dirs,
vfs_path_free (current_panel->cwd_vpath);
current_panel->cwd_vpath = vfs_path_from_str (PATH_SEP_STR);
ret = chdir (PATH_SEP_STR);
(void) ret;
}
panelize_save_panel (current_panel);
}

Просмотреть файл

@ -816,7 +816,7 @@ setup_cmdline (void)
#ifdef ENABLE_SUBSHELL
if (mc_global.tty.use_subshell)
tmp_prompt = strip_ctrl_codes (subshell_prompt);
tmp_prompt = strip_ctrl_codes (subshell_prompt->str);
if (tmp_prompt == NULL)
#endif
tmp_prompt = (char *) mc_prompt;

Просмотреть файл

@ -64,7 +64,6 @@
#include "lib/keybind.h"
#include "lib/event.h"
#include "option.h" /* configure_box() */
#include "tree.h"
#include "boxes.h" /* sort_box(), tree_box() */
#include "layout.h"
@ -115,6 +114,9 @@ WLabel *the_hint;
/* The button bar */
WButtonBar *the_bar;
/* The prompt */
const char *mc_prompt = NULL;
/*** file scope macro definitions ****************************************************************/
#ifdef HAVE_CHARSET
@ -896,6 +898,7 @@ setup_dummy_mc (void)
setup_mc ();
vpath = vfs_path_from_str (d);
ret = mc_chdir (vpath);
(void) ret;
vfs_path_free (vpath);
g_free (d);
}

Просмотреть файл

@ -37,6 +37,8 @@ extern WPanel *left_panel;
extern WPanel *right_panel;
extern WPanel *current_panel;
extern const char *mc_prompt;
/*** declarations of public functions ************************************************************/
void update_menu (void);

Просмотреть файл

@ -1,261 +0,0 @@
/*
Configure box module for the Midnight Commander
Copyright (C) 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2007, 2009, 2010, 2011, 2012
The Free Software Foundation, Inc.
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/** \file option.c
* \brief Source: configure boxes module
*/
#include <config.h>
#include <stdlib.h> /* atoi() */
#include <sys/types.h>
#include <unistd.h>
#include "lib/global.h"
#include "lib/mcconfig.h"
#include "lib/strutil.h" /* str_term_width1() */
#include "lib/tty/key.h" /* old_esc_mode_timeout */
#include "lib/widget.h"
#include "src/setup.h" /* variables */
#include "src/history.h" /* MC_HISTORY_ESC_TIMEOUT */
#include "src/execute.h" /* pause_after_run */
#include "layout.h" /* nice_rotating_dash */
#include "panel.h" /* update_panels() */
#include "option.h"
/*** global variables ****************************************************************************/
/*** file scope macro definitions ****************************************************************/
/*** file scope type declarations ****************************************************************/
/*** file scope variables ************************************************************************/
unsigned long configure_old_esc_mode_id, configure_time_out_id;
/* --------------------------------------------------------------------------------------------- */
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
configure_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
switch (msg)
{
case MSG_ACTION:
/* message from "Single press" checkbutton */
if (sender != NULL && sender->id == configure_old_esc_mode_id)
{
const gboolean not_single = !(CHECK (sender)->state & C_BOOL);
Widget *ww;
/* input line */
ww = dlg_find_by_id (DIALOG (w), configure_time_out_id);
widget_disable (ww, not_single);
return MSG_HANDLED;
}
return MSG_NOT_HANDLED;
default:
return dlg_default_callback (w, sender, msg, parm, data);
}
}
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
void
configure_box (void)
{
const char *pause_options[] = {
N_("&Never"),
N_("On dum&b terminals"),
N_("Alwa&ys")
};
int pause_options_num;
pause_options_num = G_N_ELEMENTS (pause_options);
{
char time_out[BUF_TINY] = "";
char *time_out_new;
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_START_COLUMNS,
QUICK_START_GROUPBOX (N_("File operations")),
QUICK_CHECKBOX (N_("&Verbose operation"), &verbose, NULL),
QUICK_CHECKBOX (N_("Compute tota&ls"), &file_op_compute_totals, NULL),
QUICK_CHECKBOX (N_("Classic pro&gressbar"), &classic_progressbar, NULL),
QUICK_CHECKBOX (N_("Mkdi&r autoname"), &auto_fill_mkdir_name, NULL),
QUICK_CHECKBOX (N_("Preallocate &space"), &mc_global.vfs.preallocate_space,
NULL),
QUICK_STOP_GROUPBOX,
QUICK_START_GROUPBOX (N_("Esc key mode")),
QUICK_CHECKBOX (N_("S&ingle press"), &old_esc_mode, &configure_old_esc_mode_id),
QUICK_LABELED_INPUT (N_("Timeout:"), input_label_left,
(const char *) time_out, 0, MC_HISTORY_ESC_TIMEOUT,
&time_out_new, &configure_time_out_id),
QUICK_STOP_GROUPBOX,
QUICK_START_GROUPBOX (N_("Pause after run")),
QUICK_RADIO (pause_options_num, pause_options, &pause_after_run, NULL),
QUICK_STOP_GROUPBOX,
QUICK_NEXT_COLUMN,
QUICK_START_GROUPBOX (N_("Other options")),
QUICK_CHECKBOX (N_("Use internal edi&t"), &use_internal_edit, NULL),
QUICK_CHECKBOX (N_("Use internal vie&w"), &use_internal_view, NULL),
QUICK_CHECKBOX (N_("Auto m&enus"), &auto_menu, NULL),
QUICK_CHECKBOX (N_("&Drop down menus"), &drop_menus, NULL),
QUICK_CHECKBOX (N_("Shell &patterns"), &easy_patterns, NULL),
QUICK_CHECKBOX (N_("Co&mplete: show all"),
&mc_global.widget.show_all_if_ambiguous, NULL),
QUICK_CHECKBOX (N_("Rotating d&ash"), &nice_rotating_dash, NULL),
QUICK_CHECKBOX (N_("Cd follows lin&ks"), &mc_global.vfs.cd_symlinks, NULL),
QUICK_CHECKBOX (N_("Sa&fe delete"), &safe_delete, NULL),
QUICK_CHECKBOX (N_("A&uto save setup"), &auto_save_setup, NULL),
QUICK_SEPARATOR (FALSE),
QUICK_SEPARATOR (FALSE),
QUICK_SEPARATOR (FALSE),
QUICK_SEPARATOR (FALSE),
QUICK_STOP_GROUPBOX,
QUICK_STOP_COLUMNS,
QUICK_BUTTONS_OK_CANCEL,
QUICK_END
/* *INDENT-ON* */
};
quick_dialog_t qdlg = {
-1, -1, 60,
N_("Configure options"), "[Configuration]",
quick_widgets, configure_callback, NULL
};
g_snprintf (time_out, sizeof (time_out), "%d", old_esc_mode_timeout);
if (!old_esc_mode)
quick_widgets[10].options = quick_widgets[11].options = W_DISABLED;
#ifndef HAVE_POSIX_FALLOCATE
mc_global.vfs.preallocate_space = FALSE;
quick_widgets[7].options = W_DISABLED;
#endif
if (quick_dialog (&qdlg) == B_ENTER)
old_esc_mode_timeout = atoi (time_out_new);
g_free (time_out_new);
}
}
/* --------------------------------------------------------------------------------------------- */
void
panel_options_box (void)
{
const char *qsearch_options[] = {
N_("Case &insensitive"),
N_("Cas&e sensitive"),
N_("Use panel sort mo&de")
};
int simple_swap;
simple_swap = mc_config_get_bool (mc_main_config, CONFIG_PANELS_SECTION,
"simple_swap", FALSE) ? 1 : 0;
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_START_COLUMNS,
QUICK_START_GROUPBOX (N_("Main options")),
QUICK_CHECKBOX (N_("Show mi&ni-status"), &panels_options.show_mini_info, NULL),
QUICK_CHECKBOX (N_("Use SI si&ze units"), &panels_options.kilobyte_si, NULL),
QUICK_CHECKBOX (N_("Mi&x all files"), &panels_options.mix_all_files, NULL),
QUICK_CHECKBOX (N_("Show &backup files"), &panels_options.show_backups, NULL),
QUICK_CHECKBOX (N_("Show &hidden files"), &panels_options.show_dot_files, NULL),
QUICK_CHECKBOX (N_("&Fast dir reload"), &panels_options.fast_reload, NULL),
QUICK_CHECKBOX (N_("Ma&rk moves down"), &panels_options.mark_moves_down, NULL),
QUICK_CHECKBOX (N_("Re&verse files only"), &panels_options.reverse_files_only,
NULL),
QUICK_CHECKBOX (N_("Simple s&wap"), &simple_swap, NULL),
QUICK_CHECKBOX (N_("A&uto save panels setup"), &panels_options.auto_save_setup,
NULL),
QUICK_SEPARATOR (FALSE),
QUICK_SEPARATOR (FALSE),
QUICK_STOP_GROUPBOX,
QUICK_NEXT_COLUMN,
QUICK_START_GROUPBOX (N_("Navigation")),
QUICK_CHECKBOX (N_("L&ynx-like motion"), &panels_options.navigate_with_arrows,
NULL),
QUICK_CHECKBOX (N_("Pa&ge scrolling"), &panels_options.scroll_pages, NULL),
QUICK_CHECKBOX (N_("&Mouse page scrolling"), &panels_options.mouse_move_pages,
NULL),
QUICK_STOP_GROUPBOX,
QUICK_START_GROUPBOX (N_("File highlight")),
QUICK_CHECKBOX (N_("File &types"), &panels_options.filetype_mode, NULL),
QUICK_CHECKBOX (N_("&Permissions"), &panels_options.permission_mode, NULL),
QUICK_STOP_GROUPBOX,
QUICK_START_GROUPBOX (N_("Quick search")),
QUICK_RADIO (QSEARCH_NUM, qsearch_options, (int *) &panels_options.qsearch_mode,
NULL),
QUICK_STOP_GROUPBOX,
QUICK_STOP_COLUMNS,
QUICK_BUTTONS_OK_CANCEL,
QUICK_END
/* *INDENT-ON* */
};
quick_dialog_t qdlg = {
-1, -1, 60,
N_("Panel options"), "[Panel options]",
quick_widgets, NULL, NULL
};
if (quick_dialog (&qdlg) != B_ENTER)
return;
}
mc_config_set_bool (mc_main_config, CONFIG_PANELS_SECTION,
"simple_swap", (gboolean) (simple_swap & C_BOOL));
if (!panels_options.fast_reload_msg_shown && panels_options.fast_reload)
{
message (D_NORMAL, _("Information"),
_("Using the fast reload option may not reflect the exact\n"
"directory contents. In this case you'll need to do a\n"
"manual reload of the directory. See the man page for\n" "the details."));
panels_options.fast_reload_msg_shown = TRUE;
}
update_panels (UP_RELOAD, UP_KEEPSEL);
}
/* --------------------------------------------------------------------------------------------- */

Просмотреть файл

@ -1,22 +0,0 @@
/** \file option.h
* \brief Header: configure box module
*/
#ifndef MC__OPTION_H
#define MC__OPTION_H
/*** typedefs(not structures) and defined constants **********************************************/
/*** enums ***************************************************************************************/
/*** structures declarations (and typedefs of structures)*****************************************/
/*** global variables defined in .c file *********************************************************/
/*** declarations of public functions ************************************************************/
void configure_box (void);
void panel_options_box (void);
/*** inline functions ****************************************************************************/
#endif /* MC__OPTION_H */

Просмотреть файл

@ -47,7 +47,7 @@
#include "lib/mcconfig.h"
#include "lib/vfs/vfs.h"
#include "lib/unixcompat.h"
#include "lib/timefmt.h"
#include "lib/timefmt.h" /* file_date() */
#include "lib/util.h"
#include "lib/widget.h"
#ifdef HAVE_CHARSET

Просмотреть файл

@ -373,6 +373,7 @@ do_external_panelize (char *command)
int ret;
panel_set_cwd (current_panel, PATH_SEP_STR);
ret = chdir (PATH_SEP_STR);
(void) ret;
}
}
else

Просмотреть файл

@ -742,7 +742,6 @@ static void
tree_rescan (void *data)
{
WTree *tree = data;
int ret;
vfs_path_t *old_vpath;
old_vpath = vfs_path_clone (vfs_get_raw_current_dir ());
@ -751,8 +750,11 @@ tree_rescan (void *data)
if (tree->selected_ptr != NULL && mc_chdir (tree->selected_ptr->name) == 0)
{
int ret;
tree_store_rescan (tree->selected_ptr->name);
ret = mc_chdir (old_vpath);
(void) ret;
}
vfs_path_free (old_vpath);
}

Просмотреть файл

@ -129,17 +129,18 @@ OS_Setup (void)
if ((shell_env == NULL) || (shell_env[0] == '\0'))
{
struct passwd *pwd;
pwd = getpwuid (geteuid ());
if (pwd != NULL)
shell = g_strdup (pwd->pw_shell);
mc_global.tty.shell = g_strdup (pwd->pw_shell);
}
else
shell = g_strdup (shell_env);
mc_global.tty.shell = g_strdup (shell_env);
if ((shell == NULL) || (shell[0] == '\0'))
if ((mc_global.tty.shell == NULL) || (mc_global.tty.shell[0] == '\0'))
{
g_free (shell);
shell = g_strdup ("/bin/sh");
g_free (mc_global.tty.shell);
mc_global.tty.shell = g_strdup ("/bin/sh");
}
/* This is the directory, where MC was installed, on Unix this is DATADIR */
@ -257,7 +258,7 @@ main (int argc, char *argv[])
startup_exit_falure:
fprintf (stderr, _("Failed to run:\n%s\n"), error->message);
g_error_free (error);
g_free (shell);
g_free (mc_global.tty.shell);
startup_exit_ok:
str_uninit_strings ();
return exit_code;
@ -376,16 +377,8 @@ main (int argc, char *argv[])
if (mc_global.tty.alternate_plus_minus)
application_keypad_mode ();
#ifdef ENABLE_SUBSHELL
if (mc_global.tty.use_subshell)
{
mc_prompt = strip_ctrl_codes (subshell_prompt);
if (mc_prompt == NULL)
mc_prompt = (geteuid () == 0) ? "# " : "$ ";
}
else
#endif /* ENABLE_SUBSHELL */
mc_prompt = (geteuid () == 0) ? "# " : "$ ";
/* subshell_prompt is NULL here */
mc_prompt = (geteuid () == 0) ? "# " : "$ ";
if (config_migrated)
{
@ -439,11 +432,13 @@ main (int argc, char *argv[])
int ret2;
ret1 = write (last_wd_fd, last_wd_string, strlen (last_wd_string));
ret2 = close (last_wd_fd);
(void) ret1;
(void) ret2;
}
}
g_free (last_wd_string);
g_free (shell);
g_free (mc_global.tty.shell);
done_key ();

Просмотреть файл

@ -197,12 +197,6 @@ char *last_wd_string = NULL;
/* Set when main loop should be terminated */
int quit = 0;
/* The user's shell */
char *shell = NULL;
/* The prompt */
const char *mc_prompt = NULL;
/* Set to TRUE to suppress printing the last directory */
int print_last_revert = FALSE;
@ -951,6 +945,10 @@ load_setup (void)
*int_options[i].opt_addr =
mc_config_get_int (mc_main_config, CONFIG_APP_SECTION, int_options[i].opt_name,
*int_options[i].opt_addr);
#ifndef USE_INTERNAL_EDIT
/* reset forced in case of build without internal editor */
use_internal_edit = 0;
#endif /* USE_INTERNAL_EDIT */
if (option_tab_spacing <= 0)
option_tab_spacing = DEFAULT_TAB_SPACING;

Просмотреть файл

@ -124,9 +124,6 @@ extern int quit;
/* Set to TRUE to suppress printing the last directory */
extern gboolean print_last_revert;
extern char *shell;
extern const char *mc_prompt;
/* index to record_macro_buf[], -1 if not recording a macro */
extern int macro_index;

Просмотреть файл

@ -75,7 +75,7 @@
enum subshell_state_enum subshell_state;
/* Holds the latest prompt captured from the subshell */
char *subshell_prompt = NULL;
GString *subshell_prompt = NULL;
/* Subshell: if set, then the prompt was not saved on CONSOLE_SAVE */
/* We need to paint it after CONSOLE_RESTORE, see: load_prompt */
@ -255,6 +255,7 @@ init_subshell_child (const char *pty_name)
{
int ret;
ret = chdir (mc_config_get_home_dir ()); /* FIXME? What about when we re-run the subshell? */
(void) ret;
}
/* Set MC_SID to prevent running one mc from another */
@ -329,22 +330,22 @@ init_subshell_child (const char *pty_name)
switch (subshell_type)
{
case BASH:
execl (shell, "bash", "-rcfile", init_file, (char *) NULL);
execl (mc_global.tty.shell, "bash", "-rcfile", init_file, (char *) NULL);
break;
case TCSH:
execl (shell, "tcsh", (char *) NULL);
execl (mc_global.tty.shell, "tcsh", (char *) NULL);
break;
case ZSH:
/* Use -g to exclude cmds beginning with space from history
* and -Z to use the line editor on non-interactive term */
execl (shell, "zsh", "-Z", "-g", (char *) NULL);
execl (mc_global.tty.shell, "zsh", "-Z", "-g", (char *) NULL);
break;
case FISH:
execl (shell, "fish", (char *) NULL);
execl (mc_global.tty.shell, "fish", (char *) NULL);
break;
}
@ -790,15 +791,15 @@ init_subshell (void)
{ /* First time through */
/* Find out what type of shell we have */
if (strstr (shell, "/zsh") || getenv ("ZSH_VERSION"))
if (strstr (mc_global.tty.shell, "/zsh") || getenv ("ZSH_VERSION"))
subshell_type = ZSH;
else if (strstr (shell, "/tcsh"))
else if (strstr (mc_global.tty.shell, "/tcsh"))
subshell_type = TCSH;
else if (strstr (shell, "/csh"))
else if (strstr (mc_global.tty.shell, "/csh"))
subshell_type = TCSH;
else if (strstr (shell, "/bash") || getenv ("BASH"))
else if (strstr (mc_global.tty.shell, "/bash") || getenv ("BASH"))
subshell_type = BASH;
else if (strstr (shell, "/fish"))
else if (strstr (mc_global.tty.shell, "/fish"))
subshell_type = FISH;
else
{
@ -981,27 +982,26 @@ invoke_subshell (const char *command, int how, vfs_path_t ** new_dir_vpath)
/* --------------------------------------------------------------------------------------------- */
int
gboolean
read_subshell_prompt (void)
{
static int prompt_size = INITIAL_PROMPT_SIZE;
int bytes = 0, i, rc = 0;
int rc = 0;
ssize_t bytes = 0;
struct timeval timeleft = { 0, 0 };
fd_set tmp;
FD_ZERO (&tmp);
FD_SET (mc_global.tty.subshell_pty, &tmp);
/* First time through */
if (subshell_prompt == NULL)
{ /* First time through */
subshell_prompt = g_malloc (prompt_size);
*subshell_prompt = '\0';
prompt_pos = 0;
}
subshell_prompt = g_string_sized_new (INITIAL_PROMPT_SIZE);
while (subshell_alive
&& (rc = select (mc_global.tty.subshell_pty + 1, &tmp, NULL, NULL, &timeleft)))
&& (rc = select (mc_global.tty.subshell_pty + 1, &tmp, NULL, NULL, &timeleft)) != 0)
{
ssize_t i;
/* Check for `select' errors */
if (rc == -1)
{
@ -1020,27 +1020,15 @@ read_subshell_prompt (void)
bytes = read (mc_global.tty.subshell_pty, pty_buffer, sizeof (pty_buffer));
/* Extract the prompt from the shell output */
for (i = 0; i < bytes; ++i)
g_string_set_size (subshell_prompt, 0);
for (i = 0; i < bytes; i++)
if (pty_buffer[i] == '\n' || pty_buffer[i] == '\r')
{
prompt_pos = 0;
}
else
{
if (!pty_buffer[i])
continue;
subshell_prompt[prompt_pos++] = pty_buffer[i];
if (prompt_pos == prompt_size)
subshell_prompt = g_realloc (subshell_prompt, prompt_size *= 2);
}
subshell_prompt[prompt_pos] = '\0';
g_string_set_size (subshell_prompt, 0);
else if (pty_buffer[i] != '\0')
g_string_append_c (subshell_prompt, pty_buffer[i]);
}
if (rc == 0 && bytes == 0)
return FALSE;
return TRUE;
return (rc != 0 || bytes != 0);
}
/* --------------------------------------------------------------------------------------------- */
@ -1050,7 +1038,7 @@ do_update_prompt (void)
{
if (update_subshell_prompt)
{
printf ("\r\n%s", subshell_prompt);
printf ("\r\n%s", subshell_prompt->str);
fflush (stdout);
update_subshell_prompt = FALSE;
}
@ -1078,7 +1066,7 @@ exit_subshell (void)
tcsh_fifo, unix_error_string (errno));
}
g_free (subshell_prompt);
g_string_free (subshell_prompt, TRUE);
subshell_prompt = NULL;
pty_buffer[0] = '\0';
}

Просмотреть файл

@ -32,7 +32,7 @@ enum
extern enum subshell_state_enum subshell_state;
/* Holds the latest prompt captured from the subshell */
extern char *subshell_prompt;
extern GString *subshell_prompt;
extern gboolean update_subshell_prompt;
@ -40,7 +40,7 @@ extern gboolean update_subshell_prompt;
void init_subshell (void);
int invoke_subshell (const char *command, int how, vfs_path_t ** new_dir);
int read_subshell_prompt (void);
gboolean read_subshell_prompt (void);
void do_update_prompt (void);
gboolean exit_subshell (void);
void do_subshell_chdir (const vfs_path_t * vpath, gboolean update_prompt, gboolean reset_prompt);

Просмотреть файл

@ -58,7 +58,6 @@
#include "lib/util.h"
#include "lib/widget.h" /* message() */
#include "src/setup.h" /* shell */
#include "src/execute.h" /* For shell_execute */
#include "lib/vfs/vfs.h"
@ -851,7 +850,7 @@ extfs_cmd (const char *str_extfs_cmd, struct archive *archive,
g_free (quoted_archive_name);
open_error_pipe ();
retval = my_system (EXECUTE_AS_SHELL, shell, cmd);
retval = my_system (EXECUTE_AS_SHELL, mc_global.tty.shell, cmd);
g_free (cmd);
close_error_pipe (D_ERROR, NULL);
return retval;

Просмотреть файл

@ -253,6 +253,7 @@ fish_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, c
size_t ret;
ret = fwrite (str, strlen (str), 1, logfile);
ret = fflush (logfile);
(void) ret;
}
tty_enable_interrupt_key ();

Просмотреть файл

@ -478,6 +478,7 @@ ftpfs_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply,
{
size_t ret;
ret = fwrite (cmdstr, cmdlen, 1, MEDATA->logfile);
(void) ret;
}
fflush (MEDATA->logfile);

Просмотреть файл

@ -188,7 +188,7 @@ main (void)
suite_add_tcase (s, tc_core);
sr = srunner_create (s);
// srunner_set_fork_status (sr, CK_NOFORK);
/* srunner_set_fork_status (sr, CK_NOFORK); */
srunner_run_all (sr, CK_NORMAL);
number_failed = srunner_ntests_failed (sr);
srunner_free (sr);

Просмотреть файл

@ -132,7 +132,7 @@ main (void)
suite_add_tcase (s, tc_core);
sr = srunner_create (s);
srunner_set_log (sr, "user_configs_path.log");
// srunner_set_fork_status (sr, CK_NOFORK);
/* srunner_set_fork_status (sr, CK_NOFORK); */
srunner_run_all (sr, CK_NORMAL);
number_failed = srunner_ntests_failed (sr);
srunner_free (sr);

Просмотреть файл

@ -59,14 +59,14 @@ static const struct data_source1_struct
START_TEST (quote_percent_test)
{
// given
/* given */
char *actual_string;
const struct data_source1_struct test_data = data_source1[_i];
// when
/* when */
actual_string = name_quote (test_data.input_string, test_data.input_quote_percent);
// then
/* then */
g_assert_cmpstr (actual_string, ==, test_data.expected_string);
g_free (actual_string);
@ -95,14 +95,14 @@ static const struct data_source2_struct
START_TEST (name_quote_test)
{
// given
/* given */
char *actual_string;
const struct data_source2_struct test_data = data_source2[_i];
// when
/* when */
actual_string = name_quote (test_data.input_string, FALSE);
// then
/* then */
g_assert_cmpstr (actual_string, ==, test_data.expected_string);
g_free (actual_string);

Просмотреть файл

@ -249,12 +249,10 @@ START_TEST (test_vfs_parse_ls_lga_reorder)
{
size_t filepos = 0;
struct vfs_s_entry *ent1, *ent2, *ent3;
int i;
vfs_parse_ls_lga_init();
ent1 = vfs_s_generate_entry (&vfs_test_ops1, NULL, vfs_root_inode, 0);
i = ent1->ino->st.st_nlink;
if (! vfs_parse_ls_lga ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root1",
&ent1->ino->st, &ent1->name, &ent1->ino->linkname, &filepos))
{
@ -266,7 +264,6 @@ START_TEST (test_vfs_parse_ls_lga_reorder)
ent2 = vfs_s_generate_entry (&vfs_test_ops1, NULL, vfs_root_inode, 0);
i = ent2->ino->st.st_nlink;
if (! vfs_parse_ls_lga ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root2",
&ent2->ino->st, &ent2->name, &ent2->ino->linkname, &filepos))
{
@ -277,7 +274,6 @@ START_TEST (test_vfs_parse_ls_lga_reorder)
vfs_s_insert_entry (&vfs_test_ops1, vfs_root_inode, ent2);
ent3 = vfs_s_generate_entry (&vfs_test_ops1, NULL, vfs_root_inode, 0);
i = ent3->ino->st.st_nlink;
if (! vfs_parse_ls_lga ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 ..",
&ent3->ino->st, &ent3->name, &ent3->ino->linkname, &filepos))
{

Просмотреть файл

@ -69,7 +69,7 @@ teardown (void)
START_TEST (sanitize_variables)
{
// given
/* given */
vfs_path_t * filename_vpath;
char *actual_string;
const char *expected_string;
@ -82,12 +82,12 @@ START_TEST (sanitize_variables)
current_panel->dir.list[2].f.marked = TRUE;
current_panel->count = 3;
// when
/* when */
filename_vpath = vfs_path_from_str("/tmp/blabla.txt");
actual_string = exec_get_export_variables (filename_vpath);
vfs_path_free (filename_vpath);
// then
/* then */
expected_string = "\
MC_EXT_FILENAME=/tmp/blabla.txt\n\
export MC_EXT_FILENAME\n\