summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:11:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:11:51 +0000
commita6f3675fc4e21b3f899286b9a02005368d913f74 (patch)
treec9bfa92b223783ff03b8e941c3bb0d36c68d3b5e /src
parentReleasing progress-linux version 3:4.8.30-1~progress7.99u1. (diff)
downloadmc-a6f3675fc4e21b3f899286b9a02005368d913f74.tar.xz
mc-a6f3675fc4e21b3f899286b9a02005368d913f74.zip
Merging upstream version 3:4.8.31.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in2
-rw-r--r--src/args.c4
-rw-r--r--src/background.c7
-rw-r--r--src/clipboard.c2
-rw-r--r--src/cons.handler.c2
-rw-r--r--src/consaver/Makefile.in2
-rw-r--r--src/consaver/cons.saver.c2
-rw-r--r--src/diffviewer/Makefile.in2
-rw-r--r--src/diffviewer/internal.h2
-rw-r--r--src/diffviewer/search.c5
-rw-r--r--src/diffviewer/ydiff.c569
-rw-r--r--src/editor/Makefile.in2
-rw-r--r--src/editor/bookmark.c2
-rw-r--r--src/editor/edit-impl.h4
-rw-r--r--src/editor/edit.c266
-rw-r--r--src/editor/editbuffer.c2
-rw-r--r--src/editor/editcmd.c167
-rw-r--r--src/editor/editcomplete.c2
-rw-r--r--src/editor/editdraw.c14
-rw-r--r--src/editor/editmacros.c2
-rw-r--r--src/editor/editmenu.c2
-rw-r--r--src/editor/editoptions.c2
-rw-r--r--src/editor/editsearch.c19
-rw-r--r--src/editor/editwidget.c12
-rw-r--r--src/editor/etags.c2
-rw-r--r--src/editor/format.c2
-rw-r--r--src/editor/spell.c2
-rw-r--r--src/editor/syntax.c118
-rw-r--r--src/events_init.c2
-rw-r--r--src/execute.c2
-rw-r--r--src/file_history.c2
-rw-r--r--src/filemanager/Makefile.am2
-rw-r--r--src/filemanager/Makefile.in5
-rw-r--r--src/filemanager/achown.c2
-rw-r--r--src/filemanager/boxes.c2
-rw-r--r--src/filemanager/cd.c2
-rw-r--r--src/filemanager/chattr.c2
-rw-r--r--src/filemanager/chmod.c2
-rw-r--r--src/filemanager/chown.c2
-rw-r--r--src/filemanager/cmd.c8
-rw-r--r--src/filemanager/cmd.h4
-rw-r--r--src/filemanager/command.c16
-rw-r--r--src/filemanager/dir.c2
-rw-r--r--src/filemanager/ext.c59
-rw-r--r--src/filemanager/file.c15
-rw-r--r--src/filemanager/filegui.c2
-rw-r--r--src/filemanager/filemanager.c12
-rw-r--r--src/filemanager/filenot.c2
-rw-r--r--src/filemanager/fileopctx.c2
-rw-r--r--src/filemanager/find.c2
-rw-r--r--src/filemanager/hotlist.c2
-rw-r--r--src/filemanager/info.c2
-rw-r--r--src/filemanager/layout.c5
-rw-r--r--src/filemanager/mountlist.c2
-rw-r--r--src/filemanager/panel.c19
-rw-r--r--src/filemanager/panelize.c2
-rw-r--r--src/filemanager/tree.c17
-rw-r--r--src/filemanager/treestore.c2
-rw-r--r--src/help.c52
-rw-r--r--src/keymap.c2
-rw-r--r--src/learn.c2
-rw-r--r--src/main.c16
-rw-r--r--src/man2hlp/Makefile.in2
-rw-r--r--src/man2hlp/man2hlp.in3
-rw-r--r--src/selcodepage.c2
-rw-r--r--src/setup.c14
-rw-r--r--src/subshell/Makefile.in2
-rw-r--r--src/subshell/common.c2
-rw-r--r--src/subshell/proxyfunc.c2
-rw-r--r--src/textconf.c18
-rw-r--r--src/usermenu.c59
-rw-r--r--src/util.c2
-rw-r--r--src/vfs/Makefile.am6
-rw-r--r--src/vfs/Makefile.in8
-rw-r--r--src/vfs/cpio/Makefile.in2
-rw-r--r--src/vfs/cpio/cpio.c2
-rw-r--r--src/vfs/extfs/Makefile.in2
-rw-r--r--src/vfs/extfs/extfs.c42
-rw-r--r--src/vfs/extfs/helpers/Makefile.in2
-rw-r--r--src/vfs/extfs/helpers/iso9660.in1
-rw-r--r--src/vfs/extfs/helpers/lslR.in1
-rw-r--r--src/vfs/extfs/helpers/mailfs.in3
-rw-r--r--src/vfs/extfs/helpers/patchfs.in5
-rw-r--r--src/vfs/extfs/helpers/s3+.in18
-rw-r--r--[-rwxr-xr-x]src/vfs/extfs/helpers/uc1541152
-rw-r--r--src/vfs/fish/helpers/Makefile.am10
-rw-r--r--src/vfs/fish/helpers/README.fish217
-rw-r--r--src/vfs/fish/helpers/append16
-rw-r--r--src/vfs/fish/helpers/chmod6
-rw-r--r--src/vfs/fish/helpers/chown6
-rw-r--r--src/vfs/fish/helpers/fexists3
-rw-r--r--src/vfs/fish/helpers/mkdir6
-rw-r--r--src/vfs/fish/helpers/mv6
-rw-r--r--src/vfs/fish/helpers/rmdir6
-rw-r--r--src/vfs/fish/helpers/send17
-rw-r--r--src/vfs/fish/helpers/unlink6
-rw-r--r--src/vfs/fish/helpers/utime13
-rw-r--r--src/vfs/ftpfs/Makefile.in2
-rw-r--r--src/vfs/ftpfs/ftpfs.c2
-rw-r--r--src/vfs/ftpfs/ftpfs_parse_ls.c2
-rw-r--r--src/vfs/local/Makefile.in2
-rw-r--r--src/vfs/local/local.c2
-rw-r--r--src/vfs/plugins_init.c12
-rw-r--r--src/vfs/sfs/Makefile.in2
-rw-r--r--src/vfs/sfs/sfs.c2
-rw-r--r--src/vfs/sfs/sfs.ini2
-rw-r--r--src/vfs/sftpfs/Makefile.in2
-rw-r--r--src/vfs/sftpfs/config_parser.c2
-rw-r--r--src/vfs/sftpfs/connection.c49
-rw-r--r--src/vfs/sftpfs/dir.c2
-rw-r--r--src/vfs/sftpfs/file.c2
-rw-r--r--src/vfs/sftpfs/internal.c2
-rw-r--r--src/vfs/sftpfs/sftpfs.c2
-rw-r--r--src/vfs/shell/Makefile.am (renamed from src/vfs/fish/Makefile.am)8
-rw-r--r--src/vfs/shell/Makefile.in (renamed from src/vfs/fish/Makefile.in)38
-rw-r--r--src/vfs/shell/helpers/Makefile.am10
-rw-r--r--src/vfs/shell/helpers/Makefile.in (renamed from src/vfs/fish/helpers/Makefile.in)60
-rw-r--r--src/vfs/shell/helpers/README.shell227
-rw-r--r--src/vfs/shell/helpers/append15
-rw-r--r--src/vfs/shell/helpers/chmod5
-rw-r--r--src/vfs/shell/helpers/chown5
-rw-r--r--src/vfs/shell/helpers/fexists2
-rw-r--r--src/vfs/shell/helpers/get (renamed from src/vfs/fish/helpers/get)17
-rw-r--r--src/vfs/shell/helpers/hardlink (renamed from src/vfs/fish/helpers/hardlink)5
-rw-r--r--src/vfs/shell/helpers/info (renamed from src/vfs/fish/helpers/info)14
-rw-r--r--src/vfs/shell/helpers/ln (renamed from src/vfs/fish/helpers/ln)5
-rw-r--r--src/vfs/shell/helpers/ls (renamed from src/vfs/fish/helpers/ls)58
-rw-r--r--src/vfs/shell/helpers/mkdir5
-rw-r--r--src/vfs/shell/helpers/mv5
-rw-r--r--src/vfs/shell/helpers/rmdir5
-rw-r--r--src/vfs/shell/helpers/send16
-rw-r--r--src/vfs/shell/helpers/unlink5
-rw-r--r--src/vfs/shell/helpers/utime12
-rw-r--r--src/vfs/shell/shell.c (renamed from src/vfs/fish/fish.c)652
-rw-r--r--src/vfs/shell/shell.h (renamed from src/vfs/fish/fish.h)12
-rw-r--r--src/vfs/shell/shelldef.h (renamed from src/vfs/fish/fishdef.h)150
-rw-r--r--src/vfs/tar/Makefile.in2
-rw-r--r--src/vfs/tar/tar-internal.c21
-rw-r--r--src/vfs/tar/tar-internal.h3
-rw-r--r--src/vfs/tar/tar-sparse.c16
-rw-r--r--src/vfs/tar/tar-xheader.c2
-rw-r--r--src/vfs/tar/tar.c22
-rw-r--r--src/vfs/undelfs/Makefile.in2
-rw-r--r--src/vfs/undelfs/undelfs.c2
-rw-r--r--src/viewer/Makefile.in2
-rw-r--r--src/viewer/actions_cmd.c24
-rw-r--r--src/viewer/ascii.c2
-rw-r--r--src/viewer/coord_cache.c2
-rw-r--r--src/viewer/datasource.c2
-rw-r--r--src/viewer/dialogs.c2
-rw-r--r--src/viewer/display.c2
-rw-r--r--src/viewer/growbuf.c2
-rw-r--r--src/viewer/hex.c2
-rw-r--r--src/viewer/lib.c2
-rw-r--r--src/viewer/mcviewer.c2
-rw-r--r--src/viewer/move.c2
-rw-r--r--src/viewer/nroff.c2
-rw-r--r--src/viewer/search.c2
158 files changed, 1853 insertions, 1840 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index 0a4b851..3fdbaed 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -148,7 +148,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
diff --git a/src/args.c b/src/args.c
index a66777e..8831f38 100644
--- a/src/args.c
+++ b/src/args.c
@@ -1,7 +1,7 @@
/*
Handle command line arguments.
- Copyright (C) 2009-2023
+ Copyright (C) 2009-2024
Free Software Foundation, Inc.
Written by:
@@ -345,7 +345,7 @@ mc_args_new_color_group (void)
" errdhotfocus\n"
" Menus: menunormal, menuhot, menusel, menuhotsel, menuinactive\n"
" Popup menus: pmenunormal, pmenusel, pmenutitle\n"
- " Editor: editnormal, editbold, editmarked, editwhitespace,\n"
+ " Editor: editnormal, editbold, editmarked, editwhitespace, editnonprintable,\n"
" editlinestate, editbg, editframe, editframeactive\n"
" editframedrag\n"
" Viewer: viewnormal,viewbold, viewunderline, viewselected\n"
diff --git a/src/background.c b/src/background.c
index 41a7f40..74c449e 100644
--- a/src/background.c
+++ b/src/background.c
@@ -2,7 +2,7 @@
/* Background support.
- Copyright (C) 1996-2023
+ Copyright (C) 1996-2024
Free Software Foundation, Inc.
Written by:
@@ -553,7 +553,10 @@ do_background (file_op_context_t * ctx, char *info)
{
int nullfd;
+ (void) close (comm[0]);
parent_fd = comm[1];
+
+ (void) close (back_comm[1]);
from_parent_fd = back_comm[0];
mc_global.we_are_background = TRUE;
@@ -580,6 +583,8 @@ do_background (file_op_context_t * ctx, char *info)
}
else
{
+ (void) close (comm[1]);
+ (void) close (back_comm[0]);
ctx->pid = pid;
register_task_running (ctx, pid, comm[0], back_comm[1], info);
return 1;
diff --git a/src/clipboard.c b/src/clipboard.c
index 3c31cb0..a919792 100644
--- a/src/clipboard.c
+++ b/src/clipboard.c
@@ -1,7 +1,7 @@
/*
Util for external clipboard.
- Copyright (C) 2009-2023
+ Copyright (C) 2009-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/cons.handler.c b/src/cons.handler.c
index d747ff3..5f58a42 100644
--- a/src/cons.handler.c
+++ b/src/cons.handler.c
@@ -1,7 +1,7 @@
/*
Client interface for General purpose Linux console save/restore server
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
This file is part of the Midnight Commander.
diff --git a/src/consaver/Makefile.in b/src/consaver/Makefile.in
index 1945611..bb55429 100644
--- a/src/consaver/Makefile.in
+++ b/src/consaver/Makefile.in
@@ -134,7 +134,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
diff --git a/src/consaver/cons.saver.c b/src/consaver/cons.saver.c
index 4867ab6..dda9c41 100644
--- a/src/consaver/cons.saver.c
+++ b/src/consaver/cons.saver.c
@@ -11,7 +11,7 @@
Partly rewritten by Jakub Jelinek <jakub@redhat.com>.
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
This file is part of the Midnight Commander.
diff --git a/src/diffviewer/Makefile.in b/src/diffviewer/Makefile.in
index cb5729e..b81b2dc 100644
--- a/src/diffviewer/Makefile.in
+++ b/src/diffviewer/Makefile.in
@@ -134,7 +134,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
diff --git a/src/diffviewer/internal.h b/src/diffviewer/internal.h
index 728d4b5..ad6fcb2 100644
--- a/src/diffviewer/internal.h
+++ b/src/diffviewer/internal.h
@@ -108,7 +108,7 @@ typedef struct WDiff
gboolean new_frame;
int skip_rows;
int skip_cols;
- int display_symbols;
+ gboolean display_symbols;
int display_numbers;
gboolean show_cr;
int tab_size;
diff --git a/src/diffviewer/search.c b/src/diffviewer/search.c
index 77d09cd..e4cc306 100644
--- a/src/diffviewer/search.c
+++ b/src/diffviewer/search.c
@@ -1,7 +1,7 @@
/*
Search functions for diffviewer.
- Copyright (C) 2010-2023
+ Copyright (C) 2010-2024
Free Software Foundation, Inc.
Written by:
@@ -85,7 +85,8 @@ mcdiffview_dialog_search (WDiff * dview)
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_LABELED_INPUT (N_("Enter search string:"), input_label_above, INPUT_LAST_TEXT,
- MC_HISTORY_SHARED_SEARCH, &exp, NULL, FALSE, FALSE, INPUT_COMPLETE_NONE),
+ MC_HISTORY_SHARED_SEARCH, &exp, NULL, FALSE, FALSE,
+ INPUT_COMPLETE_NONE),
QUICK_SEPARATOR (TRUE),
QUICK_START_COLUMNS,
QUICK_RADIO (num_of_types, (const char **) list_of_types,
diff --git a/src/diffviewer/ydiff.c b/src/diffviewer/ydiff.c
index 3afb8af..c6c12dd 100644
--- a/src/diffviewer/ydiff.c
+++ b/src/diffviewer/ydiff.c
@@ -1,7 +1,7 @@
/*
File difference viewer
- Copyright (C) 2007-2023
+ Copyright (C) 2007-2024
Free Software Foundation, Inc.
Written by:
@@ -71,19 +71,6 @@
/*** file scope macro definitions ****************************************************************/
-#define g_array_foreach(a, TP, cbf) \
-do { \
- size_t g_array_foreach_i;\
- \
- for (g_array_foreach_i = 0; g_array_foreach_i < a->len; g_array_foreach_i++) \
- { \
- TP *g_array_foreach_var; \
- \
- g_array_foreach_var = &g_array_index (a, TP, g_array_foreach_i); \
- (*cbf) (g_array_foreach_var); \
- } \
-} while (0)
-
#define FILE_READ_BUF 4096
#define FILE_FLAG_TEMP (1 << 0)
@@ -131,6 +118,23 @@ TAB_SKIP (int ts, int pos)
/* --------------------------------------------------------------------------------------------- */
+/**
+ * Fill buffer by spaces
+ *
+ * @param buf buffer
+ * @param n number of spaces
+ * @param zero_terminate add a nul after @n spaces
+ */
+static void
+fill_by_space (char *buf, size_t n, gboolean zero_terminate)
+{
+ memset (buf, ' ', n);
+ if (zero_terminate)
+ buf[n] = '\0';
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
static gboolean
rewrite_backup_content (const vfs_path_t * from_file_name_vpath, const char *to_file_name)
{
@@ -196,7 +200,7 @@ open_temp (void **name)
*/
static FBUF *
-f_dopen (int fd)
+dview_fdopen (int fd)
{
FBUF *fs;
@@ -232,11 +236,11 @@ f_dopen (int fd)
*/
static int
-f_free (FBUF * fs)
+dview_ffree (FBUF * fs)
{
int rv = 0;
- if (fs->flags & FILE_FLAG_TEMP)
+ if ((fs->flags & FILE_FLAG_TEMP) != 0)
{
rv = unlink (fs->data);
g_free (fs->data);
@@ -255,19 +259,19 @@ f_free (FBUF * fs)
* @return file structure
*/
static FBUF *
-f_temp (void)
+dview_ftemp (void)
{
int fd;
FBUF *fs;
- fs = f_dopen (0);
+ fs = dview_fdopen (0);
if (fs == NULL)
return NULL;
fd = open_temp (&fs->data);
if (fd < 0)
{
- f_free (fs);
+ dview_ffree (fs);
return NULL;
}
@@ -288,19 +292,19 @@ f_temp (void)
*/
static FBUF *
-f_open (const char *filename, int flags)
+dview_fopen (const char *filename, int flags)
{
int fd;
FBUF *fs;
- fs = f_dopen (0);
+ fs = dview_fdopen (0);
if (fs == NULL)
return NULL;
fd = open (filename, flags);
if (fd < 0)
{
- f_free (fs);
+ dview_ffree (fs);
return NULL;
}
@@ -323,20 +327,20 @@ f_open (const char *filename, int flags)
*/
static size_t
-f_gets (char *buf, size_t size, FBUF * fs)
+dview_fgets (char *buf, size_t size, FBUF * fs)
{
size_t j = 0;
do
{
int i;
- int stop = 0;
+ gboolean stop = FALSE;
for (i = fs->pos; j < size && i < fs->len && !stop; i++, j++)
{
buf[j] = fs->buf[i];
if (buf[j] == '\n')
- stop = 1;
+ stop = TRUE;
}
fs->pos = i;
@@ -365,11 +369,11 @@ f_gets (char *buf, size_t size, FBUF * fs)
*/
static off_t
-f_seek (FBUF * fs, off_t off, int whence)
+dview_fseek (FBUF * fs, off_t off, int whence)
{
off_t rv;
- if (fs->len && whence != SEEK_END)
+ if (fs->len != 0 && whence != SEEK_END)
{
rv = lseek (fs->fd, 0, SEEK_CUR);
if (rv != -1)
@@ -404,7 +408,7 @@ f_seek (FBUF * fs, off_t off, int whence)
*/
static off_t
-f_reset (FBUF * fs)
+dview_freset (FBUF * fs)
{
off_t rv;
@@ -428,7 +432,7 @@ f_reset (FBUF * fs)
*/
static ssize_t
-f_write (FBUF * fs, const char *buf, size_t size)
+dview_fwrite (FBUF * fs, const char *buf, size_t size)
{
ssize_t rv;
@@ -450,7 +454,7 @@ f_write (FBUF * fs, const char *buf, size_t size)
*/
static off_t
-f_trunc (FBUF * fs)
+dview_ftrunc (FBUF * fs)
{
off_t off;
@@ -479,14 +483,14 @@ f_trunc (FBUF * fs)
*/
static int
-f_close (FBUF * fs)
+dview_fclose (FBUF * fs)
{
int rv = -1;
if (fs != NULL)
{
rv = close (fs->fd);
- f_free (fs);
+ dview_ffree (fs);
}
return rv;
@@ -504,7 +508,7 @@ f_close (FBUF * fs)
*/
static FBUF *
-p_open (const char *cmd, int flags)
+dview_popen (const char *cmd, int flags)
{
FILE *f;
FBUF *fs;
@@ -518,14 +522,14 @@ p_open (const char *cmd, int flags)
if (type == NULL)
return NULL;
- fs = f_dopen (0);
+ fs = dview_fdopen (0);
if (fs == NULL)
return NULL;
f = popen (cmd, type);
if (f == NULL)
{
- f_free (fs);
+ dview_ffree (fs);
return NULL;
}
@@ -544,14 +548,14 @@ p_open (const char *cmd, int flags)
*/
static int
-p_close (FBUF * fs)
+dview_pclose (FBUF * fs)
{
int rv = -1;
if (fs != NULL)
{
rv = pclose (fs->data);
- f_free (fs);
+ dview_ffree (fs);
}
return rv;
@@ -694,7 +698,7 @@ scan_line (const char *p, GArray * ops)
int f1, f2;
int t1, t2;
int cmd;
- int range;
+ gboolean range = FALSE;
/* handle the following cases:
* NUMaNUM[,NUM]
@@ -707,20 +711,19 @@ scan_line (const char *p, GArray * ops)
return -1;
f2 = f1;
- range = 0;
if (*p == ',')
{
p++;
if (scan_deci (&p, &f2) != 0 || f2 < f1)
return -1;
- range = 1;
+ range = TRUE;
}
cmd = *p++;
if (cmd == 'a')
{
- if (range != 0)
+ if (range)
return -1;
}
else if (cmd != 'c' && cmd != 'd')
@@ -730,17 +733,17 @@ scan_line (const char *p, GArray * ops)
return -1;
t2 = t1;
- range = 0;
+ range = FALSE;
if (*p == ',')
{
p++;
if (scan_deci (&p, &t2) != 0 || t2 < t1)
return -1;
- range = 1;
+ range = TRUE;
}
- if (cmd == 'd' && range != 0)
+ if (cmd == 'd' && range)
return -1;
op.a[0][0] = f1;
@@ -768,7 +771,7 @@ scan_diff (FBUF * f, GArray * ops)
int sz;
char buf[BUFSIZ];
- while ((sz = f_gets (buf, sizeof (buf) - 1, f)) != 0)
+ while ((sz = dview_fgets (buf, sizeof (buf) - 1, f)) != 0)
{
if (isdigit (buf[0]))
{
@@ -778,12 +781,10 @@ scan_diff (FBUF * f, GArray * ops)
buf[sz] = '\0';
if (scan_line (buf, ops) != 0)
return -1;
-
- continue;
}
-
- while (buf[sz - 1] != '\n' && (sz = f_gets (buf, sizeof (buf), f)) != 0)
- ;
+ else
+ while (buf[sz - 1] != '\n' && (sz = dview_fgets (buf, sizeof (buf), f)) != 0)
+ ;
}
return ops->len;
@@ -829,14 +830,14 @@ dff_execute (const char *args, const char *extra, const char *file1, const char
if (cmd == NULL)
return -1;
- f = p_open (cmd, O_RDONLY);
+ f = dview_popen (cmd, O_RDONLY);
g_free (cmd);
if (f == NULL)
return -1;
rv = scan_diff (f, ops);
- code = p_close (f);
+ code = dview_pclose (f);
if (rv < 0 || code == -1 || !WIFEXITED (code) || WEXITSTATUS (code) == 2)
rv = -1;
@@ -846,6 +847,38 @@ dff_execute (const char *args, const char *extra, const char *file1, const char
/* --------------------------------------------------------------------------------------------- */
+static gboolean
+printer_for (char ch, DFUNC printer, void *ctx, FBUF * f, int *line, off_t * off)
+{
+ size_t sz;
+ char buf[BUFSIZ];
+
+ sz = dview_fgets (buf, sizeof (buf), f);
+ if (sz == 0)
+ return FALSE;
+
+ (*line)++;
+ printer (ctx, ch, *line, *off, sz, buf);
+ *off += sz;
+
+ while (buf[sz - 1] != '\n')
+ {
+ sz = dview_fgets (buf, sizeof (buf), f);
+ if (sz == 0)
+ {
+ printer (ctx, 0, 0, 0, 1, "\n");
+ break;
+ }
+
+ printer (ctx, 0, 0, 0, sz, buf);
+ *off += sz;
+ }
+
+ return TRUE;
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
/**
* Reparse and display file according to diff statements.
*
@@ -863,29 +896,30 @@ dff_reparse (diff_place_t ord, const char *filename, const GArray * ops, DFUNC p
{
size_t i;
FBUF *f;
- size_t sz;
- char buf[BUFSIZ];
int line = 0;
off_t off = 0;
const DIFFCMD *op;
diff_place_t eff;
- int add_cmd;
- int del_cmd;
+ int add_cmd, del_cmd;
- f = f_open (filename, O_RDONLY);
+ f = dview_fopen (filename, O_RDONLY);
if (f == NULL)
return -1;
- ord &= 1;
+ if (ord != DIFF_LEFT)
+ ord = DIFF_RIGHT;
eff = ord;
- add_cmd = 'a';
- del_cmd = 'd';
- if (ord != 0)
+ if (ord != DIFF_LEFT)
{
add_cmd = 'd';
del_cmd = 'a';
}
+ else
+ {
+ add_cmd = 'a';
+ del_cmd = 'd';
+ }
#define F1 a[eff][0]
#define F2 a[eff][1]
#define T1 a[ ord^1 ][0]
@@ -895,60 +929,26 @@ dff_reparse (diff_place_t ord, const char *filename, const GArray * ops, DFUNC p
int n;
op = &g_array_index (ops, DIFFCMD, i);
- n = op->F1 - (op->cmd != add_cmd);
- while (line < n && (sz = f_gets (buf, sizeof (buf), f)) != 0)
- {
- line++;
- printer (ctx, EQU_CH, line, off, sz, buf);
- off += sz;
- while (buf[sz - 1] != '\n')
- {
- sz = f_gets (buf, sizeof (buf), f);
- if (sz == 0)
- {
- printer (ctx, 0, 0, 0, 1, "\n");
- break;
- }
- printer (ctx, 0, 0, 0, sz, buf);
- off += sz;
- }
- }
+ n = op->F1;
+ if (op->cmd != add_cmd)
+ n--;
+
+ while (line < n && printer_for (EQU_CH, printer, ctx, f, &line, &off))
+ ;
if (line != n)
goto err;
if (op->cmd == add_cmd)
- {
- n = op->T2 - op->T1 + 1;
- while (n != 0)
- {
+ for (n = op->T2 - op->T1 + 1; n != 0; n--)
printer (ctx, DEL_CH, 0, 0, 1, "\n");
- n--;
- }
- }
if (op->cmd == del_cmd)
{
- n = op->F2 - op->F1 + 1;
- while (n != 0 && (sz = f_gets (buf, sizeof (buf), f)) != 0)
- {
- line++;
- printer (ctx, ADD_CH, line, off, sz, buf);
- off += sz;
- while (buf[sz - 1] != '\n')
- {
- sz = f_gets (buf, sizeof (buf), f);
- if (sz == 0)
- {
- printer (ctx, 0, 0, 0, 1, "\n");
- break;
- }
- printer (ctx, 0, 0, 0, sz, buf);
- off += sz;
- }
- n--;
- }
+ for (n = op->F2 - op->F1 + 1;
+ n != 0 && printer_for (ADD_CH, printer, ctx, f, &line, &off); n--)
+ ;
if (n != 0)
goto err;
@@ -956,35 +956,15 @@ dff_reparse (diff_place_t ord, const char *filename, const GArray * ops, DFUNC p
if (op->cmd == 'c')
{
- n = op->F2 - op->F1 + 1;
- while (n != 0 && (sz = f_gets (buf, sizeof (buf), f)) != 0)
- {
- line++;
- printer (ctx, CHG_CH, line, off, sz, buf);
- off += sz;
- while (buf[sz - 1] != '\n')
- {
- sz = f_gets (buf, sizeof (buf), f);
- if (sz == 0)
- {
- printer (ctx, 0, 0, 0, 1, "\n");
- break;
- }
- printer (ctx, 0, 0, 0, sz, buf);
- off += sz;
- }
- n--;
- }
+ for (n = op->F2 - op->F1 + 1;
+ n != 0 && printer_for (CHG_CH, printer, ctx, f, &line, &off); n--)
+ ;
if (n != 0)
goto err;
- n = op->T2 - op->T1 - (op->F2 - op->F1);
- while (n > 0)
- {
+ for (n = op->T2 - op->T1 - (op->F2 - op->F1); n > 0; n--)
printer (ctx, CHG_CH, 0, 0, 1, "\n");
- n--;
- }
}
}
#undef T2
@@ -992,29 +972,14 @@ dff_reparse (diff_place_t ord, const char *filename, const GArray * ops, DFUNC p
#undef F2
#undef F1
- while ((sz = f_gets (buf, sizeof (buf), f)) != 0)
- {
- line++;
- printer (ctx, EQU_CH, line, off, sz, buf);
- off += sz;
- while (buf[sz - 1] != '\n')
- {
- sz = f_gets (buf, sizeof (buf), f);
- if (sz == 0)
- {
- printer (ctx, 0, 0, 0, 1, "\n");
- break;
- }
- printer (ctx, 0, 0, 0, sz, buf);
- off += sz;
- }
- }
+ while (printer_for (EQU_CH, printer, ctx, f, &line, &off))
+ ;
- f_close (f);
+ dview_fclose (f);
return 0;
err:
- f_close (f);
+ dview_fclose (f);
return -1;
}
@@ -1145,8 +1110,6 @@ hdiff_multi (const char *s, const char *t, const BRACKET bracket, int min, GArra
int len;
ret = g_array_new (FALSE, TRUE, sizeof (PAIR));
- if (ret == NULL)
- return FALSE;
len = lcsubstr (s + bracket[DIFF_LEFT].off, bracket[DIFF_LEFT].len,
t + bracket[DIFF_RIGHT].off, bracket[DIFF_RIGHT].len, ret, min);
@@ -1295,9 +1258,8 @@ cvt_cpy (char *dst, const char *src, size_t srcsize, int base, int ts)
j = TAB_SKIP (ts, i + base);
i += j - 1;
- while (j-- > 0)
- *dst++ = ' ';
- dst--;
+ fill_by_space (dst, j, FALSE);
+ dst += j - 1;
}
}
return i + base;
@@ -1339,9 +1301,8 @@ cvt_ncpy (char *dst, int dstsize, const char **_src, size_t srcsize, int base, i
if (j > dstsize - i)
j = dstsize - i;
i += j - 1;
- while (j-- > 0)
- *dst++ = ' ';
- dst--;
+ fill_by_space (dst, j, FALSE);
+ dst += j - 1;
}
}
*_src = src;
@@ -1435,12 +1396,9 @@ cvt_mget (const char *src, size_t srcsize, char *dst, int dstsize, int skip, int
}
sz = dst - tmp;
}
- while (dstsize != 0)
- {
- dstsize--;
- *dst++ = ' ';
- }
- *dst = '\0';
+
+ fill_by_space (dst, dstsize, TRUE);
+
return sz;
}
@@ -1538,13 +1496,10 @@ cvt_mgeta (const char *src, size_t srcsize, char *dst, int dstsize, int skip, in
}
sz = dst - tmp;
}
- while (dstsize != 0)
- {
- dstsize--;
- *att++ = '\0';
- *dst++ = ' ';
- }
- *dst = '\0';
+
+ memset (att, '\0', dstsize);
+ fill_by_space (dst, dstsize, TRUE);
+
return sz;
}
@@ -1581,17 +1536,16 @@ cvt_fget (FBUF * f, off_t off, char *dst, size_t dstsize, int skip, int ts, gboo
if (sizeof (tmp) < amount || sizeof (tmp) <= dstsize || sizeof (cvt) < 8 * amount)
{
/* abnormal, but avoid buffer overflow */
- memset (dst, ' ', dstsize);
- dst[dstsize] = '\0';
+ fill_by_space (dst, dstsize, TRUE);
return 0;
}
- f_seek (f, off, SEEK_SET);
+ dview_fseek (f, off, SEEK_SET);
while (skip > base)
{
old_base = base;
- sz = f_gets (tmp, amount, f);
+ sz = dview_fgets (tmp, amount, f);
if (sz == 0)
break;
@@ -1606,8 +1560,7 @@ cvt_fget (FBUF * f, off_t off, char *dst, size_t dstsize, int skip, int ts, gboo
if (base < skip)
{
- memset (dst, ' ', dstsize);
- dst[dstsize] = '\0';
+ fill_by_space (dst, dstsize, TRUE);
return 0;
}
@@ -1621,7 +1574,7 @@ cvt_fget (FBUF * f, off_t off, char *dst, size_t dstsize, int skip, int ts, gboo
if (q == NULL)
{
- sz = f_gets (tmp, dstsize - useful + 1, f);
+ sz = dview_fgets (tmp, dstsize - useful + 1, f);
if (sz != 0)
{
const char *ptr = tmp;
@@ -1642,7 +1595,6 @@ cvt_fget (FBUF * f, off_t off, char *dst, size_t dstsize, int skip, int ts, gboo
dst[sz] = lastch;
for (i = 0; i < sz && dst[i] != '\n'; i++)
- {
if (dst[i] == '\r' && dst[i + 1] == '\n')
{
if (show_cr)
@@ -1653,17 +1605,13 @@ cvt_fget (FBUF * f, off_t off, char *dst, size_t dstsize, int skip, int ts, gboo
dst[i++] = 'M';
}
else
- {
dst[i++] = '*';
- }
}
break;
}
- }
- for (; i < dstsize; i++)
- dst[i] = ' ';
- dst[i] = '\0';
+ fill_by_space (dst, dstsize, TRUE);
+
return sz;
}
@@ -1671,9 +1619,9 @@ cvt_fget (FBUF * f, off_t off, char *dst, size_t dstsize, int skip, int ts, gboo
/* diff printers et al ****************************************************** */
static void
-cc_free_elt (void *elt)
+cc_free_elt (gpointer elt)
{
- DIFFLN *p = elt;
+ DIFFLN *p = (DIFFLN *) elt;
if (p != NULL)
g_free (p->p);
@@ -1727,7 +1675,7 @@ printer (void *ctx, int ch, int line, off_t off, size_t sz, const char *str)
if (dsrc == DATA_SRC_TMP && (line != 0 || ch == 0))
{
FBUF *f = ((PRINTER_CTX *) ctx)->f;
- f_write (f, str, sz);
+ dview_fwrite (f, str, sz);
}
return 0;
}
@@ -1741,8 +1689,8 @@ redo_diff (WDiff * dview)
PRINTER_CTX ctx;
GArray *ops;
int ndiff;
- int rv;
- char extra[256];
+ int rv = 0;
+ char extra[BUF_MEDIUM];
extra[0] = '\0';
if (dview->opt.quality == 2)
@@ -1762,8 +1710,8 @@ redo_diff (WDiff * dview)
if (dview->dsrc != DATA_SRC_MEM)
{
- f_reset (f[DIFF_LEFT]);
- f_reset (f[DIFF_RIGHT]);
+ dview_freset (f[DIFF_LEFT]);
+ dview_freset (f[DIFF_RIGHT]);
}
ops = g_array_new (FALSE, FALSE, sizeof (DIFFCMD));
@@ -1776,8 +1724,6 @@ redo_diff (WDiff * dview)
}
ctx.dsrc = dview->dsrc;
-
- rv = 0;
ctx.a = dview->a[DIFF_LEFT];
ctx.f = f[DIFF_LEFT];
rv |= dff_reparse (DIFF_LEFT, dview->file[DIFF_LEFT], ops, printer, &ctx);
@@ -1794,44 +1740,40 @@ redo_diff (WDiff * dview)
if (dview->dsrc == DATA_SRC_TMP)
{
- f_trunc (f[DIFF_LEFT]);
- f_trunc (f[DIFF_RIGHT]);
+ dview_ftrunc (f[DIFF_LEFT]);
+ dview_ftrunc (f[DIFF_RIGHT]);
}
if (dview->dsrc == DATA_SRC_MEM && HDIFF_ENABLE)
{
+ size_t i;
+
dview->hdiff = g_ptr_array_new ();
- if (dview->hdiff != NULL)
+
+ for (i = 0; i < dview->a[DIFF_LEFT]->len; i++)
{
- size_t i;
+ GArray *h = NULL;
+ const DIFFLN *p;
+ const DIFFLN *q;
- for (i = 0; i < dview->a[DIFF_LEFT]->len; i++)
+ p = &g_array_index (dview->a[DIFF_LEFT], DIFFLN, i);
+ q = &g_array_index (dview->a[DIFF_RIGHT], DIFFLN, i);
+ if (p->line != 0 && q->line != 0 && p->ch == CHG_CH)
{
- GArray *h = NULL;
- const DIFFLN *p;
- const DIFFLN *q;
+ gboolean runresult;
- p = &g_array_index (dview->a[DIFF_LEFT], DIFFLN, i);
- q = &g_array_index (dview->a[DIFF_RIGHT], DIFFLN, i);
- if (p->line && q->line && p->ch == CHG_CH)
- {
- h = g_array_new (FALSE, FALSE, sizeof (BRACKET));
- if (h != NULL)
- {
- gboolean runresult;
+ h = g_array_new (FALSE, FALSE, sizeof (BRACKET));
- runresult =
- hdiff_scan (p->p, p->u.len, q->p, q->u.len, HDIFF_MINCTX, h,
- HDIFF_DEPTH);
- if (!runresult)
- {
- g_array_free (h, TRUE);
- h = NULL;
- }
- }
+ runresult =
+ hdiff_scan (p->p, p->u.len, q->p, q->u.len, HDIFF_MINCTX, h, HDIFF_DEPTH);
+ if (!runresult)
+ {
+ g_array_free (h, TRUE);
+ h = NULL;
}
- g_ptr_array_add (dview->hdiff, h);
}
+
+ g_ptr_array_add (dview->hdiff, h);
}
}
return ndiff;
@@ -1874,7 +1816,7 @@ get_digits (unsigned int n)
{
int d = 1;
- while (n /= 10)
+ while ((n /= 10) != 0)
d++;
return d;
}
@@ -1935,19 +1877,19 @@ static int
find_prev_hunk (const GArray * a, int pos)
{
#if 1
- while (pos > 0 && ((DIFFLN *) & g_array_index (a, DIFFLN, pos))->ch != EQU_CH)
- pos--;
- while (pos > 0 && ((DIFFLN *) & g_array_index (a, DIFFLN, pos))->ch == EQU_CH)
- pos--;
- while (pos > 0 && ((DIFFLN *) & g_array_index (a, DIFFLN, pos))->ch != EQU_CH)
- pos--;
+ for (; pos > 0 && ((DIFFLN *) & g_array_index (a, DIFFLN, pos))->ch != EQU_CH; pos--)
+ ;
+ for (; pos > 0 && ((DIFFLN *) & g_array_index (a, DIFFLN, pos))->ch == EQU_CH; pos--)
+ ;
+ for (; pos > 0 && ((DIFFLN *) & g_array_index (a, DIFFLN, pos))->ch != EQU_CH; pos--)
+ ;
if (pos > 0 && (size_t) pos < a->len)
pos++;
#else
- while (pos > 0 && ((DIFFLN *) & g_array_index (a, DIFFLN, pos - 1))->ch == EQU_CH)
- pos--;
- while (pos > 0 && ((DIFFLN *) & g_array_index (a, DIFFLN, pos - 1))->ch != EQU_CH)
- pos--;
+ for (; pos > 0 && ((DIFFLN *) & g_array_index (a, DIFFLN, pos - 1))->ch == EQU_CH; pos--)
+ ;
+ for (; pos > 0 && ((DIFFLN *) & g_array_index (a, DIFFLN, pos - 1))->ch != EQU_CH; pos--)
+ ;
#endif
return pos;
@@ -1958,10 +1900,10 @@ find_prev_hunk (const GArray * a, int pos)
static size_t
find_next_hunk (const GArray * a, size_t pos)
{
- while (pos < a->len && ((DIFFLN *) & g_array_index (a, DIFFLN, pos))->ch != EQU_CH)
- pos++;
- while (pos < a->len && ((DIFFLN *) & g_array_index (a, DIFFLN, pos))->ch == EQU_CH)
- pos++;
+ for (; pos < a->len && ((DIFFLN *) & g_array_index (a, DIFFLN, pos))->ch != EQU_CH; pos++)
+ ;
+ for (; pos < a->len && ((DIFFLN *) & g_array_index (a, DIFFLN, pos))->ch == EQU_CH; pos++)
+ ;
return pos;
}
@@ -2009,15 +1951,17 @@ get_current_hunk (WDiff * dview, int *start_line1, int *end_line1, int *start_li
default:
break;
}
- while (pos > 0 && ((DIFFLN *) & g_array_index (a0, DIFFLN, pos))->ch != EQU_CH)
- pos--;
+
+ for (; pos > 0 && ((DIFFLN *) & g_array_index (a0, DIFFLN, pos))->ch != EQU_CH; pos--)
+ ;
if (pos > 0)
{
*start_line1 = ((DIFFLN *) & g_array_index (a0, DIFFLN, pos))->line + 1;
*start_line2 = ((DIFFLN *) & g_array_index (a1, DIFFLN, pos))->line + 1;
}
- pos = dview->skip_rows;
- while (pos < a0->len && ((DIFFLN *) & g_array_index (a0, DIFFLN, pos))->ch != EQU_CH)
+
+ for (pos = dview->skip_rows;
+ pos < a0->len && ((DIFFLN *) & g_array_index (a0, DIFFLN, pos))->ch != EQU_CH; pos++)
{
int l0, l1;
@@ -2027,7 +1971,6 @@ get_current_hunk (WDiff * dview, int *start_line1, int *end_line1, int *start_li
*end_line1 = MAX (*start_line1, l0);
if (l1 > 0)
*end_line2 = MAX (*start_line2, l1);
- pos++;
}
}
return res;
@@ -2057,12 +2000,9 @@ dview_remove_hunk (WDiff * dview, FILE * merge_file, int from1, int to1,
else
f0 = fopen (dview->file[DIFF_LEFT], "r");
- line = 0;
- while (fgets (buf, sizeof (buf), f0) != NULL && line < from1 - 1)
- {
- line++;
+ for (line = 0; fgets (buf, sizeof (buf), f0) != NULL && line < from1 - 1; line++)
fputs (buf, merge_file);
- }
+
while (fgets (buf, sizeof (buf), f0) != NULL)
{
line++;
@@ -2090,8 +2030,7 @@ dview_add_hunk (WDiff * dview, FILE * merge_file, int from1, int from2, int to2,
{
int line;
char buf[BUF_10K];
- FILE *f0;
- FILE *f1;
+ FILE *f0, *f1;
if (merge_direction == FROM_RIGHT_TO_LEFT)
{
@@ -2104,14 +2043,9 @@ dview_add_hunk (WDiff * dview, FILE * merge_file, int from1, int from2, int to2,
f1 = fopen (dview->file[DIFF_RIGHT], "r");
}
- line = 0;
- while (fgets (buf, sizeof (buf), f0) != NULL && line < from1 - 1)
- {
- line++;
+ for (line = 0; fgets (buf, sizeof (buf), f0) != NULL && line < from1 - 1; line++)
fputs (buf, merge_file);
- }
- line = 0;
- while (fgets (buf, sizeof (buf), f1) != NULL && line <= to2)
+ for (line = 0; fgets (buf, sizeof (buf), f1) != NULL && line <= to2;)
{
line++;
if (line >= from2)
@@ -2141,10 +2075,9 @@ static void
dview_replace_hunk (WDiff * dview, FILE * merge_file, int from1, int to1, int from2, int to2,
action_direction_t merge_direction)
{
- int line1 = 0, line2 = 0;
+ int line1, line2;
char buf[BUF_10K];
- FILE *f0;
- FILE *f1;
+ FILE *f0, *f1;
if (merge_direction == FROM_RIGHT_TO_LEFT)
{
@@ -2157,12 +2090,9 @@ dview_replace_hunk (WDiff * dview, FILE * merge_file, int from1, int to1, int fr
f1 = fopen (dview->file[DIFF_RIGHT], "r");
}
- while (fgets (buf, sizeof (buf), f0) != NULL && line1 < from1 - 1)
- {
- line1++;
+ for (line1 = 0; fgets (buf, sizeof (buf), f0) != NULL && line1 < from1 - 1; line1++)
fputs (buf, merge_file);
- }
- while (fgets (buf, sizeof (buf), f1) != NULL && line2 <= to2)
+ for (line2 = 0; fgets (buf, sizeof (buf), f1) != NULL && line2 <= to2;)
{
line2++;
if (line2 >= from2)
@@ -2295,18 +2225,14 @@ dview_reread (WDiff * dview)
destroy_hdiff (dview);
if (dview->a[DIFF_LEFT] != NULL)
- {
- g_array_foreach (dview->a[DIFF_LEFT], DIFFLN, cc_free_elt);
g_array_free (dview->a[DIFF_LEFT], TRUE);
- }
if (dview->a[DIFF_RIGHT] != NULL)
- {
- g_array_foreach (dview->a[DIFF_RIGHT], DIFFLN, cc_free_elt);
g_array_free (dview->a[DIFF_RIGHT], TRUE);
- }
dview->a[DIFF_LEFT] = g_array_new (FALSE, FALSE, sizeof (DIFFLN));
+ g_array_set_clear_func (dview->a[DIFF_LEFT], cc_free_elt);
dview->a[DIFF_RIGHT] = g_array_new (FALSE, FALSE, sizeof (DIFFLN));
+ g_array_set_clear_func (dview->a[DIFF_RIGHT], cc_free_elt);
ndiff = redo_diff (dview);
if (ndiff >= 0)
@@ -2358,15 +2284,14 @@ dview_select_encoding (WDiff * dview)
static void
dview_load_options (WDiff * dview)
{
- gboolean show_numbers, show_symbols;
+ gboolean show_numbers;
int tab_size;
- show_symbols = mc_config_get_bool (mc_global.main_config, "DiffView", "show_symbols", FALSE);
- if (show_symbols)
- dview->display_symbols = 1;
+ dview->display_symbols =
+ mc_config_get_bool (mc_global.main_config, "DiffView", "show_symbols", FALSE);
show_numbers = mc_config_get_bool (mc_global.main_config, "DiffView", "show_numbers", FALSE);
if (show_numbers)
- dview->display_numbers = calc_nwidth ((const GArray * const *) dview->a);
+ dview->display_numbers = 1;
tab_size = mc_config_get_int (mc_global.main_config, "DiffView", "tab_size", 8);
if (tab_size > 0 && tab_size < 9)
dview->tab_size = tab_size;
@@ -2394,8 +2319,7 @@ dview_load_options (WDiff * dview)
static void
dview_save_options (WDiff * dview)
{
- mc_config_set_bool (mc_global.main_config, "DiffView", "show_symbols",
- dview->display_symbols != 0);
+ mc_config_set_bool (mc_global.main_config, "DiffView", "show_symbols", dview->display_symbols);
mc_config_set_bool (mc_global.main_config, "DiffView", "show_numbers",
dview->display_numbers != 0);
mc_config_set_int (mc_global.main_config, "DiffView", "tab_size", dview->tab_size);
@@ -2468,27 +2392,27 @@ dview_init (WDiff * dview, const char *args, const char *file1, const char *file
if (dsrc == DATA_SRC_TMP)
{
- f[DIFF_LEFT] = f_temp ();
+ f[DIFF_LEFT] = dview_ftemp ();
if (f[DIFF_LEFT] == NULL)
return -1;
- f[DIFF_RIGHT] = f_temp ();
+ f[DIFF_RIGHT] = dview_ftemp ();
if (f[DIFF_RIGHT] == NULL)
{
- f_close (f[DIFF_LEFT]);
+ dview_fclose (f[DIFF_LEFT]);
return -1;
}
}
else if (dsrc == DATA_SRC_ORG)
{
- f[DIFF_LEFT] = f_open (file1, O_RDONLY);
+ f[DIFF_LEFT] = dview_fopen (file1, O_RDONLY);
if (f[DIFF_LEFT] == NULL)
return -1;
- f[DIFF_RIGHT] = f_open (file2, O_RDONLY);
+ f[DIFF_RIGHT] = dview_fopen (file2, O_RDONLY);
if (f[DIFF_RIGHT] == NULL)
{
- f_close (f[DIFF_LEFT]);
+ dview_fclose (f[DIFF_LEFT]);
return -1;
}
}
@@ -2499,7 +2423,7 @@ dview_init (WDiff * dview, const char *args, const char *file1, const char *file
dview->new_frame = TRUE;
dview->skip_rows = 0;
dview->skip_cols = 0;
- dview->display_symbols = 0;
+ dview->display_symbols = FALSE;
dview->display_numbers = 0;
dview->show_cr = TRUE;
dview->tab_size = 8;
@@ -2529,14 +2453,16 @@ dview_init (WDiff * dview, const char *args, const char *file1, const char *file
dview_set_codeset (dview);
#endif
dview->a[DIFF_LEFT] = g_array_new (FALSE, FALSE, sizeof (DIFFLN));
+ g_array_set_clear_func (dview->a[DIFF_LEFT], cc_free_elt);
dview->a[DIFF_RIGHT] = g_array_new (FALSE, FALSE, sizeof (DIFFLN));
+ g_array_set_clear_func (dview->a[DIFF_RIGHT], cc_free_elt);
ndiff = redo_diff (dview);
if (ndiff < 0)
{
/* goto MSG_DESTROY stage: dview_fini() */
- f_close (f[DIFF_LEFT]);
- f_close (f[DIFF_RIGHT]);
+ dview_fclose (f[DIFF_LEFT]);
+ dview_fclose (f[DIFF_RIGHT]);
return -1;
}
@@ -2554,8 +2480,8 @@ dview_fini (WDiff * dview)
{
if (dview->dsrc != DATA_SRC_MEM)
{
- f_close (dview->f[DIFF_RIGHT]);
- f_close (dview->f[DIFF_LEFT]);
+ dview_fclose (dview->f[DIFF_RIGHT]);
+ dview_fclose (dview->f[DIFF_LEFT]);
}
#ifdef HAVE_CHARSET
@@ -2566,13 +2492,11 @@ dview_fini (WDiff * dview)
destroy_hdiff (dview);
if (dview->a[DIFF_LEFT] != NULL)
{
- g_array_foreach (dview->a[DIFF_LEFT], DIFFLN, cc_free_elt);
g_array_free (dview->a[DIFF_LEFT], TRUE);
dview->a[DIFF_LEFT] = NULL;
}
if (dview->a[DIFF_RIGHT] != NULL)
{
- g_array_foreach (dview->a[DIFF_RIGHT], DIFFLN, cc_free_elt);
g_array_free (dview->a[DIFF_RIGHT], TRUE);
dview->a[DIFF_RIGHT] = NULL;
}
@@ -2591,7 +2515,7 @@ dview_display_file (const WDiff * dview, diff_place_t ord, int r, int c, int hei
char buf[BUFSIZ];
FBUF *f = dview->f[ord];
int skip = dview->skip_cols;
- int display_symbols = dview->display_symbols;
+ gboolean display_symbols = dview->display_symbols;
int display_numbers = dview->display_numbers;
gboolean show_cr = dview->show_cr;
int tab_size = 8;
@@ -2599,7 +2523,9 @@ dview_display_file (const WDiff * dview, diff_place_t ord, int r, int c, int hei
int nwidth = display_numbers;
int xwidth;
- xwidth = display_symbols + display_numbers;
+ xwidth = display_numbers;
+ if (display_symbols)
+ xwidth++;
if (dview->tab_size > 0 && dview->tab_size < 9)
tab_size = dview->tab_size;
@@ -2608,9 +2534,9 @@ dview_display_file (const WDiff * dview, diff_place_t ord, int r, int c, int hei
if (xwidth > width && display_symbols)
{
xwidth--;
- display_symbols = 0;
+ display_symbols = FALSE;
}
- if (xwidth > width && display_numbers)
+ if (xwidth > width && display_numbers != 0)
{
xwidth = width;
display_numbers = width;
@@ -2631,7 +2557,9 @@ dview_display_file (const WDiff * dview, diff_place_t ord, int r, int c, int hei
for (i = dview->skip_rows, j = 0; i < dview->a[ord]->len && j < height; j++, i++)
{
- int ch, next_ch = 0, col;
+ int ch;
+ int next_ch = 0;
+ int col;
size_t cnt;
p = (DIFFLN *) & g_array_index (dview->a[ord], DIFFLN, i);
@@ -2644,7 +2572,7 @@ dview_display_file (const WDiff * dview, diff_place_t ord, int r, int c, int hei
}
if (p->line != 0)
{
- if (display_numbers)
+ if (display_numbers != 0)
{
tty_gotoyx (r + j, c - xwidth);
g_snprintf (buf, display_numbers + 1, "%*d", nwidth, p->line);
@@ -2734,19 +2662,17 @@ dview_display_file (const WDiff * dview, diff_place_t ord, int r, int c, int hei
}
else
{
- if (display_numbers)
+ if (display_numbers != 0)
{
tty_gotoyx (r + j, c - xwidth);
- memset (buf, ' ', display_numbers);
- buf[display_numbers] = '\0';
+ fill_by_space (buf, display_numbers, TRUE);
tty_print_string (buf);
}
if (ch == DEL_CH)
tty_setcolor (DFF_DEL_COLOR);
if (ch == CHG_CH)
tty_setcolor (DFF_CHD_COLOR);
- memset (buf, ' ', width);
- buf[width] = '\0';
+ fill_by_space (buf, width, TRUE);
}
tty_gotoyx (r + j, c);
/* tty_print_nstring (buf, width); */
@@ -2776,10 +2702,8 @@ dview_display_file (const WDiff * dview, diff_place_t ord, int r, int c, int hei
if (mc_global.utf8_display)
{
if (!dview->utf8)
- {
next_ch =
convert_from_8bit_to_utf_c ((unsigned char) next_ch, dview->converter);
- }
}
else if (dview->utf8)
next_ch = convert_from_utf_to_current_c (next_ch, dview->converter);
@@ -2796,8 +2720,7 @@ dview_display_file (const WDiff * dview, diff_place_t ord, int r, int c, int hei
k = width;
if (width < xwidth - 1)
k = xwidth - 1;
- memset (buf, ' ', k);
- buf[k] = '\0';
+ fill_by_space (buf, k, TRUE);
for (; j < height; j++)
{
if (xwidth != 0)
@@ -2852,7 +2775,7 @@ dview_status (const WDiff * dview, diff_place_t ord, int width, int c)
static void
dview_redo (WDiff * dview)
{
- if (dview->display_numbers)
+ if (dview->display_numbers != 0)
{
int old;
@@ -2869,8 +2792,7 @@ static void
dview_update (WDiff * dview)
{
int height = dview->height;
- int width1;
- int width2;
+ int width1, width2;
int last;
last = dview->a[DIFF_LEFT]->len - 1;
@@ -2885,6 +2807,10 @@ dview_update (WDiff * dview)
if (height < 2)
return;
+ /* use an actual length of dview->a */
+ if (dview->display_numbers != 0)
+ dview->display_numbers = calc_nwidth ((const GArray * const *) dview->a);
+
width1 = dview->half1 + dview->bias;
width2 = dview->half2 - dview->bias;
if (dview->full)
@@ -2898,7 +2824,9 @@ dview_update (WDiff * dview)
int xwidth;
tty_setcolor (NORMAL_COLOR);
- xwidth = dview->display_symbols + dview->display_numbers;
+ xwidth = dview->display_numbers;
+ if (dview->display_symbols)
+ xwidth++;
if (width1 > 1)
tty_draw_box (1, 0, height, width1, FALSE);
if (width2 > 1)
@@ -2934,8 +2862,11 @@ dview_update (WDiff * dview)
}
if (width2 > 2)
{
- dview_status (dview, dview->ord ^ 1, width2, width1);
- dview_display_file (dview, dview->ord ^ 1, 2, width1 + 1, height - 2, width2 - 2);
+ diff_place_t ord;
+
+ ord = dview->ord == DIFF_LEFT ? DIFF_RIGHT : DIFF_LEFT;
+ dview_status (dview, ord, width2, width1);
+ dview_display_file (dview, ord, 2, width1 + 1, height - 2, width2 - 2);
}
}
@@ -3004,7 +2935,6 @@ dview_goto_cmd (WDiff * dview, diff_place_t ord)
size_t i = 0;
if (newline > 0)
- {
for (; i < dview->a[ord]->len; i++)
{
const DIFFLN *p;
@@ -3013,9 +2943,10 @@ dview_goto_cmd (WDiff * dview, diff_place_t ord)
if (p->line == newline)
break;
}
- }
+
dview->skip_rows = dview->search.last_accessed_num_line = (ssize_t) i;
}
+
g_free (input);
}
@@ -3125,7 +3056,7 @@ dview_execute_cmd (WDiff * dview, long command)
switch (command)
{
case CK_ShowSymbols:
- dview->display_symbols ^= 1;
+ dview->display_symbols = !dview->display_symbols;
dview->new_frame = TRUE;
break;
case CK_ShowNumbers:
@@ -3502,9 +3433,9 @@ while (0)
#define UNGET_FILE(n) \
do \
{ \
- if (use_copy##n) \
+ if (use_copy##n != 0) \
{ \
- int changed = 0; \
+ gboolean changed = FALSE; \
if (use_copy##n > 0) \
{ \
time_t mtime; \
@@ -3534,8 +3465,7 @@ dview_diff_cmd (const void *f0, const void *f1)
/* run from panels */
const WPanel *panel0 = (const WPanel *) f0;
const WPanel *panel1 = (const WPanel *) f1;
- const file_entry_t *fe0;
- const file_entry_t *fe1;
+ const file_entry_t *fe0, *fe1;
fe0 = panel_current_entry (panel0);
file0 = vfs_path_append_new (panel0->cwd_vpath, fe0->fname->str, (char *) NULL);
@@ -3613,12 +3543,9 @@ dview_diff_cmd (const void *f0, const void *f1)
rv = -1;
if (file0 != NULL && file1 != NULL)
{
- int use_copy0;
- int use_copy1;
- struct stat st0;
- struct stat st1;
- vfs_path_t *real_file0;
- vfs_path_t *real_file1;
+ int use_copy0, use_copy1;
+ struct stat st0, st1;
+ vfs_path_t *real_file0, *real_file1;
GET_FILE_AND_STAMP (0);
GET_FILE_AND_STAMP (1);
diff --git a/src/editor/Makefile.in b/src/editor/Makefile.in
index b20d678..ffef1a0 100644
--- a/src/editor/Makefile.in
+++ b/src/editor/Makefile.in
@@ -137,7 +137,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
diff --git a/src/editor/bookmark.c b/src/editor/bookmark.c
index d530660..040a01b 100644
--- a/src/editor/bookmark.c
+++ b/src/editor/bookmark.c
@@ -1,7 +1,7 @@
/*
Editor book mark handling
- Copyright (C) 2001-2023
+ Copyright (C) 2001-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/editor/edit-impl.h b/src/editor/edit-impl.h
index 3d00545..98472ee 100644
--- a/src/editor/edit-impl.h
+++ b/src/editor/edit-impl.h
@@ -141,7 +141,7 @@ WEdit *edit_find_editor (const WDialog * h);
gboolean edit_widget_is_editor (const Widget * w);
gboolean edit_drop_hotkey_menu (WDialog * h, int key);
void edit_menu_cmd (WDialog * h);
-void user_menu (WEdit * edit, const char *menu_file, int selected_entry);
+void edit_user_menu (WEdit * edit, const char *menu_file, int selected_entry);
void edit_init_menu (WMenuBar * menubar);
void edit_save_mode_cmd (void);
off_t edit_move_forward3 (const WEdit * edit, off_t current, long cols, off_t upto);
@@ -163,7 +163,7 @@ void edit_set_codeset (WEdit * edit);
void edit_block_copy_cmd (WEdit * edit);
void edit_block_move_cmd (WEdit * edit);
-int edit_block_delete_cmd (WEdit * edit);
+gboolean edit_block_delete_cmd (WEdit * edit);
void edit_delete_line (WEdit * edit);
int edit_delete (WEdit * edit, gboolean byte_delete);
diff --git a/src/editor/edit.c b/src/editor/edit.c
index dc3b322..2eceeed 100644
--- a/src/editor/edit.c
+++ b/src/editor/edit.c
@@ -1,7 +1,7 @@
/*
Editor low level data handling and cursor fundamentals.
- Copyright (C) 1996-2023
+ Copyright (C) 1996-2024
Free Software Foundation, Inc.
Written by:
@@ -142,6 +142,7 @@ static const struct edit_filters
{ "lz4 -cd %s 2>&1", "lz4 > %s", ".lz4" },
{ "lzip -cd %s 2>&1", "lzip > %s", ".lz"},
{ "lzma -cd %s 2>&1", "lzma > %s", ".lzma" },
+ { "lzop -cd %s 2>&1", "lzop > %s", ".lzo"},
{ "bzip2 -cd %s 2>&1", "bzip2 > %s", ".bz2" },
{ "gzip -cd %s 2>&1", "gzip > %s", ".gz" },
{ "gzip -cd %s 2>&1", "gzip > %s", ".Z" }
@@ -262,15 +263,20 @@ static char *
edit_get_filter (const vfs_path_t * filename_vpath)
{
int i;
- char *p, *quoted_name;
+ char *quoted_name;
+ char *p = NULL;
i = edit_find_filter (filename_vpath);
if (i < 0)
return NULL;
quoted_name = name_quote (vfs_path_as_str (filename_vpath), FALSE);
- p = g_strdup_printf (all_filters[i].read, quoted_name);
- g_free (quoted_name);
+ if (quoted_name != NULL)
+ {
+ p = g_strdup_printf (all_filters[i].read, quoted_name);
+ g_free (quoted_name);
+ }
+
return p;
}
@@ -479,6 +485,7 @@ edit_load_position (WEdit * edit, gboolean load_position)
{
long line, column;
off_t offset;
+ off_t b;
if (edit->filename_vpath == NULL
|| *(vfs_path_get_by_index (edit->filename_vpath, 0)->path) == '\0')
@@ -503,7 +510,8 @@ edit_load_position (WEdit * edit, gboolean load_position)
edit->search_start = edit->buffer.curs1;
}
- edit_move_to_prev_col (edit, edit_buffer_get_current_bol (&edit->buffer));
+ b = edit_buffer_get_current_bol (&edit->buffer);
+ edit_move_to_prev_col (edit, b);
edit_move_display (edit, line - (WIDGET (edit)->rect.lines / 2));
}
@@ -637,7 +645,7 @@ edit_modification (WEdit * edit)
edit->caches_valid = FALSE;
/* raise lock when file modified */
- if (!edit->modified && !edit->delete_file)
+ if (edit->modified == 0 && edit->delete_file == 0)
edit->locked = lock_file (edit->filename_vpath);
edit->modified = 1;
}
@@ -679,12 +687,12 @@ is_blank (const edit_buffer_t * buf, off_t offset)
off_t s, f;
s = edit_buffer_get_bol (buf, offset);
- f = edit_buffer_get_eol (buf, offset) - 1;
- while (s <= f)
+ f = edit_buffer_get_eol (buf, offset);
+ for (; s < f; s++)
{
int c;
- c = edit_buffer_get_byte (buf, s++);
+ c = edit_buffer_get_byte (buf, s);
if (!isspace (c))
return FALSE;
}
@@ -697,7 +705,8 @@ is_blank (const edit_buffer_t * buf, off_t offset)
static off_t
edit_find_line (WEdit * edit, long line)
{
- long i, j = 0;
+ long i;
+ long j = 0;
long m = 2000000000; /* what is the magic number? */
if (!edit->caches_valid)
@@ -874,7 +883,10 @@ edit_move_to_bottom (WEdit * edit)
static void
edit_cursor_to_bol (WEdit * edit)
{
- edit_cursor_move (edit, edit_buffer_get_current_bol (&edit->buffer) - edit->buffer.curs1);
+ off_t b;
+
+ b = edit_buffer_get_current_bol (&edit->buffer);
+ edit_cursor_move (edit, b - edit->buffer.curs1);
edit->search_start = edit->buffer.curs1;
edit->prev_col = edit_get_col (edit);
edit->over_col = 0;
@@ -886,7 +898,10 @@ edit_cursor_to_bol (WEdit * edit)
static void
edit_cursor_to_eol (WEdit * edit)
{
- edit_cursor_move (edit, edit_buffer_get_current_eol (&edit->buffer) - edit->buffer.curs1);
+ off_t b;
+
+ b = edit_buffer_get_current_eol (&edit->buffer);
+ edit_cursor_move (edit, b - edit->buffer.curs1);
edit->search_start = edit->buffer.curs1;
edit->prev_col = edit_get_col (edit);
edit->over_col = 0;
@@ -897,8 +912,8 @@ edit_cursor_to_eol (WEdit * edit)
static unsigned long
my_type_of (int c)
{
- unsigned long x, r = 0;
- const char *p, *q;
+ unsigned long r = 0;
+ const char *q;
const char chars_move_whole_word[] =
"!=&|<>^~ !:;, !'!`!.?!\"!( !) !{ !} !Aa0 !+-*/= |<> ![ !] !\\#! ";
@@ -918,16 +933,21 @@ my_type_of (int c)
else if (isspace (c))
c = ' ';
q = strchr (chars_move_whole_word, c);
- if (!q)
+ if (q == NULL)
return 0xFFFFFFFFUL;
+
do
{
+ unsigned long x;
+ const char *p;
+
for (x = 1, p = chars_move_whole_word; p < q; p++)
if (*p == '!')
x <<= 1;
r |= x;
}
- while ((q = strchr (q + 1, c)));
+ while ((q = strchr (q + 1, c)) != NULL);
+
return r;
}
@@ -949,8 +969,10 @@ edit_left_word_move (WEdit * edit, int s)
if (edit->buffer.curs1 == 0)
break;
c1 = edit_buffer_get_previous_byte (&edit->buffer);
+ if (c1 == '\n')
+ break;
c2 = edit_buffer_get_current_byte (&edit->buffer);
- if (c1 == '\n' || c2 == '\n')
+ if (c2 == '\n')
break;
if ((my_type_of (c1) & my_type_of (c2)) == 0)
break;
@@ -988,8 +1010,10 @@ edit_right_word_move (WEdit * edit, int s)
if (edit->buffer.curs1 >= edit->buffer.size)
break;
c1 = edit_buffer_get_previous_byte (&edit->buffer);
+ if (c1 == '\n')
+ break;
c2 = edit_buffer_get_current_byte (&edit->buffer);
- if (c1 == '\n' || c2 == '\n')
+ if (c2 == '\n')
break;
if ((my_type_of (c1) & my_type_of (c2)) == 0)
break;
@@ -1118,8 +1142,10 @@ edit_right_delete_word (WEdit * edit)
int c1, c2;
c1 = edit_delete (edit, TRUE);
+ if (c1 == '\n')
+ break;
c2 = edit_buffer_get_current_byte (&edit->buffer);
- if (c1 == '\n' || c2 == '\n')
+ if (c2 == '\n')
break;
if ((isspace (c1) == 0) != (isspace (c2) == 0))
break;
@@ -1138,8 +1164,10 @@ edit_left_delete_word (WEdit * edit)
int c1, c2;
c1 = edit_backspace (edit, TRUE);
+ if (c1 == '\n')
+ break;
c2 = edit_buffer_get_previous_byte (&edit->buffer);
- if (c1 == '\n' || c2 == '\n')
+ if (c2 == '\n')
break;
if ((isspace (c1) == 0) != (isspace (c2) == 0))
break;
@@ -1162,8 +1190,11 @@ edit_do_undo (WEdit * edit)
edit->undo_stack_disable = 1; /* don't record undo's onto undo stack! */
edit->over_col = 0;
+
while ((ac = edit_pop_undo_action (edit)) < KEY_PRESS)
{
+ off_t b;
+
switch ((int) ac)
{
case STACK_BOTTOM:
@@ -1199,16 +1230,14 @@ edit_do_undo (WEdit * edit)
if (ac >= MARK_1 - 2 && ac < MARK_2 - 2)
{
edit->mark1 = ac - MARK_1;
- edit->column1 =
- (long) edit_move_forward3 (edit, edit_buffer_get_bol (&edit->buffer, edit->mark1),
- 0, edit->mark1);
+ b = edit_buffer_get_bol (&edit->buffer, edit->mark1);
+ edit->column1 = (long) edit_move_forward3 (edit, b, 0, edit->mark1);
}
if (ac >= MARK_2 - 2 && ac < MARK_CURS - 2)
{
edit->mark2 = ac - MARK_2;
- edit->column2 =
- (long) edit_move_forward3 (edit, edit_buffer_get_bol (&edit->buffer, edit->mark2),
- 0, edit->mark2);
+ b = edit_buffer_get_bol (&edit->buffer, edit->mark2);
+ edit->column2 = (long) edit_move_forward3 (edit, b, 0, edit->mark2);
}
else if (ac >= MARK_CURS - 2 && ac < KEY_PRESS)
{
@@ -1249,8 +1278,11 @@ edit_do_redo (WEdit * edit)
return;
edit->over_col = 0;
+
while ((ac = edit_pop_redo_action (edit)) < KEY_PRESS)
{
+ off_t b;
+
switch ((int) ac)
{
case STACK_BOTTOM:
@@ -1284,19 +1316,17 @@ edit_do_redo (WEdit * edit)
if (ac >= MARK_1 - 2 && ac < MARK_2 - 2)
{
edit->mark1 = ac - MARK_1;
- edit->column1 =
- (long) edit_move_forward3 (edit, edit_buffer_get_bol (&edit->buffer, edit->mark1),
- 0, edit->mark1);
+ b = edit_buffer_get_bol (&edit->buffer, edit->mark1);
+ edit->column1 = (long) edit_move_forward3 (edit, b, 0, edit->mark1);
}
else if (ac >= MARK_2 - 2 && ac < KEY_PRESS)
{
edit->mark2 = ac - MARK_2;
- edit->column2 =
- (long) edit_move_forward3 (edit, edit_buffer_get_bol (&edit->buffer, edit->mark2),
- 0, edit->mark2);
+ b = edit_buffer_get_bol (&edit->buffer, edit->mark2);
+ edit->column2 = (long) edit_move_forward3 (edit, b, 0, edit->mark2);
}
/* more than one pop usually means something big */
- if (count++)
+ if (count++ != 0)
edit->force |= REDRAW_PAGE;
}
@@ -1326,6 +1356,7 @@ edit_group_undo (WEdit * edit)
{
long ac = KEY_PRESS;
long cur_ac = KEY_PRESS;
+
while (ac != STACK_BOTTOM && ac == cur_ac)
{
cur_ac = get_prev_undo_action (edit);
@@ -1374,7 +1405,8 @@ is_aligned_on_a_tab (WEdit * edit)
static gboolean
right_of_four_spaces (WEdit * edit)
{
- int i, ch = 0;
+ int i;
+ int ch = 0;
for (i = 1; i <= HALF_TAB_SIZE; i++)
ch |= edit_buffer_get_byte (&edit->buffer, edit->buffer.curs1 - i);
@@ -1442,14 +1474,8 @@ insert_spaces_tab (WEdit * edit, gboolean half)
if (half)
i /= 2;
if (i != 0)
- {
- i = ((edit->curs_col / i) + 1) * i - edit->curs_col;
- while (i > 0)
- {
+ for (i = ((edit->curs_col / i) + 1) * i - edit->curs_col; i > 0; i -= space_width)
edit_insert (edit, ' ');
- i -= space_width;
- }
- }
}
/* --------------------------------------------------------------------------------------------- */
@@ -1609,6 +1635,8 @@ edit_move_block_to_right (WEdit * edit)
do
{
+ off_t b;
+
edit_cursor_move (edit, cur_bol - edit->buffer.curs1);
if (!edit_line_is_blank (edit, edit->buffer.curs_line))
{
@@ -1616,8 +1644,9 @@ edit_move_block_to_right (WEdit * edit)
insert_spaces_tab (edit, edit_options.fake_half_tabs);
else
edit_insert (edit, '\t');
- edit_cursor_move (edit,
- edit_buffer_get_bol (&edit->buffer, cur_bol) - edit->buffer.curs1);
+
+ b = edit_buffer_get_bol (&edit->buffer, cur_bol);
+ edit_cursor_move (edit, b - edit->buffer.curs1);
}
if (cur_bol == 0)
@@ -1687,10 +1716,10 @@ edit_move_block_to_left (WEdit * edit)
static size_t
edit_print_string (WEdit * e, const char *s)
{
- size_t i = 0;
+ size_t i;
- while (s[i] != '\0')
- edit_execute_cmd (e, CK_InsertChar, (unsigned char) s[i++]);
+ for (i = 0; s[i] != '\0'; i++)
+ edit_execute_cmd (e, CK_InsertChar, (unsigned char) s[i]);
e->force |= REDRAW_COMPLETELY;
edit_update_screen (e);
return i;
@@ -1772,10 +1801,10 @@ edit_insert_column_from_file (WEdit * edit, int file, off_t * start_pos, off_t *
/** User edit menu, like user menu (F2) but only in editor. */
void
-user_menu (WEdit * edit, const char *menu_file, int selected_entry)
+edit_user_menu (WEdit * edit, const char *menu_file, int selected_entry)
{
char *block_file;
- gboolean nomark;
+ gboolean mark;
off_t curs;
off_t start_mark, end_mark;
struct stat status;
@@ -1784,27 +1813,27 @@ user_menu (WEdit * edit, const char *menu_file, int selected_entry)
block_file = mc_config_get_full_path (EDIT_HOME_BLOCK_FILE);
block_file_vpath = vfs_path_from_str (block_file);
curs = edit->buffer.curs1;
- nomark = !eval_marks (edit, &start_mark, &end_mark);
- if (!nomark)
+ mark = eval_marks (edit, &start_mark, &end_mark);
+ if (mark)
edit_save_block (edit, block_file, start_mark, end_mark);
/* run shell scripts from menu */
if (user_menu_cmd (CONST_WIDGET (edit), menu_file, selected_entry)
&& (mc_stat (block_file_vpath, &status) == 0) && (status.st_size != 0))
{
- int rc = 0;
+ gboolean rc = FALSE;
FILE *fd;
/* i.e. we have marked block */
- if (!nomark)
+ if (mark)
rc = edit_block_delete_cmd (edit);
- if (rc == 0)
+ if (!rc)
{
off_t ins_len;
ins_len = edit_insert_file (edit, block_file_vpath);
- if (!nomark && ins_len > 0)
+ if (mark && ins_len > 0)
edit_set_markers (edit, start_mark, start_mark + ins_len, 0, 0);
}
/* truncate block file */
@@ -1827,7 +1856,8 @@ edit_get_write_filter (const vfs_path_t * write_name_vpath, const vfs_path_t * f
{
int i;
const char *write_name;
- char *p, *write_name_quoted;
+ char *write_name_quoted;
+ char *p = NULL;
i = edit_find_filter (filename_vpath);
if (i < 0)
@@ -1835,8 +1865,11 @@ edit_get_write_filter (const vfs_path_t * write_name_vpath, const vfs_path_t * f
write_name = vfs_path_get_last_path_str (write_name_vpath);
write_name_quoted = name_quote (write_name, FALSE);
- p = g_strdup_printf (all_filters[i].write, write_name_quoted);
- g_free (write_name_quoted);
+ if (write_name_quoted != NULL)
+ {
+ p = g_strdup_printf (all_filters[i].write, write_name_quoted);
+ g_free (write_name_quoted);
+ }
return p;
}
@@ -1950,7 +1983,7 @@ edit_write_stream (WEdit * edit, FILE * f)
gboolean
is_break_char (char c)
{
- return (isspace (c) || strchr ("{}[]()<>=|/\\!?~-+`'\",.;:#$%^&*", c));
+ return (isspace (c) || strchr ("{}[]()<>=|/\\!?~-+`'\",.;:#$%^&*", c) != NULL);
}
/* --------------------------------------------------------------------------------------------- */
@@ -2006,7 +2039,7 @@ edit_insert_file (WEdit * edit, const vfs_path_t * filename_vpath)
{
int file;
off_t blocklen;
- int vertical_insertion = 0;
+ gboolean vertical_insertion = FALSE;
char *buf;
file = mc_open (filename_vpath, O_RDONLY | O_BINARY);
@@ -2019,7 +2052,7 @@ edit_insert_file (WEdit * edit, const vfs_path_t * filename_vpath)
{
/* if contain signature VERTICAL_MAGIC then it vertical block */
if (memcmp (buf, VERTICAL_MAGIC, sizeof (VERTICAL_MAGIC)) == 0)
- vertical_insertion = 1;
+ vertical_insertion = TRUE;
else
mc_lseek (file, 0, SEEK_SET);
}
@@ -2377,6 +2410,7 @@ edit_push_undo_action (WEdit * edit, long c)
&& ((sp - 2) & edit->undo_stack_size_mask) != edit->undo_stack_bottom)
{
long d;
+
if (edit->undo_stack[spm1] < 0)
{
d = edit->undo_stack[(sp - 2) & edit->undo_stack_size_mask];
@@ -2457,6 +2491,7 @@ edit_push_redo_action (WEdit * edit, long c)
&& ((sp - 2) & edit->redo_stack_size_mask) != edit->redo_stack_bottom)
{
long d;
+
if (edit->redo_stack[spm1] < 0)
{
d = edit->redo_stack[(sp - 2) & edit->redo_stack_size_mask];
@@ -2848,8 +2883,10 @@ edit_get_cursor_offset (const WEdit * edit)
long
edit_get_col (const WEdit * edit)
{
- return (long) edit_move_forward3 (edit, edit_buffer_get_current_bol (&edit->buffer), 0,
- edit->buffer.curs1);
+ off_t b;
+
+ b = edit_buffer_get_current_bol (&edit->buffer);
+ return (long) edit_move_forward3 (edit, b, 0, edit->buffer.curs1);
}
/* --------------------------------------------------------------------------------------------- */
@@ -2867,8 +2904,10 @@ edit_update_curs_row (WEdit * edit)
void
edit_update_curs_col (WEdit * edit)
{
- edit->curs_col = (long) edit_move_forward3 (edit, edit_buffer_get_current_bol (&edit->buffer),
- 0, edit->buffer.curs1);
+ off_t b;
+
+ b = edit_buffer_get_current_bol (&edit->buffer);
+ edit->curs_col = (long) edit_move_forward3 (edit, b, 0, edit->buffer.curs1);
}
/* --------------------------------------------------------------------------------------------- */
@@ -2900,7 +2939,6 @@ edit_scroll_upward (WEdit * edit, long i)
edit_update_curs_row (edit);
}
-
/* --------------------------------------------------------------------------------------------- */
void
@@ -2956,16 +2994,19 @@ edit_move_to_prev_col (WEdit * edit, off_t p)
{
long prev = edit->prev_col;
long over = edit->over_col;
+ off_t b;
edit_cursor_move (edit,
edit_move_forward3 (edit, p, prev + edit->over_col, 0) - edit->buffer.curs1);
if (edit_options.cursor_beyond_eol)
{
+ off_t e;
long line_len;
- line_len = (long) edit_move_forward3 (edit, edit_buffer_get_current_bol (&edit->buffer), 0,
- edit_buffer_get_current_eol (&edit->buffer));
+ b = edit_buffer_get_current_bol (&edit->buffer);
+ e = edit_buffer_get_current_eol (&edit->buffer);
+ line_len = (long) edit_move_forward3 (edit, b, 0, e);
if (line_len < prev + edit->over_col)
{
edit->over_col = prev + over - line_len;
@@ -2974,9 +3015,9 @@ edit_move_to_prev_col (WEdit * edit, off_t p)
}
else
{
- edit->curs_col = prev + over;
- edit->prev_col = edit->curs_col;
edit->over_col = 0;
+ edit->prev_col = edit->curs_col;
+ edit->curs_col = prev + over;
}
}
else
@@ -2996,12 +3037,13 @@ edit_move_to_prev_col (WEdit * edit, off_t p)
q = edit->curs_col;
edit->curs_col -= (edit->curs_col % fake_half_tabs);
p = edit_buffer_get_current_bol (&edit->buffer);
- edit_cursor_move (edit,
- edit_move_forward3 (edit, p, edit->curs_col,
- 0) - edit->buffer.curs1);
+ b = edit_move_forward3 (edit, p, edit->curs_col, 0);
+ edit_cursor_move (edit, b - edit->buffer.curs1);
if (!left_of_four_spaces (edit))
- edit_cursor_move (edit,
- edit_move_forward3 (edit, p, q, 0) - edit->buffer.curs1);
+ {
+ b = edit_move_forward3 (edit, p, q, 0);
+ edit_cursor_move (edit, b - edit->buffer.curs1);
+ }
}
}
}
@@ -3069,6 +3111,71 @@ edit_set_markers (WEdit * edit, off_t m1, off_t m2, long c1, long c2)
edit->column2 = c2;
}
+/* --------------------------------------------------------------------------------------------- */
+/**
+ if mark2 is -1 then marking is from mark1 to the cursor.
+ Otherwise its between the markers. This handles this.
+ Returns FALSE if no text is marked.
+ */
+
+gboolean
+eval_marks (WEdit * edit, off_t * start_mark, off_t * end_mark)
+{
+ long end_mark_curs;
+
+ if (edit->mark1 == edit->mark2)
+ {
+ *start_mark = *end_mark = 0;
+ edit->column2 = edit->column1 = 0;
+ return FALSE;
+ }
+
+ if (edit->end_mark_curs < 0)
+ end_mark_curs = edit->buffer.curs1;
+ else
+ end_mark_curs = edit->end_mark_curs;
+
+ if (edit->mark2 >= 0)
+ {
+ *start_mark = MIN (edit->mark1, edit->mark2);
+ *end_mark = MAX (edit->mark1, edit->mark2);
+ }
+ else
+ {
+ *start_mark = MIN (edit->mark1, end_mark_curs);
+ *end_mark = MAX (edit->mark1, end_mark_curs);
+ edit->column2 = edit->curs_col + edit->over_col;
+ }
+
+ if (edit->column_highlight
+ && ((edit->mark1 > end_mark_curs && edit->column1 < edit->column2)
+ || (edit->mark1 < end_mark_curs && edit->column1 > edit->column2)))
+ {
+ off_t start_bol, start_eol;
+ off_t end_bol, end_eol;
+ long col1, col2;
+ off_t diff1, diff2;
+
+ start_bol = edit_buffer_get_bol (&edit->buffer, *start_mark);
+ start_eol = edit_buffer_get_eol (&edit->buffer, start_bol - 1) + 1;
+ end_bol = edit_buffer_get_bol (&edit->buffer, *end_mark);
+ end_eol = edit_buffer_get_eol (&edit->buffer, *end_mark);
+ col1 = MIN (edit->column1, edit->column2);
+ col2 = MAX (edit->column1, edit->column2);
+
+ diff1 = edit_move_forward3 (edit, start_bol, col2, 0) -
+ edit_move_forward3 (edit, start_bol, col1, 0);
+ diff2 = edit_move_forward3 (edit, end_bol, col2, 0) -
+ edit_move_forward3 (edit, end_bol, col1, 0);
+
+ *start_mark -= diff1;
+ *end_mark += diff2;
+ *start_mark = MAX (*start_mark, start_eol);
+ *end_mark = MIN (*end_mark, end_eol);
+ }
+
+ return TRUE;
+}
/* --------------------------------------------------------------------------------------------- */
/** highlight marker toggle */
@@ -3364,7 +3471,6 @@ edit_execute_cmd (WEdit * edit, long command, int char_for_insertion)
if (!mc_global.utf8_display || edit->charpoint == 0)
#endif
if (edit_buffer_get_current_byte (&edit->buffer) != '\n')
-
edit_delete (edit, FALSE);
}
if (edit_options.cursor_beyond_eol && edit->over_col > 0)
@@ -3378,7 +3484,7 @@ edit_execute_cmd (WEdit * edit, long command, int char_for_insertion)
&& !mc_global.utf8_display)
{
unsigned char str[UTF8_CHAR_LEN + 1];
- size_t i = 0;
+ size_t i;
int res;
res = g_unichar_to_utf8 (char_for_insertion, (char *) str);
@@ -3388,14 +3494,12 @@ edit_execute_cmd (WEdit * edit, long command, int char_for_insertion)
str[1] = '\0';
}
else
- {
str[res] = '\0';
- }
- while (i <= UTF8_CHAR_LEN && str[i] != '\0')
+
+ for (i = 0; i <= UTF8_CHAR_LEN && str[i] != '\0'; i++)
{
char_for_insertion = str[i];
edit_insert (edit, char_for_insertion);
- i++;
}
}
else
@@ -3920,7 +4024,7 @@ edit_execute_cmd (WEdit * edit, long command, int char_for_insertion)
edit_goto_matching_bracket (edit);
break;
case CK_UserMenu:
- user_menu (edit, NULL, -1);
+ edit_user_menu (edit, NULL, -1);
break;
case CK_Sort:
edit_sort_cmd (edit);
diff --git a/src/editor/editbuffer.c b/src/editor/editbuffer.c
index 24bc7ee..acc776a 100644
--- a/src/editor/editbuffer.c
+++ b/src/editor/editbuffer.c
@@ -1,7 +1,7 @@
/*
Editor text keep buffer.
- Copyright (C) 2013-2023
+ Copyright (C) 2013-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c
index de624f2..bca9df7 100644
--- a/src/editor/editcmd.c
+++ b/src/editor/editcmd.c
@@ -1,7 +1,7 @@
/*
Editor high level editing commands
- Copyright (C) 1996-2023
+ Copyright (C) 1996-2024
Free Software Foundation, Inc.
Written by:
@@ -460,22 +460,23 @@ edit_save_cmd (WEdit * edit)
/* --------------------------------------------------------------------------------------------- */
static void
-edit_delete_column_of_text (WEdit * edit)
+edit_delete_column_of_text (WEdit * edit, off_t m1, off_t m2)
{
- off_t m1, m2;
off_t n;
+ off_t r;
long b, c, d;
- eval_marks (edit, &m1, &m2);
n = edit_buffer_get_forward_offset (&edit->buffer, m1, 0, m2) + 1;
- c = (long) edit_move_forward3 (edit, edit_buffer_get_bol (&edit->buffer, m1), 0, m1);
- d = (long) edit_move_forward3 (edit, edit_buffer_get_bol (&edit->buffer, m2), 0, m2);
+ r = edit_buffer_get_bol (&edit->buffer, m1);
+ c = (long) edit_move_forward3 (edit, r, 0, m1);
+ r = edit_buffer_get_bol (&edit->buffer, m2);
+ d = (long) edit_move_forward3 (edit, r, 0, m2);
b = MAX (MIN (c, d), MIN (edit->column1, edit->column2));
c = MAX (c, MAX (edit->column1, edit->column2));
while (n-- != 0)
{
- off_t r, p, q;
+ off_t p, q;
r = edit_buffer_get_current_bol (&edit->buffer);
p = edit_move_forward3 (edit, r, b, 0);
@@ -490,25 +491,22 @@ edit_delete_column_of_text (WEdit * edit)
/* move to next line except on the last delete */
if (n != 0)
- edit_cursor_move (edit,
- edit_buffer_get_forward_offset (&edit->buffer, edit->buffer.curs1, 1,
- 0) - edit->buffer.curs1);
+ {
+ r = edit_buffer_get_forward_offset (&edit->buffer, edit->buffer.curs1, 1, 0);
+ edit_cursor_move (edit, r - edit->buffer.curs1);
+ }
}
}
/* --------------------------------------------------------------------------------------------- */
-/** if success return 0 */
+/** if success return TRUE */
-static int
-edit_block_delete (WEdit * edit)
+static gboolean
+edit_block_delete (WEdit * edit, off_t start_mark, off_t end_mark)
{
- off_t start_mark, end_mark;
off_t curs_pos;
long curs_line, c1, c2;
- if (!eval_marks (edit, &start_mark, &end_mark))
- return 0;
-
if (edit->column_highlight && edit->mark2 < 0)
edit_mark_cmd (edit, FALSE);
@@ -517,7 +515,7 @@ edit_block_delete (WEdit * edit)
edit_query_dialog2 (_("Warning"),
("Block is large, you may not be able to undo this action"),
_("C&ontinue"), _("&Cancel")) != 0)
- return 1;
+ return FALSE;
c1 = MIN (edit->column1, edit->column2);
c2 = MAX (edit->column1, edit->column2);
@@ -538,16 +536,18 @@ edit_block_delete (WEdit * edit)
{
if (edit->column_highlight)
{
+ off_t b, e;
off_t line_width;
if (edit->mark2 < 0)
edit_mark_cmd (edit, FALSE);
- edit_delete_column_of_text (edit);
+ edit_delete_column_of_text (edit, start_mark, end_mark);
/* move cursor to the saved position */
edit_move_to_line (edit, curs_line);
/* calculate line width and cursor position before cut */
- line_width = edit_move_forward3 (edit, edit_buffer_get_current_bol (&edit->buffer), 0,
- edit_buffer_get_current_eol (&edit->buffer));
+ b = edit_buffer_get_current_bol (&edit->buffer);
+ e = edit_buffer_get_current_eol (&edit->buffer);
+ line_width = edit_move_forward3 (edit, b, 0, e);
if (edit_options.cursor_beyond_eol && curs_pos > line_width)
edit->over_col = curs_pos - line_width;
}
@@ -563,7 +563,7 @@ edit_block_delete (WEdit * edit)
edit_set_markers (edit, 0, 0, 0, 0);
edit->force |= REDRAW_PAGE;
- return 0;
+ return TRUE;
}
/* --------------------------------------------------------------------------------------------- */
@@ -586,7 +586,8 @@ edit_get_block (WEdit * edit, off_t start, off_t finish, off_t * l)
int c;
off_t x;
- x = edit_move_forward3 (edit, edit_buffer_get_bol (&edit->buffer, start), 0, start);
+ x = edit_buffer_get_bol (&edit->buffer, start);
+ x = edit_move_forward3 (edit, x, 0, start);
c = edit_buffer_get_byte (&edit->buffer, start);
if ((x >= edit->column1 && x < edit->column2)
|| (x >= edit->column2 && x < edit->column1) || c == '\n')
@@ -631,15 +632,28 @@ static void
pipe_mail (const edit_buffer_t * buf, char *to, char *subject, char *cc)
{
FILE *p = 0;
- char *s;
+ char *s = NULL;
to = name_quote (to, FALSE);
- subject = name_quote (subject, FALSE);
- cc = name_quote (cc, FALSE);
- s = g_strconcat ("mail -s ", subject, *cc ? " -c " : "", cc, " ", to, (char *) NULL);
- g_free (to);
- g_free (subject);
- g_free (cc);
+ if (to != NULL)
+ {
+ subject = name_quote (subject, FALSE);
+ if (subject != NULL)
+ {
+ cc = name_quote (cc, FALSE);
+ if (cc == NULL)
+ s = g_strdup_printf ("mail -s %s %s", subject, to);
+ else
+ {
+ s = g_strdup_printf ("mail -s %s -c %s %s", subject, cc, to);
+ g_free (cc);
+ }
+
+ g_free (subject);
+ }
+
+ g_free (to);
+ }
if (s != NULL)
{
@@ -1256,72 +1270,6 @@ edit_close_cmd (WEdit * edit)
}
/* --------------------------------------------------------------------------------------------- */
-/**
- if mark2 is -1 then marking is from mark1 to the cursor.
- Otherwise its between the markers. This handles this.
- Returns FALSE if no text is marked.
- */
-
-gboolean
-eval_marks (WEdit * edit, off_t * start_mark, off_t * end_mark)
-{
- long end_mark_curs;
-
- if (edit->mark1 == edit->mark2)
- {
- *start_mark = *end_mark = 0;
- edit->column2 = edit->column1 = 0;
- return FALSE;
- }
-
- if (edit->end_mark_curs < 0)
- end_mark_curs = edit->buffer.curs1;
- else
- end_mark_curs = edit->end_mark_curs;
-
- if (edit->mark2 >= 0)
- {
- *start_mark = MIN (edit->mark1, edit->mark2);
- *end_mark = MAX (edit->mark1, edit->mark2);
- }
- else
- {
- *start_mark = MIN (edit->mark1, end_mark_curs);
- *end_mark = MAX (edit->mark1, end_mark_curs);
- edit->column2 = edit->curs_col + edit->over_col;
- }
-
- if (edit->column_highlight
- && ((edit->mark1 > end_mark_curs && edit->column1 < edit->column2)
- || (edit->mark1 < end_mark_curs && edit->column1 > edit->column2)))
- {
- off_t start_bol, start_eol;
- off_t end_bol, end_eol;
- long col1, col2;
- off_t diff1, diff2;
-
- start_bol = edit_buffer_get_bol (&edit->buffer, *start_mark);
- start_eol = edit_buffer_get_eol (&edit->buffer, start_bol - 1) + 1;
- end_bol = edit_buffer_get_bol (&edit->buffer, *end_mark);
- end_eol = edit_buffer_get_eol (&edit->buffer, *end_mark);
- col1 = MIN (edit->column1, edit->column2);
- col2 = MAX (edit->column1, edit->column2);
-
- diff1 = edit_move_forward3 (edit, start_bol, col2, 0) -
- edit_move_forward3 (edit, start_bol, col1, 0);
- diff2 = edit_move_forward3 (edit, end_bol, col2, 0) -
- edit_move_forward3 (edit, end_bol, col1, 0);
-
- *start_mark -= diff1;
- *end_mark += diff2;
- *start_mark = MAX (*start_mark, start_eol);
- *end_mark = MIN (*end_mark, end_eol);
- }
-
- return TRUE;
-}
-
-/* --------------------------------------------------------------------------------------------- */
void
edit_block_copy_cmd (WEdit * edit)
@@ -1398,6 +1346,7 @@ edit_block_move_cmd (WEdit * edit)
off_t size;
long c1, c2, b_width;
long x, x2;
+ off_t b1, b2;
c1 = MIN (edit->column1, edit->column2);
c2 = MAX (edit->column1, edit->column2);
@@ -1409,8 +1358,9 @@ edit_block_move_cmd (WEdit * edit)
x2 = x + edit->over_col;
/* do nothing when cursor inside first line of selected area */
- if ((edit_buffer_get_eol (&edit->buffer, edit->buffer.curs1) ==
- edit_buffer_get_eol (&edit->buffer, start_mark)) && x2 > c1 && x2 <= c2)
+ b1 = edit_buffer_get_eol (&edit->buffer, edit->buffer.curs1);
+ b2 = edit_buffer_get_eol (&edit->buffer, start_mark);
+ if (b1 == b2 && x2 > c1 && x2 <= c2)
return;
if (edit->buffer.curs1 > start_mark
@@ -1429,7 +1379,8 @@ edit_block_move_cmd (WEdit * edit)
edit->over_col = MAX (0, edit->over_col - b_width);
/* calculate the cursor pos after delete block */
- current = edit_move_forward3 (edit, edit_buffer_get_current_bol (&edit->buffer), x, 0);
+ b1 = edit_buffer_get_current_bol (&edit->buffer);
+ current = edit_move_forward3 (edit, b1, x, 0);
edit_cursor_move (edit, current - edit->buffer.curs1);
edit_scroll_screen_over_cursor (edit);
@@ -1443,6 +1394,7 @@ edit_block_move_cmd (WEdit * edit)
else
{
off_t count, count_orig;
+ off_t x;
current = edit->buffer.curs1;
copy_buf = g_malloc0 (end_mark - start_mark);
@@ -1453,9 +1405,8 @@ edit_block_move_cmd (WEdit * edit)
copy_buf[end_mark - count - 1] = edit_delete (edit, TRUE);
edit_scroll_screen_over_cursor (edit);
- edit_cursor_move (edit,
- current - edit->buffer.curs1 -
- (((current - edit->buffer.curs1) > 0) ? end_mark - start_mark : 0));
+ x = current > edit->buffer.curs1 ? end_mark - start_mark : 0;
+ edit_cursor_move (edit, current - edit->buffer.curs1 - x);
edit_scroll_screen_over_cursor (edit);
count_orig = count;
while (count-- > start_mark)
@@ -1475,19 +1426,19 @@ edit_block_move_cmd (WEdit * edit)
}
/* --------------------------------------------------------------------------------------------- */
-/** returns 1 if canceelled by user */
+/** returns FALSE if canceelled by user */
-int
+gboolean
edit_block_delete_cmd (WEdit * edit)
{
off_t start_mark, end_mark;
if (eval_marks (edit, &start_mark, &end_mark))
- return edit_block_delete (edit);
+ return edit_block_delete (edit, start_mark, end_mark);
edit_delete_line (edit);
- return 0;
+ return TRUE;
}
/* --------------------------------------------------------------------------------------------- */
@@ -1859,7 +1810,7 @@ edit_sort_cmd (WEdit * edit)
edit->force |= REDRAW_COMPLETELY;
- if (edit_block_delete_cmd (edit))
+ if (!edit_block_delete_cmd (edit))
return 1;
{
@@ -1934,7 +1885,7 @@ edit_block_process_cmd (WEdit * edit, int macro_number)
fname = g_strdup_printf ("%s.%i.sh", EDIT_HOME_MACRO_FILE, macro_number);
macros_fname = g_build_filename (mc_config_get_data_path (), fname, (char *) NULL);
- user_menu (edit, macros_fname, 0);
+ edit_user_menu (edit, macros_fname, 0);
g_free (fname);
g_free (macros_fname);
edit->force |= REDRAW_COMPLETELY;
diff --git a/src/editor/editcomplete.c b/src/editor/editcomplete.c
index 06f304d..f3ea0e7 100644
--- a/src/editor/editcomplete.c
+++ b/src/editor/editcomplete.c
@@ -1,7 +1,7 @@
/*
Editor word completion engine
- Copyright (C) 2021-2023
+ Copyright (C) 2021-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/editor/editdraw.c b/src/editor/editdraw.c
index fbd1e09..49be571 100644
--- a/src/editor/editdraw.c
+++ b/src/editor/editdraw.c
@@ -1,7 +1,7 @@
/*
Editor text drawing.
- Copyright (C) 1996-2023
+ Copyright (C) 1996-2024
Free Software Foundation, Inc.
Written by:
@@ -448,7 +448,6 @@ print_to_widget (WEdit * edit, long row, int start_col, int start_col_real,
{
int style;
unsigned int textchar;
- int color;
if (cols_to_skip != 0)
{
@@ -458,8 +457,6 @@ print_to_widget (WEdit * edit, long row, int start_col, int start_col_real,
style = p->style & 0xFF00;
textchar = p->ch;
- /* If non-printable - use black background */
- color = (style & MOD_ABNORMAL) != 0 ? 0 : p->style >> 16;
if ((style & MOD_WHITESPACE) != 0)
{
@@ -475,8 +472,10 @@ print_to_widget (WEdit * edit, long row, int start_col, int start_col_real,
tty_setcolor (EDITOR_BOLD_COLOR);
else if ((style & MOD_MARKED) != 0)
tty_setcolor (EDITOR_MARKED_COLOR);
+ else if ((style & MOD_ABNORMAL) != 0)
+ tty_setcolor (EDITOR_NONPRINTABLE_COLOR);
else
- tty_lowlevel_setcolor (color);
+ tty_lowlevel_setcolor (p->style >> 16);
if (edit_options.show_right_margin)
{
@@ -951,9 +950,8 @@ render_edit_text (WEdit * edit, long start_row, long start_column, long end_row,
if ((force & REDRAW_LINE_ABOVE) != 0 && curs_row >= 1)
{
row = curs_row - 1;
- b = edit_buffer_get_backward_offset (&edit->buffer,
- edit_buffer_get_current_bol (&edit->buffer),
- 1);
+ b = edit_buffer_get_current_bol (&edit->buffer);
+ b = edit_buffer_get_backward_offset (&edit->buffer, b, 1);
if (row >= start_row && row <= end_row)
{
if (key_pending (edit))
diff --git a/src/editor/editmacros.c b/src/editor/editmacros.c
index 8545d67..6c07139 100644
--- a/src/editor/editmacros.c
+++ b/src/editor/editmacros.c
@@ -1,7 +1,7 @@
/*
Editor macros engine
- Copyright (C) 2001-2023
+ Copyright (C) 2001-2024
Free Software Foundation, Inc.
This file is part of the Midnight Commander.
diff --git a/src/editor/editmenu.c b/src/editor/editmenu.c
index 3509fa2..f83742c 100644
--- a/src/editor/editmenu.c
+++ b/src/editor/editmenu.c
@@ -1,7 +1,7 @@
/*
Editor menu definitions and initialisation
- Copyright (C) 1996-2023
+ Copyright (C) 1996-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/editor/editoptions.c b/src/editor/editoptions.c
index 9e059f3..c81d9b8 100644
--- a/src/editor/editoptions.c
+++ b/src/editor/editoptions.c
@@ -1,7 +1,7 @@
/*
Editor options dialog box
- Copyright (C) 1996-2023
+ Copyright (C) 1996-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/editor/editsearch.c b/src/editor/editsearch.c
index 1bdf883..4ed5785 100644
--- a/src/editor/editsearch.c
+++ b/src/editor/editsearch.c
@@ -1,7 +1,7 @@
/*
Search & replace engine of MCEditor.
- Copyright (C) 2021-2023
+ Copyright (C) 2021-2024
Free Software Foundation, Inc.
Written by:
@@ -29,7 +29,7 @@
#include "lib/global.h"
#include "lib/search.h"
-#include "lib/mcconfig.h" /* mc_config_history_get */
+#include "lib/mcconfig.h" /* mc_config_history_get_recent_item() */
#ifdef HAVE_CHARSET
#include "lib/charsets.h" /* cp_source */
#endif
@@ -780,16 +780,12 @@ edit_search_cmd (WEdit * edit, gboolean again)
else
{
/* find last search string in history */
- GList *history;
+ char *s;
- history = mc_config_history_get (MC_HISTORY_SHARED_SEARCH);
- if (history != NULL)
+ s = mc_config_history_get_recent_item (MC_HISTORY_SHARED_SEARCH);
+ if (s != NULL)
{
- /* FIXME: is it possible that history->data == NULL? */
- edit->last_search_string = (char *) history->data;
- history->data = NULL;
- history = g_list_first (history);
- g_list_free_full (history, g_free);
+ edit->last_search_string = s;
if (edit_search_init (edit, edit->last_search_string))
{
@@ -877,7 +873,8 @@ edit_replace_cmd (WEdit * edit, gboolean again)
edit->search = NULL;
}
- input2_str = g_string_new (input2);
+ input2_str = g_string_new_take (input2);
+ input2 = NULL;
if (edit->search == NULL)
{
diff --git a/src/editor/editwidget.c b/src/editor/editwidget.c
index 05f03e8..45be31e 100644
--- a/src/editor/editwidget.c
+++ b/src/editor/editwidget.c
@@ -1,7 +1,7 @@
/*
Editor initialisation and callback handler.
- Copyright (C) 1996-2023
+ Copyright (C) 1996-2024
Free Software Foundation, Inc.
Written by:
@@ -152,7 +152,7 @@ edit_about (void)
QUICK_LABEL (N_("A user friendly text editor\n"
"written for the Midnight Commander."), NULL),
QUICK_SEPARATOR (FALSE),
- QUICK_LABEL (N_("Copyright (C) 1996-2023 the Free Software Foundation"), NULL),
+ QUICK_LABEL (N_("Copyright (C) 1996-2024 the Free Software Foundation"), NULL),
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_END
@@ -182,9 +182,10 @@ edit_about (void)
*/
static void
-edit_help (void)
+edit_help (const WDialog * h)
{
- ev_help_t event_data = { NULL, "[Internal File Editor]" };
+ ev_help_t event_data = { NULL, h->help_ctx };
+
mc_event_raise (MCEVENT_GROUP_CORE, "help", &event_data);
}
@@ -426,8 +427,7 @@ edit_dialog_command_execute (WDialog * h, long command)
dlg_close (h);
break;
case CK_Help:
- edit_help ();
- /* edit->force |= REDRAW_COMPLETELY; */
+ edit_help (h);
break;
case CK_Menu:
edit_menu_cmd (h);
diff --git a/src/editor/etags.c b/src/editor/etags.c
index 7b570d6..ddc5ca8 100644
--- a/src/editor/etags.c
+++ b/src/editor/etags.c
@@ -6,7 +6,7 @@
or, if etags utility not installed:
$ find . -type f -name "*.[ch]" | ctags --c-kinds=+p --fields=+iaS --extra=+q -e -L-
- Copyright (C) 2009-2023
+ Copyright (C) 2009-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/editor/format.c b/src/editor/format.c
index 3193067..9dc5d72 100644
--- a/src/editor/format.c
+++ b/src/editor/format.c
@@ -1,7 +1,7 @@
/*
Dynamic paragraph formatting.
- Copyright (C) 2011-2023
+ Copyright (C) 2011-2024
Free Software Foundation, Inc.
Copyright (C) 1996 Paul Sheer
diff --git a/src/editor/spell.c b/src/editor/spell.c
index aeb0884..9d26345 100644
--- a/src/editor/spell.c
+++ b/src/editor/spell.c
@@ -1,7 +1,7 @@
/*
Editor spell checker
- Copyright (C) 2012-2023
+ Copyright (C) 2012-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/editor/syntax.c b/src/editor/syntax.c
index f95ad2b..4b8116f 100644
--- a/src/editor/syntax.c
+++ b/src/editor/syntax.c
@@ -1,7 +1,7 @@
/*
Editor syntax highlighting.
- Copyright (C) 1996-2023
+ Copyright (C) 1996-2024
Free Software Foundation, Inc.
Written by:
@@ -248,7 +248,8 @@ compare_word_to_right (const WEdit * edit, off_t i, const GString * text,
const unsigned char *p, *q;
int c, d, j;
- c = xx_tolower (edit, edit_buffer_get_byte (&edit->buffer, i - 1));
+ c = edit_buffer_get_byte (&edit->buffer, i - 1);
+ c = xx_tolower (edit, c);
if ((line_start && c != '\n') || (whole_left != NULL && strchr (whole_left, c) != NULL))
return -1;
@@ -261,7 +262,8 @@ compare_word_to_right (const WEdit * edit, off_t i, const GString * text,
return -1;
while (TRUE)
{
- c = xx_tolower (edit, edit_buffer_get_byte (&edit->buffer, i));
+ c = edit_buffer_get_byte (&edit->buffer, i);
+ c = xx_tolower (edit, c);
if (*p == '\0' && whole_right != NULL && strchr (whole_right, c) == NULL)
break;
if (c == *p)
@@ -277,7 +279,8 @@ compare_word_to_right (const WEdit * edit, off_t i, const GString * text,
j = 0;
while (TRUE)
{
- c = xx_tolower (edit, edit_buffer_get_byte (&edit->buffer, i));
+ c = edit_buffer_get_byte (&edit->buffer, i);
+ c = xx_tolower (edit, c);
if (c == *p)
{
j = i;
@@ -308,7 +311,8 @@ compare_word_to_right (const WEdit * edit, off_t i, const GString * text,
while (TRUE)
{
d = c;
- c = xx_tolower (edit, edit_buffer_get_byte (&edit->buffer, i));
+ c = edit_buffer_get_byte (&edit->buffer, i);
+ c = xx_tolower (edit, c);
for (j = 0; p[j] != SYNTAX_TOKEN_BRACKET && p[j] != '\0'; j++)
if (c == p[j])
goto found_char2;
@@ -327,7 +331,8 @@ compare_word_to_right (const WEdit * edit, off_t i, const GString * text,
case SYNTAX_TOKEN_BRACE:
if (++p > q)
return -1;
- c = xx_tolower (edit, edit_buffer_get_byte (&edit->buffer, i));
+ c = edit_buffer_get_byte (&edit->buffer, i);
+ c = xx_tolower (edit, c);
for (; *p != SYNTAX_TOKEN_BRACE && *p != '\0'; p++)
if (c == *p)
goto found_char3;
@@ -337,13 +342,18 @@ compare_word_to_right (const WEdit * edit, off_t i, const GString * text,
p++;
break;
default:
- if (*p != xx_tolower (edit, edit_buffer_get_byte (&edit->buffer, i)))
+ c = edit_buffer_get_byte (&edit->buffer, i);
+ if (*p != xx_tolower (edit, c))
return -1;
}
}
- return (whole_right != NULL &&
- strchr (whole_right,
- xx_tolower (edit, edit_buffer_get_byte (&edit->buffer, i))) != NULL) ? -1 : i;
+
+ if (whole_right == NULL)
+ return i;
+
+ c = edit_buffer_get_byte (&edit->buffer, i);
+ c = xx_tolower (edit, c);
+ return strchr (whole_right, c) != NULL ? -1 : i;
}
/* --------------------------------------------------------------------------------------------- */
@@ -371,7 +381,8 @@ apply_rules_going_right (WEdit * edit, off_t i)
off_t end = 0;
edit_syntax_rule_t _rule = edit->rule;
- c = xx_tolower (edit, edit_buffer_get_byte (&edit->buffer, i));
+ c = edit_buffer_get_byte (&edit->buffer, i);
+ c = xx_tolower (edit, c);
if (c == 0)
return;
@@ -801,44 +812,44 @@ get_args (char *l, char **args, int args_size)
/* --------------------------------------------------------------------------------------------- */
static int
-this_try_alloc_color_pair (const char *fg, const char *bg, const char *attrs)
+this_try_alloc_color_pair (tty_color_pair_t * color)
{
char f[80], b[80], a[80], *p;
- if (bg != NULL && *bg == '\0')
- bg = NULL;
- if (fg != NULL && *fg == '\0')
- fg = NULL;
- if (attrs != NULL && *attrs == '\0')
- attrs = NULL;
+ if (color->bg != NULL && *color->bg == '\0')
+ color->bg = NULL;
+ if (color->fg != NULL && *color->fg == '\0')
+ color->fg = NULL;
+ if (color->attrs != NULL && *color->attrs == '\0')
+ color->attrs = NULL;
- if ((fg == NULL) && (bg == NULL))
+ if (color->fg == NULL && color->bg == NULL)
return EDITOR_NORMAL_COLOR;
- if (fg != NULL)
+ if (color->fg != NULL)
{
- g_strlcpy (f, fg, sizeof (f));
+ g_strlcpy (f, color->fg, sizeof (f));
p = strchr (f, '/');
if (p != NULL)
*p = '\0';
- fg = f;
+ color->fg = f;
}
- if (bg != NULL)
+ if (color->bg != NULL)
{
- g_strlcpy (b, bg, sizeof (b));
+ g_strlcpy (b, color->bg, sizeof (b));
p = strchr (b, '/');
if (p != NULL)
*p = '\0';
- bg = b;
+ color->bg = b;
}
- if ((fg == NULL) || (bg == NULL))
+ if (color->fg == NULL || color->bg == NULL)
{
/* get colors from skin */
char *editnormal;
editnormal = mc_skin_get ("editor", "_default_", "default;default");
- if (fg == NULL)
+ if (color->fg == NULL)
{
g_strlcpy (f, editnormal, sizeof (f));
p = strchr (f, ';');
@@ -846,24 +857,24 @@ this_try_alloc_color_pair (const char *fg, const char *bg, const char *attrs)
*p = '\0';
if (f[0] == '\0')
g_strlcpy (f, "default", sizeof (f));
- fg = f;
+ color->fg = f;
}
- if (bg == NULL)
+ if (color->bg == NULL)
{
p = strchr (editnormal, ';');
if ((p != NULL) && (*(++p) != '\0'))
g_strlcpy (b, p, sizeof (b));
else
g_strlcpy (b, "default", sizeof (b));
- bg = b;
+ color->bg = b;
}
g_free (editnormal);
}
- if (attrs != NULL)
+ if (color->attrs != NULL)
{
- g_strlcpy (a, attrs, sizeof (a));
+ g_strlcpy (a, color->attrs, sizeof (a));
p = strchr (a, '/');
if (p != NULL)
*p = '\0';
@@ -871,9 +882,10 @@ this_try_alloc_color_pair (const char *fg, const char *bg, const char *attrs)
p = a;
while ((p = strchr (p, SYNTAX_TOKEN_PLUS)) != NULL)
*p++ = '+';
- attrs = a;
+ color->attrs = a;
}
- return tty_try_alloc_color_pair (fg, bg, attrs);
+
+ return tty_try_alloc_color_pair (color, TRUE);
}
/* --------------------------------------------------------------------------------------------- */
@@ -923,7 +935,7 @@ static int
edit_read_syntax_rules (WEdit * edit, FILE * f, char **args, int args_size)
{
FILE *g = NULL;
- char *fg, *bg, *attrs;
+ tty_color_pair_t color;
char last_fg[32] = "", last_bg[32] = "", last_attrs[64] = "";
char whole_right[512];
char whole_left[512];
@@ -1089,19 +1101,19 @@ edit_read_syntax_rules (WEdit * edit, FILE * f, char **args, int args_size)
g_ptr_array_add (c->keyword, k);
no_words = FALSE;
subst_defines (edit->defines, a, &args[ARGS_LEN]);
- fg = *a;
+ color.fg = *a;
if (*a != NULL)
a++;
- bg = *a;
+ color.bg = *a;
if (*a != NULL)
a++;
- attrs = *a;
+ color.attrs = *a;
if (*a != NULL)
a++;
- g_strlcpy (last_fg, fg != NULL ? fg : "", sizeof (last_fg));
- g_strlcpy (last_bg, bg != NULL ? bg : "", sizeof (last_bg));
- g_strlcpy (last_attrs, attrs != NULL ? attrs : "", sizeof (last_attrs));
- k->color = this_try_alloc_color_pair (fg, bg, attrs);
+ g_strlcpy (last_fg, color.fg != NULL ? color.fg : "", sizeof (last_fg));
+ g_strlcpy (last_bg, color.bg != NULL ? color.bg : "", sizeof (last_bg));
+ g_strlcpy (last_attrs, color.attrs != NULL ? color.attrs : "", sizeof (last_attrs));
+ k->color = this_try_alloc_color_pair (&color);
k->keyword = g_string_new (" ");
check_not_a;
}
@@ -1153,22 +1165,22 @@ edit_read_syntax_rules (WEdit * edit, FILE * f, char **args, int args_size)
k->keyword = g_string_new (*a++);
subst_defines (edit->defines, a, &args[ARGS_LEN]);
- fg = *a;
+ color.fg = *a;
if (*a != NULL)
a++;
- bg = *a;
+ color.bg = *a;
if (*a != NULL)
a++;
- attrs = *a;
+ color.attrs = *a;
if (*a != NULL)
a++;
- if (fg == NULL)
- fg = last_fg;
- if (bg == NULL)
- bg = last_bg;
- if (attrs == NULL)
- attrs = last_attrs;
- k->color = this_try_alloc_color_pair (fg, bg, attrs);
+ if (color.fg == NULL)
+ color.fg = last_fg;
+ if (color.bg == NULL)
+ color.bg = last_bg;
+ if (color.attrs == NULL)
+ color.attrs = last_attrs;
+ k->color = this_try_alloc_color_pair (&color);
check_not_a;
}
else if (*(args[0]) == '#')
@@ -1481,7 +1493,7 @@ edit_free_syntax_rules (WEdit * edit)
g_ptr_array_free (edit->rules, TRUE);
edit->rules = NULL;
g_clear_slist (&edit->syntax_marker, g_free);
- tty_color_free_all_tmp ();
+ tty_color_free_temp ();
}
/* --------------------------------------------------------------------------------------------- */
diff --git a/src/events_init.c b/src/events_init.c
index 53473e5..b29678c 100644
--- a/src/events_init.c
+++ b/src/events_init.c
@@ -1,7 +1,7 @@
/*
Event callbacks initialization
- Copyright (C) 2011-2023
+ Copyright (C) 2011-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/execute.c b/src/execute.c
index c220774..21095a2 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -1,7 +1,7 @@
/*
Execution routines for GNU Midnight Commander
- Copyright (C) 2003-2023
+ Copyright (C) 2003-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/file_history.c b/src/file_history.c
index e46985e..f4989e7 100644
--- a/src/file_history.c
+++ b/src/file_history.c
@@ -1,7 +1,7 @@
/*
Load and show history of edited and viewed files
- Copyright (C) 2020-2023
+ Copyright (C) 2020-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/filemanager/Makefile.am b/src/filemanager/Makefile.am
index 534d8dc..0b3c365 100644
--- a/src/filemanager/Makefile.am
+++ b/src/filemanager/Makefile.am
@@ -35,6 +35,4 @@ AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS)
if ENABLE_EXT2FS_ATTR
libmcfilemanager_la_SOURCES += \
chattr.c
-
-AM_CPPFLAGS += @EXT2FS_CFLAGS@ @E2P_CFLAGS@
endif
diff --git a/src/filemanager/Makefile.in b/src/filemanager/Makefile.in
index 2e1300b..4297fd9 100644
--- a/src/filemanager/Makefile.in
+++ b/src/filemanager/Makefile.in
@@ -91,7 +91,6 @@ host_triplet = @host@
@ENABLE_EXT2FS_ATTR_TRUE@am__append_1 = \
@ENABLE_EXT2FS_ATTR_TRUE@ chattr.c
-@ENABLE_EXT2FS_ATTR_TRUE@am__append_2 = @EXT2FS_CFLAGS@ @E2P_CFLAGS@
subdir = src/filemanager
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
@@ -138,7 +137,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
@@ -467,7 +466,7 @@ libmcfilemanager_la_SOURCES = achown.c boxes.c boxes.h cd.c cd.h \
# Unmaintained, unsupported, etc
# listmode.c listmode.h
-AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(am__append_2)
+AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS)
all: all-am
.SUFFIXES:
diff --git a/src/filemanager/achown.c b/src/filemanager/achown.c
index dca3eca..717a645 100644
--- a/src/filemanager/achown.c
+++ b/src/filemanager/achown.c
@@ -1,7 +1,7 @@
/*
Chown-advanced command -- for the Midnight Commander
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
This file is part of the Midnight Commander.
diff --git a/src/filemanager/boxes.c b/src/filemanager/boxes.c
index e091c95..2dbc75d 100644
--- a/src/filemanager/boxes.c
+++ b/src/filemanager/boxes.c
@@ -1,7 +1,7 @@
/*
Some misc dialog boxes for the program.
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/filemanager/cd.c b/src/filemanager/cd.c
index 564a605..65b1f62 100644
--- a/src/filemanager/cd.c
+++ b/src/filemanager/cd.c
@@ -1,7 +1,7 @@
/*
cd_to() function.
- Copyright (C) 1995-2023
+ Copyright (C) 1995-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/filemanager/chattr.c b/src/filemanager/chattr.c
index 08a5a99..b5de12a 100644
--- a/src/filemanager/chattr.c
+++ b/src/filemanager/chattr.c
@@ -1,7 +1,7 @@
/*
Chattr command -- for the Midnight Commander
- Copyright (C) 2020-2023
+ Copyright (C) 2020-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/filemanager/chmod.c b/src/filemanager/chmod.c
index c93bcbc..bac3d99 100644
--- a/src/filemanager/chmod.c
+++ b/src/filemanager/chmod.c
@@ -1,7 +1,7 @@
/*
Chmod command -- for the Midnight Commander
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
This file is part of the Midnight Commander.
diff --git a/src/filemanager/chown.c b/src/filemanager/chown.c
index 1ce769f..ff84a4f 100644
--- a/src/filemanager/chown.c
+++ b/src/filemanager/chown.c
@@ -1,7 +1,7 @@
/*
Chown command -- for the Midnight Commander
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
This file is part of the Midnight Commander.
diff --git a/src/filemanager/cmd.c b/src/filemanager/cmd.c
index 8c33fd8..0ef7184 100644
--- a/src/filemanager/cmd.c
+++ b/src/filemanager/cmd.c
@@ -2,7 +2,7 @@
Routines invoked by a function key
They normally operate on the current panel.
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
@@ -1199,15 +1199,15 @@ sftplink_cmd (void)
/* --------------------------------------------------------------------------------------------- */
-#ifdef ENABLE_VFS_FISH
+#ifdef ENABLE_VFS_SHELL
void
-fishlink_cmd (void)
+shelllink_cmd (void)
{
nice_cd (_("Shell link to machine"), _(machine_str),
"[FIle transfer over SHell filesystem]", ":fishlink_cmd: Shell link to machine ",
"sh://", 1, TRUE);
}
-#endif /* ENABLE_VFS_FISH */
+#endif /* ENABLE_VFS_SHELL */
/* --------------------------------------------------------------------------------------------- */
diff --git a/src/filemanager/cmd.h b/src/filemanager/cmd.h
index 26bfdb7..30b309c 100644
--- a/src/filemanager/cmd.h
+++ b/src/filemanager/cmd.h
@@ -35,8 +35,8 @@ void ftplink_cmd (void);
#ifdef ENABLE_VFS_SFTP
void sftplink_cmd (void);
#endif
-#ifdef ENABLE_VFS_FISH
-void fishlink_cmd (void);
+#ifdef ENABLE_VFS_SHELL
+void shelllink_cmd (void);
#endif
void undelete_cmd (void);
void help_cmd (void);
diff --git a/src/filemanager/command.c b/src/filemanager/command.c
index 47d2d75..360f104 100644
--- a/src/filemanager/command.c
+++ b/src/filemanager/command.c
@@ -4,7 +4,7 @@
with all the magic of the command input line, we depend on some
help from the program's callback.
- Copyright (C) 1995-2023
+ Copyright (C) 1995-2024
Free Software Foundation, Inc.
Written by:
@@ -139,8 +139,11 @@ enter (WInput * lc_cmdline)
char *s;
s = expand_format (NULL, cmd[++i], TRUE);
- g_string_append (command, s);
- g_free (s);
+ if (s != NULL)
+ {
+ g_string_append (command, s);
+ g_free (s);
+ }
}
}
@@ -248,8 +251,11 @@ command_insert (WInput * in, const char *text, gboolean insert_extra_space)
char *quoted_text;
quoted_text = name_quote (text, TRUE);
- input_insert (in, quoted_text, insert_extra_space);
- g_free (quoted_text);
+ if (quoted_text != NULL)
+ {
+ input_insert (in, quoted_text, insert_extra_space);
+ g_free (quoted_text);
+ }
}
/* --------------------------------------------------------------------------------------------- */
diff --git a/src/filemanager/dir.c b/src/filemanager/dir.c
index 0931819..b405131 100644
--- a/src/filemanager/dir.c
+++ b/src/filemanager/dir.c
@@ -1,7 +1,7 @@
/*
Directory routines
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/filemanager/ext.c b/src/filemanager/ext.c
index b21c4d0..ccf5192 100644
--- a/src/filemanager/ext.c
+++ b/src/filemanager/ext.c
@@ -1,7 +1,7 @@
/*
Extension dependent execution.
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
@@ -331,15 +331,19 @@ exec_make_shell_string (const char *lc_data, const vfs_path_t * filename_vpath)
}
}
- if (!is_cd)
- g_string_append (shell_string, text);
- else
+ if (text != NULL)
{
- strcpy (pbuffer, text);
- pbuffer = strchr (pbuffer, 0);
+ if (!is_cd)
+ g_string_append (shell_string, text);
+ else
+ {
+ strcpy (pbuffer, text);
+ pbuffer = strchr (pbuffer, '\0');
+ }
+
+ g_free (text);
}
- g_free (text);
written_nonspace = TRUE;
}
}
@@ -593,12 +597,15 @@ get_popen_information (const char *cmd_file, const char *args, char *buf, int bu
static int
get_file_type_local (const vfs_path_t * filename_vpath, char *buf, int buflen)
{
- char *tmp;
- int ret;
+ char *filename_quoted;
+ int ret = 0;
- tmp = name_quote (vfs_path_get_last_path_str (filename_vpath), FALSE);
- ret = get_popen_information (FILE_CMD, tmp, buf, buflen);
- g_free (tmp);
+ filename_quoted = name_quote (vfs_path_get_last_path_str (filename_vpath), FALSE);
+ if (filename_quoted != NULL)
+ {
+ ret = get_popen_information (FILE_CMD, filename_quoted, buf, buflen);
+ g_free (filename_quoted);
+ }
return ret;
}
@@ -613,18 +620,28 @@ get_file_type_local (const vfs_path_t * filename_vpath, char *buf, int buflen)
static int
get_file_encoding_local (const vfs_path_t * filename_vpath, char *buf, int buflen)
{
- char *tmp, *lang, *args;
- int ret;
+ char *filename_quoted;
+ int ret = 0;
+
+ filename_quoted = name_quote (vfs_path_get_last_path_str (filename_vpath), FALSE);
+ if (filename_quoted != NULL)
+ {
+ char *lang;
- tmp = name_quote (vfs_path_get_last_path_str (filename_vpath), FALSE);
- lang = name_quote (autodetect_codeset, FALSE);
- args = g_strconcat (" -L", lang, " -i ", tmp, (char *) NULL);
+ lang = name_quote (autodetect_codeset, FALSE);
+ if (lang != NULL)
+ {
+ char *args;
- ret = get_popen_information ("enca", args, buf, buflen);
+ args = g_strdup_printf (" -L %s -i %s", lang, filename_quoted);
+ g_free (lang);
- g_free (args);
- g_free (lang);
- g_free (tmp);
+ ret = get_popen_information ("enca", args, buf, buflen);
+ g_free (args);
+ }
+
+ g_free (filename_quoted);
+ }
return ret;
}
diff --git a/src/filemanager/file.c b/src/filemanager/file.c
index fa2ef44..4e1f2c9 100644
--- a/src/filemanager/file.c
+++ b/src/filemanager/file.c
@@ -1,7 +1,7 @@
/*
File management.
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
@@ -1521,7 +1521,7 @@ recursive_erase (file_op_total_context_t * tctx, file_op_context_t * ctx, const
*
* ATTENTION! Be careful when modifying this function (like commit 25e419ba0886f)!
* Some implementations of readdir() in MC VFS (for example, vfs_s_readdir(), which is used
- * in FISH) don't return "." and ".." entries.
+ * in SHELL) don't return "." and ".." entries.
*/
static int
check_dir_is_empty (const vfs_path_t * vpath)
@@ -2765,9 +2765,12 @@ copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx,
/* Query to remove short file */
if (query_dialog (Q_ ("DialogTitle|Copy"), _("Incomplete file was retrieved"),
D_ERROR, 2, _("&Delete"), _("&Keep")) == 0)
- mc_unlink (dst_vpath);
+ dst_status = DEST_SHORT_DELETE;
+ else
+ dst_status = DEST_SHORT_KEEP;
}
- else if (dst_status == DEST_SHORT_DELETE)
+
+ if (dst_status == DEST_SHORT_DELETE)
mc_unlink (dst_vpath);
else if (dst_status == DEST_FULL && !appending)
{
@@ -2812,9 +2815,11 @@ copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx,
src_mode = 0100666 & ~src_mode;
mc_chmod (dst_vpath, (src_mode & ctx->umask_kill));
}
+ }
+ /* Always sync timestamps */
+ if (dst_status == DEST_FULL || dst_status == DEST_SHORT_KEEP)
mc_utime (dst_vpath, &times);
- }
if (return_status == FILE_CONT)
return_status = progress_update_one (tctx, ctx, file_size);
diff --git a/src/filemanager/filegui.c b/src/filemanager/filegui.c
index abca598..8e7777f 100644
--- a/src/filemanager/filegui.c
+++ b/src/filemanager/filegui.c
@@ -10,7 +10,7 @@
Janne Kukonlehto added much error recovery to them for being used
in an interactive program.
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/filemanager/filemanager.c b/src/filemanager/filemanager.c
index b995024..1250dad 100644
--- a/src/filemanager/filemanager.c
+++ b/src/filemanager/filemanager.c
@@ -1,7 +1,7 @@
/*
Main dialog (file panels) of the Midnight Commander
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
@@ -210,8 +210,8 @@ create_panel_menu (void)
#ifdef ENABLE_VFS_FTP
entries = g_list_prepend (entries, menu_entry_new (_("FT&P link..."), CK_ConnectFtp));
#endif
-#ifdef ENABLE_VFS_FISH
- entries = g_list_prepend (entries, menu_entry_new (_("S&hell link..."), CK_ConnectFish));
+#ifdef ENABLE_VFS_SHELL
+ entries = g_list_prepend (entries, menu_entry_new (_("S&hell link..."), CK_ConnectShell));
#endif
#ifdef ENABLE_VFS_SFTP
entries = g_list_prepend (entries, menu_entry_new (_("SFTP li&nk..."), CK_ConnectSftp));
@@ -1240,9 +1240,9 @@ midnight_execute_cmd (Widget * sender, long command)
case CK_Find:
find_cmd (current_panel);
break;
-#ifdef ENABLE_VFS_FISH
- case CK_ConnectFish:
- fishlink_cmd ();
+#ifdef ENABLE_VFS_SHELL
+ case CK_ConnectShell:
+ shelllink_cmd ();
break;
#endif
#ifdef ENABLE_VFS_FTP
diff --git a/src/filemanager/filenot.c b/src/filemanager/filenot.c
index 2bfc76a..0ceed42 100644
--- a/src/filemanager/filenot.c
+++ b/src/filemanager/filenot.c
@@ -3,7 +3,7 @@
tree about the changes made to the directory
structure.
- Copyright (C) 2011-2023
+ Copyright (C) 2011-2024
Free Software Foundation, Inc.
Author:
diff --git a/src/filemanager/fileopctx.c b/src/filemanager/fileopctx.c
index a118749..2da3072 100644
--- a/src/filemanager/fileopctx.c
+++ b/src/filemanager/fileopctx.c
@@ -1,7 +1,7 @@
/*
File operation contexts for the Midnight Commander
- Copyright (C) 1999-2023
+ Copyright (C) 1999-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/filemanager/find.c b/src/filemanager/find.c
index c0d2cf9..93f89b1 100644
--- a/src/filemanager/find.c
+++ b/src/filemanager/find.c
@@ -1,7 +1,7 @@
/*
Find file command for the Midnight Commander
- Copyright (C) 1995-2023
+ Copyright (C) 1995-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/filemanager/hotlist.c b/src/filemanager/hotlist.c
index fa04a3b..68406e4 100644
--- a/src/filemanager/hotlist.c
+++ b/src/filemanager/hotlist.c
@@ -1,7 +1,7 @@
/*
Directory hotlist -- for the Midnight Commander
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/filemanager/info.c b/src/filemanager/info.c
index 790f820..584bc2a 100644
--- a/src/filemanager/info.c
+++ b/src/filemanager/info.c
@@ -1,7 +1,7 @@
/*
Panel managing.
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/filemanager/layout.c b/src/filemanager/layout.c
index c9d581f..1160772 100644
--- a/src/filemanager/layout.c
+++ b/src/filemanager/layout.c
@@ -1,7 +1,7 @@
/*
Panel layout module for the Midnight Commander
- Copyright (C) 1995-2023
+ Copyright (C) 1995-2024
Free Software Foundation, Inc.
Written by:
@@ -1015,8 +1015,7 @@ setup_cmdline (void)
#ifdef ENABLE_SUBSHELL
if (mc_global.tty.use_subshell)
{
- subshell_prompt = g_string_new (tmp_prompt);
- g_free (tmp_prompt);
+ subshell_prompt = g_string_new_take (tmp_prompt);
mc_prompt = subshell_prompt->str;
}
#endif
diff --git a/src/filemanager/mountlist.c b/src/filemanager/mountlist.c
index d7fd734..bab6aa1 100644
--- a/src/filemanager/mountlist.c
+++ b/src/filemanager/mountlist.c
@@ -1,7 +1,7 @@
/*
Return a list of mounted file systems
- Copyright (C) 1991-2023
+ Copyright (C) 1991-2024
Free Software Foundation, Inc.
This file is part of the Midnight Commander.
diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
index ec1dbc3..b1174c0 100644
--- a/src/filemanager/panel.c
+++ b/src/filemanager/panel.c
@@ -1,7 +1,7 @@
/*
Panel managing.
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
@@ -2353,8 +2353,7 @@ goto_parent_dir (WPanel * panel)
mc_build_filename (vfs_path_as_str (panel->panelized_descr->root_vpath), fname->str,
(char *) NULL);
- fname = g_string_new (fname2);
- g_free (fname2);
+ fname = g_string_new_take (fname2);
}
bname = x_basename (fname->str);
@@ -2923,6 +2922,7 @@ static gboolean
do_enter_on_file_entry (WPanel * panel, file_entry_t * fe)
{
const char *fname = fe->fname->str;
+ char *fname_quoted;
vfs_path_t *full_name_vpath;
gboolean ok;
@@ -2973,12 +2973,14 @@ do_enter_on_file_entry (WPanel * panel, file_entry_t * fe)
return confirm_execute || (ret == 0);
}
+ fname_quoted = name_quote (fname, FALSE);
+ if (fname_quoted != NULL)
{
- char *tmp, *cmd;
+ char *cmd;
+
+ cmd = g_strconcat ("." PATH_SEP_STR, fname_quoted, (char *) NULL);
+ g_free (fname_quoted);
- tmp = name_quote (fname, FALSE);
- cmd = g_strconcat (".", PATH_SEP_STR, tmp, (char *) NULL);
- g_free (tmp);
shell_execute (cmd, 0);
g_free (cmd);
}
@@ -5240,8 +5242,7 @@ panel_panelize_cd (void)
tmp_vpath =
vfs_path_append_new (pdescr->root_vpath, plist->list[i].fname->str, (char *) NULL);
- list->list[i].fname = g_string_new (vfs_path_as_str (tmp_vpath));
- vfs_path_free (tmp_vpath, TRUE);
+ list->list[i].fname = g_string_new_take (vfs_path_free (tmp_vpath, FALSE));
}
list->list[i].f.link_to_dir = plist->list[i].f.link_to_dir;
list->list[i].f.stale_link = plist->list[i].f.stale_link;
diff --git a/src/filemanager/panelize.c b/src/filemanager/panelize.c
index e90076c..b1c87ca 100644
--- a/src/filemanager/panelize.c
+++ b/src/filemanager/panelize.c
@@ -1,7 +1,7 @@
/*
External panelize
- Copyright (C) 1995-2023
+ Copyright (C) 1995-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/filemanager/tree.c b/src/filemanager/tree.c
index fd50407..6f86693 100644
--- a/src/filemanager/tree.c
+++ b/src/filemanager/tree.c
@@ -6,7 +6,7 @@
created and destroyed. This is required for the future vfs layer,
it will be possible to have tree views over virtual file systems.
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
@@ -985,6 +985,16 @@ tree_toggle_navig (WTree * tree)
/* --------------------------------------------------------------------------------------------- */
+static void
+tree_help (void)
+{
+ ev_help_t event_data = { NULL, "[Directory Tree]" };
+
+ mc_event_raise (MCEVENT_GROUP_CORE, "help", &event_data);
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
static cb_ret_t
tree_execute_cmd (WTree * tree, long command)
{
@@ -996,10 +1006,7 @@ tree_execute_cmd (WTree * tree, long command)
switch (command)
{
case CK_Help:
- {
- ev_help_t event_data = { NULL, "[Directory Tree]" };
- mc_event_raise (MCEVENT_GROUP_CORE, "help", &event_data);
- }
+ tree_help ();
break;
case CK_Forget:
tree_forget (tree);
diff --git a/src/filemanager/treestore.c b/src/filemanager/treestore.c
index 2d23c93..984bb92 100644
--- a/src/filemanager/treestore.c
+++ b/src/filemanager/treestore.c
@@ -8,7 +8,7 @@
created and destroyed. This is required for the future vfs layer,
it will be possible to have tree views over virtual file systems.
- Copyright (C) 1999-2023
+ Copyright (C) 1999-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/help.c b/src/help.c
index a14744a..f36704c 100644
--- a/src/help.c
+++ b/src/help.c
@@ -1,7 +1,7 @@
/*
Hypertext file browser.
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
This file is part of the Midnight Commander.
@@ -126,21 +126,20 @@ static const char *
search_string (const char *start, const char *text)
{
const char *result = NULL;
- char *local_text = g_strdup (text);
- char *d = local_text;
+ char *local_text;
+ char *d;
const char *e = start;
+ local_text = g_strdup (text);
+
/* fmt sometimes replaces a space with a newline in the help file */
/* Replace the newlines in the link name with spaces to correct the situation */
- while (*d != '\0')
- {
+ for (d = local_text; *d != '\0'; str_next_char (&d))
if (*d == '\n')
*d = ' ';
- str_next_char (&d);
- }
/* Do search */
- for (d = local_text; *e; e++)
+ for (d = local_text; *e != '\0'; e++)
{
if (*d == *e)
d++;
@@ -166,11 +165,12 @@ search_string (const char *start, const char *text)
static const char *
search_string_node (const char *start, const char *text)
{
- const char *d = text;
- const char *e = start;
-
if (start != NULL)
- for (; *e && *e != CHAR_NODE_END; e++)
+ {
+ const char *d = text;
+ const char *e;
+
+ for (e = start; *e != '\0' && *e != CHAR_NODE_END; e++)
{
if (*d == *e)
d++;
@@ -179,6 +179,7 @@ search_string_node (const char *start, const char *text)
if (*d == '\0')
return e + 1;
}
+ }
return NULL;
}
@@ -271,7 +272,7 @@ move_backward (int i)
static void
move_to_top (void)
{
- while (((int) (currentpoint > fdata) > 0) && (*currentpoint != CHAR_NODE_END))
+ while (((int) (currentpoint - fdata) > 0) && (*currentpoint != CHAR_NODE_END))
currentpoint--;
while (*currentpoint != ']')
@@ -301,7 +302,7 @@ help_follow_link (const char *start, const char *lc_selected_item)
if (lc_selected_item == NULL)
return start;
- for (p = lc_selected_item; *p && *p != CHAR_NODE_END && *p != CHAR_LINK_POINTER; p++)
+ for (p = lc_selected_item; *p != '\0' && *p != CHAR_NODE_END && *p != CHAR_LINK_POINTER; p++)
;
if (*p == CHAR_LINK_POINTER)
{
@@ -309,7 +310,8 @@ help_follow_link (const char *start, const char *lc_selected_item)
char link_name[MAXLINKNAME];
link_name[0] = '[';
- for (i = 1; *p != CHAR_LINK_END && *p && *p != CHAR_NODE_END && i < MAXLINKNAME - 3;)
+ for (i = 1;
+ *p != CHAR_LINK_END && *p != '\0' && *p != CHAR_NODE_END && i < MAXLINKNAME - 3;)
link_name[i++] = *++p;
link_name[i - 1] = ']';
link_name[i] = '\0';
@@ -447,10 +449,7 @@ help_print_word (WDialog * h, GString * word, int *col, int *line, gboolean add_
static void
help_show (WDialog * h, const char *paint_start)
{
- const char *p, *n;
- int col, line, c;
gboolean painting = TRUE;
- gboolean acs; /* Flag: Alternate character set active? */
gboolean repeat_paint;
int active_col, active_line; /* Active link position */
char buff[MB_LEN_MAX + 1];
@@ -461,9 +460,15 @@ help_show (WDialog * h, const char *paint_start)
tty_setcolor (HELP_NORMAL_COLOR);
do
{
- line = col = active_col = active_line = 0;
+ int line = 0;
+ int col = 0;
+ gboolean acs = FALSE; /* Flag: Is alternate character set active? */
+ const char *p, *n;
+
+ active_col = 0;
+ active_line = 0;
+
repeat_paint = FALSE;
- acs = FALSE;
clear_link_areas ();
if ((int) (selected_item - paint_start) < 0)
@@ -473,6 +478,8 @@ help_show (WDialog * h, const char *paint_start)
n = paint_start;
while ((n[0] != '\0') && (n[0] != CHAR_NODE_END) && (line < help_lines))
{
+ int c;
+
p = n;
n = str_cget_next_char (p);
memcpy (buff, p, n - p);
@@ -597,7 +604,7 @@ help_show (WDialog * h, const char *paint_start)
g_string_free (word, TRUE);
/* Position the cursor over a nice link */
- if (active_col)
+ if (active_col != 0)
widget_gotoyx (h, active_line, active_col);
}
@@ -1143,9 +1150,8 @@ help_interactive_display (const gchar * event_group_name, const gchar * event_na
selected_item = search_string_node (main_node, STRING_LINK_START) - 1;
currentpoint = main_node + 1; /* Skip the newline following the start of the node */
- for (history_ptr = HISTORY_SIZE; history_ptr;)
+ for (history_ptr = HISTORY_SIZE - 1; history_ptr >= 0; history_ptr--)
{
- history_ptr--;
history[history_ptr].page = currentpoint;
history[history_ptr].link = selected_item;
}
diff --git a/src/keymap.c b/src/keymap.c
index 3f6cce4..e708fb2 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1,7 +1,7 @@
/*
Default values and initialization of keybinding engine
- Copyright (C) 2009-2023
+ Copyright (C) 2009-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/learn.c b/src/learn.c
index c704ce1..f42aebf 100644
--- a/src/learn.c
+++ b/src/learn.c
@@ -1,7 +1,7 @@
/*
Learn keys
- Copyright (C) 1995-2023
+ Copyright (C) 1995-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/main.c b/src/main.c
index c18e069..fcc31bb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,7 +1,7 @@
/*
Main program for the Midnight Commander
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
@@ -279,6 +279,13 @@ main (int argc, char *argv[])
return exit_code;
}
+ /* check terminal type
+ * $TERM must be set and not empty
+ * mc_global.tty.xterm_flag is used in init_key() and tty_init()
+ * Do this after mc_args_parse() where mc_args__force_xterm is set up.
+ */
+ mc_global.tty.xterm_flag = tty_check_term (mc_args__force_xterm);
+
/* do this before mc_args_show_info () to view paths in the --datadir-info output */
OS_Setup ();
@@ -346,13 +353,6 @@ main (int argc, char *argv[])
vfs_path_free (vpath, TRUE);
}
- /* check terminal type
- * $TERM must be set and not empty
- * mc_global.tty.xterm_flag is used in init_key() and tty_init()
- * Do this after mc_args_handle() where mc_args__force_xterm is set up.
- */
- mc_global.tty.xterm_flag = tty_check_term (mc_args__force_xterm);
-
/* NOTE: This has to be called before tty_init or whatever routine
calls any define_sequence */
init_key ();
diff --git a/src/man2hlp/Makefile.in b/src/man2hlp/Makefile.in
index e2273de..f3d66e5 100644
--- a/src/man2hlp/Makefile.in
+++ b/src/man2hlp/Makefile.in
@@ -134,7 +134,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
diff --git a/src/man2hlp/man2hlp.in b/src/man2hlp/man2hlp.in
index 8aa7131..16e5e7b 100644
--- a/src/man2hlp/man2hlp.in
+++ b/src/man2hlp/man2hlp.in
@@ -1,8 +1,7 @@
#! @PERL_FOR_BUILD@
#
# Man page to help file converter
-# Copyright (C) 1994, 1995, 1998, 2000, 2001, 2002, 2003, 2004, 2005,
-# 2007, 2010, 2011
+# Copyright (C) 1994-2024
# The Free Software Foundation, Inc.
#
# Originally written by:
diff --git a/src/selcodepage.c b/src/selcodepage.c
index c8a3cdc..067ad67 100644
--- a/src/selcodepage.c
+++ b/src/selcodepage.c
@@ -3,7 +3,7 @@
Copyright (C) 2001 Walery Studennikov <despair@sama.ru>
- Copyright (C) 2011-2023
+ Copyright (C) 2011-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/setup.c b/src/setup.c
index 68e6f37..9d6e153 100644
--- a/src/setup.c
+++ b/src/setup.c
@@ -1,7 +1,7 @@
/*
Setup loading/saving.
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
This file is part of the Midnight Commander.
@@ -44,8 +44,8 @@
#ifdef ENABLE_VFS_FTP
#include "src/vfs/ftpfs/ftpfs.h"
#endif
-#ifdef ENABLE_VFS_FISH
-#include "src/vfs/fish/fish.h"
+#ifdef ENABLE_VFS_SHELL
+#include "src/vfs/shell/shell.h"
#endif
#ifdef HAVE_CHARSET
@@ -227,7 +227,7 @@ GArray *macros_list;
/*** file scope variables ************************************************************************/
static char *profile_name = NULL; /* ${XDG_CONFIG_HOME}/mc/ini */
-static char *panels_profile_name = NULL; /* ${XDG_CACHE_HOME}/mc/panels.ini */
+static char *panels_profile_name = NULL; /* ${XDG_CONFIG_HOME}/mc/panels.ini */
/* *INDENT-OFF* */
static const struct
@@ -386,9 +386,9 @@ static const struct
{ "ftpfs_directory_timeout", &ftpfs_directory_timeout },
{ "ftpfs_retry_seconds", &ftpfs_retry_seconds },
#endif /* ENABLE_VFS_FTP */
-#ifdef ENABLE_VFS_FISH
- { "fish_directory_timeout", &fish_directory_timeout },
-#endif /* ENABLE_VFS_FISH */
+#ifdef ENABLE_VFS_SHELL
+ { "shell_directory_timeout", &shell_directory_timeout },
+#endif /* ENABLE_VFS_SHELL */
#endif /* ENABLE_VFS */
/* option_tab_spacing is used in internal viewer */
{ "editor_tab_spacing", &option_tab_spacing },
diff --git a/src/subshell/Makefile.in b/src/subshell/Makefile.in
index 18ef165..2520c6f 100644
--- a/src/subshell/Makefile.in
+++ b/src/subshell/Makefile.in
@@ -134,7 +134,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
diff --git a/src/subshell/common.c b/src/subshell/common.c
index 3ea4b5f..1c432fd 100644
--- a/src/subshell/common.c
+++ b/src/subshell/common.c
@@ -1,7 +1,7 @@
/*
Concurrent shell support for the Midnight Commander
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/subshell/proxyfunc.c b/src/subshell/proxyfunc.c
index 3f180d3..b1c20a9 100644
--- a/src/subshell/proxyfunc.c
+++ b/src/subshell/proxyfunc.c
@@ -1,7 +1,7 @@
/*
Proxy functions for getting access to public variables into 'filemanager' module.
- Copyright (C) 2015-2023
+ Copyright (C) 2015-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/textconf.c b/src/textconf.c
index e8accd9..0a1f4cc 100644
--- a/src/textconf.c
+++ b/src/textconf.c
@@ -1,7 +1,7 @@
/*
Print features specific for this build
- Copyright (C) 2000-2023
+ Copyright (C) 2000-2024
Free Software Foundation, Inc.
This file is part of the Midnight Commander.
@@ -75,8 +75,8 @@ static const char *const vfs_supported[] = {
#ifdef ENABLE_VFS_SFTP
"sftpfs",
#endif
-#ifdef ENABLE_VFS_FISH
- "fish",
+#ifdef ENABLE_VFS_SHELL
+ "shell",
#endif
NULL
};
@@ -218,15 +218,15 @@ show_datadirs_extended (void)
PRINTF_SECTION (_("File extension handlers:"), EXTHELPERSDIR);
-#if defined ENABLE_VFS_EXTFS || defined ENABLE_VFS_FISH
+#if defined ENABLE_VFS_EXTFS || defined ENABLE_VFS_SHELL
PRINTF_SECTION (_("VFS plugins and scripts:"), LIBEXECDIR);
#ifdef ENABLE_VFS_EXTFS
PRINTF2 ("extfs.d:", LIBEXECDIR, MC_EXTFS_DIR PATH_SEP_STR);
#endif
-#ifdef ENABLE_VFS_FISH
- PRINTF2 ("fish:", LIBEXECDIR, FISH_PREFIX PATH_SEP_STR);
+#ifdef ENABLE_VFS_SHELL
+ PRINTF2 ("shell:", LIBEXECDIR, VFS_SHELL_PREFIX PATH_SEP_STR);
#endif
-#endif /* ENABLE_VFS_EXTFS || defiined ENABLE_VFS_FISH */
+#endif /* ENABLE_VFS_EXTFS || defiined ENABLE_VFS_SHELL */
(void) puts ("");
PRINTF_GROUP (_("User data"));
@@ -237,8 +237,8 @@ show_datadirs_extended (void)
#ifdef ENABLE_VFS_EXTFS
PRINTF ("extfs.d:", mc_config_get_data_path (), MC_EXTFS_DIR PATH_SEP_STR);
#endif
-#ifdef ENABLE_VFS_FISH
- PRINTF ("fish:", mc_config_get_data_path (), FISH_PREFIX PATH_SEP_STR);
+#ifdef ENABLE_VFS_SHELL
+ PRINTF ("shell:", mc_config_get_data_path (), VFS_SHELL_PREFIX PATH_SEP_STR);
#endif
#ifdef USE_INTERNAL_EDIT
PRINTF ("mcedit macros:", mc_config_get_data_path (), MC_MACRO_FILE);
diff --git a/src/usermenu.c b/src/usermenu.c
index c328871..accd9f2 100644
--- a/src/usermenu.c
+++ b/src/usermenu.c
@@ -1,7 +1,7 @@
/*
User Menu implementation
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
@@ -86,20 +86,24 @@ static char *menu = NULL;
static char *
strip_ext (char *ss)
{
- char *s = ss;
+ char *s;
char *e = NULL;
- while (*s != '\0')
+ if (ss == NULL)
+ return NULL;
+
+ for (s = ss; *s != '\0'; s++)
{
if (*s == '.')
e = s;
if (IS_PATH_SEP (*s) && e != NULL)
e = NULL; /* '.' in *directory* name */
- s++;
}
+
if (e != NULL)
*e = '\0';
- return ss;
+
+ return (*ss == '\0' ? NULL : ss);
}
/* --------------------------------------------------------------------------------------------- */
@@ -501,8 +505,11 @@ execute_menu_command (const Widget * edit_widget, const char *commands, gboolean
char *tmp;
tmp = name_quote (parameter, FALSE);
- fputs (tmp, cmd_file);
- g_free (tmp);
+ if (tmp != NULL)
+ {
+ fputs (tmp, cmd_file);
+ g_free (tmp);
+ }
}
else
fputs (parameter, cmd_file);
@@ -528,8 +535,11 @@ execute_menu_command (const Widget * edit_widget, const char *commands, gboolean
char *text;
text = expand_format (edit_widget, *commands, do_quote);
- fputs (text, cmd_file);
- g_free (text);
+ if (text != NULL)
+ {
+ fputs (text, cmd_file);
+ g_free (text);
+ }
}
}
else if (*commands == '%')
@@ -779,7 +789,7 @@ expand_format (const Widget * edit_widget, char c, gboolean do_quote)
else
{
if (get_other_type () != view_listing)
- return g_strdup ("");
+ return NULL;
panel = other_panel;
}
@@ -800,7 +810,7 @@ expand_format (const Widget * edit_widget, char c, gboolean do_quote)
default:
/* other modes don't use formats */
- return g_strdup ("");
+ return NULL;
}
if (do_quote)
@@ -822,16 +832,13 @@ expand_format (const Widget * edit_widget, char c, gboolean do_quote)
case 'd':
{
const char *cwd;
- char *qstr;
if (panel != NULL)
cwd = vfs_path_as_str (panel->cwd_vpath);
else
cwd = vfs_get_current_dir ();
- qstr = quote_func (cwd, FALSE);
-
- result = qstr;
+ result = quote_func (cwd, FALSE);
goto ret;
}
case 'c':
@@ -914,31 +921,37 @@ expand_format (const Widget * edit_widget, char c, gboolean do_quote)
case 't':
case 'u':
{
- GString *block;
+ GString *block = NULL;
int i;
if (panel == NULL)
{
- result = g_strdup ("");
+ result = NULL;
goto ret;
}
- block = g_string_sized_new (16);
-
for (i = 0; i < panel->dir.len; i++)
if (panel->dir.list[i].f.marked != 0)
{
char *tmp;
tmp = quote_func (panel->dir.list[i].fname->str, FALSE);
- g_string_append (block, tmp);
- g_string_append_c (block, ' ');
- g_free (tmp);
+ if (tmp != NULL)
+ {
+ if (block == NULL)
+ block = g_string_new_take (tmp);
+ else
+ {
+ g_string_append (block, tmp);
+ g_free (tmp);
+ }
+ g_string_append_c (block, ' ');
+ }
if (c_lc == 'u')
do_file_mark (panel, i, 0);
}
- result = g_string_free (block, FALSE);
+ result = block == NULL ? NULL : g_string_free (block, block->len == 0);
goto ret;
} /* sub case block */
default:
diff --git a/src/util.c b/src/util.c
index 36159a9..bc590fb 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1,7 +1,7 @@
/*
Various non-library utilities
- Copyright (C) 2003-2023
+ Copyright (C) 2003-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/vfs/Makefile.am b/src/vfs/Makefile.am
index 1441953..4adde8e 100644
--- a/src/vfs/Makefile.am
+++ b/src/vfs/Makefile.am
@@ -16,9 +16,9 @@ SUBDIRS += extfs
libmc_vfs_la_LIBADD += extfs/libvfs-extfs.la
endif
-if ENABLE_VFS_FISH
-SUBDIRS += fish
-libmc_vfs_la_LIBADD += fish/libvfs-fish.la
+if ENABLE_VFS_SHELL
+SUBDIRS += shell
+libmc_vfs_la_LIBADD += shell/libvfs-shell.la
endif
if ENABLE_VFS_FTP
diff --git a/src/vfs/Makefile.in b/src/vfs/Makefile.in
index a245efe..fc0898d 100644
--- a/src/vfs/Makefile.in
+++ b/src/vfs/Makefile.in
@@ -92,8 +92,8 @@ host_triplet = @host@
@ENABLE_VFS_CPIO_TRUE@am__append_2 = cpio/libvfs-cpio.la
@ENABLE_VFS_EXTFS_TRUE@am__append_3 = extfs
@ENABLE_VFS_EXTFS_TRUE@am__append_4 = extfs/libvfs-extfs.la
-@ENABLE_VFS_FISH_TRUE@am__append_5 = fish
-@ENABLE_VFS_FISH_TRUE@am__append_6 = fish/libvfs-fish.la
+@ENABLE_VFS_SHELL_TRUE@am__append_5 = shell
+@ENABLE_VFS_SHELL_TRUE@am__append_6 = shell/libvfs-shell.la
@ENABLE_VFS_FTP_TRUE@am__append_7 = ftpfs
@ENABLE_VFS_FTP_TRUE@am__append_8 = ftpfs/libvfs-ftpfs.la
@ENABLE_VFS_SFTP_TRUE@am__append_9 = sftpfs
@@ -150,7 +150,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
@@ -252,7 +252,7 @@ am__define_uniq_tagged_files = \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
-DIST_SUBDIRS = local cpio extfs fish ftpfs sftpfs sfs tar undelfs
+DIST_SUBDIRS = local cpio extfs shell ftpfs sftpfs sfs tar undelfs
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
diff --git a/src/vfs/cpio/Makefile.in b/src/vfs/cpio/Makefile.in
index 8534a52..a129146 100644
--- a/src/vfs/cpio/Makefile.in
+++ b/src/vfs/cpio/Makefile.in
@@ -134,7 +134,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
diff --git a/src/vfs/cpio/cpio.c b/src/vfs/cpio/cpio.c
index 447d1f6..1b904c5 100644
--- a/src/vfs/cpio/cpio.c
+++ b/src/vfs/cpio/cpio.c
@@ -1,7 +1,7 @@
/*
Virtual File System: GNU Tar file system.
- Copyright (C) 2000-2023
+ Copyright (C) 2000-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/vfs/extfs/Makefile.in b/src/vfs/extfs/Makefile.in
index 317af30..cce1b12 100644
--- a/src/vfs/extfs/Makefile.in
+++ b/src/vfs/extfs/Makefile.in
@@ -134,7 +134,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
diff --git a/src/vfs/extfs/extfs.c b/src/vfs/extfs/extfs.c
index d6ef7af..11a9ba5 100644
--- a/src/vfs/extfs/extfs.c
+++ b/src/vfs/extfs/extfs.c
@@ -1,7 +1,7 @@
/*
Virtual File System: External file system.
- Copyright (C) 1995-2023
+ Copyright (C) 1995-2024
Free Software Foundation, Inc.
Written by:
@@ -916,10 +916,9 @@ extfs_cmd (const char *str_extfs_cmd, const struct extfs_super_t *archive,
{
char *file;
char *quoted_file;
- char *quoted_localname;
char *archive_name, *quoted_archive_name;
const extfs_plugin_info_t *info;
- char *cmd;
+ char *cmd = NULL;
int retval = 0;
GError *error = NULL;
mc_pipe_t *pip;
@@ -928,20 +927,49 @@ extfs_cmd (const char *str_extfs_cmd, const struct extfs_super_t *archive,
quoted_file = name_quote (file, FALSE);
g_free (file);
+ if (quoted_file == NULL)
+ {
+ message (D_ERROR, MSG_ERROR, _("EXTFS virtual file system:\nwrong file name"));
+ return (-1);
+ }
+
/* Skip leading "./" (if present) added in name_quote() */
file = extfs_skip_leading_dotslash (quoted_file);
archive_name = extfs_get_archive_name (archive);
quoted_archive_name = name_quote (archive_name, FALSE);
g_free (archive_name);
- quoted_localname = name_quote (localname, FALSE);
+
+ if (quoted_archive_name == NULL)
+ {
+ message (D_ERROR, MSG_ERROR, _("EXTFS virtual file system:\nwrong archive name"));
+ return (-1);
+ }
+
info = &g_array_index (extfs_plugins, extfs_plugin_info_t, archive->fstype);
- cmd = g_strconcat (info->path, info->prefix, str_extfs_cmd,
- quoted_archive_name, " ", file, " ", quoted_localname, (char *) NULL);
+
+ if (localname == NULL || *localname == '\0')
+ cmd = g_strconcat (info->path, info->prefix, str_extfs_cmd, quoted_archive_name, " ",
+ file, (char *) NULL);
+ else
+ {
+ char *quoted_localname;
+
+ quoted_localname = name_quote (localname, FALSE);
+ cmd = g_strconcat (info->path, info->prefix, str_extfs_cmd, quoted_archive_name, " ",
+ file, " ", quoted_localname, (char *) NULL);
+ g_free (quoted_localname);
+ }
+
g_free (quoted_file);
- g_free (quoted_localname);
g_free (quoted_archive_name);
+ if (cmd == NULL)
+ {
+ message (D_ERROR, MSG_ERROR, _("EXTFS virtual file system:\ncannot build command"));
+ return (-1);
+ }
+
/* don't read stdout */
pip = mc_popen (cmd, FALSE, TRUE, &error);
g_free (cmd);
diff --git a/src/vfs/extfs/helpers/Makefile.in b/src/vfs/extfs/helpers/Makefile.in
index 0a240fb..95e5375 100644
--- a/src/vfs/extfs/helpers/Makefile.in
+++ b/src/vfs/extfs/helpers/Makefile.in
@@ -135,7 +135,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
diff --git a/src/vfs/extfs/helpers/iso9660.in b/src/vfs/extfs/helpers/iso9660.in
index 5a6f1d5..f78db61 100644
--- a/src/vfs/extfs/helpers/iso9660.in
+++ b/src/vfs/extfs/helpers/iso9660.in
@@ -132,6 +132,7 @@ mcisofs_list () {
*.lz) MYCAT="lzip -dc";;
*.lz4) MYCAT="lz4 -dc";;
*.lzma) MYCAT="lzma -dc";;
+ *.lzo) MYCAT="lzop -dc";;
*.xz) MYCAT="xz -dc";;
*.zst) MYCAT="zstd -dc";;
*.bz2) MYCAT="bzip2 -dc";;
diff --git a/src/vfs/extfs/helpers/lslR.in b/src/vfs/extfs/helpers/lslR.in
index 69b663b..f568c02 100644
--- a/src/vfs/extfs/helpers/lslR.in
+++ b/src/vfs/extfs/helpers/lslR.in
@@ -15,6 +15,7 @@ case "$1" in
*.lz) MYCAT="lzip -dc";;
*.lz4) MYCAT="lz4 -dc";;
*.lzma) MYCAT="lzma -dc";;
+ *.lzo) MYCAT="lzop -dc";;
*.xz) MYCAT="xz -dc";;
*.zst) MYCAT="zstd -dc";;
*.bz2) MYCAT="bzip2 -dc";;
diff --git a/src/vfs/extfs/helpers/mailfs.in b/src/vfs/extfs/helpers/mailfs.in
index 5bb373b..20cfae3 100644
--- a/src/vfs/extfs/helpers/mailfs.in
+++ b/src/vfs/extfs/helpers/mailfs.in
@@ -11,6 +11,7 @@ $bzcat="bzip2 -dc"; # bunzip2 to stdout
$lzipcat="lzip -dc"; # unlzip to stdout
$lz4cat="lz4 -dc"; # unlz4 to stdout
$lzcat="lzma -dc"; # unlzma to stdout
+$lzocat="lzop -dc"; # unlzo to stdout
$xzcat="xz -dc"; # unxz to stdout
$zstdcat="zstd -dc"; # unzstd to stdout
$file="file"; # "file" command
@@ -194,6 +195,8 @@ if (/gzip/) {
exit 1 unless (open IN, "$lz4cat $mbox_qname|");
} elsif (/lzma/) {
exit 1 unless (open IN, "$lzcat $mbox_qname|");
+} elsif (/lzo/) {
+ exit 1 unless (open IN, "$lzocat $mbox_qname|");
} elsif (/xz/) {
exit 1 unless (open IN, "$xzcat $mbox_qname|");
} elsif (/zst/) {
diff --git a/src/vfs/extfs/helpers/patchfs.in b/src/vfs/extfs/helpers/patchfs.in
index ee1e651..59fdde1 100644
--- a/src/vfs/extfs/helpers/patchfs.in
+++ b/src/vfs/extfs/helpers/patchfs.in
@@ -17,6 +17,7 @@ use File::Temp 'tempfile';
my $lzip = 'lzip';
my $lz4 = 'lz4';
my $lzma = 'lzma';
+my $lzo = 'lzop';
my $xz = 'xz';
my $zstd = 'zstd';
my $bzip = 'bzip2';
@@ -88,6 +89,8 @@ sub myin
return "$lzip -dc $qfname";
} elsif (/^'*lzma/) {
return "$lzma -dc $qfname";
+ } elsif (/^'*lzo/) {
+ return "$lzo -dc $qfname";
} elsif (/^'*xz/) {
return "$xz -dc $qfname";
} elsif (/^'*zst/) {
@@ -114,6 +117,8 @@ sub myout
return "$lzip -c $sep $qfname";
} elsif (/^'*lzma/) {
return "$lzma -c $sep $qfname";
+ } elsif (/^'*lzo/) {
+ return "$lzo -c $sep $qfname";
} elsif (/^'*xz/) {
return "$xz -c $sep $qfname";
} elsif (/^'*zst/) {
diff --git a/src/vfs/extfs/helpers/s3+.in b/src/vfs/extfs/helpers/s3+.in
index f5e4b90..6436ba7 100644
--- a/src/vfs/extfs/helpers/s3+.in
+++ b/src/vfs/extfs/helpers/s3+.in
@@ -153,16 +153,16 @@ def threadmap(fun, iterable, maxthreads=16):
Propagates exception safely.
"""
from threading import Thread
- import Queue
+ import queue
items = list(iterable)
nitems = len(items)
if nitems < 2:
- return map(fun, items)
+ return list(map(fun, items))
# Create and fill input queue
- input = Queue.Queue()
- output = Queue.Queue()
+ input = queue.Queue()
+ output = queue.Queue()
for i,item in enumerate(items):
input.put( (i,item) )
@@ -181,7 +181,7 @@ def threadmap(fun, iterable, maxthreads=16):
output.put( (i,result) )
except:
output.put( (None,sys.exc_info()) )
- except Queue.Empty:
+ except queue.Empty:
return
# Start threads
@@ -196,8 +196,8 @@ def threadmap(fun, iterable, maxthreads=16):
try:
i,res = output.get()
if i == None:
- raise res[0],res[1],res[2]
- except Queue.Empty:
+ raise res[0](res[1]).with_traceback(res[2])
+ except queue.Empty:
break
ret.append(res)
@@ -241,7 +241,7 @@ def get_bucket(name):
b = s3.get_bucket(name, validate=False)
b.get_location() # just to raise an exception on error
return b
- except boto.exception.S3ResponseError, e:
+ except boto.exception.S3ResponseError as e:
# Seems this is the only proper way to switch to the bucket's region.
# Requesting of the default region for "?location" does not work unfortunately.
m = re.search(r'<Region>(.*?)</Region>', e.body)
@@ -340,7 +340,7 @@ if cmd == 'list':
expr = re.compile(r'^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})\.\d{3}Z$')
def convDate(awsdatetime):
m = expr.match(awsdatetime)
- ye,mo,da,ho,mi,se = map(int,m.groups())
+ ye,mo,da,ho,mi,se = list(map(int,m.groups()))
dt = datetime.datetime(ye,mo,da,ho,mi,se, tzinfo=pytz.utc)
return dt.astimezone(tz).strftime('%m-%d-%Y %H:%M')
diff --git a/src/vfs/extfs/helpers/uc1541 b/src/vfs/extfs/helpers/uc1541
index dc15b42..abb86ea 100755..100644
--- a/src/vfs/extfs/helpers/uc1541
+++ b/src/vfs/extfs/helpers/uc1541
@@ -1,24 +1,25 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""
UC1541 Virtual filesystem
Author: Roman 'gryf' Dobosz <gryf73@gmail.com>
-Date: 2019-09-20
-Version: 3.3
+Date: 2023-10-04
+Version: 3.6
Licence: BSD
source: https://bitbucket.org/gryf/uc1541
mirror: https://github.com/gryf/uc1541
"""
-
-import sys
-import re
-import os
+import argparse
import gzip
-from subprocess import Popen, PIPE
+import logging
+import os
+import re
+import subprocess
+import sys
+
+LOG = logging.getLogger('UC1541')
if os.getenv('UC1541_DEBUG'):
- import logging
- LOG = logging.getLogger('UC1541')
LOG.setLevel(logging.DEBUG)
FILE_HANDLER = logging.FileHandler("/tmp/uc1541.log")
FILE_FORMATTER = logging.Formatter("%(asctime)s %(levelname)-8s "
@@ -26,47 +27,11 @@ if os.getenv('UC1541_DEBUG'):
FILE_HANDLER.setFormatter(FILE_FORMATTER)
FILE_HANDLER.setLevel(logging.DEBUG)
LOG.addHandler(FILE_HANDLER)
-else:
- class LOG(object):
- """
- Dummy logger object. Does nothing.
- """
- @classmethod
- def debug(*args, **kwargs):
- pass
-
- @classmethod
- def info(*args, **kwargs):
- pass
-
- @classmethod
- def warning(*args, **kwargs):
- pass
-
- @classmethod
- def error(*args, **kwargs):
- pass
-
- @classmethod
- def critical(*args, **kwargs):
- pass
SECLEN = 256
-def _ord(string_or_int):
- """
- Return an int value for the (possible) string passed in argument. This
- function is for compatibility between python2 and python3, where single
- element in byte string array is a string or an int respectively.
- """
- try:
- return ord(string_or_int)
- except TypeError:
- return string_or_int
-
-
def _get_raw(dimage):
"""
Try to get contents of the D64 image either it's gzip compressed or not.
@@ -160,10 +125,10 @@ class Disk(object):
filename = list()
for chr_ in string:
- if _ord(chr_) == 160: # shift+space character; $a0
+ if chr_ == 160: # shift+space character; $a0
break
- character = D64.CHAR_MAP.get(_ord(chr_), '?')
+ character = D64.CHAR_MAP.get(chr_, '?')
filename.append(character)
# special cases
@@ -204,8 +169,8 @@ class Disk(object):
if not self.current_sector_data:
return False
- self.next_track = _ord(self.current_sector_data[0])
- self.next_sector = _ord(self.current_sector_data[1])
+ self.next_track = self.current_sector_data[0]
+ self.next_sector = self.current_sector_data[1]
if (self.next_track, self.next_sector) in self._already_done:
# Just a failsafe. Endless loop is not what is expected.
@@ -239,7 +204,7 @@ class Disk(object):
sector = self.current_sector_data
for dummy in range(8):
entry = sector[:32]
- ftype = _ord(entry[2])
+ ftype = entry[2]
if ftype == 0: # deleted
sector = sector[32:]
@@ -247,12 +212,12 @@ class Disk(object):
type_verbose = self._get_ftype(ftype)
- protect = _ord(entry[2]) & 64 and "<" or " "
+ protect = entry[2] & 64 and "<" or " "
fname = entry[5:21]
if ftype == 'rel':
- size = _ord(entry[23])
+ size = entry[23]
else:
- size = _ord(entry[30]) + _ord(entry[31]) * 226
+ size = entry[30] + entry[31] * 226
self._dir_contents.append({'fname': self._map_filename(fname),
'ftype': type_verbose,
@@ -392,7 +357,7 @@ class Uc1541(object):
"""
Class for interact with c1541 program and MC
"""
- PRG = re.compile(r'(\d+)\s+"([^"]*)".+?\s(del|prg|rel|seq|usr)([\s<])')
+ PRG = re.compile(r'(\d+)\s+"([^"]*)".+?(del|prg|rel|seq|usr)([\s<])')
def __init__(self, archname):
self.arch = archname
@@ -430,11 +395,7 @@ class Uc1541(object):
"""
LOG.info("Removing file %s", dst)
dst = self._get_masked_fname(dst)
-
- if not self._call_command('delete', dst=dst):
- return self._show_error()
-
- return 0
+ return self._call_command('delete', dst=dst)
def copyin(self, dst, src):
"""
@@ -442,11 +403,7 @@ class Uc1541(object):
"""
LOG.info("Copy into D64 %s as %s", src, dst)
dst = self._correct_fname(dst)
-
- if not self._call_command('write', src=src, dst=dst):
- return self._show_error()
-
- return 0
+ return self._call_command('write', src=src, dst=dst)
def copyout(self, src, dst):
"""
@@ -459,10 +416,7 @@ class Uc1541(object):
src = self._get_masked_fname(src)
- if not self._call_command('read', src=src, dst=dst):
- return self._show_error()
-
- return 0
+ return self._call_command('read', src=src, dst=dst)
def mkdir(self, dirname):
"""Not supported"""
@@ -523,8 +477,9 @@ class Uc1541(object):
uid = os.getuid()
gid = os.getgid()
- if not self._call_command('list'):
- return self._show_error()
+ res = self._call_command('list')
+ if res != 0:
+ return res
idx = 0
for line in self.out.split("\n"):
@@ -540,7 +495,7 @@ class Uc1541(object):
if '/' in display_name:
display_name = display_name.replace('/', '|')
- # workaround for space and dash at the beginning of the
+ # workaround for space and dash at the beggining of the
# filename
char_map = {' ': '~',
'-': '_'}
@@ -593,13 +548,16 @@ class Uc1541(object):
universal_newlines = True
if cmd in ['delete', 'write']:
universal_newlines = False
- self.out, self.err = Popen(command,
- universal_newlines=universal_newlines,
- stdout=PIPE, stderr=PIPE).communicate()
+ (self.out,
+ self.err) = subprocess.Popen(command,
+ universal_newlines=universal_newlines,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE).communicate()
if self.err:
LOG.debug('an err: %s', self.err)
- return not self.err
+ return self._show_error()
+ return 0
CALL_MAP = {'list': lambda a: Uc1541(a.arch).list(),
@@ -612,7 +570,7 @@ CALL_MAP = {'list': lambda a: Uc1541(a.arch).list(),
def parse_args():
"""Use ArgumentParser to check for script arguments and execute."""
- parser = ArgumentParser()
+ parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(help='supported commands',
dest='subcommand')
subparsers.required = True
@@ -659,44 +617,6 @@ def parse_args():
return args.func(args)
-def no_parse():
- """Failsafe argument "parsing". Note, that it blindly takes positional
- arguments without checking them. In case of wrong arguments it will
- silently exit"""
- try:
- if sys.argv[1] not in ('list', 'copyin', 'copyout', 'rm', 'mkdir',
- "run"):
- sys.exit(2)
- except IndexError:
- sys.exit(2)
-
- class Arg(object):
- """Mimic argparse object"""
- dst = None
- src = None
- arch = None
-
- arg = Arg()
-
- try:
- arg.arch = sys.argv[2]
- if sys.argv[1] in ('copyin', 'copyout'):
- arg.src = sys.argv[3]
- arg.dst = sys.argv[4]
- elif sys.argv[1] in ('rm', 'run', 'mkdir'):
- arg.dst = sys.argv[3]
- except IndexError:
- sys.exit(2)
-
- return CALL_MAP[sys.argv[1]](arg)
-
-
if __name__ == "__main__":
LOG.debug("Script params: %s", str(sys.argv))
- try:
- from argparse import ArgumentParser
- PARSE_FUNC = parse_args
- except ImportError:
- PARSE_FUNC = no_parse
-
- sys.exit(PARSE_FUNC())
+ sys.exit(parse_args())
diff --git a/src/vfs/fish/helpers/Makefile.am b/src/vfs/fish/helpers/Makefile.am
deleted file mode 100644
index e3ba15d..0000000
--- a/src/vfs/fish/helpers/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-fishdir = $(libexecdir)/@PACKAGE@/fish
-
-# Files to install and distribute other than fish scripts
-FISH_MISC = README.fish
-
-# Install and distribute FISH helper scripts w/o shebang & executable bit as data
-fish_DATA = $(FISH_MISC) ls mkdir fexists unlink chown chmod rmdir ln mv hardlink get send append info utime
-fishconfdir = $(sysconfdir)/@PACKAGE@
-
-EXTRA_DIST = $(fish_DATA)
diff --git a/src/vfs/fish/helpers/README.fish b/src/vfs/fish/helpers/README.fish
deleted file mode 100644
index ac319c8..0000000
--- a/src/vfs/fish/helpers/README.fish
+++ /dev/null
@@ -1,217 +0,0 @@
-
- FIles transferred over SHell protocol (V 0.0.3)
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-This protocol was designed for transferring files over a remote shell
-connection (rsh and compatibles). It can be as well used for transfers over
-rsh, and there may be other uses.
-
-Client sends requests of following form:
-
-#FISH_COMMAND
-equivalent shell commands,
-which may be multiline
-
-Only fish commands are defined here, shell equivalents are for your
-information only and will probably vary from implementation to
-implementation. Fish commands always have priority: server is
-expected to execute fish command if it understands it. If it does not,
-however, it can try the luck and execute shell command.
-
-Since version 4.7.3, the scripts that FISH sends to host machines after
-a command is transmitted are no longer hardwired in the Midnight
-Commander source code.
-
-First, mc looks for system-wide set of scripts, then it checks whether
-current user has host-specific overrides in his per-user mc
-configuration directory. User-defined overrides take priority over
-sytem-wide scripts if they exist. The order in which the directories are
-traversed is as follows:
-
- /usr/libexec/mc/fish
- ~/.local/share/mc/fish/<hostname>/
-
-Server's reply is multiline, but always ends with
-
-### 000<optional text>
-
-line. ### is prefix to mark this line, 000 is return code. Return
-codes are superset to those used in ftp.
-
-There are few new exit codes defined:
-
-000 don't know; if there were no previous lines, this marks COMPLETE
-success, if they were, it marks failure.
-
-001 don't know; if there were no previous lines, this marks
-PRELIMinary success, if they were, it marks failure
-
- Connecting
- ~~~~~~~~~~
-Client uses "echo FISH:;/bin/sh" as command executed on remote
-machine. This should make it possible for server to distinguish FISH
-connections from normal rsh/ssh.
-
- Commands
- ~~~~~~~~
-#FISH
-echo; start_fish_server; echo '### 200'
-
-This command is sent at the beginning. It marks that client wishes to
-talk via FISH protocol. #VER command must follow. If server
-understands FISH protocol, it has option to put FISH server somewhere
-on system path and name it start_fish_server.
-
-#VER 0.0.2 <feature1> <feature2> <...>
-echo '### 000'
-
-This command is the second one. It sends client version and extensions
-to the server. Server should reply with protocol version to be used,
-and list of extensions accepted.
-
-VER 0.0.0 <feature2>
-### 200
-
-#PWD
-pwd; echo '### 200'
-
-Server should reply with current directory (in form /abc/def/ghi)
-followed by line indicating success.
-
-#LIST /directory
-ls -lLa $1 | grep '^[^cbt]' | ( while read p x u g s m d y n; do echo "P$p $u.$g
-S$s
-d$m $d $y
-:$n
-"; done )
-ls -lLa $1 | grep '^[cb]' | ( while read p x u g a i m d y n; do echo "P$p $u.$g
-E$a$i
-dD$m $d $y
-:$n
-"; done )
-echo '### 200'
-
-This allows client to list directory or get status information about
-single file. Output is in following form (any line except :<filename>
-may be omitted):
-
-P<unix permissions> <owner>.<group>
-S<size>
-d<3-letters month name> <day> <year or HH:MM>
-D<year> <month> <day> <hour> <minute> <second>[.1234]
-E<major-of-device>,<minor>
-:<filename>
-L<filename symlink points to>
-<blank line to separate items>
-
-Unix permissions are of form X--------- where X is type of
-file. Currently, '-' means regular file, 'd' means directory, 'c', 'b'
-means character and block device, 'l' means symbolic link, 'p' means
-FIFO and 's' means socket.
-
-'d' has three fields: month (one of strings Jan Feb Mar Apr May Jun
-Jul Aug Sep Oct Nov Dec), day of month, and third is either single
-number indicating year, or HH:MM field (assume current year in such
-case). As you've probably noticed, this is pretty broken; it is for
-compatibility with ls listing.
-
-#RETR /some/name
-ls -l /some/name | ( read a b c d x e; echo $x ); echo '### 100'; cat /some/name; echo '### 200'
-
-Server sends line with filesize on it, followed by line with ### 100
-indicating partial success, then it sends binary data (exactly
-filesize bytes) and follows them with (with no preceding newline) ###
-200.
-
-Note that there's no way to abort running RETR command - except
-closing the connection.
-
-#STOR <size> /file/name
-> /file/name; echo '### 001'; ( dd bs=4096 count=<size/4096>; dd bs=<size%4096> count=1 ) 2>/dev/null | ( cat > %s; cat > /dev/null ); echo '### 200'
-
-This command is for storing /file/name, which is exactly size bytes
-big. You probably think I went crazy. Well, I did not: that strange
-cat > /dev/null has purpose to discard any extra data which was not
-written to disk (due to for example out of space condition).
-
-[Why? Imagine uploading file with "rm -rf /" line in it.]
-
-#CWD /somewhere
-cd /somewhere; echo '### 000'
-
-It is specified here, but I'm not sure how wise idea is to use this
-one: it breaks stateless-ness of the protocol.
-
-Following commands should be rather self-explanatory:
-
-#CHMOD 1234 file
-chmod 1234 file; echo '### 000'
-
-#DELE /some/path
-rm -f /some/path; echo '### 000'
-
-#MKD /some/path
-mkdir /some/path; echo '### 000'
-
-#RMD /some/path
-rmdir /some/path; echo '### 000'
-
-#RENAME /path/a /path/b
-mv /path/a /path/b; echo '### 000'
-
-#LINK /path/a /path/b
-ln /path/a /path/b; echo '### 000'
-
-#SYMLINK /path/a /path/b
-ln -s /path/a /path/b; echo '### 000'
-
-#CHOWN user /file/name
-chown user /file/name; echo '### 000'
-
-#CHGRP group /file/name
-chgrp group /file/name; echo '### 000'
-
-#INFO
-...collect info about host into $result ...
-echo $result
-echo '### 200'
-
-#READ <offset> <size> /path/and/filename
-cat /path/and/filename | ( dd bs=4096 count=<offset/4096> > /dev/null;
-dd bs=<offset%4096> count=1 > /dev/null;
-dd bs=4096 count=<offset/4096>;
-dd bs=<offset%4096> count=1; )
-
-Returns ### 200 on successful exit, ### 291 on successful exit when
-reading ended at eof, ### 292 on successful exit when reading did not
-end at eof.
-
-#WRITE <offset> <size> /path/and/filename
-
-Hmm, shall we define these ones if we know our client is not going to
-use them?
-
-you can use follow parameters:
-FISH_FILESIZE
-FISH_FILENAME
-FISH_FILEMODE
-FISH_FILEOWNER
-FISH_FILEGROUPE
-FISH_FILEFROM
-FISH_FILETO
-
-NB:
-'FISH_FILESIZE' used if we operate with single file name in 'unlink', 'rmdir', 'chmod', etc...
-'FISH_FILEFROM','FISH_FILETO' used if we operate with two files in 'ln', 'hardlink', 'mv' etc...
-'FISH_FILEOWNER', 'FISH_FILEGROUPE' is a new user/group in chown
-
-also flags:
-FISH_HAVE_HEAD
-FISH_HAVE_SED
-FISH_HAVE_AWK
-FISH_HAVE_PERL
-FISH_HAVE_LSQ
-FISH_HAVE_DATE_MDYT
-
-That's all, folks!
- pavel@ucw.cz
diff --git a/src/vfs/fish/helpers/append b/src/vfs/fish/helpers/append
deleted file mode 100644
index 81ded44..0000000
--- a/src/vfs/fish/helpers/append
+++ /dev/null
@@ -1,16 +0,0 @@
-#APPE $FISH_FILESIZE $FISH_FILENAME
-FILENAME="/${FISH_FILENAME}"
-echo "### 001"
-{
- bss=4096
- bsl=4095
- if [ $FISH_FILESIZE -lt $bss ]; then
- bss=1;
- bsl=0;
- fi
- while [ $FISH_FILESIZE -gt 0 ]; do
- cnt=`expr \\( $FISH_FILESIZE + $bsl \\) / $bss`
- n=`dd bs=$bss count=$cnt | tee -a "${FILENAME}" | wc -c`
- FISH_FILESIZE=`expr $FISH_FILESIZE - $n`
- done
-}; echo "### 200"
diff --git a/src/vfs/fish/helpers/chmod b/src/vfs/fish/helpers/chmod
deleted file mode 100644
index a5a88b4..0000000
--- a/src/vfs/fish/helpers/chmod
+++ /dev/null
@@ -1,6 +0,0 @@
-#CHMOD $FISH_FILEMODE $FISH_FILENAME
-if chmod ${FISH_FILEMODE} "/${FISH_FILENAME}" 2>/dev/null; then
- echo "### 000"
-else
- echo "### 500"
-fi
diff --git a/src/vfs/fish/helpers/chown b/src/vfs/fish/helpers/chown
deleted file mode 100644
index 469fdc1..0000000
--- a/src/vfs/fish/helpers/chown
+++ /dev/null
@@ -1,6 +0,0 @@
-#CHOWN $FISH_FILEOWNER:$FISH_FILEGROUP $FISH_FILENAME
-if chown ${FISH_FILEOWNER}:${FISH_FILEGROUP} "/${FISH_FILENAME}" ; then
- echo "### 000"
-else
- echo "### 500"
-fi
diff --git a/src/vfs/fish/helpers/fexists b/src/vfs/fish/helpers/fexists
deleted file mode 100644
index cf03b15..0000000
--- a/src/vfs/fish/helpers/fexists
+++ /dev/null
@@ -1,3 +0,0 @@
-#ISEXISTS $FISH_FILENAME
-ls -l "/${FISH_FILENAME}" >/dev/null 2>/dev/null
-echo '### '$?
diff --git a/src/vfs/fish/helpers/mkdir b/src/vfs/fish/helpers/mkdir
deleted file mode 100644
index b32e995..0000000
--- a/src/vfs/fish/helpers/mkdir
+++ /dev/null
@@ -1,6 +0,0 @@
-#MKD $FISH_FILENAME
-if mkdir "/$FISH_FILENAME" 2>/dev/null; then
- echo "### 000"
-else
- echo "### 500"
-fi
diff --git a/src/vfs/fish/helpers/mv b/src/vfs/fish/helpers/mv
deleted file mode 100644
index c8cf70c..0000000
--- a/src/vfs/fish/helpers/mv
+++ /dev/null
@@ -1,6 +0,0 @@
-#RENAME $FISH_FILEFROM $FISH_FILETO
-if mv "/${FISH_FILEFROM}" "/${FISH_FILETO}" 2>/dev/null; then
- echo "### 000"
-else
- echo "### 500"
-fi
diff --git a/src/vfs/fish/helpers/rmdir b/src/vfs/fish/helpers/rmdir
deleted file mode 100644
index 0f99bf6..0000000
--- a/src/vfs/fish/helpers/rmdir
+++ /dev/null
@@ -1,6 +0,0 @@
-#RMD $FISH_FILENAME
-if rmdir "/${FISH_FILENAME}" 2>/dev/null; then
- echo "### 000"
-else
- echo "### 500"
-fi
diff --git a/src/vfs/fish/helpers/send b/src/vfs/fish/helpers/send
deleted file mode 100644
index 80dd22b..0000000
--- a/src/vfs/fish/helpers/send
+++ /dev/null
@@ -1,17 +0,0 @@
-#STOR $FISH_FILESIZE $FISH_FILENAME
-FILENAME="/${FISH_FILENAME}"
-echo "### 001"
-{
- > "${FILENAME}"
- bss=4096
- bsl=4095
- if [ $FISH_FILESIZE -lt $bss ]; then
- bss=1;
- bsl=0;
- fi
- while [ $FISH_FILESIZE -gt 0 ]; do
- cnt=`expr \\( $FISH_FILESIZE + $bsl \\) / $bss`
- n=`dd bs=$bss count=$cnt | tee -a "${FILENAME}" | wc -c`
- FISH_FILESIZE=`expr $FISH_FILESIZE - $n`
- done
-}; echo "### 200"
diff --git a/src/vfs/fish/helpers/unlink b/src/vfs/fish/helpers/unlink
deleted file mode 100644
index 79b9ad0..0000000
--- a/src/vfs/fish/helpers/unlink
+++ /dev/null
@@ -1,6 +0,0 @@
-#DELE $FISH_FILENAME
-if rm -f "/${FISH_FILENAME}" 2>/dev/null; then
- echo "### 000"
-else
- echo "### 500"
-fi
diff --git a/src/vfs/fish/helpers/utime b/src/vfs/fish/helpers/utime
deleted file mode 100644
index 94395b4..0000000
--- a/src/vfs/fish/helpers/utime
+++ /dev/null
@@ -1,13 +0,0 @@
-#UTIME "$FISH_TOUCHATIME_W_NSEC" "$FISH_TOUCHMTIME_W_NSEC" "$FISH_FILENAME"
-if TZ=UTC touch -h -m -d "$FISH_TOUCHMTIME_W_NSEC" "/${FISH_FILENAME}" 2>/dev/null && \
- TZ=UTC touch -h -a -d "$FISH_TOUCHATIME_W_NSEC" "/${FISH_FILENAME}" 2>/dev/null; then
- echo "### 000"
-elif TZ=UTC touch -h -m -t $FISH_TOUCHMTIME "/${FISH_FILENAME}" 2>/dev/null && \
- TZ=UTC touch -h -a -t $FISH_TOUCHATIME "/${FISH_FILENAME}" 2>/dev/null; then
- echo "### 000"
-elif [ -n "$FISH_HAVE_PERL" ] &&
- perl -e 'utime '$FISH_FILEATIME','$FISH_FILEMTIME',@ARGV;' "/${FISH_FILENAME}" 2>/dev/null; then
- echo "### 000"
-else
- echo "### 500"
-fi
diff --git a/src/vfs/ftpfs/Makefile.in b/src/vfs/ftpfs/Makefile.in
index e6e561f..2767536 100644
--- a/src/vfs/ftpfs/Makefile.in
+++ b/src/vfs/ftpfs/Makefile.in
@@ -134,7 +134,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
diff --git a/src/vfs/ftpfs/ftpfs.c b/src/vfs/ftpfs/ftpfs.c
index 549ba32..175bd0d 100644
--- a/src/vfs/ftpfs/ftpfs.c
+++ b/src/vfs/ftpfs/ftpfs.c
@@ -1,7 +1,7 @@
/*
Virtual File System: FTP file system.
- Copyright (C) 1995-2023
+ Copyright (C) 1995-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/vfs/ftpfs/ftpfs_parse_ls.c b/src/vfs/ftpfs/ftpfs_parse_ls.c
index 5db79e0..a9ee58c 100644
--- a/src/vfs/ftpfs/ftpfs_parse_ls.c
+++ b/src/vfs/ftpfs/ftpfs_parse_ls.c
@@ -1,7 +1,7 @@
/*
Virtual File System: FTP file system
- Copyright (C) 2015-2023
+ Copyright (C) 2015-2024
The Free Software Foundation, Inc.
Written by: Andrew Borodin <aborodin@vmail.ru>, 2013
diff --git a/src/vfs/local/Makefile.in b/src/vfs/local/Makefile.in
index 6d79948..61c6f0e 100644
--- a/src/vfs/local/Makefile.in
+++ b/src/vfs/local/Makefile.in
@@ -134,7 +134,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
diff --git a/src/vfs/local/local.c b/src/vfs/local/local.c
index a777c84..193fb6b 100644
--- a/src/vfs/local/local.c
+++ b/src/vfs/local/local.c
@@ -1,7 +1,7 @@
/*
Virtual File System: local file system.
- Copyright (C) 1995-2023
+ Copyright (C) 1995-2024
Free Software Foundation, Inc.
This file is part of the Midnight Commander.
diff --git a/src/vfs/plugins_init.c b/src/vfs/plugins_init.c
index 767e284..da13a12 100644
--- a/src/vfs/plugins_init.c
+++ b/src/vfs/plugins_init.c
@@ -1,7 +1,7 @@
/*
Init VFS plugins.
- Copyright (C) 2011-2023
+ Copyright (C) 2011-2024
Free Software Foundation, Inc.
Written by:
@@ -46,8 +46,8 @@
#include "extfs/extfs.h"
#endif
-#ifdef ENABLE_VFS_FISH
-#include "fish/fish.h"
+#ifdef ENABLE_VFS_SHELL
+#include "shell/shell.h"
#endif
#ifdef ENABLE_VFS_FTP
@@ -115,9 +115,9 @@ vfs_plugins_init (void)
#ifdef ENABLE_VFS_SFTP
vfs_init_sftpfs ();
#endif /* ENABLE_VFS_SFTP */
-#ifdef ENABLE_VFS_FISH
- vfs_init_fish ();
-#endif /* ENABLE_VFS_FISH */
+#ifdef ENABLE_VFS_SHELL
+ vfs_init_shell ();
+#endif /* ENABLE_VFS_SHELL */
}
/* --------------------------------------------------------------------------------------------- */
diff --git a/src/vfs/sfs/Makefile.in b/src/vfs/sfs/Makefile.in
index f9893eb..54392be 100644
--- a/src/vfs/sfs/Makefile.in
+++ b/src/vfs/sfs/Makefile.in
@@ -135,7 +135,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
diff --git a/src/vfs/sfs/sfs.c b/src/vfs/sfs/sfs.c
index fdcc823..58ce5a2 100644
--- a/src/vfs/sfs/sfs.c
+++ b/src/vfs/sfs/sfs.c
@@ -1,7 +1,7 @@
/*
Single File fileSystem
- Copyright (C) 1998-2023
+ Copyright (C) 1998-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/vfs/sfs/sfs.ini b/src/vfs/sfs/sfs.ini
index d817dc9..a7b059b 100644
--- a/src/vfs/sfs/sfs.ini
+++ b/src/vfs/sfs/sfs.ini
@@ -16,6 +16,8 @@ lz4/1 lz4 < %1 > %3
ulz4/1 lz4 -d < %1 > %3
lzma/1 lzma < %1 > %3
ulzma/1 lzma -d < %1 > %3
+lzo/1 lzop < %1 > %3
+ulzo/1 lzop -d < %1 > %3
xz/1 xz < %1 > %3
uxz/1 xz -d < %1 > %3
zst/1 zstd < %1 > %3
diff --git a/src/vfs/sftpfs/Makefile.in b/src/vfs/sftpfs/Makefile.in
index e59e875..89bf19f 100644
--- a/src/vfs/sftpfs/Makefile.in
+++ b/src/vfs/sftpfs/Makefile.in
@@ -134,7 +134,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
diff --git a/src/vfs/sftpfs/config_parser.c b/src/vfs/sftpfs/config_parser.c
index d3e2287..d899e37 100644
--- a/src/vfs/sftpfs/config_parser.c
+++ b/src/vfs/sftpfs/config_parser.c
@@ -1,7 +1,7 @@
/* Virtual File System: SFTP file system.
The SSH config parser
- Copyright (C) 2011-2023
+ Copyright (C) 2011-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/vfs/sftpfs/connection.c b/src/vfs/sftpfs/connection.c
index d2466de..6132675 100644
--- a/src/vfs/sftpfs/connection.c
+++ b/src/vfs/sftpfs/connection.c
@@ -1,7 +1,7 @@
/* Virtual File System: SFTP file system.
The internal functions: connections
- Copyright (C) 2011-2023
+ Copyright (C) 2011-2024
Free Software Foundation, Inc.
Written by:
@@ -74,6 +74,37 @@ static const char *const hostkey_method_ssh_ecdsa_256 = "ecdsa-sha2-nistp256";
static const char *const hostkey_method_ssh_rsa = "ssh-rsa";
static const char *const hostkey_method_ssh_dss = "ssh-dss";
+/* *INDENT-OFF* */
+static const char *default_hostkey_methods =
+#ifdef LIBSSH2_KNOWNHOST_KEY_ECDSA_256
+ "ecdsa-sha2-nistp256,"
+#endif
+#ifdef LIBSSH2_KNOWNHOST_KEY_ECDSA_384
+ "ecdsa-sha2-nistp384,"
+#endif
+#ifdef LIBSSH2_KNOWNHOST_KEY_ECDSA_521
+ "ecdsa-sha2-nistp521,"
+#endif
+#ifdef LIBSSH2_KNOWNHOST_KEY_ECDSA_256
+ "ecdsa-sha2-nistp256-cert-v01@openssh.com,"
+#endif
+#ifdef LIBSSH2_KNOWNHOST_KEY_ECDSA_384
+ "ecdsa-sha2-nistp384-cert-v01@openssh.com,"
+#endif
+#ifdef LIBSSH2_KNOWNHOST_KEY_ECDSA_521
+ "ecdsa-sha2-nistp521-cert-v01@openssh.com,"
+#endif
+#ifdef LIBSSH2_KNOWNHOST_KEY_ED25519
+ "ssh-ed25519,"
+ "ssh-ed25519-cert-v01@openssh.com,"
+#endif
+ "rsa-sha2-256,"
+ "rsa-sha2-512,"
+ "ssh-rsa,"
+ "ssh-rsa-cert-v01@openssh.com,"
+ "ssh-dss";
+/* *INDENT-ON* */
+
/**
*
* The current implementation of know host key checking has following limitations:
@@ -257,8 +288,10 @@ sftpfs_read_known_hosts (struct vfs_s_super *super, GError ** mcerror)
continue;
if (store->name == NULL)
- found = TRUE;
- else if (store->name[0] != '[')
+ /* Ignore hashed hostnames. Currently, libssh2 offers no way for us to match it */
+ continue;
+
+ if (store->name[0] != '[')
found = strcmp (store->name, super->path_element->host) == 0;
else
{
@@ -285,6 +318,7 @@ sftpfs_read_known_hosts (struct vfs_s_super *super, GError ** mcerror)
{
int mask;
const char *hostkey_method = NULL;
+ char *hostkey_methods;
mask = store->typemask & LIBSSH2_KNOWNHOST_KEY_MASK;
@@ -326,8 +360,15 @@ sftpfs_read_known_hosts (struct vfs_s_super *super, GError ** mcerror)
return FALSE;
}
+ /* Append the default hostkey methods (with lower priority).
+ * Since we ignored hashed hostnames, the actual matching host
+ * key might have different type than the one found in
+ * known_hosts for non-hashed hostname. Methods not supported
+ * by libssh2 it are ignored. */
+ hostkey_methods = g_strdup_printf ("%s,%s", hostkey_method, default_hostkey_methods);
rc = libssh2_session_method_pref (sftpfs_super->session, LIBSSH2_METHOD_HOSTKEY,
- hostkey_method);
+ hostkey_methods);
+ g_free (hostkey_methods);
if (rc < 0)
goto err;
}
diff --git a/src/vfs/sftpfs/dir.c b/src/vfs/sftpfs/dir.c
index a19a31f..53cb553 100644
--- a/src/vfs/sftpfs/dir.c
+++ b/src/vfs/sftpfs/dir.c
@@ -1,7 +1,7 @@
/* Virtual File System: SFTP file system.
The internal functions: dirs
- Copyright (C) 2011-2023
+ Copyright (C) 2011-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/vfs/sftpfs/file.c b/src/vfs/sftpfs/file.c
index 4146239..ab91b70 100644
--- a/src/vfs/sftpfs/file.c
+++ b/src/vfs/sftpfs/file.c
@@ -1,7 +1,7 @@
/* Virtual File System: SFTP file system.
The internal functions: files
- Copyright (C) 2011-2023
+ Copyright (C) 2011-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/vfs/sftpfs/internal.c b/src/vfs/sftpfs/internal.c
index 9faa76c..dbf15cc 100644
--- a/src/vfs/sftpfs/internal.c
+++ b/src/vfs/sftpfs/internal.c
@@ -1,7 +1,7 @@
/* Virtual File System: SFTP file system.
The internal functions
- Copyright (C) 2011-2023
+ Copyright (C) 2011-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/vfs/sftpfs/sftpfs.c b/src/vfs/sftpfs/sftpfs.c
index f2cc592..ba7d169 100644
--- a/src/vfs/sftpfs/sftpfs.c
+++ b/src/vfs/sftpfs/sftpfs.c
@@ -1,7 +1,7 @@
/* Virtual File System: SFTP file system.
The interface function
- Copyright (C) 2011-2023
+ Copyright (C) 2011-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/vfs/fish/Makefile.am b/src/vfs/shell/Makefile.am
index 4f3ca87..a4cb725 100644
--- a/src/vfs/fish/Makefile.am
+++ b/src/vfs/shell/Makefile.am
@@ -6,8 +6,8 @@ AM_CPPFLAGS = \
$(GLIB_CFLAGS) \
-I$(top_srcdir)
-noinst_LTLIBRARIES = libvfs-fish.la
+noinst_LTLIBRARIES = libvfs-shell.la
-libvfs_fish_la_SOURCES = \
- fish.c fish.h \
- fishdef.h
+libvfs_shell_la_SOURCES = \
+ shell.c shell.h \
+ shelldef.h
diff --git a/src/vfs/fish/Makefile.in b/src/vfs/shell/Makefile.in
index cd952a8..351aba8 100644
--- a/src/vfs/fish/Makefile.in
+++ b/src/vfs/shell/Makefile.in
@@ -88,7 +88,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-subdir = src/vfs/fish
+subdir = src/vfs/shell
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 \
@@ -134,7 +134,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
@@ -151,9 +151,9 @@ CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
-libvfs_fish_la_LIBADD =
-am_libvfs_fish_la_OBJECTS = fish.lo
-libvfs_fish_la_OBJECTS = $(am_libvfs_fish_la_OBJECTS)
+libvfs_shell_la_LIBADD =
+am_libvfs_shell_la_OBJECTS = shell.lo
+libvfs_shell_la_OBJECTS = $(am_libvfs_shell_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
@@ -173,7 +173,7 @@ 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)/fish.Plo
+am__depfiles_remade = ./$(DEPDIR)/shell.Plo
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -193,8 +193,8 @@ 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_fish_la_SOURCES)
-DIST_SOURCES = $(libvfs_fish_la_SOURCES)
+SOURCES = $(libvfs_shell_la_SOURCES)
+DIST_SOURCES = $(libvfs_shell_la_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
@@ -476,10 +476,10 @@ AM_CPPFLAGS = \
$(GLIB_CFLAGS) \
-I$(top_srcdir)
-noinst_LTLIBRARIES = libvfs-fish.la
-libvfs_fish_la_SOURCES = \
- fish.c fish.h \
- fishdef.h
+noinst_LTLIBRARIES = libvfs-shell.la
+libvfs_shell_la_SOURCES = \
+ shell.c shell.h \
+ shelldef.h
all: all-recursive
@@ -494,9 +494,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/vfs/fish/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/vfs/shell/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu src/vfs/fish/Makefile
+ $(AUTOMAKE) --gnu src/vfs/shell/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@@ -526,8 +526,8 @@ clean-noinstLTLIBRARIES:
rm -f $${locs}; \
}
-libvfs-fish.la: $(libvfs_fish_la_OBJECTS) $(libvfs_fish_la_DEPENDENCIES) $(EXTRA_libvfs_fish_la_DEPENDENCIES)
- $(AM_V_CCLD)$(LINK) $(libvfs_fish_la_OBJECTS) $(libvfs_fish_la_LIBADD) $(LIBS)
+libvfs-shell.la: $(libvfs_shell_la_OBJECTS) $(libvfs_shell_la_DEPENDENCIES) $(EXTRA_libvfs_shell_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(libvfs_shell_la_OBJECTS) $(libvfs_shell_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -535,7 +535,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fish.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shell.Plo@am__quote@ # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@@ -767,7 +767,7 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
mostlyclean-am
distclean: distclean-recursive
- -rm -f ./$(DEPDIR)/fish.Plo
+ -rm -f ./$(DEPDIR)/shell.Plo
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
@@ -813,7 +813,7 @@ install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
- -rm -f ./$(DEPDIR)/fish.Plo
+ -rm -f ./$(DEPDIR)/shell.Plo
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
diff --git a/src/vfs/shell/helpers/Makefile.am b/src/vfs/shell/helpers/Makefile.am
new file mode 100644
index 0000000..aa0db25
--- /dev/null
+++ b/src/vfs/shell/helpers/Makefile.am
@@ -0,0 +1,10 @@
+shelldir = $(libexecdir)/@PACKAGE@/shell
+
+# Files to install and distribute other than shell scripts
+SHELL_MISC = README.shell
+
+# Install and distribute SHELL helper scripts w/o shebang & executable bit as data
+shell_DATA = $(SHELL_MISC) ls mkdir fexists unlink chown chmod rmdir ln mv hardlink get send append info utime
+shellconfdir = $(sysconfdir)/@PACKAGE@
+
+EXTRA_DIST = $(shell_DATA)
diff --git a/src/vfs/fish/helpers/Makefile.in b/src/vfs/shell/helpers/Makefile.in
index c17efbb..cef7b97 100644
--- a/src/vfs/fish/helpers/Makefile.in
+++ b/src/vfs/shell/helpers/Makefile.in
@@ -88,7 +88,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-subdir = src/vfs/fish/helpers
+subdir = src/vfs/shell/helpers
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 \
@@ -134,7 +134,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
@@ -196,8 +196,8 @@ am__uninstall_files_from_dir = { \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
-am__installdirs = "$(DESTDIR)$(fishdir)"
-DATA = $(fish_DATA)
+am__installdirs = "$(DESTDIR)$(shelldir)"
+DATA = $(shell_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -410,15 +410,15 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-fishdir = $(libexecdir)/@PACKAGE@/fish
+shelldir = $(libexecdir)/@PACKAGE@/shell
-# Files to install and distribute other than fish scripts
-FISH_MISC = README.fish
+# Files to install and distribute other than shell scripts
+SHELL_MISC = README.shell
-# Install and distribute FISH helper scripts w/o shebang & executable bit as data
-fish_DATA = $(FISH_MISC) ls mkdir fexists unlink chown chmod rmdir ln mv hardlink get send append info utime
-fishconfdir = $(sysconfdir)/@PACKAGE@
-EXTRA_DIST = $(fish_DATA)
+# Install and distribute SHELL helper scripts w/o shebang & executable bit as data
+shell_DATA = $(SHELL_MISC) ls mkdir fexists unlink chown chmod rmdir ln mv hardlink get send append info utime
+shellconfdir = $(sysconfdir)/@PACKAGE@
+EXTRA_DIST = $(shell_DATA)
all: all-am
.SUFFIXES:
@@ -431,9 +431,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/vfs/fish/helpers/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/vfs/shell/helpers/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu src/vfs/fish/helpers/Makefile
+ $(AUTOMAKE) --gnu src/vfs/shell/helpers/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@@ -457,27 +457,27 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
-install-fishDATA: $(fish_DATA)
+install-shellDATA: $(shell_DATA)
@$(NORMAL_INSTALL)
- @list='$(fish_DATA)'; test -n "$(fishdir)" || list=; \
+ @list='$(shell_DATA)'; test -n "$(shelldir)" || list=; \
if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(fishdir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(fishdir)" || exit 1; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(shelldir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(shelldir)" || 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)$(fishdir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(fishdir)" || exit $$?; \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(shelldir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(shelldir)" || exit $$?; \
done
-uninstall-fishDATA:
+uninstall-shellDATA:
@$(NORMAL_UNINSTALL)
- @list='$(fish_DATA)'; test -n "$(fishdir)" || list=; \
+ @list='$(shell_DATA)'; test -n "$(shelldir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- dir='$(DESTDIR)$(fishdir)'; $(am__uninstall_files_from_dir)
+ dir='$(DESTDIR)$(shelldir)'; $(am__uninstall_files_from_dir)
tags TAGS:
ctags CTAGS:
@@ -521,7 +521,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(DATA)
installdirs:
- for dir in "$(DESTDIR)$(fishdir)"; do \
+ for dir in "$(DESTDIR)$(shelldir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@@ -574,7 +574,7 @@ info: info-am
info-am:
-install-data-am: install-fishDATA
+install-data-am: install-shellDATA
install-dvi: install-dvi-am
@@ -618,7 +618,7 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-fishDATA
+uninstall-am: uninstall-shellDATA
.MAKE: install-am install-strip
@@ -626,13 +626,13 @@ uninstall-am: uninstall-fishDATA
cscopelist-am ctags-am distclean distclean-generic \
distclean-libtool 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-fishDATA \
- install-html install-html-am install-info install-info-am \
- install-man install-pdf install-pdf-am install-ps \
- install-ps-am install-strip installcheck installcheck-am \
+ 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-shellDATA install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
- ps ps-am tags-am uninstall uninstall-am uninstall-fishDATA
+ ps ps-am tags-am uninstall uninstall-am uninstall-shellDATA
.PRECIOUS: Makefile
diff --git a/src/vfs/shell/helpers/README.shell b/src/vfs/shell/helpers/README.shell
new file mode 100644
index 0000000..8cc5347
--- /dev/null
+++ b/src/vfs/shell/helpers/README.shell
@@ -0,0 +1,227 @@
+
+ FIles transferred over SSH
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This protocol was designed for transferring files over a remote shell
+connection (rsh and compatibles). It can be as well used for transfers over
+rsh, and there may be other uses.
+
+Since version 4.8.31 Midnight Commander doesn't support FISH commands with form
+
+#FISH_COMMAND [arg1] [arg2] ... [argN]
+
+and sends requests as shell scripts only.
+
+First, MC looks for system-wide set of scripts, then it checks whether
+current user has host-specific overrides in his per-user MC configuration
+directory. User-defined overrides take priority over sytem-wide scripts
+if they exist. The order in which the directories are traversed is as follows:
+
+ /usr/libexec/mc/shell
+ ~/.local/share/mc/shell/<hostname>/
+
+Server's reply is multiline, but always ends with
+
+### 000<optional text>
+
+line. ### is prefix to mark this line, 000 is return code. Return
+codes are superset to those used in ftp.
+
+There are few new exit codes defined:
+
+000 don't know; if there were no previous lines, this marks COMPLETE
+success, if they were, it marks failure.
+
+001 don't know; if there were no previous lines, this marks
+PRELIMinary success, if they were, it marks failure
+
+ Connecting
+ ~~~~~~~~~~
+MC uses "echo SHELL:;/bin/sh" as command executed on remote machine.
+
+ Actions
+ ~~~~~~~
+
+Get info about host into $result
+
+ echo $result
+ echo '### 200'
+
+Script: info
+
+--------------------------------------------------------------------------------
+
+List directory or get status information about single file.
+
+ ls -lLa $1 | grep '^[^cbt]' | ( while read p x u g s m d y n; do echo "P$p $u.$g
+ S$s
+ d$m $d $y
+ :$n
+ "; done )
+ ls -lLa $1 | grep '^[cb]' | ( while read p x u g a i m d y n; do echo "P$p $u.$g
+ E$a$i
+ dD$m $d $y
+ :$n
+ "; done )
+ echo '### 200'
+
+Output is in following form (any line except :<filename> may be omitted):
+
+P<unix permissions> <owner>.<group>
+S<size>
+d<3-letters month name> <day> <year or HH:MM>
+D<year> <month> <day> <hour> <minute> <second>[.1234]
+E<major-of-device>,<minor>
+:<filename>
+L<filename symlink points to>
+<blank line to separate items>
+
+Unix permissions are of form X---------
+where X is type of file:
+ '-' a regular file
+ 'd' a directory
+ 'c' a character device
+ 'b' a block device
+ 'l' a symbolic link
+ 'p' a FIFO
+ 's' a socket.
+
+'d' has three fields:
+ month (one of strings Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
+ day of month
+ single number indicating year, or HH:MM field (assume current year in such
+ case). As you've probably noticed, this is pretty broken; it is for
+ compatibility with ls listing.
+
+Script: ls
+
+--------------------------------------------------------------------------------
+
+Get file
+
+ ls -l /some/name | ( read a b c d x e; echo $x ); echo '### 100'; cat /some/name; echo '### 200'
+
+Server sends line with filesize on it, followed by line with ### 100
+indicating partial success, then it sends binary data (exactly filesize bytes)
+and follows them with (with no preceding newline) ### 200.
+
+Note that there's no way to abort running RETR command - except closing
+the connection.
+
+Script: get
+
+--------------------------------------------------------------------------------
+
+Put file
+
+ > /file/name; echo '### 001'; ( dd bs=4096 count=<size/4096>; dd bs=<size%4096> count=1 ) 2>/dev/null | ( cat > %s; cat > /dev/null ); echo '### 200'
+
+This command is for storing /file/name, which is exactly size bytes big.
+You probably think I went crazy. Well, I did not: that strange cat > /dev/null
+has purpose to discard any extra data which was not written to disk (due to for
+example out of space condition).
+
+[Why? Imagine uploading file with "rm -rf /" line in it.]
+
+Script: send
+
+--------------------------------------------------------------------------------
+
+Change directory
+
+ cd /somewhere; echo '### 000'
+
+It is specified here, but I'm not sure how wise idea is to use this one:
+it breaks stateless-ness of the protocol.
+
+--------------------------------------------------------------------------------
+
+Change mode
+
+ chmod 1234 file; echo '### 000'
+
+Script: chmod
+
+--------------------------------------------------------------------------------
+
+Change own
+
+ chown user /file/name; echo '### 000'
+
+Script: chown
+
+--------------------------------------------------------------------------------
+
+Remove file
+
+ rm -f /some/path; echo '### 000'
+
+Sctipt: unlink
+
+--------------------------------------------------------------------------------
+
+Make directory:
+
+ mkdir /some/path; echo '### 000'
+
+Script: mkdir
+
+--------------------------------------------------------------------------------
+
+Remove directory
+
+ rmdir /some/path; echo '### 000'
+
+Script: rmdir
+
+--------------------------------------------------------------------------------
+
+Rename/move file
+
+ mv /path/a /path/b; echo '### 000'
+
+Script: mv
+
+--------------------------------------------------------------------------------
+
+Make link
+
+ ln /path/a /path/b; echo '### 000'
+
+Script: hardlink
+
+--------------------------------------------------------------------------------
+
+Make symbolic link:
+
+ ln -s /path/a /path/b; echo '### 000'
+
+Script: ln
+
+--------------------------------------------------------------------------------
+
+You can use following parameters:
+SHELL_FILESIZE
+SHELL_FILENAME
+SHELL_FILEMODE
+SHELL_FILEOWNER
+SHELL_FILEGROUPE
+SHELL_FILEFROM
+SHELL_FILETO
+
+NB:
+'SHELL_FILESIZE' is used if we operate with single file name in 'unlink', 'rmdir', 'chmod', etc...
+'SHELL_FILEFROM','SHELL_FILETO' are used if we operate with two files in 'ln', 'hardlink', 'mv' etc...
+'SHELL_FILEOWNER', 'SHELL_FILEGROUPE' are a new user/group in chown
+
+and flags:
+SHELL_HAVE_HEAD
+SHELL_HAVE_SED
+SHELL_HAVE_AWK
+SHELL_HAVE_PERL
+SHELL_HAVE_LSQ
+SHELL_HAVE_DATE_MDYT
+
+That's all, folks!
+ pavel@ucw.cz
+ aborodin@vmail.ru
diff --git a/src/vfs/shell/helpers/append b/src/vfs/shell/helpers/append
new file mode 100644
index 0000000..a73d2cd
--- /dev/null
+++ b/src/vfs/shell/helpers/append
@@ -0,0 +1,15 @@
+FILENAME="/${SHELL_FILENAME}"
+echo "### 001"
+{
+ bss=4096
+ bsl=4095
+ if [ $SHELL_FILESIZE -lt $bss ]; then
+ bss=1;
+ bsl=0;
+ fi
+ while [ $SHELL_FILESIZE -gt 0 ]; do
+ cnt=`expr \\( $SHELL_FILESIZE + $bsl \\) / $bss`
+ n=`dd bs=$bss count=$cnt | tee -a "${FILENAME}" | wc -c`
+ SHELL_FILESIZE=`expr $SHELL_FILESIZE - $n`
+ done
+}; echo "### 200"
diff --git a/src/vfs/shell/helpers/chmod b/src/vfs/shell/helpers/chmod
new file mode 100644
index 0000000..75ea024
--- /dev/null
+++ b/src/vfs/shell/helpers/chmod
@@ -0,0 +1,5 @@
+if chmod ${SHELL_FILEMODE} "/${SHELL_FILENAME}" 2>/dev/null; then
+ echo "### 000"
+else
+ echo "### 500"
+fi
diff --git a/src/vfs/shell/helpers/chown b/src/vfs/shell/helpers/chown
new file mode 100644
index 0000000..c2fc2b1
--- /dev/null
+++ b/src/vfs/shell/helpers/chown
@@ -0,0 +1,5 @@
+if chown ${SHELL_FILEOWNER}:${SHELL_FILEGROUP} "/${SHELL_FILENAME}" ; then
+ echo "### 000"
+else
+ echo "### 500"
+fi
diff --git a/src/vfs/shell/helpers/fexists b/src/vfs/shell/helpers/fexists
new file mode 100644
index 0000000..3d11574
--- /dev/null
+++ b/src/vfs/shell/helpers/fexists
@@ -0,0 +1,2 @@
+ls -l "/${SHELL_FILENAME}" >/dev/null 2>/dev/null
+echo '### '$?
diff --git a/src/vfs/fish/helpers/get b/src/vfs/shell/helpers/get
index 762267a..b633a45 100644
--- a/src/vfs/fish/helpers/get
+++ b/src/vfs/shell/helpers/get
@@ -1,7 +1,6 @@
-#RETR $FISH_FILENAME $FISH_START_OFFSET
LC_TIME=C
export LC_TIME
-fish_get_perl ()
+shell_get_perl ()
{
FILENAME=$1
OFFSET=$2
@@ -35,7 +34,7 @@ exit 0
' "${FILENAME}" $OFFSET
}
-fish_get_tail ()
+shell_get_tail ()
{
FILENAME=$1
OFFSET=$2
@@ -67,7 +66,7 @@ else
fi
}
-fish_get_dd ()
+shell_get_dd ()
{
FILENAME=$1
OFFSET=$2
@@ -96,10 +95,10 @@ else
fi
}
-if [ -n "${FISH_HAVE_PERL}" ]; then
- fish_get_perl "/${FISH_FILENAME}" ${FISH_START_OFFSET}
-elif [ -n "${FISH_HAVE_TAIL}" ]; then
- fish_get_tail "/${FISH_FILENAME}" ${FISH_START_OFFSET}
+if [ -n "${SHELL_HAVE_PERL}" ]; then
+ shell_get_perl "/${SHELL_FILENAME}" ${SHELL_START_OFFSET}
+elif [ -n "${SHELL_HAVE_TAIL}" ]; then
+ shell_get_tail "/${SHELL_FILENAME}" ${SHELL_START_OFFSET}
else
- fish_get_dd "/${FISH_FILENAME}" ${FISH_START_OFFSET}
+ shell_get_dd "/${SHELL_FILENAME}" ${SHELL_START_OFFSET}
fi
diff --git a/src/vfs/fish/helpers/hardlink b/src/vfs/shell/helpers/hardlink
index 4f36b3f..f92b332 100644
--- a/src/vfs/fish/helpers/hardlink
+++ b/src/vfs/shell/helpers/hardlink
@@ -1,6 +1,5 @@
-#LINK $FISH_FILEFROM $FISH_FILETO
-FILEFROM="/${FISH_FILEFROM}"
-FILETO="/${FISH_FILETO}"
+FILEFROM="/${SHELL_FILEFROM}"
+FILETO="/${SHELL_FILETO}"
if ln "${FILEFROM}" "${FILETO}" 2>/dev/null; then
echo "### 000"
else
diff --git a/src/vfs/fish/helpers/info b/src/vfs/shell/helpers/info
index b85b0a7..053423a 100644
--- a/src/vfs/fish/helpers/info
+++ b/src/vfs/shell/helpers/info
@@ -1,12 +1,12 @@
LC_TIME=C
export LC_TIME
-#FISH_HAVE_HEAD 1
-#FISH_HAVE_SED 2
-#FISH_HAVE_AWK 4
-#FISH_HAVE_PERL 8
-#FISH_HAVE_LSQ 16
-#FISH_HAVE_DATE_MDYT 32
-#FISH_HAVE_TAIL 64
+#SHELL_HAVE_HEAD 1
+#SHELL_HAVE_SED 2
+#SHELL_HAVE_AWK 4
+#SHELL_HAVE_PERL 8
+#SHELL_HAVE_LSQ 16
+#SHELL_HAVE_DATE_MDYT 32
+#SHELL_HAVE_TAIL 64
res=0
if `echo yes| head -c 1 > /dev/null 2>&1` ; then
res=`expr $res + 1`
diff --git a/src/vfs/fish/helpers/ln b/src/vfs/shell/helpers/ln
index a8445d8..15a20cd 100644
--- a/src/vfs/fish/helpers/ln
+++ b/src/vfs/shell/helpers/ln
@@ -1,6 +1,5 @@
-#SYMLINK $FISH_FILEFROM $FISH_FILETO
-FILEFROM="${FISH_FILEFROM}"
-FILETO="/${FISH_FILETO}"
+FILEFROM="${SHELL_FILEFROM}"
+FILETO="/${SHELL_FILETO}"
if ln -s "${FILEFROM}" "${FILETO}" 2>/dev/null; then
echo "### 000"
else
diff --git a/src/vfs/fish/helpers/ls b/src/vfs/shell/helpers/ls
index 7165b51..c7701d6 100644
--- a/src/vfs/fish/helpers/ls
+++ b/src/vfs/shell/helpers/ls
@@ -1,11 +1,10 @@
-#LIST /${FISH_DIR}
LC_TIME=C
export LC_TIME
perl_res="1"
-fish_list_lsq ()
+shell_list_lsq ()
{
-FISH_DIR="$1"
-ls -Qlan "${FISH_DIR}" 2>/dev/null | grep '^[^cbt]' | (
+SHELL_DIR="$1"
+ls -Qlan "${SHELL_DIR}" 2>/dev/null | grep '^[^cbt]' | (
while read p l u g s m d y n; do
echo "P$p $u.$g"
echo "S$s"
@@ -15,7 +14,7 @@ while read p l u g s m d y n; do
done
)
-ls -Qlan "${FISH_DIR}" 2>/dev/null | grep '^[cb]' | (
+ls -Qlan "${SHELL_DIR}" 2>/dev/null | grep '^[cb]' | (
while read p l u g a i m d y n; do
echo "P$p $u.$g"
echo "E$a$i"
@@ -27,13 +26,13 @@ done
echo '### 200'
}
-fish_list_sed ()
+shell_list_sed ()
{
-FISH_DIR="$1"
-ls -lan "${FISH_DIR}" 2>/dev/null | grep '^[^cbt]' | (
+SHELL_DIR="$1"
+ls -lan "${SHELL_DIR}" 2>/dev/null | grep '^[^cbt]' | (
while read p l u g s rec; do
if [ -n "$g" ]; then
- if [ -n "$FISH_HAVE_DATE_MDYT" ]; then
+ if [ -n "$SHELL_HAVE_DATE_MDYT" ]; then
filename=`echo "$rec"| sed 's/[^[:space:]]\+ \+[^[:space:]]\+ \+[^[:space:]]\+ //'`
filedate=`echo "$rec"| sed 's/\([^[:space:]]\+ \+[^[:space:]]\+ \+[^[:space:]]\+\) .*/\1/'`
else
@@ -43,7 +42,7 @@ while read p l u g s rec; do
pfile=\"`echo "$filename" | sed -e 's#^\(.*\) -> \(.*\)#\1" -> "\2#'`\"
echo "P$p $u.$g"
echo "S$s"
- if [ -n "$FISH_HAVE_DATE_MDYT" ]; then
+ if [ -n "$SHELL_HAVE_DATE_MDYT" ]; then
echo "d$filedate"
else
echo "D$filedate"
@@ -53,10 +52,10 @@ while read p l u g s rec; do
fi
done
)
-ls -lan "${FISH_DIR}" 2>/dev/null | grep '^[cb]' | (
+ls -lan "${SHELL_DIR}" 2>/dev/null | grep '^[cb]' | (
while read p l u g a i rec; do
if [ -n "$g" ]; then
- if [ -n "$FISH_HAVE_DATE_MDYT" ]; then
+ if [ -n "$SHELL_HAVE_DATE_MDYT" ]; then
filename=`echo "$rec"| sed 's/[^[:space:]]\+ \+[^[:space:]]\+ \+[^[:space:]]\+ //'`
filedate=`echo "$rec"| sed 's/\([^[:space:]]\+ \+[^[:space:]]\+ \+[^[:space:]]\+\) .*/\1/'`
else
@@ -66,7 +65,7 @@ while read p l u g a i rec; do
pfile=\"`echo "$filename" | sed -e 's#^\(.*\) -> \(.*\)#\1" -> "\2#'`\"
echo "P$p $u.$g"
echo "E$a$i"
- if [ -n "$FISH_HAVE_DATE_MDYT" ]; then
+ if [ -n "$SHELL_HAVE_DATE_MDYT" ]; then
echo "d$filedate"
else
echo "D$filedate"
@@ -79,10 +78,10 @@ done
echo '### 200'
}
-fish_list_poor_ls ()
+shell_list_poor_ls ()
{
-FISH_DIR="$1"
-ls -lan "${FISH_DIR}" 2>/dev/null | grep '^[^cbt]' | (
+SHELL_DIR="$1"
+ls -lan "${SHELL_DIR}" 2>/dev/null | grep '^[^cbt]' | (
while read p l u g s m d y n n2 n3; do
if [ -n "$g" ]; then
if [ "$m" = "0" ]; then
@@ -98,7 +97,7 @@ while read p l u g s m d y n n2 n3; do
fi
done
)
-ls -lan "${FISH_DIR}" 2>/dev/null | grep '^[cb]' | (
+ls -lan "${SHELL_DIR}" 2>/dev/null | grep '^[cb]' | (
while read p l u g a i m d y n n2 n3; do
if [ -n "$g" ]; then
if [ "$a" = "0" ]; then
@@ -117,15 +116,14 @@ done
echo '### 200'
}
-fish_list_perl ()
+shell_list_perl ()
{
-FISH_DIR=$1
+SHELL_DIR=$1
perl -e '
use strict;
use POSIX;
-use Fcntl;
-use POSIX ":fcntl_h"; #S_ISLNK was here until 5.6
-import Fcntl ":mode" unless defined &S_ISLNK; #and is now here
+use Fcntl ":mode"; # S_ISLNK, S_IFMT, S_IMODE are here
+use POSIX ":fcntl_h"; # S_ISLNK might be here as well
my $dirname = $ARGV[0];
if (opendir (DIR, $dirname)) {
while((my $filename = readdir (DIR))){
@@ -152,19 +150,19 @@ while((my $filename = readdir (DIR))){
printf("### 500\n");
}
exit 0
-' "/${FISH_DIR}"
+' "/${SHELL_DIR}"
perl_res=$?
}
-if [ -n "${FISH_HAVE_PERL}" ]; then
- fish_list_perl "/${FISH_FILENAME}"
+if [ -n "${SHELL_HAVE_PERL}" ]; then
+ shell_list_perl "/${SHELL_FILENAME}"
fi
if [ "${perl_res}" != "0" ]; then
- if [ -n "${FISH_HAVE_LSQ}" ]; then
- fish_list_lsq "/${FISH_FILENAME}"
- elif [ -n "${FISH_HAVE_SED}" ]; then
- fish_list_sed "/${FISH_FILENAME}"
+ if [ -n "${SHELL_HAVE_LSQ}" ]; then
+ shell_list_lsq "/${SHELL_FILENAME}"
+ elif [ -n "${SHELL_HAVE_SED}" ]; then
+ shell_list_sed "/${SHELL_FILENAME}"
else
- fish_list_poor_ls "/${FISH_FILENAME}"
+ shell_list_poor_ls "/${SHELL_FILENAME}"
fi
fi
diff --git a/src/vfs/shell/helpers/mkdir b/src/vfs/shell/helpers/mkdir
new file mode 100644
index 0000000..b05f125
--- /dev/null
+++ b/src/vfs/shell/helpers/mkdir
@@ -0,0 +1,5 @@
+if mkdir "/$SHELL_FILENAME" 2>/dev/null; then
+ echo "### 000"
+else
+ echo "### 500"
+fi
diff --git a/src/vfs/shell/helpers/mv b/src/vfs/shell/helpers/mv
new file mode 100644
index 0000000..1fd2327
--- /dev/null
+++ b/src/vfs/shell/helpers/mv
@@ -0,0 +1,5 @@
+if mv "/${SHELL_FILEFROM}" "/${SHELL_FILETO}" 2>/dev/null; then
+ echo "### 000"
+else
+ echo "### 500"
+fi
diff --git a/src/vfs/shell/helpers/rmdir b/src/vfs/shell/helpers/rmdir
new file mode 100644
index 0000000..88172c4
--- /dev/null
+++ b/src/vfs/shell/helpers/rmdir
@@ -0,0 +1,5 @@
+if rmdir "/${SHELL_FILENAME}" 2>/dev/null; then
+ echo "### 000"
+else
+ echo "### 500"
+fi
diff --git a/src/vfs/shell/helpers/send b/src/vfs/shell/helpers/send
new file mode 100644
index 0000000..66c2a1c
--- /dev/null
+++ b/src/vfs/shell/helpers/send
@@ -0,0 +1,16 @@
+FILENAME="/${SHELL_FILENAME}"
+echo "### 001"
+{
+ > "${FILENAME}"
+ bss=4096
+ bsl=4095
+ if [ $SHELL_FILESIZE -lt $bss ]; then
+ bss=1;
+ bsl=0;
+ fi
+ while [ $SHELL_FILESIZE -gt 0 ]; do
+ cnt=`expr \\( $SHELL_FILESIZE + $bsl \\) / $bss`
+ n=`dd bs=$bss count=$cnt | tee -a "${FILENAME}" | wc -c`
+ SHELL_FILESIZE=`expr $SHELL_FILESIZE - $n`
+ done
+}; echo "### 200"
diff --git a/src/vfs/shell/helpers/unlink b/src/vfs/shell/helpers/unlink
new file mode 100644
index 0000000..f02f4d3
--- /dev/null
+++ b/src/vfs/shell/helpers/unlink
@@ -0,0 +1,5 @@
+if rm -f "/${SHELL_FILENAME}" 2>/dev/null; then
+ echo "### 000"
+else
+ echo "### 500"
+fi
diff --git a/src/vfs/shell/helpers/utime b/src/vfs/shell/helpers/utime
new file mode 100644
index 0000000..a563431
--- /dev/null
+++ b/src/vfs/shell/helpers/utime
@@ -0,0 +1,12 @@
+if TZ=UTC touch -h -m -d "$SHELL_TOUCHMTIME_W_NSEC" "/${SHELL_FILENAME}" 2>/dev/null && \
+ TZ=UTC touch -h -a -d "$SHELL_TOUCHATIME_W_NSEC" "/${SHELL_FILENAME}" 2>/dev/null; then
+ echo "### 000"
+elif TZ=UTC touch -h -m -t $SHELL_TOUCHMTIME "/${SHELL_FILENAME}" 2>/dev/null && \
+ TZ=UTC touch -h -a -t $SHELL_TOUCHATIME "/${SHELL_FILENAME}" 2>/dev/null; then
+ echo "### 000"
+elif [ -n "$SHELL_HAVE_PERL" ] &&
+ perl -e 'utime '$SHELL_FILEATIME','$SHELL_FILEMTIME',@ARGV;' "/${SHELL_FILENAME}" 2>/dev/null; then
+ echo "### 000"
+else
+ echo "### 500"
+fi
diff --git a/src/vfs/fish/fish.c b/src/vfs/shell/shell.c
index ec71a41..74788d6 100644
--- a/src/vfs/fish/fish.c
+++ b/src/vfs/shell/shell.c
@@ -1,8 +1,8 @@
/*
- Virtual File System: FISH implementation for transferring files over
+ Virtual File System: SHELL implementation for transferring files over
shell connections.
- Copyright (C) 1998-2023
+ Copyright (C) 1998-2024
Free Software Foundation, Inc.
Written by:
@@ -32,20 +32,20 @@
/**
* \file
- * \brief Source: Virtual File System: FISH implementation for transferring files over
+ * \brief Source: Virtual File System: SHELL implementation for transferring files over
* shell connections
* \author Pavel Machek
* \author Michal Svec
* \date 1998, 2000
*
* Derived from ftpfs.c
- * Read README.fish for protocol specification.
+ * Read README.shell for protocol specification.
*
* Syntax of path is: \verbatim sh://user@host[:Cr]/path \endverbatim
* where C means you want compressed connection,
* and r means you want to use rsh
*
- * Namespace: fish_vfs_ops exported.
+ * Namespace: shell_vfs_ops exported.
*/
/* Define this if your ssh can take -I option */
@@ -74,12 +74,12 @@
#include "lib/vfs/xdirentry.h"
#include "lib/vfs/gc.h" /* vfs_stamp_create */
-#include "fish.h"
-#include "fishdef.h"
+#include "shell.h"
+#include "shelldef.h"
/*** global variables ****************************************************************************/
-int fish_directory_timeout = 900;
+int shell_directory_timeout = 900;
/*** file scope macro definitions ****************************************************************/
@@ -87,8 +87,8 @@ int fish_directory_timeout = 900;
#define DO_OPEN 2
#define DO_FREE_RESOURCE 4
-#define FISH_FLAG_COMPRESSED 1
-#define FISH_FLAG_RSH 2
+#define SHELL_FLAG_COMPRESSED 1
+#define SHELL_FLAG_RSH 2
#define OPT_FLUSH 1
#define OPT_IGNORE_ERROR 2
@@ -108,16 +108,16 @@ int fish_directory_timeout = 900;
#define WANT_STRING 0x02
/* environment flags */
-#define FISH_HAVE_HEAD 1
-#define FISH_HAVE_SED 2
-#define FISH_HAVE_AWK 4
-#define FISH_HAVE_PERL 8
-#define FISH_HAVE_LSQ 16
-#define FISH_HAVE_DATE_MDYT 32
-#define FISH_HAVE_TAIL 64
+#define SHELL_HAVE_HEAD 1
+#define SHELL_HAVE_SED 2
+#define SHELL_HAVE_AWK 4
+#define SHELL_HAVE_PERL 8
+#define SHELL_HAVE_LSQ 16
+#define SHELL_HAVE_DATE_MDYT 32
+#define SHELL_HAVE_TAIL 64
-#define FISH_SUPER(super) ((fish_super_t *) (super))
-#define FISH_FILE_HANDLER(fh) ((fish_file_handler_t *) fh)
+#define SHELL_SUPER(super) ((shell_super_t *) (super))
+#define SHELL_FILE_HANDLER(fh) ((shell_file_handler_t *) fh)
/*** file scope type declarations ****************************************************************/
@@ -144,7 +144,7 @@ typedef struct
char *scr_info;
int host_flags;
GString *scr_env;
-} fish_super_t;
+} shell_super_t;
typedef struct
{
@@ -153,7 +153,7 @@ typedef struct
off_t got;
off_t total;
gboolean append;
-} fish_file_handler_t;
+} shell_file_handler_t;
/*** forward declarations (file scope functions) *************************************************/
@@ -161,15 +161,15 @@ typedef struct
static char reply_str[80];
-static struct vfs_s_subclass fish_subclass;
-static struct vfs_class *vfs_fish_ops = VFS_CLASS (&fish_subclass);
+static struct vfs_s_subclass shell_subclass;
+static struct vfs_class *vfs_shell_ops = VFS_CLASS (&shell_subclass);
/* --------------------------------------------------------------------------------------------- */
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
static void
-fish_set_blksize (struct stat *s)
+shell_set_blksize (struct stat *s)
{
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
/* redefine block size */
@@ -180,12 +180,12 @@ fish_set_blksize (struct stat *s)
/* --------------------------------------------------------------------------------------------- */
static struct stat *
-fish_default_stat (struct vfs_class *me)
+shell_default_stat (struct vfs_class *me)
{
struct stat *s;
s = vfs_s_default_stat (me, S_IFDIR | 0755);
- fish_set_blksize (s);
+ shell_set_blksize (s);
vfs_adjust_stat (s);
return s;
@@ -194,15 +194,16 @@ fish_default_stat (struct vfs_class *me)
/* --------------------------------------------------------------------------------------------- */
static char *
-fish_load_script_from_file (const char *hostname, const char *script_name, const char *def_content)
+shell_load_script_from_file (const char *hostname, const char *script_name, const char *def_content)
{
char *scr_filename = NULL;
char *scr_content;
gsize scr_len = 0;
/* 1st: scan user directory */
- scr_filename = g_build_path (PATH_SEP_STR, mc_config_get_data_path (), FISH_PREFIX, hostname,
- script_name, (char *) NULL);
+ scr_filename =
+ g_build_path (PATH_SEP_STR, mc_config_get_data_path (), VFS_SHELL_PREFIX, hostname,
+ script_name, (char *) NULL);
/* silent about user dir */
g_file_get_contents (scr_filename, &scr_content, &scr_len, NULL);
g_free (scr_filename);
@@ -210,7 +211,7 @@ fish_load_script_from_file (const char *hostname, const char *script_name, const
if (scr_content == NULL)
{
scr_filename =
- g_build_path (PATH_SEP_STR, LIBEXECDIR, FISH_PREFIX, script_name, (char *) NULL);
+ g_build_path (PATH_SEP_STR, LIBEXECDIR, VFS_SHELL_PREFIX, script_name, (char *) NULL);
g_file_get_contents (scr_filename, &scr_content, &scr_len, NULL);
g_free (scr_filename);
}
@@ -224,7 +225,7 @@ fish_load_script_from_file (const char *hostname, const char *script_name, const
/* --------------------------------------------------------------------------------------------- */
static int
-fish_decode_reply (char *s, gboolean was_garbage)
+shell_decode_reply (char *s, gboolean was_garbage)
{
int code;
@@ -243,7 +244,7 @@ fish_decode_reply (char *s, gboolean was_garbage)
/* Returns a reply code, check /usr/include/arpa/ftp.h for possible values */
static int
-fish_get_reply (struct vfs_class *me, int sock, char *string_buf, int string_len)
+shell_get_reply (struct vfs_class *me, int sock, char *string_buf, int string_len)
{
char answer[BUF_1K];
gboolean was_garbage = FALSE;
@@ -258,7 +259,7 @@ fish_get_reply (struct vfs_class *me, int sock, char *string_buf, int string_len
}
if (strncmp (answer, "### ", 4) == 0)
- return fish_decode_reply (answer + 4, was_garbage ? 1 : 0);
+ return shell_decode_reply (answer + 4, was_garbage ? 1 : 0);
was_garbage = TRUE;
if (string_buf != NULL)
@@ -269,8 +270,8 @@ fish_get_reply (struct vfs_class *me, int sock, char *string_buf, int string_len
/* --------------------------------------------------------------------------------------------- */
static int
-fish_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, const char *cmd,
- size_t cmd_len)
+shell_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, const char *cmd,
+ size_t cmd_len)
{
ssize_t status;
FILE *logfile = me->logfile;
@@ -288,16 +289,16 @@ fish_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, c
}
tty_enable_interrupt_key ();
- status = write (FISH_SUPER (super)->sockw, cmd, cmd_len);
+ status = write (SHELL_SUPER (super)->sockw, cmd, cmd_len);
tty_disable_interrupt_key ();
if (status < 0)
return TRANSIENT;
if (wait_reply)
- return fish_get_reply (me, FISH_SUPER (super)->sockr,
- (wait_reply & WANT_STRING) != 0 ? reply_str :
- NULL, sizeof (reply_str) - 1);
+ return shell_get_reply (me, SHELL_SUPER (super)->sockr,
+ (wait_reply & WANT_STRING) != 0 ? reply_str : NULL,
+ sizeof (reply_str) - 1);
return COMPLETE;
}
@@ -305,16 +306,16 @@ fish_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, c
static int
G_GNUC_PRINTF (5, 0)
-fish_command_va (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, const char *scr,
- const char *vars, va_list ap)
+shell_command_va (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, const char *scr,
+ const char *vars, va_list ap)
{
int r;
GString *command;
- command = mc_g_string_dup (FISH_SUPER (super)->scr_env);
+ command = mc_g_string_dup (SHELL_SUPER (super)->scr_env);
g_string_append_vprintf (command, vars, ap);
g_string_append (command, scr);
- r = fish_command (me, super, wait_reply, command->str, command->len);
+ r = shell_command (me, super, wait_reply, command->str, command->len);
g_string_free (command, TRUE);
return r;
@@ -324,14 +325,14 @@ fish_command_va (struct vfs_class *me, struct vfs_s_super *super, int wait_reply
static int
G_GNUC_PRINTF (5, 6)
-fish_command_v (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, const char *scr,
- const char *vars, ...)
+shell_command_v (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, const char *scr,
+ const char *vars, ...)
{
int r;
va_list ap;
va_start (ap, vars);
- r = fish_command_va (me, super, wait_reply, scr, vars, ap);
+ r = shell_command_va (me, super, wait_reply, scr, vars, ap);
va_end (ap);
return r;
@@ -341,16 +342,16 @@ fish_command_v (struct vfs_class *me, struct vfs_s_super *super, int wait_reply,
static int
G_GNUC_PRINTF (5, 6)
-fish_send_command (struct vfs_class *me, struct vfs_s_super *super, int flags, const char *scr,
- const char *vars, ...)
+shell_send_command (struct vfs_class *me, struct vfs_s_super *super, int flags, const char *scr,
+ const char *vars, ...)
{
int r;
va_list ap;
va_start (ap, vars);
- r = fish_command_va (me, super, WAIT_REPLY, scr, vars, ap);
+ r = shell_command_va (me, super, WAIT_REPLY, scr, vars, ap);
va_end (ap);
- vfs_stamp_create (vfs_fish_ops, super);
+ vfs_stamp_create (vfs_shell_ops, super);
if (r != COMPLETE)
ERRNOR (E_REMOTE, -1);
@@ -363,11 +364,11 @@ fish_send_command (struct vfs_class *me, struct vfs_s_super *super, int flags, c
/* --------------------------------------------------------------------------------------------- */
static struct vfs_s_super *
-fish_new_archive (struct vfs_class *me)
+shell_new_archive (struct vfs_class *me)
{
- fish_super_t *arch;
+ shell_super_t *arch;
- arch = g_new0 (fish_super_t, 1);
+ arch = g_new0 (shell_super_t, 1);
arch->base.me = me;
return VFS_SUPER (arch);
@@ -376,48 +377,48 @@ fish_new_archive (struct vfs_class *me)
/* --------------------------------------------------------------------------------------------- */
static void
-fish_free_archive (struct vfs_class *me, struct vfs_s_super *super)
+shell_free_archive (struct vfs_class *me, struct vfs_s_super *super)
{
- fish_super_t *fish_super = FISH_SUPER (super);
+ shell_super_t *shell_super = SHELL_SUPER (super);
- if ((fish_super->sockw != -1) || (fish_super->sockr != -1))
- vfs_print_message (_("fish: Disconnecting from %s"), super->name ? super->name : "???");
+ if ((shell_super->sockw != -1) || (shell_super->sockr != -1))
+ vfs_print_message (_("shell: Disconnecting from %s"), super->name ? super->name : "???");
- if (fish_super->sockw != -1)
+ if (shell_super->sockw != -1)
{
- fish_command (me, super, NONE, "#BYE\nexit\n", -1);
- close (fish_super->sockw);
- fish_super->sockw = -1;
+ shell_command (me, super, NONE, "exit\n", -1);
+ close (shell_super->sockw);
+ shell_super->sockw = -1;
}
- if (fish_super->sockr != -1)
+ if (shell_super->sockr != -1)
{
- close (fish_super->sockr);
- fish_super->sockr = -1;
+ close (shell_super->sockr);
+ shell_super->sockr = -1;
}
- g_free (fish_super->scr_ls);
- g_free (fish_super->scr_exists);
- g_free (fish_super->scr_mkdir);
- g_free (fish_super->scr_unlink);
- g_free (fish_super->scr_chown);
- g_free (fish_super->scr_chmod);
- g_free (fish_super->scr_utime);
- g_free (fish_super->scr_rmdir);
- g_free (fish_super->scr_ln);
- g_free (fish_super->scr_mv);
- g_free (fish_super->scr_hardlink);
- g_free (fish_super->scr_get);
- g_free (fish_super->scr_send);
- g_free (fish_super->scr_append);
- g_free (fish_super->scr_info);
- g_string_free (fish_super->scr_env, TRUE);
+ g_free (shell_super->scr_ls);
+ g_free (shell_super->scr_exists);
+ g_free (shell_super->scr_mkdir);
+ g_free (shell_super->scr_unlink);
+ g_free (shell_super->scr_chown);
+ g_free (shell_super->scr_chmod);
+ g_free (shell_super->scr_utime);
+ g_free (shell_super->scr_rmdir);
+ g_free (shell_super->scr_ln);
+ g_free (shell_super->scr_mv);
+ g_free (shell_super->scr_hardlink);
+ g_free (shell_super->scr_get);
+ g_free (shell_super->scr_send);
+ g_free (shell_super->scr_append);
+ g_free (shell_super->scr_info);
+ g_string_free (shell_super->scr_env, TRUE);
}
/* --------------------------------------------------------------------------------------------- */
static void
-fish_pipeopen (struct vfs_s_super *super, const char *path, const char *argv[])
+shell_pipeopen (struct vfs_s_super *super, const char *path, const char *argv[])
{
int fileset1[2], fileset2[2];
int res;
@@ -433,9 +434,9 @@ fish_pipeopen (struct vfs_s_super *super, const char *path, const char *argv[])
vfs_die ("Cannot fork(): %m.");
/* We are the parent */
close (fileset1[0]);
- FISH_SUPER (super)->sockw = fileset1[1];
+ SHELL_SUPER (super)->sockw = fileset1[1];
close (fileset2[1]);
- FISH_SUPER (super)->sockr = fileset2[0];
+ SHELL_SUPER (super)->sockr = fileset2[0];
}
else
{
@@ -456,32 +457,32 @@ fish_pipeopen (struct vfs_s_super *super, const char *path, const char *argv[])
/* --------------------------------------------------------------------------------------------- */
static GString *
-fish_set_env (int flags)
+shell_set_env (int flags)
{
GString *ret;
ret = g_string_sized_new (256);
- if ((flags & FISH_HAVE_HEAD) != 0)
- g_string_append (ret, "FISH_HAVE_HEAD=1 export FISH_HAVE_HEAD; ");
+ if ((flags & SHELL_HAVE_HEAD) != 0)
+ g_string_append (ret, "SHELL_HAVE_HEAD=1 export SHELL_HAVE_HEAD; ");
- if ((flags & FISH_HAVE_SED) != 0)
- g_string_append (ret, "FISH_HAVE_SED=1 export FISH_HAVE_SED; ");
+ if ((flags & SHELL_HAVE_SED) != 0)
+ g_string_append (ret, "SHELL_HAVE_SED=1 export SHELL_HAVE_SED; ");
- if ((flags & FISH_HAVE_AWK) != 0)
- g_string_append (ret, "FISH_HAVE_AWK=1 export FISH_HAVE_AWK; ");
+ if ((flags & SHELL_HAVE_AWK) != 0)
+ g_string_append (ret, "SHELL_HAVE_AWK=1 export SHELL_HAVE_AWK; ");
- if ((flags & FISH_HAVE_PERL) != 0)
- g_string_append (ret, "FISH_HAVE_PERL=1 export FISH_HAVE_PERL; ");
+ if ((flags & SHELL_HAVE_PERL) != 0)
+ g_string_append (ret, "SHELL_HAVE_PERL=1 export SHELL_HAVE_PERL; ");
- if ((flags & FISH_HAVE_LSQ) != 0)
- g_string_append (ret, "FISH_HAVE_LSQ=1 export FISH_HAVE_LSQ; ");
+ if ((flags & SHELL_HAVE_LSQ) != 0)
+ g_string_append (ret, "SHELL_HAVE_LSQ=1 export SHELL_HAVE_LSQ; ");
- if ((flags & FISH_HAVE_DATE_MDYT) != 0)
- g_string_append (ret, "FISH_HAVE_DATE_MDYT=1 export FISH_HAVE_DATE_MDYT; ");
+ if ((flags & SHELL_HAVE_DATE_MDYT) != 0)
+ g_string_append (ret, "SHELL_HAVE_DATE_MDYT=1 export SHELL_HAVE_DATE_MDYT; ");
- if ((flags & FISH_HAVE_TAIL) != 0)
- g_string_append (ret, "FISH_HAVE_TAIL=1 export FISH_HAVE_TAIL; ");
+ if ((flags & SHELL_HAVE_TAIL) != 0)
+ g_string_append (ret, "SHELL_HAVE_TAIL=1 export SHELL_HAVE_TAIL; ");
return ret;
}
@@ -489,23 +490,23 @@ fish_set_env (int flags)
/* --------------------------------------------------------------------------------------------- */
static gboolean
-fish_info (struct vfs_class *me, struct vfs_s_super *super)
+shell_info (struct vfs_class *me, struct vfs_s_super *super)
{
- fish_super_t *fish_super = FISH_SUPER (super);
+ shell_super_t *shell_super = SHELL_SUPER (super);
- if (fish_command (me, super, NONE, fish_super->scr_info, -1) == COMPLETE)
+ if (shell_command (me, super, NONE, shell_super->scr_info, -1) == COMPLETE)
{
while (TRUE)
{
int res;
char buffer[BUF_8K] = "";
- res = vfs_s_get_line_interruptible (me, buffer, sizeof (buffer), fish_super->sockr);
+ res = vfs_s_get_line_interruptible (me, buffer, sizeof (buffer), shell_super->sockr);
if ((res == 0) || (res == EINTR))
ERRNOR (ECONNRESET, FALSE);
if (strncmp (buffer, "### ", 4) == 0)
break;
- fish_super->host_flags = atol (buffer);
+ shell_super->host_flags = atol (buffer);
}
return TRUE;
}
@@ -515,18 +516,18 @@ fish_info (struct vfs_class *me, struct vfs_s_super *super)
/* --------------------------------------------------------------------------------------------- */
static void
-fish_open_archive_pipeopen (struct vfs_s_super *super)
+shell_open_archive_pipeopen (struct vfs_s_super *super)
{
char gbuf[10];
const char *argv[10]; /* All of 10 is used now */
- const char *xsh = (super->path_element->port == FISH_FLAG_RSH ? "rsh" : "ssh");
+ const char *xsh = (super->path_element->port == SHELL_FLAG_RSH ? "rsh" : "ssh");
int i = 0;
argv[i++] = xsh;
- if (super->path_element->port == FISH_FLAG_COMPRESSED)
+ if (super->path_element->port == SHELL_FLAG_COMPRESSED)
argv[i++] = "-C";
- if (super->path_element->port > FISH_FLAG_RSH)
+ if (super->path_element->port > SHELL_FLAG_RSH)
{
argv[i++] = "-p";
g_snprintf (gbuf, sizeof (gbuf), "%d", super->path_element->port);
@@ -552,23 +553,23 @@ fish_open_archive_pipeopen (struct vfs_s_super *super)
}
argv[i++] = super->path_element->host;
- argv[i++] = "echo FISH:; /bin/sh";
+ argv[i++] = "echo SHELL:; /bin/sh";
argv[i++] = NULL;
- fish_pipeopen (super, xsh, argv);
+ shell_pipeopen (super, xsh, argv);
}
/* --------------------------------------------------------------------------------------------- */
static gboolean
-fish_open_archive_talk (struct vfs_class *me, struct vfs_s_super *super)
+shell_open_archive_talk (struct vfs_class *me, struct vfs_s_super *super)
{
- fish_super_t *fish_super = FISH_SUPER (super);
+ shell_super_t *shell_super = SHELL_SUPER (super);
char answer[2048];
- printf ("\n%s\n", _("fish: Waiting for initial line..."));
+ printf ("\n%s\n", _("shell: Waiting for initial line..."));
- if (vfs_s_get_line (me, fish_super->sockr, answer, sizeof (answer), ':') == 0)
+ if (vfs_s_get_line (me, shell_super->sockr, answer, sizeof (answer), ':') == 0)
return FALSE;
if (strstr (answer, "assword") != NULL)
@@ -584,7 +585,8 @@ fish_open_archive_talk (struct vfs_class *me, struct vfs_s_super *super)
{
char *p, *op;
- p = g_strdup_printf (_("fish: Password is required for %s"), super->path_element->user);
+ p = g_strdup_printf (_("shell: Password is required for %s"),
+ super->path_element->user);
op = vfs_get_password (p);
g_free (p);
if (op == NULL)
@@ -592,14 +594,14 @@ fish_open_archive_talk (struct vfs_class *me, struct vfs_s_super *super)
super->path_element->password = op;
}
- printf ("\n%s\n", _("fish: Sending password..."));
+ printf ("\n%s\n", _("shell: Sending password..."));
{
size_t str_len;
str_len = strlen (super->path_element->password);
- if ((write (fish_super.sockw, super->path_element->password, str_len) !=
- (ssize_t) str_len) || (write (fish_super->sockw, "\n", 1) != 1))
+ if ((write (shell_super.sockw, super->path_element->password, str_len) !=
+ (ssize_t) str_len) || (write (shell_super->sockw, "\n", 1) != 1))
return FALSE;
}
#endif
@@ -610,7 +612,7 @@ fish_open_archive_talk (struct vfs_class *me, struct vfs_s_super *super)
/* --------------------------------------------------------------------------------------------- */
static int
-fish_open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
+shell_open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
{
gboolean ftalk;
@@ -618,10 +620,10 @@ fish_open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
pre_exec ();
/* open pipe */
- fish_open_archive_pipeopen (super);
+ shell_open_archive_pipeopen (super);
/* Start talk with ssh-server (password prompt, etc ) */
- ftalk = fish_open_archive_talk (me, super);
+ ftalk = shell_open_archive_talk (me, super);
/* show panels */
post_exec ();
@@ -629,31 +631,18 @@ fish_open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
if (!ftalk)
ERRNOR (E_PROTO, -1);
- vfs_print_message ("%s", _("fish: Sending initial line..."));
- /*
- * Run 'start_fish_server'. If it doesn't exist - no problem,
- * we'll talk directly to the shell.
- */
-
- if (fish_command
- (me, super, WAIT_REPLY, "#FISH\necho; start_fish_server 2>&1; echo '### 200'\n",
- -1) != COMPLETE)
- ERRNOR (E_PROTO, -1);
-
- vfs_print_message ("%s", _("fish: Handshaking version..."));
- if (fish_command (me, super, WAIT_REPLY, "#VER 0.0.3\necho '### 000'\n", -1) != COMPLETE)
- ERRNOR (E_PROTO, -1);
+ vfs_print_message ("%s", _("shell: Sending initial line..."));
/* Set up remote locale to C, otherwise dates cannot be recognized */
- if (fish_command
+ if (shell_command
(me, super, WAIT_REPLY,
"LANG=C LC_ALL=C LC_TIME=C; export LANG LC_ALL LC_TIME;\n" "echo '### 200'\n",
-1) != COMPLETE)
ERRNOR (E_PROTO, -1);
- vfs_print_message ("%s", _("fish: Getting host info..."));
- if (fish_info (me, super))
- FISH_SUPER (super)->scr_env = fish_set_env (FISH_SUPER (super)->host_flags);
+ vfs_print_message ("%s", _("shell: Getting host info..."));
+ if (shell_info (me, super))
+ SHELL_SUPER (super)->scr_env = shell_set_env (SHELL_SUPER (super)->host_flags);
#if 0
super->name =
@@ -663,7 +652,7 @@ fish_open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
super->name = g_strdup (PATH_SEP_STR);
#endif
- super->root = vfs_s_new_inode (me, super, fish_default_stat (me));
+ super->root = vfs_s_new_inode (me, super, shell_default_stat (me));
return 0;
}
@@ -671,68 +660,72 @@ fish_open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
/* --------------------------------------------------------------------------------------------- */
static int
-fish_open_archive (struct vfs_s_super *super,
- const vfs_path_t * vpath, const vfs_path_element_t * vpath_element)
+shell_open_archive (struct vfs_s_super *super,
+ const vfs_path_t * vpath, const vfs_path_element_t * vpath_element)
{
- fish_super_t *fish_super = FISH_SUPER (super);
+ shell_super_t *shell_super = SHELL_SUPER (super);
(void) vpath;
super->path_element = vfs_path_element_clone (vpath_element);
if (strncmp (vpath_element->vfs_prefix, "rsh", 3) == 0)
- super->path_element->port = FISH_FLAG_RSH;
-
- fish_super->scr_ls =
- fish_load_script_from_file (super->path_element->host, FISH_LS_FILE, FISH_LS_DEF_CONTENT);
- fish_super->scr_exists =
- fish_load_script_from_file (super->path_element->host, FISH_EXISTS_FILE,
- FISH_EXISTS_DEF_CONTENT);
- fish_super->scr_mkdir =
- fish_load_script_from_file (super->path_element->host, FISH_MKDIR_FILE,
- FISH_MKDIR_DEF_CONTENT);
- fish_super->scr_unlink =
- fish_load_script_from_file (super->path_element->host, FISH_UNLINK_FILE,
- FISH_UNLINK_DEF_CONTENT);
- fish_super->scr_chown =
- fish_load_script_from_file (super->path_element->host, FISH_CHOWN_FILE,
- FISH_CHOWN_DEF_CONTENT);
- fish_super->scr_chmod =
- fish_load_script_from_file (super->path_element->host, FISH_CHMOD_FILE,
- FISH_CHMOD_DEF_CONTENT);
- fish_super->scr_utime =
- fish_load_script_from_file (super->path_element->host, FISH_UTIME_FILE,
- FISH_UTIME_DEF_CONTENT);
- fish_super->scr_rmdir =
- fish_load_script_from_file (super->path_element->host, FISH_RMDIR_FILE,
- FISH_RMDIR_DEF_CONTENT);
- fish_super->scr_ln =
- fish_load_script_from_file (super->path_element->host, FISH_LN_FILE, FISH_LN_DEF_CONTENT);
- fish_super->scr_mv =
- fish_load_script_from_file (super->path_element->host, FISH_MV_FILE, FISH_MV_DEF_CONTENT);
- fish_super->scr_hardlink =
- fish_load_script_from_file (super->path_element->host, FISH_HARDLINK_FILE,
- FISH_HARDLINK_DEF_CONTENT);
- fish_super->scr_get =
- fish_load_script_from_file (super->path_element->host, FISH_GET_FILE, FISH_GET_DEF_CONTENT);
- fish_super->scr_send =
- fish_load_script_from_file (super->path_element->host, FISH_SEND_FILE,
- FISH_SEND_DEF_CONTENT);
- fish_super->scr_append =
- fish_load_script_from_file (super->path_element->host, FISH_APPEND_FILE,
- FISH_APPEND_DEF_CONTENT);
- fish_super->scr_info =
- fish_load_script_from_file (super->path_element->host, FISH_INFO_FILE,
- FISH_INFO_DEF_CONTENT);
-
- return fish_open_archive_int (vpath_element->class, super);
+ super->path_element->port = SHELL_FLAG_RSH;
+
+ shell_super->scr_ls =
+ shell_load_script_from_file (super->path_element->host, VFS_SHELL_LS_FILE,
+ VFS_SHELL_LS_DEF_CONTENT);
+ shell_super->scr_exists =
+ shell_load_script_from_file (super->path_element->host, VFS_SHELL_EXISTS_FILE,
+ VFS_SHELL_EXISTS_DEF_CONTENT);
+ shell_super->scr_mkdir =
+ shell_load_script_from_file (super->path_element->host, VFS_SHELL_MKDIR_FILE,
+ VFS_SHELL_MKDIR_DEF_CONTENT);
+ shell_super->scr_unlink =
+ shell_load_script_from_file (super->path_element->host, VFS_SHELL_UNLINK_FILE,
+ VFS_SHELL_UNLINK_DEF_CONTENT);
+ shell_super->scr_chown =
+ shell_load_script_from_file (super->path_element->host, VFS_SHELL_CHOWN_FILE,
+ VFS_SHELL_CHOWN_DEF_CONTENT);
+ shell_super->scr_chmod =
+ shell_load_script_from_file (super->path_element->host, VFS_SHELL_CHMOD_FILE,
+ VFS_SHELL_CHMOD_DEF_CONTENT);
+ shell_super->scr_utime =
+ shell_load_script_from_file (super->path_element->host, VFS_SHELL_UTIME_FILE,
+ VFS_SHELL_UTIME_DEF_CONTENT);
+ shell_super->scr_rmdir =
+ shell_load_script_from_file (super->path_element->host, VFS_SHELL_RMDIR_FILE,
+ VFS_SHELL_RMDIR_DEF_CONTENT);
+ shell_super->scr_ln =
+ shell_load_script_from_file (super->path_element->host, VFS_SHELL_LN_FILE,
+ VFS_SHELL_LN_DEF_CONTENT);
+ shell_super->scr_mv =
+ shell_load_script_from_file (super->path_element->host, VFS_SHELL_MV_FILE,
+ VFS_SHELL_MV_DEF_CONTENT);
+ shell_super->scr_hardlink =
+ shell_load_script_from_file (super->path_element->host, VFS_SHELL_HARDLINK_FILE,
+ VFS_SHELL_HARDLINK_DEF_CONTENT);
+ shell_super->scr_get =
+ shell_load_script_from_file (super->path_element->host, VFS_SHELL_GET_FILE,
+ VFS_SHELL_GET_DEF_CONTENT);
+ shell_super->scr_send =
+ shell_load_script_from_file (super->path_element->host, VFS_SHELL_SEND_FILE,
+ VFS_SHELL_SEND_DEF_CONTENT);
+ shell_super->scr_append =
+ shell_load_script_from_file (super->path_element->host, VFS_SHELL_APPEND_FILE,
+ VFS_SHELL_APPEND_DEF_CONTENT);
+ shell_super->scr_info =
+ shell_load_script_from_file (super->path_element->host, VFS_SHELL_INFO_FILE,
+ VFS_SHELL_INFO_DEF_CONTENT);
+
+ return shell_open_archive_int (vpath_element->class, super);
}
/* --------------------------------------------------------------------------------------------- */
static int
-fish_archive_same (const vfs_path_element_t * vpath_element, struct vfs_s_super *super,
- const vfs_path_t * vpath, void *cookie)
+shell_archive_same (const vfs_path_element_t * vpath_element, struct vfs_s_super *super,
+ const vfs_path_t * vpath, void *cookie)
{
vfs_path_element_t *path_element;
int result;
@@ -757,7 +750,7 @@ fish_archive_same (const vfs_path_element_t * vpath_element, struct vfs_s_super
/* --------------------------------------------------------------------------------------------- */
static void
-fish_parse_ls (char *buffer, struct vfs_s_entry *ent)
+shell_parse_ls (char *buffer, struct vfs_s_entry *ent)
{
#define ST ent->ino->st
@@ -914,7 +907,7 @@ fish_parse_ls (char *buffer, struct vfs_s_entry *ent)
/* --------------------------------------------------------------------------------------------- */
static int
-fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, const char *remote_path)
+shell_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, const char *remote_path)
{
struct vfs_s_super *super = dir->super;
char buffer[BUF_8K] = "\0";
@@ -923,20 +916,20 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, const char *remote
int reply_code;
/*
- * Simple FISH debug interface :]
+ * Simple SHELL debug interface :]
*/
#if 0
if (me->logfile == NULL)
- me->logfile = fopen ("/tmp/mc-FISH.sh", "w");
+ me->logfile = fopen ("/tmp/mc-SHELL.sh", "w");
#endif
- vfs_print_message (_("fish: Reading directory %s..."), remote_path);
+ vfs_print_message (_("shell: Reading directory %s..."), remote_path);
- dir->timestamp = g_get_monotonic_time () + fish_directory_timeout * G_USEC_PER_SEC;
+ dir->timestamp = g_get_monotonic_time () + shell_directory_timeout * G_USEC_PER_SEC;
quoted_path = strutils_shell_escape (remote_path);
- (void) fish_command_v (me, super, NONE, FISH_SUPER (super)->scr_ls, "FISH_FILENAME=%s;\n",
- quoted_path);
+ (void) shell_command_v (me, super, NONE, SHELL_SUPER (super)->scr_ls, "SHELL_FILENAME=%s;\n",
+ quoted_path);
g_free (quoted_path);
ent = vfs_s_generate_entry (me, NULL, dir, 0);
@@ -945,7 +938,8 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, const char *remote
{
int res;
- res = vfs_s_get_line_interruptible (me, buffer, sizeof (buffer), FISH_SUPER (super)->sockr);
+ res =
+ vfs_s_get_line_interruptible (me, buffer, sizeof (buffer), SHELL_SUPER (super)->sockr);
if ((res == 0) || (res == EINTR))
{
@@ -963,7 +957,7 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, const char *remote
break;
if (buffer[0] != '\0')
- fish_parse_ls (buffer, ent);
+ shell_parse_ls (buffer, ent);
else if (ent->name != NULL)
{
vfs_s_insert_entry (me, dir, ent);
@@ -972,7 +966,7 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, const char *remote
}
vfs_s_free_entry (me, ent);
- reply_code = fish_decode_reply (buffer + 4, 0);
+ reply_code = shell_decode_reply (buffer + 4, 0);
if (reply_code == COMPLETE)
{
vfs_print_message (_("%s: done."), me->name);
@@ -989,11 +983,11 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, const char *remote
/* --------------------------------------------------------------------------------------------- */
static int
-fish_file_store (struct vfs_class *me, vfs_file_handler_t * fh, char *name, char *localname)
+shell_file_store (struct vfs_class *me, vfs_file_handler_t * fh, char *name, char *localname)
{
- fish_file_handler_t *fish = FISH_FILE_HANDLER (fh);
+ shell_file_handler_t *shell = SHELL_FILE_HANDLER (fh);
struct vfs_s_super *super = VFS_FILE_HANDLER_SUPER (fh);
- fish_super_t *fish_super = FISH_SUPER (super);
+ shell_super_t *shell_super = SHELL_SUPER (super);
int code;
off_t total = 0;
char buffer[BUF_8K];
@@ -1040,14 +1034,14 @@ fish_file_store (struct vfs_class *me, vfs_file_handler_t * fh, char *name, char
*/
quoted_name = strutils_shell_escape (name);
- vfs_print_message (_("fish: store %s: sending command..."), quoted_name);
+ vfs_print_message (_("shell: store %s: sending command..."), quoted_name);
/* FIXME: File size is limited to ULONG_MAX */
code =
- fish_command_v (me, super, WAIT_REPLY,
- fish->append ? fish_super->scr_append : fish_super->scr_send,
- "FISH_FILENAME=%s FISH_FILESIZE=%" PRIuMAX ";\n", quoted_name,
- (uintmax_t) s.st_size);
+ shell_command_v (me, super, WAIT_REPLY,
+ shell->append ? shell_super->scr_append : shell_super->scr_send,
+ "SHELL_FILENAME=%s SHELL_FILESIZE=%" PRIuMAX ";\n", quoted_name,
+ (uintmax_t) s.st_size);
g_free (quoted_name);
if (code != PRELIM)
@@ -1064,7 +1058,7 @@ fish_file_store (struct vfs_class *me, vfs_file_handler_t * fh, char *name, char
{
if ((errno == EINTR) && tty_got_interrupt ())
continue;
- vfs_print_message ("%s", _("fish: Local read failed, sending zeros"));
+ vfs_print_message ("%s", _("shell: Local read failed, sending zeros"));
close (h);
h = open ("/dev/zero", O_RDONLY);
}
@@ -1072,7 +1066,7 @@ fish_file_store (struct vfs_class *me, vfs_file_handler_t * fh, char *name, char
if (n == 0)
break;
- t = write (fish_super->sockw, buffer, n);
+ t = write (shell_super->sockw, buffer, n);
if (t != n)
{
if (t == -1)
@@ -1083,27 +1077,27 @@ fish_file_store (struct vfs_class *me, vfs_file_handler_t * fh, char *name, char
}
tty_disable_interrupt_key ();
total += n;
- vfs_print_message ("%s: %" PRIuMAX "/%" PRIuMAX, _("fish: storing file"),
+ vfs_print_message ("%s: %" PRIuMAX "/%" PRIuMAX, _("shell: storing file"),
(uintmax_t) total, (uintmax_t) s.st_size);
}
close (h);
- if (fish_get_reply (me, fish_super->sockr, NULL, 0) != COMPLETE)
+ if (shell_get_reply (me, shell_super->sockr, NULL, 0) != COMPLETE)
ERRNOR (E_REMOTE, -1);
return 0;
error_return:
close (h);
- fish_get_reply (me, fish_super->sockr, NULL, 0);
+ shell_get_reply (me, shell_super->sockr, NULL, 0);
return -1;
}
/* --------------------------------------------------------------------------------------------- */
static int
-fish_linear_start (struct vfs_class *me, vfs_file_handler_t * fh, off_t offset)
+shell_linear_start (struct vfs_class *me, vfs_file_handler_t * fh, off_t offset)
{
- fish_file_handler_t *fish = FISH_FILE_HANDLER (fh);
+ shell_file_handler_t *shell = SHELL_FILE_HANDLER (fh);
struct vfs_s_super *super = VFS_FILE_HANDLER_SUPER (fh);
char *name;
char *quoted_name;
@@ -1113,7 +1107,7 @@ fish_linear_start (struct vfs_class *me, vfs_file_handler_t * fh, off_t offset)
return 0;
quoted_name = strutils_shell_escape (name);
g_free (name);
- fish->append = FALSE;
+ shell->append = FALSE;
/*
* Check whether the remote file is readable by using 'dd' to copy
@@ -1123,20 +1117,20 @@ fish_linear_start (struct vfs_class *me, vfs_file_handler_t * fh, off_t offset)
*/
offset =
- fish_command_v (me, super, WANT_STRING, FISH_SUPER (super)->scr_get,
- "FISH_FILENAME=%s FISH_START_OFFSET=%" PRIuMAX ";\n", quoted_name,
- (uintmax_t) offset);
+ shell_command_v (me, super, WANT_STRING, SHELL_SUPER (super)->scr_get,
+ "SHELL_FILENAME=%s SHELL_START_OFFSET=%" PRIuMAX ";\n", quoted_name,
+ (uintmax_t) offset);
g_free (quoted_name);
if (offset != PRELIM)
ERRNOR (E_REMOTE, 0);
fh->linear = LS_LINEAR_OPEN;
- fish->got = 0;
+ shell->got = 0;
errno = 0;
#if SIZEOF_OFF_T == SIZEOF_LONG
- fish->total = (off_t) strtol (reply_str, NULL, 10);
+ shell->total = (off_t) strtol (reply_str, NULL, 10);
#else
- fish->total = (off_t) g_ascii_strtoll (reply_str, NULL, 10);
+ shell->total = (off_t) g_ascii_strtoll (reply_str, NULL, 10);
#endif
if (errno != 0)
ERRNOR (E_REMOTE, 0);
@@ -1146,9 +1140,9 @@ fish_linear_start (struct vfs_class *me, vfs_file_handler_t * fh, off_t offset)
/* --------------------------------------------------------------------------------------------- */
static void
-fish_linear_abort (struct vfs_class *me, vfs_file_handler_t * fh)
+shell_linear_abort (struct vfs_class *me, vfs_file_handler_t * fh)
{
- fish_file_handler_t *fish = FISH_FILE_HANDLER (fh);
+ shell_file_handler_t *shell = SHELL_FILE_HANDLER (fh);
struct vfs_s_super *super = VFS_FILE_HANDLER_SUPER (fh);
char buffer[BUF_8K];
ssize_t n;
@@ -1157,18 +1151,18 @@ fish_linear_abort (struct vfs_class *me, vfs_file_handler_t * fh)
do
{
- n = MIN ((off_t) sizeof (buffer), (fish->total - fish->got));
+ n = MIN ((off_t) sizeof (buffer), (shell->total - shell->got));
if (n != 0)
{
- n = read (FISH_SUPER (super)->sockr, buffer, n);
+ n = read (SHELL_SUPER (super)->sockr, buffer, n);
if (n < 0)
return;
- fish->got += n;
+ shell->got += n;
}
}
while (n != 0);
- if (fish_get_reply (me, FISH_SUPER (super)->sockr, NULL, 0) != COMPLETE)
+ if (shell_get_reply (me, SHELL_SUPER (super)->sockr, NULL, 0) != COMPLETE)
vfs_print_message ("%s", _("Error reported after abort."));
else
vfs_print_message ("%s", _("Aborted transfer would be successful."));
@@ -1177,15 +1171,15 @@ fish_linear_abort (struct vfs_class *me, vfs_file_handler_t * fh)
/* --------------------------------------------------------------------------------------------- */
static ssize_t
-fish_linear_read (struct vfs_class *me, vfs_file_handler_t * fh, void *buf, size_t len)
+shell_linear_read (struct vfs_class *me, vfs_file_handler_t * fh, void *buf, size_t len)
{
- fish_file_handler_t *fish = FISH_FILE_HANDLER (fh);
+ shell_file_handler_t *shell = SHELL_FILE_HANDLER (fh);
struct vfs_s_super *super = VFS_FILE_HANDLER_SUPER (fh);
ssize_t n = 0;
- len = MIN ((size_t) (fish->total - fish->got), len);
+ len = MIN ((size_t) (shell->total - shell->got), len);
tty_disable_interrupt_key ();
- while (len != 0 && ((n = read (FISH_SUPER (super)->sockr, buf, len)) < 0))
+ while (len != 0 && ((n = read (SHELL_SUPER (super)->sockr, buf, len)) < 0))
{
if ((errno == EINTR) && !tty_got_interrupt ())
continue;
@@ -1194,10 +1188,10 @@ fish_linear_read (struct vfs_class *me, vfs_file_handler_t * fh, void *buf, size
tty_enable_interrupt_key ();
if (n > 0)
- fish->got += n;
+ shell->got += n;
else if (n < 0)
- fish_linear_abort (me, fh);
- else if (fish_get_reply (me, FISH_SUPER (super)->sockr, NULL, 0) != COMPLETE)
+ shell_linear_abort (me, fh);
+ else if (shell_get_reply (me, SHELL_SUPER (super)->sockr, NULL, 0) != COMPLETE)
ERRNOR (E_REMOTE, -1);
ERRNOR (errno, n);
}
@@ -1205,18 +1199,18 @@ fish_linear_read (struct vfs_class *me, vfs_file_handler_t * fh, void *buf, size
/* --------------------------------------------------------------------------------------------- */
static void
-fish_linear_close (struct vfs_class *me, vfs_file_handler_t * fh)
+shell_linear_close (struct vfs_class *me, vfs_file_handler_t * fh)
{
- fish_file_handler_t *fish = FISH_FILE_HANDLER (fh);
+ shell_file_handler_t *shell = SHELL_FILE_HANDLER (fh);
- if (fish->total != fish->got)
- fish_linear_abort (me, fh);
+ if (shell->total != shell->got)
+ shell_linear_abort (me, fh);
}
/* --------------------------------------------------------------------------------------------- */
static int
-fish_ctl (void *fh, int ctlop, void *arg)
+shell_ctl (void *fh, int ctlop, void *arg)
{
(void) arg;
(void) fh;
@@ -1237,7 +1231,7 @@ fish_ctl (void *fh, int ctlop, void *arg)
if (file->linear == LS_LINEAR_CLOSED || file->linear == LS_LINEAR_PREOPEN)
return 0;
- v = vfs_s_select_on_two (VFS_FILE_HANDLER_SUPER (fh)->u.fish.sockr, 0);
+ v = vfs_s_select_on_two (VFS_FILE_HANDLER_SUPER (fh)->u.shell.sockr, 0);
return (((v < 0) && (errno == EINTR)) || v == 0) ? 1 : 0;
}
@@ -1250,7 +1244,7 @@ fish_ctl (void *fh, int ctlop, void *arg)
/* --------------------------------------------------------------------------------------------- */
static int
-fish_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
+shell_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
{
const char *crpath1, *crpath2;
char *rpath1, *rpath2;
@@ -1272,8 +1266,8 @@ fish_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath1));
ret =
- fish_send_command (me, super2, OPT_FLUSH, FISH_SUPER (super)->scr_mv,
- "FISH_FILEFROM=%s FISH_FILETO=%s;\n", rpath1, rpath2);
+ shell_send_command (me, super2, OPT_FLUSH, SHELL_SUPER (super)->scr_mv,
+ "SHELL_FILEFROM=%s SHELL_FILETO=%s;\n", rpath1, rpath2);
g_free (rpath1);
g_free (rpath2);
@@ -1284,7 +1278,7 @@ fish_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
/* --------------------------------------------------------------------------------------------- */
static int
-fish_link (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
+shell_link (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
{
const char *crpath1, *crpath2;
char *rpath1, *rpath2;
@@ -1306,8 +1300,8 @@ fish_link (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath1));
ret =
- fish_send_command (me, super2, OPT_FLUSH, FISH_SUPER (super)->scr_hardlink,
- "FISH_FILEFROM=%s FISH_FILETO=%s;\n", rpath1, rpath2);
+ shell_send_command (me, super2, OPT_FLUSH, SHELL_SUPER (super)->scr_hardlink,
+ "SHELL_FILEFROM=%s SHELL_FILETO=%s;\n", rpath1, rpath2);
g_free (rpath1);
g_free (rpath2);
@@ -1318,7 +1312,7 @@ fish_link (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
/* --------------------------------------------------------------------------------------------- */
static int
-fish_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
+shell_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
{
char *qsetto;
const char *crpath;
@@ -1337,8 +1331,8 @@ fish_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath2));
ret =
- fish_send_command (me, super, OPT_FLUSH, FISH_SUPER (super)->scr_ln,
- "FISH_FILEFROM=%s FISH_FILETO=%s;\n", qsetto, rpath);
+ shell_send_command (me, super, OPT_FLUSH, SHELL_SUPER (super)->scr_ln,
+ "SHELL_FILEFROM=%s SHELL_FILETO=%s;\n", qsetto, rpath);
g_free (qsetto);
g_free (rpath);
@@ -1349,43 +1343,43 @@ fish_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
/* --------------------------------------------------------------------------------------------- */
static int
-fish_stat (const vfs_path_t * vpath, struct stat *buf)
+shell_stat (const vfs_path_t * vpath, struct stat *buf)
{
int ret;
ret = vfs_s_stat (vpath, buf);
- fish_set_blksize (buf);
+ shell_set_blksize (buf);
return ret;
}
/* --------------------------------------------------------------------------------------------- */
static int
-fish_lstat (const vfs_path_t * vpath, struct stat *buf)
+shell_lstat (const vfs_path_t * vpath, struct stat *buf)
{
int ret;
ret = vfs_s_lstat (vpath, buf);
- fish_set_blksize (buf);
+ shell_set_blksize (buf);
return ret;
}
/* --------------------------------------------------------------------------------------------- */
static int
-fish_fstat (void *vfs_info, struct stat *buf)
+shell_fstat (void *vfs_info, struct stat *buf)
{
int ret;
ret = vfs_s_fstat (vfs_info, buf);
- fish_set_blksize (buf);
+ shell_set_blksize (buf);
return ret;
}
/* --------------------------------------------------------------------------------------------- */
static int
-fish_chmod (const vfs_path_t * vpath, mode_t mode)
+shell_chmod (const vfs_path_t * vpath, mode_t mode)
{
const char *crpath;
char *rpath;
@@ -1402,9 +1396,9 @@ fish_chmod (const vfs_path_t * vpath, mode_t mode)
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
ret =
- fish_send_command (me, super, OPT_FLUSH, FISH_SUPER (super)->scr_chmod,
- "FISH_FILENAME=%s FISH_FILEMODE=%4.4o;\n", rpath,
- (unsigned int) (mode & 07777));
+ shell_send_command (me, super, OPT_FLUSH, SHELL_SUPER (super)->scr_chmod,
+ "SHELL_FILENAME=%s SHELL_FILEMODE=%4.4o;\n", rpath,
+ (unsigned int) (mode & 07777));
g_free (rpath);
@@ -1414,7 +1408,7 @@ fish_chmod (const vfs_path_t * vpath, mode_t mode)
/* --------------------------------------------------------------------------------------------- */
static int
-fish_chown (const vfs_path_t * vpath, uid_t owner, gid_t group)
+shell_chown (const vfs_path_t * vpath, uid_t owner, gid_t group)
{
char *sowner, *sgroup;
struct passwd *pw;
@@ -1446,9 +1440,9 @@ fish_chown (const vfs_path_t * vpath, uid_t owner, gid_t group)
/* FIXME: what should we report if chgrp succeeds but chown fails? */
ret =
- fish_send_command (me, super, OPT_FLUSH, FISH_SUPER (super)->scr_chown,
- "FISH_FILENAME=%s FISH_FILEOWNER=%s FISH_FILEGROUP=%s;\n", rpath, sowner,
- sgroup);
+ shell_send_command (me, super, OPT_FLUSH, SHELL_SUPER (super)->scr_chown,
+ "SHELL_FILENAME=%s SHELL_FILEOWNER=%s SHELL_FILEGROUP=%s;\n", rpath,
+ sowner, sgroup);
g_free (rpath);
@@ -1458,7 +1452,7 @@ fish_chown (const vfs_path_t * vpath, uid_t owner, gid_t group)
/* --------------------------------------------------------------------------------------------- */
static void
-fish_get_atime (mc_timesbuf_t * times, time_t * sec, long *nsec)
+shell_get_atime (mc_timesbuf_t * times, time_t * sec, long *nsec)
{
#ifdef HAVE_UTIMENSAT
*sec = (*times)[0].tv_sec;
@@ -1472,7 +1466,7 @@ fish_get_atime (mc_timesbuf_t * times, time_t * sec, long *nsec)
/* --------------------------------------------------------------------------------------------- */
static void
-fish_get_mtime (mc_timesbuf_t * times, time_t * sec, long *nsec)
+shell_get_mtime (mc_timesbuf_t * times, time_t * sec, long *nsec)
{
#ifdef HAVE_UTIMENSAT
*sec = (*times)[1].tv_sec;
@@ -1486,7 +1480,7 @@ fish_get_mtime (mc_timesbuf_t * times, time_t * sec, long *nsec)
/* --------------------------------------------------------------------------------------------- */
static int
-fish_utime (const vfs_path_t * vpath, mc_timesbuf_t * times)
+shell_utime (const vfs_path_t * vpath, mc_timesbuf_t * times)
{
char utcatime[16], utcmtime[16];
char utcatime_w_nsec[30], utcmtime_w_nsec[30];
@@ -1505,7 +1499,7 @@ fish_utime (const vfs_path_t * vpath, mc_timesbuf_t * times)
rpath = strutils_shell_escape (crpath);
- fish_get_atime (times, &atime, &atime_nsec);
+ shell_get_atime (times, &atime, &atime_nsec);
gmt = gmtime (&atime);
g_snprintf (utcatime, sizeof (utcatime), "%04d%02d%02d%02d%02d.%02d",
gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday,
@@ -1514,7 +1508,7 @@ fish_utime (const vfs_path_t * vpath, mc_timesbuf_t * times)
gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday,
gmt->tm_hour, gmt->tm_min, gmt->tm_sec, atime_nsec);
- fish_get_mtime (times, &mtime, &mtime_nsec);
+ shell_get_mtime (times, &mtime, &mtime_nsec);
gmt = gmtime (&mtime);
g_snprintf (utcmtime, sizeof (utcmtime), "%04d%02d%02d%02d%02d.%02d",
gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday,
@@ -1525,11 +1519,11 @@ fish_utime (const vfs_path_t * vpath, mc_timesbuf_t * times)
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
- ret = fish_send_command (me, super, OPT_FLUSH, FISH_SUPER (super)->scr_utime,
- "FISH_FILENAME=%s FISH_FILEATIME=%ld FISH_FILEMTIME=%ld "
- "FISH_TOUCHATIME=%s FISH_TOUCHMTIME=%s FISH_TOUCHATIME_W_NSEC=\"%s\" "
- "FISH_TOUCHMTIME_W_NSEC=\"%s\";\n", rpath, (long) atime, (long) mtime,
- utcatime, utcmtime, utcatime_w_nsec, utcmtime_w_nsec);
+ ret = shell_send_command (me, super, OPT_FLUSH, SHELL_SUPER (super)->scr_utime,
+ "SHELL_FILENAME=%s SHELL_FILEATIME=%ld SHELL_FILEMTIME=%ld "
+ "SHELL_TOUCHATIME=%s SHELL_TOUCHMTIME=%s SHELL_TOUCHATIME_W_NSEC=\"%s\" "
+ "SHELL_TOUCHMTIME_W_NSEC=\"%s\";\n", rpath, (long) atime,
+ (long) mtime, utcatime, utcmtime, utcatime_w_nsec, utcmtime_w_nsec);
g_free (rpath);
@@ -1539,7 +1533,7 @@ fish_utime (const vfs_path_t * vpath, mc_timesbuf_t * times)
/* --------------------------------------------------------------------------------------------- */
static int
-fish_unlink (const vfs_path_t * vpath)
+shell_unlink (const vfs_path_t * vpath)
{
const char *crpath;
char *rpath;
@@ -1556,8 +1550,8 @@ fish_unlink (const vfs_path_t * vpath)
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
ret =
- fish_send_command (me, super, OPT_FLUSH, FISH_SUPER (super)->scr_unlink,
- "FISH_FILENAME=%s;\n", rpath);
+ shell_send_command (me, super, OPT_FLUSH, SHELL_SUPER (super)->scr_unlink,
+ "SHELL_FILENAME=%s;\n", rpath);
g_free (rpath);
@@ -1567,7 +1561,7 @@ fish_unlink (const vfs_path_t * vpath)
/* --------------------------------------------------------------------------------------------- */
static int
-fish_exists (const vfs_path_t * vpath)
+shell_exists (const vfs_path_t * vpath)
{
const char *crpath;
char *rpath;
@@ -1584,8 +1578,8 @@ fish_exists (const vfs_path_t * vpath)
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
ret =
- fish_send_command (me, super, OPT_FLUSH, FISH_SUPER (super)->scr_exists,
- "FISH_FILENAME=%s;\n", rpath);
+ shell_send_command (me, super, OPT_FLUSH, SHELL_SUPER (super)->scr_exists,
+ "SHELL_FILENAME=%s;\n", rpath);
g_free (rpath);
@@ -1595,7 +1589,7 @@ fish_exists (const vfs_path_t * vpath)
/* --------------------------------------------------------------------------------------------- */
static int
-fish_mkdir (const vfs_path_t * vpath, mode_t mode)
+shell_mkdir (const vfs_path_t * vpath, mode_t mode)
{
const char *crpath;
char *rpath;
@@ -1614,14 +1608,14 @@ fish_mkdir (const vfs_path_t * vpath, mode_t mode)
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
ret =
- fish_send_command (me, super, OPT_FLUSH, FISH_SUPER (super)->scr_mkdir,
- "FISH_FILENAME=%s;\n", rpath);
+ shell_send_command (me, super, OPT_FLUSH, SHELL_SUPER (super)->scr_mkdir,
+ "SHELL_FILENAME=%s;\n", rpath);
g_free (rpath);
if (ret != 0)
return ret;
- if (fish_exists (vpath) == 0)
+ if (shell_exists (vpath) == 0)
{
me->verrno = EACCES;
return -1;
@@ -1632,7 +1626,7 @@ fish_mkdir (const vfs_path_t * vpath, mode_t mode)
/* --------------------------------------------------------------------------------------------- */
static int
-fish_rmdir (const vfs_path_t * vpath)
+shell_rmdir (const vfs_path_t * vpath)
{
const char *crpath;
char *rpath;
@@ -1649,8 +1643,8 @@ fish_rmdir (const vfs_path_t * vpath)
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
ret =
- fish_send_command (me, super, OPT_FLUSH, FISH_SUPER (super)->scr_rmdir,
- "FISH_FILENAME=%s;\n", rpath);
+ shell_send_command (me, super, OPT_FLUSH, SHELL_SUPER (super)->scr_rmdir,
+ "SHELL_FILENAME=%s;\n", rpath);
g_free (rpath);
@@ -1660,11 +1654,11 @@ fish_rmdir (const vfs_path_t * vpath)
/* --------------------------------------------------------------------------------------------- */
static vfs_file_handler_t *
-fish_fh_new (struct vfs_s_inode *ino, gboolean changed)
+shell_fh_new (struct vfs_s_inode *ino, gboolean changed)
{
- fish_file_handler_t *fh;
+ shell_file_handler_t *fh;
- fh = g_new0 (fish_file_handler_t, 1);
+ fh = g_new0 (shell_file_handler_t, 1);
vfs_s_init_fh (VFS_FILE_HANDLER (fh), ino, changed);
return VFS_FILE_HANDLER (fh);
@@ -1673,9 +1667,9 @@ fish_fh_new (struct vfs_s_inode *ino, gboolean changed)
/* --------------------------------------------------------------------------------------------- */
static int
-fish_fh_open (struct vfs_class *me, vfs_file_handler_t * fh, int flags, mode_t mode)
+shell_fh_open (struct vfs_class *me, vfs_file_handler_t * fh, int flags, mode_t mode)
{
- fish_file_handler_t *fish = FISH_FILE_HANDLER (fh);
+ shell_file_handler_t *shell = SHELL_FILE_HANDLER (fh);
(void) mode;
@@ -1684,7 +1678,7 @@ fish_fh_open (struct vfs_class *me, vfs_file_handler_t * fh, int flags, mode_t m
{
/* user pressed the button [ Append ] in the "Copy" dialog */
if ((flags & O_APPEND) != 0)
- fish->append = TRUE;
+ shell->append = TRUE;
if (fh->ino->localname == NULL)
{
@@ -1712,7 +1706,7 @@ fish_fh_open (struct vfs_class *me, vfs_file_handler_t * fh, int flags, mode_t m
/* --------------------------------------------------------------------------------------------- */
static void
-fish_fill_names (struct vfs_class *me, fill_names_f func)
+shell_fill_names (struct vfs_class *me, fill_names_f func)
{
GList *iter;
@@ -1726,14 +1720,14 @@ fish_fill_names (struct vfs_class *me, fill_names_f func)
switch (super->path_element->port)
{
- case FISH_FLAG_RSH:
+ case SHELL_FLAG_RSH:
flags = ":r";
break;
- case FISH_FLAG_COMPRESSED:
+ case SHELL_FLAG_COMPRESSED:
flags = ":C";
break;
default:
- if (super->path_element->port > FISH_FLAG_RSH)
+ if (super->path_element->port > SHELL_FLAG_RSH)
{
g_snprintf (gbuf, sizeof (gbuf), ":%d", super->path_element->port);
flags = gbuf;
@@ -1742,7 +1736,7 @@ fish_fill_names (struct vfs_class *me, fill_names_f func)
}
name =
- g_strconcat (vfs_fish_ops->prefix, VFS_PATH_URL_DELIMITER,
+ g_strconcat (vfs_shell_ops->prefix, VFS_PATH_URL_DELIMITER,
super->path_element->user, "@", super->path_element->host, flags,
PATH_SEP_STR, super->path_element->path, (char *) NULL);
func (name);
@@ -1753,11 +1747,11 @@ fish_fill_names (struct vfs_class *me, fill_names_f func)
/* --------------------------------------------------------------------------------------------- */
static void *
-fish_open (const vfs_path_t * vpath, int flags, mode_t mode)
+shell_open (const vfs_path_t * vpath, int flags, mode_t mode)
{
/*
sorry, i've places hack here
- cause fish don't able to open files with O_EXCL flag
+ cause shell don't able to open files with O_EXCL flag
*/
flags &= ~O_EXCL;
return vfs_s_open (vpath, flags, mode);
@@ -1768,38 +1762,38 @@ fish_open (const vfs_path_t * vpath, int flags, mode_t mode)
/* --------------------------------------------------------------------------------------------- */
void
-vfs_init_fish (void)
+vfs_init_shell (void)
{
tcp_init ();
- vfs_init_subclass (&fish_subclass, "fish", VFSF_REMOTE | VFSF_USETMP, "sh");
- vfs_fish_ops->fill_names = fish_fill_names;
- vfs_fish_ops->stat = fish_stat;
- vfs_fish_ops->lstat = fish_lstat;
- vfs_fish_ops->fstat = fish_fstat;
- vfs_fish_ops->chmod = fish_chmod;
- vfs_fish_ops->chown = fish_chown;
- vfs_fish_ops->utime = fish_utime;
- vfs_fish_ops->open = fish_open;
- vfs_fish_ops->symlink = fish_symlink;
- vfs_fish_ops->link = fish_link;
- vfs_fish_ops->unlink = fish_unlink;
- vfs_fish_ops->rename = fish_rename;
- vfs_fish_ops->mkdir = fish_mkdir;
- vfs_fish_ops->rmdir = fish_rmdir;
- vfs_fish_ops->ctl = fish_ctl;
- fish_subclass.archive_same = fish_archive_same;
- fish_subclass.new_archive = fish_new_archive;
- fish_subclass.open_archive = fish_open_archive;
- fish_subclass.free_archive = fish_free_archive;
- fish_subclass.fh_new = fish_fh_new;
- fish_subclass.fh_open = fish_fh_open;
- fish_subclass.dir_load = fish_dir_load;
- fish_subclass.file_store = fish_file_store;
- fish_subclass.linear_start = fish_linear_start;
- fish_subclass.linear_read = fish_linear_read;
- fish_subclass.linear_close = fish_linear_close;
- vfs_register_class (vfs_fish_ops);
+ vfs_init_subclass (&shell_subclass, "shell", VFSF_REMOTE | VFSF_USETMP, "sh");
+ vfs_shell_ops->fill_names = shell_fill_names;
+ vfs_shell_ops->stat = shell_stat;
+ vfs_shell_ops->lstat = shell_lstat;
+ vfs_shell_ops->fstat = shell_fstat;
+ vfs_shell_ops->chmod = shell_chmod;
+ vfs_shell_ops->chown = shell_chown;
+ vfs_shell_ops->utime = shell_utime;
+ vfs_shell_ops->open = shell_open;
+ vfs_shell_ops->symlink = shell_symlink;
+ vfs_shell_ops->link = shell_link;
+ vfs_shell_ops->unlink = shell_unlink;
+ vfs_shell_ops->rename = shell_rename;
+ vfs_shell_ops->mkdir = shell_mkdir;
+ vfs_shell_ops->rmdir = shell_rmdir;
+ vfs_shell_ops->ctl = shell_ctl;
+ shell_subclass.archive_same = shell_archive_same;
+ shell_subclass.new_archive = shell_new_archive;
+ shell_subclass.open_archive = shell_open_archive;
+ shell_subclass.free_archive = shell_free_archive;
+ shell_subclass.fh_new = shell_fh_new;
+ shell_subclass.fh_open = shell_fh_open;
+ shell_subclass.dir_load = shell_dir_load;
+ shell_subclass.file_store = shell_file_store;
+ shell_subclass.linear_start = shell_linear_start;
+ shell_subclass.linear_read = shell_linear_read;
+ shell_subclass.linear_close = shell_linear_close;
+ vfs_register_class (vfs_shell_ops);
}
/* --------------------------------------------------------------------------------------------- */
diff --git a/src/vfs/fish/fish.h b/src/vfs/shell/shell.h
index 3c1fa06..e485d69 100644
--- a/src/vfs/fish/fish.h
+++ b/src/vfs/shell/shell.h
@@ -1,13 +1,13 @@
/**
* \file
- * \brief Header: Virtual File System: FISH implementation for transferring files over
+ * \brief Header: Virtual File System: SHELL implementation for transferring files over
* shell connections
*/
-#ifndef MC__VFS_FISH_H
-#define MC__VFS_FISH_H
+#ifndef MC__VFS_SHELL_H
+#define MC__VFS_SHELL_H
/*** typedefs(not structures) and defined constants **********************************************/
@@ -17,12 +17,12 @@
/*** global variables defined in .c file *********************************************************/
-extern int fish_directory_timeout;
+extern int shell_directory_timeout;
/*** declarations of public functions ************************************************************/
-void vfs_init_fish (void);
+void vfs_init_shell (void);
/*** inline functions ****************************************************************************/
-#endif
+#endif /* MC__VFS_SHELL_H */
diff --git a/src/vfs/fish/fishdef.h b/src/vfs/shell/shelldef.h
index 129d2b9..37244d9 100644
--- a/src/vfs/fish/fishdef.h
+++ b/src/vfs/shell/shelldef.h
@@ -1,19 +1,18 @@
/**
* \file
- * \brief Header: FISH script defaults
+ * \brief Header: SHELL script defaults
*/
-#ifndef MC__FISH_DEF_H
-#define MC__FISH_DEF_H
+#ifndef MC__VFS_SHELL_DEF_H
+#define MC__VFS_SHELL_DEF_H
/*** typedefs(not structures) and defined constants **********************************************/
/* default 'ls' script */
-#define FISH_LS_DEF_CONTENT "" \
-"#LIST /${FISH_FILENAME}\n" \
+#define VFS_SHELL_LS_DEF_CONTENT "" \
"export LC_TIME=C\n" \
-"ls -Qlan \"/${FISH_FILENAME}\" 2>/dev/null | grep '^[^cbt]' | (\n" \
+"ls -Qlan \"/${SHELL_FILENAME}\" 2>/dev/null | grep '^[^cbt]' | (\n" \
"while read p l u g s m d y n; do\n" \
" echo \"P$p $u.$g\"\n" \
" echo \"S$s\"\n" \
@@ -22,7 +21,7 @@
" echo\n" \
"done\n" \
")\n" \
-"ls -Qlan \"/${FISH_FILENAME}\" 2>/dev/null | grep '^[cb]' | (\n" \
+"ls -Qlan \"/${SHELL_FILENAME}\" 2>/dev/null | grep '^[cb]' | (\n" \
"while read p l u g a i m d y n; do\n" \
" echo \"P$p $u.$g\"\n" \
" echo \"E$a$i\"\n" \
@@ -34,120 +33,109 @@
"echo \"### 200\"\n"
/* default file exists script */
-#define FISH_EXISTS_DEF_CONTENT "" \
-"#ISEXISTS $FISH_FILENAME\n" \
-"ls -l \"/${FISH_FILENAME}\" >/dev/null 2>/dev/null\n" \
+#define VFS_SHELL_EXISTS_DEF_CONTENT "" \
+"ls -l \"/${SHELL_FILENAME}\" >/dev/null 2>/dev/null\n" \
"echo '### '$?\n"
/* default 'mkdir' script */
-#define FISH_MKDIR_DEF_CONTENT "" \
-"#MKD $FISH_FILENAME\n" \
-"if mkdir \"/${FISH_FILENAME}\" 2>/dev/null; then\n" \
+#define VFS_SHELL_MKDIR_DEF_CONTENT "" \
+"if mkdir \"/${SHELL_FILENAME}\" 2>/dev/null; then\n" \
" echo \"### 000\"\n" \
"else\n" \
" echo \"### 500\"\n" \
"fi\n"
/* default 'unlink' script */
-#define FISH_UNLINK_DEF_CONTENT "" \
-"#DELE $FISH_FILENAME\n" \
-"if rm -f \"/${FISH_FILENAME}\" 2>/dev/null; then\n" \
+#define VFS_SHELL_UNLINK_DEF_CONTENT "" \
+"if rm -f \"/${SHELL_FILENAME}\" 2>/dev/null; then\n" \
" echo \"### 000\"\n" \
"else\n" \
" echo \"### 500\"\n" \
"fi\n"
+
/* default 'chown' script */
-#define FISH_CHOWN_DEF_CONTENT "" \
-"#CHOWN $FISH_FILEOWNER:$FISH_FILEGROUP $FISH_FILENAME\n" \
-"if chown ${FISH_FILEOWNER}:${FISH_FILEGROUP} \"/${FISH_FILENAME}\"; then\n"\
-" echo \"### 000\"\n" \
-"else\n" \
-" echo \"### 500\"\n" \
+#define VFS_SHELL_CHOWN_DEF_CONTENT "" \
+"if chown ${SHELL_FILEOWNER}:${SHELL_FILEGROUP} \"/${SHELL_FILENAME}\"; then\n" \
+" echo \"### 000\"\n" \
+"else\n" \
+" echo \"### 500\"\n" \
"fi\n"
/* default 'chmod' script */
-#define FISH_CHMOD_DEF_CONTENT "" \
-"#CHMOD $FISH_FILEMODE $FISH_FILENAME\n" \
-"if chmod ${FISH_FILEMODE} \"/${FISH_FILENAME}\" 2>/dev/null; then\n" \
+#define VFS_SHELL_CHMOD_DEF_CONTENT "" \
+"if chmod ${SHELL_FILEMODE} \"/${SHELL_FILENAME}\" 2>/dev/null; then\n" \
" echo \"### 000\"\n" \
"else\n" \
" echo \"### 500\"\n" \
"fi\n"
/* default 'utime' script */
-#define FISH_UTIME_DEF_CONTENT "" \
-"#UTIME \"$FISH_TOUCHATIME_W_NSEC\" \"$FISH_TOUCHMTIME_W_NSEC\" $FISH_FILENAME\n" \
-"if TZ=UTC touch -h -m -d \"$FISH_TOUCHMTIME_W_NSEC\" \"/${FISH_FILENAME}\" 2>/dev/null && \\\n" \
-" TZ=UTC touch -h -a -d \"$FISH_TOUCHATIME_W_NSEC\" \"/${FISH_FILENAME}\" 2>/dev/null; then\n" \
-" echo \"### 000\"\n" \
-"elif TZ=UTC touch -h -m -t $FISH_TOUCHMTIME \"/${FISH_FILENAME}\" 2>/dev/null && \\\n" \
-" TZ=UTC touch -h -a -t $FISH_TOUCHATIME \"/${FISH_FILENAME}\" 2>/dev/null; then\n" \
-" echo \"### 000\"\n" \
-"elif [ -n \"$FISH_HAVE_PERL\" ] && \\\n" \
-" perl -e 'utime '$FISH_FILEATIME','$FISH_FILEMTIME',@ARGV;' \"/${FISH_FILENAME}\" 2>/dev/null; then\n" \
-" echo \"### 000\"\n" \
-"else\n" \
-" echo \"### 500\"\n" \
+#define VFS_SHELL_UTIME_DEF_CONTENT "" \
+"#UTIME \"$SHELL_TOUCHATIME_W_NSEC\" \"$SHELL_TOUCHMTIME_W_NSEC\" $SHELL_FILENAME\n" \
+"if TZ=UTC touch -h -m -d \"$SHELL_TOUCHMTIME_W_NSEC\" \"/${SHELL_FILENAME}\" 2>/dev/null && \\\n" \
+" TZ=UTC touch -h -a -d \"$SHELL_TOUCHATIME_W_NSEC\" \"/${SHELL_FILENAME}\" 2>/dev/null; then\n" \
+" echo \"### 000\"\n" \
+"elif TZ=UTC touch -h -m -t $SHELL_TOUCHMTIME \"/${SHELL_FILENAME}\" 2>/dev/null && \\\n" \
+" TZ=UTC touch -h -a -t $SHELL_TOUCHATIME \"/${SHELL_FILENAME}\" 2>/dev/null; then\n" \
+" echo \"### 000\"\n" \
+"elif [ -n \"$SHELL_HAVE_PERL\" ] && \\\n" \
+" perl -e 'utime '$SHELL_FILEATIME','$SHELL_FILEMTIME',@ARGV;' \"/${SHELL_FILENAME}\" 2>/dev/null; then\n" \
+" echo \"### 000\"\n" \
+"else\n" \
+" echo \"### 500\"\n" \
"fi\n"
-
/* default 'rmdir' script */
-#define FISH_RMDIR_DEF_CONTENT "" \
-"#RMD $FISH_FILENAME\n" \
-"if rmdir \"/${FISH_FILENAME}\" 2>/dev/null; then\n" \
+#define VFS_SHELL_RMDIR_DEF_CONTENT "" \
+"if rmdir \"/${SHELL_FILENAME}\" 2>/dev/null; then\n" \
" echo \"### 000\"\n" \
"else\n" \
" echo \"### 500\"\n" \
"fi\n"
/* default 'ln -s' symlink script */
-#define FISH_LN_DEF_CONTENT "" \
-"#SYMLINK $FISH_FILEFROM $FISH_FILETO\n" \
-"if ln -s \"/${FISH_FILEFROM}\" \"/${FISH_FILETO}\" 2>/dev/null; then\n" \
+#define VFS_SHELL_LN_DEF_CONTENT "" \
+"if ln -s \"/${SHELL_FILEFROM}\" \"/${SHELL_FILETO}\" 2>/dev/null; then\n" \
" echo \"### 000\"\n" \
"else\n" \
" echo \"### 500\"\n" \
"fi\n"
/* default 'mv' script */
-#define FISH_MV_DEF_CONTENT "" \
-"#RENAME $FISH_FILEFROM $FISH_FILETO\n" \
-"if mv \"/${FISH_FILEFROM}\" \"/${FISH_FILETO}\" 2>/dev/null; then\n" \
+#define VFS_SHELL_MV_DEF_CONTENT "" \
+"if mv \"/${SHELL_FILEFROM}\" \"/${SHELL_FILETO}\" 2>/dev/null; then\n" \
" echo \"### 000\"\n" \
"else\n" \
" echo \"### 500\"\n" \
"fi\n"
/* default 'ln' hardlink script */
-#define FISH_HARDLINK_DEF_CONTENT "" \
-"#LINK $FISH_FILEFROM $FISH_FILETO\n" \
-"if ln \"/${FISH_FILEFROM}\" \"/${FISH_FILETO}\" 2>/dev/null; then\n" \
+#define VFS_SHELL_HARDLINK_DEF_CONTENT "" \
+"if ln \"/${SHELL_FILEFROM}\" \"/${SHELL_FILETO}\" 2>/dev/null; then\n" \
" echo \"### 000\"\n" \
"else\n" \
" echo \"### 500\"\n" \
"fi\n"
/* default 'retr' script */
-#define FISH_GET_DEF_CONTENT "" \
-"export LC_TIME=C\n" \
-"#RETR $FISH_FILENAME\n" \
-"if dd if=\"/${FISH_FILENAME}\" of=/dev/null bs=1 count=1 2>/dev/null ; then\n" \
-" ls -ln \"/${FISH_FILENAME}\" 2>/dev/null | (\n" \
-" read p l u g s r\n" \
-" echo $s\n" \
-" )\n" \
-" echo \"### 100\"\n" \
-" cat \"/${FISH_FILENAME}\"\n" \
-" echo \"### 200\"\n" \
-"else\n" \
-" echo \"### 500\"\n" \
+#define VFS_SHELL_GET_DEF_CONTENT "" \
+"export LC_TIME=C\n" \
+"if dd if=\"/${SHELL_FILENAME}\" of=/dev/null bs=1 count=1 2>/dev/null ; then\n" \
+" ls -ln \"/${SHELL_FILENAME}\" 2>/dev/null | (\n" \
+" read p l u g s r\n" \
+" echo $s\n" \
+" )\n" \
+" echo \"### 100\"\n" \
+" cat \"/${SHELL_FILENAME}\"\n" \
+" echo \"### 200\"\n" \
+"else\n" \
+" echo \"### 500\"\n" \
"fi\n"
/* default 'stor' script */
-#define FISH_SEND_DEF_CONTENT "" \
-"FILENAME=\"/${FISH_FILENAME}\"\n" \
-"FILESIZE=${FISH_FILESIZE}\n" \
-"#STOR $FILESIZE $FILENAME\n" \
+#define VFS_SHELL_SEND_DEF_CONTENT "" \
+"FILENAME=\"/${SHELL_FILENAME}\"\n" \
+"FILESIZE=${SHELL_FILESIZE}\n" \
"echo \"### 001\"\n" \
"{\n" \
" while [ $FILESIZE -gt 0 ]; do\n" \
@@ -158,10 +146,9 @@
"}; echo \"### 200\"\n"
/* default 'appe' script */
-#define FISH_APPEND_DEF_CONTENT "" \
-"FILENAME=\"/${FISH_FILENAME}\"\n" \
-"FILESIZE=${FISH_FILESIZE}\n" \
-"#APPE $FILESIZE $FILENAME\n" \
+#define VFS_SHELL_APPEND_DEF_CONTENT "" \
+"FILENAME=\"/${SHELL_FILENAME}\"\n" \
+"FILESIZE=${SHELL_FILESIZE}\n" \
"echo \"### 001\"\n" \
"res=`exec 3>&1\n" \
"(\n" \
@@ -180,15 +167,15 @@
"}; echo \"### 200\"\n"
/* default 'info' script */
-#define FISH_INFO_DEF_CONTENT "" \
+#define VFS_SHELL_INFO_DEF_CONTENT "" \
"export LC_TIME=C\n" \
-"#FISH_HAVE_HEAD 1\n" \
-"#FISH_HAVE_SED 2\n" \
-"#FISH_HAVE_AWK 4\n" \
-"#FISH_HAVE_PERL 8\n" \
-"#FISH_HAVE_LSQ 16\n" \
-"#FISH_HAVE_DATE_MDYT 32\n" \
-"#FISH_HAVE_TAIL 64\n" \
+"#SHELL_HAVE_HEAD 1\n" \
+"#SHELL_HAVE_SED 2\n" \
+"#SHELL_HAVE_AWK 4\n" \
+"#SHELL_HAVE_PERL 8\n" \
+"#SHELL_HAVE_LSQ 16\n" \
+"#SHELL_HAVE_DATE_MDYT 32\n" \
+"#SHELL_HAVE_TAIL 64\n" \
"res=0\n" \
"if `echo yes| head -c 1 > /dev/null 2>&1` ; then\n" \
" res=`expr $res + 1`\n" \
@@ -233,4 +220,5 @@
/*** declarations of public functions ************************************************************/
/*** inline functions ****************************************************************************/
-#endif
+
+#endif /* MC__VFS_SHELL_DEF_H */
diff --git a/src/vfs/tar/Makefile.in b/src/vfs/tar/Makefile.in
index c89786e..79cd3e1 100644
--- a/src/vfs/tar/Makefile.in
+++ b/src/vfs/tar/Makefile.in
@@ -134,7 +134,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
diff --git a/src/vfs/tar/tar-internal.c b/src/vfs/tar/tar-internal.c
index f77b1b3..2c4a0ad 100644
--- a/src/vfs/tar/tar-internal.c
+++ b/src/vfs/tar/tar-internal.c
@@ -1,7 +1,7 @@
/*
Virtual File System: GNU Tar file system.
- Copyright (C) 2023
+ Copyright (C) 2023-2024
Free Software Foundation, Inc.
Written by:
@@ -32,7 +32,6 @@
#include <config.h>
-#include <ctype.h> /* isspace() */
#include <inttypes.h> /* uintmax_t */
#include <stdint.h> /* UINTMAX_MAX, etc */
@@ -184,6 +183,14 @@ tar_seek_archive (tar_super_t * archive, off_t size)
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
+gboolean
+is_octal_digit (char c)
+{
+ return '0' <= c && c <= '7';
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
void
tar_base64_init (void)
{
@@ -262,13 +269,13 @@ tar_from_header (const char *where0, size_t digs, char const *type, intmax_t min
if (where == lim)
return (-1);
- if (!isspace ((unsigned char) *where))
+ if (!g_ascii_isspace (*where))
break;
where++;
}
- if (isodigit (*where))
+ if (is_octal_digit (*where))
{
char const *where1 = where;
gboolean overflow = FALSE;
@@ -276,7 +283,7 @@ tar_from_header (const char *where0, size_t digs, char const *type, intmax_t min
while (TRUE)
{
value += *where++ - '0';
- if (where == lim || !isodigit (*where))
+ if (where == lim || !is_octal_digit (*where))
break;
overflow |= value != (value << LG_8 >> LG_8);
value <<= LG_8;
@@ -301,7 +308,7 @@ tar_from_header (const char *where0, size_t digs, char const *type, intmax_t min
{
value += 7 - digit;
where++;
- if (where == lim || !isodigit (*where))
+ if (where == lim || !is_octal_digit (*where))
break;
digit = *where - '0';
overflow |= value != (value << LG_8 >> LG_8);
@@ -373,7 +380,7 @@ tar_from_header (const char *where0, size_t digs, char const *type, intmax_t min
value = -value;
}
- if (where != lim && *where != '\0' && !isspace ((unsigned char) *where))
+ if (where != lim && *where != '\0' && !g_ascii_isspace (*where))
return (-1);
if (value <= (negative ? minus_minval : maxval))
diff --git a/src/vfs/tar/tar-internal.h b/src/vfs/tar/tar-internal.h
index 7b3bb53..e0ce577 100644
--- a/src/vfs/tar/tar-internal.h
+++ b/src/vfs/tar/tar-internal.h
@@ -65,8 +65,6 @@
#define OFF_FROM_HEADER(where) off_from_header (where, sizeof (where))
-#define isodigit(c) ( ((c) >= '0') && ((c) <= '7') )
-
/*** enums ***************************************************************************************/
/*** structures declarations (and typedefs of structures)*****************************************/
@@ -302,6 +300,7 @@ extern struct tar_stat_info current_stat_info;
/*** declarations of public functions ************************************************************/
/* tar-internal.c */
+gboolean is_octal_digit (char c);
void tar_base64_init (void);
void tar_assign_string (char **string, char *value);
void tar_assign_string_dup (char **string, const char *value);
diff --git a/src/vfs/tar/tar-sparse.c b/src/vfs/tar/tar-sparse.c
index 0bc169b..9795d15 100644
--- a/src/vfs/tar/tar-sparse.c
+++ b/src/vfs/tar/tar-sparse.c
@@ -1,7 +1,7 @@
/*
Virtual File System: GNU Tar file system.
- Copyright (C) 2003-2023
+ Copyright (C) 2003-2024
Free Software Foundation, Inc.
Written by:
@@ -547,8 +547,8 @@ oldgnu_get_sparse_info (tar_super_t * archive, struct tar_sparse_file *file)
{
size_t i;
union block *h = current_header;
- int ext_p;
- enum oldgnu_add_status rc;
+ gboolean ext_p;
+ enum oldgnu_add_status rc = add_fail;
if (file->stat_info->sparse_map != NULL)
g_array_set_size (file->stat_info->sparse_map, 0);
@@ -560,8 +560,8 @@ oldgnu_get_sparse_info (tar_super_t * archive, struct tar_sparse_file *file)
break;
}
- for (ext_p = h->oldgnu_header.isextended ? 1 : 0; rc == add_ok && ext_p != 0;
- ext_p = h->sparse_header.isextended ? 1 : 0)
+ for (ext_p = h->oldgnu_header.isextended != 0; rc == add_ok && ext_p;
+ ext_p = h->sparse_header.isextended != 0)
{
h = tar_find_next_block (archive);
if (h == NULL)
@@ -612,7 +612,7 @@ star_get_sparse_info (tar_super_t * archive, struct tar_sparse_file *file)
{
size_t i;
union block *h = current_header;
- int ext_p = 1;
+ gboolean ext_p = TRUE;
enum oldgnu_add_status rc = add_ok;
if (file->stat_info->sparse_map != NULL)
@@ -628,10 +628,10 @@ star_get_sparse_info (tar_super_t * archive, struct tar_sparse_file *file)
break;
}
- ext_p = h->star_in_header.isextended ? 1 : 0;
+ ext_p = h->star_in_header.isextended != 0;
}
- for (; rc == add_ok && ext_p != 0; ext_p = h->star_ext_header.isextended ? 1 : 0)
+ for (; rc == add_ok && ext_p; ext_p = h->star_ext_header.isextended != 0)
{
h = tar_find_next_block (archive);
if (h == NULL)
diff --git a/src/vfs/tar/tar-xheader.c b/src/vfs/tar/tar-xheader.c
index 5062ed1..c4c79de 100644
--- a/src/vfs/tar/tar-xheader.c
+++ b/src/vfs/tar/tar-xheader.c
@@ -1,7 +1,7 @@
/*
Virtual File System: GNU Tar file system.
- Copyright (C) 1995-2023
+ Copyright (C) 1995-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/vfs/tar/tar.c b/src/vfs/tar/tar.c
index 2d32111..4ce6494 100644
--- a/src/vfs/tar/tar.c
+++ b/src/vfs/tar/tar.c
@@ -1,7 +1,7 @@
/*
Virtual File System: GNU Tar file system.
- Copyright (C) 1995-2023
+ Copyright (C) 1995-2024
Free Software Foundation, Inc.
Written by:
@@ -87,6 +87,8 @@ struct tar_stat_info current_stat_info;
#define XGLTYPE 'g' /* Global extended header */
/* Values used in typeflag field. */
+#define REGTYPE '0' /* regular file */
+#define AREGTYPE '\0' /* regular file */
#define LNKTYPE '1' /* link */
#define SYMTYPE '2' /* symbolic link */
#define CHRTYPE '3' /* character special */
@@ -123,7 +125,6 @@ struct tar_stat_info current_stat_info;
#define MODE_FROM_HEADER(where,hbits) mode_from_header (where, sizeof (where), hbits)
#define TIME_FROM_HEADER(where) time_from_header (where, sizeof (where))
#define UID_FROM_HEADER(where) uid_from_header (where, sizeof (where))
-#define UINTMAX_FROM_HEADER(where) uintmax_from_header (where, sizeof (where))
/*** file scope type declarations ****************************************************************/
@@ -247,14 +248,6 @@ uid_from_header (const char *p, size_t s)
/* --------------------------------------------------------------------------------------------- */
-static inline uintmax_t
-uintmax_from_header (const char *p, size_t s)
-{
- return tar_from_header (p, s, "uintmax_t", 0, UINTMAX_MAX, FALSE);
-}
-
-/* --------------------------------------------------------------------------------------------- */
-
static void
tar_calc_sparse_offsets (struct vfs_s_inode *inode)
{
@@ -304,7 +297,7 @@ tar_skip_member (tar_super_t * archive, struct vfs_s_inode *inode)
}
else if (save_typeflag != DIRTYPE)
{
- if (inode != NULL)
+ if (inode != NULL && (save_typeflag == REGTYPE || save_typeflag == AREGTYPE))
inode->data_offset = BLOCKSIZE * tar_current_block_ordinal (archive);
return tar_skip_file (archive, current_stat_info.stat.st_size);
@@ -390,8 +383,10 @@ tar_decode_header (union block *header, tar_super_t * arch)
{
if (strcmp (header->header.magic, TMAGIC) == 0)
{
- if (header->star_header.prefix[130] == 0 && isodigit (header->star_header.atime[0])
- && header->star_header.atime[11] == ' ' && isodigit (header->star_header.ctime[0])
+ if (header->star_header.prefix[130] == 0
+ && is_octal_digit (header->star_header.atime[0])
+ && header->star_header.atime[11] == ' '
+ && is_octal_digit (header->star_header.ctime[0])
&& header->star_header.ctime[11] == ' ')
arch->type = TAR_STAR;
else if (current_stat_info.xhdr.buffer != NULL)
@@ -588,7 +583,6 @@ tar_insert_entry (struct vfs_class *me, struct vfs_s_super *archive, union block
(*inode)->st.st_mtime = current_stat_info.mtime.tv_sec;
(*inode)->st.st_atime = current_stat_info.atime.tv_sec;
(*inode)->st.st_ctime = current_stat_info.ctime.tv_sec;
- (*inode)->data_offset = BLOCKSIZE * tar_current_block_ordinal (TAR_SUPER (archive));
if (link_name != NULL && *link_name != '\0')
(*inode)->linkname = g_strdup (link_name);
diff --git a/src/vfs/undelfs/Makefile.in b/src/vfs/undelfs/Makefile.in
index 4f258d7..9734ce2 100644
--- a/src/vfs/undelfs/Makefile.in
+++ b/src/vfs/undelfs/Makefile.in
@@ -134,7 +134,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
diff --git a/src/vfs/undelfs/undelfs.c b/src/vfs/undelfs/undelfs.c
index de54440..e480040 100644
--- a/src/vfs/undelfs/undelfs.c
+++ b/src/vfs/undelfs/undelfs.c
@@ -7,7 +7,7 @@
Parts of this program were taken from the lsdel.c and dump.c files
written by Ted Ts'o (tytso@mit.edu) for the ext2fs package.
- Copyright (C) 1995-2023
+ Copyright (C) 1995-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/viewer/Makefile.in b/src/viewer/Makefile.in
index 26ff9c6..dc77f67 100644
--- a/src/viewer/Makefile.in
+++ b/src/viewer/Makefile.in
@@ -134,7 +134,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.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-shell.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 \
diff --git a/src/viewer/actions_cmd.c b/src/viewer/actions_cmd.c
index 465f0f0..453eb78 100644
--- a/src/viewer/actions_cmd.c
+++ b/src/viewer/actions_cmd.c
@@ -2,7 +2,7 @@
Internal file viewer for the Midnight Commander
Callback function for some actions (hotkeys, menu)
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
@@ -57,13 +57,13 @@
#include "lib/charsets.h"
#endif
#include "lib/event.h" /* mc_event_raise() */
-#include "lib/mcconfig.h" /* mc_config_history_get() */
+#include "lib/mcconfig.h" /* mc_config_history_get_recent_item() */
#include "src/filemanager/layout.h"
#include "src/filemanager/filemanager.h" /* current_panel */
#include "src/filemanager/ext.h" /* regex_command_for() */
-#include "src/history.h"
+#include "src/history.h" /* MC_HISTORY_SHARED_SEARCH */
#include "src/file_history.h" /* show_file_history() */
#include "src/execute.h"
#include "src/keymap.h"
@@ -139,16 +139,12 @@ mcview_continue_search_cmd (WView * view)
else
{
/* find last search string in history */
- GList *history;
+ char *s;
- history = mc_config_history_get (MC_HISTORY_SHARED_SEARCH);
- if (history != NULL)
+ s = mc_config_history_get_recent_item (MC_HISTORY_SHARED_SEARCH);
+ if (s != NULL)
{
- /* FIXME: is it possible that history->data == NULL? */
- view->last_search_string = (gchar *) history->data;
- history->data = NULL;
- history = g_list_first (history);
- g_list_free_full (history, g_free);
+ view->last_search_string = s;
if (mcview_search_init (view))
{
@@ -405,12 +401,6 @@ mcview_execute_cmd (WView * view, long command)
switch (command)
{
- case CK_Help:
- {
- ev_help_t event_data = { NULL, "[Internal File Viewer]" };
- mc_event_raise (MCEVENT_GROUP_CORE, "help", &event_data);
- }
- break;
case CK_HexMode:
/* Toggle between hex view and text view */
mcview_toggle_hex_mode (view);
diff --git a/src/viewer/ascii.c b/src/viewer/ascii.c
index f786dcc..c406feb 100644
--- a/src/viewer/ascii.c
+++ b/src/viewer/ascii.c
@@ -2,7 +2,7 @@
Internal file viewer for the Midnight Commander
Function for plain view
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/viewer/coord_cache.c b/src/viewer/coord_cache.c
index 190dbd5..2ea23c2 100644
--- a/src/viewer/coord_cache.c
+++ b/src/viewer/coord_cache.c
@@ -2,7 +2,7 @@
Internal file viewer for the Midnight Commander
Function for work with coordinate cache (ccache)
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/viewer/datasource.c b/src/viewer/datasource.c
index ea4199c..94c8099 100644
--- a/src/viewer/datasource.c
+++ b/src/viewer/datasource.c
@@ -2,7 +2,7 @@
Internal file viewer for the Midnight Commander
Functions for datasources
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/viewer/dialogs.c b/src/viewer/dialogs.c
index f15c2ff..4a2fe39 100644
--- a/src/viewer/dialogs.c
+++ b/src/viewer/dialogs.c
@@ -2,7 +2,7 @@
Internal file viewer for the Midnight Commander
Function for paint dialogs
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/viewer/display.c b/src/viewer/display.c
index e76c4dd..08fdb64 100644
--- a/src/viewer/display.c
+++ b/src/viewer/display.c
@@ -2,7 +2,7 @@
Internal file viewer for the Midnight Commander
Function for whow info on display
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/viewer/growbuf.c b/src/viewer/growbuf.c
index e18a527..f1fbb9b 100644
--- a/src/viewer/growbuf.c
+++ b/src/viewer/growbuf.c
@@ -2,7 +2,7 @@
Internal file viewer for the Midnight Commander
Function for work with growing buffers
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/viewer/hex.c b/src/viewer/hex.c
index c0cf7d0..de037cd 100644
--- a/src/viewer/hex.c
+++ b/src/viewer/hex.c
@@ -2,7 +2,7 @@
Internal file viewer for the Midnight Commander
Function for hex view
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/viewer/lib.c b/src/viewer/lib.c
index 5f2eb52..b427987 100644
--- a/src/viewer/lib.c
+++ b/src/viewer/lib.c
@@ -2,7 +2,7 @@
Internal file viewer for the Midnight Commander
Common finctions (used from some other mcviewer functions)
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/viewer/mcviewer.c b/src/viewer/mcviewer.c
index 36d31c0..1ec75c3 100644
--- a/src/viewer/mcviewer.c
+++ b/src/viewer/mcviewer.c
@@ -2,7 +2,7 @@
Internal file viewer for the Midnight Commander
Interface functions
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc
Written by:
diff --git a/src/viewer/move.c b/src/viewer/move.c
index 4f15b7c..0bdf38f 100644
--- a/src/viewer/move.c
+++ b/src/viewer/move.c
@@ -2,7 +2,7 @@
Internal file viewer for the Midnight Commander
Functions for handle cursor movement
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/viewer/nroff.c b/src/viewer/nroff.c
index 14dacd5..a7c7fe2 100644
--- a/src/viewer/nroff.c
+++ b/src/viewer/nroff.c
@@ -2,7 +2,7 @@
Internal file viewer for the Midnight Commander
Functions for searching in nroff-like view
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by:
diff --git a/src/viewer/search.c b/src/viewer/search.c
index f470a36..9fce398 100644
--- a/src/viewer/search.c
+++ b/src/viewer/search.c
@@ -2,7 +2,7 @@
Internal file viewer for the Midnight Commander
Function for search data
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Written by: