Merge branch '2447_prepare_to_4.7.5'

* 2447_prepare_to_4.7.5:
  (fish_fill_names): remove unexpected break.
  (panel_save_curent_file_to_clip_file): 'res' might be used uninitialized here.
  Fixed English and Russian man pages.
  (warn_same_file): cleanup of preprocessing usage.
  fix VFS crashes.
  Panel update: type accuracy.
  Replaced remaining grep with @GREP@ in iso9660 VFS plugin.
  (single_dirsize_cmd): send CK_PanelMoveDown message instead of KEY_DOWN one to panel.
  Ticket #2447: code cleanup before 4.7.5 release.
This commit is contained in:
Andrew Borodin 2010-12-28 12:28:14 +03:00
commit 09533cf671
12 changed files with 101 additions and 77 deletions

View File

@ -3973,6 +3973,7 @@ For example:
.PP
.nf
clipboard_store=xclip \-i
.fi
.TP
.I clipboard_paste
This variable contains path (with options) to the external clipboard
@ -3980,7 +3981,8 @@ utility like 'xclip' to print the selection to standard out.
For example:
.PP
.nf
clipboard_store=xclip \-o
clipboard_pastee=xclip \-o
.fi
.TP
.I autodetect_codeset
This option allows use the `enca' command to autodetect codeset of text files

View File

@ -4257,6 +4257,7 @@ mc.ext\&.
.PP
.nf
clipboard_store=xclip \-i
.fi
.TP
.I clipboard_paste
Эта переменная позволяет назначить внешнюю программу (с параметрами) для
@ -4265,7 +4266,8 @@ clipboard_store=xclip \-i
Например:
.PP
.nf
clipboard_store=xclip \-o
clipboard_paste=xclip \-o
.fi
.PP
.I autodetect_codeset
.IP

View File

@ -1166,8 +1166,12 @@ vfs_s_open (struct vfs_class *me, const char *file, int flags, mode_t mode)
}
split_dir_name (me, q, &dirname, &name, &save);
/* FIXME: check if vfs_s_find_inode returns NULL */
dir = vfs_s_find_inode (me, super, dirname, LINK_FOLLOW, FL_DIR);
if (dir == NULL)
{
g_free (q);
return NULL;
}
if (save)
*save = PATH_SEP;
ent = vfs_s_generate_entry (me, name, dir, 0755);

View File

@ -11,7 +11,7 @@
test_iso () {
CHARSET=`locale charmap 2>/dev/null`
if test -z "$CHARSET"; then
CHARSET=`locale 2>/dev/null | grep LC_CTYPE | sed -n -e 's/.*\.\(.*\)"$/\1/p'`
CHARSET=`locale 2>/dev/null | @GREP@ LC_CTYPE | sed -n -e 's/.*\.\(.*\)"$/\1/p'`
fi
if test -n "$CHARSET"; then
CHARSET=`echo "$CHARSET" | tr '[A-Z]' '[a-z]' | sed -e 's/^iso-/iso/'`

View File

@ -128,7 +128,7 @@ int fish_directory_timeout = 900;
return -1; \
} \
rpath = strutils_shell_escape (crpath); \
g_free (mpath);
g_free (mpath)
/*** file scope type declarations ****************************************************************/
@ -1221,7 +1221,9 @@ static int
fish_chmod (struct vfs_class *me, const char *path, int mode)
{
gchar *shell_commands = NULL;
PREFIX
PREFIX;
shell_commands = g_strconcat (SUP.scr_env, "FISH_FILENAME=%s FISH_FILEMODE=%4.4o;\n",
SUP.scr_chmod, (char *) NULL);
g_snprintf (buf, sizeof (buf), shell_commands, rpath, mode & 07777);
@ -1252,7 +1254,8 @@ fish_chown (struct vfs_class *me, const char *path, uid_t owner, gid_t group)
{
gchar *shell_commands = NULL;
PREFIX
PREFIX;
shell_commands = g_strconcat (SUP.scr_env,
"FISH_FILENAME=%s FISH_FILEOWNER=%s FISH_FILEGROUP=%s;\n",
SUP.scr_chown, (char *) NULL);
@ -1272,7 +1275,9 @@ static int
fish_unlink (struct vfs_class *me, const char *path)
{
gchar *shell_commands = NULL;
PREFIX
PREFIX;
shell_commands =
g_strconcat (SUP.scr_env, "FISH_FILENAME=%s;\n", SUP.scr_unlink, (char *) NULL);
g_snprintf (buf, sizeof (buf), shell_commands, rpath);
@ -1287,7 +1292,9 @@ static int
fish_exists (struct vfs_class *me, const char *path)
{
gchar *shell_commands = NULL;
PREFIX
PREFIX;
shell_commands =
g_strconcat (SUP.scr_env, "FISH_FILENAME=%s;\n", SUP.scr_exists, (char *) NULL);
g_snprintf (buf, sizeof (buf), shell_commands, rpath);
@ -1306,7 +1313,9 @@ fish_mkdir (struct vfs_class *me, const char *path, mode_t mode)
gchar *shell_commands = NULL;
int ret_code;
PREFIX (void) mode;
PREFIX;
(void) mode;
shell_commands = g_strconcat (SUP.scr_env, "FISH_FILENAME=%s;\n", SUP.scr_mkdir, (char *) NULL);
g_snprintf (buf, sizeof (buf), shell_commands, rpath);
@ -1331,9 +1340,10 @@ static int
fish_rmdir (struct vfs_class *me, const char *path)
{
gchar *shell_commands = NULL;
PREFIX
shell_commands =
g_strconcat (SUP.scr_env, "FISH_FILENAME=%s;\n", SUP.scr_rmdir, (char *) NULL);
PREFIX;
shell_commands = g_strconcat (SUP.scr_env, "FISH_FILENAME=%s;\n", SUP.scr_rmdir, (char *) NULL);
g_snprintf (buf, sizeof (buf), shell_commands, rpath);
g_free (shell_commands);
g_free (rpath);
@ -1394,7 +1404,6 @@ fish_fill_names (struct vfs_class *me, fill_names_f func)
default:
if (SUP.flags > FISH_FLAG_RSH)
{
break;
g_snprintf (gbuf, sizeof (gbuf), ":%d", SUP.flags);
flags = gbuf;
}

View File

@ -222,7 +222,7 @@ vfs_stamp_create (struct vfs_class *oldvfs, vfsid oldvfsid)
n3vfsid = NULL;
}
if (!oldvfs->nothingisopen || !(*oldvfs->nothingisopen) (oldvfsid))
if (!oldvfs || !oldvfs->nothingisopen || !(*oldvfs->nothingisopen) (oldvfsid))
return;
vfs_addstamp (oldvfs, oldvfsid);

View File

@ -810,16 +810,20 @@ mc_open (const char *filename, int flags, ...)
/* --------------------------------------------------------------------------------------------- */
/* *INDENT-OFF* */
#define MC_NAMEOP(name, inarg, callarg) \
int mc_##name inarg \
{ \
struct vfs_class *vfs; \
int result; \
char *mpath = vfs_canon_and_translate (path); \
char *mpath; \
mpath = vfs_canon_and_translate (path); \
if (mpath == NULL) \
return -1; \
vfs = vfs_get_class (mpath); \
if (vfs == NULL){ \
if (vfs == NULL) \
{ \
g_free (mpath); \
return -1; \
} \
@ -830,14 +834,16 @@ int mc_##name inarg \
return result; \
}
MC_NAMEOP (chmod, (const char *path, mode_t mode), (vfs, mpath, mode));
MC_NAMEOP (chown, (const char *path, uid_t owner, gid_t group), (vfs, mpath, owner, group));
MC_NAMEOP (utime, (const char *path, struct utimbuf * times), (vfs, mpath, times));
MC_NAMEOP (readlink, (const char *path, char *buf, size_t bufsiz), (vfs, mpath, buf, bufsiz));
MC_NAMEOP (unlink, (const char *path), (vfs, mpath));
MC_NAMEOP (mkdir, (const char *path, mode_t mode), (vfs, mpath, mode));
MC_NAMEOP (rmdir, (const char *path), (vfs, mpath));
MC_NAMEOP (mknod, (const char *path, mode_t mode, dev_t dev), (vfs, mpath, mode, dev));
MC_NAMEOP (chmod, (const char *path, mode_t mode), (vfs, mpath, mode))
MC_NAMEOP (chown, (const char *path, uid_t owner, gid_t group), (vfs, mpath, owner, group))
MC_NAMEOP (utime, (const char *path, struct utimbuf * times), (vfs, mpath, times))
MC_NAMEOP (readlink, (const char *path, char *buf, size_t bufsiz), (vfs, mpath, buf, bufsiz))
MC_NAMEOP (unlink, (const char *path), (vfs, mpath))
MC_NAMEOP (mkdir, (const char *path, mode_t mode), (vfs, mpath, mode))
MC_NAMEOP (rmdir, (const char *path), (vfs, mpath))
MC_NAMEOP (mknod, (const char *path, mode_t mode, dev_t dev), (vfs, mpath, mode, dev))
/* *INDENT-ON* */
/* --------------------------------------------------------------------------------------------- */
@ -877,6 +883,8 @@ mc_symlink (const char *name1, const char *path)
/* --------------------------------------------------------------------------------------------- */
/* *INDENT-OFF* */
#define MC_HANDLEOP(name, inarg, callarg) \
ssize_t mc_##name inarg \
{ \
@ -893,8 +901,8 @@ ssize_t mc_##name inarg \
return result; \
}
MC_HANDLEOP (read, (int handle, void *buffer, size_t count), (vfs_info (handle), buffer, count));
MC_HANDLEOP (write, (int handle, const void *buf, size_t nbyte), (vfs_info (handle), buf, nbyte));
MC_HANDLEOP (read, (int handle, void *buffer, size_t count), (vfs_info (handle), buffer, count))
MC_HANDLEOP (write, (int handle, const void *buf, size_t nbyte), (vfs_info (handle), buf, nbyte))
/* --------------------------------------------------------------------------------------------- */
@ -928,11 +936,15 @@ int mc_##name (const char *fname1, const char *fname2) \
return result; \
}
MC_RENAMEOP (link) MC_RENAMEOP (rename);
MC_RENAMEOP (link)
MC_RENAMEOP (rename)
/* *INDENT-ON* */
/* --------------------------------------------------------------------------------------------- */
int
mc_ctl (int handle, int ctlop, void *arg)
int
mc_ctl (int handle, int ctlop, void *arg)
{
struct vfs_class *vfs = vfs_op (handle);

View File

@ -161,7 +161,7 @@ load_text_from_clip_file (char **text)
static gboolean
panel_save_curent_file_to_clip_file (void)
{
gboolean res;
gboolean res = FALSE;
if (current_panel->marked == 0)
res = save_text_to_clip_file (selection (current_panel)->fname);

View File

@ -58,6 +58,7 @@
#include "lib/strutil.h"
#include "lib/util.h"
#include "lib/widget.h"
#include "lib/keybind.h" /* CK_PanelMoveDown, CK_InputHistoryShow */
#include "src/subshell.h" /* use_subshell */
#include "src/consaver/cons.saver.h" /* console_flag */
@ -66,7 +67,6 @@
#include "src/setup.h"
#include "src/execute.h" /* toggle_panels() */
#include "src/history.h"
#include "src/keybind-defaults.h" /* CK_InputHistoryShow */
#ifdef USE_INTERNAL_EDIT
#include "src/editor/edit.h"
@ -956,12 +956,11 @@ filter_cmd (void)
void
reread_cmd (void)
{
int flag;
panel_update_flags_t flag = UP_ONLY_CURRENT;
if (get_current_type () == view_listing && get_other_type () == view_listing)
flag = strcmp (current_panel->cwd, other_panel->cwd) ? UP_ONLY_CURRENT : 0;
else
flag = UP_ONLY_CURRENT;
if (get_current_type () == view_listing && get_other_type () == view_listing
&& strcmp (current_panel->cwd, other_panel->cwd) == 0)
flag = UP_OPTIMIZE;
update_panels (UP_RELOAD | flag, UP_KEEPSEL);
repaint_screen ();
@ -1513,7 +1512,7 @@ single_dirsize_cmd (void)
}
if (panels_options.mark_moves_down)
send_message (&panel->widget, WIDGET_KEY, KEY_DOWN);
send_message ((Widget *) panel, WIDGET_COMMAND, CK_PanelMoveDown);
recalculate_panel_summary (panel);

View File

@ -462,30 +462,24 @@ real_warn_same_file (enum OperationMode mode, const char *fmt, const char *a, co
/* --------------------------------------------------------------------------------------------- */
#ifdef WITH_BACKGROUND
static FileProgressStatus
warn_same_file (const char *fmt, const char *a, const char *b)
{
#ifdef WITH_BACKGROUND
union
{
void *p;
FileProgressStatus (*f) (enum OperationMode, const char *fmt,
const char *a, const char *b);
} pntr;
pntr.f = real_warn_same_file;
if (we_are_background)
return parent_call (pntr.p, NULL, 3, strlen (fmt), fmt, strlen (a), a, strlen (b), b);
else
return real_warn_same_file (Foreground, fmt, a, b);
}
#else
static FileProgressStatus
warn_same_file (const char *fmt, const char *a, const char *b)
{
return real_warn_same_file (Foreground, fmt, a, b);
}
#endif
return real_warn_same_file (Foreground, fmt, a, b);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -3268,12 +3268,12 @@ reload_panelized (WPanel * panel)
/* --------------------------------------------------------------------------------------------- */
static void
update_one_panel_widget (WPanel * panel, int force_update, const char *current_file)
update_one_panel_widget (WPanel * panel, panel_update_flags_t flags, const char *current_file)
{
int free_pointer;
gboolean free_pointer;
char *my_current_file = NULL;
if (force_update & UP_RELOAD)
if ((flags & UP_RELOAD) != 0)
{
panel->is_panelized = 0;
mc_setctl (panel->cwd, VFS_SETCTL_FLUSH, 0);
@ -3281,14 +3281,13 @@ update_one_panel_widget (WPanel * panel, int force_update, const char *current_f
}
/* If current_file == -1 (an invalid pointer) then preserve selection */
if (current_file == UP_KEEPSEL)
free_pointer = current_file == UP_KEEPSEL;
if (free_pointer)
{
free_pointer = 1;
my_current_file = g_strdup (panel->dir.list[panel->selected].fname);
current_file = my_current_file;
}
else
free_pointer = 0;
if (panel->is_panelized)
reload_panelized (panel);
@ -3305,13 +3304,13 @@ update_one_panel_widget (WPanel * panel, int force_update, const char *current_f
/* --------------------------------------------------------------------------------------------- */
static void
update_one_panel (int which, int force_update, const char *current_file)
update_one_panel (int which, panel_update_flags_t flags, const char *current_file)
{
if (get_display_type (which) == view_listing)
{
WPanel *panel;
panel = (WPanel *) get_panel_widget (which);
update_one_panel_widget (panel, force_update, current_file);
update_one_panel_widget (panel, flags, current_file);
}
}
@ -3995,15 +3994,15 @@ panel_change_encoding (WPanel * panel)
*/
void
update_panels (int force_update, const char *current_file)
update_panels (panel_update_flags_t flags, const char *current_file)
{
int reload_other = !(force_update & UP_ONLY_CURRENT);
gboolean reload_other = (flags & UP_ONLY_CURRENT) == 0;
WPanel *panel;
int ret;
update_one_panel (get_current_index (), force_update, current_file);
update_one_panel (get_current_index (), flags, current_file);
if (reload_other)
update_one_panel (get_other_index (), force_update, UP_KEEPSEL);
update_one_panel (get_other_index (), flags, UP_KEEPSEL);
if (get_current_type () == view_listing)
panel = (WPanel *) get_panel_widget (get_current_index ());

View File

@ -23,10 +23,6 @@
#define LIST_TYPES 4
#define UP_OPTIMIZE 0
#define UP_RELOAD 1
#define UP_ONLY_CURRENT 2
#define UP_KEEPSEL ((char *) -1)
/*** enums ***************************************************************************************/
@ -54,6 +50,13 @@ enum panel_display_enum
frame_half /* half screen frame */
};
typedef enum
{
UP_OPTIMIZE = 0,
UP_RELOAD = 1,
UP_ONLY_CURRENT = 2
} panel_update_flags_t;
/*** structures declarations (and typedefs of structures)*****************************************/
struct format_e;
@ -142,7 +145,7 @@ void panel_re_sort (WPanel * panel);
void panel_change_encoding (WPanel * panel);
void update_dirty_panels (void);
void update_panels (int force_update, const char *current_file);
void update_panels (panel_update_flags_t flags, const char *current_file);
void panel_update_cols (Widget * widget, int frame_size);
int set_panel_formats (WPanel * p);