Fix of file panel encoding change w/o VFS support.
Now --disable-vfs doesn't mean the total disabling of VFS. With --disable-vfs option, the localfs module is built to use the change of file panel encoding. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
48318f3e5d
Коммит
c36a810c09
@ -39,9 +39,5 @@ libmc_la_LIBADD = \
|
|||||||
search/libsearch.la \
|
search/libsearch.la \
|
||||||
strutil/libmcstrutil.la \
|
strutil/libmcstrutil.la \
|
||||||
skin/libmcskin.la \
|
skin/libmcskin.la \
|
||||||
tty/libmctty.la
|
tty/libmctty.la \
|
||||||
|
vfs/mc-vfs/libvfs-mc.la
|
||||||
if ENABLE_VFS
|
|
||||||
libmc_la_LIBADD += vfs/mc-vfs/libvfs-mc.la
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
24
lib/util.c
24
lib/util.c
@ -894,30 +894,6 @@ strip_ctrl_codes (char *s)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef ENABLE_VFS
|
|
||||||
char *
|
|
||||||
get_current_wd (char *buffer, size_t size)
|
|
||||||
{
|
|
||||||
char *p;
|
|
||||||
size_t len;
|
|
||||||
|
|
||||||
p = g_get_current_dir ();
|
|
||||||
len = strlen (p) + 1;
|
|
||||||
|
|
||||||
if (len > size)
|
|
||||||
{
|
|
||||||
g_free (p);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy (buffer, p, len);
|
|
||||||
g_free (p);
|
|
||||||
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
#endif /* !ENABLE_VFS */
|
|
||||||
|
|
||||||
enum compression_type
|
enum compression_type
|
||||||
get_compression_type (int fd, const char *name)
|
get_compression_type (int fd, const char *name)
|
||||||
{
|
{
|
||||||
|
@ -164,7 +164,6 @@ void custom_canonicalize_pathname (char *, CANON_PATH_FLAGS);
|
|||||||
void canonicalize_pathname (char *);
|
void canonicalize_pathname (char *);
|
||||||
|
|
||||||
/* Misc Unix functions */
|
/* Misc Unix functions */
|
||||||
char *get_current_wd (char *buffer, size_t size);
|
|
||||||
int my_mkdir (const char *s, mode_t mode);
|
int my_mkdir (const char *s, mode_t mode);
|
||||||
int my_rmdir (const char *s);
|
int my_rmdir (const char *s);
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ BASICFILES = \
|
|||||||
vfs.c vfs.h vfs-impl.h \
|
vfs.c vfs.h vfs-impl.h \
|
||||||
direntry.c xdirentry.h \
|
direntry.c xdirentry.h \
|
||||||
utilvfs.c utilvfs.h \
|
utilvfs.c utilvfs.h \
|
||||||
local.c local.h \
|
gc.c gc.h \
|
||||||
gc.c gc.h
|
local.c local.h
|
||||||
|
|
||||||
CPIOFILES = cpio.c
|
CPIOFILES = cpio.c
|
||||||
TARFILES = tar.c
|
TARFILES = tar.c
|
||||||
@ -102,11 +102,7 @@ distclean-local:
|
|||||||
(cd samba && $(MAKE) distclean) \
|
(cd samba && $(MAKE) distclean) \
|
||||||
else :; fi
|
else :; fi
|
||||||
|
|
||||||
if ENABLE_VFS
|
|
||||||
noinst_LTLIBRARIES = libvfs-mc.la
|
noinst_LTLIBRARIES = libvfs-mc.la
|
||||||
else
|
|
||||||
noinst_LTLIBRARIES =
|
|
||||||
endif
|
|
||||||
|
|
||||||
SAMBA_DIST = \
|
SAMBA_DIST = \
|
||||||
Makefile.in \
|
Makefile.in \
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "lib/global.h"
|
#include "lib/global.h"
|
||||||
|
|
||||||
#include "lib/tty/tty.h" /* enable/disable interrupt key */
|
#include "lib/tty/tty.h" /* enable/disable interrupt key */
|
||||||
|
#include "lib/util.h" /* concat_dir_and_file */
|
||||||
|
|
||||||
#include "src/wtools.h" /* message() */
|
#include "src/wtools.h" /* message() */
|
||||||
#include "src/main.h" /* print_vfs_message */
|
#include "src/main.h" /* print_vfs_message */
|
||||||
@ -1229,6 +1230,22 @@ vfs_s_init_class (struct vfs_class *vclass, struct vfs_s_subclass *sub)
|
|||||||
sub->dir_uptodate = vfs_s_dir_uptodate;
|
sub->dir_uptodate = vfs_s_dir_uptodate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Find VFS id for given directory name */
|
||||||
|
vfsid
|
||||||
|
vfs_getid (struct vfs_class *vclass, const char *dir)
|
||||||
|
{
|
||||||
|
char *dir1;
|
||||||
|
vfsid id = NULL;
|
||||||
|
|
||||||
|
/* append slash if needed */
|
||||||
|
dir1 = concat_dir_and_file (dir, "");
|
||||||
|
if (vclass->getid)
|
||||||
|
id = (*vclass->getid) (vclass, dir1);
|
||||||
|
|
||||||
|
g_free (dir1);
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------- Utility functions for networked filesystems -------------- */
|
/* ----------- Utility functions for networked filesystems -------------- */
|
||||||
|
|
||||||
#ifdef ENABLE_VFS_NET
|
#ifdef ENABLE_VFS_NET
|
||||||
|
@ -121,23 +121,6 @@ vfs_rmstamp (struct vfs_class *v, vfsid id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Find VFS id for given directory name */
|
|
||||||
vfsid
|
|
||||||
vfs_getid (struct vfs_class *vclass, const char *dir)
|
|
||||||
{
|
|
||||||
char *dir1;
|
|
||||||
vfsid id = NULL;
|
|
||||||
|
|
||||||
/* append slash if needed */
|
|
||||||
dir1 = concat_dir_and_file (dir, "");
|
|
||||||
if (vclass->getid)
|
|
||||||
id = (*vclass->getid) (vclass, dir1);
|
|
||||||
|
|
||||||
g_free (dir1);
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
vfs_stamp_path (const char *path)
|
vfs_stamp_path (const char *path)
|
||||||
{
|
{
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
#ifndef MC_VFS_IMPL_H
|
#ifndef MC_VFS_IMPL_H
|
||||||
#define MC_VFS_IMPL_H
|
#define MC_VFS_IMPL_H
|
||||||
|
|
||||||
#ifdef ENABLE_VFS
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -111,6 +109,8 @@ char *vfs_path (const char *path);
|
|||||||
/* vfs/direntry.c: */
|
/* vfs/direntry.c: */
|
||||||
void *vfs_s_open (struct vfs_class *me, const char *file, int flags, mode_t mode);
|
void *vfs_s_open (struct vfs_class *me, const char *file, int flags, mode_t mode);
|
||||||
|
|
||||||
|
vfsid vfs_getid (struct vfs_class *vclass, const char *dir);
|
||||||
|
|
||||||
#ifdef ENABLE_VFS_CPIO
|
#ifdef ENABLE_VFS_CPIO
|
||||||
void init_cpiofs (void);
|
void init_cpiofs (void);
|
||||||
#endif
|
#endif
|
||||||
@ -133,6 +133,4 @@ void init_ftpfs (void);
|
|||||||
void init_fish (void);
|
void init_fish (void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ENABLE_VFS */
|
|
||||||
|
|
||||||
#endif /* MC_VFS_IMPL_H */
|
#endif /* MC_VFS_IMPL_H */
|
||||||
|
@ -24,7 +24,8 @@ typedef enum
|
|||||||
VFSF_NOLINKS = 1 << 1 /* Hard links not supported */
|
VFSF_NOLINKS = 1 << 1 /* Hard links not supported */
|
||||||
} vfs_class_flags_t;
|
} vfs_class_flags_t;
|
||||||
|
|
||||||
#ifdef ENABLE_VFS
|
void vfs_init (void);
|
||||||
|
void vfs_shut (void);
|
||||||
|
|
||||||
#if defined (ENABLE_VFS_FTP) || defined (ENABLE_VFS_FISH) || defined (ENABLE_VFS_SMB)
|
#if defined (ENABLE_VFS_FTP) || defined (ENABLE_VFS_FISH) || defined (ENABLE_VFS_SMB)
|
||||||
#define ENABLE_VFS_NET 1
|
#define ENABLE_VFS_NET 1
|
||||||
@ -44,8 +45,6 @@ extern int vfs_timeout;
|
|||||||
extern int use_netrc;
|
extern int use_netrc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void vfs_init (void);
|
|
||||||
void vfs_shut (void);
|
|
||||||
void vfs_expire (int now);
|
void vfs_expire (int now);
|
||||||
|
|
||||||
gboolean vfs_current_is_local (void);
|
gboolean vfs_current_is_local (void);
|
||||||
@ -102,107 +101,6 @@ void vfs_release_path (const char *dir);
|
|||||||
|
|
||||||
void vfs_fill_names (fill_names_f);
|
void vfs_fill_names (fill_names_f);
|
||||||
|
|
||||||
#else /* ENABLE_VFS */
|
|
||||||
|
|
||||||
/* Only the routines outside of the VFS module need the emulation macros */
|
|
||||||
|
|
||||||
#define vfs_init() do { } while (0)
|
|
||||||
#define vfs_shut() do { } while (0)
|
|
||||||
#define vfs_current_is_local() (TRUE)
|
|
||||||
#define vfs_file_is_local(x) (TRUE)
|
|
||||||
#define vfs_strip_suffix_from_filename(x) g_strdup(x)
|
|
||||||
#define vfs_get_class(x) (struct vfs_class *)(NULL)
|
|
||||||
#define vfs_translate_url(s) g_strdup(s)
|
|
||||||
#define vfs_file_class_flags(x) (VFSF_LOCAL)
|
|
||||||
#define vfs_release_path(x)
|
|
||||||
#define vfs_timeout_handler() do { } while (0)
|
|
||||||
#define vfs_timeouts() 0
|
|
||||||
|
|
||||||
#define mc_getlocalcopy(x) vfs_canon(x)
|
|
||||||
#define mc_read read
|
|
||||||
#define mc_write write
|
|
||||||
#define mc_utime utime
|
|
||||||
#define mc_readlink readlink
|
|
||||||
#define mc_ungetlocalcopy(x,y,z) do { } while (0)
|
|
||||||
#define mc_close close
|
|
||||||
#define mc_lseek lseek
|
|
||||||
#define mc_opendir opendir
|
|
||||||
#define mc_readdir readdir
|
|
||||||
#define mc_closedir closedir
|
|
||||||
#define mc_stat stat
|
|
||||||
#define mc_mknod mknod
|
|
||||||
#define mc_link link
|
|
||||||
#define mc_mkdir mkdir
|
|
||||||
#define mc_rmdir rmdir
|
|
||||||
#define mc_fstat fstat
|
|
||||||
#define mc_lstat lstat
|
|
||||||
#define mc_symlink symlink
|
|
||||||
#define mc_rename rename
|
|
||||||
#define mc_chmod chmod
|
|
||||||
#define mc_chown chown
|
|
||||||
#define mc_chdir chdir
|
|
||||||
#define mc_unlink unlink
|
|
||||||
#define mc_open open
|
|
||||||
#define mc_get_current_wd(x,size) get_current_wd (x, size)
|
|
||||||
|
|
||||||
static inline int mc_setctl (const char *path, int ctlop, void *arg)
|
|
||||||
{
|
|
||||||
(void) path;
|
|
||||||
(void) ctlop;
|
|
||||||
(void) arg;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int mc_ctl (int fd, int ctlop, void *arg)
|
|
||||||
{
|
|
||||||
(void) fd;
|
|
||||||
(void) ctlop;
|
|
||||||
(void) arg;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline const char *vfs_get_encoding (const char *path)
|
|
||||||
{
|
|
||||||
(void) path;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* return new string */
|
|
||||||
static inline char *vfs_translate_path_n (const char *path)
|
|
||||||
{
|
|
||||||
return ((path == NULL) ? g_strdup ("") : g_strdup (path));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline char* vfs_canon_and_translate(const char* path)
|
|
||||||
{
|
|
||||||
char *ret_str;
|
|
||||||
|
|
||||||
if (path == NULL)
|
|
||||||
return g_strdup("");
|
|
||||||
|
|
||||||
if (path[0] == PATH_SEP)
|
|
||||||
{
|
|
||||||
char *curr_dir = g_get_current_dir();
|
|
||||||
ret_str = g_strdup_printf("%s" PATH_SEP_STR "%s", curr_dir, path);
|
|
||||||
g_free(curr_dir);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ret_str = g_strdup(path);
|
|
||||||
|
|
||||||
canonicalize_pathname (ret_str);
|
|
||||||
return ret_str;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline char *
|
|
||||||
vfs_canon (const char *path)
|
|
||||||
{
|
|
||||||
char *p = g_strdup (path);
|
|
||||||
canonicalize_pathname(p);
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* ENABLE_VFS */
|
|
||||||
|
|
||||||
char *vfs_get_current_dir (void);
|
char *vfs_get_current_dir (void);
|
||||||
/* translate path back to terminal encoding, remove all #enc:
|
/* translate path back to terminal encoding, remove all #enc:
|
||||||
* every invalid character is replaced with question mark
|
* every invalid character is replaced with question mark
|
||||||
|
@ -45,6 +45,7 @@ struct vfs_s_super
|
|||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_VFS_FISH
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
int sockr, sockw;
|
int sockr, sockw;
|
||||||
@ -69,6 +70,8 @@ struct vfs_s_super
|
|||||||
int host_flags;
|
int host_flags;
|
||||||
char *scr_env;
|
char *scr_env;
|
||||||
} fish;
|
} fish;
|
||||||
|
#endif /* ENABLE_VFS_FISH */
|
||||||
|
#ifdef ENABLE_VFS_FTP
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
int sock;
|
int sock;
|
||||||
@ -90,6 +93,8 @@ struct vfs_s_super
|
|||||||
*/
|
*/
|
||||||
int ctl_connection_busy;
|
int ctl_connection_busy;
|
||||||
} ftp;
|
} ftp;
|
||||||
|
#endif /* ENABLE_VFS_FTP */
|
||||||
|
#if defined(ENABLE_VFS_CPIO) || defined(ENABLE_VFS_TAR)
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
@ -97,6 +102,7 @@ struct vfs_s_super
|
|||||||
int type; /* Type of the archive */
|
int type; /* Type of the archive */
|
||||||
struct defer_inode *deferred; /* List of inodes for which another entries may appear */
|
struct defer_inode *deferred; /* List of inodes for which another entries may appear */
|
||||||
} arch;
|
} arch;
|
||||||
|
#endif /* ENABLE_VFS_CPIO || ENABLE_VFS_TAR */
|
||||||
} u;
|
} u;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -137,15 +143,19 @@ struct vfs_s_fh
|
|||||||
int linear; /* Is that file open with O_LINEAR? */
|
int linear; /* Is that file open with O_LINEAR? */
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_VFS_FISH
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
off_t got, total;
|
off_t got, total;
|
||||||
int append;
|
int append;
|
||||||
} fish;
|
} fish;
|
||||||
|
#endif /* ENABLE_VFS_FISH */
|
||||||
|
#ifdef ENABLE_VFS_FTP
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
int sock, append;
|
int sock, append;
|
||||||
} ftp;
|
} ftp;
|
||||||
|
#endif /* ENABLE_VFS_FTP */
|
||||||
} u;
|
} u;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -647,8 +647,8 @@ tree_rescan (void *data)
|
|||||||
WTree *tree = data;
|
WTree *tree = data;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!tree->selected_ptr || !mc_get_current_wd (old_dir, MC_MAXPATHLEN) ||
|
if (tree->selected_ptr == NULL || mc_get_current_wd (old_dir, MC_MAXPATHLEN) == NULL
|
||||||
mc_chdir (tree->selected_ptr->name))
|
|| mc_chdir (tree->selected_ptr->name))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tree_store_rescan (tree->selected_ptr->name);
|
tree_store_rescan (tree->selected_ptr->name);
|
||||||
@ -751,7 +751,7 @@ tree_mkdir (WTree * tree)
|
|||||||
|
|
||||||
if (!tree->selected_ptr)
|
if (!tree->selected_ptr)
|
||||||
return;
|
return;
|
||||||
if (!mc_get_current_wd (old_dir, MC_MAXPATHLEN))
|
if (mc_get_current_wd (old_dir, MC_MAXPATHLEN) == NULL)
|
||||||
return;
|
return;
|
||||||
if (chdir (tree->selected_ptr->name))
|
if (chdir (tree->selected_ptr->name))
|
||||||
return;
|
return;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user