1
1

Merge branch '1916_nonvfs_fixup'

* 1916_nonvfs_fixup:
  Rewritten vfs_canon_and_translate() function for using glib functions.
  VFS: renamed USE_VFS to ENABLE_VFS
  VFS: fixed help description for --disable-vfs
  src/file.c: Fixed warning on unused parameter on non-vfs build
  VFS: removed duplicate O_LINEAR declaration in src/vfsdummy.h
  VFS: added non-vfs version of vfs_canon_and_translate()
  VFS: added non-vfs version of vfs_translate_path_n()
  VFS: added non-vfs version of vfs_get_encoding()
  VFS: fixing symbol clash on mc_ungetlocalcopy() at non-vfs build
  VFS: fixing symbol clash on mc_readlink() at non-vfs build
  VFS: fixing symbol clash on mc_utime() at non-vfs build
  VFS: fixing symbol clash on mc_write() at non-vfs build
  VFS: fixing symbol clash on mc_read() at non-vfs build
  VFS: fixing symbol clash on vfs_file_is_local() at non-vfs build
  VFS: fixing symbol clash on vfs_current_is_local() at non-vfs build
  VFS: fixing symbol clash on vfs_init() and vfs_shut() at non-vfs build
  VFS: fixed lots of missing includes to vfs/vfs.h
  Ticket #1916: non-vfs build fixups
Этот коммит содержится в:
Slava Zanko 2009-12-30 11:06:47 +02:00
родитель f287f204be c73e282823
Коммит 00f38570e6
37 изменённых файлов: 172 добавлений и 94 удалений

Просмотреть файл

@ -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"])

Просмотреть файл

@ -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:

Просмотреть файл

@ -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;

Просмотреть файл

@ -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"
@ -472,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

Просмотреть файл

@ -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

Просмотреть файл

@ -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
@ -64,16 +64,13 @@ 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"
use_vfs=yes
AC_MSG_NOTICE([Enabling VFS code])
AC_MC_MVFS_FILESYSTEMS
AC_MC_VFS_CPIOFS
AC_MC_VFS_TARFS
AC_MC_VFS_FTP
@ -88,6 +85,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"])

Просмотреть файл

@ -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

Просмотреть файл

@ -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)

Просмотреть файл

@ -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)
{

Просмотреть файл

@ -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 () */

Просмотреть файл

@ -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 ();

Просмотреть файл

@ -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;

Просмотреть файл

@ -81,6 +81,7 @@
#include "filegui.h"
#include "tree.h"
#include "../vfs/vfs-impl.h"
#include "../vfs/vfs.h"
/* }}} */
@ -191,14 +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;

Просмотреть файл

@ -38,6 +38,8 @@
#include "fs.h"
#include "util.h"
#include "../vfs/vfs.h"
static char *
get_absolute_name (const char *file)
{

Просмотреть файл

@ -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"

Просмотреть файл

@ -92,7 +92,7 @@
#include "textconf.h"
#ifdef USE_VFS
#ifdef ENABLE_VFS
#include "../vfs/vfs.h"
#else
#include "vfsdummy.h"

Просмотреть файл

@ -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);

Просмотреть файл

@ -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" },

Просмотреть файл

@ -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;

Просмотреть файл

@ -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() */

Просмотреть файл

@ -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]) )
@ -2334,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;

Просмотреть файл

@ -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"
@ -52,7 +53,7 @@
#include "fileloc.h"
#include "wtools.h"
#ifdef USE_VFS
#ifdef ENABLE_VFS
#include "../vfs/gc.h"
#endif
@ -187,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 },
@ -200,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 },
@ -378,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",
@ -799,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 ) {
@ -826,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 ()
{
@ -839,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)

Просмотреть файл

@ -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

Просмотреть файл

@ -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]));

Просмотреть файл

@ -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"

Просмотреть файл

@ -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"

Просмотреть файл

@ -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 */

Просмотреть файл

@ -57,6 +57,8 @@
#include "dir.h"
#include "fileloc.h"
#include "../vfs/vfs.h"
#ifdef HAVE_CHARSET
#include "charsets.h"
#endif
@ -835,7 +837,7 @@ strip_ctrl_codes (char *s)
}
#ifndef USE_VFS
#ifndef ENABLE_VFS
char *
get_current_wd (char *buffer, int size)
{
@ -855,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)

Просмотреть файл

@ -13,11 +13,7 @@
#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_read read
#define mc_write write
#define mc_lseek lseek
#define mc_opendir opendir
#define mc_readdir readdir
@ -31,12 +27,10 @@
#define mc_fstat fstat
#define mc_lstat lstat
#define mc_readlink readlink
#define mc_symlink symlink
#define mc_rename rename
#define mc_open open
#define mc_utime utime
#define mc_chmod chmod
#define mc_chown chown
#define mc_chdir chdir
@ -53,13 +47,7 @@ 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_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)
#define vfs_file_class_flags(x) (VFSF_LOCAL)

Просмотреть файл

@ -58,6 +58,8 @@
#include "../src/global.h"
#include "../src/wtools.h"
#include "../../vfs/vfs.h"
#include "internal.h"
/*** global variables ****************************************************************************/

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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 ****************************************************************************/

Просмотреть файл

@ -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"

Просмотреть файл

@ -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)

Просмотреть файл

@ -64,7 +64,7 @@ EXTFS_OUT = \
uzip \
uzoo
if USE_VFS
if ENABLE_VFS
extfs_DATA = $(EXTFS_MISC)
extfs_SCRIPTS = $(EXTFS_CONST) $(EXTFS_OUT)

Просмотреть файл

@ -7,7 +7,7 @@
#ifndef MC_VFS_IMPL_H
#define MC_VFS_IMPL_H
#ifdef USE_VFS
#ifdef ENABLE_VFS
#include <sys/types.h>
#include <dirent.h>
@ -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 */

Просмотреть файл

@ -10,25 +10,82 @@
#include <sys/types.h>
#include <dirent.h>
#include <utime.h>
#include <stdio.h>
#ifdef ENABLE_VFS
void vfs_init (void);
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);
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);
/* return new string */
char *vfs_translate_path_n (const char *path);
#else /* ENABLE_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)
#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)
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;
}
#endif /* ENABLE_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);
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
* return static buffer */
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);
@ -38,8 +95,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);
@ -53,8 +108,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);
int mc_link (const char *name1, const char *name2);
@ -64,7 +117,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);