mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
extfs.ini file is replaced to extfs.d directory.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
2d43ad1bb4
commit
ba1d909a7a
12
configure.ac
12
configure.ac
@ -589,20 +589,20 @@ lib/tty/Makefile
|
|||||||
lib/vfs/Makefile
|
lib/vfs/Makefile
|
||||||
lib/vfs/mc-vfs/Makefile
|
lib/vfs/mc-vfs/Makefile
|
||||||
lib/vfs/mc-vfs/extfs/Makefile
|
lib/vfs/mc-vfs/extfs/Makefile
|
||||||
lib/vfs/mc-vfs/extfs/a
|
lib/vfs/mc-vfs/extfs/a+
|
||||||
lib/vfs/mc-vfs/extfs/apt
|
lib/vfs/mc-vfs/extfs/apt+
|
||||||
lib/vfs/mc-vfs/extfs/audio
|
lib/vfs/mc-vfs/extfs/audio
|
||||||
lib/vfs/mc-vfs/extfs/deb
|
lib/vfs/mc-vfs/extfs/deb
|
||||||
lib/vfs/mc-vfs/extfs/deba
|
lib/vfs/mc-vfs/extfs/deba
|
||||||
lib/vfs/mc-vfs/extfs/debd
|
lib/vfs/mc-vfs/extfs/debd
|
||||||
lib/vfs/mc-vfs/extfs/dpkg
|
lib/vfs/mc-vfs/extfs/dpkg+
|
||||||
lib/vfs/mc-vfs/extfs/iso9660
|
lib/vfs/mc-vfs/extfs/iso9660
|
||||||
lib/vfs/mc-vfs/extfs/hp48
|
lib/vfs/mc-vfs/extfs/hp48+
|
||||||
lib/vfs/mc-vfs/extfs/lslR
|
lib/vfs/mc-vfs/extfs/lslR
|
||||||
lib/vfs/mc-vfs/extfs/mailfs
|
lib/vfs/mc-vfs/extfs/mailfs
|
||||||
lib/vfs/mc-vfs/extfs/patchfs
|
lib/vfs/mc-vfs/extfs/patchfs
|
||||||
lib/vfs/mc-vfs/extfs/rpms
|
lib/vfs/mc-vfs/extfs/rpms+
|
||||||
lib/vfs/mc-vfs/extfs/s3
|
lib/vfs/mc-vfs/extfs/s3+
|
||||||
lib/vfs/mc-vfs/extfs/uace
|
lib/vfs/mc-vfs/extfs/uace
|
||||||
lib/vfs/mc-vfs/extfs/ualz
|
lib/vfs/mc-vfs/extfs/ualz
|
||||||
lib/vfs/mc-vfs/extfs/uar
|
lib/vfs/mc-vfs/extfs/uar
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#define CHARSETS_INDEX "mc.charsets"
|
#define CHARSETS_INDEX "mc.charsets"
|
||||||
#define MC_LIB_EXT "mc.ext"
|
#define MC_LIB_EXT "mc.ext"
|
||||||
|
|
||||||
|
#define MC_EXTFS_DIR "extfs.d"
|
||||||
|
|
||||||
#define MC_BASHRC_FILE "bashrc"
|
#define MC_BASHRC_FILE "bashrc"
|
||||||
#define MC_CONFIG_FILE "ini"
|
#define MC_CONFIG_FILE "ini"
|
||||||
|
@ -8,6 +8,8 @@ DIST_SUBDIRS = extfs
|
|||||||
SUBDIRS = extfs $(SAMBA_SUBDIRS)
|
SUBDIRS = extfs $(SAMBA_SUBDIRS)
|
||||||
AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) $(SAMBA_CFLAGS)
|
AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) $(SAMBA_CFLAGS)
|
||||||
|
|
||||||
|
AM_CPPFLAGS = -DLIBEXECDIR=\""$(libexecdir)/@PACKAGE@/"\"
|
||||||
|
|
||||||
BASICFILES = \
|
BASICFILES = \
|
||||||
cpio.c \
|
cpio.c \
|
||||||
direntry.c \
|
direntry.c \
|
||||||
|
@ -44,8 +44,10 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "lib/global.h"
|
#include "lib/global.h"
|
||||||
|
#include "lib/fileloc.h"
|
||||||
|
|
||||||
#include "src/wtools.h" /* message() */
|
#include "src/wtools.h" /* message() */
|
||||||
#include "src/main.h" /* print_vfs_message */
|
#include "src/main.h" /* print_vfs_message */
|
||||||
@ -353,7 +355,7 @@ extfs_open_archive (int fstype, const char *name, struct archive **pparc)
|
|||||||
tmp = name_quote (name, 0);
|
tmp = name_quote (name, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
mc_extfsdir = concat_dir_and_file (mc_home_alt, "extfs" PATH_SEP_STR);
|
mc_extfsdir = g_build_path (PATH_SEP_STR, LIBEXECDIR, MC_EXTFS_DIR PATH_SEP_STR, (char *) NULL);
|
||||||
cmd = g_strconcat (mc_extfsdir, info->prefix, " list ",
|
cmd = g_strconcat (mc_extfsdir, info->prefix, " list ",
|
||||||
local_name != NULL ? local_name : tmp, (char *) NULL);
|
local_name != NULL ? local_name : tmp, (char *) NULL);
|
||||||
g_free (tmp);
|
g_free (tmp);
|
||||||
@ -722,7 +724,7 @@ extfs_cmd (const char *str_extfs_cmd, struct archive *archive,
|
|||||||
archive_name = name_quote (extfs_get_archive_name (archive), 0);
|
archive_name = name_quote (extfs_get_archive_name (archive), 0);
|
||||||
quoted_localname = name_quote (localname, 0);
|
quoted_localname = name_quote (localname, 0);
|
||||||
info = &g_array_index (extfs_plugins, extfs_plugin_info_t, archive->fstype);
|
info = &g_array_index (extfs_plugins, extfs_plugin_info_t, archive->fstype);
|
||||||
mc_extfsdir = concat_dir_and_file (mc_home_alt, "extfs" PATH_SEP_STR);
|
mc_extfsdir = g_build_path (PATH_SEP_STR, LIBEXECDIR, MC_EXTFS_DIR PATH_SEP_STR, (char *) NULL);
|
||||||
cmd = g_strconcat (mc_extfsdir, info->prefix, str_extfs_cmd,
|
cmd = g_strconcat (mc_extfsdir, info->prefix, str_extfs_cmd,
|
||||||
archive_name, " ", quoted_file, " ",
|
archive_name, " ", quoted_file, " ",
|
||||||
quoted_localname, (char *) NULL);
|
quoted_localname, (char *) NULL);
|
||||||
@ -753,7 +755,7 @@ extfs_run (struct vfs_class *me, const char *file)
|
|||||||
g_free (p);
|
g_free (p);
|
||||||
|
|
||||||
archive_name = name_quote (extfs_get_archive_name (archive), 0);
|
archive_name = name_quote (extfs_get_archive_name (archive), 0);
|
||||||
mc_extfsdir = concat_dir_and_file (mc_home_alt, "extfs" PATH_SEP_STR);
|
mc_extfsdir = g_build_path (PATH_SEP_STR, LIBEXECDIR, MC_EXTFS_DIR PATH_SEP_STR, (char *) NULL);
|
||||||
info = &g_array_index (extfs_plugins, extfs_plugin_info_t, archive->fstype);
|
info = &g_array_index (extfs_plugins, extfs_plugin_info_t, archive->fstype);
|
||||||
cmd = g_strconcat (mc_extfsdir, info->prefix,
|
cmd = g_strconcat (mc_extfsdir, info->prefix,
|
||||||
" run ", archive_name, " ", q, (char *) NULL);
|
" run ", archive_name, " ", q, (char *) NULL);
|
||||||
@ -1361,61 +1363,78 @@ extfs_ungetlocalcopy (struct vfs_class *me, const char *path,
|
|||||||
static int
|
static int
|
||||||
extfs_init (struct vfs_class *me)
|
extfs_init (struct vfs_class *me)
|
||||||
{
|
{
|
||||||
FILE *cfg;
|
char *dirname;
|
||||||
char *mc_extfsini;
|
GDir *dir;
|
||||||
char key[256];
|
const char *filename;
|
||||||
|
|
||||||
(void) me;
|
(void) me;
|
||||||
|
|
||||||
mc_extfsini = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR "extfs.ini");
|
dirname = g_build_path (PATH_SEP_STR, LIBEXECDIR, MC_EXTFS_DIR, (char *) NULL);
|
||||||
cfg = fopen (mc_extfsini, "r");
|
dir = g_dir_open (dirname, 0, NULL);
|
||||||
|
|
||||||
/* We may not use vfs_die() message or message or similar,
|
/* We may not use vfs_die() message or message or similar,
|
||||||
* UI is not initialized at this time and message would not
|
* UI is not initialized at this time and message would not
|
||||||
* appear on screen. */
|
* appear on screen. */
|
||||||
if (cfg == NULL) {
|
if (dir == NULL) {
|
||||||
fprintf (stderr, _("Warning: file %s not found\n"), mc_extfsini);
|
fprintf (stderr, _("Warning: cannot open %s directory\n"), dirname);
|
||||||
g_free (mc_extfsini);
|
g_free (dirname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extfs_plugins = g_array_sized_new (FALSE, TRUE, sizeof (extfs_plugin_info_t), 32);
|
extfs_plugins = g_array_sized_new (FALSE, TRUE, sizeof (extfs_plugin_info_t), 32);
|
||||||
|
|
||||||
while (fgets (key, sizeof (key), cfg) != NULL) {
|
while ((filename = g_dir_read_name (dir)) != NULL) {
|
||||||
extfs_plugin_info_t info;
|
char fullname[MC_MAXPATHLEN];
|
||||||
char *c;
|
struct stat s;
|
||||||
|
|
||||||
/* Handle those with a trailing ':', those flag that the
|
g_snprintf (fullname, sizeof (fullname), "%s" PATH_SEP_STR "%s", dirname, filename);
|
||||||
|
|
||||||
|
if ((stat (fullname, &s) == 0)
|
||||||
|
&& S_ISREG (s.st_mode) && !S_ISDIR (s.st_mode)
|
||||||
|
&& (((s.st_mode & S_IXOTH) != 0) ||
|
||||||
|
((s.st_mode & S_IXUSR) != 0) ||
|
||||||
|
((s.st_mode & S_IXGRP) != 0))) {
|
||||||
|
int f;
|
||||||
|
|
||||||
|
f = open (fullname, O_RDONLY);
|
||||||
|
|
||||||
|
if (f > 0) {
|
||||||
|
size_t len;
|
||||||
|
extfs_plugin_info_t info;
|
||||||
|
|
||||||
|
close (f);
|
||||||
|
|
||||||
|
/* Handle those with a trailing '+', those flag that the
|
||||||
* file system does not require an archive to work
|
* file system does not require an archive to work
|
||||||
*/
|
*/
|
||||||
|
len = strlen (filename);
|
||||||
if (*key == '[') {
|
if (filename [len - 1] != '+')
|
||||||
fprintf (stderr, "Warning: You need to update your %s file.\n",
|
info.need_archive = TRUE;
|
||||||
mc_extfsini);
|
else {
|
||||||
fclose (cfg);
|
info.need_archive = FALSE;
|
||||||
g_free (mc_extfsini);
|
len--;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
info.prefix = g_strndup (filename, len);
|
||||||
if (*key == '#' || *key == '\n')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
c = strchr (key, '\n');
|
|
||||||
if (c != '\0')
|
|
||||||
*c-- = '\0';
|
|
||||||
else /* Last line without newline or strlen (key) > 255 */
|
|
||||||
c = &key [strlen (key) - 1];
|
|
||||||
|
|
||||||
info.need_archive = !(*c == ':');
|
|
||||||
if (*c == ':')
|
|
||||||
*c = '\0';
|
|
||||||
if (*key != '\0')
|
|
||||||
info.prefix = g_strdup (key);
|
|
||||||
|
|
||||||
g_array_append_val (extfs_plugins, info);
|
g_array_append_val (extfs_plugins, info);
|
||||||
}
|
}
|
||||||
fclose (cfg);
|
}
|
||||||
g_free (mc_extfsini);
|
}
|
||||||
|
|
||||||
|
g_dir_close (dir);
|
||||||
|
g_free (dirname);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < extfs_plugins->len; i++) {
|
||||||
|
extfs_plugin_info_t *info;
|
||||||
|
info = &g_array_index (extfs_plugins, extfs_plugin_info_t, i);
|
||||||
|
mc_log ("%s %d\n", info->prefix, info->need_archive ? 1 : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
extfsdir = $(pkgdatadir)/extfs
|
extfsdir = $(libexecdir)/@PACKAGE@/extfs.d
|
||||||
|
|
||||||
EXTFSCONFFILES = extfs.ini sfs.ini
|
EXTFSCONFFILES = sfs.ini
|
||||||
|
|
||||||
# Files to install and distribute other than extfs scripts
|
# Files to install and distribute other than extfs scripts
|
||||||
EXTFS_MISC = README
|
EXTFS_MISC = README README.extfs
|
||||||
|
|
||||||
# Scripts hat don't need adaptation to the local system
|
# Scripts hat don't need adaptation to the local system
|
||||||
EXTFS_CONST = bpp rpm trpm u7z ucab
|
EXTFS_CONST = bpp rpm trpm u7z ucab
|
||||||
|
|
||||||
# Scripts that need adaptation to the local system - source files
|
# Scripts that need adaptation to the local system - source files
|
||||||
EXTFS_IN = \
|
EXTFS_IN = \
|
||||||
a.in \
|
a+.in \
|
||||||
apt.in \
|
apt+.in \
|
||||||
audio.in \
|
audio.in \
|
||||||
deb.in \
|
deb.in \
|
||||||
deba.in \
|
deba.in \
|
||||||
debd.in \
|
debd.in \
|
||||||
dpkg.in \
|
dpkg+.in \
|
||||||
iso9660.in \
|
iso9660.in \
|
||||||
hp48.in \
|
hp48+.in \
|
||||||
lslR.in \
|
lslR.in \
|
||||||
mailfs.in \
|
mailfs.in \
|
||||||
patchfs.in \
|
patchfs.in \
|
||||||
rpms.in \
|
rpms+.in \
|
||||||
s3.in \
|
s3+.in \
|
||||||
uace.in \
|
uace.in \
|
||||||
ualz.in \
|
ualz.in \
|
||||||
uar.in \
|
uar.in \
|
||||||
@ -38,20 +38,20 @@ EXTFS_IN = \
|
|||||||
|
|
||||||
# Scripts that need adaptation to the local system - files to install
|
# Scripts that need adaptation to the local system - files to install
|
||||||
EXTFS_OUT = \
|
EXTFS_OUT = \
|
||||||
a \
|
a+ \
|
||||||
apt \
|
apt+ \
|
||||||
audio \
|
audio \
|
||||||
deb \
|
deb \
|
||||||
deba \
|
deba \
|
||||||
debd \
|
debd \
|
||||||
dpkg \
|
dpkg+ \
|
||||||
iso9660 \
|
iso9660 \
|
||||||
hp48 \
|
hp48+ \
|
||||||
lslR \
|
lslR \
|
||||||
mailfs \
|
mailfs \
|
||||||
patchfs \
|
patchfs \
|
||||||
rpms \
|
rpms+ \
|
||||||
s3 \
|
s3+ \
|
||||||
uace \
|
uace \
|
||||||
ualz \
|
ualz \
|
||||||
uar \
|
uar \
|
||||||
@ -68,7 +68,7 @@ if ENABLE_VFS
|
|||||||
extfs_DATA = $(EXTFS_MISC)
|
extfs_DATA = $(EXTFS_MISC)
|
||||||
extfs_SCRIPTS = $(EXTFS_CONST) $(EXTFS_OUT)
|
extfs_SCRIPTS = $(EXTFS_CONST) $(EXTFS_OUT)
|
||||||
|
|
||||||
extfsconfdir = $(sysconfdir)/@PACKAGE@/extfs
|
extfsconfdir = $(sysconfdir)/@PACKAGE@
|
||||||
extfsconf_DATA = $(EXTFSCONFFILES)
|
extfsconf_DATA = $(EXTFSCONFFILES)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# Each external VFS type must be registered here if you want to use it
|
# Each external VFS type must be registered in extfs.d directory if you want to use it.
|
||||||
# Trailing colon means that the filesystem is not tied to a certain file
|
# Trailing plus means that the filesystem is not tied to a certain file.
|
||||||
|
|
||||||
# Popular pc archivers
|
# Popular PC archivers
|
||||||
uzip
|
uzip
|
||||||
uzoo
|
uzoo
|
||||||
ulha
|
ulha
|
||||||
@ -9,7 +9,7 @@ urar
|
|||||||
uha
|
uha
|
||||||
u7z
|
u7z
|
||||||
ualz
|
ualz
|
||||||
# For arj usage you need a special patch to unarj (see unarj.diff)
|
# FIXME: for arj usage you need a special patch to unarj (see unarj.diff)
|
||||||
uarj
|
uarj
|
||||||
uarc
|
uarc
|
||||||
uace
|
uace
|
||||||
@ -24,14 +24,14 @@ uar
|
|||||||
rpm
|
rpm
|
||||||
deb
|
deb
|
||||||
|
|
||||||
# a: - mtools filesystem
|
# a+ - mtools filesystem
|
||||||
a:
|
a+
|
||||||
|
|
||||||
# For browsing lslR listings (found on many ftp sites)
|
# For browsing lslR listings (found on many ftp sites)
|
||||||
lslR
|
lslR
|
||||||
|
|
||||||
# Hewlett Packard calculator
|
# Hewlett Packard calculator
|
||||||
hp48:
|
hp48+
|
||||||
|
|
||||||
# Commodore 64/128 d64/D64 files
|
# Commodore 64/128 d64/D64 files
|
||||||
uc1541
|
uc1541
|
||||||
@ -43,18 +43,18 @@ patchfs
|
|||||||
mailfs
|
mailfs
|
||||||
|
|
||||||
# List all installed RPM packages on the system
|
# List all installed RPM packages on the system
|
||||||
rpms:
|
rpms+
|
||||||
trpm
|
trpm
|
||||||
|
|
||||||
# dpkg frontend
|
# dpkg frontend
|
||||||
dpkg:
|
dpkg+
|
||||||
debd
|
debd
|
||||||
|
|
||||||
# apt frontend
|
# apt frontend
|
||||||
apt:
|
apt+
|
||||||
deba
|
deba
|
||||||
|
|
||||||
# Simple filesystem for audio cdroms. Use /dev/cdrom#audio (or /#audio).
|
# Simple filesystem for audio cdroms. Use /dev/cdrom#audio (or /#audio)
|
||||||
audio
|
audio
|
||||||
|
|
||||||
# Package of Bad Penguin (an Italian GNU/Linux distribution)
|
# Package of Bad Penguin (an Italian GNU/Linux distribution)
|
||||||
@ -64,5 +64,4 @@ bpp
|
|||||||
iso9660
|
iso9660
|
||||||
|
|
||||||
# Amazon S3
|
# Amazon S3
|
||||||
s3:
|
s3+
|
||||||
|
|
@ -344,10 +344,10 @@ static int sfs_init (struct vfs_class *me)
|
|||||||
|
|
||||||
(void) me;
|
(void) me;
|
||||||
|
|
||||||
mc_sfsini = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR "sfs.ini");
|
mc_sfsini = g_build_filename (mc_home, "sfs.ini", (char *) NULL);
|
||||||
cfg = fopen (mc_sfsini, "r");
|
cfg = fopen (mc_sfsini, "r");
|
||||||
|
|
||||||
if (!cfg){
|
if (cfg == NULL) {
|
||||||
fprintf (stderr, _("Warning: file %s not found\n"), mc_sfsini);
|
fprintf (stderr, _("Warning: file %s not found\n"), mc_sfsini);
|
||||||
g_free (mc_sfsini);
|
g_free (mc_sfsini);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user