From 03b6d009760ea0f1d7ccef3989cade8fc5bd9709 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Tue, 29 Dec 2009 04:34:26 +0100 Subject: [PATCH 01/18] Ticket #1916: non-vfs build fixups * removed accidentially merged unfinished mvfs stuff * added missing AM_CONDITIONAL's for non-vfs build * fixed clashes between vfs/vfs.h and src/vfsdummy.h * added missing functions/inlines to non-vfs build --- m4.include/mc-vfs.m4 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/m4.include/mc-vfs.m4 b/m4.include/mc-vfs.m4 index d5ca7ebbe..c6448ee4b 100644 --- a/m4.include/mc-vfs.m4 +++ b/m4.include/mc-vfs.m4 @@ -72,8 +72,6 @@ AC_DEFUN([AC_MC_VFS_CHECKS],[ AC_MSG_NOTICE([Enabling VFS code]) - AC_MC_MVFS_FILESYSTEMS - AC_MC_VFS_CPIOFS AC_MC_VFS_TARFS AC_MC_VFS_FTP @@ -88,6 +86,13 @@ AC_DEFUN([AC_MC_VFS_CHECKS],[ else vfs_type="Plain OS filesystem" + AM_CONDITIONAL(ENABLE_VFS_CPIO, [false]) + AM_CONDITIONAL(ENABLE_VFS_TAR, [false]) + AM_CONDITIONAL(ENABLE_VFS_FTP, [false]) + AM_CONDITIONAL(ENABLE_VFS_FISH, [false]) + AM_CONDITIONAL(ENABLE_VFS_EXTFS, [false]) + AM_CONDITIONAL(ENABLE_VFS_SFS, [false]) + AM_CONDITIONAL(ENABLE_VFS_UNDELFS, [false]) fi AM_CONDITIONAL(ENABLE_VFS, [test x"$enable_vfs" = x"yes"]) From 80b3776c20cda2e5f08503c95d71fd6adc26a21f Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Tue, 29 Dec 2009 05:35:55 +0100 Subject: [PATCH 02/18] VFS: fixed lots of missing includes to vfs/vfs.h --- edit/edit.c | 2 ++ edit/editcmd.c | 2 ++ edit/editlock.c | 2 ++ src/command.c | 1 + src/ext.c | 2 ++ src/file.c | 1 + src/filenot.c | 2 ++ src/find.c | 3 ++- src/panelize.c | 2 ++ src/screen.c | 1 + src/setup.c | 1 + src/subshell.c | 2 ++ src/treestore.c | 1 + src/user.c | 2 ++ src/util.c | 2 ++ src/viewer/datasource.c | 2 ++ src/viewer/growbuf.c | 3 +++ src/viewer/hex.c | 3 +++ src/widget.c | 3 ++- 19 files changed, 35 insertions(+), 2 deletions(-) diff --git a/edit/edit.c b/edit/edit.c index 6e4de51f0..7a06d530e 100644 --- a/edit/edit.c +++ b/edit/edit.c @@ -61,6 +61,8 @@ #include "../src/main.h" /* source_codepage */ #include "../src/learn.h" /* learn_keys */ +#include "../vfs/vfs.h" + int option_word_wrap_line_length = 72; int option_typewriter_wrap = 0; int option_auto_para_formatting = 0; diff --git a/edit/editcmd.c b/edit/editcmd.c index e935ac061..ced4748bc 100644 --- a/edit/editcmd.c +++ b/edit/editcmd.c @@ -62,6 +62,8 @@ #include "../src/mcconfig/mcconfig.h" #include "../src/skin/skin.h" /* mc_skin_color_get */ +#include "../vfs/vfs.h" + #include "../edit/edit-impl.h" #include "../edit/edit.h" #include "../edit/editlock.h" diff --git a/edit/editlock.c b/edit/editlock.c index b1fa61dcb..91990312d 100644 --- a/edit/editlock.c +++ b/edit/editlock.c @@ -60,6 +60,8 @@ #include "../src/wtools.h" /* edit_query_dialog () */ #include "../src/strutil.h" /* utf string functions */ +#include "../vfs/vfs.h" + #define BUF_SIZE 255 #define PID_BUF_SIZE 10 diff --git a/src/command.c b/src/command.c index d95f06982..d8f6956d1 100644 --- a/src/command.c +++ b/src/command.c @@ -34,6 +34,7 @@ #include "global.h" /* home_dir */ #include "../src/tty/tty.h" +#include "../vfs/vfs.h" #include "widget.h" /* WInput */ #include "command.h" #include "wtools.h" /* message () */ diff --git a/src/ext.c b/src/ext.c index 83a0ae172..7e368e82a 100644 --- a/src/ext.c +++ b/src/ext.c @@ -45,6 +45,8 @@ #include "../src/search/search.h" #include "../src/viewer/mcviewer.h" +#include "../vfs/vfs.h" + /* If set, we execute the file command to check the file type */ int use_file_to_check_type = 1; diff --git a/src/file.c b/src/file.c index da1ad5555..fb3fd7970 100644 --- a/src/file.c +++ b/src/file.c @@ -81,6 +81,7 @@ #include "filegui.h" #include "tree.h" #include "../vfs/vfs-impl.h" +#include "../vfs/vfs.h" /* }}} */ diff --git a/src/filenot.c b/src/filenot.c index 374834d18..15a79c197 100644 --- a/src/filenot.c +++ b/src/filenot.c @@ -38,6 +38,8 @@ #include "fs.h" #include "util.h" +#include "../vfs/vfs.h" + static char * get_absolute_name (const char *file) { diff --git a/src/find.c b/src/find.c index a8df52eee..ab4ff9dfb 100644 --- a/src/find.c +++ b/src/find.c @@ -37,9 +37,10 @@ #include "../src/tty/tty.h" #include "../src/skin/skin.h" #include "../src/tty/key.h" - #include "../src/search/search.h" +#include "../vfs/vfs.h" + #include "setup.h" #include "find.h" #include "strutil.h" diff --git a/src/panelize.c b/src/panelize.c index d35751678..f596449dd 100644 --- a/src/panelize.c +++ b/src/panelize.c @@ -37,6 +37,8 @@ #include "../src/skin/skin.h" +#include "../vfs/vfs.h" + #include "dialog.h" #include "widget.h" #include "wtools.h" /* For common_dialog_repaint() */ diff --git a/src/screen.c b/src/screen.c index 6cac7b019..1bfed104b 100644 --- a/src/screen.c +++ b/src/screen.c @@ -62,6 +62,7 @@ #include "charsets.h" /* get_codepage_id () */ #include "cmddef.h" /* CK_ cmd name const */ #include "keybind.h" /* global_keymap_t */ +#include "../vfs/vfs.h" #define ELEMENTS(arr) ( sizeof(arr) / sizeof((arr)[0]) ) diff --git a/src/setup.c b/src/setup.c index a2f096c82..c9cdf7fff 100644 --- a/src/setup.c +++ b/src/setup.c @@ -33,6 +33,7 @@ #include "../src/tty/tty.h" #include "../src/tty/key.h" #include "../src/tty/mouse.h" /* To make view.h happy */ +#include "../vfs/vfs.h" #include "args.h" #include "dir.h" diff --git a/src/subshell.c b/src/subshell.c index cc0ffa820..a80f8a110 100644 --- a/src/subshell.c +++ b/src/subshell.c @@ -60,6 +60,8 @@ #include "strutil.h" #include "fileloc.h" +#include "../vfs/vfs.h" + #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) #endif diff --git a/src/treestore.c b/src/treestore.c index 7a9f338f7..39db5f213 100644 --- a/src/treestore.c +++ b/src/treestore.c @@ -50,6 +50,7 @@ #include "global.h" #include "treestore.h" #include "../src/mcconfig/mcconfig.h" +#include "../vfs/vfs.h" #include "setup.h" #include "fileloc.h" diff --git a/src/user.c b/src/user.c index f78c6b2ff..ed5fe81c1 100644 --- a/src/user.c +++ b/src/user.c @@ -42,6 +42,8 @@ #include "strutil.h" #include "../src/search/search.h" +#include "../vfs/vfs.h" + #include "../edit/edit.h" /* WEdit, BLOCK_FILE */ /* For the simple listbox manager */ diff --git a/src/util.c b/src/util.c index f78c5edba..ebbb0f472 100644 --- a/src/util.c +++ b/src/util.c @@ -57,6 +57,8 @@ #include "dir.h" #include "fileloc.h" +#include "../vfs/vfs.h" + #ifdef HAVE_CHARSET #include "charsets.h" #endif diff --git a/src/viewer/datasource.c b/src/viewer/datasource.c index 15abc9389..d2d689a3b 100644 --- a/src/viewer/datasource.c +++ b/src/viewer/datasource.c @@ -58,6 +58,8 @@ #include "../src/global.h" #include "../src/wtools.h" +#include "../../vfs/vfs.h" + #include "internal.h" /*** global variables ****************************************************************************/ diff --git a/src/viewer/growbuf.c b/src/viewer/growbuf.c index 327963bfc..3923fa54c 100644 --- a/src/viewer/growbuf.c +++ b/src/viewer/growbuf.c @@ -40,6 +40,9 @@ #include "../src/global.h" #include "../src/wtools.h" + +#include "../../vfs/vfs.h" + #include "internal.h" /* Block size for reading files in parts */ diff --git a/src/viewer/hex.c b/src/viewer/hex.c index 56f1083ea..41cdd6c2b 100644 --- a/src/viewer/hex.c +++ b/src/viewer/hex.c @@ -46,6 +46,9 @@ #include "../src/main.h" #include "../src/wtools.h" #include "../src/charsets.h" + +#include "../../vfs/vfs.h" + #include "internal.h" /*** global variables ****************************************************************************/ diff --git a/src/widget.c b/src/widget.c index db665daa2..9257fadc2 100644 --- a/src/widget.c +++ b/src/widget.c @@ -46,9 +46,10 @@ #include "../src/skin/skin.h" #include "../src/tty/mouse.h" #include "../src/tty/key.h" /* XCTRL and ALT macros */ - #include "../src/mcconfig/mcconfig.h" /* for history loading and saving */ +#include "../vfs/vfs.h" + #include "dialog.h" #include "widget.h" #include "wtools.h" From b86788822d65942c9497e86e6a69f5e23563f729 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Tue, 29 Dec 2009 04:51:01 +0100 Subject: [PATCH 03/18] VFS: fixing symbol clash on vfs_init() and vfs_shut() at non-vfs build --- src/vfsdummy.h | 3 --- vfs/vfs.h | 9 +++++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/vfsdummy.h b/src/vfsdummy.h index 27af5edc1..dc2304183 100644 --- a/src/vfsdummy.h +++ b/src/vfsdummy.h @@ -55,9 +55,6 @@ return_zero (void) #define mc_getlocalcopy(x) vfs_canon(x) #define mc_ungetlocalcopy(x,y,z) do { } while (0) -#define vfs_init() do { } while (0) -#define vfs_shut() do { } while (0) - #define vfs_current_is_local() 1 #define vfs_file_is_local(x) 1 #define vfs_strip_suffix_from_filename(x) g_strdup(x) diff --git a/vfs/vfs.h b/vfs/vfs.h index 23dd0b604..0d7677a28 100644 --- a/vfs/vfs.h +++ b/vfs/vfs.h @@ -11,9 +11,18 @@ #include #include +#ifdef USE_VFS + void vfs_init (void); void vfs_shut (void); +#else /* USE_VFS */ + +#define vfs_init() do { } while (0) +#define vfs_shut() do { } while (0) + +#endif /* USE_VFS */ + char *vfs_strip_suffix_from_filename (const char *filename); char *vfs_canon (const char *path); char *mc_get_current_wd (char *buffer, int bufsize); From 49c83d786caadefd1a53c304363d25a0f2e337a5 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Tue, 29 Dec 2009 04:53:07 +0100 Subject: [PATCH 04/18] VFS: fixing symbol clash on vfs_current_is_local() at non-vfs build --- src/vfsdummy.h | 1 - vfs/vfs.h | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vfsdummy.h b/src/vfsdummy.h index dc2304183..21ee6d61f 100644 --- a/src/vfsdummy.h +++ b/src/vfsdummy.h @@ -55,7 +55,6 @@ return_zero (void) #define mc_getlocalcopy(x) vfs_canon(x) #define mc_ungetlocalcopy(x,y,z) do { } while (0) -#define vfs_current_is_local() 1 #define vfs_file_is_local(x) 1 #define vfs_strip_suffix_from_filename(x) g_strdup(x) diff --git a/vfs/vfs.h b/vfs/vfs.h index 0d7677a28..a62fa29be 100644 --- a/vfs/vfs.h +++ b/vfs/vfs.h @@ -16,10 +16,13 @@ void vfs_init (void); void vfs_shut (void); +int vfs_current_is_local (void); + #else /* USE_VFS */ #define vfs_init() do { } while (0) #define vfs_shut() do { } while (0) +#define vfs_current_is_local() (1) #endif /* USE_VFS */ @@ -27,7 +30,6 @@ char *vfs_strip_suffix_from_filename (const char *filename); char *vfs_canon (const char *path); char *mc_get_current_wd (char *buffer, int bufsize); char *vfs_get_current_dir (void); -int vfs_current_is_local (void); int vfs_file_is_local (const char *filename); /* translate path back to terminal encoding, remove all #enc: * every invalid character is replaced with question mark From 54f302e2c99ce21c4bbe2ead3141d932aca25f52 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Tue, 29 Dec 2009 04:57:40 +0100 Subject: [PATCH 05/18] VFS: fixing symbol clash on vfs_file_is_local() at non-vfs build --- src/vfsdummy.h | 1 - vfs/vfs.h | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vfsdummy.h b/src/vfsdummy.h index 21ee6d61f..6dab666cc 100644 --- a/src/vfsdummy.h +++ b/src/vfsdummy.h @@ -55,7 +55,6 @@ return_zero (void) #define mc_getlocalcopy(x) vfs_canon(x) #define mc_ungetlocalcopy(x,y,z) do { } while (0) -#define vfs_file_is_local(x) 1 #define vfs_strip_suffix_from_filename(x) g_strdup(x) #define vfs_file_class_flags(x) (VFSF_LOCAL) diff --git a/vfs/vfs.h b/vfs/vfs.h index a62fa29be..df85e6b09 100644 --- a/vfs/vfs.h +++ b/vfs/vfs.h @@ -17,12 +17,14 @@ void vfs_init (void); void vfs_shut (void); int vfs_current_is_local (void); +int vfs_file_is_local (const char *filename); #else /* USE_VFS */ #define vfs_init() do { } while (0) #define vfs_shut() do { } while (0) #define vfs_current_is_local() (1) +#define vfs_file_is_local(x) (1) #endif /* USE_VFS */ @@ -30,7 +32,6 @@ char *vfs_strip_suffix_from_filename (const char *filename); char *vfs_canon (const char *path); char *mc_get_current_wd (char *buffer, int bufsize); char *vfs_get_current_dir (void); -int vfs_file_is_local (const char *filename); /* translate path back to terminal encoding, remove all #enc: * every invalid character is replaced with question mark * return static buffer */ From 1b11c35b2b251b3f2ea850a92692b00ccee8b381 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Tue, 29 Dec 2009 05:00:44 +0100 Subject: [PATCH 06/18] VFS: fixing symbol clash on mc_read() at non-vfs build --- src/vfsdummy.h | 1 - vfs/vfs.h | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vfsdummy.h b/src/vfsdummy.h index 6dab666cc..7763121c3 100644 --- a/src/vfsdummy.h +++ b/src/vfsdummy.h @@ -16,7 +16,6 @@ #define O_LINEAR 0 #define mc_close close -#define mc_read read #define mc_write write #define mc_lseek lseek #define mc_opendir opendir diff --git a/vfs/vfs.h b/vfs/vfs.h index df85e6b09..812a174ad 100644 --- a/vfs/vfs.h +++ b/vfs/vfs.h @@ -18,6 +18,7 @@ void vfs_shut (void); int vfs_current_is_local (void); int vfs_file_is_local (const char *filename); +ssize_t mc_read (int handle, void *buffer, int count); #else /* USE_VFS */ @@ -25,6 +26,7 @@ int vfs_file_is_local (const char *filename); #define vfs_shut() do { } while (0) #define vfs_current_is_local() (1) #define vfs_file_is_local(x) (1) +#define mc_read read #endif /* USE_VFS */ @@ -50,7 +52,6 @@ char *vfs_translate_url (const char *url); int mc_open (const char *filename, int flags, ...); int mc_close (int handle); -ssize_t mc_read (int handle, void *buffer, int count); ssize_t mc_write (int handle, const void *buffer, int count); off_t mc_lseek (int fd, off_t offset, int whence); int mc_chdir (const char *path); From 8cade48b1310acffcddedf5e3452731431b02bc1 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Tue, 29 Dec 2009 05:02:50 +0100 Subject: [PATCH 07/18] VFS: fixing symbol clash on mc_write() at non-vfs build --- src/vfsdummy.h | 1 - vfs/vfs.h | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vfsdummy.h b/src/vfsdummy.h index 7763121c3..70261c293 100644 --- a/src/vfsdummy.h +++ b/src/vfsdummy.h @@ -16,7 +16,6 @@ #define O_LINEAR 0 #define mc_close close -#define mc_write write #define mc_lseek lseek #define mc_opendir opendir #define mc_readdir readdir diff --git a/vfs/vfs.h b/vfs/vfs.h index 812a174ad..bec9e7c9c 100644 --- a/vfs/vfs.h +++ b/vfs/vfs.h @@ -19,6 +19,7 @@ void vfs_shut (void); int vfs_current_is_local (void); int vfs_file_is_local (const char *filename); ssize_t mc_read (int handle, void *buffer, int count); +ssize_t mc_write (int handle, const void *buffer, int count); #else /* USE_VFS */ @@ -27,6 +28,7 @@ ssize_t mc_read (int handle, void *buffer, int count); #define vfs_current_is_local() (1) #define vfs_file_is_local(x) (1) #define mc_read read +#define mc_write write #endif /* USE_VFS */ @@ -52,7 +54,6 @@ char *vfs_translate_url (const char *url); int mc_open (const char *filename, int flags, ...); int mc_close (int handle); -ssize_t mc_write (int handle, const void *buffer, int count); off_t mc_lseek (int fd, off_t offset, int whence); int mc_chdir (const char *path); From 1ee19ccdc2c2e9d25d705010ce0eab4c06f6a856 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Tue, 29 Dec 2009 05:06:49 +0100 Subject: [PATCH 08/18] VFS: fixing symbol clash on mc_utime() at non-vfs build --- src/vfsdummy.h | 1 - vfs/vfs.h | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vfsdummy.h b/src/vfsdummy.h index 70261c293..9ca4fd173 100644 --- a/src/vfsdummy.h +++ b/src/vfsdummy.h @@ -34,7 +34,6 @@ #define mc_rename rename #define mc_open open -#define mc_utime utime #define mc_chmod chmod #define mc_chown chown #define mc_chdir chdir diff --git a/vfs/vfs.h b/vfs/vfs.h index bec9e7c9c..daff1aac9 100644 --- a/vfs/vfs.h +++ b/vfs/vfs.h @@ -20,6 +20,7 @@ int vfs_current_is_local (void); int vfs_file_is_local (const char *filename); ssize_t mc_read (int handle, void *buffer, int count); ssize_t mc_write (int handle, const void *buffer, int count); +int mc_utime (const char *path, struct utimbuf *times); #else /* USE_VFS */ @@ -29,6 +30,7 @@ ssize_t mc_write (int handle, const void *buffer, int count); #define vfs_file_is_local(x) (1) #define mc_read read #define mc_write write +#define mc_utime utime #endif /* USE_VFS */ @@ -67,7 +69,6 @@ int mc_fstat (int fd, struct stat *buf); int mc_chmod (const char *path, mode_t mode); int mc_chown (const char *path, uid_t owner, gid_t group); -int mc_utime (const char *path, struct utimbuf *times); int mc_readlink (const char *path, char *buf, int bufsiz); int mc_unlink (const char *path); int mc_symlink (const char *name1, const char *name2); From 9571b0ac157c2f7d4ddb256ea7eddbc6d83438fc Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Tue, 29 Dec 2009 05:10:25 +0100 Subject: [PATCH 09/18] VFS: fixing symbol clash on mc_readlink() at non-vfs build --- src/vfsdummy.h | 1 - vfs/vfs.h | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vfsdummy.h b/src/vfsdummy.h index 9ca4fd173..aae83e905 100644 --- a/src/vfsdummy.h +++ b/src/vfsdummy.h @@ -29,7 +29,6 @@ #define mc_fstat fstat #define mc_lstat lstat -#define mc_readlink readlink #define mc_symlink symlink #define mc_rename rename diff --git a/vfs/vfs.h b/vfs/vfs.h index daff1aac9..5245de2c0 100644 --- a/vfs/vfs.h +++ b/vfs/vfs.h @@ -21,6 +21,7 @@ int vfs_file_is_local (const char *filename); ssize_t mc_read (int handle, void *buffer, int count); ssize_t mc_write (int handle, const void *buffer, int count); int mc_utime (const char *path, struct utimbuf *times); +int mc_readlink (const char *path, char *buf, int bufsiz); #else /* USE_VFS */ @@ -31,6 +32,7 @@ int mc_utime (const char *path, struct utimbuf *times); #define mc_read read #define mc_write write #define mc_utime utime +#define mc_readlink readlink #endif /* USE_VFS */ @@ -69,7 +71,6 @@ int mc_fstat (int fd, struct stat *buf); int mc_chmod (const char *path, mode_t mode); int mc_chown (const char *path, uid_t owner, gid_t group); -int mc_readlink (const char *path, char *buf, int bufsiz); int mc_unlink (const char *path); int mc_symlink (const char *name1, const char *name2); int mc_link (const char *name1, const char *name2); From e2e490a054c2eb813bfbda5839f6263036d62c96 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Tue, 29 Dec 2009 05:35:34 +0100 Subject: [PATCH 10/18] VFS: fixing symbol clash on mc_ungetlocalcopy() at non-vfs build --- src/vfsdummy.h | 1 - vfs/vfs.h | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vfsdummy.h b/src/vfsdummy.h index aae83e905..498dc434c 100644 --- a/src/vfsdummy.h +++ b/src/vfsdummy.h @@ -49,7 +49,6 @@ return_zero (void) #define mc_get_current_wd(x,size) get_current_wd (x, size) #define mc_getlocalcopy(x) vfs_canon(x) -#define mc_ungetlocalcopy(x,y,z) do { } while (0) #define vfs_strip_suffix_from_filename(x) g_strdup(x) diff --git a/vfs/vfs.h b/vfs/vfs.h index 5245de2c0..a49a8477f 100644 --- a/vfs/vfs.h +++ b/vfs/vfs.h @@ -22,6 +22,7 @@ ssize_t mc_read (int handle, void *buffer, int count); ssize_t mc_write (int handle, const void *buffer, int count); int mc_utime (const char *path, struct utimbuf *times); int mc_readlink (const char *path, char *buf, int bufsiz); +int mc_ungetlocalcopy (const char *pathname, const char *local, int has_changed); #else /* USE_VFS */ @@ -33,6 +34,7 @@ int mc_readlink (const char *path, char *buf, int bufsiz); #define mc_write write #define mc_utime utime #define mc_readlink readlink +#define mc_ungetlocalcopy(x,y,z) do { } while (0) #endif /* USE_VFS */ @@ -80,7 +82,6 @@ int mc_rmdir (const char *path); int mc_mkdir (const char *path, mode_t mode); char *mc_getlocalcopy (const char *pathname); -int mc_ungetlocalcopy (const char *pathname, const char *local, int has_changed); int mc_ctl (int fd, int ctlop, void *arg); int mc_setctl (const char *path, int ctlop, void *arg); From 2153b3c5cda23bcdd6b76e43103a8984c41cba0d Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Tue, 29 Dec 2009 06:00:18 +0100 Subject: [PATCH 11/18] VFS: added non-vfs version of vfs_get_encoding() --- vfs/vfs.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/vfs/vfs.h b/vfs/vfs.h index a49a8477f..a33679608 100644 --- a/vfs/vfs.h +++ b/vfs/vfs.h @@ -24,6 +24,10 @@ int mc_utime (const char *path, struct utimbuf *times); int mc_readlink (const char *path, char *buf, int bufsiz); int mc_ungetlocalcopy (const char *pathname, const char *local, int has_changed); +/* return encoding after last #enc: or NULL, if part does not contain #enc: + * return static buffer */ +const char *vfs_get_encoding (const char *path); + #else /* USE_VFS */ #define vfs_init() do { } while (0) @@ -36,6 +40,12 @@ int mc_ungetlocalcopy (const char *pathname, const char *local, int has_changed) #define mc_readlink readlink #define mc_ungetlocalcopy(x,y,z) do { } while (0) +static inline const char *vfs_get_encoding (const char *path) +{ + (void) path; + return NULL; +} + #endif /* USE_VFS */ char *vfs_strip_suffix_from_filename (const char *filename); @@ -48,9 +58,6 @@ char *vfs_get_current_dir (void); char *vfs_translate_path (const char *path); /* return new string */ char *vfs_translate_path_n (const char *path); -/* return encoding after last #enc: or NULL, if part does not contain #enc: - * return static buffer */ -const char *vfs_get_encoding (const char *path); /* canonize and translate path, return new string */ char *vfs_canon_and_translate (const char *path); From b3a0216000a524bff05f35c904696ee453a7df81 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Tue, 29 Dec 2009 06:02:43 +0100 Subject: [PATCH 12/18] VFS: added non-vfs version of vfs_translate_path_n() --- vfs/vfs.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/vfs/vfs.h b/vfs/vfs.h index a33679608..ca2a95354 100644 --- a/vfs/vfs.h +++ b/vfs/vfs.h @@ -28,6 +28,9 @@ int mc_ungetlocalcopy (const char *pathname, const char *local, int has_changed) * return static buffer */ const char *vfs_get_encoding (const char *path); +/* return new string */ +char *vfs_translate_path_n (const char *path); + #else /* USE_VFS */ #define vfs_init() do { } while (0) @@ -46,6 +49,12 @@ static inline const char *vfs_get_encoding (const char *path) return NULL; } +/* return new string */ +static inline char *vfs_translate_path_n (const char *path) +{ + return ((path == NULL) ? g_strdup ("") : g_strdup (path)); +} + #endif /* USE_VFS */ char *vfs_strip_suffix_from_filename (const char *filename); @@ -56,8 +65,6 @@ char *vfs_get_current_dir (void); * every invalid character is replaced with question mark * return static buffer */ char *vfs_translate_path (const char *path); -/* return new string */ -char *vfs_translate_path_n (const char *path); /* canonize and translate path, return new string */ char *vfs_canon_and_translate (const char *path); From 43fa57ed65cbfd2f8488fbdf17bd0a9eb853177e Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Tue, 29 Dec 2009 06:08:29 +0100 Subject: [PATCH 13/18] VFS: added non-vfs version of vfs_canon_and_translate() --- vfs/vfs.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/vfs/vfs.h b/vfs/vfs.h index ca2a95354..7e0067afe 100644 --- a/vfs/vfs.h +++ b/vfs/vfs.h @@ -10,6 +10,7 @@ #include #include #include +#include #ifdef USE_VFS @@ -55,6 +56,28 @@ 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 buf[MC_MAXPATHLEN]; + + if (path == NULL) + return strdup(""); + + if (path[0] == PATH_SEP) + { + char cwd[MC_MAXPATHLEN]; + if (getcwd (cwd, sizeof (cwd))) + snprintf (buf, sizeof (buf), "%s" PATH_SEP_STR "%s", cwd, path); + else + return strdup ("[MC_MAXPATHLEN TOO SMALL]"); + } + else + snprintf (buf, sizeof (buf), "%s", path); + + canonicalize_pathname (buf); + return strdup (buf); +} + #endif /* USE_VFS */ char *vfs_strip_suffix_from_filename (const char *filename); From bc0a91e931b18ddab3c493ce9b9e59e63b2933ac Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Tue, 29 Dec 2009 06:39:39 +0100 Subject: [PATCH 14/18] VFS: removed duplicate O_LINEAR declaration in src/vfsdummy.h --- src/vfsdummy.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/vfsdummy.h b/src/vfsdummy.h index 498dc434c..3d6c4948a 100644 --- a/src/vfsdummy.h +++ b/src/vfsdummy.h @@ -13,8 +13,6 @@ #define VFSF_LOCAL 1 /* Class is local (not virtual) filesystem */ #define VFSF_NOLINKS 2 /* Hard links not supported */ -#define O_LINEAR 0 - #define mc_close close #define mc_lseek lseek #define mc_opendir opendir From c40d1c09bd99d3001d5ea605089deb27e0abe6c9 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Tue, 29 Dec 2009 06:47:53 +0100 Subject: [PATCH 15/18] src/file.c: Fixed warning on unused parameter on non-vfs build --- src/file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/file.c b/src/file.c index fb3fd7970..8b7cd1132 100644 --- a/src/file.c +++ b/src/file.c @@ -196,6 +196,8 @@ is_in_linklist (struct link *lp, const char *path, struct stat *sb) struct vfs_class *vfs = vfs_get_class (path); #endif /* USE_VFS */ + (void) path; + while (lp) { #ifdef USE_VFS if (lp->vfs == vfs) From 02a6a6994b59e00e5184b6184218c633c4885833 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Tue, 29 Dec 2009 11:39:17 +0100 Subject: [PATCH 16/18] VFS: fixed help description for --disable-vfs --- m4.include/mc-vfs.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m4.include/mc-vfs.m4 b/m4.include/mc-vfs.m4 index c6448ee4b..3fcb73ad8 100644 --- a/m4.include/mc-vfs.m4 +++ b/m4.include/mc-vfs.m4 @@ -64,7 +64,7 @@ AC_DEFUN([MC_WITH_VFS], AC_DEFUN([AC_MC_VFS_CHECKS],[ AC_ARG_ENABLE([vfs], - [ --disable-vfs Compile with VFS code]) + [ --disable-vfs Disable VFS]) if test x"$enable_vfs" != x"no" ; then enable_vfs="yes" vfs_type="Midnight Commander Virtual Filesystem" From ec1a52fb0a9d1048be0ea226d4ab334b67811a9f Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Tue, 29 Dec 2009 12:39:13 +0100 Subject: [PATCH 17/18] VFS: renamed USE_VFS to ENABLE_VFS --- configure.ac | 5 ++--- doc/README.QNX | 2 +- edit/editcmd.c | 6 +++--- m4.include/mc-vfs.m4 | 5 ++--- src/Makefile.am | 2 +- src/boxes.c | 6 +++--- src/cmd.c | 4 ++-- src/execute.c | 12 ++++++------ src/file.c | 8 ++++---- src/global.h | 2 +- src/hotlist.c | 16 ++++++++-------- src/keybind.c | 4 ++-- src/main.c | 10 +++++----- src/screen.c | 2 +- src/setup.c | 18 +++++++++--------- src/textconf.c | 8 ++++---- src/tty/key.c | 4 ++-- src/util.c | 4 ++-- vfs/Makefile.am | 4 ++-- vfs/extfs/Makefile.am | 2 +- vfs/vfs-impl.h | 4 ++-- vfs/vfs.h | 6 +++--- 22 files changed, 66 insertions(+), 68 deletions(-) diff --git a/configure.ac b/configure.ac index a025bb334..a5a996337 100644 --- a/configure.ac +++ b/configure.ac @@ -301,7 +301,7 @@ have to use that instead of gettimeofday])]) AC_MC_VFS_CHECKS vfs_type="normal" -if test x$use_vfs = xyes; then +if test x$enable_vfs = xyes; then AC_MSG_NOTICE([enabling VFS code]) vfs_type="Midnight Commander Virtual File System" fi @@ -555,8 +555,7 @@ fi AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes]) AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang]) AM_CONDITIONAL(USE_EDIT, [test -n "$use_edit"]) -AM_CONDITIONAL(USE_VFS, [test "x$use_vfs" = xyes]) -AM_CONDITIONAL(USE_VFS_NET, [test x"$use_net_code" = xtrue]) +AM_CONDITIONAL(ENABLE_VFS_NET, [test x"$use_net_code" = xtrue]) AM_CONDITIONAL(USE_SAMBA_FS, [test -n "$use_smbfs"]) AM_CONDITIONAL(ENABLE_MCSERVER, [test x"$enable_mcserver" = "xyes"]) AM_CONDITIONAL(CHARSET, [test -n "$have_charset"]) diff --git a/doc/README.QNX b/doc/README.QNX index 6f39c73cd..b681ebca4 100644 --- a/doc/README.QNX +++ b/doc/README.QNX @@ -213,7 +213,7 @@ src/ file.c: - 'do_reget' can be extern if (USE_VFS && USE_NETCODE), not if (USE_VFS). + 'do_reget' can be extern if (ENABLE_VFS && USE_NETCODE), not if (ENABLE_VFS). find.c: diff --git a/edit/editcmd.c b/edit/editcmd.c index ced4748bc..b8c2cc619 100644 --- a/edit/editcmd.c +++ b/edit/editcmd.c @@ -474,11 +474,11 @@ edit_set_filename (WEdit *edit, const char *f) f = ""; edit->filename = g_strdup (f); if (edit->dir == NULL && *f != PATH_SEP) -#ifdef USE_VFS +#ifdef ENABLE_VFS edit->dir = g_strdup (vfs_get_current_dir ()); -#else +#else /* ENABLE_VFS */ edit->dir = g_get_current_dir (); -#endif +#endif /* ENABLE_VFS */ } static gboolean diff --git a/m4.include/mc-vfs.m4 b/m4.include/mc-vfs.m4 index 3fcb73ad8..5db42cddf 100644 --- a/m4.include/mc-vfs.m4 +++ b/m4.include/mc-vfs.m4 @@ -25,7 +25,7 @@ dnl Check for various functions needed by libvfs. dnl This has various effects: dnl Sets MC_VFS_LIBS to libraries required dnl Sets vfs_flags to "pretty" list of vfs implementations we include. -dnl Sets shell variable use_vfs to yes (default, --with-vfs) or +dnl Sets shell variable enable_vfs to yes (default, --with-vfs) or dnl "no" (--without-vfs). dnl Private define @@ -56,7 +56,7 @@ AC_DEFUN([MC_WITH_VFS], fi - AC_DEFINE(USE_VFS, 1, [Define to enable VFS support]) + AC_DEFINE(ENABLE_VFS, 1, [Define to enable VFS support]) if $use_net_code; then AC_DEFINE(USE_NETCODE, 1, [Define to use networked VFS]) fi @@ -68,7 +68,6 @@ AC_DEFUN([AC_MC_VFS_CHECKS],[ if test x"$enable_vfs" != x"no" ; then enable_vfs="yes" vfs_type="Midnight Commander Virtual Filesystem" - use_vfs=yes AC_MSG_NOTICE([Enabling VFS code]) diff --git a/src/Makefile.am b/src/Makefile.am index 28cdbd267..4cc9bcdc4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,7 +32,7 @@ if USE_EDIT EDITLIB = ../edit/libedit.a endif -if USE_VFS +if ENABLE_VFS if USE_SAMBA_FS VFSLIB = ../vfs/libvfs-mc.a ../vfs/samba/libsamba.a else diff --git a/src/boxes.c b/src/boxes.c index 0b95d3361..27202fd55 100644 --- a/src/boxes.c +++ b/src/boxes.c @@ -65,7 +65,7 @@ # include "../vfs/ftpfs.h" #endif -#ifdef USE_VFS +#ifdef ENABLE_VFS #include "../vfs/gc.h" #endif @@ -689,7 +689,7 @@ tree_box (const char *current_dir) return val; } -#ifdef USE_VFS +#ifdef ENABLE_VFS static char *ret_timeout; @@ -768,7 +768,7 @@ configure_vfs (void) #undef VFSY } -#endif /* USE_VFS */ +#endif /* ENABLE_VFS */ char * cd_dialog (void) diff --git a/src/cmd.c b/src/cmd.c index 220f781b8..ac14b143e 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -723,7 +723,7 @@ void quick_chdir_cmd (void) g_free (target); } -#ifdef USE_VFS +#ifdef ENABLE_VFS void reselect_vfs (void) { char *target; @@ -736,7 +736,7 @@ void reselect_vfs (void) message (D_ERROR, MSG_ERROR, _("Cannot change directory") ); g_free (target); } -#endif /* USE_VFS */ +#endif /* ENABLE_VFS */ static int compare_files (char *name1, char *name2, off_t size) { diff --git a/src/execute.c b/src/execute.c index b59109b01..52c3bfeb0 100644 --- a/src/execute.c +++ b/src/execute.c @@ -118,12 +118,12 @@ do_execute (const char *lc_shell, const char *command, int flags) char *new_dir = NULL; #endif /* HAVE_SUBSHELL_SUPPORT */ -#ifdef USE_VFS +#ifdef ENABLE_VFS char *old_vfs_dir = 0; if (!vfs_current_is_local ()) old_vfs_dir = g_strdup (vfs_get_current_dir ()); -#endif /* USE_VFS */ +#endif /* ENABLE_VFS */ save_cwds_stat (); pre_exec (); @@ -139,11 +139,11 @@ do_execute (const char *lc_shell, const char *command, int flags) do_update_prompt (); /* We don't care if it died, higher level takes care of this */ -#ifdef USE_VFS +#ifdef ENABLE_VFS invoke_subshell (command, VISIBLY, old_vfs_dir ? NULL : &new_dir); #else invoke_subshell (command, VISIBLY, &new_dir); -#endif /* !USE_VFS */ +#endif /* !ENABLE_VFS */ } else #endif /* HAVE_SUBSHELL_SUPPORT */ my_system (flags, lc_shell, command); @@ -181,12 +181,12 @@ do_execute (const char *lc_shell, const char *command, int flags) #endif /* HAVE_SUBSHELL_SUPPORT */ -#ifdef USE_VFS +#ifdef ENABLE_VFS if (old_vfs_dir) { mc_chdir (old_vfs_dir); g_free (old_vfs_dir); } -#endif /* USE_VFS */ +#endif /* ENABLE_VFS */ update_panels (UP_OPTIMIZE, UP_KEEPSEL); update_xterm_title_path (); diff --git a/src/file.c b/src/file.c index 8b7cd1132..c166320e3 100644 --- a/src/file.c +++ b/src/file.c @@ -192,16 +192,16 @@ is_in_linklist (struct link *lp, const char *path, struct stat *sb) { ino_t ino = sb->st_ino; dev_t dev = sb->st_dev; -#ifdef USE_VFS +#ifdef ENABLE_VFS struct vfs_class *vfs = vfs_get_class (path); -#endif /* USE_VFS */ +#endif /* ENABLE_VFS */ (void) path; while (lp) { -#ifdef USE_VFS +#ifdef ENABLE_VFS if (lp->vfs == vfs) -#endif /* USE_VFS */ +#endif /* ENABLE_VFS */ if (lp->ino == ino && lp->dev == dev) return 1; lp = lp->next; diff --git a/src/global.h b/src/global.h index be6fc06ab..b86851fd9 100644 --- a/src/global.h +++ b/src/global.h @@ -92,7 +92,7 @@ #include "textconf.h" -#ifdef USE_VFS +#ifdef ENABLE_VFS #include "../vfs/vfs.h" #else #include "vfsdummy.h" diff --git a/src/hotlist.c b/src/hotlist.c index 5dc5fd244..03eafbee5 100644 --- a/src/hotlist.c +++ b/src/hotlist.c @@ -78,7 +78,7 @@ #define B_APPEND (B_USER + 6) #define B_MOVE (B_USER + 7) -#ifdef USE_VFS +#ifdef ENABLE_VFS #include "../vfs/gc.h" #define B_FREE_ALL_VFS (B_USER + 8) #define B_REFRESH_VFS (B_USER + 9) @@ -145,7 +145,7 @@ static struct _hotlist_but { LIST_HOTLIST | LIST_MOVELIST, WPOS_KEEP_LEFT | WPOS_KEEP_BOTTOM }, { B_ADD_CURRENT, NORMAL_BUTTON, 0, 20, N_("&Add current"), LIST_HOTLIST, WPOS_KEEP_LEFT | WPOS_KEEP_BOTTOM }, -#ifdef USE_VFS +#ifdef ENABLE_VFS { B_REFRESH_VFS, NORMAL_BUTTON, 0, 43, N_("&Refresh"), LIST_VFSLIST, WPOS_KEEP_LEFT | WPOS_KEEP_BOTTOM }, { B_FREE_ALL_VFS, NORMAL_BUTTON, 0, 20, N_("Fr&ee VFSs now"), @@ -287,12 +287,12 @@ unlink_entry (struct hotlist *entry) entry->up = 0; } -#ifdef USE_VFS +#ifdef ENABLE_VFS static void add_name_to_list (const char *path) { listbox_add_item (l_hotlist, 0, 0, path, 0); } -#endif /* !USE_VFS */ +#endif /* !ENABLE_VFS */ static int hotlist_button_callback (int action) @@ -416,7 +416,7 @@ hotlist_button_callback (int action) break; } -#ifdef USE_VFS +#ifdef ENABLE_VFS case B_FREE_ALL_VFS: vfs_expire (1); /* fall through */ @@ -426,7 +426,7 @@ hotlist_button_callback (int action) listbox_add_item (l_hotlist, 0, 0, home_dir, 0); vfs_fill_names (add_name_to_list); return MSG_NOT_HANDLED; -#endif /* USE_VFS */ +#endif /* ENABLE_VFS */ default: return MSG_HANDLED; @@ -686,12 +686,12 @@ init_hotlist (int list_type) l_call); /* Fill the hotlist with the active VFS or the hotlist */ -#ifdef USE_VFS +#ifdef ENABLE_VFS if (list_type == LIST_VFSLIST) { listbox_add_item (l_hotlist, 0, 0, home_dir, 0); vfs_fill_names (add_name_to_list); } else -#endif /* !USE_VFS */ +#endif /* !ENABLE_VFS */ fill_listbox (); add_widget_autopos (hotlist_dlg, l_hotlist, WPOS_KEEP_ALL); diff --git a/src/keybind.c b/src/keybind.c index 66657ab16..5744e167f 100644 --- a/src/keybind.c +++ b/src/keybind.c @@ -838,9 +838,9 @@ const global_keymap_t default_main_map[] = { const global_keymap_t default_main_x_map[] = { { 'd', CK_CompareDirsCmd, "d" }, -#ifdef USE_VFS +#ifdef ENABLE_VFS { 'a', CK_ReselectVfs, "a"}, -#endif /* USE_VFS */ +#endif /* ENABLE_VFS */ { 'p', CK_CopyCurrentPathname, "p" }, { XCTRL ('p'), CK_CopyOtherPathname, "C-p" }, { 't', CK_CopyCurrentTagged, "t" }, diff --git a/src/main.c b/src/main.c index deb52b310..dd9dc2532 100644 --- a/src/main.c +++ b/src/main.c @@ -99,7 +99,7 @@ #include "charsets.h" #endif /* HAVE_CHARSET */ -#ifdef USE_VFS +#ifdef ENABLE_VFS #include "../vfs/gc.h" #endif @@ -752,7 +752,7 @@ create_command_menu (void) entries = g_list_append (entries, menu_separator_create ()); entries = g_list_append (entries, menu_entry_create (_("Command &history"), CK_HistoryCmd)); entries = g_list_append (entries, menu_entry_create (_("Di&rectory hotlist"), CK_QuickChdirCmd)); -#ifdef USE_VFS +#ifdef ENABLE_VFS entries = g_list_append (entries, menu_entry_create (_("&Active VFS list"), CK_ReselectVfs)); #endif #ifdef WITH_BACKGROUND @@ -785,7 +785,7 @@ create_options_menu (void) entries = g_list_append (entries, menu_entry_create (_("C&onfirmation..."), CK_ConfirmBox)); entries = g_list_append (entries, menu_entry_create (_("&Display bits..."), CK_DisplayBitsBox)); entries = g_list_append (entries, menu_entry_create (_("Learn &keys..."), CK_LearnKeys)); -#ifdef USE_VFS +#ifdef ENABLE_VFS entries = g_list_append (entries, menu_entry_create (_("&Virtual FS..."), CK_ConfigureVfs)); #endif entries = g_list_append (entries, menu_separator_create ()); @@ -1154,7 +1154,7 @@ midnight_execute_cmd (Widget *sender, unsigned long command) case CK_ConfigureBox: configure_box (); break; -#ifdef USE_VFS +#ifdef ENABLE_VFS case CK_ConfigureVfs: configure_vfs (); break; @@ -1301,7 +1301,7 @@ midnight_execute_cmd (Widget *sender, unsigned long command) case CK_RereadCmd: reread_cmd (); break; -#ifdef USE_VFS +#ifdef ENABLE_VFS case CK_ReselectVfs: reselect_vfs (); break; diff --git a/src/screen.c b/src/screen.c index 1bfed104b..b644240a1 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2335,7 +2335,7 @@ do_enter_on_file_entry (file_entry *fe) _("&No")) != 0) return 1; } -#ifdef USE_VFS +#ifdef ENABLE_VFS if (!vfs_current_is_local ()) { char *tmp; int ret; diff --git a/src/setup.c b/src/setup.c index c9cdf7fff..01fea8931 100644 --- a/src/setup.c +++ b/src/setup.c @@ -53,7 +53,7 @@ #include "fileloc.h" #include "wtools.h" -#ifdef USE_VFS +#ifdef ENABLE_VFS #include "../vfs/gc.h" #endif @@ -188,7 +188,7 @@ static const struct { { "xtree_mode", &xtree_mode }, { "num_history_items_recorded", &num_history_items_recorded }, { "file_op_compute_totals", &file_op_compute_totals }, -#ifdef USE_VFS +#ifdef ENABLE_VFS { "vfs_timeout", &vfs_timeout }, #ifdef USE_NETCODE { "ftpfs_directory_timeout", &ftpfs_directory_timeout }, @@ -201,7 +201,7 @@ static const struct { { "ftpfs_first_cd_then_ls", &ftpfs_first_cd_then_ls }, { "fish_directory_timeout", &fish_directory_timeout }, #endif /* USE_NETCODE */ -#endif /* USE_VFS */ +#endif /* ENABLE_VFS */ #ifdef USE_INTERNAL_EDIT { "editor_word_wrap_line_length", &option_word_wrap_line_length }, { "editor_tab_spacing", &option_tab_spacing }, @@ -379,13 +379,13 @@ save_setup (void) save_panel_types (); /* directory_history_save (); */ -#if defined(USE_VFS) && defined (USE_NETCODE) +#if defined(ENABLE_VFS) && defined (USE_NETCODE) mc_config_set_string(mc_main_config, "Misc" , "ftpfs_password", ftpfs_anonymous_passwd); if (ftpfs_proxy_host) mc_config_set_string(mc_main_config, "Misc" , "ftp_proxy_host", ftpfs_proxy_host); -#endif /* USE_VFS && USE_NETCODE */ +#endif /* ENABLE_VFS && USE_NETCODE */ #ifdef HAVE_CHARSET mc_config_set_string(mc_main_config, "Misc" , "display_codepage", @@ -800,9 +800,9 @@ load_setup (void) /* Load the directory history */ /* directory_history_load (); */ /* Remove the temporal entries */ -#if defined(USE_VFS) && defined (USE_NETCODE) +#if defined(ENABLE_VFS) && defined (USE_NETCODE) ftpfs_init_passwd (); -#endif /* USE_VFS && USE_NETCODE */ +#endif /* ENABLE_VFS && USE_NETCODE */ #ifdef HAVE_CHARSET if ( load_codepages_list() > 0 ) { @@ -827,7 +827,7 @@ load_setup (void) #endif /* HAVE_CHARSET */ } -#if defined(USE_VFS) && defined (USE_NETCODE) +#if defined(ENABLE_VFS) && defined (USE_NETCODE) char * load_anon_passwd () { @@ -840,7 +840,7 @@ load_anon_passwd () g_free(buffer); return NULL; } -#endif /* USE_VFS && USE_NETCODE */ +#endif /* ENABLE_VFS && USE_NETCODE */ void done_setup (void) diff --git a/src/textconf.c b/src/textconf.c index 9bfc84c16..8696919a1 100644 --- a/src/textconf.c +++ b/src/textconf.c @@ -33,7 +33,7 @@ #include "ecs.h" #include "../src/textconf.h" -#ifdef USE_VFS +#ifdef ENABLE_VFS static const char *const vfs_supported[] = { "tarfs", "extfs", @@ -53,7 +53,7 @@ static const char *const vfs_supported[] = { #endif NULL }; -#endif /* USE_VFS */ +#endif /* ENABLE_VFS */ static const char *const features[] = { @@ -120,7 +120,7 @@ show_version (void) printf (_("GNU Midnight Commander %s\n"), VERSION); -#ifdef USE_VFS +#ifdef ENABLE_VFS printf (_("Virtual File System:")); for (i = 0; vfs_supported[i]; i++) { if (i == 0) @@ -131,7 +131,7 @@ show_version (void) printf ("%s", _(vfs_supported[i])); } printf ("\n"); -#endif /* USE_VFS */ +#endif /* ENABLE_VFS */ for (i = 0; features[i]; i++) printf ("%s", _(features[i])); diff --git a/src/tty/key.c b/src/tty/key.c index ab5bf234a..56b8719b9 100644 --- a/src/tty/key.c +++ b/src/tty/key.c @@ -50,9 +50,9 @@ #include "../../src/cons.saver.h" #include "../../src/strutil.h" /* str_casecmp */ -#ifdef USE_VFS +#ifdef ENABLE_VFS #include "../../vfs/gc.h" -#endif +#endif /* ENABLE_VFS */ #ifdef HAVE_TEXTMODE_X11_SUPPORT #include "../src/tty/x11conn.h" diff --git a/src/util.c b/src/util.c index ebbb0f472..08c577715 100644 --- a/src/util.c +++ b/src/util.c @@ -837,7 +837,7 @@ strip_ctrl_codes (char *s) } -#ifndef USE_VFS +#ifndef ENABLE_VFS char * get_current_wd (char *buffer, int size) { @@ -857,7 +857,7 @@ get_current_wd (char *buffer, int size) return buffer; } -#endif /* !USE_VFS */ +#endif /* !ENABLE_VFS */ enum compression_type get_compression_type (int fd, const char * name) diff --git a/vfs/Makefile.am b/vfs/Makefile.am index ffaf56223..dea50c57b 100644 --- a/vfs/Makefile.am +++ b/vfs/Makefile.am @@ -75,13 +75,13 @@ distclean-local: (cd samba && $(MAKE) distclean) \ else :; fi -if USE_VFS +if ENABLE_VFS noinst_LIBRARIES = libvfs-mc.a else noinst_LIBRARIES = endif -if USE_VFS_NET +if ENABLE_VFS_NET libvfs_mc_a_SOURCES = $(NETFILES) $(NONETFILES) else libvfs_mc_a_SOURCES = $(NONETFILES) diff --git a/vfs/extfs/Makefile.am b/vfs/extfs/Makefile.am index a33f624ad..d955a2c07 100644 --- a/vfs/extfs/Makefile.am +++ b/vfs/extfs/Makefile.am @@ -64,7 +64,7 @@ EXTFS_OUT = \ uzip \ uzoo -if USE_VFS +if ENABLE_VFS extfs_DATA = $(EXTFS_MISC) extfs_SCRIPTS = $(EXTFS_CONST) $(EXTFS_OUT) diff --git a/vfs/vfs-impl.h b/vfs/vfs-impl.h index 00c752f78..e38b29349 100644 --- a/vfs/vfs-impl.h +++ b/vfs/vfs-impl.h @@ -7,7 +7,7 @@ #ifndef MC_VFS_IMPL_H #define MC_VFS_IMPL_H -#ifdef USE_VFS +#ifdef ENABLE_VFS #include #include @@ -150,6 +150,6 @@ void init_sfs (void); void init_tarfs (void); void init_undelfs (void); -#endif /* USE_VFS */ +#endif /* ENABLE_VFS */ #endif /* MC_VFS_IMPL_H */ diff --git a/vfs/vfs.h b/vfs/vfs.h index 7e0067afe..69b66a44f 100644 --- a/vfs/vfs.h +++ b/vfs/vfs.h @@ -12,7 +12,7 @@ #include #include -#ifdef USE_VFS +#ifdef ENABLE_VFS void vfs_init (void); void vfs_shut (void); @@ -32,7 +32,7 @@ const char *vfs_get_encoding (const char *path); /* return new string */ char *vfs_translate_path_n (const char *path); -#else /* USE_VFS */ +#else /* ENABLE_VFS */ #define vfs_init() do { } while (0) #define vfs_shut() do { } while (0) @@ -78,7 +78,7 @@ static inline char* vfs_canon_and_translate(const char* path) return strdup (buf); } -#endif /* USE_VFS */ +#endif /* ENABLE_VFS */ char *vfs_strip_suffix_from_filename (const char *filename); char *vfs_canon (const char *path); From c73e2828237acbedf6759849e6f27b6fdbf0a1b9 Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Tue, 29 Dec 2009 16:11:59 +0200 Subject: [PATCH 18/18] Rewritten vfs_canon_and_translate() function for using glib functions. Signed-off-by: Slava Zanko --- vfs/vfs.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/vfs/vfs.h b/vfs/vfs.h index 69b66a44f..a4ffd7b0d 100644 --- a/vfs/vfs.h +++ b/vfs/vfs.h @@ -58,24 +58,22 @@ static inline char *vfs_translate_path_n (const char *path) static inline char* vfs_canon_and_translate(const char* path) { - char buf[MC_MAXPATHLEN]; + char *ret_str; if (path == NULL) - return strdup(""); + return g_strdup(""); if (path[0] == PATH_SEP) { - char cwd[MC_MAXPATHLEN]; - if (getcwd (cwd, sizeof (cwd))) - snprintf (buf, sizeof (buf), "%s" PATH_SEP_STR "%s", cwd, path); - else - return strdup ("[MC_MAXPATHLEN TOO SMALL]"); + 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 - snprintf (buf, sizeof (buf), "%s", path); + ret_str = g_strdup(path); - canonicalize_pathname (buf); - return strdup (buf); + canonicalize_pathname (ret_str); + return ret_str; } #endif /* ENABLE_VFS */