Merge branch '3997_cleanup'

* 3997_cleanup:
  Do not include <sys/select> globally via "lib/global.h".
  (mc_symlink): test vpath2 before use.
  lib/vfs/interface.c: fix coding style.
  (display_bits_box): use tty_display_8bit().
  (panel_options_box): don't apply integer value to boolean variable.
  (edit_files): fix shadow of variable declaration.
  mcviewer: clarify of HAVE_CHARSET usage.
  Replace [] in AS_HELP_STRING.
  (setup_panels): fix origin and size of panels.
  (vfs_stamp_compare): fix NULL dereference.
  (ftpfs_dir_load): minor refactoring.
  Make VFS faster a bit.
  (vfs_s_normalize_filename_leading_spaces): minor refactoring.
  (history_show): fix order of history items.
  urar extfs: don't start path with ./ in file list.
  Ticket #3997: code clean up before 4.8.24 release.
This commit is contained in:
Andrew Borodin 2019-09-29 15:19:10 +03:00
commit 994c6a3c18
24 changed files with 167 additions and 149 deletions

View File

@ -58,10 +58,6 @@
#endif /* !O_NDELAY */
#endif /* !O_NONBLOCK */
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#if defined(__QNX__) && !defined(__QNXNTO__)
/* exec*() from <process.h> */
#include <unix.h>

View File

@ -40,9 +40,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#else
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#endif
#include "lib/global.h"

View File

@ -32,8 +32,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#else
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#endif
#include "lib/global.h"
#include "lib/util.h" /* is_printable() */

View File

@ -58,10 +58,14 @@
#include <config.h>
#include <errno.h>
#include <time.h>
#include <sys/time.h> /* gettimeofday() */
#include <inttypes.h> /* uintmax_t */
#include <stdarg.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#include <sys/time.h> /* gettimeofday() */
#include <sys/types.h>
#include <unistd.h>
#include "lib/global.h"
@ -196,7 +200,7 @@ vfs_s_find_entry_tree (struct vfs_class *me, struct vfs_s_inode *root,
for (pseg = 0; path[pseg] != '\0' && !IS_PATH_SEP (path[pseg]); pseg++)
;
for (iter = root->subdir; iter != NULL; iter = g_list_next (iter))
for (iter = g_queue_peek_head_link (root->subdir); iter != NULL; iter = g_list_next (iter))
{
ent = VFS_ENTRY (iter->data);
if (strlen (ent->name) == pseg && strncmp (ent->name, path, pseg) == 0)
@ -259,7 +263,7 @@ vfs_s_find_entry_linear (struct vfs_class *me, struct vfs_s_inode *root,
return ent;
}
iter = g_list_find_custom (root->subdir, path, (GCompareFunc) vfs_s_entry_compare);
iter = g_queue_find_custom (root->subdir, path, (GCompareFunc) vfs_s_entry_compare);
ent = iter != NULL ? VFS_ENTRY (iter->data) : NULL;
if (ent != NULL && !VFS_SUBCLASS (me)->dir_uptodate (me, ent->ino))
@ -286,7 +290,7 @@ vfs_s_find_entry_linear (struct vfs_class *me, struct vfs_s_inode *root,
vfs_s_insert_entry (me, root, ent);
iter = g_list_find_custom (root->subdir, path, (GCompareFunc) vfs_s_entry_compare);
iter = g_queue_find_custom (root->subdir, path, (GCompareFunc) vfs_s_entry_compare);
ent = iter != NULL ? VFS_ENTRY (iter->data) : NULL;
}
if (ent == NULL)
@ -441,7 +445,7 @@ vfs_s_opendir (const vfs_path_t * vpath)
}
#endif
info = g_new (struct dirhandle, 1);
info->cur = dir->subdir;
info->cur = g_queue_peek_head_link (dir->subdir);
info->dir = dir;
return info;
@ -888,6 +892,7 @@ vfs_s_new_inode (struct vfs_class *me, struct vfs_s_super *super, struct stat *i
if (initstat != NULL)
ino->st = *initstat;
ino->super = super;
ino->subdir = g_queue_new ();
ino->st.st_nlink = 0;
ino->st.st_ino = VFS_SUBCLASS (me)->inode_counter++;
ino->st.st_dev = VFS_SUBCLASS (me)->rdev;
@ -914,8 +919,16 @@ vfs_s_free_inode (struct vfs_class *me, struct vfs_s_inode *ino)
return;
}
while (ino->subdir != NULL)
vfs_s_free_entry (me, VFS_ENTRY (ino->subdir->data));
while (g_queue_get_length (ino->subdir) != 0)
{
struct vfs_s_entry *entry;
entry = VFS_ENTRY (g_queue_peek_head (ino->subdir));
vfs_s_free_entry (me, entry);
}
g_queue_free (ino->subdir);
ino->subdir = NULL;
CALL (free_inode) (me, ino);
g_free (ino->linkname);
@ -951,7 +964,7 @@ void
vfs_s_free_entry (struct vfs_class *me, struct vfs_s_entry *ent)
{
if (ent->dir != NULL)
ent->dir->subdir = g_list_remove (ent->dir->subdir, ent);
g_queue_remove (ent->dir->subdir, ent);
MC_PTR_FREE (ent->name);
@ -974,7 +987,7 @@ vfs_s_insert_entry (struct vfs_class *me, struct vfs_s_inode *dir, struct vfs_s_
ent->dir = dir;
ent->ino->st.st_nlink++;
dir->subdir = g_list_append (dir->subdir, ent);
g_queue_push_tail (dir->subdir, ent);
}
/* --------------------------------------------------------------------------------------------- */
@ -1708,20 +1721,22 @@ vfs_s_normalize_filename_leading_spaces (struct vfs_s_inode *root_inode, size_t
{
GList *iter;
for (iter = root_inode->subdir; iter != NULL; iter = g_list_next (iter))
for (iter = g_queue_peek_head_link (root_inode->subdir); iter != NULL;
iter = g_list_next (iter))
{
struct vfs_s_entry *entry = VFS_ENTRY (iter->data);
if ((size_t) entry->ino->data_offset > final_num_spaces)
{
char *source_name = entry->name;
char *spacer;
char *source_name, *spacer;
source_name = entry->name;
spacer = g_strnfill (entry->ino->data_offset - final_num_spaces, ' ');
entry->name = g_strdup_printf ("%s%s", spacer, source_name);
entry->name = g_strconcat (spacer, source_name, (char *) NULL);
g_free (spacer);
g_free (source_name);
}
entry->ino->data_offset = -1;
}
}

View File

@ -127,7 +127,7 @@ vfs_stamp_compare (gconstpointer a, gconstpointer b)
const struct vfs_stamping *vsa = (const struct vfs_stamping *) a;
const struct vfs_stamping *vsb = (const struct vfs_stamping *) b;
return (vsa->v == vsb->v && vsa->id == vsb->id) ? 0 : 1;
return (vsa == NULL || vsb == NULL || (vsa->v == vsb->v && vsa->id == vsb->id)) ? 0 : 1;
}
/* --------------------------------------------------------------------------------------------- */
@ -163,7 +163,7 @@ vfs_stamp (struct vfs_class *v, vfsid id)
gboolean ret = FALSE;
stamp = g_slist_find_custom (stamps, &what, vfs_stamp_compare);
if (stamp != NULL)
if (stamp != NULL && stamp->data != NULL)
{
gettimeofday (&(VFS_STAMPING (stamp->data)->time), NULL);
ret = TRUE;

View File

@ -178,7 +178,7 @@ mc_def_ungetlocalcopy (const vfs_path_t * filename_vpath,
if (fdin != -1)
close (fdin);
unlink (local);
return -1;
return (-1);
}
/* --------------------------------------------------------------------------------------------- */
@ -193,12 +193,13 @@ mc_open (const vfs_path_t * vpath, int flags, ...)
const vfs_path_element_t *path_element;
if (vpath == NULL)
return -1;
return (-1);
/* Get the mode flag */
if (flags & O_CREAT)
if ((flags & O_CREAT) != 0)
{
va_list ap;
va_start (ap, flags);
/* We have to use PROMOTED_MODE_T instead of mode_t. Doing 'va_arg (ap, mode_t)'
* fails on systems where 'mode_t' is smaller than 'int' because of C's "default
@ -211,6 +212,7 @@ mc_open (const vfs_path_t * vpath, int flags, ...)
if (vfs_path_element_valid (path_element) && path_element->class->open != NULL)
{
void *info;
/* open must be supported */
info = path_element->class->open (vpath, flags, mode);
if (info == NULL)
@ -235,13 +237,11 @@ int mc_##name inarg \
const vfs_path_element_t *path_element; \
\
if (vpath == NULL) \
return -1; \
return (-1); \
\
path_element = vfs_path_get_by_index (vpath, -1); \
if (!vfs_path_element_valid (path_element)) \
{ \
return -1; \
} \
return (-1); \
\
result = path_element->class->name != NULL ? path_element->class->name callarg : -1; \
if (result == -1) \
@ -267,10 +267,7 @@ mc_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
{
int result = -1;
if (vpath1 == NULL)
return -1;
if (vpath1 != NULL)
if (vpath1 != NULL && vpath2 != NULL)
{
const vfs_path_element_t *path_element;
@ -300,11 +297,14 @@ ssize_t mc_##name (int handle, C void *buf, size_t count) \
struct vfs_class *vfs; \
void *fsinfo = NULL; \
int result; \
\
if (handle == -1) \
return -1; \
return (-1); \
\
vfs = vfs_class_find_by_handle (handle, &fsinfo); \
if (vfs == NULL) \
return -1; \
return (-1); \
\
result = vfs->name != NULL ? vfs->name (fsinfo, buf, count) : -1; \
if (result == -1) \
errno = vfs->name != NULL ? vfs_ferrno (vfs) : E_NOTSUPP; \
@ -328,7 +328,7 @@ int mc_##name (const vfs_path_t *vpath1, const vfs_path_t *vpath2) \
const vfs_path_element_t *path_element2; \
\
if (vpath1 == NULL || vpath2 == NULL) \
return -1; \
return (-1); \
\
path_element1 = vfs_path_get_by_index (vpath1, (-1)); \
path_element2 = vfs_path_get_by_index (vpath2, (-1)); \
@ -337,12 +337,11 @@ int mc_##name (const vfs_path_t *vpath1, const vfs_path_t *vpath2) \
path_element1->class != path_element2->class) \
{ \
errno = EXDEV; \
return -1; \
}\
return (-1); \
} \
\
result = path_element1->class->name != NULL \
? path_element1->class->name (vpath1, vpath2) \
: -1; \
? path_element1->class->name (vpath1, vpath2) : -1; \
if (result == -1) \
errno = path_element1->class->name != NULL ? vfs_ferrno (path_element1->class) : E_NOTSUPP; \
return result; \
@ -396,18 +395,18 @@ mc_close (int handle)
int result;
if (handle == -1)
return -1;
return (-1);
vfs = vfs_class_find_by_handle (handle, &fsinfo);
if (vfs == NULL || fsinfo == NULL)
return -1;
return (-1);
if (handle < 3)
return close (handle);
if (!vfs->close)
if (vfs->close == NULL)
vfs_die ("VFS must support close.\n");
result = (*vfs->close) (fsinfo);
result = vfs->close (fsinfo);
vfs_free_handle (handle);
if (result == -1)
errno = vfs_ferrno (vfs);
@ -428,15 +427,13 @@ mc_opendir (const vfs_path_t * vpath)
return NULL;
path_element = (vfs_path_element_t *) vfs_path_get_by_index (vpath, -1);
if (!vfs_path_element_valid (path_element))
{
errno = E_NOTSUPP;
return NULL;
}
info = path_element->class->opendir ? (*path_element->class->opendir) (vpath) : NULL;
info = path_element->class->opendir ? path_element->class->opendir (vpath) : NULL;
if (info == NULL)
{
errno = path_element->class->opendir ? vfs_ferrno (path_element->class) : E_NOTSUPP;
@ -470,7 +467,7 @@ mc_readdir (DIR * dirp)
struct dirent *entry = NULL;
vfs_path_element_t *vfs_path_element;
if (!mc_readdir_result)
if (mc_readdir_result == NULL)
{
/* We can't just allocate struct dirent as (see man dirent.h)
* struct dirent has VERY nonnaive semantics of allocating
@ -485,11 +482,12 @@ mc_readdir (DIR * dirp)
mc_readdir_result = (struct dirent *) g_malloc (sizeof (struct dirent) + MAXNAMLEN + 1);
}
if (!dirp)
if (dirp == NULL)
{
errno = EFAULT;
return NULL;
}
handle = *(int *) dirp;
vfs = vfs_class_find_by_handle (handle, &fsinfo);
@ -497,9 +495,9 @@ mc_readdir (DIR * dirp)
return NULL;
vfs_path_element = (vfs_path_element_t *) fsinfo;
if (vfs->readdir)
if (vfs->readdir != NULL)
{
entry = (*vfs->readdir) (vfs_path_element->dir.info);
entry = vfs->readdir (vfs_path_element->dir.info);
if (entry == NULL)
return NULL;
@ -562,13 +560,12 @@ mc_stat (const vfs_path_t * vpath, struct stat *buf)
const vfs_path_element_t *path_element;
if (vpath == NULL)
return -1;
return (-1);
path_element = vfs_path_get_by_index (vpath, -1);
if (vfs_path_element_valid (path_element))
{
result = path_element->class->stat ? (*path_element->class->stat) (vpath, buf) : -1;
result = path_element->class->stat ? path_element->class->stat (vpath, buf) : -1;
if (result == -1)
errno = path_element->class->name ? vfs_ferrno (path_element->class) : E_NOTSUPP;
}
@ -585,13 +582,12 @@ mc_lstat (const vfs_path_t * vpath, struct stat *buf)
const vfs_path_element_t *path_element;
if (vpath == NULL)
return -1;
return (-1);
path_element = vfs_path_get_by_index (vpath, -1);
if (vfs_path_element_valid (path_element))
{
result = path_element->class->lstat ? (*path_element->class->lstat) (vpath, buf) : -1;
result = path_element->class->lstat ? path_element->class->lstat (vpath, buf) : -1;
if (result == -1)
errno = path_element->class->name ? vfs_ferrno (path_element->class) : E_NOTSUPP;
}
@ -609,13 +605,13 @@ mc_fstat (int handle, struct stat *buf)
int result;
if (handle == -1)
return -1;
return (-1);
vfs = vfs_class_find_by_handle (handle, &fsinfo);
if (vfs == NULL)
return -1;
return (-1);
result = vfs->fstat ? (*vfs->fstat) (fsinfo, buf) : -1;
result = vfs->fstat ? vfs->fstat (fsinfo, buf) : -1;
if (result == -1)
errno = vfs->fstat ? vfs_ferrno (vfs) : E_NOTSUPP;
return result;
@ -633,7 +629,6 @@ mc_getlocalcopy (const vfs_path_t * pathname_vpath)
return NULL;
path_element = vfs_path_get_by_index (pathname_vpath, -1);
if (vfs_path_element_valid (path_element))
{
result = path_element->class->getlocalcopy != NULL ?
@ -651,20 +646,19 @@ int
mc_ungetlocalcopy (const vfs_path_t * pathname_vpath, const vfs_path_t * local_vpath,
gboolean has_changed)
{
int return_value = -1;
int result = -1;
const vfs_path_element_t *path_element;
if (pathname_vpath == NULL)
return -1;
return (-1);
path_element = vfs_path_get_by_index (pathname_vpath, -1);
if (vfs_path_element_valid (path_element))
return_value = path_element->class->ungetlocalcopy != NULL ?
result = path_element->class->ungetlocalcopy != NULL ?
path_element->class->ungetlocalcopy (pathname_vpath, local_vpath, has_changed) :
mc_def_ungetlocalcopy (pathname_vpath, local_vpath, has_changed);
return return_value;
return result;
}
/* --------------------------------------------------------------------------------------------- */
@ -686,7 +680,7 @@ mc_chdir (const vfs_path_t * vpath)
vfs_path_t *cd_vpath;
if (vpath == NULL)
return -1;
return (-1);
if (vpath->relative)
cd_vpath = vfs_path_to_absolute (vpath);
@ -694,14 +688,11 @@ mc_chdir (const vfs_path_t * vpath)
cd_vpath = vfs_path_clone (vpath);
path_element = vfs_path_get_by_index (cd_vpath, -1);
if (!vfs_path_element_valid (path_element) || path_element->class->chdir == NULL)
{
goto error_end;
}
result = (*path_element->class->chdir) (cd_vpath);
result = path_element->class->chdir (cd_vpath);
if (result == -1)
{
errno = vfs_ferrno (path_element->class);
@ -750,7 +741,7 @@ mc_chdir (const vfs_path_t * vpath)
error_end:
vfs_path_free (cd_vpath);
return -1;
return (-1);
}
/* --------------------------------------------------------------------------------------------- */
@ -763,13 +754,13 @@ mc_lseek (int fd, off_t offset, int whence)
off_t result;
if (fd == -1)
return -1;
return (-1);
vfs = vfs_class_find_by_handle (fd, &fsinfo);
if (vfs == NULL)
return -1;
return (-1);
result = vfs->lseek ? (*vfs->lseek) (fsinfo, offset, whence) : -1;
result = vfs->lseek ? vfs->lseek (fsinfo, offset, whence) : -1;
if (result == -1)
errno = vfs->lseek ? vfs_ferrno (vfs) : E_NOTSUPP;
return result;
@ -840,7 +831,7 @@ mc_tmpdir (void)
const char *error = NULL;
/* Check if already correctly initialized */
if (tmpdir && lstat (tmpdir, &st) == 0 && S_ISDIR (st.st_mode) &&
if (tmpdir != NULL && lstat (tmpdir, &st) == 0 && S_ISDIR (st.st_mode) &&
st.st_uid == getuid () && (st.st_mode & 0777) == 0700)
return tmpdir;
@ -849,8 +840,7 @@ mc_tmpdir (void)
sys_tmp = TMPDIR_DEFAULT;
pwd = getpwuid (getuid ());
if (pwd)
if (pwd != NULL)
g_snprintf (buffer, sizeof (buffer), "%s/mc-%s", sys_tmp, pwd->pw_name);
else
g_snprintf (buffer, sizeof (buffer), "%s/mc-%lu", sys_tmp, (unsigned long) getuid ());
@ -886,7 +876,7 @@ mc_tmpdir (void)
gboolean fallback_ok = FALSE;
vfs_path_t *test_vpath;
if (*error)
if (*error != '\0')
fprintf (stderr, error, buffer);
/* Test if sys_tmp is suitable for temporary files */
@ -924,7 +914,7 @@ mc_tmpdir (void)
tmpdir = buffer;
if (!error)
if (error == NULL)
g_setenv ("MC_TMPDIR", tmpdir, TRUE);
return tmpdir;

View File

@ -87,7 +87,7 @@ struct vfs_s_inode
struct vfs_s_entry *ent; /* Our entry in the parent directory -
use only for directories because they
cannot be hardlinked */
GList *subdir; /* If this is a directory, its entry. List of vfs_s_entry */
GQueue *subdir; /* If this is a directory, its entry. List of vfs_s_entry */
struct stat st; /* Parameters of this inode */
char *linkname; /* Symlink's contents */
char *localname; /* Filename of local file, if we have one */

View File

@ -241,7 +241,7 @@ history_show (history_descriptor_t * hd)
if (WIDGET (query_dlg)->y < hd->y)
{
/* history is below base widget -- place recent item on top */
/* history is above base widget -- revert order to place recent item at bottom */
/* revert history direction */
g_queue_reverse (hd->listbox->list);
if (hd->current < 0 || (size_t) hd->current >= count)
@ -251,7 +251,7 @@ history_show (history_descriptor_t * hd)
}
else
{
/* history is above base widget -- place recent item at bottom */
/* history is below base widget -- keep order to place recent item on top */
if (hd->current > 0)
listbox_select_entry (hd->listbox, hd->current);
}
@ -284,7 +284,7 @@ history_show (history_descriptor_t * hd)
z = g_list_prepend (z, hd->release (hd, LENTRY (hi->data)));
/* restore history direction */
if (WIDGET (query_dlg)->y >= hd->y)
if (WIDGET (query_dlg)->y < hd->y)
z = g_list_reverse (z);
dlg_destroy (query_dlg);

View File

@ -5,7 +5,7 @@ dnl
AC_DEFUN([mc_ASSERT],
[
AC_ARG_ENABLE([assert],
AS_HELP_STRING([--enable-assert], [turn on assertions [yes]]),
AS_HELP_STRING([--enable-assert], [turn on assertions @<:@yes@:>@]),
[
if test "x$enableval" = xno; then
enable_assert=no

View File

@ -5,7 +5,7 @@ dnl
AC_DEFUN([mc_BACKGROUND],
[
AC_ARG_ENABLE([background],
AS_HELP_STRING([--enable-background], [Support for background file operations [yes]]),
AS_HELP_STRING([--enable-background], [Support for background file operations @<:@yes@:>@]),
[
if test "x$enableval" = xno; then
enable_background=no

View File

@ -1188,7 +1188,7 @@ edit_files (const GList * files)
static gboolean made_directory = FALSE;
WDialog *edit_dlg;
WMenuBar *menubar;
Widget *w;
Widget *w, *wd;
const GList *file;
gboolean ok = FALSE;
@ -1213,7 +1213,8 @@ edit_files (const GList * files)
edit_dlg =
dlg_create (FALSE, 0, 0, 1, 1, WPOS_FULLSCREEN, FALSE, NULL, edit_dialog_callback,
edit_dialog_mouse_callback, "[Internal File Editor]", NULL);
widget_want_tab (WIDGET (edit_dlg), TRUE);
wd = WIDGET (edit_dlg);
widget_want_tab (wd, TRUE);
edit_dlg->get_shortcut = edit_get_shortcut;
edit_dlg->get_title = edit_get_title;
@ -1228,11 +1229,10 @@ edit_files (const GList * files)
for (file = files; file != NULL; file = g_list_next (file))
{
Widget *w = WIDGET (edit_dlg);
mcedit_arg_t *f = (mcedit_arg_t *) file->data;
gboolean f_ok;
f_ok = edit_add_window (edit_dlg, w->y + 1, w->x, w->lines - 2, w->cols, f->file_vpath,
f_ok = edit_add_window (edit_dlg, wd->y + 1, wd->x, wd->lines - 2, wd->cols, f->file_vpath,
f->line_number);
/* at least one file has been opened succefully */
ok = ok || f_ok;
@ -1241,7 +1241,7 @@ edit_files (const GList * files)
if (ok)
dlg_run (edit_dlg);
if (!ok || widget_get_state (WIDGET (edit_dlg), WST_CLOSED))
if (!ok || widget_get_state (wd, WST_CLOSED))
dlg_destroy (edit_dlg);
return ok;

View File

@ -632,7 +632,7 @@ panel_options_box (void)
gboolean simple_swap;
simple_swap = mc_config_get_bool (mc_global.main_config, CONFIG_PANELS_SECTION,
"simple_swap", FALSE) ? 1 : 0;
"simple_swap", FALSE);
{
const char *qsearch_options[] = {
N_("Case &insensitive"),
@ -943,9 +943,9 @@ display_bits_box (void)
mc_global.eight_bit_clean = current_mode < 3;
mc_global.full_eight_bits = current_mode < 2;
#ifndef HAVE_SLANG
meta (stdscr, mc_global.eight_bit_clean);
tty_display_8bit (mc_global.eight_bit_clean);
#else
SLsmg_Display_Eight_Bit = mc_global.full_eight_bits ? 128 : 160;
tty_display_8bit (mc_global.full_eight_bits);
#endif
use_8th_bit_as_meta = !new_meta;
}

View File

@ -779,16 +779,14 @@ setup_panels (void)
/* ...then rows and origin */
if (panels_layout.horizontal_split)
{
widget_set_size (panels[0].widget, start_y, panels[0].widget->x,
panels_layout.top_panel_size, panels[0].widget->cols);
widget_set_size (panels[1].widget, start_y + panels_layout.top_panel_size,
panels[1].widget->x, height - panels_layout.top_panel_size,
panels[1].widget->cols);
widget_set_size (panels[0].widget, start_y, mw->x, panels_layout.top_panel_size,
panels[0].widget->cols);
widget_set_size (panels[1].widget, start_y + panels_layout.top_panel_size, mw->x,
height - panels_layout.top_panel_size, panels[1].widget->cols);
}
else
{
widget_set_size (panels[0].widget, start_y, panels[0].widget->x, height,
panels[0].widget->cols);
widget_set_size (panels[0].widget, start_y, mw->x, height, panels[0].widget->cols);
widget_set_size (panels[1].widget, start_y, panels[1].widget->x, height,
panels[1].widget->cols);
}

View File

@ -63,6 +63,12 @@
#include <errno.h>
#include <string.h>
#include <signal.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#else
#include <sys/time.h>
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/wait.h>
#ifdef HAVE_SYS_IOCTL_H

View File

@ -71,7 +71,6 @@ subshell_handle_cons_saver (void)
pid_t pid;
pid = waitpid (cons_saver_pid, &status, WUNTRACED | WNOHANG);
waitpid (cons_saver_pid, &status, WUNTRACED | WNOHANG);
if (pid == cons_saver_pid)
{

View File

@ -271,7 +271,7 @@ extfs_find_entry_int (struct vfs_s_inode *dir, const char *name, GSList * list,
}
pdir = pent;
pl = g_list_find_custom (pent->ino->subdir, p, vfs_s_entry_compare);
pl = g_queue_find_custom (pent->ino->subdir, p, vfs_s_entry_compare);
pent = pl != NULL ? VFS_ENTRY (pl->data) : NULL;
if (pent != NULL && q + 1 > name_end)
{
@ -512,13 +512,13 @@ extfs_read_archive (FILE * extfsd, struct extfs_super_t *current_archive)
{
entry = extfs_entry_new (super->me, p, pent->ino);
entry->dir = pent->ino;
pent->ino->subdir = g_list_append (pent->ino->subdir, entry);
g_queue_push_tail (pent->ino->subdir, entry);
}
else
{
entry = extfs_entry_new (super->me, p, super->root);
entry->dir = super->root;
super->root->subdir = g_list_append (super->root->subdir, entry);
g_queue_push_tail (super->root->subdir, entry);
}
if (!S_ISLNK (hstat.st_mode) && (current_link_name != NULL))
@ -1014,7 +1014,7 @@ extfs_opendir (const vfs_path_t * vpath)
ERRNOR (ENOTDIR, NULL);
info = g_new (GList *, 1);
*info = entry->ino->subdir;
*info = g_queue_peek_head_link (entry->ino->subdir);
return info;
}

View File

@ -47,7 +47,7 @@ flag==1 {
else
if (index($6, ".") != 0)
$6="-rw-r--r--"
printf "%s 1 %s %s %d %02d/%02d/%02d %s ./%s\n", $6, uid, gid, $1, a[2], a[1], a[3], $5, str
printf "%s 1 %s %s %d %02d/%02d/%02d %s %s\n", $6, uid, gid, $1, a[2], a[1], a[3], $5, str
}'
}
@ -105,7 +105,7 @@ mcrar5fs_list ()
}
### and finally
printf ("%s 1 %s %s %d %02d/%02d/%02d %s ./%s\n",
printf ("%s 1 %s %s %d %02d/%02d/%02d %s %s\n",
attrs, uid, gid, size, date[2], date[3], date[1], time, name);
}
'

View File

@ -1765,12 +1765,25 @@ ftpfs_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path
}
if (sock == -1)
goto fallback;
{
fallback:
if (ftp_super->strict == RFC_AUTODETECT)
{
/* It's our first attempt to get a directory listing from this
server (UNIX style LIST command) */
ftp_super->strict = RFC_STRICT;
/* I hate goto, but recursive call needs another 8K on stack */
/* return ftpfs_dir_load (me, dir, remote_path); */
cd_first = TRUE;
goto again;
}
/* Clear the interrupt flag */
tty_enable_interrupt_key ();
vfs_print_message ("%s", _("ftpfs: failed; nowhere to fallback to"));
ERRNOR (EACCES, -1);
}
vfs_parse_ls_lga_init ();
while (TRUE)
{
int i;
@ -1787,7 +1800,6 @@ ftpfs_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path
me->verrno = ECONNRESET;
close (sock);
ftp_super->ctl_connection_busy = FALSE;
tty_disable_interrupt_key ();
ftpfs_get_reply (me, ftp_super->sock, NULL, 0);
vfs_print_message (_("%s: failure"), me->name);
return (-1);
@ -1844,21 +1856,6 @@ ftpfs_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path
vfs_print_message (_("%s: done."), me->name);
return 0;
fallback:
if (ftp_super->strict == RFC_AUTODETECT)
{
/* It's our first attempt to get a directory listing from this
server (UNIX style LIST command) */
ftp_super->strict = RFC_STRICT;
/* I hate goto, but recursive call needs another 8K on stack */
/* return ftpfs_dir_load (me, dir, remote_path); */
cd_first = TRUE;
goto again;
}
vfs_print_message ("%s", _("ftpfs: failed; nowhere to fallback to"));
ERRNOR (EACCES, -1);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -27,6 +27,14 @@
#include <config.h>
#include <errno.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#else
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#endif
#include "lib/global.h"
#include "lib/util.h"

View File

@ -301,8 +301,10 @@ void mcview_toggle_nroff_mode (WView * view);
void mcview_toggle_hex_mode (WView * view);
void mcview_init (WView * view);
void mcview_done (WView * view);
#ifdef HAVE_CHARSET
void mcview_select_encoding (WView * view);
void mcview_set_codeset (WView * view);
#endif
void mcview_show_error (WView * view, const char *error);
off_t mcview_bol (WView * view, off_t current, off_t limit);
off_t mcview_eol (WView * view, off_t current);

View File

@ -257,10 +257,10 @@ mcview_done (WView * view)
/* --------------------------------------------------------------------------------------------- */
#ifdef HAVE_CHARSET
void
mcview_set_codeset (WView * view)
{
#ifdef HAVE_CHARSET
const char *cp_id = NULL;
view->utf8 = TRUE;
@ -280,21 +280,17 @@ mcview_set_codeset (WView * view)
view->utf8 = (gboolean) str_isutf8 (cp_id);
view->dpy_wrap_dirty = TRUE;
}
#else
(void) view;
#endif
}
/* --------------------------------------------------------------------------------------------- */
#ifdef HAVE_CHARSET
void
mcview_select_encoding (WView * view)
{
if (do_select_codepage ())
mcview_set_codeset (view);
}
#endif
#endif /* HAVE_CHARSET */
/* --------------------------------------------------------------------------------------------- */

View File

@ -309,7 +309,9 @@ mcview_load (WView * view, const char *command, const char *file, int start_line
if (!mcview_is_in_panel (view))
view->dpy_text_column = 0;
#ifdef HAVE_CHARSET
mcview_set_codeset (view);
#endif
if (command != NULL && (view->mode_flags.magic || file == NULL || file[0] == '\0'))
retval = mcview_load_command_output (view, command);

View File

@ -1,9 +1,9 @@
drwx------ 1 <<uid>> <<gid>> 0 2016-06-07 20:43:00 ./.dosbox
-rw-rw-r-- 1 <<uid>> <<gid>> 10730 2016-06-07 20:43:00 ./.dosbox/dosbox-0.74.conf
-rw------- 1 <<uid>> <<gid>> 11032 2016-11-23 07:10:00 ./.viminfo
-rw-rw-r-- 1 <<uid>> <<gid>> 205 2016-10-26 13:14:00 ./.wget-hsts
-rw-rw-r-- 1 <<uid>> <<gid>> 7527 2016-04-17 01:21:00 ./.xboardrc
-rw-rw-r-- 1 <<uid>> <<gid>> 559 2016-09-29 01:08:00 ./.xchm
-rw-rw-r-- 1 <<uid>> <<gid>> 130 2015-12-27 17:08:00 ./.xinputrc
-rw-r--r-- 1 <<uid>> <<gid>> 6 2016-11-23 07:39:00 ./filename with spaces.txt
-rw-rw-r-- 1 <<uid>> <<gid>> 5869937 2016-11-23 07:43:00 ./log.txt
drwx------ 1 <<uid>> <<gid>> 0 2016-06-07 20:43:00 .dosbox
-rw-rw-r-- 1 <<uid>> <<gid>> 10730 2016-06-07 20:43:00 .dosbox/dosbox-0.74.conf
-rw------- 1 <<uid>> <<gid>> 11032 2016-11-23 07:10:00 .viminfo
-rw-rw-r-- 1 <<uid>> <<gid>> 205 2016-10-26 13:14:00 .wget-hsts
-rw-rw-r-- 1 <<uid>> <<gid>> 7527 2016-04-17 01:21:00 .xboardrc
-rw-rw-r-- 1 <<uid>> <<gid>> 559 2016-09-29 01:08:00 .xchm
-rw-rw-r-- 1 <<uid>> <<gid>> 130 2015-12-27 17:08:00 .xinputrc
-rw-r--r-- 1 <<uid>> <<gid>> 6 2016-11-23 07:39:00 filename with spaces.txt
-rw-rw-r-- 1 <<uid>> <<gid>> 5869937 2016-11-23 07:43:00 log.txt

View File

@ -1,9 +1,9 @@
drwx------ 1 <<uid>> <<gid>> 0 2016-06-07 20:43:00 ./.dosbox
-rw-rw-r-- 1 <<uid>> <<gid>> 10730 2016-06-07 20:43:00 ./.dosbox/dosbox-0.74.conf
-rw------- 1 <<uid>> <<gid>> 11032 2016-11-23 07:10:00 ./.viminfo
-rw-rw-r-- 1 <<uid>> <<gid>> 205 2016-10-26 13:14:00 ./.wget-hsts
-rw-rw-r-- 1 <<uid>> <<gid>> 7527 2016-04-17 01:21:00 ./.xboardrc
-rw-rw-r-- 1 <<uid>> <<gid>> 559 2016-09-29 01:08:00 ./.xchm
-rw-rw-r-- 1 <<uid>> <<gid>> 130 2015-12-27 17:08:00 ./.xinputrc
-rw-r--r-- 1 <<uid>> <<gid>> 6 2016-11-23 07:39:00 ./filename with spaces.txt
-rw-rw-r-- 1 <<uid>> <<gid>> 5869937 2016-11-23 07:43:00 ./log.txt
drwx------ 1 <<uid>> <<gid>> 0 2016-06-07 20:43:00 .dosbox
-rw-rw-r-- 1 <<uid>> <<gid>> 10730 2016-06-07 20:43:00 .dosbox/dosbox-0.74.conf
-rw------- 1 <<uid>> <<gid>> 11032 2016-11-23 07:10:00 .viminfo
-rw-rw-r-- 1 <<uid>> <<gid>> 205 2016-10-26 13:14:00 .wget-hsts
-rw-rw-r-- 1 <<uid>> <<gid>> 7527 2016-04-17 01:21:00 .xboardrc
-rw-rw-r-- 1 <<uid>> <<gid>> 559 2016-09-29 01:08:00 .xchm
-rw-rw-r-- 1 <<uid>> <<gid>> 130 2015-12-27 17:08:00 .xinputrc
-rw-r--r-- 1 <<uid>> <<gid>> 6 2016-11-23 07:39:00 filename with spaces.txt
-rw-rw-r-- 1 <<uid>> <<gid>> 5869937 2016-11-23 07:43:00 log.txt