diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 17:44:12 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 17:44:12 +0000 |
commit | 8ccb487c21368a7fdc8c7c72315325bf0aa06147 (patch) | |
tree | b2056fae01d325924508a41731edfbd4c3cddd23 /src/vfs/sfs | |
parent | Initial commit. (diff) | |
download | mc-upstream.tar.xz mc-upstream.zip |
Adding upstream version 3:4.8.29.upstream/3%4.8.29upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/vfs/sfs/Makefile.am | 16 | ||||
-rw-r--r-- | src/vfs/sfs/Makefile.in | 793 | ||||
-rw-r--r-- | src/vfs/sfs/sfs.c | 603 | ||||
-rw-r--r-- | src/vfs/sfs/sfs.h | 18 | ||||
-rw-r--r-- | src/vfs/sfs/sfs.ini | 34 |
5 files changed, 1464 insertions, 0 deletions
diff --git a/src/vfs/sfs/Makefile.am b/src/vfs/sfs/Makefile.am new file mode 100644 index 0000000..7de97d0 --- /dev/null +++ b/src/vfs/sfs/Makefile.am @@ -0,0 +1,16 @@ + +AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) + +noinst_LTLIBRARIES = libvfs-sfs.la + +libvfs_sfs_la_SOURCES = \ + sfs.c sfs.h + +SFSCONFFILES = sfs.ini + +if ENABLE_VFS_SFS +sfsconfdir = $(sysconfdir)/@PACKAGE@ +sfsconf_DATA = $(SFSCONFFILES) +endif + +EXTRA_DIST = $(SFSCONFFILES) diff --git a/src/vfs/sfs/Makefile.in b/src/vfs/sfs/Makefile.in new file mode 100644 index 0000000..c6aa671 --- /dev/null +++ b/src/vfs/sfs/Makefile.in @@ -0,0 +1,793 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/vfs/sfs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/m4.include/gnulib/mode_t.m4 \ + $(top_srcdir)/m4.include/gnulib/stat-size.m4 \ + $(top_srcdir)/m4.include/gnulib/fstypename.m4 \ + $(top_srcdir)/m4.include/gnulib/fsusage.m4 \ + $(top_srcdir)/m4.include/gnulib/mountlist.m4 \ + $(top_srcdir)/m4.include/gnulib/windows-stat-inodes.m4 \ + $(top_srcdir)/m4.include/gnulib/sys_types_h.m4 \ + $(top_srcdir)/m4.include/ax_path_lib_pcre.m4 \ + $(top_srcdir)/m4.include/dx_doxygen.m4 \ + $(top_srcdir)/m4.include/ax_require_defined.m4 \ + $(top_srcdir)/m4.include/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4.include/ax_append_flag.m4 \ + $(top_srcdir)/m4.include/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4.include/mc-cflags.m4 \ + $(top_srcdir)/m4.include/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4.include/mc-check-search-type.m4 \ + $(top_srcdir)/m4.include/mc-get-fs-info.m4 \ + $(top_srcdir)/m4.include/mc-with-x.m4 \ + $(top_srcdir)/m4.include/mc-use-termcap.m4 \ + $(top_srcdir)/m4.include/mc-with-screen.m4 \ + $(top_srcdir)/m4.include/mc-with-screen-ncurses.m4 \ + $(top_srcdir)/m4.include/mc-with-screen-slang.m4 \ + $(top_srcdir)/m4.include/mc-with-internal-edit.m4 \ + $(top_srcdir)/m4.include/mc-subshell.m4 \ + $(top_srcdir)/m4.include/mc-background.m4 \ + $(top_srcdir)/m4.include/mc-ext2fs-attr.m4 \ + $(top_srcdir)/m4.include/mc-glib.m4 \ + $(top_srcdir)/m4.include/mc-vfs.m4 \ + $(top_srcdir)/m4.include/vfs/rpc.m4 \ + $(top_srcdir)/m4.include/vfs/socket.m4 \ + $(top_srcdir)/m4.include/vfs/mc-vfs-extfs.m4 \ + $(top_srcdir)/m4.include/vfs/mc-vfs-sfs.m4 \ + $(top_srcdir)/m4.include/vfs/mc-vfs-ftp.m4 \ + $(top_srcdir)/m4.include/vfs/mc-vfs-sftp.m4 \ + $(top_srcdir)/m4.include/vfs/mc-vfs-fish.m4 \ + $(top_srcdir)/m4.include/vfs/mc-vfs-undelfs.m4 \ + $(top_srcdir)/m4.include/vfs/mc-vfs-tarfs.m4 \ + $(top_srcdir)/m4.include/vfs/mc-vfs-cpiofs.m4 \ + $(top_srcdir)/m4.include/mc-version.m4 \ + $(top_srcdir)/m4.include/mc-tests.m4 \ + $(top_srcdir)/m4.include/mc-i18n.m4 \ + $(top_srcdir)/m4.include/mc-assert.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libvfs_sfs_la_LIBADD = +am_libvfs_sfs_la_OBJECTS = sfs.lo +libvfs_sfs_la_OBJECTS = $(am_libvfs_sfs_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/sfs.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libvfs_sfs_la_SOURCES) +DIST_SOURCES = $(libvfs_sfs_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(sfsconfdir)" +DATA = $(sfsconf_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CP1251 = @CP1251@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOC_LINGUAS = @DOC_LINGUAS@ +DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +DX_CONFIG = @DX_CONFIG@ +DX_DOCDIR = @DX_DOCDIR@ +DX_DOT = @DX_DOT@ +DX_DOXYGEN = @DX_DOXYGEN@ +DX_DVIPS = @DX_DVIPS@ +DX_EGREP = @DX_EGREP@ +DX_ENV = @DX_ENV@ +DX_FLAG_chi = @DX_FLAG_chi@ +DX_FLAG_chm = @DX_FLAG_chm@ +DX_FLAG_doc = @DX_FLAG_doc@ +DX_FLAG_dot = @DX_FLAG_dot@ +DX_FLAG_html = @DX_FLAG_html@ +DX_FLAG_man = @DX_FLAG_man@ +DX_FLAG_pdf = @DX_FLAG_pdf@ +DX_FLAG_ps = @DX_FLAG_ps@ +DX_FLAG_rtf = @DX_FLAG_rtf@ +DX_FLAG_xml = @DX_FLAG_xml@ +DX_HHC = @DX_HHC@ +DX_LATEX = @DX_LATEX@ +DX_MAKEINDEX = @DX_MAKEINDEX@ +DX_PDFLATEX = @DX_PDFLATEX@ +DX_PERL = @DX_PERL@ +DX_PROJECT = @DX_PROJECT@ +E2P_CFLAGS = @E2P_CFLAGS@ +E2P_LIBS = @E2P_LIBS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +EXTHELPERSDIR = @EXTHELPERSDIR@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMODULE_CFLAGS = @GMODULE_CFLAGS@ +GMODULE_LIBS = @GMODULE_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +HAVE_FILECMD = @HAVE_FILECMD@ +HAVE_ZIPINFO = @HAVE_ZIPINFO@ +HAVE_nroff = @HAVE_nroff@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBMC_RELEASE = @LIBMC_RELEASE@ +LIBMC_VERSION = @LIBMC_VERSION@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSSH_CFLAGS = @LIBSSH_CFLAGS@ +LIBSSH_LIBS = @LIBSSH_LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANDOC = @MANDOC@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MAN_DATE = @MAN_DATE@ +MAN_FLAGS = @MAN_FLAGS@ +MAN_VERSION = @MAN_VERSION@ +MCLIBS = @MCLIBS@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCRE_CPPFLAGS = @PCRE_CPPFLAGS@ +PCRE_LIBS = @PCRE_LIBS@ +PERL = @PERL@ +PERL_FOR_BUILD = @PERL_FOR_BUILD@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +PYTHON = @PYTHON@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SLANG_CFLAGS = @SLANG_CFLAGS@ +SLANG_LIBS = @SLANG_LIBS@ +STRIP = @STRIP@ +TESTS_LDFLAGS = @TESTS_LDFLAGS@ +UNZIP = @UNZIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +X11_WWW = @X11_WWW@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +ZIP = @ZIP@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) +noinst_LTLIBRARIES = libvfs-sfs.la +libvfs_sfs_la_SOURCES = \ + sfs.c sfs.h + +SFSCONFFILES = sfs.ini +@ENABLE_VFS_SFS_TRUE@sfsconfdir = $(sysconfdir)/@PACKAGE@ +@ENABLE_VFS_SFS_TRUE@sfsconf_DATA = $(SFSCONFFILES) +EXTRA_DIST = $(SFSCONFFILES) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/vfs/sfs/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/vfs/sfs/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libvfs-sfs.la: $(libvfs_sfs_la_OBJECTS) $(libvfs_sfs_la_DEPENDENCIES) $(EXTRA_libvfs_sfs_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libvfs_sfs_la_OBJECTS) $(libvfs_sfs_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sfs.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-sfsconfDATA: $(sfsconf_DATA) + @$(NORMAL_INSTALL) + @list='$(sfsconf_DATA)'; test -n "$(sfsconfdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(sfsconfdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(sfsconfdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(sfsconfdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(sfsconfdir)" || exit $$?; \ + done + +uninstall-sfsconfDATA: + @$(NORMAL_UNINSTALL) + @list='$(sfsconf_DATA)'; test -n "$(sfsconfdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(sfsconfdir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(sfsconfdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/sfs.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-sfsconfDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/sfs.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-sfsconfDATA + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-sfsconfDATA \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-sfsconfDATA + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/vfs/sfs/sfs.c b/src/vfs/sfs/sfs.c new file mode 100644 index 0000000..ad313b5 --- /dev/null +++ b/src/vfs/sfs/sfs.c @@ -0,0 +1,603 @@ +/* + Single File fileSystem + + Copyright (C) 1998-2022 + Free Software Foundation, Inc. + + Written by: + Slava Zanko <slavazanko@gmail.com>, 2013 + + This file is part of the Midnight Commander. + + The Midnight Commander is free software: you can redistribute it + and/or modify it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + The Midnight Commander is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/** + * \file + * \brief Source: Single File fileSystem + * + * This defines whole class of filesystems which contain single file + * inside. It is somehow similar to extfs, except that extfs makes + * whole virtual trees and we do only single virtual files. + * + * If you want to gunzip something, you should open it with \verbatim #ugz \endverbatim + * suffix, DON'T try to gunzip it yourself. + * + * Namespace: exports vfs_sfs_ops + */ + +#include <config.h> +#include <errno.h> +#include <sys/types.h> +#include <unistd.h> +#include <stdio.h> +#include <string.h> + +#include "lib/global.h" +#include "lib/util.h" +#include "lib/widget.h" /* D_ERROR, D_NORMAL */ + +#include "src/execute.h" /* EXECUTE_AS_SHELL */ + +#include "lib/vfs/vfs.h" +#include "lib/vfs/utilvfs.h" +#include "lib/vfs/xdirentry.h" +#include "src/vfs/local/local.h" +#include "lib/vfs/gc.h" /* vfs_stamp_create */ + +#include "sfs.h" + +/*** global variables ****************************************************************************/ + +/*** file scope macro definitions ****************************************************************/ + +#define MAXFS 32 + +typedef enum +{ + F_NONE = 0x0, + F_1 = 0x1, + F_2 = 0x2, + F_NOLOCALCOPY = 0x4, + F_FULLMATCH = 0x8 +} sfs_flags_t; + +#define COPY_CHAR \ + if ((size_t) (t - pad) > sizeof (pad)) \ + { \ + g_free (pqname); \ + return (-1); \ + } \ + else \ + *t++ = *s_iter; + +#define COPY_STRING(a) \ + if ((t - pad) + strlen (a) > sizeof (pad)) \ + { \ + g_free (pqname); \ + return (-1); \ + } \ + else \ + { \ + strcpy (t, a); \ + t += strlen (a); \ + } + +/*** file scope type declarations ****************************************************************/ + +typedef struct cachedfile +{ + char *name; + char *cache; +} cachedfile; + +/*** file scope variables ************************************************************************/ + +static GSList *head = NULL; + +static struct vfs_s_subclass sfs_subclass; +static struct vfs_class *vfs_sfs_ops = VFS_CLASS (&sfs_subclass); + +static int sfs_no = 0; +static struct +{ + char *prefix; + char *command; + sfs_flags_t flags; +} sfs_info[MAXFS]; + +/*** file scope functions ************************************************************************/ + +static int +cachedfile_compare (const void *a, const void *b) +{ + const cachedfile *cf = (const cachedfile *) a; + const char *name = (const char *) b; + + return strcmp (name, cf->name); +} + +/* --------------------------------------------------------------------------------------------- */ + +static int +sfs_vfmake (const vfs_path_t * vpath, vfs_path_t * cache_vpath) +{ + int w; + char pad[10240]; + char *s_iter, *t = pad; + gboolean was_percent = FALSE; + vfs_path_t *pname; /* name of parent archive */ + char *pqname; /* name of parent archive, quoted */ + const vfs_path_element_t *path_element; + mc_pipe_t *pip; + GError *error = NULL; + + path_element = vfs_path_get_by_index (vpath, -1); + pname = vfs_path_clone (vpath); + vfs_path_remove_element_by_index (pname, -1); + + w = path_element->class->which (path_element->class, path_element->vfs_prefix); + if (w == -1) + vfs_die ("This cannot happen... Hopefully.\n"); + + if ((sfs_info[w].flags & F_1) == 0 + && strcmp (vfs_path_get_last_path_str (pname), PATH_SEP_STR) != 0) + { + vfs_path_free (pname, TRUE); + return (-1); + } + + /* if ((sfs_info[w].flags & F_2) || (!inpath) || (!*inpath)); else return -1; */ + if ((sfs_info[w].flags & F_NOLOCALCOPY) != 0) + pqname = name_quote (vfs_path_as_str (pname), FALSE); + else + { + vfs_path_t *s; + + s = mc_getlocalcopy (pname); + if (s == NULL) + { + vfs_path_free (pname, TRUE); + return (-1); + } + + pqname = name_quote (vfs_path_get_last_path_str (s), FALSE); + vfs_path_free (s, TRUE); + } + + vfs_path_free (pname, TRUE); + + for (s_iter = sfs_info[w].command; *s_iter != '\0'; s_iter++) + { + if (was_percent) + { + const char *ptr = NULL; + + was_percent = FALSE; + + switch (*s_iter) + { + case '1': + ptr = pqname; + break; + case '2': + ptr = path_element->path; + break; + case '3': + ptr = vfs_path_get_by_index (cache_vpath, -1)->path; + break; + case '%': + COPY_CHAR; + continue; + default: + break; + } + + if (ptr != NULL) + { + COPY_STRING (ptr); + } + } + else if (*s_iter == '%') + was_percent = TRUE; + else + { + COPY_CHAR; + } + } + + g_free (pqname); + + /* don't read stdout */ + pip = mc_popen (pad, FALSE, TRUE, &error); + if (pip == NULL) + { + message (D_ERROR, MSG_ERROR, _("SFS virtual file system:\n%s"), error->message); + g_error_free (error); + return (-1); + } + + pip->err.null_term = TRUE; + + mc_pread (pip, &error); + if (error != NULL) + { + message (D_ERROR, MSG_ERROR, _("SFS virtual file system:\n%s"), error->message); + g_error_free (error); + mc_pclose (pip, NULL); + return (-1); + } + + if (pip->err.len > 0) + message (D_ERROR, MSG_ERROR, _("SFS virtual file system:\n%s"), pip->err.buf); + + mc_pclose (pip, NULL); + return 0; /* OK */ +} + +/* --------------------------------------------------------------------------------------------- */ + +static const char * +sfs_redirect (const vfs_path_t * vpath) +{ + GSList *cur; + cachedfile *cf; + vfs_path_t *cache_vpath; + int handle; + const vfs_path_element_t *path_element; + + path_element = vfs_path_get_by_index (vpath, -1); + cur = g_slist_find_custom (head, vfs_path_as_str (vpath), cachedfile_compare); + + if (cur != NULL) + { + cf = (cachedfile *) cur->data; + vfs_stamp (vfs_sfs_ops, cf); + return cf->cache; + } + + handle = vfs_mkstemps (&cache_vpath, "sfs", path_element->path); + + if (handle == -1) + return "/SOMEONE_PLAYING_DIRTY_TMP_TRICKS_ON_US"; + + close (handle); + + if (sfs_vfmake (vpath, cache_vpath) == 0) + { + cf = g_new (cachedfile, 1); + cf->name = g_strdup (vfs_path_as_str (vpath)); + cf->cache = vfs_path_free (cache_vpath, FALSE); + head = g_slist_prepend (head, cf); + + vfs_stamp_create (vfs_sfs_ops, (cachedfile *) head->data); + return cf->cache; + } + + mc_unlink (cache_vpath); + vfs_path_free (cache_vpath, TRUE); + return "/I_MUST_NOT_EXIST"; +} + +/* --------------------------------------------------------------------------------------------- */ + +static void * +sfs_open (const vfs_path_t * vpath /*struct vfs_class *me, const char *path */ , int flags, + mode_t mode) +{ + int *info; + int fd; + + fd = open (sfs_redirect (vpath), NO_LINEAR (flags), mode); + if (fd == -1) + return NULL; + + info = g_new (int, 1); + *info = fd; + + return info; +} + +/* --------------------------------------------------------------------------------------------- */ + +static int +sfs_stat (const vfs_path_t * vpath, struct stat *buf) +{ + return stat (sfs_redirect (vpath), buf); +} + +/* --------------------------------------------------------------------------------------------- */ + +static int +sfs_lstat (const vfs_path_t * vpath, struct stat *buf) +{ +#ifndef HAVE_STATLSTAT + return lstat (sfs_redirect (vpath), buf); +#else + return statlstat (sfs_redirect (vpath), buf); +#endif +} + +/* --------------------------------------------------------------------------------------------- */ + +static int +sfs_chmod (const vfs_path_t * vpath, mode_t mode) +{ + return chmod (sfs_redirect (vpath), mode); +} + +/* --------------------------------------------------------------------------------------------- */ + +static int +sfs_chown (const vfs_path_t * vpath, uid_t owner, gid_t group) +{ + return chown (sfs_redirect (vpath), owner, group); +} + +/* --------------------------------------------------------------------------------------------- */ + +static int +sfs_utime (const vfs_path_t * vpath, mc_timesbuf_t * times) +{ +#ifdef HAVE_UTIMENSAT + return utimensat (AT_FDCWD, sfs_redirect (vpath), *times, 0); +#else + return utime (sfs_redirect (vpath), times); +#endif +} + +/* --------------------------------------------------------------------------------------------- */ + +static int +sfs_readlink (const vfs_path_t * vpath, char *buf, size_t size) +{ + return readlink (sfs_redirect (vpath), buf, size); +} + +/* --------------------------------------------------------------------------------------------- */ + +static vfsid +sfs_getid (const vfs_path_t * vpath) +{ + GSList *cur; + + cur = g_slist_find_custom (head, vfs_path_as_str (vpath), cachedfile_compare); + + return (vfsid) (cur != NULL ? cur->data : NULL); +} + +/* --------------------------------------------------------------------------------------------- */ + +static void +sfs_free (vfsid id) +{ + struct cachedfile *which; + GSList *cur; + + which = (struct cachedfile *) id; + cur = g_slist_find (head, which); + if (cur == NULL) + vfs_die ("Free of thing which is unknown to me\n"); + + which = (struct cachedfile *) cur->data; + unlink (which->cache); + g_free (which->cache); + g_free (which->name); + g_free (which); + + head = g_slist_delete_link (head, cur); +} + +/* --------------------------------------------------------------------------------------------- */ + +static void +sfs_fill_names (struct vfs_class *me, fill_names_f func) +{ + GSList *cur; + + (void) me; + + for (cur = head; cur != NULL; cur = g_slist_next (cur)) + func (((cachedfile *) cur->data)->name); +} + +/* --------------------------------------------------------------------------------------------- */ + +static gboolean +sfs_nothingisopen (vfsid id) +{ + /* FIXME: Investigate whether have to guard this like in + the other VFSs (see fd_usage in extfs) -- Norbert */ + (void) id; + return TRUE; +} + +/* --------------------------------------------------------------------------------------------- */ + +static vfs_path_t * +sfs_getlocalcopy (const vfs_path_t * vpath) +{ + return vfs_path_from_str (sfs_redirect (vpath)); +} + +/* --------------------------------------------------------------------------------------------- */ + +static int +sfs_ungetlocalcopy (const vfs_path_t * vpath, const vfs_path_t * local, gboolean has_changed) +{ + (void) vpath; + (void) local; + (void) has_changed; + return 0; +} + +/* --------------------------------------------------------------------------------------------- */ + +static int +sfs_init (struct vfs_class *me) +{ + char *mc_sfsini; + FILE *cfg; + char key[256]; + + (void) me; + + mc_sfsini = g_build_filename (mc_global.sysconfig_dir, "sfs.ini", (char *) NULL); + cfg = fopen (mc_sfsini, "r"); + + if (cfg == NULL) + { + fprintf (stderr, _("%s: Warning: file %s not found\n"), "sfs_init()", mc_sfsini); + g_free (mc_sfsini); + return 0; + } + g_free (mc_sfsini); + + sfs_no = 0; + while (sfs_no < MAXFS && fgets (key, sizeof (key), cfg) != NULL) + { + char *c, *semi = NULL; + sfs_flags_t flags = F_NONE; + + if (*key == '#' || *key == '\n') + continue; + + for (c = key; *c != '\0'; c++) + if (*c == ':' || IS_PATH_SEP (*c)) + { + semi = c; + if (IS_PATH_SEP (*c)) + { + *c = '\0'; + flags |= F_FULLMATCH; + } + break; + } + + if (semi == NULL) + { + invalid_line: + fprintf (stderr, _("Warning: Invalid line in %s:\n%s\n"), "sfs.ini", key); + continue; + } + + for (c = semi + 1; *c != '\0' && !whitespace (*c); c++) + switch (*c) + { + case '1': + flags |= F_1; + break; + case '2': + flags |= F_2; + break; + case 'R': + flags |= F_NOLOCALCOPY; + break; + default: + fprintf (stderr, _("Warning: Invalid flag %c in %s:\n%s\n"), *c, "sfs.ini", key); + } + + if (*c == '\0') + goto invalid_line; + + c++; + *(semi + 1) = '\0'; + semi = strchr (c, '\n'); + if (semi != NULL) + *semi = '\0'; + + sfs_info[sfs_no].prefix = g_strdup (key); + sfs_info[sfs_no].command = g_strdup (c); + sfs_info[sfs_no].flags = flags; + sfs_no++; + } + fclose (cfg); + + return 1; +} + +/* --------------------------------------------------------------------------------------------- */ + +static void +sfs_done (struct vfs_class *me) +{ + int i; + + (void) me; + + for (i = 0; i < sfs_no; i++) + { + MC_PTR_FREE (sfs_info[i].prefix); + MC_PTR_FREE (sfs_info[i].command); + } + sfs_no = 0; +} + +/* --------------------------------------------------------------------------------------------- */ + +static int +sfs_which (struct vfs_class *me, const char *path) +{ + int i; + + (void) me; + + for (i = 0; i < sfs_no; i++) + if ((sfs_info[i].flags & F_FULLMATCH) != 0) + { + if (strcmp (path, sfs_info[i].prefix) == 0) + return i; + } + else if (strncmp (path, sfs_info[i].prefix, strlen (sfs_info[i].prefix)) == 0) + return i; + + return (-1); +} + +/* --------------------------------------------------------------------------------------------- */ +/*** public functions ****************************************************************************/ +/* --------------------------------------------------------------------------------------------- */ + +void +vfs_init_sfs (void) +{ + /* NULLize vfs_s_subclass members */ + memset (&sfs_subclass, 0, sizeof (sfs_subclass)); + + vfs_init_class (vfs_sfs_ops, "sfs", VFSF_UNKNOWN, NULL); + vfs_sfs_ops->init = sfs_init; + vfs_sfs_ops->done = sfs_done; + vfs_sfs_ops->fill_names = sfs_fill_names; + vfs_sfs_ops->which = sfs_which; + vfs_sfs_ops->open = sfs_open; + vfs_sfs_ops->close = local_close; + vfs_sfs_ops->read = local_read; + vfs_sfs_ops->stat = sfs_stat; + vfs_sfs_ops->lstat = sfs_lstat; + vfs_sfs_ops->fstat = local_fstat; + vfs_sfs_ops->chmod = sfs_chmod; + vfs_sfs_ops->chown = sfs_chown; + vfs_sfs_ops->utime = sfs_utime; + vfs_sfs_ops->readlink = sfs_readlink; + vfs_sfs_ops->ferrno = local_errno; + vfs_sfs_ops->lseek = local_lseek; + vfs_sfs_ops->getid = sfs_getid; + vfs_sfs_ops->nothingisopen = sfs_nothingisopen; + vfs_sfs_ops->free = sfs_free; + vfs_sfs_ops->getlocalcopy = sfs_getlocalcopy; + vfs_sfs_ops->ungetlocalcopy = sfs_ungetlocalcopy; + vfs_register_class (vfs_sfs_ops); +} + +/* --------------------------------------------------------------------------------------------- */ diff --git a/src/vfs/sfs/sfs.h b/src/vfs/sfs/sfs.h new file mode 100644 index 0000000..c846c93 --- /dev/null +++ b/src/vfs/sfs/sfs.h @@ -0,0 +1,18 @@ +#ifndef MC__VFS_SFS_H +#define MC__VFS_SFS_H + +/*** typedefs(not structures) and defined constants **********************************************/ + +/*** enums ***************************************************************************************/ + +/*** structures declarations (and typedefs of structures)*****************************************/ + +/*** global variables defined in .c file *********************************************************/ + +/*** declarations of public functions ************************************************************/ + +void vfs_init_sfs (void); + +/*** inline functions ****************************************************************************/ + +#endif /* MC__VFS_SFS_H */ diff --git a/src/vfs/sfs/sfs.ini b/src/vfs/sfs/sfs.ini new file mode 100644 index 0000000..d817dc9 --- /dev/null +++ b/src/vfs/sfs/sfs.ini @@ -0,0 +1,34 @@ +# +# This is config for Single File fileSystem +# +# Notice that output files (%3) are pre-created atomically in /tmp +# with 0600 rights, so it is safe to > %3 +# +gz/1 gzip < %1 > %3 +ugz/1 gzip -cdf < %1 > %3 +bz/1 bzip < %1 > %3 +ubz/1 bzip -d < %1 > %3 +bz2/1 bzip2 < %1 > %3 +ubz2/1 bzip2 -d < %1 > %3 +lz/1 lzip < %1 > %3 +ulz/1 lzip -d < %1 > %3 +lz4/1 lz4 < %1 > %3 +ulz4/1 lz4 -d < %1 > %3 +lzma/1 lzma < %1 > %3 +ulzma/1 lzma -d < %1 > %3 +xz/1 xz < %1 > %3 +uxz/1 xz -d < %1 > %3 +zst/1 zstd < %1 > %3 +uzst/1 zstd -d < %1 > %3 +tar/1 tar cf %3 %1 +tgz/1 tar czf %3 %1 +uhtml/1 lynx -force_html -dump %1 > %3 +uman/1 groff -Tascii -man %1 > %3 +uue/1 uuenpipe < %1 > %3 +uude/1 uudepipe < %1 > %3 +crlf/1 todos < %1 > %3 +cr/1 fromdos < %1 > %3 +# Fixme: we need it to fail whenever it should +url:2 lynx -source `echo "%2" | sed 's-|-/-g'` > %3 +nop/1 cat %1 > %3 +strings/1 strings %1 > %3 |