diff --git a/doc/man/mc.1.in b/doc/man/mc.1.in index 07b6e8d6d..0193f2145 100644 --- a/doc/man/mc.1.in +++ b/doc/man/mc.1.in @@ -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 diff --git a/doc/man/ru/mc.1.in b/doc/man/ru/mc.1.in index 1305455a2..d8ed3e15a 100644 --- a/doc/man/ru/mc.1.in +++ b/doc/man/ru/mc.1.in @@ -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 diff --git a/lib/vfs/mc-vfs/direntry.c b/lib/vfs/mc-vfs/direntry.c index 1fe31d41a..314696be1 100644 --- a/lib/vfs/mc-vfs/direntry.c +++ b/lib/vfs/mc-vfs/direntry.c @@ -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); diff --git a/lib/vfs/mc-vfs/extfs/iso9660.in b/lib/vfs/mc-vfs/extfs/iso9660.in index a64958ea3..2522cba23 100644 --- a/lib/vfs/mc-vfs/extfs/iso9660.in +++ b/lib/vfs/mc-vfs/extfs/iso9660.in @@ -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/'` diff --git a/lib/vfs/mc-vfs/fish.c b/lib/vfs/mc-vfs/fish.c index 1f27e1956..694369b55 100644 --- a/lib/vfs/mc-vfs/fish.c +++ b/lib/vfs/mc-vfs/fish.c @@ -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,9 +1221,11 @@ static int fish_chmod (struct vfs_class *me, const char *path, int mode) { gchar *shell_commands = NULL; - PREFIX - shell_commands = g_strconcat (SUP.scr_env, "FISH_FILENAME=%s FISH_FILEMODE=%4.4o;\n", - SUP.scr_chmod, (char *) NULL); + + 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); g_free (shell_commands); g_free (rpath); @@ -1252,10 +1254,11 @@ fish_chown (struct vfs_class *me, const char *path, uid_t owner, gid_t group) { gchar *shell_commands = NULL; - PREFIX - shell_commands = g_strconcat (SUP.scr_env, - "FISH_FILENAME=%s FISH_FILEOWNER=%s FISH_FILEGROUP=%s;\n", - SUP.scr_chown, (char *) NULL); + PREFIX; + + shell_commands = g_strconcat (SUP.scr_env, + "FISH_FILENAME=%s FISH_FILEOWNER=%s FISH_FILEGROUP=%s;\n", + SUP.scr_chown, (char *) NULL); g_snprintf (buf, sizeof (buf), shell_commands, rpath, sowner, sgroup); g_free (shell_commands); fish_send_command (me, super, buf, OPT_FLUSH); @@ -1272,8 +1275,10 @@ static int fish_unlink (struct vfs_class *me, const char *path) { gchar *shell_commands = NULL; - PREFIX - shell_commands = + + 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); g_free (shell_commands); @@ -1287,8 +1292,10 @@ static int fish_exists (struct vfs_class *me, const char *path) { gchar *shell_commands = NULL; - PREFIX - shell_commands = + + 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); g_free (shell_commands); @@ -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; } diff --git a/lib/vfs/mc-vfs/gc.c b/lib/vfs/mc-vfs/gc.c index 81ce710a7..d789c3a54 100644 --- a/lib/vfs/mc-vfs/gc.c +++ b/lib/vfs/mc-vfs/gc.c @@ -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); diff --git a/lib/vfs/mc-vfs/vfs.c b/lib/vfs/mc-vfs/vfs.c index f8daecc74..a539a4343 100644 --- a/lib/vfs/mc-vfs/vfs.c +++ b/lib/vfs/mc-vfs/vfs.c @@ -810,34 +810,40 @@ 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){ \ - g_free (mpath); \ - return -1; \ + if (vfs == NULL) \ + { \ + g_free (mpath); \ + return -1; \ } \ result = vfs->name != NULL ? vfs->name callarg : -1; \ g_free (mpath); \ if (result == -1) \ - errno = vfs->name != NULL ? ferrno (vfs) : E_NOTSUPP; \ + errno = vfs->name != NULL ? ferrno (vfs) : E_NOTSUPP; \ 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); diff --git a/lib/widget/input.c b/lib/widget/input.c index 62795feac..5adf07012 100644 --- a/lib/widget/input.c +++ b/lib/widget/input.c @@ -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); diff --git a/src/filemanager/cmd.c b/src/filemanager/cmd.c index 739a78a74..4d91851a6 100644 --- a/src/filemanager/cmd.c +++ b/src/filemanager/cmd.c @@ -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); diff --git a/src/filemanager/file.c b/src/filemanager/file.c index 527464661..1b8be52de 100644 --- a/src/filemanager/file.c +++ b/src/filemanager/file.c @@ -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); + 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) -{ +#endif return real_warn_same_file (Foreground, fmt, a, b); } -#endif /* --------------------------------------------------------------------------------------------- */ diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c index ff8a30522..06a4c5c0d 100644 --- a/src/filemanager/panel.c +++ b/src/filemanager/panel.c @@ -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 ()); diff --git a/src/filemanager/panel.h b/src/filemanager/panel.h index bf136c53e..e1b1e5450 100644 --- a/src/filemanager/panel.h +++ b/src/filemanager/panel.h @@ -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);