Merge branch '3547_cleanup'

* 3547_cleanup: (61 commits)
  Update po/mc.pot.
  Remove unneeded `struct` keyword for typedef'd structs
  src/editor/edit.c: Cleanup some compiler warnings
  src/editor/editbuffer.c: Cleanup some compiler warning
  src/editor/editwidget.c: Cleanup some compiler warnings
  (etags_set_definition_hash): refactoring:
  Add -Wassign-enum compiler wirning.
  (widget_options_t): add W_DEFAULT value to cleanup -Wassign-enum warnings.
  Add three new compiler warnings:
  Cleanup -Wfloat-conversion warning.
  (edit_block_copy_cmd): cleanup -Wconditional-uninitialized warning.
  (edit_search_fix_search_start_if_selection): cleanup -Wlogical-not-parentheses warning.
  (mc_error_message): make output format translatable.
  Find File: clarify description of exit from panelize mode.
  WPanel should report MSG_NOT_HANDLED for unhandled commands.
  Sync with gnulib 781788eeb5d4d0b816698e8629300cd90a7379bd.
  lib/widget/input.c: (quote): change type to gboolean.
  (tree_chdir, sync_tree): take vfs_path_t object to avoid double conversion of path.
  (set_display_type): ret rid of string reduplication.
  (expand_format): ret rid of extra string duplication.
  ...
This commit is contained in:
Andrew Borodin 2016-03-04 09:28:56 +03:00
commit e8b68df26f
107 changed files with 1373 additions and 1440 deletions

View File

@ -14,7 +14,7 @@ m4_include([m4.include/mc-with-screen.m4])
m4_include([m4.include/mc-with-internal-edit.m4])
m4_include([m4.include/mc-subshell.m4])
m4_include([m4.include/mc-background.m4])
m4_include([m4.include/ac-glib.m4])
m4_include([m4.include/mc-glib.m4])
m4_include([m4.include/mc-vfs.m4])
m4_include([m4.include/mc-version.m4])
m4_include([m4.include/mc-tests.m4])

View File

@ -9,7 +9,7 @@ AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_SRCDIR(src/main.c)
AC_CONFIG_HEADERS(config.h)
MC_VERSION
mc_VERSION
AM_INIT_AUTOMAKE(mc, ${VERSION} )
dnl Enable silent rules by default (if yes)
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@ -28,7 +28,7 @@ dnl ############################################################################
AC_PROG_CC_STDC
AM_PROG_CC_C_O
MC_CHECK_CFLAGS
mc_CHECK_CFLAGS
CFLAGS_OPTS=""
if test "x$CFLAGS" = "x"; then
@ -42,7 +42,7 @@ fi
AC_ARG_ENABLE([werror],
AS_HELP_STRING([--enable-werror], [Handle all compiler warnings as errors]))
if test "x$enable_werror" = xyes; then
MC_CHECK_ONE_CFLAG([-Werror])
mc_CHECK_ONE_CFLAG([-Werror])
fi
AC_PROG_LIBTOOL
@ -137,19 +137,19 @@ dnl Check for other tools
dnl ############################################################################
AC_CHECK_TOOL(AR, ar, ar)
MC_UNIT_TESTS
mc_UNIT_TESTS
dnl ############################################################################
dnl Check for main libraies
dnl ############################################################################
AC_CHECK_GLIB
AC_G_MODULE_SUPPORTED
MC_WITH_SCREEN
MC_CHECK_SEARCH_TYPE
mc_CHECK_GLIB
mc_G_MODULE_SUPPORTED
mc_WITH_SCREEN
mc_CHECK_SEARCH_TYPE
dnl X11 support. Used to read keyboard modifiers when running under X11.
MC_WITH_X
mc_WITH_X
dnl ############################################################################
@ -266,7 +266,7 @@ dnl ############################################################################
AM_GNU_GETTEXT(no-libtool, need-ngettext)
AM_GNU_GETTEXT_VERSION(0.14.3)
MC_I18N
mc_I18N
dnl ############################################################################
dnl OS specific flags
@ -384,7 +384,7 @@ dnl ############################################################################
dnl MC options
dnl ############################################################################
MC_WITH_INTERNAL_EDIT
mc_WITH_INTERNAL_EDIT
dnl Diff viewer support.
AC_ARG_WITH([diff_viewer],
@ -399,9 +399,9 @@ else
diff_msg="no"
fi
MC_SUBSHELL
MC_BACKGROUND
AC_MC_VFS_CHECKS
mc_SUBSHELL
mc_BACKGROUND
mc_VFS_CHECKS
dnl ############################################################################
dnl Directories

View File

@ -1435,8 +1435,8 @@ file. The Again button will ask for the parameters for a new
search. The Quit button quits the search operation. The Panelize
button will place the found files to the current directory panel so
that you can do additional operations on them (view, copy, move,
delete and so on). After panelizing you can press C\-r to return to the
normal file listing.
delete and so on). To return to the normal file listing, change directory
to "..".
.PP
The 'Enable ignore directories' checkbox and input field below it
allow to set up the list of directories that should be skip during the search

View File

@ -1524,10 +1524,8 @@ Midnight Commander создает дерево путем просмотра т
Нажатие на кнопку <Панелизация> приведет к тому, что
результаты поиска будут отображены на текущую активную панель, так что
вы можете производить с выбранными файлами еще какие\-то действия
(просматривать, копировать, перемещать, удалять и так далее). После
вывода на панель можно нажать
.B C\-r
для возврата к обычному списку файлов.
(просматривать, копировать, перемещать, удалять и так далее). Для возврата
к обычному списку файлов нужно перейти в каталог "..".
.PP
Опция "Разрешить игнорирование каталогов" совместно с расположенным ниже
полем ввода позволяет задать список каталогов, которые нужно пропускать при

View File

@ -52,7 +52,7 @@ if CHARSET
libmc_la_SOURCES += charsets.c charsets.h
endif
AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) $(PCRE_CPPFLAGS)
AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
libmc_la_LIBADD = \
event/libmcevent.la \

View File

@ -7,4 +7,4 @@ libmcevent_la_SOURCES = \
manage.c \
raise.c
AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(PCRE_CPPFLAGS)
AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS)

View File

@ -1,10 +1,8 @@
#ifndef MC__FILEHIGHLIGHT_H
#define MC__FILEHIGHLIGHT_H
#include "lib/mcconfig.h"
#include "lib/search.h"
#include "lib/util.h"
#include "lib/mcconfig.h" /* mc_config_t */
#include "lib/util.h" /* file_entry_t */
/*** typedefs(not structures) and defined constants **********************************************/

View File

@ -1,6 +1,8 @@
#ifndef MC__FILEHIGHLIGHT_INTERNAL_H
#define MC__FILEHIGHLIGHT_INTERNAL_H
#include "lib/search.h" /* mc_search_t */
/*** typedefs(not structures) and defined constants **********************************************/
/*** enums ***************************************************************************************/

View File

@ -163,6 +163,8 @@
#define DEFAULT_CHARSET "ASCII"
#include "lib/timer.h" /* mc_timer_t */
/*** enums ***************************************************************************************/
/* run mode and params */
@ -180,7 +182,7 @@ typedef struct
{
mc_run_mode_t mc_run_mode;
/* global timer */
struct mc_timer_t *timer;
mc_timer_t *timer;
/* Used so that widgets know if they are being destroyed or shut down */
gboolean midnight_shutdown;

View File

@ -69,11 +69,11 @@
/*** file scope type declarations ****************************************************************/
struct lock_s
typedef struct
{
char *who;
pid_t pid;
};
} lock_s;
/*** file scope variables ************************************************************************/
@ -135,13 +135,13 @@ lock_build_symlink_name (const vfs_path_t * fname_vpath)
* Extract pid from user@host.domain.pid string
*/
static struct lock_s *
static lock_s *
lock_extract_info (const char *str)
{
size_t i, len;
const char *p, *s;
static char pid[PID_BUF_SIZE], who[BUF_SIZE];
static struct lock_s lock;
static lock_s lock;
len = strlen (str);
@ -201,7 +201,7 @@ lock_file (const vfs_path_t * fname_vpath)
{
char *lockfname = NULL, *newlock, *msg;
struct stat statbuf;
struct lock_s *lockinfo;
lock_s *lockinfo;
gboolean is_local;
gboolean symlink_ok = FALSE;
const char *elpath;

View File

@ -9,4 +9,4 @@ libmcskin_la_SOURCES = \
lines.c \
internal.h
AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(PCRE_CPPFLAGS)
AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS)

View File

@ -583,7 +583,8 @@ extension (const char *filename)
/* --------------------------------------------------------------------------------------------- */
char *
load_mc_home_file (const char *from, const char *filename, char **allocated_filename)
load_mc_home_file (const char *from, const char *filename, char **allocated_filename,
size_t * length)
{
char *hintfile_base, *hintfile;
char *lang;
@ -593,18 +594,18 @@ load_mc_home_file (const char *from, const char *filename, char **allocated_file
lang = guess_message_value ();
hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL);
if (!g_file_get_contents (hintfile, &data, NULL, NULL))
if (!g_file_get_contents (hintfile, &data, length, NULL))
{
/* Fall back to the two-letter language code */
if (lang[0] != '\0' && lang[1] != '\0')
lang[2] = '\0';
g_free (hintfile);
hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL);
if (!g_file_get_contents (hintfile, &data, NULL, NULL))
if (!g_file_get_contents (hintfile, &data, length, NULL))
{
g_free (hintfile);
hintfile = hintfile_base;
g_file_get_contents (hintfile_base, &data, NULL, NULL);
g_file_get_contents (hintfile_base, &data, length, NULL);
}
}

View File

@ -172,7 +172,8 @@ char *diff_two_paths (const vfs_path_t * vpath1, const vfs_path_t * vpath2);
/* Returns the basename of fname. The result is a pointer into fname. */
const char *x_basename (const char *fname);
char *load_mc_home_file (const char *from, const char *filename, char **allocated_filename);
char *load_mc_home_file (const char *from, const char *filename, char **allocated_filename,
size_t * length);
/* uid/gid managing */
void init_groups (void);

View File

@ -974,7 +974,7 @@ custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
&& strncmp (s - url_delim_len, VFS_PATH_URL_DELIMITER, url_delim_len) == 0)
{
char *vfs_prefix = s - url_delim_len;
struct vfs_class *vclass;
vfs_class *vclass;
while (vfs_prefix > lpath && !IS_PATH_SEP (*--vfs_prefix))
;

View File

@ -92,8 +92,6 @@ struct dirhandle
/*** file scope variables ************************************************************************/
static volatile int total_inodes = 0, total_entries = 0;
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
@ -891,7 +889,6 @@ vfs_s_new_inode (struct vfs_class *me, struct vfs_s_super *super, struct stat *i
ino->st.st_dev = MEDATA->rdev;
super->ino_usage++;
total_inodes++;
CALL (init_inode) (me, ino);
@ -923,7 +920,6 @@ vfs_s_free_inode (struct vfs_class *me, struct vfs_s_inode *ino)
unlink (ino->localname);
g_free (ino->localname);
}
total_inodes--;
ino->super->ino_usage--;
g_free (ino);
}
@ -936,7 +932,6 @@ vfs_s_new_entry (struct vfs_class *me, const char *name, struct vfs_s_inode *ino
struct vfs_s_entry *entry;
entry = g_new0 (struct vfs_s_entry, 1);
total_entries++;
entry->name = g_strdup (name);
entry->ino = inode;
@ -963,7 +958,6 @@ vfs_s_free_entry (struct vfs_class *me, struct vfs_s_entry *ent)
vfs_s_free_inode (me, ent->ino);
}
total_entries--;
g_free (ent);
}

View File

@ -61,7 +61,7 @@
/* TODO: move it to separate private .h */
extern GString *vfs_str_buffer;
extern struct vfs_class *current_vfs;
extern vfs_class *current_vfs;
extern struct dirent *mc_readdir_result;
/*** global variables ****************************************************************************/

View File

@ -63,13 +63,13 @@
extern struct dirent *mc_readdir_result;
extern GPtrArray *vfs__classes_list;
extern GString *vfs_str_buffer;
extern struct vfs_class *current_vfs;
extern vfs_class *current_vfs;
/*** global variables ****************************************************************************/
GPtrArray *vfs__classes_list = NULL;
GString *vfs_str_buffer = NULL;
struct vfs_class *current_vfs = NULL;
vfs_class *current_vfs = NULL;
/*** file scope macro definitions ****************************************************************/
@ -86,7 +86,7 @@ struct vfs_class *current_vfs = NULL;
struct vfs_openfile
{
int handle;
struct vfs_class *vclass;
vfs_class *vclass;
void *fsinfo;
};

View File

@ -22,4 +22,4 @@ libmcwidget_la_SOURCES = \
widget-common.c widget-common.h \
wtools.c wtools.h
AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(PCRE_CPPFLAGS)
AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS)

View File

@ -262,7 +262,7 @@ buttonbar_new (gboolean visible)
void
buttonbar_set_label (WButtonBar * bb, int idx, const char *text,
const struct global_keymap_t *keymap, const Widget * receiver)
const global_keymap_t * keymap, const Widget * receiver)
{
if ((bb != NULL) && (idx >= 1) && (idx <= BUTTONBAR_LABELS_NUM))
{

View File

@ -19,8 +19,6 @@
/*** structures declarations (and typedefs of structures)*****************************************/
struct global_keymap_t;
typedef struct WButtonBar
{
Widget widget;
@ -34,15 +32,13 @@ typedef struct WButtonBar
} labels[BUTTONBAR_LABELS_NUM];
} WButtonBar;
struct global_keymap_t;
/*** global variables defined in .c file *********************************************************/
/*** declarations of public functions ************************************************************/
WButtonBar *buttonbar_new (gboolean visible);
void buttonbar_set_label (WButtonBar * bb, int idx, const char *text,
const struct global_keymap_t *keymap, const Widget * receiver);
const global_keymap_t * keymap, const Widget * receiver);
WButtonBar *find_buttonbar (const WDialog * h);
/*** inline functions ****************************************************************************/

View File

@ -16,8 +16,8 @@ extern WDialog *midnight_dlg;
/*** declarations of public functions ************************************************************/
void dialog_switch_add (struct WDialog *h);
void dialog_switch_remove (struct WDialog *h);
void dialog_switch_add (WDialog * h);
void dialog_switch_remove (WDialog * h);
size_t dialog_switch_num (void);
void dialog_switch_next (void);

View File

@ -189,7 +189,7 @@ void update_cursor (WDialog * h);
/* --------------------------------------------------------------------------------------------- */
static inline unsigned long
dlg_get_current_widget_id (const struct WDialog *h)
dlg_get_current_widget_id (const WDialog * h)
{
return WIDGET (h->current->data)->id;
}

View File

@ -165,7 +165,7 @@ history_get (const char *input_name)
* Load history from the mc_config
*/
GList *
history_load (struct mc_config_t * cfg, const char *name)
history_load (mc_config_t * cfg, const char *name)
{
size_t i;
GList *hist = NULL;
@ -228,7 +228,7 @@ history_load (struct mc_config_t * cfg, const char *name)
* Save history to the mc_config, but don't save config to file
*/
void
history_save (struct mc_config_t *cfg, const char *name, GList * h)
history_save (mc_config_t * cfg, const char *name, GList * h)
{
GIConv conv = INVALID_CONV;
GString *buffer;

View File

@ -6,15 +6,14 @@
#ifndef MC__WIDGET_HISTORY_H
#define MC__WIDGET_HISTORY_H
#include "lib/mcconfig.h" /* mc_config_t */
/*** typedefs(not structures) and defined constants **********************************************/
/*** enums ***************************************************************************************/
/*** structures declarations (and typedefs of structures)*****************************************/
/* forward declaration */
struct mc_config_t;
/*** global variables defined in .c file *********************************************************/
extern int num_history_items_recorded;
@ -24,9 +23,9 @@ extern int num_history_items_recorded;
/* read history to the mc_config, but don't save config to file */
GList *history_get (const char *input_name);
/* load history from the mc_config */
GList *history_load (struct mc_config_t *cfg, const char *name);
GList *history_load (mc_config_t * cfg, const char *name);
/* save history to the mc_config, but don't save config to file */
void history_save (struct mc_config_t *cfg, const char *name, GList * h);
void history_save (mc_config_t * cfg, const char *name, GList * h);
/* for repositioning of history dialog we should pass widget to this
* function, as position of history dialog depends on widget's position */
char *history_show (GList ** history, Widget * widget, int current);

View File

@ -10,7 +10,7 @@
Jakub Jelinek, 1995
Andrej Borsenkow, 1996
Norbert Warmuth, 1997
Andrew Borodin <aborodin@vmail.ru>, 2009-2014
Andrew Borodin <aborodin@vmail.ru>, 2009-2016
This file is part of the Midnight Commander.
@ -55,7 +55,7 @@
/*** global variables ****************************************************************************/
int quote = 0;
gboolean quote = FALSE;
const global_keymap_t *input_map = NULL;
@ -1067,9 +1067,9 @@ input_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
case MSG_KEY:
if (parm == XCTRL ('q'))
{
quote = 1;
quote = TRUE;
v = input_handle_char (in, ascii_alpha_to_cntrl (tty_getch ()));
quote = 0;
quote = FALSE;
return v;
}
@ -1081,9 +1081,9 @@ input_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
/* When pasting multiline text, insert literal Enter */
if ((parm & ~KEY_M_MASK) == '\n')
{
quote = 1;
quote = TRUE;
v = input_handle_char (in, '\n');
quote = 0;
quote = FALSE;
return v;
}
@ -1135,12 +1135,12 @@ input_handle_char (WInput * in, int key)
cb_ret_t v;
long command;
if (quote != 0)
if (quote)
{
input_free_completions (in);
v = insert_char (in, key);
input_update (in, TRUE);
quote = 0;
quote = FALSE;
return v;
}

View File

@ -16,8 +16,8 @@
typedef struct
{
struct WDialog *dlg;
struct WListbox *list;
WDialog *dlg;
WListbox *list;
} Listbox;
/*** global variables defined in .c file *********************************************************/

View File

@ -12,7 +12,7 @@
#define QUICK_CHECKBOX(txt, st, id_) \
{ \
.widget_type = quick_checkbox, \
.options = 0, \
.options = W_DEFAULT, \
.pos_flags = WPOS_KEEP_DEFAULT, \
.id = id_, \
.u = { \
@ -26,7 +26,7 @@
#define QUICK_BUTTON(txt, act, cb, id_) \
{ \
.widget_type = quick_button, \
.options = 0, \
.options = W_DEFAULT, \
.pos_flags = WPOS_KEEP_DEFAULT, \
.id = id_, \
.u = { \
@ -41,7 +41,7 @@
#define QUICK_INPUT(txt, hname, res, id_, is_passwd_, strip_passwd_, completion_flags_) \
{ \
.widget_type = quick_input, \
.options = 0, \
.options = W_DEFAULT, \
.pos_flags = WPOS_KEEP_DEFAULT, \
.id = id_, \
.u = { \
@ -62,7 +62,7 @@
#define QUICK_LABELED_INPUT(label_, label_loc, txt, hname, res, id_, is_passwd_, strip_passwd_, completion_flags_) \
{ \
.widget_type = quick_input, \
.options = 0, \
.options = W_DEFAULT, \
.pos_flags = WPOS_KEEP_DEFAULT, \
.id = id_, \
.u = { \
@ -83,7 +83,7 @@
#define QUICK_LABEL(txt, id_) \
{ \
.widget_type = quick_label, \
.options = 0, \
.options = W_DEFAULT, \
.pos_flags = WPOS_KEEP_DEFAULT, \
.id = id_, \
.u = { \
@ -97,7 +97,7 @@
#define QUICK_RADIO(cnt, items_, val, id_) \
{ \
.widget_type = quick_radio, \
.options = 0, \
.options = W_DEFAULT, \
.pos_flags = WPOS_KEEP_DEFAULT, \
.id = id_, \
.u = { \
@ -112,7 +112,7 @@
#define QUICK_START_GROUPBOX(t) \
{ \
.widget_type = quick_start_groupbox, \
.options = 0, \
.options = W_DEFAULT, \
.pos_flags = WPOS_KEEP_DEFAULT, \
.id = NULL, \
.u = { \
@ -125,7 +125,7 @@
#define QUICK_STOP_GROUPBOX \
{ \
.widget_type = quick_stop_groupbox, \
.options = 0, \
.options = W_DEFAULT, \
.pos_flags = WPOS_KEEP_DEFAULT, \
.id = NULL, \
.u = { \
@ -140,7 +140,7 @@
#define QUICK_SEPARATOR(line_) \
{ \
.widget_type = quick_separator, \
.options = 0, \
.options = W_DEFAULT, \
.pos_flags = WPOS_KEEP_DEFAULT, \
.id = NULL, \
.u = { \
@ -154,7 +154,7 @@
#define QUICK_START_COLUMNS \
{ \
.widget_type = quick_start_columns, \
.options = 0, \
.options = W_DEFAULT, \
.pos_flags = WPOS_KEEP_DEFAULT, \
.id = NULL, \
.u = { \
@ -169,7 +169,7 @@
#define QUICK_NEXT_COLUMN \
{ \
.widget_type = quick_next_column, \
.options = 0, \
.options = W_DEFAULT, \
.pos_flags = WPOS_KEEP_DEFAULT, \
.id = NULL, \
.u = { \
@ -184,7 +184,7 @@
#define QUICK_STOP_COLUMNS \
{ \
.widget_type = quick_stop_columns, \
.options = 0, \
.options = W_DEFAULT, \
.pos_flags = WPOS_KEEP_DEFAULT, \
.id = NULL, \
.u = { \
@ -199,7 +199,7 @@
#define QUICK_START_BUTTONS(space_, line_) \
{ \
.widget_type = quick_buttons, \
.options = 0, \
.options = W_DEFAULT, \
.pos_flags = WPOS_KEEP_DEFAULT, \
.id = NULL, \
.u = { \
@ -218,7 +218,7 @@
#define QUICK_END \
{ \
.widget_type = quick_end, \
.options = 0, \
.options = W_DEFAULT, \
.pos_flags = WPOS_KEEP_DEFAULT, \
.id = NULL, \
.u = { \

View File

@ -60,6 +60,7 @@ typedef enum
/* Widget options */
typedef enum
{
W_DEFAULT = (0 << 0),
W_WANT_HOTKEY = (1 << 1),
W_WANT_CURSOR = (1 << 2),
W_WANT_IDLE = (1 << 3),
@ -104,7 +105,7 @@ struct Widget
widget_cb_fn callback;
mouse_h mouse;
void (*set_options) (Widget * w, widget_options_t options, gboolean enable);
struct WDialog *owner;
WDialog *owner;
};
/* structure for label (caption) with hotkey, if original text does not contain

View File

@ -115,7 +115,7 @@ query_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
/* --------------------------------------------------------------------------------------------- */
/** Create message dialog */
static struct WDialog *
static WDialog *
do_create_message (int flags, const char *title, const char *text)
{
char *p;
@ -378,7 +378,7 @@ query_set_sel (int new_sel)
* dlg_destroy() to dismiss it. Not safe to call from background.
*/
struct WDialog *
WDialog *
create_message (int flags, const char *title, const char *text, ...)
{
va_list args;
@ -443,7 +443,7 @@ mc_error_message (GError ** mcerror, int *code)
if ((*mcerror)->code == 0)
message (D_ERROR, MSG_ERROR, "%s", (*mcerror)->message);
else
message (D_ERROR, MSG_ERROR, "%s (%d)", (*mcerror)->message, (*mcerror)->code);
message (D_ERROR, MSG_ERROR, _("%s (%d)"), (*mcerror)->message, (*mcerror)->code);
if (code != NULL)
*code = (*mcerror)->code;
@ -588,7 +588,7 @@ status_msg_init (status_msg_t * sm, const char *title, double delay, status_msg_
sm->dlg = dlg_create (TRUE, 0, 0, 7, min (max (40, COLS / 2), COLS), dialog_colors,
NULL, NULL, NULL, title, DLG_CENTER);
sm->start = start;
sm->delay = delay * G_USEC_PER_SEC;
sm->delay = (guint64) (delay * G_USEC_PER_SEC);
sm->block = FALSE;
sm->init = init_cb;

View File

@ -78,8 +78,8 @@ void query_set_sel (int new_sel);
/* Create message box but don't dismiss it yet, not background safe */
/* *INDENT-OFF* */
struct WDialog *create_message (int flags, const char *title, const char *text, ...)
G_GNUC_PRINTF (3, 4);
WDialog *create_message (int flags, const char *title, const char *text, ...)
G_GNUC_PRINTF (3, 4);
/* Show message box, background safe */
void message (int flags, const char *title, const char *text, ...) G_GNUC_PRINTF (3, 4);

View File

@ -2,15 +2,15 @@ dnl
dnl Support for background operations
dnl
AC_DEFUN([MC_BACKGROUND],
AC_DEFUN([mc_BACKGROUND],
[
AC_ARG_ENABLE([background],
AS_HELP_STRING([--enable-background], [Support for background file operations [yes]]),
[
if test "x$enableval" = xno; then
enable_background=no
enable_background=no
else
enable_background=yes
enable_background=yes
fi
],
[enable_background=yes])

View File

@ -1,4 +1,4 @@
dnl @synopsis MC_CHECK_CFLAGS
dnl @synopsis mc_CHECK_CFLAGS
dnl
dnl Check flags supported by C compiler
dnl
@ -7,7 +7,7 @@ dnl @version 2013-01-16
dnl @license GPL
dnl @copyright Free Software Foundation, Inc.
AC_DEFUN([MC_CHECK_ONE_CFLAG],[
AC_DEFUN([mc_CHECK_ONE_CFLAG],[
AC_MSG_CHECKING([whether ${CC} accepts $1])
@ -35,7 +35,7 @@ AC_DEFUN([MC_CHECK_ONE_CFLAG],[
fi
])
AC_DEFUN([MC_CHECK_CFLAGS],[
AC_DEFUN([mc_CHECK_CFLAGS],[
AC_LANG_PUSH(C)
mc_configured_cflags=""
@ -44,57 +44,61 @@ dnl Sorted -f options:
dnl AC_MSG_CHECKING([CC is $CC])
case "$CC" in
gcc*)
MC_CHECK_ONE_CFLAG([-fdiagnostics-show-option])
dnl MC_CHECK_ONE_CFLAG([-fno-stack-protector])
mc_CHECK_ONE_CFLAG([-fdiagnostics-show-option])
dnl mc_CHECK_ONE_CFLAG([-fno-stack-protector])
;;
*)
;;
esac
dnl Sorted -W options:
MC_CHECK_ONE_CFLAG([-Wbad-function-cast])
MC_CHECK_ONE_CFLAG([-Wcomment])
MC_CHECK_ONE_CFLAG([-Wdeclaration-after-statement])
MC_CHECK_ONE_CFLAG([-Wfloat-equal])
MC_CHECK_ONE_CFLAG([-Wformat])
MC_CHECK_ONE_CFLAG([-Wformat-security])
MC_CHECK_ONE_CFLAG([-Wimplicit])
MC_CHECK_ONE_CFLAG([-Wignored-qualifiers])
MC_CHECK_ONE_CFLAG([-Wmaybe-uninitialized])
MC_CHECK_ONE_CFLAG([-Wmissing-braces])
MC_CHECK_ONE_CFLAG([-Wmissing-declarations])
MC_CHECK_ONE_CFLAG([-Wmissing-field-initializers])
MC_CHECK_ONE_CFLAG([-Wmissing-format-attribute])
MC_CHECK_ONE_CFLAG([-Wmissing-parameter-type])
MC_CHECK_ONE_CFLAG([-Wmissing-prototypes])
MC_CHECK_ONE_CFLAG([-Wmissing-variable-declarations])
MC_CHECK_ONE_CFLAG([-Wnested-externs])
MC_CHECK_ONE_CFLAG([-Wno-long-long])
MC_CHECK_ONE_CFLAG([-Wno-unreachable-code])
MC_CHECK_ONE_CFLAG([-Wparentheses])
MC_CHECK_ONE_CFLAG([-Wpointer-arith])
MC_CHECK_ONE_CFLAG([-Wpointer-sign])
MC_CHECK_ONE_CFLAG([-Wredundant-decls])
MC_CHECK_ONE_CFLAG([-Wreturn-type])
MC_CHECK_ONE_CFLAG([-Wsequence-point])
MC_CHECK_ONE_CFLAG([-Wshadow])
MC_CHECK_ONE_CFLAG([-Wsign-compare])
dnl MC_CHECK_ONE_CFLAG([-Wstrict-aliasing])
MC_CHECK_ONE_CFLAG([-Wstrict-prototypes])
MC_CHECK_ONE_CFLAG([-Wswitch])
MC_CHECK_ONE_CFLAG([-Wswitch-default])
MC_CHECK_ONE_CFLAG([-Wtype-limits])
MC_CHECK_ONE_CFLAG([-Wundef])
MC_CHECK_ONE_CFLAG([-Wuninitialized])
MC_CHECK_ONE_CFLAG([-Wunreachable-code])
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])
MC_CHECK_ONE_CFLAG([-Wunused-result])
MC_CHECK_ONE_CFLAG([-Wunused-value])
MC_CHECK_ONE_CFLAG([-Wunused-variable])
MC_CHECK_ONE_CFLAG([-Wwrite-strings])
mc_CHECK_ONE_CFLAG([-Wassign-enum])
mc_CHECK_ONE_CFLAG([-Wbad-function-cast])
mc_CHECK_ONE_CFLAG([-Wcomment])
mc_CHECK_ONE_CFLAG([-Wconditional-uninitialized])
mc_CHECK_ONE_CFLAG([-Wdeclaration-after-statement])
mc_CHECK_ONE_CFLAG([-Wfloat-conversion])
mc_CHECK_ONE_CFLAG([-Wfloat-equal])
mc_CHECK_ONE_CFLAG([-Wformat])
mc_CHECK_ONE_CFLAG([-Wformat-security])
mc_CHECK_ONE_CFLAG([-Wimplicit])
mc_CHECK_ONE_CFLAG([-Wignored-qualifiers])
mc_CHECK_ONE_CFLAG([-Wlogical-not-parentheses])
mc_CHECK_ONE_CFLAG([-Wmaybe-uninitialized])
mc_CHECK_ONE_CFLAG([-Wmissing-braces])
mc_CHECK_ONE_CFLAG([-Wmissing-declarations])
mc_CHECK_ONE_CFLAG([-Wmissing-field-initializers])
mc_CHECK_ONE_CFLAG([-Wmissing-format-attribute])
mc_CHECK_ONE_CFLAG([-Wmissing-parameter-type])
mc_CHECK_ONE_CFLAG([-Wmissing-prototypes])
mc_CHECK_ONE_CFLAG([-Wmissing-variable-declarations])
mc_CHECK_ONE_CFLAG([-Wnested-externs])
mc_CHECK_ONE_CFLAG([-Wno-long-long])
mc_CHECK_ONE_CFLAG([-Wno-unreachable-code])
mc_CHECK_ONE_CFLAG([-Wparentheses])
mc_CHECK_ONE_CFLAG([-Wpointer-arith])
mc_CHECK_ONE_CFLAG([-Wpointer-sign])
mc_CHECK_ONE_CFLAG([-Wredundant-decls])
mc_CHECK_ONE_CFLAG([-Wreturn-type])
mc_CHECK_ONE_CFLAG([-Wsequence-point])
mc_CHECK_ONE_CFLAG([-Wshadow])
mc_CHECK_ONE_CFLAG([-Wsign-compare])
dnl mc_CHECK_ONE_CFLAG([-Wstrict-aliasing])
mc_CHECK_ONE_CFLAG([-Wstrict-prototypes])
mc_CHECK_ONE_CFLAG([-Wswitch])
mc_CHECK_ONE_CFLAG([-Wswitch-default])
mc_CHECK_ONE_CFLAG([-Wtype-limits])
mc_CHECK_ONE_CFLAG([-Wundef])
mc_CHECK_ONE_CFLAG([-Wuninitialized])
mc_CHECK_ONE_CFLAG([-Wunreachable-code])
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])
mc_CHECK_ONE_CFLAG([-Wunused-result])
mc_CHECK_ONE_CFLAG([-Wunused-value])
mc_CHECK_ONE_CFLAG([-Wunused-variable])
mc_CHECK_ONE_CFLAG([-Wwrite-strings])
AC_LANG_POP()
])

View File

@ -1,4 +1,4 @@
dnl @synopsis MC_VERSION
dnl @synopsis mc_CHECK_SEARCH_TYPE
dnl
dnl Check search type in mc. Currently used glib-regexp or pcre
dnl
@ -7,7 +7,7 @@ dnl @version 2009-06-19
dnl @license GPL
dnl @copyright Free Software Foundation, Inc.
AC_DEFUN([MC_CHECK_SEARCH_TYPE_PCRE],[
AC_DEFUN([mc_CHECK_SEARCH_TYPE_PCRE],[
AX_PATH_LIB_PCRE
if test x"${PCRE_LIBS}" = x; then
AC_MSG_ERROR([Your system don't have pcre library (or pcre devel stuff)])
@ -18,18 +18,18 @@ AC_DEFUN([MC_CHECK_SEARCH_TYPE_PCRE],[
])
AC_DEFUN([MC_CHECK_SEARCH_TYPE_GLIB],[
AC_DEFUN([mc_CHECK_SEARCH_TYPE_GLIB],[
$PKG_CONFIG --max-version 2.14 glib-2.0
if test $? -eq 0; then
AC_MSG_RESULT([[Selected 'glib' search engine, but you don't have glib >= 2.14. Trying to use 'pcre' engine], (WARNING)])
MC_CHECK_SEARCH_TYPE_PCRE
mc_CHECK_SEARCH_TYPE_PCRE
else
AC_DEFINE(SEARCH_TYPE_GLIB, 1, [Define to select 'glib-regexp' search type])
fi
])
AC_DEFUN([MC_CHECK_SEARCH_TYPE],[
AC_DEFUN([mc_CHECK_SEARCH_TYPE],[
AC_ARG_WITH([search-engine],
AS_HELP_STRING([--with-search-engine=type],
@ -40,7 +40,7 @@ AC_DEFUN([MC_CHECK_SEARCH_TYPE],[
SEARCH_TYPE="glib-regexp"
;;
xpcre)
MC_CHECK_SEARCH_TYPE_PCRE
mc_CHECK_SEARCH_TYPE_PCRE
;;
x)
SEARCH_TYPE="glib-regexp"
@ -51,6 +51,6 @@ AC_DEFUN([MC_CHECK_SEARCH_TYPE],[
esac
if test x"$SEARCH_TYPE" = x"glib-regexp"; then
MC_CHECK_SEARCH_TYPE_GLIB
mc_CHECK_SEARCH_TYPE_GLIB
fi
])

View File

@ -3,7 +3,7 @@ dnl Check whether the g_module_* family of functions works
dnl on this system. We need to know that at the compile time to
dnl decide whether to link with X11.
dnl
AC_DEFUN([AC_G_MODULE_SUPPORTED], [
AC_DEFUN([mc_G_MODULE_SUPPORTED], [
g_module_supported=""
@ -67,7 +67,7 @@ AC_DEFUN([AC_G_MODULE_SUPPORTED], [
])
AC_DEFUN([AC_CHECK_GLIB], [
AC_DEFUN([mc_CHECK_GLIB], [
dnl
dnl First try glib 2.x.
dnl Keep this check close to the beginning, so that the users

View File

@ -1,4 +1,4 @@
dnl @synopsis MC_DOC_LINGUAS
dnl @synopsis mc_I18N
dnl
dnl Check if environment is ready for get translations of docs from transifex
dnl
@ -7,7 +7,7 @@ dnl @version 2011-02-10
dnl @license GPL
dnl @copyright Free Software Foundation, Inc.
AC_DEFUN([MC_I18N],[
AC_DEFUN([mc_I18N],[
if test "x$USE_INCLUDED_LIBINTL" = xyes; then
CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl -I\$(top_srcdir)/intl"

View File

@ -1,7 +1,7 @@
dnl
dnl Subshell support.
dnl
AC_DEFUN([MC_SUBSHELL], [
AC_DEFUN([mc_SUBSHELL], [
AC_MSG_CHECKING([for subshell support])
AC_ARG_WITH(subshell,

View File

@ -1,4 +1,4 @@
dnl @synopsis MC_UNIT_TESTS
dnl @synopsis mc_UNIT_TESTS
dnl
dnl Check if unit tests enabled
dnl
@ -7,7 +7,7 @@ dnl @version 2011-02-10
dnl @license GPL
dnl @copyright Free Software Foundation, Inc.
AC_DEFUN([MC_UNIT_TESTS],[
AC_DEFUN([mc_UNIT_TESTS],[
AC_ARG_ENABLE(
[tests],

View File

@ -1,7 +1,7 @@
dnl
dnl Try using termcap database and link with libtermcap if possible.
dnl
AC_DEFUN([MC_USE_TERMCAP], [
AC_DEFUN([mc_USE_TERMCAP], [
screen_msg="$screen_msg with termcap database"
AC_MSG_NOTICE([using S-Lang screen library with termcap])
AC_DEFINE(USE_TERMCAP, 1, [Define to use termcap database])
@ -11,7 +11,7 @@ AC_DEFUN([MC_USE_TERMCAP], [
dnl
dnl Check if the installed S-Lang library uses termcap
dnl
AC_DEFUN([MC_SLANG_TERMCAP], [
AC_DEFUN([mc_SLANG_TERMCAP], [
unset ac_cv_lib_termcap_tgoto
AC_CACHE_CHECK([if S-Lang uses termcap], [mc_cv_slang_termcap], [
@ -31,6 +31,6 @@ AC_DEFUN([MC_SLANG_TERMCAP], [
])
if test x"$mc_cv_slang_termcap" = xyes; then
MC_USE_TERMCAP
mc_USE_TERMCAP
fi
])

View File

@ -1,4 +1,4 @@
dnl @synopsis MC_VERSION
dnl @synopsis mc_VERSION
dnl
dnl Get current version of Midnight Commander from git tags
dnl
@ -7,7 +7,7 @@ dnl @version 2009-12-30
dnl @license GPL
dnl @copyright Free Software Foundation, Inc.
AC_DEFUN([MC_VERSION],[
AC_DEFUN([mc_VERSION],[
if test ! -f ${srcdir}/version.h; then
${srcdir}/maint/utils/version.sh ${srcdir}
fi

View File

@ -1,4 +1,4 @@
AC_DEFUN([AC_MC_VFS_ADDNAME],
AC_DEFUN([mc_VFS_ADDNAME],
[
if test x"$vfs_flags" = "x" ; then
vfs_flags="$1"
@ -19,7 +19,7 @@ m4_include([m4.include/vfs/mc-vfs-tarfs.m4])
m4_include([m4.include/vfs/mc-vfs-cpiofs.m4])
m4_include([m4.include/vfs/mc-vfs-samba.m4])
dnl MC_VFS_CHECKS
dnl mc_VFS_CHECKS
dnl Check for various functions needed by libvfs.
dnl This has various effects:
dnl Sets MC_VFS_LIBS to libraries required
@ -28,7 +28,7 @@ dnl Sets shell variable enable_vfs to yes (default, --with-vfs) or
dnl "no" (--without-vfs).
dnl Private define
AC_DEFUN([MC_ENABLE_VFS_NET],
AC_DEFUN([mc_ENABLE_VFS_NET],
[
dnl FIXME: network checks should probably be in their own macro.
AC_REQUIRE_SOCKET
@ -48,7 +48,7 @@ AC_DEFUN([MC_ENABLE_VFS_NET],
fi
])
AC_DEFUN([AC_MC_VFS_CHECKS],
AC_DEFUN([mc_VFS_CHECKS],
[
vfs_type="normal"
@ -69,20 +69,20 @@ AC_DEFUN([AC_MC_VFS_CHECKS],
AC_DEFINE(ENABLE_VFS, [1], [Define to enable VFS support])
fi
AC_MC_VFS_CPIOFS
AC_MC_VFS_TARFS
AC_MC_VFS_SFS
AC_MC_VFS_EXTFS
AC_MC_VFS_UNDELFS
AC_MC_VFS_FTP
AC_MC_VFS_SFTP
AC_MC_VFS_FISH
AC_MC_VFS_SMB
mc_VFS_CPIOFS
mc_VFS_EXTFS
mc_VFS_FISH
mc_VFS_FTP
mc_VFS_SFS
mc_VFS_SFTP
mc_VFS_SMB
mc_VFS_TARFS
mc_VFS_UNDELFS
AM_CONDITIONAL(ENABLE_VFS, [test x"$enable_vfs" = x"yes"])
if test x"$enable_vfs_ftp" = x"yes" -o x"$enable_vfs_fish" = x"yes" -o x"$enable_vfs_smb" = x"yes"; then
MC_ENABLE_VFS_NET
mc_ENABLE_VFS_NET
fi
AM_CONDITIONAL([ENABLE_VFS_NET], [test x"$enable_vfs_net" = x"yes"])

View File

@ -1,7 +1,7 @@
dnl
dnl Internal editor support.
dnl
AC_DEFUN([MC_WITH_INTERNAL_EDIT], [
AC_DEFUN([mc_WITH_INTERNAL_EDIT], [
AC_ARG_WITH([internal_edit],
AS_HELP_STRING([--with-internal-edit], [Enable internal editor @<:@yes@:>@]))

View File

@ -1,5 +1,5 @@
dnl check for ncurses in user supplied path
AC_DEFUN([MC_CHECK_NCURSES_BY_PATH], [
AC_DEFUN([mc_CHECK_NCURSES_BY_PATH], [
ac_ncurses_inc_path=[$1]
ac_ncurses_lib_path=[$2]
@ -70,7 +70,7 @@ dnl
dnl If ncurses exports the ESCDELAY variable it should be set to 0
dnl or you'll have to press Esc three times to dismiss a dialog box.
dnl
AC_DEFUN([MC_WITH_NCURSES], [
AC_DEFUN([mc_WITH_NCURSES], [
dnl has_colors() is specific to ncurses, it's not in the old curses
save_LIBS="$LIBS"
ncursesw_found=
@ -96,7 +96,7 @@ AC_DEFUN([MC_WITH_NCURSES], [
dnl we need at least the inc path, the lib may be in a std location
if test x"$ac_ncurses_inc_path" != x; then
dnl check the user supplied location
MC_CHECK_NCURSES_BY_PATH([$ac_ncurses_inc_path],[$ac_ncurses_lib_path])
mc_CHECK_NCURSES_BY_PATH([$ac_ncurses_inc_path],[$ac_ncurses_lib_path])
LIBS=
AC_SEARCH_LIBS([has_colors], [ncurses], [MCLIBS="$MCLIBS $LIBS"],
@ -160,7 +160,7 @@ dnl If ncursesw exports the ESCDELAY variable it should be set to 0
dnl or you'll have to press Esc three times to dismiss a dialog box.
dnl
AC_DEFUN([MC_WITH_NCURSESW], [
AC_DEFUN([mc_WITH_NCURSESW], [
dnl has_colors() is specific to ncurses, it's not in the old curses
save_LIBS="$LIBS"
LIBS=

View File

@ -1,6 +1,6 @@
dnl Check the header
AC_DEFUN([MC_CHECK_SLANG_HEADER], [
AC_DEFUN([mc_CHECK_SLANG_HEADER], [
AC_MSG_CHECKING([for slang/slang.h])
AC_PREPROC_IFELSE(
[
@ -21,7 +21,7 @@ dnl
dnl Check if the system S-Lang library can be used.
dnl If not, and $1 is "strict", exit.
dnl
AC_DEFUN([MC_CHECK_SLANG_BY_PATH], [
AC_DEFUN([mc_CHECK_SLANG_BY_PATH], [
param_slang_inc_path=[$1]
param_slang_lib_path=[$2]
@ -60,7 +60,7 @@ AC_DEFUN([MC_CHECK_SLANG_BY_PATH], [
[
AC_MSG_RESULT(no)
MC_CHECK_SLANG_HEADER
mc_CHECK_SLANG_HEADER
if test x"$found_slang" = xno; then
error_msg_slang="S-Lang header not found"
else
@ -117,7 +117,7 @@ int main (void)
dnl Check if termcap is needed.
dnl This check must be done before anything is linked against S-Lang.
if test x"$found_slang" = x"yes"; then
MC_SLANG_TERMCAP
mc_SLANG_TERMCAP
if test x"$mc_cv_slang_termcap" = x"yes"; then
saved_CPPFLAGS="$saved_CPPFLAGS "
saved_LDFLAGS="-ltermcap $saved_LDFLAGS"
@ -154,7 +154,7 @@ int main (void)
dnl
dnl Use the slang library.
dnl
AC_DEFUN([MC_WITH_SLANG], [
AC_DEFUN([mc_WITH_SLANG], [
with_screen=slang
found_slang=yes
error_msg_slang=""
@ -176,7 +176,7 @@ AC_DEFUN([MC_WITH_SLANG], [
)
if test x"$ac_slang_lib_path" != x -o x"$ac_slang_inc_path" != x; then
echo 'checking S-Lang headers in specified place ...'
MC_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
mc_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
else
found_slang=no
PKG_CHECK_MODULES(SLANG, [slang >= 2.0], [found_slang=yes], [:])
@ -192,14 +192,14 @@ AC_DEFUN([MC_WITH_SLANG], [
ac_slang_lib_path="/usr/lib"
echo 'checking S-Lang headers in /usr ...'
MC_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
mc_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
if test x"$found_slang" = "xno"; then
found_slang=yes
ac_slang_inc_path="/usr/local/include"
ac_slang_lib_path="/usr/local/lib"
echo 'checking S-Lang headers in /usr/local ...'
MC_CHECK_SLANG_BY_PATH( $ac_slang_inc_path , $ac_slang_lib_path )
mc_CHECK_SLANG_BY_PATH( $ac_slang_inc_path , $ac_slang_lib_path )
if test x"$found_slang" = "xno"; then
AC_MSG_ERROR([$error_msg_slang])
fi
@ -208,5 +208,5 @@ AC_DEFUN([MC_WITH_SLANG], [
AC_DEFINE(HAVE_SLANG, 1, [Define to use S-Lang library for screen management])
MC_CHECK_SLANG_HEADER
mc_CHECK_SLANG_HEADER
])

View File

@ -5,7 +5,7 @@ dnl
dnl Select the screen library.
dnl
AC_DEFUN([MC_WITH_SCREEN], [
AC_DEFUN([mc_WITH_SCREEN], [
AC_ARG_WITH([screen],
AS_HELP_STRING([--with-screen=@<:@LIB@:>@],
@ -13,13 +13,13 @@ AC_DEFUN([MC_WITH_SCREEN], [
case x$with_screen in
x | xslang)
MC_WITH_SLANG
mc_WITH_SLANG
;;
xncurses)
MC_WITH_NCURSES
mc_WITH_NCURSES
;;
xncursesw)
MC_WITH_NCURSESW
mc_WITH_NCURSESW
;;
*)
AC_MSG_ERROR([Value of the screen library is incorrect])

View File

@ -1,7 +1,7 @@
dnl X11 support.
dnl Used to read keyboard modifiers when running under X11.
AC_DEFUN([MC_WITH_X], [
AC_DEFUN([mc_WITH_X], [
AC_PATH_XTRA

View File

@ -1,12 +1,12 @@
dnl CPIO filesystem support
AC_DEFUN([AC_MC_VFS_CPIOFS],
AC_DEFUN([mc_VFS_CPIOFS],
[
AC_ARG_ENABLE([vfs-cpio],
AS_HELP_STRING([--enable-vfs-cpio], [Support for cpio filesystem @<:@yes@:>@]))
if test "$enable_vfs" = "yes" -a x"$enable_vfs_cpio" != x"no"; then
enable_vfs_cpio="yes"
AC_DEFINE([ENABLE_VFS_CPIO], [1], [Support for cpio filesystem])
AC_MC_VFS_ADDNAME([cpio])
mc_VFS_ADDNAME([cpio])
fi
AM_CONDITIONAL(ENABLE_VFS_CPIO, [test "$enable_vfs" = "yes" -a x"$enable_vfs_cpio" = x"yes"])
])

View File

@ -1,8 +1,8 @@
dnl AC_MC_EXTFS_CHECKS
dnl mc_EXTFS_CHECKS
dnl Check for tools used in extfs scripts.
dnl FIXME: make this configurable
AC_DEFUN([AC_MC_EXTFS_CHECKS], [
AC_DEFUN([mc_EXTFS_CHECKS], [
AC_PATH_PROG([ZIP], [zip], [/usr/bin/zip])
AC_PATH_PROG([UNZIP], [unzip], [/usr/bin/unzip])
AC_CACHE_CHECK([for zipinfo code in unzip], [mc_cv_have_zipinfo],
@ -20,14 +20,14 @@ AC_DEFUN([AC_MC_EXTFS_CHECKS], [
dnl Enable Extfs (classic)
AC_DEFUN([AC_MC_VFS_EXTFS],
AC_DEFUN([mc_VFS_EXTFS],
[
AC_ARG_ENABLE([vfs-extfs],
AS_HELP_STRING([--enable-vfs-extfs], [Support for extfs filesystem @<:@yes@:>@]))
if test "$enable_vfs" = "yes" -a x"$enable_vfs_extfs" != x"no"; then
AC_MC_EXTFS_CHECKS
mc_EXTFS_CHECKS
enable_vfs_extfs="yes"
AC_MC_VFS_ADDNAME([extfs])
mc_VFS_ADDNAME([extfs])
AC_DEFINE([ENABLE_VFS_EXTFS], [1], [Support for extfs])
fi
AM_CONDITIONAL(ENABLE_VFS_EXTFS, [test "$enable_vfs" = "yes" -a x"$enable_vfs_extfs" = x"yes"])

View File

@ -1,11 +1,11 @@
dnl Enable FISH protocol (classic)
AC_DEFUN([AC_MC_VFS_FISH],
AC_DEFUN([mc_VFS_FISH],
[
AC_ARG_ENABLE([vfs-fish],
AS_HELP_STRING([--enable-vfs-fish], [Support for FISH filesystem @<:@yes@:>@]))
if test "$enable_vfs" = "yes" -a "x$enable_vfs_fish" != xno; then
enable_vfs_fish="yes"
AC_MC_VFS_ADDNAME([fish])
mc_VFS_ADDNAME([fish])
AC_DEFINE([ENABLE_VFS_FISH], [1], [Support for FISH vfs])
fi
AM_CONDITIONAL(ENABLE_VFS_FISH, [test "$enable_vfs" = "yes" -a x"$enable_vfs_fish" = x"yes"])

View File

@ -1,11 +1,11 @@
dnl Enable FTP filesystem (classic)
AC_DEFUN([AC_MC_VFS_FTP],
AC_DEFUN([mc_VFS_FTP],
[
AC_ARG_ENABLE([vfs-ftp],
AS_HELP_STRING([--enable-vfs-ftp], [Support for FTP filesystem @<:@yes@:>@]))
if test "$enable_vfs" != "no" -a x"$enable_vfs_ftp" != x"no"; then
enable_vfs_ftp="yes"
AC_MC_VFS_ADDNAME([ftp])
mc_VFS_ADDNAME([ftp])
AC_DEFINE([ENABLE_VFS_FTP], [1], [Support for FTP (classic)])
fi
AM_CONDITIONAL([ENABLE_VFS_FTP], [test "$enable_vfs" = "yes" -a x"$enable_vfs_ftp" = x"yes"])

View File

@ -1,5 +1,5 @@
dnl Samba support
AC_DEFUN([AC_MC_VFS_SMB],
AC_DEFUN([mc_VFS_SMB],
[
AC_ARG_ENABLE([vfs-smb],
AS_HELP_STRING([--enable-vfs-smb], [Support for SMB filesystem @<:@no@:>@]),
@ -14,7 +14,7 @@ AC_DEFUN([AC_MC_VFS_SMB],
if test "$enable_vfs" = "yes" -a x"$enable_vfs_smb" != x"no"; then
enable_vfs_smb="yes"
AC_MC_VFS_ADDNAME([smb])
mc_VFS_ADDNAME([smb])
AC_DEFINE([ENABLE_VFS_SMB], [1], [Define to enable VFS over SMB])
fi

View File

@ -1,11 +1,11 @@
dnl SFS support
AC_DEFUN([AC_MC_VFS_SFS],
AC_DEFUN([mc_VFS_SFS],
[
AC_ARG_ENABLE([vfs-sfs],
AS_HELP_STRING([--enable-vfs-sfs], [Support for sfs filesystem @<:@yes@:>@]))
if test "$enable_vfs" = "yes" -a x"$enable_vfs_sfs" != x"no"; then
enable_vfs_sfs="yes"
AC_MC_VFS_ADDNAME([sfs])
mc_VFS_ADDNAME([sfs])
AC_DEFINE([ENABLE_VFS_SFS], [1], [Support for sfs])
fi
AM_CONDITIONAL(ENABLE_VFS_SFS, [test "$enable_vfs" = "yes" -a x"$enable_vfs_sfs" = x"yes"])

View File

@ -1,12 +1,12 @@
dnl Enable SFTP filesystem
AC_DEFUN([AC_MC_VFS_SFTP],
AC_DEFUN([mc_VFS_SFTP],
[
AC_ARG_ENABLE([vfs-sftp],
AS_HELP_STRING([--enable-vfs-sftp], [Support for SFTP filesystem [auto]]))
if test "$enable_vfs" != "no" -a x"$enable_vfs_sftp" != x"no"; then
PKG_CHECK_MODULES(LIBSSH, [libssh2 >= 1.2.5], [found_libssh=yes], [:])
if test x"$found_libssh" = "xyes"; then
AC_MC_VFS_ADDNAME([sftp])
mc_VFS_ADDNAME([sftp])
AC_DEFINE([ENABLE_VFS_SFTP], [1], [Support for SFTP filesystem])
MCLIBS="$MCLIBS $LIBSSH_LIBS"
enable_vfs_sftp="yes"

View File

@ -1,11 +1,11 @@
dnl TAR filesystem support
AC_DEFUN([AC_MC_VFS_TARFS],
AC_DEFUN([mc_VFS_TARFS],
[
AC_ARG_ENABLE([vfs-tar],
AS_HELP_STRING([--enable-vfs-tar], [Support for tar filesystem @<:@yes@:>@]))
if test "$enable_vfs" = "yes" -a x"$enable_vfs_tar" != x"no"; then
enable_vfs_tar="yes"
AC_MC_VFS_ADDNAME([tar])
mc_VFS_ADDNAME([tar])
AC_DEFINE([ENABLE_VFS_TAR], [1], [Support for tar filesystem])
fi
AM_CONDITIONAL(ENABLE_VFS_TAR, [test "$enable_vfs" = "yes" -a x"$enable_vfs_tar" = x"yes"])

View File

@ -1,10 +1,10 @@
dnl MC_UNDELFS_CHECKS
dnl mc_UNDELFS_CHECKS
dnl Check for ext2fs undel support.
dnl Set shell variable ext2fs_undel to "yes" if we have it,
dnl "no" otherwise. May define ENABLE_VFS_UNDELFS for cpp.
dnl Will set EXT2FS_UNDEL_LIBS to required libraries.
AC_DEFUN([MC_UNDELFS_CHECKS], [
AC_DEFUN([mc_UNDELFS_CHECKS], [
ext2fs_undel=no
EXT2FS_UNDEL_LIBS=
AC_CHECK_HEADERS([ext2fs/ext2_fs.h linux/ext2_fs.h], [ext2_fs_h=yes; break])
@ -45,7 +45,7 @@ AC_DEFUN([MC_UNDELFS_CHECKS], [
dnl
dnl Ext2fs undelete support
dnl
AC_DEFUN([AC_MC_VFS_UNDELFS],
AC_DEFUN([mc_VFS_UNDELFS],
[
AC_ARG_ENABLE([vfs-undelfs],
AS_HELP_STRING([--enable-vfs-undelfs], [Support for ext2 undelete filesystem @<:@no@:>@]),
@ -59,11 +59,11 @@ AC_DEFUN([AC_MC_VFS_UNDELFS],
[enable_vfs_undelfs="no"])
if test x"$enable_vfs" = x"yes" -a x"$enable_vfs_undelfs" != x"no"; then
MC_UNDELFS_CHECKS
mc_UNDELFS_CHECKS
if test x"$ext2fs_undel" = x"yes"; then
enable_vfs_undelfs="yes"
AC_MC_VFS_ADDNAME([undelfs])
mc_VFS_ADDNAME([undelfs])
AC_DEFINE(ENABLE_VFS_UNDELFS, [1], [Support for ext2 undelfs])
AC_MSG_NOTICE([using ext2fs file recovery code])
MCLIBS="$MCLIBS $EXT2FS_UNDEL_LIBS"

View File

@ -23,25 +23,24 @@
regexp=^core\\.*\\d*$
[temp]
extensions=tmp;$$$;~;bak
extensions=~;$$$;bak;tmp
extensions_case=false
regexp=(^#.*|.*~$)
[archive]
extensions=gz;bz2;tar;tgz;rpm;Z;rar;zip;arj;cab;lzh;lha;zoo;arc;ark;xz;tbz;tbz2;7z;ace;lz4;lz;tlz
extensions=7z;Z;ace;arc;arj;ark;bz2;cab;gz;lha;lz;lz4;lzh;lzma;rar;rpm;tar;tbz;tbz2;tgz;tlz;xz;zip;zoo
[doc]
extensions=txt;doc;rtf;diz;ctl;me;ps;pdf;xml;xsd;xslt;dtd;html;shtml;htm;mail;msg;lsm;po;nroff;man;tex;sgml;css;text;letter;chm;docx;docm;xlsx;xlsm;pptx;pptm
extensions=chm;css;ctl;diz;doc;docm;docx;dtd;htm;html;letter;lsm;mail;man;me;msg;nroff;pdf;po;pptm;pptx;ps;rtf;sgml;shtml;tex;text;txt;xlsm;xlsx;xml;xsd;xslt
[source]
extensions=c;h;cc;hh;cpp;cxx;hpp;asm;py;pl;pm;inc;cgi;php;phps;js;java;jav;jasm;sh;bash;diff;patch;pas;tcl;tk;awk;m4;st;mak;sl;ada;caml;ml;mli;mly;mll;mlp;sas;prg;hs;hi;erl
extensions=ada;asm;awk;bash;c;caml;cc;cgi;cpp;cxx;diff;erl;h;hh;hi;hpp;hs;inc;jasm;jav;java;js;m4;mak;ml;mli;mll;mlp;mly;pas;patch;php;phps;pl;pm;prg;py;sas;sh;sl;st;tcl;tk
[media]
extensions=mp2;mp3;mpg;ogg;ogv;mpeg;wav;avi;asf;mov;mol;mpl;xm;mod;it;med;mid;midi;s3m;umx;vob;mkv;flv;mp4;m3u;flac;ape;wma;wmv;3gp;webm
extensions=3gp;ape;asf;avi;flac;flv;it;m3u;med;mid;midi;mkv;mod;mol;mov;mp2;mp3;mp4;mpeg;mpg;mpl;ogg;ogv;s3m;umx;vob;wav;webm;wma;wmv;xm
[graph]
extensions=jpg;jpeg;gif;png;tif;pcx;bmp;xpm;xbm;eps;pic;rle;ico;wmf;omf;ai;cdr
extensions=ai;bmp;cdr;eps;gif;ico;jpeg;jpg;omf;pcx;pic;png;rle;tif;wmf;xbm;xpm
[database]
extensions=dbf;mdn;db;mdb;dat;fox;dbx;mdx;sql;mssql;msql;ssql;pgsql;xls;cdx;dbi
extensions=cdx;dat;db;dbf;dbi;dbx;fox;mdb;mdn;mdx;msql;mssql;pgsql;sql;ssql;xls

View File

@ -471,13 +471,13 @@ o Open bash to next free console
u Upper case selection
TMPFILE=`mktemp ${MC_TMPDIR:-/tmp}/up.XXXXXX` || exit 1
cat %b > $TMPFILE
cat $TMPFILE| sed 's/\(.*\)/\U\1/' >%b
sed 's/\(.*\)/\U\1/' $TMPFILE >%b
rm -f $TMPFILE
l Lower case selection
TMPFILE=`mktemp ${MC_TMPDIR:-/tmp}/up.XXXXXX` || exit 1
cat %b > $TMPFILE
cat $TMPFILE| sed 's/\(.*\)/\U\1/' >%b
sed 's/\(.*\)/\L\1/' $TMPFILE >%b
rm -f $TMPFILE
#-------------------------- End of common section -----------------------------

889
po/mc.pot

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@ SUBDIRS += consaver
AM_CPPFLAGS += -DSAVERDIR=\""$(pkglibexecdir)"\"
endif
AM_CPPFLAGS += -I$(top_srcdir) $(GLIB_CFLAGS) $(PCRE_CPPFLAGS)
AM_CPPFLAGS += -I$(top_srcdir) $(GLIB_CFLAGS)
localedir = $(datadir)/locale
pkglibexecdir = $(libexecdir)/@PACKAGE@

View File

@ -66,7 +66,9 @@ char *mc_args__netfs_logfile = NULL;
char *mc_args__keymap_file = NULL;
/* Debug level */
#ifdef ENABLE_VFS_SMB
int mc_args__debug_level = 0;
#endif
void *mc_run_param0 = NULL;
char *mc_run_param1 = NULL;
@ -467,6 +469,42 @@ parse_mc_v_argument (const gchar * option_name, const gchar * value, gpointer da
return TRUE;
}
/* --------------------------------------------------------------------------------------------- */
/**
* Create mcedit_arg_t object from vfs_path_t object and the line number.
*
* @param file_vpath file path object
* @param line_number line number. If value is 0, try to restore saved position.
* @return mcedit_arg_t object
*/
static mcedit_arg_t *
mcedit_arg_vpath_new (vfs_path_t * file_vpath, long line_number)
{
mcedit_arg_t *arg;
arg = g_new (mcedit_arg_t, 1);
arg->file_vpath = file_vpath;
arg->line_number = line_number;
return arg;
}
/* --------------------------------------------------------------------------------------------- */
/**
* Create mcedit_arg_t object from file name and the line number.
*
* @param file_name file name
* @param line_number line number. If value is 0, try to restore saved position.
* @return mcedit_arg_t object
*/
static mcedit_arg_t *
mcedit_arg_new (const char *file_name, long line_number)
{
return mcedit_arg_vpath_new (vfs_path_from_str (file_name), line_number);
}
/* --------------------------------------------------------------------------------------------- */
/**
* Get list of filenames (and line numbers) from command line, when mc called as editor
@ -791,42 +829,6 @@ mc_setup_by_args (int argc, char **argv, GError ** mcerror)
return TRUE;
}
/* --------------------------------------------------------------------------------------------- */
/**
* Create mcedit_arg_t object from file name and the line number.
*
* @param file_name file name
* @param line_number line number. If value is 0, try to restore saved position.
* @return mcedit_arg_t object
*/
mcedit_arg_t *
mcedit_arg_new (const char *file_name, long line_number)
{
return mcedit_arg_vpath_new (vfs_path_from_str (file_name), line_number);
}
/* --------------------------------------------------------------------------------------------- */
/**
* Create mcedit_arg_t object from vfs_path_t object and the line number.
*
* @param file_vpath file path object
* @param line_number line number. If value is 0, try to restore saved position.
* @return mcedit_arg_t object
*/
mcedit_arg_t *
mcedit_arg_vpath_new (vfs_path_t * file_vpath, long line_number)
{
mcedit_arg_t *arg;
arg = g_new (mcedit_arg_t, 1);
arg->file_vpath = file_vpath;
arg->line_number = line_number;
return arg;
}
/* --------------------------------------------------------------------------------------------- */
/**
* Free the mcedit_arg_t object.

View File

@ -25,7 +25,9 @@ extern gboolean mc_args__nokeymap;
extern char *mc_args__last_wd_file;
extern char *mc_args__netfs_logfile;
extern char *mc_args__keymap_file;
#ifdef ENABLE_VFS_SMB
extern int mc_args__debug_level;
#endif
/*
* MC_RUN_FULL: dir for left panel
@ -48,8 +50,6 @@ gboolean mc_args_parse (int *argc, char ***argv, const char *translation_domain,
gboolean mc_args_show_info (void);
gboolean mc_setup_by_args (int argc, char **argv, GError ** mcerror);
mcedit_arg_t *mcedit_arg_new (const char *file_name, long line_number);
mcedit_arg_t *mcedit_arg_vpath_new (vfs_path_t * file_vpath, long line_number);
void mcedit_arg_free (mcedit_arg_t * arg);
/*** inline functions ****************************************************************************/

View File

@ -76,7 +76,7 @@ static int parent_fd;
/* File descriptor for messages from our parent */
static int from_parent_fd;
struct TaskList *task_list = NULL;
TaskList *task_list = NULL;
static int background_attention (int fd, void *closure);
@ -211,7 +211,7 @@ background_attention (int fd, void *closure)
int argc, i, status;
char *data[MAXCALLARGS];
ssize_t bytes, ret;
struct TaskList *p;
TaskList *p;
int to_child_fd = -1;
enum ReturnType type;

View File

@ -31,7 +31,7 @@ typedef struct TaskList
/*** global variables defined in .c file *********************************************************/
extern struct TaskList *task_list;
extern TaskList *task_list;
/*** declarations of public functions ************************************************************/

View File

@ -34,10 +34,10 @@
#define EDIT_TEXT_HORIZONTAL_OFFSET 0
#define EDIT_TEXT_VERTICAL_OFFSET 0
#define EDIT_RIGHT_EXTREME option_edit_right_extreme
#define EDIT_LEFT_EXTREME option_edit_left_extreme
#define EDIT_TOP_EXTREME option_edit_top_extreme
#define EDIT_BOTTOM_EXTREME option_edit_bottom_extreme
#define EDIT_RIGHT_EXTREME 0
#define EDIT_LEFT_EXTREME 0
#define EDIT_TOP_EXTREME 0
#define EDIT_BOTTOM_EXTREME 0
/* Initial size of the undo stack, in bytes */
#define START_STACK_SIZE 32
@ -113,9 +113,6 @@ typedef struct edit_stack_type
vfs_path_t *filename_vpath;
} edit_stack_type;
struct Widget;
struct WMenuBar;
/*** global variables defined in .c file *********************************************************/
extern const char VERTICAL_MAGIC[5];
@ -132,11 +129,6 @@ extern int option_line_state_width;
extern int option_max_undo;
extern int option_auto_syntax;
extern int option_edit_right_extreme;
extern int option_edit_left_extreme;
extern int option_edit_top_extreme;
extern int option_edit_bottom_extreme;
extern gboolean search_create_bookmark;
extern char *edit_window_state_char;
@ -151,7 +143,7 @@ gboolean edit_widget_is_editor (const Widget * w);
gboolean edit_drop_hotkey_menu (WDialog * h, int key);
void edit_menu_cmd (WDialog * h);
void user_menu (WEdit * edit, const char *menu_file, int selected_entry);
void edit_init_menu (struct WMenuBar *menubar);
void edit_init_menu (WMenuBar * menubar);
void edit_save_mode_cmd (void);
off_t edit_move_forward3 (const WEdit * edit, off_t current, long cols, off_t upto);
void edit_scroll_screen_over_cursor (WEdit * edit);

View File

@ -91,10 +91,6 @@ int option_line_state_width = 0;
gboolean option_cursor_after_inserted_block = FALSE;
int option_state_full_filename = 0;
int option_edit_right_extreme = 0;
int option_edit_left_extreme = 0;
int option_edit_top_extreme = 0;
int option_edit_bottom_extreme = 0;
int enable_show_tabs_tws = 1;
int option_check_nl_at_eof = 0;
int option_group_undo = 0;
@ -876,7 +872,7 @@ edit_cursor_to_eol (WEdit * edit)
static unsigned long
my_type_of (int c)
{
int x, r = 0;
unsigned long x, r = 0;
const char *p, *q;
const char option_chars_move_whole_word[] =
"!=&|<>^~ !:;, !'!`!.?!\"!( !) !{ !} !Aa0 !+-*/= |<> ![ !] !\\#! ";
@ -1685,7 +1681,7 @@ edit_insert_column_from_file (WEdit * edit, int file, off_t * start_pos, off_t *
long *col1, long *col2)
{
off_t cursor;
int col;
long col;
off_t blocklen = -1, width = 0;
unsigned char *data;
@ -2359,7 +2355,7 @@ edit_push_undo_action (WEdit * edit, long c)
&& spm1 != edit->undo_stack_bottom
&& ((sp - 2) & edit->undo_stack_size_mask) != edit->undo_stack_bottom)
{
int d;
long d;
if (edit->undo_stack[spm1] < 0)
{
d = edit->undo_stack[(sp - 2) & edit->undo_stack_size_mask];
@ -2438,7 +2434,7 @@ edit_push_redo_action (WEdit * edit, long c)
&& spm1 != edit->redo_stack_bottom
&& ((sp - 2) & edit->redo_stack_size_mask) != edit->redo_stack_bottom)
{
int d;
long d;
if (edit->redo_stack[spm1] < 0)
{
d = edit->redo_stack[(sp - 2) & edit->redo_stack_size_mask];
@ -2969,7 +2965,7 @@ edit_move_to_prev_col (WEdit * edit, off_t p)
fake_half_tabs = HALF_TAB_SIZE * space_width;
if (fake_half_tabs != 0 && edit->curs_col % fake_half_tabs != 0)
{
int q;
long q;
q = edit->curs_col;
edit->curs_col -= (edit->curs_col % fake_half_tabs);

View File

@ -70,7 +70,7 @@ void edit_stack_free (void);
gboolean edit_file (const vfs_path_t * file_vpath, long line);
gboolean edit_files (const GList * files);
char *edit_get_file_name (const WEdit * edit);
const char *edit_get_file_name (const WEdit * edit);
long edit_get_curs_col (const WEdit * edit);
const char *edit_get_syntax_type (const WEdit * edit);

View File

@ -401,7 +401,7 @@ edit_buffer_get_word_from_pos (const edit_buffer_t * buf, off_t start_pos, off_t
gsize * cut)
{
off_t word_start;
long cut_len = 0;
gsize cut_len = 0;
GString *match_expr;
int c1, c2;
@ -513,9 +513,11 @@ edit_buffer_delete (edit_buffer_t * buf)
if (i == 0)
{
i = buf->b2->len - 1;
b = g_ptr_array_index (buf->b2, i);
g_ptr_array_remove_index (buf->b2, i);
guint j;
j = buf->b2->len - 1;
b = g_ptr_array_index (buf->b2, j);
g_ptr_array_remove_index (buf->b2, j);
g_free (b);
}
@ -549,9 +551,11 @@ edit_buffer_backspace (edit_buffer_t * buf)
if (i == 0)
{
i = buf->b1->len - 1;
b = g_ptr_array_index (buf->b1, i);
g_ptr_array_remove_index (buf->b1, i);
guint j;
j = buf->b1->len - 1;
b = g_ptr_array_index (buf->b1, j);
g_ptr_array_remove_index (buf->b1, j);
g_free (b);
}
@ -560,7 +564,6 @@ edit_buffer_backspace (edit_buffer_t * buf)
return c;
}
/* --------------------------------------------------------------------------------------------- */
/**
* Calculate forward offset with specified number of lines.

View File

@ -794,7 +794,7 @@ edit_search_fix_search_start_if_selection (WEdit * edit)
if (!edit_search_options.only_in_selection)
return;
if (!eval_marks (edit, &start_mark, &end_mark) != 0)
if (!eval_marks (edit, &start_mark, &end_mark))
return;
if (edit_search_options.backwards)
@ -2331,8 +2331,8 @@ void
edit_block_copy_cmd (WEdit * edit)
{
off_t start_mark, end_mark, current = edit->buffer.curs1;
off_t mark1, mark2;
long c1, c2;
off_t mark1 = 0, mark2 = 0;
long c1 = 0, c2 = 0;
off_t size;
unsigned char *copy_buf;

View File

@ -84,11 +84,11 @@ int visible_tabs = 1, visible_tws = 1;
/*** file scope type declarations ****************************************************************/
struct line_s
typedef struct
{
unsigned int ch;
unsigned int style;
};
} line_s;
/*** file scope variables ************************************************************************/
@ -390,11 +390,11 @@ edit_draw_window_icons (const WEdit * edit, int color)
static inline void
print_to_widget (WEdit * edit, long row, int start_col, int start_col_real,
long end_col, struct line_s line[], char *status, int bookmarked)
long end_col, line_s line[], char *status, int bookmarked)
{
Widget *w = WIDGET (edit);
struct line_s *p;
line_s *p;
int x = start_col_real;
int x1 = start_col + EDIT_TEXT_HORIZONTAL_OFFSET + option_line_state_width;
@ -512,8 +512,8 @@ edit_draw_this_line (WEdit * edit, off_t b, long row, long start_col, long end_c
{
Widget *w = WIDGET (edit);
struct line_s line[MAX_LINE_LEN];
struct line_s *p = line;
line_s line[MAX_LINE_LEN];
line_s *p = line;
off_t m1 = 0, m2 = 0, q;
int col, start_col_real;

View File

@ -286,7 +286,7 @@ edit_drop_menu_cmd (WDialog * h, int which)
/* --------------------------------------------------------------------------------------------- */
void
edit_init_menu (struct WMenuBar *menubar)
edit_init_menu (WMenuBar * menubar)
{
menubar_add_menu (menubar,
create_menu (_("&File"), create_file_menu (), "[Internal File Editor]"));

View File

@ -711,7 +711,7 @@ static cb_ret_t
edit_dialog_command_execute (WDialog * h, long command)
{
Widget *wh = WIDGET (h);
gboolean ret = MSG_HANDLED;
cb_ret_t ret = MSG_HANDLED;
switch (command)
{
@ -854,7 +854,7 @@ edit_translate_key (WEdit * edit, long x_key, int *cmd, int *ch)
if (!edit->utf8)
char_for_insertion = c;
else
char_for_insertion = convert_from_8bit_to_utf_c2 ((unsigned char) x_key);
char_for_insertion = convert_from_8bit_to_utf_c2 ((char) x_key);
goto fin;
}
}
@ -1262,10 +1262,10 @@ edit_files (const GList * files)
/* --------------------------------------------------------------------------------------------- */
char *
const char *
edit_get_file_name (const WEdit * edit)
{
return g_strdup (vfs_path_as_str (edit->filename_vpath));
return vfs_path_as_str (edit->filename_vpath);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -188,7 +188,6 @@ etags_set_definition_hash (const char *tagfile, const char *start_path,
char *chekedstr = NULL;
int num = 0; /* returned value */
int pos;
char *filename = NULL;
if (!match_func || !tagfile)
@ -210,12 +209,15 @@ etags_set_definition_hash (const char *tagfile, const char *start_path,
}
break;
case in_filename:
pos = strcspn (buf, ",");
g_free (filename);
filename = g_malloc (pos + 2);
g_strlcpy (filename, (char *) buf, pos + 1);
state = in_define;
break;
{
size_t pos;
pos = strcspn (buf, ",");
g_free (filename);
filename = g_strndup (buf, pos + 1);
state = in_define;
break;
}
case in_define:
if (buf[0] == 0x0C)
{

View File

@ -57,38 +57,36 @@ typedef struct aspell_struct
static GModule *spell_module = NULL;
static spell_t *global_speller = NULL;
static struct AspellConfig *(*mc_new_aspell_config) (void);
static int (*mc_aspell_config_replace) (struct AspellConfig * ths, const char *key,
const char *value);
static struct AspellCanHaveError *(*mc_new_aspell_speller) (struct AspellConfig * config);
static unsigned int (*mc_aspell_error_number) (const struct AspellCanHaveError * ths);
static const char *(*mc_aspell_speller_error_message) (const struct AspellSpeller * ths);
static const struct AspellError *(*mc_aspell_speller_error) (const struct AspellSpeller * ths);
static AspellConfig *(*mc_new_aspell_config) (void);
static int (*mc_aspell_config_replace) (AspellConfig * ths, const char *key, const char *value);
static AspellCanHaveError *(*mc_new_aspell_speller) (AspellConfig * config);
static unsigned int (*mc_aspell_error_number) (const AspellCanHaveError * ths);
static const char *(*mc_aspell_speller_error_message) (const AspellSpeller * ths);
static const AspellError *(*mc_aspell_speller_error) (const AspellSpeller * ths);
static struct AspellSpeller *(*mc_to_aspell_speller) (struct AspellCanHaveError * obj);
static int (*mc_aspell_speller_check) (struct AspellSpeller * ths, const char *word, int word_size);
static const struct AspellWordList *(*mc_aspell_speller_suggest) (struct AspellSpeller * ths,
const char *word, int word_size);
static struct AspellStringEnumeration *(*mc_aspell_word_list_elements) (const struct AspellWordList
* ths);
static const char *(*mc_aspell_config_retrieve) (struct AspellConfig * ths, const char *key);
static void (*mc_delete_aspell_speller) (struct AspellSpeller * ths);
static void (*mc_delete_aspell_config) (struct AspellConfig * ths);
static void (*mc_delete_aspell_can_have_error) (struct AspellCanHaveError * ths);
static const char *(*mc_aspell_error_message) (const struct AspellCanHaveError * ths);
static void (*mc_delete_aspell_string_enumeration) (struct AspellStringEnumeration * ths);
static struct AspellDictInfoEnumeration *(*mc_aspell_dict_info_list_elements)
(const struct AspellDictInfoList * ths);
static struct AspellDictInfoList *(*mc_get_aspell_dict_info_list) (struct AspellConfig * config);
static const struct AspellDictInfo *(*mc_aspell_dict_info_enumeration_next)
(struct AspellDictInfoEnumeration * ths);
static const char *(*mc_aspell_string_enumeration_next) (struct AspellStringEnumeration * ths);
static void (*mc_delete_aspell_dict_info_enumeration) (struct AspellDictInfoEnumeration * ths);
static unsigned int (*mc_aspell_word_list_size) (const struct AspellWordList * ths);
static const struct AspellError *(*mc_aspell_error) (const struct AspellCanHaveError * ths);
static int (*mc_aspell_speller_add_to_personal) (struct AspellSpeller * ths, const char *word,
static AspellSpeller *(*mc_to_aspell_speller) (AspellCanHaveError * obj);
static int (*mc_aspell_speller_check) (AspellSpeller * ths, const char *word, int word_size);
static const AspellWordList *(*mc_aspell_speller_suggest) (AspellSpeller * ths,
const char *word, int word_size);
static AspellStringEnumeration *(*mc_aspell_word_list_elements) (const struct AspellWordList * ths);
static const char *(*mc_aspell_config_retrieve) (AspellConfig * ths, const char *key);
static void (*mc_delete_aspell_speller) (AspellSpeller * ths);
static void (*mc_delete_aspell_config) (AspellConfig * ths);
static void (*mc_delete_aspell_can_have_error) (AspellCanHaveError * ths);
static const char *(*mc_aspell_error_message) (const AspellCanHaveError * ths);
static void (*mc_delete_aspell_string_enumeration) (AspellStringEnumeration * ths);
static AspellDictInfoEnumeration *(*mc_aspell_dict_info_list_elements)
(const AspellDictInfoList * ths);
static AspellDictInfoList *(*mc_get_aspell_dict_info_list) (AspellConfig * config);
static const AspellDictInfo *(*mc_aspell_dict_info_enumeration_next)
(AspellDictInfoEnumeration * ths);
static const char *(*mc_aspell_string_enumeration_next) (AspellStringEnumeration * ths);
static void (*mc_delete_aspell_dict_info_enumeration) (AspellDictInfoEnumeration * ths);
static unsigned int (*mc_aspell_word_list_size) (const AspellWordList * ths);
static const AspellError *(*mc_aspell_error) (const AspellCanHaveError * ths);
static int (*mc_aspell_speller_add_to_personal) (AspellSpeller * ths, const char *word,
int word_size);
static int (*mc_aspell_speller_save_all_word_lists) (struct AspellSpeller * ths);
static int (*mc_aspell_speller_save_all_word_lists) (AspellSpeller * ths);
static struct
{

View File

@ -74,7 +74,7 @@
/*** file scope variables ************************************************************************/
static struct WDialog *ch_dlg;
static WDialog *ch_dlg;
static struct
{

View File

@ -101,7 +101,6 @@ static const int panel_listing_brief_idx = 1;
static const int panel_listing_user_idx = 3;
static char **status_format;
static int listing_user_hotkey = 'u';
static unsigned long panel_listing_types_id, panel_user_format_id, panel_brief_cols_id;
static unsigned long mini_user_status_id, mini_user_format_id;
@ -251,61 +250,6 @@ panel_listing_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
switch (msg)
{
case MSG_KEY:
if (parm == '\n')
{
Widget *wi;
wi = dlg_find_by_id (h, panel_listing_types_id);
if (widget_is_active (wi))
{
WInput *in;
in = INPUT (dlg_find_by_id (h, mini_user_format_id));
input_assign_text (in, status_format[RADIO (wi)->sel]);
dlg_stop (h);
return MSG_HANDLED;
}
wi = dlg_find_by_id (h, panel_user_format_id);
if (widget_is_active (wi))
{
h->ret_value = B_USER + 6;
dlg_stop (h);
return MSG_HANDLED;
}
wi = dlg_find_by_id (h, mini_user_format_id);
if (widget_is_active (wi))
{
h->ret_value = B_USER + 7;
dlg_stop (h);
return MSG_HANDLED;
}
}
if (g_ascii_tolower (parm) == listing_user_hotkey)
{
Widget *wi;
wi = dlg_find_by_id (h, panel_user_format_id);
if (widget_is_active (wi))
{
wi = dlg_find_by_id (h, mini_user_format_id);
if (widget_is_active (wi))
{
WRadio *r;
r = RADIO (dlg_find_by_id (h, panel_listing_types_id));
r->pos = r->sel = panel_listing_user_idx;
dlg_select_widget (WIDGET (r)); /* force redraw */
send_message (h, r, MSG_ACTION, 0, NULL);
return MSG_HANDLED;
}
}
}
return MSG_NOT_HANDLED;
case MSG_ACTION:
if (sender != NULL && sender->id == panel_listing_types_id)
{
@ -771,7 +715,6 @@ panel_listing_box (WPanel * panel, int num, char **userp, char **minip, int *use
char *panel_brief_cols_out = NULL;
char *panel_user_format = NULL;
char *mini_user_format = NULL;
const char *cp;
/* Controls whether the array strings have been translated */
const char *list_types[LIST_TYPES] = {
@ -808,11 +751,6 @@ panel_listing_box (WPanel * panel, int num, char **userp, char **minip, int *use
quick_widgets, panel_listing_callback, NULL
};
/* get hotkey of user-defined format string */
cp = strchr (_(list_types[panel_listing_user_idx]), '&');
if (cp != NULL && *++cp != '\0')
listing_user_hotkey = g_ascii_tolower (*cp);
mini_user_status = panel->user_mini_status;
result = panel->list_type;
status_format = panel->user_status_format;
@ -1095,6 +1033,7 @@ tree_box (const char *current_dir)
if (dlg_run (dlg) == B_ENTER)
{
const vfs_path_t *selected_name;
selected_name = tree_selected_name (mytree);
val = g_strdup (vfs_path_as_str (selected_name));
}

View File

@ -48,7 +48,6 @@
#include <stdlib.h>
#include <pwd.h>
#include <grp.h>
#include <sys/time.h>
#include "lib/global.h"
@ -1109,11 +1108,17 @@ hotlist_cmd (void)
char *target;
target = hotlist_show (LIST_HOTLIST);
if (!target)
if (target == NULL)
return;
if (get_current_type () == view_tree)
tree_chdir (the_tree, target);
{
vfs_path_t *vpath;
vpath = vfs_path_from_str (target);
tree_chdir (the_tree, vpath);
vfs_path_free (vpath);
}
else
{
vfs_path_t *deprecated_vpath;
@ -1247,61 +1252,62 @@ link_cmd (link_type_t link_type)
void
edit_symlink_cmd (void)
{
if (S_ISLNK (selection (current_panel)->st.st_mode))
const file_entry_t *fe;
const char *p;
fe = selection (current_panel);
p = fe->fname;
if (!S_ISLNK (fe->st.st_mode))
message (D_ERROR, MSG_ERROR, _("'%s' is not a symbolic link"), p);
else
{
char buffer[MC_MAXPATHLEN];
char *p = NULL;
int i;
char *q;
vfs_path_t *p_vpath;
p = selection (current_panel)->fname;
p_vpath = vfs_path_from_str (p);
q = g_strdup_printf (_("Symlink '%s\' points to:"), str_trunc (p, 32));
i = readlink (p, buffer, MC_MAXPATHLEN - 1);
i = readlink (p, buffer, sizeof (buffer) - 1);
if (i > 0)
{
char *dest;
char *q, *dest;
buffer[i] = 0;
buffer[i] = '\0';
q = g_strdup_printf (_("Symlink '%s\' points to:"), str_trunc (p, 32));
dest =
input_expand_dialog (_("Edit symlink"), q, MC_HISTORY_FM_EDIT_LINK, buffer,
INPUT_COMPLETE_FILENAMES);
if (dest)
{
if (*dest && strcmp (buffer, dest))
{
save_cwds_stat ();
if (mc_unlink (p_vpath) == -1)
{
message (D_ERROR, MSG_ERROR, _("edit symlink, unable to remove %s: %s"),
p, unix_error_string (errno));
}
else
{
vfs_path_t *dest_vpath;
g_free (q);
dest_vpath = vfs_path_from_str_flags (dest, VPF_NO_CANON);
if (mc_symlink (dest_vpath, p_vpath) == -1)
message (D_ERROR, MSG_ERROR, _("edit symlink: %s"),
unix_error_string (errno));
vfs_path_free (dest_vpath);
}
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
repaint_screen ();
if (dest != NULL && *dest != '\0' && strcmp (buffer, dest) != 0)
{
vfs_path_t *p_vpath;
p_vpath = vfs_path_from_str (p);
save_cwds_stat ();
if (mc_unlink (p_vpath) == -1)
message (D_ERROR, MSG_ERROR, _("edit symlink, unable to remove %s: %s"), p,
unix_error_string (errno));
else
{
vfs_path_t *dest_vpath;
dest_vpath = vfs_path_from_str_flags (dest, VPF_NO_CANON);
if (mc_symlink (dest_vpath, p_vpath) == -1)
message (D_ERROR, MSG_ERROR, _("edit symlink: %s"),
unix_error_string (errno));
vfs_path_free (dest_vpath);
}
g_free (dest);
vfs_path_free (p_vpath);
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
repaint_screen ();
}
g_free (dest);
}
g_free (q);
vfs_path_free (p_vpath);
}
else
{
message (D_ERROR, MSG_ERROR, _("'%s' is not a symbolic link"),
selection (current_panel)->fname);
}
}
@ -1328,77 +1334,6 @@ user_file_menu_cmd (void)
(void) user_menu_cmd (NULL, NULL, -1);
}
/* --------------------------------------------------------------------------------------------- */
/**
* Return a random hint. If force is not 0, ignore the timeout.
*/
char *
get_random_hint (int force)
{
char *data, *result = NULL, *eop;
int len;
int start;
static int last_sec;
static struct timeval tv;
GIConv conv;
/* Do not change hints more often than one minute */
gettimeofday (&tv, NULL);
if (!force && !(tv.tv_sec > last_sec + 60))
return g_strdup ("");
last_sec = tv.tv_sec;
data = load_mc_home_file (mc_global.share_data_dir, MC_HINT, NULL);
if (data == NULL)
return NULL;
/* get a random entry */
srand (tv.tv_sec);
len = strlen (data);
start = rand () % (len - 1);
/* Search the start of paragraph */
for (; start != 0; start--)
if (data[start] == '\n' && data[start + 1] == '\n')
{
start += 2;
break;
}
/* Search the end of paragraph */
for (eop = data + start; *eop != '\0'; eop++)
{
if (*eop == '\n' && *(eop + 1) == '\n')
{
*eop = '\0';
break;
}
if (*eop == '\n')
*eop = ' ';
}
/* hint files are stored in utf-8 */
/* try convert hint file from utf-8 to terminal encoding */
conv = str_crt_conv_from ("UTF-8");
if (conv != INVALID_CONV)
{
GString *buffer;
buffer = g_string_new ("");
if (str_convert (conv, &data[start], buffer) != ESTR_FAILURE)
result = g_string_free (buffer, FALSE);
else
g_string_free (buffer, TRUE);
str_close_conv (conv);
}
else
result = g_strdup (&data[start]);
g_free (data);
return result;
}
/* --------------------------------------------------------------------------------------------- */
#ifdef ENABLE_VFS_FTP

View File

@ -83,7 +83,6 @@ void swap_cmd (void);
void view_other_cmd (void);
void quick_cd_cmd (void);
void save_setup_cmd (void);
char *get_random_hint (int force);
void user_file_menu_cmd (void);
void info_cmd (void);
void listing_cmd (void);

View File

@ -53,7 +53,7 @@
#include "midnight.h" /* current_panel */
#include "layout.h" /* for command_prompt variable */
#include "usermenu.h" /* expand_format */
#include "tree.h" /* for tree_chdir */
#include "tree.h" /* sync_tree() */
#include "command.h"
@ -401,9 +401,12 @@ do_cd_command (char *orig_cmd)
if (get_current_type () == view_tree)
{
if (cmd[0] == 0)
vfs_path_t *new_vpath = NULL;
if (cmd[0] == '\0')
{
sync_tree (mc_config_get_home_dir ());
new_vpath = vfs_path_from_str (mc_config_get_home_dir ());
sync_tree (new_vpath);
}
else if (DIR_IS_DOTDOT (cmd + operand_pos))
{
@ -416,18 +419,19 @@ do_cd_command (char *orig_cmd)
vfs_path_vtokens_get (tmp_vpath, 0, vfs_path_tokens_count (tmp_vpath) - 1);
vfs_path_free (tmp_vpath);
}
sync_tree (vfs_path_as_str (current_panel->cwd_vpath));
sync_tree (current_panel->cwd_vpath);
}
else if (IS_PATH_SEP (cmd[operand_pos]))
sync_tree (cmd + operand_pos);
else
{
vfs_path_t *new_vpath;
if (IS_PATH_SEP (cmd[operand_pos]))
new_vpath = vfs_path_from_str (cmd + operand_pos);
else
new_vpath = vfs_path_append_new (current_panel->cwd_vpath, cmd + operand_pos, NULL);
new_vpath = vfs_path_append_new (current_panel->cwd_vpath, cmd + operand_pos, NULL);
sync_tree (vfs_path_as_str (new_vpath));
vfs_path_free (new_vpath);
sync_tree (new_vpath);
}
vfs_path_free (new_vpath);
}
else
{

View File

@ -776,9 +776,9 @@ regex_command_for (void *target, const vfs_path_t * filename_vpath, const char *
gboolean error_flag = FALSE;
int ret = 0;
struct stat mystat;
int view_at_line_number;
char *include_target;
int include_target_len;
int view_at_line_number = 0;
char *include_target = NULL;
size_t include_target_len = 0;
gboolean have_type = FALSE; /* Flag used by regex_check_type() */
if (filename_vpath == NULL)
@ -793,10 +793,6 @@ regex_command_for (void *target, const vfs_path_t * filename_vpath, const char *
view_at_line_number = atoi (action + 5);
action = "View";
}
else
{
view_at_line_number = 0;
}
if (data == NULL)
{
@ -869,9 +865,6 @@ regex_command_for (void *target, const vfs_path_t * filename_vpath, const char *
mc_stat (filename_vpath, &mystat);
include_target = NULL;
include_target_len = 0;
filename = vfs_path_get_last_path_str (filename_vpath);
filename = x_basename (filename);
file_len = strlen (filename);
@ -890,9 +883,8 @@ regex_command_for (void *target, const vfs_path_t * filename_vpath, const char *
if (*p == '\0')
break;
if (p == q)
{ /* i.e. starts in the first column, should be
* keyword/descNL
*/
{
/* i.e. starts in the first column, should be keyword/descNL */
gboolean case_insense;
found = FALSE;
@ -901,7 +893,7 @@ regex_command_for (void *target, const vfs_path_t * filename_vpath, const char *
q = strchr (p, '\0');
c = *q;
*q = '\0';
if (include_target)
if (include_target != NULL)
{
if ((strncmp (p, "include/", 8) == 0)
&& (strncmp (p + 8, include_target, include_target_len) == 0))
@ -973,9 +965,6 @@ regex_command_for (void *target, const vfs_path_t * filename_vpath, const char *
found = TRUE;
*q = c;
p = q;
if (*p == '\0')
break;
}
else
{ /* List of actions */
@ -996,11 +985,11 @@ regex_command_for (void *target, const vfs_path_t * filename_vpath, const char *
include_target = p + 8;
t = strchr (include_target, '\n');
if (t != NULL)
*t = '\0';
include_target_len = strlen (include_target);
if (t != NULL)
*t = '\n';
include_target_len = (size_t) (t - include_target);
else
include_target_len = strlen (include_target);
*r = c;
p = q;
@ -1040,14 +1029,14 @@ regex_command_for (void *target, const vfs_path_t * filename_vpath, const char *
}
}
}
p = q;
if (*p == '\0')
break;
}
p = q;
if (*p == '\0')
break;
}
if (error_flag)
ret = -1;
return ret;
return (error_flag ? -1 : ret);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -1237,17 +1237,17 @@ erase_dir_iff_empty (file_op_context_t * ctx, const vfs_path_t * vpath, size_t c
* entry if there is one.
*/
static char *
static const char *
panel_get_file (WPanel * panel)
{
if (get_current_type () == view_tree)
{
WTree *tree;
vfs_path_t *selected_name;
const vfs_path_t *selected_name;
tree = (WTree *) get_panel_widget (get_current_index ());
selected_name = tree_selected_name (tree);
return g_strdup (vfs_path_as_str (selected_name));
return vfs_path_as_str (selected_name);
}
if (panel->marked != 0)
@ -1256,9 +1256,10 @@ panel_get_file (WPanel * panel)
for (i = 0; i < panel->dir.len; i++)
if (panel->dir.list[i].f.marked)
return g_strdup (panel->dir.list[i].fname);
return panel->dir.list[i].fname;
}
return g_strdup (panel->dir.list[panel->selected].fname);
return panel->dir.list[panel->selected].fname;
}
/* --------------------------------------------------------------------------------------------- */
@ -2595,12 +2596,10 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
const gboolean single_entry = force_single || (panel->marked <= 1)
|| (get_current_type () == view_tree);
char *source = NULL;
const char *source = NULL;
#ifdef WITH_FULL_PATHS
vfs_path_t *source_with_vpath = NULL;
#else
#define source_with_path source
#endif /* !WITH_FULL_PATHS */
#endif /* WITH_FULL_PATHS */
char *dest = NULL;
vfs_path_t *dest_vpath = NULL;
char *temp = NULL;
@ -2629,42 +2628,48 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
if (single_entry)
{
vfs_path_t *source_vpath;
gboolean ok;
if (force_single)
source = g_strdup (selection (panel)->fname);
source = selection (panel)->fname;
else
source = panel_get_file (panel);
if (DIR_IS_DOTDOT (source))
{
g_free (source);
ok = !DIR_IS_DOTDOT (source);
if (!ok)
message (D_ERROR, MSG_ERROR, _("Cannot operate on \"..\"!"));
return FALSE;
}
source_vpath = vfs_path_from_str (source);
/* Update stat to get actual info */
if (mc_lstat (source_vpath, &src_stat) != 0)
else
{
message (D_ERROR, MSG_ERROR, _("Cannot stat \"%s\"\n%s"),
path_trunc (source, 30), unix_error_string (errno));
vfs_path_t *source_vpath;
/* Directory was changed outside MC. Reload it forced */
if (!panel->is_panelized)
source_vpath = vfs_path_from_str (source);
/* Update stat to get actual info */
ok = mc_lstat (source_vpath, &src_stat) == 0;
if (!ok)
{
panel_update_flags_t flags = UP_RELOAD;
message (D_ERROR, MSG_ERROR, _("Cannot stat \"%s\"\n%s"),
path_trunc (source, 30), unix_error_string (errno));
/* don't update panelized panel */
if (get_other_type () == view_listing && other_panel->is_panelized)
flags |= UP_ONLY_CURRENT;
/* Directory was changed outside MC. Reload it forced */
if (!panel->is_panelized)
{
panel_update_flags_t flags = UP_RELOAD;
update_panels (flags, UP_KEEPSEL);
/* don't update panelized panel */
if (get_other_type () == view_listing && other_panel->is_panelized)
flags |= UP_ONLY_CURRENT;
update_panels (flags, UP_KEEPSEL);
}
}
vfs_path_free (source_vpath);
return FALSE;
}
vfs_path_free (source_vpath);
if (!ok)
return FALSE;
}
ctx = file_op_context_new (operation);
@ -2672,32 +2677,32 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
/* Show confirmation dialog */
if (operation != OP_DELETE)
{
char *tmp_dest_dir, *dest_dir;
const char *tmp_dest_dir;
char *dest_dir;
char *format;
/* Forced single operations default to the original name */
if (force_single)
tmp_dest_dir = g_strdup (source);
tmp_dest_dir = source;
else if (get_other_type () == view_listing)
tmp_dest_dir = g_strdup (vfs_path_as_str (other_panel->cwd_vpath));
tmp_dest_dir = vfs_path_as_str (other_panel->cwd_vpath);
else
tmp_dest_dir = g_strdup (vfs_path_as_str (panel->cwd_vpath));
tmp_dest_dir = vfs_path_as_str (panel->cwd_vpath);
/*
* Add trailing backslash only when do non-local ops.
* It saves user from occasional file renames (when destination
* dir is deleted)
*/
if (!force_single && tmp_dest_dir[0] != '\0'
if (!force_single && tmp_dest_dir != NULL && tmp_dest_dir[0] != '\0'
&& !IS_PATH_SEP (tmp_dest_dir[strlen (tmp_dest_dir) - 1]))
{
/* add trailing separator */
dest_dir = g_strconcat (tmp_dest_dir, PATH_SEP_STR, (char *) NULL);
g_free (tmp_dest_dir);
}
else
{
/* just copy */
dest_dir = tmp_dest_dir;
dest_dir = g_strdup (tmp_dest_dir);
}
if (dest_dir == NULL)
{
@ -2709,9 +2714,10 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
format =
panel_operate_generate_prompt (panel, operation, source != NULL ? &src_stat : NULL);
dest = file_mask_dialog (ctx, operation, source != NULL, format,
source != NULL ? (void *) source
: (void *) &panel->marked, dest_dir, &do_bg);
dest =
file_mask_dialog (ctx, operation, source != NULL, format,
source != NULL ? source : (const void *) &panel->marked, dest_dir,
&do_bg);
g_free (format);
g_free (dest_dir);
@ -3088,7 +3094,6 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
file_op_total_context_destroy (tctx);
ret_fast:
file_op_context_destroy (ctx);
g_free (source);
return ret_val;
}

View File

@ -343,9 +343,9 @@ static void
file_frmt_time (char *buffer, double eta_secs)
{
int eta_hours, eta_mins, eta_s;
eta_hours = eta_secs / (60 * 60);
eta_mins = (eta_secs - (eta_hours * 60 * 60)) / 60;
eta_s = eta_secs - (eta_hours * 60 * 60 + eta_mins * 60);
eta_hours = (int) (eta_secs / (60 * 60));
eta_mins = (int) ((eta_secs - (eta_hours * 60 * 60)) / 60);
eta_s = (int) (eta_secs - (eta_hours * 60 * 60 + eta_mins * 60));
g_snprintf (buffer, BUF_TINY, _("%d:%02d.%02d"), eta_hours, eta_mins, eta_s);
}

View File

@ -39,7 +39,6 @@
#include "lib/unixcompat.h"
#include "lib/tty/tty.h"
#include "lib/tty/key.h" /* is_idle() */
#include "lib/tty/mouse.h" /* Gpm_Event */
#include "lib/skin.h"
#include "lib/strutil.h"
#include "lib/timefmt.h" /* file_date() */
@ -66,7 +65,7 @@
struct WInfo
{
Widget widget;
int ready;
gboolean ready;
};
/*** file scope variables ************************************************************************/
@ -282,7 +281,7 @@ info_show_info (WInfo * info)
static void
info_hook (void *data)
{
struct WInfo *info = (struct WInfo *) data;
WInfo *info = (WInfo *) data;
Widget *other_widget;
other_widget = get_panel_widget (get_current_index ());
@ -291,7 +290,7 @@ info_hook (void *data)
if (widget_overlapped (WIDGET (info), other_widget))
return;
info->ready = 1;
info->ready = TRUE;
info_show_info (info);
}
@ -300,14 +299,14 @@ info_hook (void *data)
static cb_ret_t
info_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
struct WInfo *info = (struct WInfo *) w;
WInfo *info = (WInfo *) w;
switch (msg)
{
case MSG_INIT:
init_my_statfs ();
add_hook (&select_file_hook, info_hook, info);
info->ready = 0;
info->ready = FALSE;
return MSG_HANDLED;
case MSG_DRAW:

View File

@ -147,13 +147,7 @@ static int old_output_lines;
/* Internal variables */
static int equal_split;
static int _menubar_visible;
static int _output_lines;
static gboolean _command_prompt;
static int _keybar_visible;
static int _message_visible;
static gboolean _xterm_title;
static int _free_space;
static int height;
@ -336,38 +330,42 @@ layout_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *
return MSG_HANDLED;
case MSG_POST_KEY:
_menubar_visible = check_options[1].widget->state & C_BOOL;
_command_prompt = (check_options[2].widget->state & C_BOOL) != 0;
_keybar_visible = check_options[3].widget->state & C_BOOL;
_message_visible = check_options[4].widget->state & C_BOOL;
_xterm_title = (check_options[5].widget->state & C_BOOL) != 0;
_free_space = check_options[6].widget->state & C_BOOL;
if (mc_global.tty.console_flag != '\0')
{
int minimum;
int _menubar_visible, _command_prompt, _keybar_visible, _message_visible;
if (_output_lines < 0)
_output_lines = 0;
height = LINES - _keybar_visible - (_command_prompt ? 1 : 0) -
_menubar_visible - _output_lines - _message_visible;
minimum = MINHEIGHT * (1 + panels_layout.horizontal_split);
if (height < minimum)
_menubar_visible = check_options[1].widget->state & C_BOOL;
_command_prompt = check_options[2].widget->state & C_BOOL;
_keybar_visible = check_options[3].widget->state & C_BOOL;
_message_visible = check_options[4].widget->state & C_BOOL;
if (mc_global.tty.console_flag != '\0')
{
_output_lines -= minimum - height;
height = minimum;
}
}
else
height = LINES - _keybar_visible - (_command_prompt ? 1 : 0) -
_menubar_visible - _output_lines - _message_visible;
int minimum;
if (old_output_lines != _output_lines)
{
old_output_lines = _output_lines;
tty_setcolor (mc_global.tty.console_flag != '\0' ? COLOR_NORMAL : DISABLED_COLOR);
widget_move (h, 9, 5 + 3 + output_lines_label_len);
tty_printf ("%02d", _output_lines);
if (_output_lines < 0)
_output_lines = 0;
height =
LINES - _keybar_visible - _command_prompt - _menubar_visible - _output_lines -
_message_visible;
minimum = MINHEIGHT * (1 + panels_layout.horizontal_split);
if (height < minimum)
{
_output_lines -= minimum - height;
height = minimum;
}
}
else
height =
LINES - _keybar_visible - _command_prompt - _menubar_visible - _output_lines -
_message_visible;
if (old_output_lines != _output_lines)
{
old_output_lines = _output_lines;
tty_setcolor (mc_global.tty.console_flag != '\0' ? COLOR_NORMAL : DISABLED_COLOR);
widget_move (h, 9, 5 + 3 + output_lines_label_len);
tty_printf ("%02d", _output_lines);
}
}
return MSG_HANDLED;
@ -463,12 +461,6 @@ init_layout (void)
output_lines_label = _("Output lines:");
/* save old params */
_menubar_visible = menubar_visible;
_command_prompt = command_prompt;
_keybar_visible = mc_global.keybar_visible;
_message_visible = mc_global.message_visible;
_xterm_title = xterm_title;
_free_space = free_space;
old_output_lines = -1;
_output_lines = output_lines;
@ -636,7 +628,7 @@ layout_change (void)
how the panel are split (horizontal/vertical),
and a change of menu visibility. */
update_menu ();
load_hint (1);
load_hint (TRUE);
}
/* --------------------------------------------------------------------------------------------- */
@ -988,13 +980,7 @@ set_display_type (int num, panel_view_mode_t type)
/* Restoring saved path from panels.ini for nonlist panel */
/* when it's first creation (for example view_info) */
if (old_widget == NULL && type != view_listing)
{
char *panel_dir;
panel_dir = _vfs_get_cwd ();
panels[num].last_saved_dir = g_strdup (panel_dir);
g_free (panel_dir);
}
panels[num].last_saved_dir = _vfs_get_cwd ();
switch (type)
{
@ -1020,7 +1006,7 @@ set_display_type (int num, panel_view_mode_t type)
else
file_name = "";
mcview_load ((struct WView *) new_widget, 0, file_name, 0, 0, 0);
mcview_load ((WView *) new_widget, 0, file_name, 0, 0, 0);
break;
default:
@ -1213,7 +1199,7 @@ get_display_type (int idx)
/* --------------------------------------------------------------------------------------------- */
struct Widget *
Widget *
get_panel_widget (int idx)
{
return panels[idx].widget;

View File

@ -70,7 +70,7 @@ int get_current_index (void);
int get_other_index (void);
const char *get_nth_panel_name (int num);
struct Widget *get_panel_widget (int idx);
Widget *get_panel_widget (int idx);
WPanel *get_other_panel (void);

View File

@ -751,7 +751,7 @@ put_link (WPanel * panel)
int i;
vpath = vfs_path_append_new (panel->cwd_vpath, selection (panel)->fname, NULL);
i = mc_readlink (vpath, buffer, MC_MAXPATHLEN - 1);
i = mc_readlink (vpath, buffer, sizeof (buffer) - 1);
vfs_path_free (vpath);
if (i > 0)
@ -785,24 +785,24 @@ put_other_link (void)
static void
put_prog_name (void)
{
char *tmp;
const char *tmp;
if (!command_prompt)
return;
if (get_current_type () == view_tree)
{
WTree *tree;
vfs_path_t *selected_name;
const vfs_path_t *selected_name;
tree = (WTree *) get_panel_widget (get_current_index ());
selected_name = tree_selected_name (tree);
tmp = g_strdup (vfs_path_as_str (selected_name));
tmp = vfs_path_as_str (selected_name);
}
else
tmp = g_strdup (selection (current_panel)->fname);
tmp = selection (current_panel)->fname;
command_insert (cmdline, tmp, TRUE);
g_free (tmp);
}
/* --------------------------------------------------------------------------------------------- */
@ -1405,7 +1405,7 @@ midnight_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
return MSG_HANDLED;
case MSG_DRAW:
load_hint (1);
load_hint (TRUE);
/* We handle the special case of the output lines */
if (mc_global.tty.console_flag != '\0' && output_lines)
show_console_contents (output_start_y,
@ -1655,6 +1655,75 @@ midnight_set_buttonbar (WButtonBar * b)
buttonbar_set_label (b, 10, Q_ ("ButtonBar|Quit"), main_map, NULL);
}
/* --------------------------------------------------------------------------------------------- */
/**
* Return a random hint. If force is TRUE, ignore the timeout.
*/
char *
get_random_hint (gboolean force)
{
static const guint64 update_period = 60 * G_USEC_PER_SEC;
static guint64 tv = 0;
char *data, *result = NULL, *eop;
size_t len, start;
GIConv conv;
/* Do not change hints more often than one minute */
if (!force && !mc_time_elapsed (&tv, update_period))
return g_strdup ("");
data = load_mc_home_file (mc_global.share_data_dir, MC_HINT, NULL, &len);
if (data == NULL)
return NULL;
/* get a random entry */
srand ((unsigned int) (tv / G_USEC_PER_SEC));
start = ((size_t) rand ()) % (len - 1);
/* Search the start of paragraph */
for (; start != 0; start--)
if (data[start] == '\n' && data[start + 1] == '\n')
{
start += 2;
break;
}
/* Search the end of paragraph */
for (eop = data + start; *eop != '\0'; eop++)
{
if (*eop == '\n' && *(eop + 1) == '\n')
{
*eop = '\0';
break;
}
if (*eop == '\n')
*eop = ' ';
}
/* hint files are stored in utf-8 */
/* try convert hint file from utf-8 to terminal encoding */
conv = str_crt_conv_from ("UTF-8");
if (conv != INVALID_CONV)
{
GString *buffer;
buffer = g_string_sized_new (len - start);
if (str_convert (conv, &data[start], buffer) != ESTR_FAILURE)
result = g_string_free (buffer, FALSE);
else
g_string_free (buffer, TRUE);
str_close_conv (conv);
}
else
result = g_strndup (data + start, len - start);
g_free (data);
return result;
}
/* --------------------------------------------------------------------------------------------- */
/**
* Load new hint and display it.

View File

@ -41,6 +41,7 @@ extern const char *mc_prompt;
void update_menu (void);
void midnight_set_buttonbar (WButtonBar * b);
char *get_random_hint (gboolean force);
void load_hint (gboolean force);
void change_panel (void);
void save_cwds_stat (void);

View File

@ -264,12 +264,14 @@ me_remote (char const *fs_name, char const *fs_type)
#endif
#ifndef ME_REMOTE
/* A file system is 'remote' if its Fs_name contains a ':'
or if (it is of type (smbfs or cifs) and its Fs_name starts with '//'). */
or if (it is of type (smbfs or cifs) and its Fs_name starts with '//')
or Fs_name is equal to "-hosts" (used by autofs to mount remote fs). */
#define ME_REMOTE(Fs_name, Fs_type) \
(strchr (Fs_name, ':') != NULL \
|| ((Fs_name)[0] == '/' \
&& (Fs_name)[1] == '/' \
&& (strcmp (Fs_type, "smbfs") == 0 || strcmp (Fs_type, "cifs") == 0)))
&& (strcmp (Fs_type, "smbfs") == 0 || strcmp (Fs_type, "cifs") == 0)) \
|| (strcmp("-hosts", Fs_name) == 0))
#endif
/* Many space usage primitives use all 1 bits to denote a value that is
@ -640,12 +642,10 @@ unescape_tab (char *str)
/* --------------------------------------------------------------------------------------------- */
/* Return a list of the currently mounted file systems, or NULL on error.
Add each entry to the tail of the list so that they stay in order.
If NEED_FS_TYPE is true, ensure that the file system type fields in
the returned list are valid. Otherwise, they might not be. */
Add each entry to the tail of the list so that they stay in order. */
static GSList *
read_file_system_list (int need_fs_type)
read_file_system_list (void)
{
GSList *mount_list = NULL;
struct mount_entry *me;
@ -1057,7 +1057,6 @@ read_file_system_list (int need_fs_type)
me->me_type = "";
me->me_type_malloced = 0;
#ifdef GETFSTYP /* SVR3. */
if (need_fs_type)
{
struct statfs fsd;
char typebuf[FSTYPSZ];
@ -1290,8 +1289,6 @@ read_file_system_list (int need_fs_type)
}
#endif /* MOUNTED_INTERIX_STATVFS */
(void) need_fs_type; /* avoid argument-unused warning */
return g_slist_reverse (mount_list);
free_then_fail:
@ -1318,7 +1315,7 @@ read_file_system_list (int need_fs_type)
*/
static GSList *
read_file_system_list (int need_fs_type, int all_fs)
read_file_system_list (void)
{
struct _disk_entry de;
struct statfs fs;
@ -1694,7 +1691,7 @@ init_my_statfs (void)
{
#ifdef HAVE_INFOMOUNT_LIST
free_my_statfs ();
mc_mount_list = read_file_system_list (1);
mc_mount_list = read_file_system_list ();
#endif /* HAVE_INFOMOUNT_LIST */
}
@ -1754,7 +1751,7 @@ my_statfs (struct my_statfs *myfs_stats, const char *path)
struct mount_entry *entry;
struct fs_usage fs_use;
entry = read_file_system_list (0, 0);
entry = read_file_system_list ();
if (entry != NULL)
{
get_fs_usage (entry->me_mountdir, NULL, &fs_use);

View File

@ -3270,7 +3270,7 @@ _do_panel_cd (WPanel * panel, const vfs_path_t * new_dir_vpath, enum cd_enum cd_
&panel->sort_info, panel->filter);
try_to_select (panel, get_parent_dir_name (panel->cwd_vpath, olddir_vpath));
load_hint (0);
load_hint (FALSE);
panel->dirty = 1;
update_xterm_title_path ();
@ -3557,6 +3557,7 @@ panel_execute_cmd (WPanel * panel, long command)
panel_set_sort_type_by_id (panel, "mtime");
break;
default:
res = MSG_NOT_HANDLED;
break;
}

View File

@ -214,10 +214,14 @@ tree_destroy (WTree * tree)
static void
load_tree (WTree * tree)
{
vfs_path_t *vpath;
tree_store_load ();
tree->selected_ptr = tree->store->tree_first;
tree_chdir (tree, mc_config_get_home_dir ());
vpath = vfs_path_from_str (mc_config_get_home_dir ());
tree_chdir (tree, vpath);
vfs_path_free (vpath);
}
/* --------------------------------------------------------------------------------------------- */
@ -1283,25 +1287,22 @@ tree_new (int y, int x, int lines, int cols, gboolean is_panel)
/* --------------------------------------------------------------------------------------------- */
void
tree_chdir (WTree * tree, const char *dir)
tree_chdir (WTree * tree, const vfs_path_t * dir)
{
vfs_path_t *vpath;
tree_entry *current;
vpath = vfs_path_from_str (dir);
current = tree_store_whereis (vpath);
current = tree_store_whereis (dir);
if (current != NULL)
{
tree->selected_ptr = current;
tree_check_focus (tree);
}
vfs_path_free (vpath);
}
/* --------------------------------------------------------------------------------------------- */
/** Return name of the currently selected entry */
vfs_path_t *
const vfs_path_t *
tree_selected_name (const WTree * tree)
{
return tree->selected_ptr->name;
@ -1310,15 +1311,15 @@ tree_selected_name (const WTree * tree)
/* --------------------------------------------------------------------------------------------- */
void
sync_tree (const char *path)
sync_tree (const vfs_path_t * vpath)
{
tree_chdir (the_tree, path);
tree_chdir (the_tree, vpath);
}
/* --------------------------------------------------------------------------------------------- */
WTree *
find_tree (struct WDialog *h)
find_tree (WDialog * h)
{
return (WTree *) find_widget_type (h, tree_callback);
}

View File

@ -20,18 +20,16 @@ typedef struct WTree WTree;
extern WTree *the_tree;
extern int xtree_mode;
struct WDialog;
/*** declarations of public functions ************************************************************/
WTree *tree_new (int y, int x, int lines, int cols, gboolean is_panel);
void tree_chdir (WTree * tree, const char *dir);
vfs_path_t *tree_selected_name (const WTree * tree);
void tree_chdir (WTree * tree, const vfs_path_t * dir);
const vfs_path_t *tree_selected_name (const WTree * tree);
void sync_tree (const char *pathname);
void sync_tree (const vfs_path_t * vpath);
WTree *find_tree (struct WDialog *h);
WTree *find_tree (WDialog * h);
/*** inline functions ****************************************************************************/
#endif /* MC__TREE_H */

View File

@ -69,8 +69,8 @@
/*** file scope variables ************************************************************************/
static int debug_flag = 0;
static int debug_error = 0;
static gboolean debug_flag = FALSE;
static gboolean debug_error = FALSE;
static char *menu = NULL;
/*** file scope functions ************************************************************************/
@ -82,7 +82,8 @@ strip_ext (char *ss)
{
char *s = ss;
char *e = NULL;
while (*s)
while (*s != '\0')
{
if (*s == '.')
e = s;
@ -90,8 +91,8 @@ strip_ext (char *ss)
e = NULL; /* '.' in *directory* name */
s++;
}
if (e)
*e = 0;
if (e != NULL)
*e = '\0';
return ss;
}
@ -133,13 +134,14 @@ check_patterns (char *p)
static char *
extract_arg (char *p, char *arg, int size)
{
char *np;
while (*p && (*p == ' ' || *p == '\t' || *p == '\n'))
while (*p != '\0' && (*p == ' ' || *p == '\t' || *p == '\n'))
p++;
/* support quote space .mnu */
while (*p && (*p != ' ' || *(p - 1) == '\\') && *p != '\t' && *p != '\n')
while (*p != '\0' && (*p != ' ' || *(p - 1) == '\\') && *p != '\t' && *p != '\n')
{
char *np;
np = str_get_next_char (p);
if (np - p >= size)
break;
@ -148,8 +150,8 @@ extract_arg (char *p, char *arg, int size)
size -= np - p;
p = np;
}
*arg = 0;
if (!*p || *p == '\n')
*arg = '\0';
if (*p == '\0' || *p == '\n')
str_prev_char (&p);
return p;
}
@ -158,13 +160,13 @@ extract_arg (char *p, char *arg, int size)
/* Tests whether the selected file in the panel is of any of the types
specified in argument. */
static int
static gboolean
test_type (WPanel * panel, char *arg)
{
int result = 0; /* False by default */
mode_t st_mode = panel->dir.list[panel->selected].st.st_mode;
for (; *arg != 0; arg++)
for (; *arg != '\0'; arg++)
{
switch (*arg)
{
@ -193,17 +195,18 @@ test_type (WPanel * panel, char *arg)
result |= S_ISSOCK (st_mode);
break;
case 'x': /* Executable */
result |= (st_mode & 0111) ? 1 : 0;
result |= (st_mode & 0111) != 0 ? 1 : 0;
break;
case 't':
result |= panel->marked ? 1 : 0;
result |= panel->marked != 0 ? 1 : 0;
break;
default:
debug_error = 1;
debug_error = TRUE;
break;
}
}
return result;
return (result != 0);
}
/* --------------------------------------------------------------------------------------------- */
@ -211,7 +214,7 @@ test_type (WPanel * panel, char *arg)
p. Returns the point after condition. */
static char *
test_condition (WEdit * edit_widget, char *p, int *condition)
test_condition (const WEdit * edit_widget, char *p, gboolean * condition)
{
char arg[256];
const mc_search_type_t search_type = easy_patterns ? MC_SEARCH_T_GLOB : MC_SEARCH_T_REGEX;
@ -243,28 +246,28 @@ test_condition (WEdit * edit_widget, char *p, int *condition)
#ifdef USE_INTERNAL_EDIT
if (edit_widget != NULL)
{
char *edit_filename;
const char *edit_filename;
edit_filename = edit_get_file_name (edit_widget);
*condition = mc_search (arg, DEFAULT_CHARSET, edit_filename, search_type) ? 1 : 0;
g_free (edit_filename);
*condition = mc_search (arg, DEFAULT_CHARSET, edit_filename, search_type);
}
else
#endif
*condition = panel != NULL &&
mc_search (arg, DEFAULT_CHARSET, panel->dir.list[panel->selected].fname,
search_type) ? 1 : 0;
search_type);
break;
case 'y': /* syntax pattern */
#ifdef USE_INTERNAL_EDIT
if (edit_widget != NULL)
{
const char *syntax_type = edit_get_syntax_type (edit_widget);
const char *syntax_type;
syntax_type = edit_get_syntax_type (edit_widget);
if (syntax_type != NULL)
{
p = extract_arg (p, arg, sizeof (arg));
*condition =
mc_search (arg, DEFAULT_CHARSET, syntax_type, MC_SEARCH_T_NORMAL) ? 1 : 0;
*condition = mc_search (arg, DEFAULT_CHARSET, syntax_type, MC_SEARCH_T_NORMAL);
}
}
#endif
@ -273,28 +276,24 @@ test_condition (WEdit * edit_widget, char *p, int *condition)
p = extract_arg (p, arg, sizeof (arg));
*condition = panel != NULL
&& mc_search (arg, DEFAULT_CHARSET, vfs_path_as_str (panel->cwd_vpath),
search_type) ? 1 : 0;
search_type);
break;
case 't':
p = extract_arg (p, arg, sizeof (arg));
*condition = panel != NULL && test_type (panel, arg) ? 1 : 0;
*condition = panel != NULL && test_type (panel, arg);
break;
case 'x': /* executable */
{
struct stat status;
p = extract_arg (p, arg, sizeof (arg));
if (stat (arg, &status) == 0)
*condition = is_exe (status.st_mode) ? 1 : 0;
else
*condition = 0;
*condition = stat (arg, &status) == 0 && is_exe (status.st_mode);
break;
}
default:
debug_error = 1;
debug_error = TRUE;
break;
} /* switch */
} /* while */
return p;
}
@ -303,24 +302,24 @@ test_condition (WEdit * edit_widget, char *p, int *condition)
/** General purpose condition debug output handler */
static void
debug_out (char *start, char *end, int cond)
debug_out (char *start, char *end, gboolean condition)
{
static char *msg;
static char *msg = NULL;
if (start == NULL && end == NULL)
{
/* Show output */
if (debug_flag && msg)
if (debug_flag && msg != NULL)
{
size_t len;
len = strlen (msg);
if (len != 0)
msg[len - 1] = 0;
msg[len - 1] = '\0';
message (D_NORMAL, _("Debug"), "%s", msg);
}
debug_flag = 0;
debug_flag = FALSE;
MC_PTR_FREE (msg);
}
else
@ -335,9 +334,9 @@ debug_out (char *start, char *end, int cond)
if (debug_error)
{
type = _("ERROR:");
debug_error = 0;
debug_error = FALSE;
}
else if (cond)
else if (condition)
type = _("True:");
else
type = _("False:");
@ -356,33 +355,32 @@ debug_out (char *start, char *end, int cond)
the point just before the end of line. */
static char *
test_line (WEdit * edit_widget, char *p, int *result)
test_line (const WEdit * edit_widget, char *p, gboolean * result)
{
int condition;
char operator;
/* Repeat till end of line */
while (*p && *p != '\n')
while (*p != '\0' && *p != '\n')
{
char *debug_start, *debug_end;
gboolean condition = TRUE;
/* support quote space .mnu */
while ((*p == ' ' && *(p - 1) != '\\') || *p == '\t')
p++;
if (!*p || *p == '\n')
if (*p == '\0' || *p == '\n')
break;
operator = *p++;
if (*p == '?')
{
debug_flag = 1;
debug_flag = TRUE;
p++;
}
/* support quote space .mnu */
while ((*p == ' ' && *(p - 1) != '\\') || *p == '\t')
p++;
if (!*p || *p == '\n')
if (*p == '\0' || *p == '\n')
break;
condition = 1; /* True by default */
debug_start = p;
p = test_condition (edit_widget, p, &condition);
@ -398,13 +396,13 @@ test_line (WEdit * edit_widget, char *p, int *result)
*result = condition;
break;
case '&': /* Logical and */
*result &= condition;
*result = *result && condition;
break;
case '|': /* Logical or */
*result |= condition;
*result = *result || condition;
break;
default:
debug_error = 1;
debug_error = TRUE;
break;
} /* switch */
/* Add one debug statement */
@ -412,9 +410,9 @@ test_line (WEdit * edit_widget, char *p, int *result)
} /* while (*p != '\n') */
/* Report debug message */
debug_out (NULL, NULL, 1);
debug_out (NULL, NULL, TRUE);
if (!*p || *p == '\n')
if (*p == '\0' || *p == '\n')
str_prev_char (&p);
return p;
}
@ -423,24 +421,22 @@ test_line (WEdit * edit_widget, char *p, int *result)
/** FIXME: recode this routine on version 3.0, it could be cleaner */
static void
execute_menu_command (WEdit * edit_widget, const char *commands, gboolean show_prompt)
execute_menu_command (const WEdit * edit_widget, const char *commands, gboolean show_prompt)
{
FILE *cmd_file;
int cmd_file_fd;
int expand_prefix_found = 0;
char *parameter = 0;
gboolean expand_prefix_found = FALSE;
char *parameter = NULL;
gboolean do_quote = FALSE;
char lc_prompt[80];
int col;
vfs_path_t *file_name_vpath;
int run_view = 0;
gboolean run_view = FALSE;
/* Skip menu entry title line */
commands = strchr (commands, '\n');
if (!commands)
{
if (commands == NULL)
return;
}
cmd_file_fd = mc_mkstemps (&file_name_vpath, "mcusr", SCRIPT_SUFFIX);
@ -455,7 +451,7 @@ execute_menu_command (WEdit * edit_widget, const char *commands, gboolean show_p
fputs ("#! /bin/sh\n", cmd_file);
commands++;
for (col = 0; *commands; commands++)
for (col = 0; *commands != '\0'; commands++)
{
if (col == 0)
{
@ -463,23 +459,23 @@ execute_menu_command (WEdit * edit_widget, const char *commands, gboolean show_p
break;
while (*commands == ' ' || *commands == '\t')
commands++;
if (*commands == 0)
if (*commands == '\0')
break;
}
col++;
if (*commands == '\n')
col = 0;
if (parameter)
if (parameter != NULL)
{
if (*commands == '}')
{
*parameter = 0;
*parameter = '\0';
parameter =
input_dialog (_("Parameter"), lc_prompt, MC_HISTORY_FM_MENU_EXEC_PARAM, "",
INPUT_COMPLETE_FILENAMES | INPUT_COMPLETE_CD |
INPUT_COMPLETE_HOSTNAMES | INPUT_COMPLETE_VARIABLES |
INPUT_COMPLETE_USERNAMES);
if (!parameter || !*parameter)
if (parameter == NULL || *parameter == '\0')
{
/* User canceled */
fclose (cmd_file);
@ -497,20 +493,15 @@ execute_menu_command (WEdit * edit_widget, const char *commands, gboolean show_p
}
else
fputs (parameter, cmd_file);
g_free (parameter);
parameter = 0;
}
else
{
if (parameter < &lc_prompt[sizeof (lc_prompt) - 1])
{
*parameter++ = *commands;
}
MC_PTR_FREE (parameter);
}
else if (parameter < lc_prompt + sizeof (lc_prompt) - 1)
*parameter++ = *commands;
}
else if (expand_prefix_found)
{
expand_prefix_found = 0;
expand_prefix_found = FALSE;
if (g_ascii_isdigit ((gchar) * commands))
{
do_quote = (atoi (commands) != 0);
@ -521,7 +512,9 @@ execute_menu_command (WEdit * edit_widget, const char *commands, gboolean show_p
parameter = lc_prompt;
else
{
char *text = expand_format (edit_widget, *commands, do_quote);
char *text;
text = expand_format (edit_widget, *commands, do_quote);
fputs (text, cmd_file);
g_free (text);
}
@ -530,16 +523,18 @@ execute_menu_command (WEdit * edit_widget, const char *commands, gboolean show_p
{
if (*commands == '%')
{
int i = check_format_view (commands + 1);
if (i)
int i;
i = check_format_view (commands + 1);
if (i != 0)
{
commands += i;
run_view = 1;
run_view = TRUE;
}
else
{
do_quote = TRUE; /* Default: Quote expanded macro */
expand_prefix_found = 1;
expand_prefix_found = TRUE;
}
}
else
@ -584,23 +579,21 @@ execute_menu_command (WEdit * edit_widget, const char *commands, gboolean show_p
** Q. Should we apply this routine to system and home menu (and .ext files)?
*/
static int
static gboolean
menu_file_own (char *path)
{
struct stat st;
if (stat (path, &st) == 0
&& (!st.st_uid || (st.st_uid == geteuid ())) && ((st.st_mode & (S_IWGRP | S_IWOTH)) == 0))
{
return 1;
}
if (stat (path, &st) == 0 && (st.st_uid == 0 || (st.st_uid == geteuid ()) != 0)
&& ((st.st_mode & (S_IWGRP | S_IWOTH)) == 0))
return TRUE;
if (verbose)
{
message (D_NORMAL, _("Warning -- ignoring file"),
_("File %s is not owned by root or you or is world writable.\n"
"Using it may compromise your security"), path);
}
return 0;
return FALSE;
}
/* --------------------------------------------------------------------------------------------- */
@ -636,29 +629,30 @@ int
check_format_view (const char *p)
{
const char *q = p;
if (!strncmp (p, "view", 4))
if (strncmp (p, "view", 4) == 0)
{
q += 4;
if (*q == '{')
{
for (q++; *q && *q != '}'; q++)
for (q++; *q != '\0' && *q != '}'; q++)
{
if (!strncmp (q, DEFAULT_CHARSET, 5))
if (strncmp (q, DEFAULT_CHARSET, 5) == 0)
{
mcview_default_hex_mode = 0;
q += 4;
}
else if (!strncmp (q, "hex", 3))
else if (strncmp (q, "hex", 3) == 0)
{
mcview_default_hex_mode = 1;
q += 2;
}
else if (!strncmp (q, "nroff", 5))
else if (strncmp (q, "nroff", 5) == 0)
{
mcview_default_nroff_flag = 1;
q += 4;
}
else if (!strncmp (q, "unform", 6))
else if (strncmp (q, "unform", 6) == 0)
{
mcview_default_nroff_flag = 0;
q += 5;
@ -677,7 +671,7 @@ check_format_view (const char *p)
int
check_format_cd (const char *p)
{
return (strncmp (p, "cd", 2)) ? 0 : 3;
return (strncmp (p, "cd", 2)) != 0 ? 0 : 3;
}
/* --------------------------------------------------------------------------------------------- */
@ -692,20 +686,20 @@ check_format_var (const char *p, char **v)
char *var_name;
*v = NULL;
if (!strncmp (p, "var{", 4))
if (strncmp (p, "var{", 4) == 0)
{
const char *dots = NULL;
const char *value;
for (q += 4; *q && *q != '}'; q++)
for (q += 4; *q != '\0' && *q != '}'; q++)
{
if (*q == ':')
dots = q + 1;
}
if (!*q)
if (*q == '\0')
return 0;
if (!dots || dots == q + 5)
if (dots == NULL || dots == q + 5)
{
message (D_ERROR,
_("Format error on file Extensions File"),
@ -719,7 +713,7 @@ check_format_var (const char *p, char **v)
value = getenv (var_name);
g_free (var_name);
if (value)
if (value != NULL)
{
*v = g_strdup (value);
return q - p;
@ -734,11 +728,11 @@ check_format_var (const char *p, char **v)
/* --------------------------------------------------------------------------------------------- */
char *
expand_format (struct WEdit *edit_widget, char c, gboolean do_quote)
expand_format (const WEdit * edit_widget, char c, gboolean do_quote)
{
WPanel *panel = NULL;
char *(*quote_func) (const char *, gboolean);
char *fname = NULL;
const char *fname = NULL;
char *result;
char c_lc;
@ -760,7 +754,7 @@ expand_format (struct WEdit *edit_widget, char c, gboolean do_quote)
return g_strdup ("");
panel = other_panel;
}
fname = g_strdup (panel->dir.list[panel->selected].fname);
fname = panel->dir.list[panel->selected].fname;
break;
#ifdef USE_INTERNAL_EDIT
@ -807,7 +801,7 @@ expand_format (struct WEdit *edit_widget, char c, gboolean do_quote)
}
case 'i': /* indent equal number cursor position in line */
#ifdef USE_INTERNAL_EDIT
if (edit_widget)
if (edit_widget != NULL)
{
result = g_strnfill (edit_get_curs_col (edit_widget), ' ');
goto ret;
@ -816,9 +810,11 @@ expand_format (struct WEdit *edit_widget, char c, gboolean do_quote)
break;
case 'y': /* syntax type */
#ifdef USE_INTERNAL_EDIT
if (edit_widget)
if (edit_widget != NULL)
{
const char *syntax_type = edit_get_syntax_type (edit_widget);
const char *syntax_type;
syntax_type = edit_get_syntax_type (edit_widget);
if (syntax_type != NULL)
{
result = g_strdup (syntax_type);
@ -829,28 +825,26 @@ expand_format (struct WEdit *edit_widget, char c, gboolean do_quote)
break;
case 'k': /* block file name */
case 'b': /* block file name / strip extension */
{
#ifdef USE_INTERNAL_EDIT
if (edit_widget)
{
char *file;
if (edit_widget != NULL)
{
char *file;
file = mc_config_get_full_path (EDIT_BLOCK_FILE);
result = quote_func (file, FALSE);
g_free (file);
goto ret;
}
#endif
if (c_lc == 'b')
{
result = strip_ext (quote_func (fname, FALSE));
goto ret;
}
break;
file = mc_config_get_full_path (EDIT_BLOCK_FILE);
result = quote_func (file, FALSE);
g_free (file);
goto ret;
}
#endif
if (c_lc == 'b')
{
result = strip_ext (quote_func (fname, FALSE));
goto ret;
}
break;
case 'n': /* strip extension in editor */
#ifdef USE_INTERNAL_EDIT
if (edit_widget)
if (edit_widget != NULL)
{
result = strip_ext (quote_func (fname, FALSE));
goto ret;
@ -858,14 +852,14 @@ expand_format (struct WEdit *edit_widget, char c, gboolean do_quote)
#endif
break;
case 'm': /* menu file name */
if (menu)
if (menu != NULL)
{
result = quote_func (menu, FALSE);
goto ret;
}
break;
case 's':
if (!panel || !panel->marked)
if (panel == NULL || panel->marked == 0)
{
result = quote_func (fname, FALSE);
goto ret;
@ -910,7 +904,6 @@ expand_format (struct WEdit *edit_widget, char c, gboolean do_quote)
result = g_strdup ("% ");
result[1] = c;
ret:
g_free (fname);
return result;
}
@ -921,12 +914,13 @@ expand_format (struct WEdit *edit_widget, char c, gboolean do_quote)
*/
gboolean
user_menu_cmd (struct WEdit * edit_widget, const char *menu_file, int selected_entry)
user_menu_cmd (const WEdit * edit_widget, const char *menu_file, int selected_entry)
{
char *p;
char *data, **entries;
int max_cols, menu_lines, menu_limit;
int col, i, accept_entry = 1;
int col, i;
gboolean accept_entry = TRUE;
int selected, old_patterns;
gboolean res = FALSE;
gboolean interactive = TRUE;
@ -939,7 +933,7 @@ user_menu_cmd (struct WEdit * edit_widget, const char *menu_file, int selected_e
if (menu_file != NULL)
menu = g_strdup (menu_file);
else
menu = g_strdup (edit_widget ? EDIT_LOCAL_MENU : MC_LOCAL_MENU);
menu = g_strdup (edit_widget != NULL ? EDIT_LOCAL_MENU : MC_LOCAL_MENU);
if (!exist_file (menu) || !menu_file_own (menu))
{
if (menu_file != NULL)
@ -951,7 +945,7 @@ user_menu_cmd (struct WEdit * edit_widget, const char *menu_file, int selected_e
}
g_free (menu);
if (edit_widget)
if (edit_widget != NULL)
menu = mc_config_get_full_path (EDIT_HOME_MENU);
else
menu = mc_config_get_full_path (MC_USERMENU_FILE);
@ -962,19 +956,21 @@ user_menu_cmd (struct WEdit * edit_widget, const char *menu_file, int selected_e
g_free (menu);
menu =
mc_build_filename (mc_config_get_home_dir (),
edit_widget ? EDIT_GLOBAL_MENU : MC_GLOBAL_MENU, NULL);
edit_widget != NULL ? EDIT_GLOBAL_MENU : MC_GLOBAL_MENU, NULL);
if (!exist_file (menu))
{
g_free (menu);
menu =
mc_build_filename (mc_global.sysconfig_dir,
edit_widget ? EDIT_GLOBAL_MENU : MC_GLOBAL_MENU, NULL);
edit_widget != NULL ? EDIT_GLOBAL_MENU : MC_GLOBAL_MENU,
NULL);
if (!exist_file (menu))
{
g_free (menu);
menu = mc_build_filename
(mc_global.share_data_dir, edit_widget ? EDIT_GLOBAL_MENU : MC_GLOBAL_MENU,
NULL);
menu =
mc_build_filename (mc_global.share_data_dir,
edit_widget != NULL ? EDIT_GLOBAL_MENU : MC_GLOBAL_MENU,
NULL);
}
}
}
@ -990,12 +986,12 @@ user_menu_cmd (struct WEdit * edit_widget, const char *menu_file, int selected_e
max_cols = 0;
selected = 0;
menu_limit = 0;
entries = 0;
entries = NULL;
/* Parse the menu file */
old_patterns = easy_patterns;
p = check_patterns (data);
for (menu_lines = col = 0; *p; str_next_char (&p))
for (menu_lines = col = 0; *p != '\0'; str_next_char (&p))
{
if (menu_lines >= menu_limit)
{
@ -1012,7 +1008,7 @@ user_menu_cmd (struct WEdit * edit_widget, const char *menu_file, int selected_e
while (--new_entries >= &entries[menu_lines])
*new_entries = NULL;
}
if (col == 0 && !entries[menu_lines])
if (col == 0 && entries[menu_lines] == NULL)
{
if (*p == '#')
{
@ -1020,7 +1016,7 @@ user_menu_cmd (struct WEdit * edit_widget, const char *menu_file, int selected_e
if (selected_entry >= 0 && strncmp (p, "#silent", 7) == 0)
interactive = FALSE;
/* A commented menu entry */
accept_entry = 1;
accept_entry = TRUE;
}
else if (*p == '+')
{
@ -1051,7 +1047,7 @@ user_menu_cmd (struct WEdit * edit_widget, const char *menu_file, int selected_e
/* A condition for making the entry default */
i = 1;
p = test_line (edit_widget, p, &i);
if (selected == 0 && i)
if (selected == 0 && i != 0)
selected = menu_lines;
}
}
@ -1061,15 +1057,15 @@ user_menu_cmd (struct WEdit * edit_widget, const char *menu_file, int selected_e
if (accept_entry)
entries[menu_lines] = p;
else
accept_entry = 1;
accept_entry = TRUE;
}
}
if (*p == '\n')
{
if (entries[menu_lines])
if (entries[menu_lines] != NULL)
{
menu_lines++;
accept_entry = 1;
accept_entry = TRUE;
}
max_cols = max (max_cols, col);
col = 0;

View File

@ -7,20 +7,20 @@
#include "lib/global.h"
#include "src/editor/edit.h" /* WEdit */
/*** typedefs(not structures) and defined constants **********************************************/
/*** enums ***************************************************************************************/
/*** structures declarations (and typedefs of structures)*****************************************/
struct WEdit;
/*** global variables defined in .c file *********************************************************/
/*** declarations of public functions ************************************************************/
gboolean user_menu_cmd (struct WEdit *edit_widget, const char *menu_file, int selected_entry);
char *expand_format (struct WEdit *edit_widget, char c, gboolean do_quote);
gboolean user_menu_cmd (const WEdit * edit_widget, const char *menu_file, int selected_entry);
char *expand_format (const WEdit * edit_widget, char c, gboolean do_quote);
int check_format_view (const char *);
int check_format_var (const char *, char **);
int check_format_cd (const char *);

View File

@ -1080,7 +1080,7 @@ help_interactive_display (const gchar * event_group_name, const gchar * event_na
if (event_data->filename != NULL)
g_file_get_contents (event_data->filename, &filedata, NULL, NULL);
else
filedata = load_mc_home_file (mc_global.share_data_dir, MC_HELP, &hlpfile);
filedata = load_mc_home_file (mc_global.share_data_dir, MC_HELP, &hlpfile, NULL);
if (filedata == NULL)
message (D_ERROR, MSG_ERROR, _("Cannot open file %s\n%s"),

View File

@ -351,7 +351,9 @@ main (int argc, char *argv[])
load_keymap_defs (!mc_args__nokeymap);
#ifdef USE_INTERNAL_EDIT
macros_list = g_array_new (TRUE, FALSE, sizeof (macros_t));
#endif /* USE_INTERNAL_EDIT */
tty_init_colors (mc_global.tty.disable_colors, mc_args__force_colors);
@ -450,6 +452,7 @@ main (int argc, char *argv[])
done_key ();
#ifdef USE_INTERNAL_EDIT
if (macros_list != NULL)
{
guint i;
@ -464,6 +467,7 @@ main (int argc, char *argv[])
}
(void) g_array_free (macros_list, TRUE);
}
#endif /* USE_INTERNAL_EDIT */
str_uninit_strings ();

View File

@ -203,6 +203,7 @@ int quit = 0;
/* Set to TRUE to suppress printing the last directory */
int print_last_revert = FALSE;
#ifdef USE_INTERNAL_EDIT
/* index to record_macro_buf[], -1 if not recording a macro */
int macro_index = -1;
@ -210,6 +211,7 @@ int macro_index = -1;
struct macro_action_t record_macro_buf[MAX_MACRO_LENGTH];
GArray *macros_list;
#endif /* USE_INTERNAL_EDIT */
/*** file scope macro definitions ****************************************************************/
@ -820,6 +822,91 @@ panel_save_type (const char *section, panel_view_mode_t type)
/* --------------------------------------------------------------------------------------------- */
/**
* Load panels options from [Panels] section.
*/
static void
panels_load_options (void)
{
if (mc_config_has_group (mc_main_config, CONFIG_PANELS_SECTION))
{
size_t i;
int qmode;
for (i = 0; panels_ini_options[i].opt_name != NULL; i++)
*panels_ini_options[i].opt_addr =
mc_config_get_bool (mc_main_config, CONFIG_PANELS_SECTION,
panels_ini_options[i].opt_name,
*panels_ini_options[i].opt_addr);
qmode = mc_config_get_int (mc_main_config, CONFIG_PANELS_SECTION,
"quick_search_mode", (int) panels_options.qsearch_mode);
if (qmode < 0)
panels_options.qsearch_mode = QSEARCH_CASE_INSENSITIVE;
else if (qmode >= QSEARCH_NUM)
panels_options.qsearch_mode = QSEARCH_PANEL_CASE;
else
panels_options.qsearch_mode = (qsearch_mode_t) qmode;
panels_options.select_flags =
mc_config_get_int (mc_main_config, CONFIG_PANELS_SECTION, "select_flags",
(int) panels_options.select_flags);
}
}
/* --------------------------------------------------------------------------------------------- */
/**
* Save panels options in [Panels] section.
*/
static void
panels_save_options (void)
{
size_t i;
for (i = 0; panels_ini_options[i].opt_name != NULL; i++)
mc_config_set_bool (mc_main_config, CONFIG_PANELS_SECTION,
panels_ini_options[i].opt_name, *panels_ini_options[i].opt_addr);
mc_config_set_int (mc_main_config, CONFIG_PANELS_SECTION,
"quick_search_mode", (int) panels_options.qsearch_mode);
mc_config_set_int (mc_main_config, CONFIG_PANELS_SECTION,
"select_flags", (int) panels_options.select_flags);
}
/* --------------------------------------------------------------------------------------------- */
static void
save_config (void)
{
size_t i;
/* Save integer options */
for (i = 0; int_options[i].opt_name != NULL; i++)
mc_config_set_int (mc_main_config, CONFIG_APP_SECTION, int_options[i].opt_name,
*int_options[i].opt_addr);
/* Save string options */
for (i = 0; str_options[i].opt_name != NULL; i++)
mc_config_set_string (mc_main_config, CONFIG_APP_SECTION, str_options[i].opt_name,
*str_options[i].opt_addr);
}
/* --------------------------------------------------------------------------------------------- */
static void
save_layout (void)
{
size_t i;
/* Save integer options */
for (i = 0; layout[i].opt_name != NULL; i++)
mc_config_set_int (mc_main_config, CONFIG_LAYOUT_SECTION, layout[i].opt_name,
*layout[i].opt_addr);
}
/* --------------------------------------------------------------------------------------------- */
/* save panels.ini */
static void
save_panel_types (void)
@ -1146,23 +1233,6 @@ done_setup (void)
#endif /* HAVE_ASPELL */
}
/* --------------------------------------------------------------------------------------------- */
void
save_config (void)
{
size_t i;
/* Save integer options */
for (i = 0; int_options[i].opt_name != NULL; i++)
mc_config_set_int (mc_main_config, CONFIG_APP_SECTION, int_options[i].opt_name,
*int_options[i].opt_addr);
/* Save string options */
for (i = 0; str_options[i].opt_name != NULL; i++)
mc_config_set_string (mc_main_config, CONFIG_APP_SECTION, str_options[i].opt_name,
*str_options[i].opt_addr);
}
/* --------------------------------------------------------------------------------------------- */
@ -1177,18 +1247,6 @@ setup_save_config_show_error (const char *filename, GError ** mcerror)
}
}
/* --------------------------------------------------------------------------------------------- */
void
save_layout (void)
{
size_t i;
/* Save integer options */
for (i = 0; layout[i].opt_name != NULL; i++)
mc_config_set_int (mc_main_config, CONFIG_LAYOUT_SECTION, layout[i].opt_name,
*layout[i].opt_addr);
}
/* --------------------------------------------------------------------------------------------- */
@ -1431,58 +1489,5 @@ panel_save_setup (WPanel * panel, const char *section)
mc_config_set_int (mc_panels_config, section, "user_mini_status", panel->user_mini_status);
}
/* --------------------------------------------------------------------------------------------- */
/**
Load panels options from [Panels] section.
*/
void
panels_load_options (void)
{
if (mc_config_has_group (mc_main_config, CONFIG_PANELS_SECTION))
{
size_t i;
int qmode;
for (i = 0; panels_ini_options[i].opt_name != NULL; i++)
*panels_ini_options[i].opt_addr =
mc_config_get_bool (mc_main_config, CONFIG_PANELS_SECTION,
panels_ini_options[i].opt_name,
*panels_ini_options[i].opt_addr);
qmode = mc_config_get_int (mc_main_config, CONFIG_PANELS_SECTION,
"quick_search_mode", (int) panels_options.qsearch_mode);
if (qmode < 0)
panels_options.qsearch_mode = QSEARCH_CASE_INSENSITIVE;
else if (qmode >= QSEARCH_NUM)
panels_options.qsearch_mode = QSEARCH_PANEL_CASE;
else
panels_options.qsearch_mode = (qsearch_mode_t) qmode;
panels_options.select_flags =
mc_config_get_int (mc_main_config, CONFIG_PANELS_SECTION, "select_flags",
(int) panels_options.select_flags);
}
}
/* --------------------------------------------------------------------------------------------- */
/**
Save panels options in [Panels] section.
*/
void
panels_save_options (void)
{
size_t i;
for (i = 0; panels_ini_options[i].opt_name != NULL; i++)
mc_config_set_bool (mc_main_config, CONFIG_PANELS_SECTION,
panels_ini_options[i].opt_name, *panels_ini_options[i].opt_addr);
mc_config_set_int (mc_main_config, CONFIG_PANELS_SECTION,
"quick_search_mode", (int) panels_options.qsearch_mode);
mc_config_set_int (mc_main_config, CONFIG_PANELS_SECTION,
"select_flags", (int) panels_options.select_flags);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -126,6 +126,7 @@ extern int quit;
/* Set to TRUE to suppress printing the last directory */
extern gboolean print_last_revert;
#ifdef USE_INTERNAL_EDIT
/* index to record_macro_buf[], -1 if not recording a macro */
extern int macro_index;
@ -133,6 +134,7 @@ extern int macro_index;
extern struct macro_action_t record_macro_buf[MAX_MACRO_LENGTH];
extern GArray *macros_list;
#endif /* USE_INTERNAL_EDIT */
extern int saving_setup;
@ -142,11 +144,8 @@ const char *setup_init (void);
void load_setup (void);
gboolean save_setup (gboolean save_options, gboolean save_panel_options);
void done_setup (void);
void save_config (void);
void setup_save_config_show_error (const char *filename, GError ** mcerror);
void save_layout (void);
void load_key_defs (void);
#ifdef ENABLE_VFS_FTP
char *load_anon_passwd (void);
@ -158,9 +157,6 @@ void free_keymap_defs (void);
void panel_load_setup (WPanel * panel, const char *section);
void panel_save_setup (WPanel * panel, const char *section);
void panels_load_options (void);
void panels_save_options (void);
/*** inline functions ****************************************************************************/
#endif /* MC__SETUP_H */

View File

@ -3,6 +3,7 @@ noinst_LTLIBRARIES = libsubshell.la
libsubshell_la_SOURCES = \
common.c \
internal.h \
proxyfunc.c
proxyfunc.c \
subshell.h
AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(PCRE_CPPFLAGS)
AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS)

View File

@ -234,7 +234,9 @@ cpio_open_cpio_file (struct vfs_class *me, struct vfs_s_super *super, const vfs_
arch->deferred = NULL;
type = get_compression_type (fd, super->name);
if (type != COMPRESSION_NONE)
if (type == COMPRESSION_NONE)
mc_lseek (fd, 0, SEEK_SET);
else
{
char *s;
vfs_path_t *tmp_vpath;

View File

@ -23,7 +23,7 @@ gitfs_list()
gitfs_copyout()
{
echo -e "$2" > "$4"
printf "%s\n" "$2" > "$4"
b=`echo "$prefix"| wc -c`
b=`expr "$b" + 1`
# remove prefix from file name

View File

@ -694,7 +694,7 @@ static void
ftpfs_load_no_proxy_list (void)
{
/* FixMe: shouldn't be hardcoded!!! */
static char *mc_file = NULL;
char *mc_file;
mc_file = g_build_filename (mc_global.sysconfig_dir, "mc.no_proxy", (char *) NULL);
if (exist_file (mc_file))

View File

@ -1,5 +1,5 @@
AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) $(LIBSSH_CFLAGS)
AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) $(LIBSSH_CFLAGS) $(PCRE_CPPFLAGS)
noinst_LTLIBRARIES = libvfs-sftpfs.la

Some files were not shown because too many files have changed in this diff Show More