diff options
Diffstat (limited to 'lib')
109 files changed, 442 insertions, 397 deletions
diff --git a/lib/Makefile.in b/lib/Makefile.in index 26a3fb1..99664da 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -138,7 +138,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/lib/charsets.c b/lib/charsets.c index c97a3cf..c5ccaea 100644 --- a/lib/charsets.c +++ b/lib/charsets.c @@ -1,7 +1,7 @@ /* Text conversion from one charset to another. - Copyright (C) 2001-2023 + Copyright (C) 2001-2024 Free Software Foundation, Inc. Written by: @@ -136,6 +136,7 @@ load_codepages_list_from_file (GPtrArray ** list, const char *fname) if (*list == NULL) { *list = g_ptr_array_sized_new (16); + g_ptr_array_set_free_func (*list, free_codepage_desc); g_ptr_array_add (*list, new_codepage_desc (id, p)); } else diff --git a/lib/event/Makefile.in b/lib/event/Makefile.in index 298c4e4..fba93d4 100644 --- a/lib/event/Makefile.in +++ b/lib/event/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/lib/event/event.c b/lib/event/event.c index 10df96d..1c782f8 100644 --- a/lib/event/event.c +++ b/lib/event/event.c @@ -2,7 +2,7 @@ Handle events in application. Interface functions: init/deinit; start/stop - Copyright (C) 2011-2023 + Copyright (C) 2011-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/event/manage.c b/lib/event/manage.c index b8f9733..4657af5 100644 --- a/lib/event/manage.c +++ b/lib/event/manage.c @@ -2,7 +2,7 @@ Handle any events in application. Manage events: add, delete, destroy, search - Copyright (C) 2011-2023 + Copyright (C) 2011-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/event/raise.c b/lib/event/raise.c index 37cad46..8806b02 100644 --- a/lib/event/raise.c +++ b/lib/event/raise.c @@ -2,7 +2,7 @@ Handle any events in application. Raise events. - Copyright (C) 2011-2023 + Copyright (C) 2011-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/filehighlight/Makefile.in b/lib/filehighlight/Makefile.in index 7ad3212..5bbdc82 100644 --- a/lib/filehighlight/Makefile.in +++ b/lib/filehighlight/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/lib/filehighlight/common.c b/lib/filehighlight/common.c index d519744..71994aa 100644 --- a/lib/filehighlight/common.c +++ b/lib/filehighlight/common.c @@ -2,7 +2,7 @@ File highlight plugin. Interface functions - Copyright (C) 2009-2023 + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/filehighlight/get-color.c b/lib/filehighlight/get-color.c index cdca7e4..4122408 100644 --- a/lib/filehighlight/get-color.c +++ b/lib/filehighlight/get-color.c @@ -2,7 +2,7 @@ File highlight plugin. Interface functions. get color pair index for highlighted file. - Copyright (C) 2009-2023 + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/filehighlight/ini-file-read.c b/lib/filehighlight/ini-file-read.c index bf12b9b..69b13a7 100644 --- a/lib/filehighlight/ini-file-read.c +++ b/lib/filehighlight/ini-file-read.c @@ -2,7 +2,7 @@ File highlight plugin. Reading and parse rules from ini-files - Copyright (C) 2009-2023 + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/fileloc.h b/lib/fileloc.h index ebcfe9d..a075d03 100644 --- a/lib/fileloc.h +++ b/lib/fileloc.h @@ -30,23 +30,23 @@ #define CHARSETS_LIST "mc.charsets" #define MC_MACRO_FILE "mc.macros" -#define FISH_PREFIX "fish" - -#define FISH_LS_FILE "ls" -#define FISH_EXISTS_FILE "fexists" -#define FISH_MKDIR_FILE "mkdir" -#define FISH_UNLINK_FILE "unlink" -#define FISH_CHOWN_FILE "chown" -#define FISH_CHMOD_FILE "chmod" -#define FISH_UTIME_FILE "utime" -#define FISH_RMDIR_FILE "rmdir" -#define FISH_LN_FILE "ln" -#define FISH_MV_FILE "mv" -#define FISH_HARDLINK_FILE "hardlink" -#define FISH_GET_FILE "get" -#define FISH_SEND_FILE "send" -#define FISH_APPEND_FILE "append" -#define FISH_INFO_FILE "info" +#define VFS_SHELL_PREFIX "shell" + +#define VFS_SHELL_LS_FILE "ls" +#define VFS_SHELL_EXISTS_FILE "fexists" +#define VFS_SHELL_MKDIR_FILE "mkdir" +#define VFS_SHELL_UNLINK_FILE "unlink" +#define VFS_SHELL_CHOWN_FILE "chown" +#define VFS_SHELL_CHMOD_FILE "chmod" +#define VFS_SHELL_UTIME_FILE "utime" +#define VFS_SHELL_RMDIR_FILE "rmdir" +#define VFS_SHELL_LN_FILE "ln" +#define VFS_SHELL_MV_FILE "mv" +#define VFS_SHELL_HARDLINK_FILE "hardlink" +#define VFS_SHELL_GET_FILE "get" +#define VFS_SHELL_SEND_FILE "send" +#define VFS_SHELL_APPEND_FILE "append" +#define VFS_SHELL_INFO_FILE "info" #define MC_EXTFS_DIR "extfs.d" diff --git a/lib/glibcompat.c b/lib/glibcompat.c index 0522c0f..0d58e49 100644 --- a/lib/glibcompat.c +++ b/lib/glibcompat.c @@ -1,7 +1,7 @@ /* GLIB - Library of useful routines for C programming - Copyright (C) 2009-2023 + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by: @@ -111,29 +111,8 @@ g_clear_list (GList ** list_ptr, GDestroyNotify destroy) } } -/* --------------------------------------------------------------------------------------------- */ - #endif /* ! GLIB_CHECK_VERSION (2, 63, 3) */ -#if ! GLIB_CHECK_VERSION (2, 32, 0) -/** - * g_queue_free_full: - * @queue: a pointer to a #GQueue - * @free_func: the function to be called to free each element's data - * - * Convenience method, which frees all the memory used by a #GQueue, - * and calls the specified destroy function on every element's data. - * - * Since: 2.32 - */ -void -g_queue_free_full (GQueue * queue, GDestroyNotify free_func) -{ - g_queue_foreach (queue, (GFunc) free_func, NULL); - g_queue_free (queue); -} -#endif /* ! GLIB_CHECK_VERSION (2, 32, 0) */ - /* --------------------------------------------------------------------------------------------- */ #if ! GLIB_CHECK_VERSION (2, 60, 0) @@ -161,6 +140,41 @@ g_queue_clear_full (GQueue * queue, GDestroyNotify free_func) /* --------------------------------------------------------------------------------------------- */ +#if ! GLIB_CHECK_VERSION (2, 77, 0) +/** + * g_string_new_take: + * @init: (nullable): initial text used as the string. + * Ownership of the string is transferred to the #GString. + * Passing NULL creates an empty string. + * + * Creates a new #GString, initialized with the given string. + * + * After this call, @init belongs to the #GString and may no longer be + * modified by the caller. The memory of @data has to be dynamically + * allocated and will eventually be freed with g_free(). + * + * Returns: the new #GString + */ +GString * +g_string_new_take (char *init) +{ + GString *string; + + if (init == NULL) + return g_string_new (NULL); + + string = g_slice_new (GString); + + string->str = init; + string->len = strlen (string->str); + string->allocated_len = string->len + 1; + + return string; +} +#endif /* ! GLIB_CHECK_VERSION (2, 77, 0) */ + +/* --------------------------------------------------------------------------------------------- */ + /** * mc_g_string_copy: * @dest: (not nullable): the destination #GString. Its current contents are destroyed diff --git a/lib/glibcompat.h b/lib/glibcompat.h index cb40966..4f0b4d6 100644 --- a/lib/glibcompat.h +++ b/lib/glibcompat.h @@ -21,14 +21,14 @@ void g_clear_slist (GSList ** slist_ptr, GDestroyNotify destroy); void g_clear_list (GList ** list_ptr, GDestroyNotify destroy); #endif /* ! GLIB_CHECK_VERSION (2, 63, 3) */ -#if ! GLIB_CHECK_VERSION (2, 32, 0) -void g_queue_free_full (GQueue * queue, GDestroyNotify free_func); -#endif /* ! GLIB_CHECK_VERSION (2, 32, 0) */ - #if ! GLIB_CHECK_VERSION (2, 60, 0) void g_queue_clear_full (GQueue * queue, GDestroyNotify free_func); #endif /* ! GLIB_CHECK_VERSION (2, 60, 0) */ +#if ! GLIB_CHECK_VERSION (2, 77, 0) +GString *g_string_new_take (char *init); +#endif /* ! GLIB_CHECK_VERSION (2, 77, 0) */ + /* There is no such API in GLib2 */ GString *mc_g_string_copy (GString * dest, const GString * src); diff --git a/lib/global.c b/lib/global.c index 0b1639d..40efcf9 100644 --- a/lib/global.c +++ b/lib/global.c @@ -1,7 +1,7 @@ /* Global structure for some library-related variables - Copyright (C) 2009-2023 + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by: @@ -4,7 +4,7 @@ Slavaz: Warning! this file is deprecated and should be replaced by mcevents functional. - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/keybind.c b/lib/keybind.c index ebbc82e..2fed74e 100644 --- a/lib/keybind.c +++ b/lib/keybind.c @@ -1,7 +1,7 @@ /* Definitions of key bindings. - Copyright (C) 2005-2023 + Copyright (C) 2005-2024 Free Software Foundation, Inc. Written by: @@ -174,8 +174,8 @@ static name_keymap_t command_names[] = { ADD_KEYMAP_NAME (LinkSymbolicEdit), ADD_KEYMAP_NAME (ExternalPanelize), ADD_KEYMAP_NAME (Filter), -#ifdef ENABLE_VFS_FISH - ADD_KEYMAP_NAME (ConnectFish), +#ifdef ENABLE_VFS_SHELL + ADD_KEYMAP_NAME (ConnectShell), #endif #ifdef ENABLE_VFS_FTP ADD_KEYMAP_NAME (ConnectFtp), diff --git a/lib/keybind.h b/lib/keybind.h index 9c0fe98..4c01f58 100644 --- a/lib/keybind.h +++ b/lib/keybind.h @@ -151,7 +151,7 @@ enum CK_LinkSymbolicEdit, CK_ExternalPanelize, CK_Filter, - CK_ConnectFish, + CK_ConnectShell, CK_ConnectFtp, CK_ConnectSftp, CK_PanelInfo, @@ -1,7 +1,7 @@ /* File locking - Copyright (C) 2003-2023 + Copyright (C) 2003-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/logging.c b/lib/logging.c index 6dd0731..8e28612 100644 --- a/lib/logging.c +++ b/lib/logging.c @@ -1,7 +1,7 @@ /* Provides a log file to ease tracing the program. - Copyright (C) 2006-2023 + Copyright (C) 2006-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/mcconfig.h b/lib/mcconfig.h index 0c3ab3b..abc28ef 100644 --- a/lib/mcconfig.h +++ b/lib/mcconfig.h @@ -105,6 +105,8 @@ vfs_path_t *mc_config_get_full_vpath (const char *config_name); /* read history to the mc_config, but don't save config to file */ GList *mc_config_history_get (const char *name); +/* read recent item from the history */ +char *mc_config_history_get_recent_item (const char *name); /* load history from the mc_config */ GList *mc_config_history_load (mc_config_t * cfg, const char *name); /* save history to the mc_config, but don't save config to file */ diff --git a/lib/mcconfig/Makefile.in b/lib/mcconfig/Makefile.in index ae9c856..fd5aeda 100644 --- a/lib/mcconfig/Makefile.in +++ b/lib/mcconfig/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/lib/mcconfig/common.c b/lib/mcconfig/common.c index 75979be..4891a39 100644 --- a/lib/mcconfig/common.c +++ b/lib/mcconfig/common.c @@ -1,7 +1,7 @@ /* Configure module 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/lib/mcconfig/get.c b/lib/mcconfig/get.c index f8ecfb1..4793b61 100644 --- a/lib/mcconfig/get.c +++ b/lib/mcconfig/get.c @@ -1,7 +1,7 @@ /* Configure module 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/lib/mcconfig/history.c b/lib/mcconfig/history.c index bfbdf0a..57249c4 100644 --- a/lib/mcconfig/history.c +++ b/lib/mcconfig/history.c @@ -1,7 +1,7 @@ /* - Widgets for the Midnight Commander + Configure module for the Midnight Commander - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Authors: @@ -10,7 +10,7 @@ Jakub Jelinek, 1995 Andrej Borsenkow, 1996 Norbert Warmuth, 1997 - Andrew Borodin <aborodin@vmail.ru>, 2009-2019 + Andrew Borodin <aborodin@vmail.ru>, 2009-2023 This file is part of the Midnight Commander. @@ -65,7 +65,7 @@ int num_history_items_recorded = 60; /* --------------------------------------------------------------------------------------------- */ /** - * Load the history from the ${XDG_CACHE_HOME}/mc/history file. + * Load the history from the ${XDG_DATA_HOME}/mc/history file. * It is called with the widgets history name and returns the GList list. */ @@ -95,6 +95,33 @@ mc_config_history_get (const char *name) /* --------------------------------------------------------------------------------------------- */ /** + * Get the recent item of a history from the ${XDG_DATA_HOME}/mc/history file. + * + * TODO: get rid of load the entire history to get the only top item. + */ + +char * +mc_config_history_get_recent_item (const char *name) +{ + GList *history; + char *item = NULL; + + history = mc_config_history_get (name); + if (history != NULL) + { + /* FIXME: can history->data be NULL? */ + item = (char *) history->data; + history->data = NULL; + history = g_list_first (history); + g_list_free_full (history, g_free); + } + + return item; +} + +/* --------------------------------------------------------------------------------------------- */ + +/** * Load history from the mc_config */ GList * @@ -177,8 +204,7 @@ mc_config_history_save (mc_config_t * cfg, const char *name, GList * h) for (i = 0; (i < num_history_items_recorded - 1) && (h->prev != NULL); i++) h = g_list_previous (h); - if (name != NULL) - mc_config_del_group (cfg, name); + mc_config_del_group (cfg, name); /* create charset conversion handler to convert strings from system codepage to UTF-8 */ diff --git a/lib/mcconfig/paths.c b/lib/mcconfig/paths.c index 46ec14d..fbb71c3 100644 --- a/lib/mcconfig/paths.c +++ b/lib/mcconfig/paths.c @@ -1,7 +1,7 @@ /* paths to configuration files - Copyright (C) 2010-2023 + Copyright (C) 2010-2024 Free Software Foundation, Inc. Written by: @@ -74,7 +74,7 @@ static const struct /* data */ { &mc_data_str, MC_SKINS_DIR }, - { &mc_data_str, FISH_PREFIX }, + { &mc_data_str, VFS_SHELL_PREFIX }, { &mc_data_str, MC_ASHRC_FILE }, { &mc_data_str, MC_BASHRC_FILE }, { &mc_data_str, MC_INPUTRC_FILE }, diff --git a/lib/mcconfig/set.c b/lib/mcconfig/set.c index 961435f..ce6d887 100644 --- a/lib/mcconfig/set.c +++ b/lib/mcconfig/set.c @@ -1,7 +1,7 @@ /* Configure module 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/lib/search/Makefile.in b/lib/search/Makefile.in index b587d13..b081433 100644 --- a/lib/search/Makefile.in +++ b/lib/search/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/lib/search/glob.c b/lib/search/glob.c index 5874aba..a0326d0 100644 --- a/lib/search/glob.c +++ b/lib/search/glob.c @@ -2,7 +2,7 @@ Search text engine. Glob-style pattern matching - Copyright (C) 2009-2023 + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/search/hex.c b/lib/search/hex.c index 50af6fb..a5764d8 100644 --- a/lib/search/hex.c +++ b/lib/search/hex.c @@ -2,7 +2,7 @@ Search text engine. HEX-style pattern matching - Copyright (C) 2009-2023 + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/search/lib.c b/lib/search/lib.c index 2c22504..1158e83 100644 --- a/lib/search/lib.c +++ b/lib/search/lib.c @@ -2,7 +2,7 @@ Search text engine. Common share code for module. - Copyright (C) 2009-2023 + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/search/normal.c b/lib/search/normal.c index 9042bfc..9d86b44 100644 --- a/lib/search/normal.c +++ b/lib/search/normal.c @@ -2,7 +2,7 @@ Search text engine. Plain search - Copyright (C) 2009-2023 + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/search/regex.c b/lib/search/regex.c index d24cf48..b1c61c5 100644 --- a/lib/search/regex.c +++ b/lib/search/regex.c @@ -2,7 +2,7 @@ Search text engine. Regex search - Copyright (C) 2009-2023 + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by: @@ -397,17 +397,16 @@ mc_search_regex__get_max_num_of_replace_tokens (const gchar * str, gsize len) { int max_token = 0; gsize loop; + for (loop = 0; loop < len - 1; loop++) - { if (str[loop] == '\\' && g_ascii_isdigit (str[loop + 1])) { if (strutils_is_char_escaped (str, &str[loop])) continue; if (max_token < str[loop + 1] - '0') max_token = str[loop + 1] - '0'; - continue; } - if (str[loop] == '$' && str[loop + 1] == '{') + else if (str[loop] == '$' && str[loop + 1] == '{') { gsize tmp_len; @@ -430,7 +429,7 @@ mc_search_regex__get_max_num_of_replace_tokens (const gchar * str, gsize len) g_free (tmp_str); } } - } + return max_token; } diff --git a/lib/search/search.c b/lib/search/search.c index 8ccb65f..ddbdc2b 100644 --- a/lib/search/search.c +++ b/lib/search/search.c @@ -2,7 +2,7 @@ Search text engine. Interface functions - Copyright (C) 2009-2023 + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/serialize.c b/lib/serialize.c index 1db0a9c..6021af5 100644 --- a/lib/serialize.c +++ b/lib/serialize.c @@ -1,7 +1,7 @@ /* Provides a serialize/unserialize functionality for INI-like formats. - Copyright (C) 2011-2023 + Copyright (C) 2011-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/shell.c b/lib/shell.c index 0646171..2a10b90 100644 --- a/lib/shell.c +++ b/lib/shell.c @@ -1,7 +1,7 @@ /* Provides a functions for working with shell. - Copyright (C) 2006-2023 + Copyright (C) 2006-2024 Free Software Foundation, Inc. Written by: @@ -87,28 +87,29 @@ * Last is defined to view color. */ #define EDITOR_NORMAL_COLOR mc_skin_color__cache[49] -#define EDITOR_BOLD_COLOR mc_skin_color__cache[50] -#define EDITOR_MARKED_COLOR mc_skin_color__cache[51] -#define EDITOR_WHITESPACE_COLOR mc_skin_color__cache[52] -#define EDITOR_RIGHT_MARGIN_COLOR mc_skin_color__cache[53] -#define EDITOR_BACKGROUND mc_skin_color__cache[54] -#define EDITOR_FRAME mc_skin_color__cache[55] -#define EDITOR_FRAME_ACTIVE mc_skin_color__cache[56] -#define EDITOR_FRAME_DRAG mc_skin_color__cache[57] +#define EDITOR_NONPRINTABLE_COLOR mc_skin_color__cache[50] +#define EDITOR_BOLD_COLOR mc_skin_color__cache[51] +#define EDITOR_MARKED_COLOR mc_skin_color__cache[52] +#define EDITOR_WHITESPACE_COLOR mc_skin_color__cache[53] +#define EDITOR_RIGHT_MARGIN_COLOR mc_skin_color__cache[54] +#define EDITOR_BACKGROUND mc_skin_color__cache[55] +#define EDITOR_FRAME mc_skin_color__cache[56] +#define EDITOR_FRAME_ACTIVE mc_skin_color__cache[57] +#define EDITOR_FRAME_DRAG mc_skin_color__cache[58] /* color of left 8 char status per line */ -#define LINE_STATE_COLOR mc_skin_color__cache[58] -#define BOOK_MARK_COLOR mc_skin_color__cache[59] -#define BOOK_MARK_FOUND_COLOR mc_skin_color__cache[60] +#define LINE_STATE_COLOR mc_skin_color__cache[59] +#define BOOK_MARK_COLOR mc_skin_color__cache[60] +#define BOOK_MARK_FOUND_COLOR mc_skin_color__cache[61] /* Diff colors */ -#define DFF_ADD_COLOR mc_skin_color__cache[61] -#define DFF_CHG_COLOR mc_skin_color__cache[62] -#define DFF_CHH_COLOR mc_skin_color__cache[63] -#define DFF_CHD_COLOR mc_skin_color__cache[64] -#define DFF_DEL_COLOR mc_skin_color__cache[65] -#define DFF_ERROR_COLOR mc_skin_color__cache[66] - -#define MC_SKIN_COLOR_CACHE_COUNT 67 +#define DFF_ADD_COLOR mc_skin_color__cache[62] +#define DFF_CHG_COLOR mc_skin_color__cache[63] +#define DFF_CHH_COLOR mc_skin_color__cache[64] +#define DFF_CHD_COLOR mc_skin_color__cache[65] +#define DFF_DEL_COLOR mc_skin_color__cache[66] +#define DFF_ERROR_COLOR mc_skin_color__cache[67] + +#define MC_SKIN_COLOR_CACHE_COUNT 68 /*** enums ***************************************************************************************/ diff --git a/lib/skin/Makefile.in b/lib/skin/Makefile.in index 62f642b..f7ce1d0 100644 --- a/lib/skin/Makefile.in +++ b/lib/skin/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/lib/skin/colors-old.c b/lib/skin/colors-old.c index 628b2aa..3430cd6 100644 --- a/lib/skin/colors-old.c +++ b/lib/skin/colors-old.c @@ -2,7 +2,7 @@ Skins engine. Work with colors - backward compatibility - Copyright (C) 2009-2023 + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by: @@ -69,6 +69,7 @@ static const mc_skin_colors_old_t old_colors[] = { {"editframedrag", "editor", "editframedrag"}, {"editlinestate", "editor", "editlinestate"}, {"editmarked", "editor", "editmarked"}, + {"editnonprintable", "editor", "editnonprintable"}, {"editnormal", "editor", "_default_"}, {"editwhitespace", "editor", "editwhitespace"}, {"errdhotfocus", "error", "errdhotfocus"}, diff --git a/lib/skin/colors.c b/lib/skin/colors.c index 87e9442..688866e 100644 --- a/lib/skin/colors.c +++ b/lib/skin/colors.c @@ -2,7 +2,7 @@ Skins engine. Work with colors - Copyright (C) 2009-2023 + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by: @@ -49,11 +49,11 @@ int mc_skin_color__cache[MC_SKIN_COLOR_CACHE_COUNT]; /*** file scope functions ************************************************************************/ /* --------------------------------------------------------------------------------------------- */ -static mc_skin_color_t * +static tty_color_pair_t * mc_skin_color_get_from_hash (mc_skin_t * mc_skin, const gchar * group, const gchar * key) { gchar kname[BUF_TINY]; - mc_skin_color_t *mc_skin_color; + tty_color_pair_t *mc_skin_color; if (group == NULL || key == NULL) return NULL; @@ -62,7 +62,7 @@ mc_skin_color_get_from_hash (mc_skin_t * mc_skin, const gchar * group, const gch mc_skin = &mc_skin__default; g_snprintf (kname, sizeof (kname), "%s.%s", group, key); - mc_skin_color = (mc_skin_color_t *) g_hash_table_lookup (mc_skin->colors, (gpointer) kname); + mc_skin_color = (tty_color_pair_t *) g_hash_table_lookup (mc_skin->colors, (gpointer) kname); return mc_skin_color; } @@ -89,7 +89,7 @@ mc_skin_color_remove_from_hash (mc_skin_t * mc_skin, const gchar * group, const static void mc_skin_color_add_to_hash (mc_skin_t * mc_skin, const gchar * group, const gchar * key, - mc_skin_color_t * mc_skin_color) + tty_color_pair_t * mc_skin_color) { gchar *kname; @@ -105,10 +105,10 @@ mc_skin_color_add_to_hash (mc_skin_t * mc_skin, const gchar * group, const gchar /* --------------------------------------------------------------------------------------------- */ -static mc_skin_color_t * +static tty_color_pair_t * mc_skin_color_get_with_defaults (const gchar * group, const gchar * name) { - mc_skin_color_t *mc_skin_color; + tty_color_pair_t *mc_skin_color; mc_skin_color = mc_skin_color_get_from_hash (NULL, group, name); if (mc_skin_color != NULL) @@ -179,12 +179,12 @@ mc_skin_color_look_up_alias (mc_skin_t * mc_skin, gchar * str) /* --------------------------------------------------------------------------------------------- */ -static mc_skin_color_t * +static tty_color_pair_t * mc_skin_color_get_from_ini_file (mc_skin_t * mc_skin, const gchar * group, const gchar * key) { gsize items_count; gchar **values; - mc_skin_color_t *mc_skin_color, *tmp; + tty_color_pair_t *mc_skin_color, *tmp; values = mc_config_get_string_list (mc_skin->config, group, key, &items_count); if (values == NULL || values[0] == NULL) @@ -193,7 +193,7 @@ mc_skin_color_get_from_ini_file (mc_skin_t * mc_skin, const gchar * group, const return NULL; } - mc_skin_color = g_try_new0 (mc_skin_color_t, 1); + mc_skin_color = g_try_new0 (tty_color_pair_t, 1); if (mc_skin_color == NULL) { g_strfreev (values); @@ -201,21 +201,19 @@ mc_skin_color_get_from_ini_file (mc_skin_t * mc_skin, const gchar * group, const } tmp = mc_skin_color_get_with_defaults (group, "_default_"); - mc_skin_color->fgcolor = (items_count > 0 && values[0][0]) ? + mc_skin_color->fg = (items_count > 0 && values[0][0]) ? mc_skin_color_look_up_alias (mc_skin, g_strstrip (g_strdup (values[0]))) : - (tmp != NULL) ? g_strdup (tmp->fgcolor) : NULL; - mc_skin_color->bgcolor = (items_count > 1 && values[1][0]) ? + (tmp != NULL) ? g_strdup (tmp->fg) : NULL; + mc_skin_color->bg = (items_count > 1 && values[1][0]) ? mc_skin_color_look_up_alias (mc_skin, g_strstrip (g_strdup (values[1]))) : - (tmp != NULL) ? g_strdup (tmp->bgcolor) : NULL; + (tmp != NULL) ? g_strdup (tmp->bg) : NULL; mc_skin_color->attrs = (items_count > 2 && values[2][0]) ? mc_skin_color_look_up_alias (mc_skin, g_strstrip (g_strdup (values[2]))) : (tmp != NULL) ? g_strdup (tmp->attrs) : NULL; g_strfreev (values); - mc_skin_color->pair_index = - tty_try_alloc_color_pair2 (mc_skin_color->fgcolor, mc_skin_color->bgcolor, - mc_skin_color->attrs, FALSE); + mc_skin_color->pair_index = tty_try_alloc_color_pair (mc_skin_color, FALSE); return mc_skin_color; } @@ -225,16 +223,15 @@ mc_skin_color_get_from_ini_file (mc_skin_t * mc_skin, const gchar * group, const static void mc_skin_color_set_default_for_terminal (mc_skin_t * mc_skin) { - mc_skin_color_t *mc_skin_color; - mc_skin_color = g_try_new0 (mc_skin_color_t, 1); + tty_color_pair_t *mc_skin_color; + + mc_skin_color = g_try_new0 (tty_color_pair_t, 1); if (mc_skin_color != NULL) { - mc_skin_color->fgcolor = g_strdup ("default"); - mc_skin_color->bgcolor = g_strdup ("default"); + mc_skin_color->fg = g_strdup ("default"); + mc_skin_color->bg = g_strdup ("default"); mc_skin_color->attrs = NULL; - mc_skin_color->pair_index = - tty_try_alloc_color_pair2 (mc_skin_color->fgcolor, mc_skin_color->bgcolor, - mc_skin_color->attrs, FALSE); + mc_skin_color->pair_index = tty_try_alloc_color_pair (mc_skin_color, FALSE); mc_skin_color_add_to_hash (mc_skin, "skin", "terminal_default_color", mc_skin_color); } } @@ -305,6 +302,7 @@ mc_skin_color_cache_init (void) EDITOR_BOLD_COLOR = mc_skin_color_get ("editor", "editbold"); EDITOR_MARKED_COLOR = mc_skin_color_get ("editor", "editmarked"); EDITOR_WHITESPACE_COLOR = mc_skin_color_get ("editor", "editwhitespace"); + EDITOR_NONPRINTABLE_COLOR = mc_skin_color_get ("editor", "editnonprintable"); EDITOR_RIGHT_MARGIN_COLOR = mc_skin_color_get ("editor", "editrightmargin"); LINE_STATE_COLOR = mc_skin_color_get ("editor", "editlinestate"); EDITOR_BACKGROUND = mc_skin_color_get ("editor", "editbg"); @@ -363,7 +361,7 @@ mc_skin_color_parse_ini_file (mc_skin_t * mc_skin) gboolean ret = FALSE; gsize items_count; gchar **groups, **orig_groups; - mc_skin_color_t *mc_skin_color; + tty_color_pair_t *mc_skin_color; mc_skin_color_check_bw_mode (mc_skin); @@ -377,7 +375,7 @@ mc_skin_color_parse_ini_file (mc_skin_t * mc_skin) if (mc_skin_color == NULL) goto ret; - tty_color_set_defaults (mc_skin_color->fgcolor, mc_skin_color->bgcolor, mc_skin_color->attrs); + tty_color_set_defaults (mc_skin_color); mc_skin_color_add_to_hash (mc_skin, "core", "_default_", mc_skin_color); for (groups = orig_groups; *groups != NULL; groups++) @@ -412,7 +410,7 @@ mc_skin_color_parse_ini_file (mc_skin_t * mc_skin) int mc_skin_color_get (const gchar * group, const gchar * name) { - mc_skin_color_t *mc_skin_color; + tty_color_pair_t *mc_skin_color; mc_skin_color = mc_skin_color_get_with_defaults (group, name); diff --git a/lib/skin/common.c b/lib/skin/common.c index 85790f2..e94977c 100644 --- a/lib/skin/common.c +++ b/lib/skin/common.c @@ -2,7 +2,7 @@ Skins engine. Interface functions - Copyright (C) 2009-2023 + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by: @@ -54,9 +54,10 @@ static gboolean mc_skin_is_init = FALSE; static void mc_skin_hash_destroy_value (gpointer data) { - mc_skin_color_t *mc_skin_color = (mc_skin_color_t *) data; - g_free (mc_skin_color->fgcolor); - g_free (mc_skin_color->bgcolor); + tty_color_pair_t *mc_skin_color = (tty_color_pair_t *) data; + + g_free (mc_skin_color->fg); + g_free (mc_skin_color->bg); g_free (mc_skin_color->attrs); g_free (mc_skin_color); } @@ -180,8 +181,7 @@ mc_skin_init (const gchar * skin_override, GError ** mcerror) void mc_skin_deinit (void) { - tty_color_free_all_tmp (); - tty_color_free_all_non_tmp (); + tty_color_free_all (); MC_PTR_FREE (mc_skin__default.name); g_hash_table_destroy (mc_skin__default.colors); diff --git a/lib/skin/hc-skins.c b/lib/skin/hc-skins.c index 95ac73d..1a13dec 100644 --- a/lib/skin/hc-skins.c +++ b/lib/skin/hc-skins.c @@ -2,7 +2,7 @@ Skins engine. Set of hardcoded skins - Copyright (C) 2009-2023 + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/skin/ini-file.c b/lib/skin/ini-file.c index 6d92435..24d7c25 100644 --- a/lib/skin/ini-file.c +++ b/lib/skin/ini-file.c @@ -2,7 +2,7 @@ Skins engine. Reading and parse ini-files - Copyright (C) 2009-2023 + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/skin/internal.h b/lib/skin/internal.h index 8b468db..6bc0a23 100644 --- a/lib/skin/internal.h +++ b/lib/skin/internal.h @@ -10,14 +10,6 @@ /*** structures declarations (and typedefs of structures)*****************************************/ -typedef struct mc_skin_color_struct -{ - gchar *fgcolor; - gchar *bgcolor; - gchar *attrs; - int pair_index; -} mc_skin_color_t; - /*** global variables defined in .c file *********************************************************/ /*** declarations of public functions ************************************************************/ diff --git a/lib/skin/lines.c b/lib/skin/lines.c index 90cc028..436f555 100644 --- a/lib/skin/lines.c +++ b/lib/skin/lines.c @@ -2,7 +2,7 @@ Skins engine. Work with line draving chars. - Copyright (C) 2009-2023 + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by: @@ -68,33 +68,31 @@ mc_skin_lines_parse_ini_file (mc_skin_t * mc_skin) mc_skin_hardcoded_space_lines (mc_skin); else if (mc_global.tty.ugly_line_drawing) mc_skin_hardcoded_ugly_lines (mc_skin); - else - { - /* single lines */ - mc_tty_frm[MC_TTY_FRM_VERT] = mc_skin_lines_load_frm (mc_skin, "vert"); - mc_tty_frm[MC_TTY_FRM_HORIZ] = mc_skin_lines_load_frm (mc_skin, "horiz"); - mc_tty_frm[MC_TTY_FRM_LEFTTOP] = mc_skin_lines_load_frm (mc_skin, "lefttop"); - mc_tty_frm[MC_TTY_FRM_RIGHTTOP] = mc_skin_lines_load_frm (mc_skin, "righttop"); - mc_tty_frm[MC_TTY_FRM_LEFTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "leftbottom"); - mc_tty_frm[MC_TTY_FRM_RIGHTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "rightbottom"); - mc_tty_frm[MC_TTY_FRM_TOPMIDDLE] = mc_skin_lines_load_frm (mc_skin, "topmiddle"); - mc_tty_frm[MC_TTY_FRM_BOTTOMMIDDLE] = mc_skin_lines_load_frm (mc_skin, "bottommiddle"); - mc_tty_frm[MC_TTY_FRM_LEFTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "leftmiddle"); - mc_tty_frm[MC_TTY_FRM_RIGHTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "rightmiddle"); - mc_tty_frm[MC_TTY_FRM_CROSS] = mc_skin_lines_load_frm (mc_skin, "cross"); - - /* double lines */ - mc_tty_frm[MC_TTY_FRM_DVERT] = mc_skin_lines_load_frm (mc_skin, "dvert"); - mc_tty_frm[MC_TTY_FRM_DHORIZ] = mc_skin_lines_load_frm (mc_skin, "dhoriz"); - mc_tty_frm[MC_TTY_FRM_DLEFTTOP] = mc_skin_lines_load_frm (mc_skin, "dlefttop"); - mc_tty_frm[MC_TTY_FRM_DRIGHTTOP] = mc_skin_lines_load_frm (mc_skin, "drighttop"); - mc_tty_frm[MC_TTY_FRM_DLEFTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "dleftbottom"); - mc_tty_frm[MC_TTY_FRM_DRIGHTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "drightbottom"); - mc_tty_frm[MC_TTY_FRM_DTOPMIDDLE] = mc_skin_lines_load_frm (mc_skin, "dtopmiddle"); - mc_tty_frm[MC_TTY_FRM_DBOTTOMMIDDLE] = mc_skin_lines_load_frm (mc_skin, "dbottommiddle"); - mc_tty_frm[MC_TTY_FRM_DLEFTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "dleftmiddle"); - mc_tty_frm[MC_TTY_FRM_DRIGHTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "drightmiddle"); - } + + /* single lines */ + mc_tty_frm[MC_TTY_FRM_VERT] = mc_skin_lines_load_frm (mc_skin, "vert"); + mc_tty_frm[MC_TTY_FRM_HORIZ] = mc_skin_lines_load_frm (mc_skin, "horiz"); + mc_tty_frm[MC_TTY_FRM_LEFTTOP] = mc_skin_lines_load_frm (mc_skin, "lefttop"); + mc_tty_frm[MC_TTY_FRM_RIGHTTOP] = mc_skin_lines_load_frm (mc_skin, "righttop"); + mc_tty_frm[MC_TTY_FRM_LEFTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "leftbottom"); + mc_tty_frm[MC_TTY_FRM_RIGHTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "rightbottom"); + mc_tty_frm[MC_TTY_FRM_TOPMIDDLE] = mc_skin_lines_load_frm (mc_skin, "topmiddle"); + mc_tty_frm[MC_TTY_FRM_BOTTOMMIDDLE] = mc_skin_lines_load_frm (mc_skin, "bottommiddle"); + mc_tty_frm[MC_TTY_FRM_LEFTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "leftmiddle"); + mc_tty_frm[MC_TTY_FRM_RIGHTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "rightmiddle"); + mc_tty_frm[MC_TTY_FRM_CROSS] = mc_skin_lines_load_frm (mc_skin, "cross"); + + /* double lines */ + mc_tty_frm[MC_TTY_FRM_DVERT] = mc_skin_lines_load_frm (mc_skin, "dvert"); + mc_tty_frm[MC_TTY_FRM_DHORIZ] = mc_skin_lines_load_frm (mc_skin, "dhoriz"); + mc_tty_frm[MC_TTY_FRM_DLEFTTOP] = mc_skin_lines_load_frm (mc_skin, "dlefttop"); + mc_tty_frm[MC_TTY_FRM_DRIGHTTOP] = mc_skin_lines_load_frm (mc_skin, "drighttop"); + mc_tty_frm[MC_TTY_FRM_DLEFTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "dleftbottom"); + mc_tty_frm[MC_TTY_FRM_DRIGHTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "drightbottom"); + mc_tty_frm[MC_TTY_FRM_DTOPMIDDLE] = mc_skin_lines_load_frm (mc_skin, "dtopmiddle"); + mc_tty_frm[MC_TTY_FRM_DBOTTOMMIDDLE] = mc_skin_lines_load_frm (mc_skin, "dbottommiddle"); + mc_tty_frm[MC_TTY_FRM_DLEFTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "dleftmiddle"); + mc_tty_frm[MC_TTY_FRM_DRIGHTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "drightmiddle"); } /* --------------------------------------------------------------------------------------------- */ diff --git a/lib/strutil/Makefile.in b/lib/strutil/Makefile.in index fe19e5c..483506a 100644 --- a/lib/strutil/Makefile.in +++ b/lib/strutil/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/lib/strutil/replace.c b/lib/strutil/replace.c index 99356ee..a2d700d 100644 --- a/lib/strutil/replace.c +++ b/lib/strutil/replace.c @@ -1,7 +1,7 @@ /* Functions for replacing substrings in strings. - Copyright (C) 2013-2023 + Copyright (C) 2013-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/strutil/strescape.c b/lib/strutil/strescape.c index a605ad8..1412fee 100644 --- a/lib/strutil/strescape.c +++ b/lib/strutil/strescape.c @@ -1,7 +1,7 @@ /* Functions for escaping and unescaping strings - Copyright (C) 2009-2023 + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/strutil/strutil.c b/lib/strutil/strutil.c index 0c5f96a..4e24e7f 100644 --- a/lib/strutil/strutil.c +++ b/lib/strutil/strutil.c @@ -1,7 +1,7 @@ /* Common strings utilities - Copyright (C) 2007-2023 + Copyright (C) 2007-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/strutil/strutil8bit.c b/lib/strutil/strutil8bit.c index 2002e5e..468e6ea 100644 --- a/lib/strutil/strutil8bit.c +++ b/lib/strutil/strutil8bit.c @@ -1,7 +1,7 @@ /* 8bit strings utilities - Copyright (C) 2007-2023 + Copyright (C) 2007-2024 Free Software Foundation, Inc. Written by: @@ -677,13 +677,14 @@ str_8bit_casecmp (const char *s1, const char *s2) return strcasecmp (s1, s2); #else - gint c1, c2; g_return_val_if_fail (s1 != NULL, 0); g_return_val_if_fail (s2 != NULL, 0); - while (*s1 != '\0' && *s2 != '\0') + for (; *s1 != '\0' && *s2 != '\0'; s1++, s2++) { + gint c1, c2; + /* According to A. Cox, some platforms have islower's that * don't work right on non-uppercase */ @@ -691,8 +692,6 @@ str_8bit_casecmp (const char *s1, const char *s2) c2 = isupper ((guchar) * s2) ? tolower ((guchar) * s2) : *s2; if (c1 != c2) return (c1 - c2); - s1++; - s2++; } return (((gint) (guchar) * s1) - ((gint) (guchar) * s2)); @@ -716,11 +715,12 @@ str_8bit_ncasecmp (const char *s1, const char *s2) #ifdef HAVE_STRNCASECMP return strncasecmp (s1, s2, n); #else - gint c1, c2; - while (n != 0 && *s1 != '\0' && *s2 != '\0') + for (; *s1 != '\0' && *s2 != '\0'; s1++, s2++) { - n -= 1; + gint c1, c2; + + n--; /* According to A. Cox, some platforms have islower's that * don't work right on non-uppercase */ @@ -728,8 +728,6 @@ str_8bit_ncasecmp (const char *s1, const char *s2) c2 = isupper ((guchar) * s2) ? tolower ((guchar) * s2) : *s2; if (c1 != c2) return (c1 - c2); - s1++; - s2++; } if (n == 0) diff --git a/lib/strutil/strutilascii.c b/lib/strutil/strutilascii.c index 421bfdb..eb0a742 100644 --- a/lib/strutil/strutilascii.c +++ b/lib/strutil/strutilascii.c @@ -1,7 +1,7 @@ /* ASCII strings utilities - Copyright (C) 2007-2023 + Copyright (C) 2007-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/strutil/strutilutf8.c b/lib/strutil/strutilutf8.c index e143abe..9142f3d 100644 --- a/lib/strutil/strutilutf8.c +++ b/lib/strutil/strutilutf8.c @@ -1,7 +1,7 @@ /* UTF-8 strings utilities - Copyright (C) 2007-2023 + Copyright (C) 2007-2024 Free Software Foundation, Inc. Written by: @@ -901,12 +901,12 @@ str_utf8_offset_to_pos (const char *text, size_t length) else { int result; - GString *buffer; + char *buffer; - buffer = g_string_new (text); - str_utf8_fix_string (buffer->str); - result = g_utf8_offset_to_pointer (buffer->str, length) - buffer->str; - g_string_free (buffer, TRUE); + buffer = g_strdup (text); + str_utf8_fix_string (buffer); + result = g_utf8_offset_to_pointer (buffer, length) - buffer; + g_free (buffer); return result; } } diff --git a/lib/strutil/strverscmp.c b/lib/strutil/strverscmp.c index 7d720c5..26ab5e9 100644 --- a/lib/strutil/strverscmp.c +++ b/lib/strutil/strverscmp.c @@ -1,7 +1,7 @@ /* Compare strings while treating digits characters numerically. - Copyright (C) 1997-2023 + Copyright (C) 1997-2024 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/strutil/xstrtol.c b/lib/strutil/xstrtol.c index a0f93ce..5695c19 100644 --- a/lib/strutil/xstrtol.c +++ b/lib/strutil/xstrtol.c @@ -1,6 +1,6 @@ /* A more useful interface to strtol. - Copyright (C) 1995-2023 + Copyright (C) 1995-2024 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/lib/timefmt.c b/lib/timefmt.c index 43bd429..caa7a1d 100644 --- a/lib/timefmt.c +++ b/lib/timefmt.c @@ -1,7 +1,7 @@ /* Time formatting functions - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/tty/Makefile.in b/lib/tty/Makefile.in index 0aa0af8..26f9901 100644 --- a/lib/tty/Makefile.in +++ b/lib/tty/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/lib/tty/color-internal.c b/lib/tty/color-internal.c index 8db2b6c..16b76ef 100644 --- a/lib/tty/color-internal.c +++ b/lib/tty/color-internal.c @@ -1,7 +1,7 @@ /* Internal stuff of color setup - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Written by: @@ -184,9 +184,9 @@ tty_color_get_name_by_index (int idx) char name[9]; if (idx < 256) - sprintf (name, "color%d", idx); + g_snprintf (name, sizeof (name), "color%d", idx); else - sprintf (name, "#%06X", (unsigned int) idx & 0xFFFFFF); + g_snprintf (name, sizeof (name), "#%06X", (unsigned int) idx & 0xFFFFFF); return g_intern_string (name); } return "default"; diff --git a/lib/tty/color-internal.h b/lib/tty/color-internal.h index dc85225..a9b8d69 100644 --- a/lib/tty/color-internal.h +++ b/lib/tty/color-internal.h @@ -31,14 +31,15 @@ typedef enum { /*** structures declarations (and typedefs of structures)*****************************************/ -typedef struct mc_color_pair_struct +/* Screen library specific color pair */ +typedef struct { - int ifg; - int ibg; + int fg; + int bg; int attr; size_t pair_index; gboolean is_temp; -} tty_color_pair_t; +} tty_color_lib_pair_t; /*** global variables defined in .c file *********************************************************/ @@ -54,7 +55,7 @@ int tty_attr_get_bits (const char *attrs); void tty_color_init_lib (gboolean disable, gboolean force); void tty_color_deinit_lib (void); -void tty_color_try_alloc_pair_lib (tty_color_pair_t * mc_color_pair); +void tty_color_try_alloc_lib_pair (tty_color_lib_pair_t * mc_color_pair); /*** inline functions ****************************************************************************/ diff --git a/lib/tty/color-ncurses.c b/lib/tty/color-ncurses.c index f01d697..055a3af 100644 --- a/lib/tty/color-ncurses.c +++ b/lib/tty/color-ncurses.c @@ -1,7 +1,7 @@ /* Color setup for NCurses screen library - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Written by: @@ -103,7 +103,7 @@ color_get_attr (int color_pair) /* --------------------------------------------------------------------------------------------- */ static void -mc_tty_color_pair_init_special (tty_color_pair_t * mc_color_pair, +mc_tty_color_pair_init_special (tty_color_lib_pair_t * mc_color_pair, int fg1, int bg1, int fg2, int bg2, int attr) { if (has_colors () && !mc_tty_color_disable) @@ -145,11 +145,11 @@ tty_color_deinit_lib (void) /* --------------------------------------------------------------------------------------------- */ void -tty_color_try_alloc_pair_lib (tty_color_pair_t * mc_color_pair) +tty_color_try_alloc_lib_pair (tty_color_lib_pair_t * mc_color_pair) { - if (mc_color_pair->ifg <= (int) SPEC_A_REVERSE) + if (mc_color_pair->fg <= (int) SPEC_A_REVERSE) { - switch (mc_color_pair->ifg) + switch (mc_color_pair->fg) { case SPEC_A_REVERSE: mc_tty_color_pair_init_special (mc_color_pair, @@ -179,8 +179,8 @@ tty_color_try_alloc_pair_lib (tty_color_pair_t * mc_color_pair) { int ifg, ibg, attr; - ifg = mc_color_pair->ifg; - ibg = mc_color_pair->ibg; + ifg = mc_color_pair->fg; + ibg = mc_color_pair->bg; attr = mc_color_pair->attr; /* In legacy color mode, change bright colors into bold */ diff --git a/lib/tty/color-slang.c b/lib/tty/color-slang.c index 5dd2663..33344b5 100644 --- a/lib/tty/color-slang.c +++ b/lib/tty/color-slang.c @@ -1,7 +1,7 @@ /* Color setup for S_Lang screen library - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Written by: @@ -99,7 +99,7 @@ has_colors (gboolean disable, gboolean force) /* --------------------------------------------------------------------------------------------- */ static void -mc_tty_color_pair_init_special (tty_color_pair_t * mc_color_pair, +mc_tty_color_pair_init_special (tty_color_lib_pair_t * mc_color_pair, const char *fg1, const char *bg1, const char *fg2, const char *bg2, SLtt_Char_Type mask) { @@ -145,11 +145,11 @@ tty_color_deinit_lib (void) /* --------------------------------------------------------------------------------------------- */ void -tty_color_try_alloc_pair_lib (tty_color_pair_t * mc_color_pair) +tty_color_try_alloc_lib_pair (tty_color_lib_pair_t * mc_color_pair) { - if (mc_color_pair->ifg <= (int) SPEC_A_REVERSE) + if (mc_color_pair->fg <= (int) SPEC_A_REVERSE) { - switch (mc_color_pair->ifg) + switch (mc_color_pair->fg) { case SPEC_A_REVERSE: mc_tty_color_pair_init_special (mc_color_pair, @@ -176,8 +176,8 @@ tty_color_try_alloc_pair_lib (tty_color_pair_t * mc_color_pair) { const char *fg, *bg; - fg = tty_color_get_name_by_index (mc_color_pair->ifg); - bg = tty_color_get_name_by_index (mc_color_pair->ibg); + fg = tty_color_get_name_by_index (mc_color_pair->fg); + bg = tty_color_get_name_by_index (mc_color_pair->bg); SLtt_set_color (mc_color_pair->pair_index, (char *) "", (char *) fg, (char *) bg); SLtt_add_color_attribute (mc_color_pair->pair_index, mc_color_pair->attr); } diff --git a/lib/tty/color.c b/lib/tty/color.c index c79e13a..78d50b7 100644 --- a/lib/tty/color.c +++ b/lib/tty/color.c @@ -2,7 +2,7 @@ Color setup. Interface functions. - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Written by: @@ -46,9 +46,15 @@ /*** global variables ****************************************************************************/ -static char *tty_color_defaults__fg = NULL; -static char *tty_color_defaults__bg = NULL; -static char *tty_color_defaults__attrs = NULL; +/* *INDENT-OFF* */ +static tty_color_pair_t tty_color_defaults = +{ + .fg = NULL, + .bg = NULL, + .attrs = NULL, + .pair_index = 0 +}; +/* *INDENT-ON* */ /* Set if we are actually using colors */ gboolean use_colors = FALSE; @@ -67,25 +73,23 @@ static GHashTable *mc_tty_color__hashtable = NULL; /*** file scope functions ************************************************************************/ /* --------------------------------------------------------------------------------------------- */ -static gboolean -tty_color_free_condition_cb (gpointer key, gpointer value, gpointer user_data) +static void +mc_color__deinit (tty_color_pair_t * color) { - tty_color_pair_t *mc_color_pair = (tty_color_pair_t *) value; - gboolean is_temp_color; - - (void) key; - - is_temp_color = user_data != NULL; - return (mc_color_pair->is_temp == is_temp_color); + g_free (color->fg); + g_free (color->bg); + g_free (color->attrs); } /* --------------------------------------------------------------------------------------------- */ -static void -tty_color_free_all (gboolean is_temp_color) +static gboolean +tty_color_free_temp_cb (gpointer key, gpointer value, gpointer user_data) { - g_hash_table_foreach_remove (mc_tty_color__hashtable, tty_color_free_condition_cb, - is_temp_color ? GSIZE_TO_POINTER (1) : NULL); + (void) key; + (void) user_data; + + return ((tty_color_lib_pair_t *) value)->is_temp; } /* --------------------------------------------------------------------------------------------- */ @@ -93,7 +97,7 @@ tty_color_free_all (gboolean is_temp_color) static gboolean tty_color_get_next_cpn_cb (gpointer key, gpointer value, gpointer user_data) { - tty_color_pair_t *mc_color_pair = (tty_color_pair_t *) value; + tty_color_lib_pair_t *mc_color_pair = (tty_color_lib_pair_t *) value; size_t cp = GPOINTER_TO_SIZE (user_data); (void) key; @@ -134,10 +138,7 @@ void tty_colors_done (void) { tty_color_deinit_lib (); - g_free (tty_color_defaults__fg); - g_free (tty_color_defaults__bg); - g_free (tty_color_defaults__attrs); - + mc_color__deinit (&tty_color_defaults); g_hash_table_destroy (mc_tty_color__hashtable); } @@ -152,30 +153,27 @@ tty_use_colors (void) /* --------------------------------------------------------------------------------------------- */ int -tty_try_alloc_color_pair2 (const char *fg, const char *bg, const char *attrs, - gboolean is_temp_color) +tty_try_alloc_color_pair (const tty_color_pair_t * color, gboolean is_temp) { + gboolean is_base; gchar *color_pair; - tty_color_pair_t *mc_color_pair; + tty_color_lib_pair_t *mc_color_pair; int ifg, ibg, attr; - if (fg == NULL || strcmp (fg, "base") == 0) - fg = tty_color_defaults__fg; - if (bg == NULL || strcmp (bg, "base") == 0) - bg = tty_color_defaults__bg; - if (attrs == NULL || strcmp (attrs, "base") == 0) - attrs = tty_color_defaults__attrs; - - ifg = tty_color_get_index_by_name (fg); - ibg = tty_color_get_index_by_name (bg); - attr = tty_attr_get_bits (attrs); + is_base = (color->fg == NULL || strcmp (color->fg, "base") == 0); + ifg = tty_color_get_index_by_name (is_base ? tty_color_defaults.fg : color->fg); + is_base = (color->bg == NULL || strcmp (color->bg, "base") == 0); + ibg = tty_color_get_index_by_name (is_base ? tty_color_defaults.bg : color->bg); + is_base = (color->attrs == NULL || strcmp (color->attrs, "base") == 0); + attr = tty_attr_get_bits (is_base ? tty_color_defaults.attrs : color->attrs); color_pair = g_strdup_printf ("%d.%d.%d", ifg, ibg, attr); if (color_pair == NULL) return 0; mc_color_pair = - (tty_color_pair_t *) g_hash_table_lookup (mc_tty_color__hashtable, (gpointer) color_pair); + (tty_color_lib_pair_t *) g_hash_table_lookup (mc_tty_color__hashtable, + (gpointer) color_pair); if (mc_color_pair != NULL) { @@ -183,20 +181,20 @@ tty_try_alloc_color_pair2 (const char *fg, const char *bg, const char *attrs, return mc_color_pair->pair_index; } - mc_color_pair = g_try_new0 (tty_color_pair_t, 1); + mc_color_pair = g_try_new0 (tty_color_lib_pair_t, 1); if (mc_color_pair == NULL) { g_free (color_pair); return 0; } - mc_color_pair->is_temp = is_temp_color; - mc_color_pair->ifg = ifg; - mc_color_pair->ibg = ibg; + mc_color_pair->is_temp = is_temp; + mc_color_pair->fg = ifg; + mc_color_pair->bg = ibg; mc_color_pair->attr = attr; mc_color_pair->pair_index = tty_color_get_next__color_pair_number (); - tty_color_try_alloc_pair_lib (mc_color_pair); + tty_color_try_alloc_lib_pair (mc_color_pair); g_hash_table_insert (mc_tty_color__hashtable, (gpointer) color_pair, (gpointer) mc_color_pair); @@ -205,40 +203,31 @@ tty_try_alloc_color_pair2 (const char *fg, const char *bg, const char *attrs, /* --------------------------------------------------------------------------------------------- */ -int -tty_try_alloc_color_pair (const char *fg, const char *bg, const char *attrs) -{ - return tty_try_alloc_color_pair2 (fg, bg, attrs, TRUE); -} - -/* --------------------------------------------------------------------------------------------- */ - void -tty_color_free_all_tmp (void) +tty_color_free_temp (void) { - tty_color_free_all (TRUE); + g_hash_table_foreach_remove (mc_tty_color__hashtable, tty_color_free_temp_cb, NULL); } /* --------------------------------------------------------------------------------------------- */ void -tty_color_free_all_non_tmp (void) +tty_color_free_all (void) { - tty_color_free_all (FALSE); + g_hash_table_remove_all (mc_tty_color__hashtable); } /* --------------------------------------------------------------------------------------------- */ void -tty_color_set_defaults (const char *fgcolor, const char *bgcolor, const char *attrs) +tty_color_set_defaults (const tty_color_pair_t * color) { - g_free (tty_color_defaults__fg); - g_free (tty_color_defaults__bg); - g_free (tty_color_defaults__attrs); + mc_color__deinit (&tty_color_defaults); - tty_color_defaults__fg = g_strdup (fgcolor); - tty_color_defaults__bg = g_strdup (bgcolor); - tty_color_defaults__attrs = g_strdup (attrs); + tty_color_defaults.fg = g_strdup (color->fg); + tty_color_defaults.bg = g_strdup (color->bg); + tty_color_defaults.attrs = g_strdup (color->attrs); + tty_color_defaults.pair_index = 0; } /* --------------------------------------------------------------------------------------------- */ diff --git a/lib/tty/color.h b/lib/tty/color.h index 583cce3..e09516f 100644 --- a/lib/tty/color.h +++ b/lib/tty/color.h @@ -21,6 +21,14 @@ /*** typedefs(not structures) and defined constants **********************************************/ +typedef struct +{ + char *fg; + char *bg; + char *attrs; + size_t pair_index; +} tty_color_pair_t; + /*** enums ***************************************************************************************/ /*** structures declarations (and typedefs of structures)*****************************************/ @@ -33,18 +41,16 @@ void tty_init_colors (gboolean disable, gboolean force); void tty_colors_done (void); gboolean tty_use_colors (void); -int tty_try_alloc_color_pair (const char *fg, const char *bg, const char *attrs); -int tty_try_alloc_color_pair2 (const char *fg, const char *bg, const char *attrs, - gboolean is_temp_color); +int tty_try_alloc_color_pair (const tty_color_pair_t * color, gboolean is_temp); -void tty_color_free_all_tmp (void); -void tty_color_free_all_non_tmp (void); +void tty_color_free_temp (void); +void tty_color_free_all (void); void tty_setcolor (int color); void tty_lowlevel_setcolor (int color); void tty_set_normal_attrs (void); -void tty_color_set_defaults (const char *fgcolor, const char *bgcolor, const char *attrs); +void tty_color_set_defaults (const tty_color_pair_t * color); extern gboolean tty_use_256colors (GError ** error); extern gboolean tty_use_truecolors (GError ** error); diff --git a/lib/tty/key.c b/lib/tty/key.c index 5671666..8e7770b 100644 --- a/lib/tty/key.c +++ b/lib/tty/key.c @@ -1,7 +1,7 @@ /* Keyboard support routines. - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Written by: @@ -1173,28 +1173,19 @@ getch_with_timeout (unsigned int delay_us) /* --------------------------------------------------------------------------------------------- */ static void -learn_store_key (char *buffer, char **p, int c) +learn_store_key (GString * buffer, int c) { - if (*p - buffer > 253) - return; - if (c == ESC_CHAR) - { - *(*p)++ = '\\'; - *(*p)++ = 'e'; - } + g_string_append (buffer, "\\e"); else if (c < ' ') { - *(*p)++ = '^'; - *(*p)++ = c + 'a' - 1; + g_string_append_c (buffer, '^'); + g_string_append_c (buffer, c + 'a' - 1); } else if (c == '^') - { - *(*p)++ = '^'; - *(*p)++ = '^'; - } + g_string_append (buffer, "^^"); else - *(*p)++ = (char) c; + g_string_append_c (buffer, (char) c); } /* --------------------------------------------------------------------------------------------- */ @@ -2163,14 +2154,15 @@ learn_key (void) fd_set Read_FD_Set; gint64 end_time; int c; - char buffer[256]; - char *p = buffer; + GString *buffer; + + buffer = g_string_sized_new (16); tty_keypad (FALSE); /* disable interpreting keys by ncurses */ c = tty_lowlevel_getch (); while (c == -1) c = tty_lowlevel_getch (); /* Sanity check, should be unnecessary */ - learn_store_key (buffer, &p, c); + learn_store_key (buffer, c); end_time = g_get_monotonic_time () + LEARN_TIMEOUT * MC_USEC_PER_MSEC; @@ -2194,12 +2186,12 @@ learn_key (void) } if (c == -1) break; - learn_store_key (buffer, &p, c); + learn_store_key (buffer, c); } tty_keypad (TRUE); tty_nodelay (FALSE); - *p = '\0'; - return (buffer[0] != '\0' ? g_strdup (buffer) : NULL); + + return g_string_free (buffer, buffer->len == 0); #undef LEARN_TIMEOUT } diff --git a/lib/tty/keyxdef.c b/lib/tty/keyxdef.c index a496f67..4527161 100644 --- a/lib/tty/keyxdef.c +++ b/lib/tty/keyxdef.c @@ -3,7 +3,7 @@ /* Additional keyboard support routines. - Copyright (C) 1998-2023 + Copyright (C) 1998-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/tty/mouse.c b/lib/tty/mouse.c index cf42287..574e349 100644 --- a/lib/tty/mouse.c +++ b/lib/tty/mouse.c @@ -1,7 +1,7 @@ /* Mouse managing - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/tty/tty-internal.c b/lib/tty/tty-internal.c index c79301d..4693235 100644 --- a/lib/tty/tty-internal.c +++ b/lib/tty/tty-internal.c @@ -1,7 +1,7 @@ /* Internal stuff of the terminal controlling library. - Copyright (C) 2019-2023 + Copyright (C) 2019-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/tty/tty-ncurses.c b/lib/tty/tty-ncurses.c index 08f663d..fa503da 100644 --- a/lib/tty/tty-ncurses.c +++ b/lib/tty/tty-ncurses.c @@ -2,7 +2,7 @@ Interface to the terminal controlling library. Ncurses wrapper. - Copyright (C) 2005-2023 + Copyright (C) 2005-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/tty/tty-slang.c b/lib/tty/tty-slang.c index 3aa74de..752825b 100644 --- a/lib/tty/tty-slang.c +++ b/lib/tty/tty-slang.c @@ -2,7 +2,7 @@ Interface to the terminal controlling library. Slang wrapper. - Copyright (C) 2005-2023 + Copyright (C) 2005-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/tty/tty.c b/lib/tty/tty.c index cae0a05..55ba0e9 100644 --- a/lib/tty/tty.c +++ b/lib/tty/tty.c @@ -1,7 +1,7 @@ /* Interface to the terminal controlling library. - Copyright (C) 2005-2023 + Copyright (C) 2005-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/tty/win.c b/lib/tty/win.c index 45451a4..5ac8a5a 100644 --- a/lib/tty/win.c +++ b/lib/tty/win.c @@ -1,7 +1,7 @@ /* Terminal management xterm and rxvt support - Copyright (C) 1995-2023 + Copyright (C) 1995-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/tty/x11conn.c b/lib/tty/x11conn.c index 20e201b..dfd6454 100644 --- a/lib/tty/x11conn.c +++ b/lib/tty/x11conn.c @@ -1,7 +1,7 @@ /* X11 support for the Midnight Commander. - Copyright (C) 2005-2023 + Copyright (C) 2005-2024 Free Software Foundation, Inc. Written by: @@ -1,7 +1,7 @@ /* Various utilities - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Written by: @@ -256,6 +256,9 @@ name_quote (const char *s, gboolean quote_percent) { GString *ret; + if (s == NULL || *s == '\0') + return NULL; + ret = g_string_sized_new (64); if (*s == '-') @@ -305,7 +308,7 @@ name_quote (const char *s, gboolean quote_percent) g_string_append_c (ret, *s); } - return g_string_free (ret, FALSE); + return g_string_free (ret, ret->len == 0); } /* --------------------------------------------------------------------------------------------- */ @@ -314,7 +317,8 @@ char * fake_name_quote (const char *s, gboolean quote_percent) { (void) quote_percent; - return g_strdup (s); + + return (s == NULL || *s == '\0' ? NULL : g_strdup (s)); } /* --------------------------------------------------------------------------------------------- */ @@ -887,6 +891,11 @@ get_compression_type (int fd, const char *name) && magic[2] == 'Z' && magic[3] == 'M' && magic[4] == 'A' && magic[5] == 0x00) return COMPRESSION_LZMA; + /* LZO format - \x89\x4c\x5a\x4f\x00\x0d\x0a\x1a\x0a lzop compressed data */ + if (magic[0] == 0x89 && magic[1] == 0x4c && + magic[2] == 0x5a && magic[3] == 0x4f && magic[4] == 0x00 && magic[5] == 0x0d) + return COMPRESSION_LZO; + /* XZ compression magic */ if (magic[0] == 0xFD && magic[1] == 0x37 @@ -926,6 +935,8 @@ decompress_extension (int type) return "/ulz4" VFS_PATH_URL_DELIMITER; case COMPRESSION_LZMA: return "/ulzma" VFS_PATH_URL_DELIMITER; + case COMPRESSION_LZO: + return "/ulzo" VFS_PATH_URL_DELIMITER; case COMPRESSION_XZ: return "/uxz" VFS_PATH_URL_DELIMITER; case COMPRESSION_ZSTD: @@ -84,6 +84,7 @@ enum compression_type COMPRESSION_LZIP, COMPRESSION_LZ4, COMPRESSION_LZMA, + COMPRESSION_LZO, COMPRESSION_XZ, COMPRESSION_ZSTD, }; diff --git a/lib/utilunix.c b/lib/utilunix.c index 42e0f6d..e652e51 100644 --- a/lib/utilunix.c +++ b/lib/utilunix.c @@ -1,7 +1,7 @@ /* Various utilities - Unix variants - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/vfs/Makefile.in b/lib/vfs/Makefile.in index bf588f9..91ac02a 100644 --- a/lib/vfs/Makefile.in +++ b/lib/vfs/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/lib/vfs/direntry.c b/lib/vfs/direntry.c index 32b8594..5f9a8ef 100644 --- a/lib/vfs/direntry.c +++ b/lib/vfs/direntry.c @@ -1,7 +1,7 @@ /* Directory cache support - Copyright (C) 1998-2023 + Copyright (C) 1998-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/vfs/gc.c b/lib/vfs/gc.c index 0914b75..6c5deb0 100644 --- a/lib/vfs/gc.c +++ b/lib/vfs/gc.c @@ -1,7 +1,7 @@ /* Virtual File System garbage collection code - Copyright (C) 2003-2023 + Copyright (C) 2003-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/vfs/interface.c b/lib/vfs/interface.c index 1b2de26..545dd1d 100644 --- a/lib/vfs/interface.c +++ b/lib/vfs/interface.c @@ -1,7 +1,7 @@ /* Virtual File System: interface functions - Copyright (C) 2011-2023 + Copyright (C) 2011-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/vfs/netutil.c b/lib/vfs/netutil.c index 1306879..3f31d46 100644 --- a/lib/vfs/netutil.c +++ b/lib/vfs/netutil.c @@ -1,7 +1,7 @@ /* Network utilities for the Midnight Commander Virtual 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/lib/vfs/parse_ls_vga.c b/lib/vfs/parse_ls_vga.c index 779792f..dcb82be 100644 --- a/lib/vfs/parse_ls_vga.c +++ b/lib/vfs/parse_ls_vga.c @@ -1,7 +1,7 @@ /* Routines for parsing output from the 'ls' command. - Copyright (C) 1988-2023 + Copyright (C) 1988-2024 Free Software Foundation, Inc. Copyright (C) 1995, 1996 Miguel de Icaza @@ -49,7 +49,7 @@ /*** file scope macro definitions ****************************************************************/ -/* Parsing code is used by ftpfs, fish and extfs */ +/* Parsing code is used by ftpfs, shell and extfs */ #define MAXCOLS 30 /*** file scope type declarations ****************************************************************/ diff --git a/lib/vfs/path.c b/lib/vfs/path.c index c599e25..85faa9a 100644 --- a/lib/vfs/path.c +++ b/lib/vfs/path.c @@ -1,7 +1,7 @@ /* Virtual File System path handlers - Copyright (C) 2011-2023 + Copyright (C) 2011-2024 Free Software Foundation, Inc. Written by: @@ -546,13 +546,12 @@ vfs_path_tokens_add_class_info (const vfs_path_element_t * element, GString * re g_string_append (ret_tokens, VFS_PATH_URL_DELIMITER); url_str = vfs_path_build_url_params_str (element, TRUE); - if (url_str->len != 0) + if (url_str != NULL) { g_string_append_len (ret_tokens, url_str->str, url_str->len); g_string_append_c (ret_tokens, PATH_SEP); + g_string_free (url_str, TRUE); } - - g_string_free (url_str, TRUE); } #ifdef HAVE_CHARSET @@ -663,13 +662,12 @@ vfs_path_to_str_flags (const vfs_path_t * vpath, int elements_count, vfs_path_fl g_string_append (buffer, VFS_PATH_URL_DELIMITER); url_str = vfs_path_build_url_params_str (element, !(flags & VPF_STRIP_PASSWORD)); - if (url_str->len != 0) + if (url_str != NULL) { g_string_append_len (buffer, url_str->str, url_str->len); g_string_append_c (buffer, PATH_SEP); + g_string_free (url_str, TRUE); } - - g_string_free (url_str, TRUE); } #ifdef HAVE_CHARSET @@ -1514,7 +1512,7 @@ vfs_path_vtokens_get (const vfs_path_t * vpath, ssize_t start_position, ssize_t * @param element path element * @param keep_password TRUE or FALSE * - * @return newly allocated string + * @return newly allocated non-empty string or NULL */ GString * @@ -1553,7 +1551,11 @@ vfs_path_build_url_params_str (const vfs_path_element_t * element, gboolean keep g_string_append_printf (buffer, "%d", element->port); } - return buffer; + if (buffer->len != 0) + return buffer; + + g_string_free (buffer, TRUE); + return NULL; } /* --------------------------------------------------------------------------------------------- */ @@ -1574,14 +1576,16 @@ vfs_path_element_build_pretty_path_str (const vfs_path_element_t * element) g_string_append (pretty_path, VFS_PATH_URL_DELIMITER); url_params = vfs_path_build_url_params_str (element, FALSE); - g_string_append_len (pretty_path, url_params->str, url_params->len); - g_string_free (url_params, TRUE); + if (url_params != NULL) + { + g_string_append_len (pretty_path, url_params->str, url_params->len); + g_string_free (url_params, TRUE); + } if (!IS_PATH_SEP (*element->path)) g_string_append_c (pretty_path, PATH_SEP); - g_string_append (pretty_path, element->path); - return pretty_path; + return g_string_append (pretty_path, element->path); } /* --------------------------------------------------------------------------------------------- */ diff --git a/lib/vfs/utilvfs.c b/lib/vfs/utilvfs.c index 162eb4c..0356832 100644 --- a/lib/vfs/utilvfs.c +++ b/lib/vfs/utilvfs.c @@ -1,7 +1,7 @@ /* Utilities for VFS modules. - Copyright (C) 1988-2023 + Copyright (C) 1988-2024 Free Software Foundation, Inc. Copyright (C) 1995, 1996 Miguel de Icaza diff --git a/lib/vfs/vfs.c b/lib/vfs/vfs.c index ad57189..18d15ed 100644 --- a/lib/vfs/vfs.c +++ b/lib/vfs/vfs.c @@ -1,7 +1,7 @@ /* Virtual File System switch code - Copyright (C) 1995-2023 + Copyright (C) 1995-2024 Free Software Foundation, Inc. Written by: 1995 Miguel de Icaza diff --git a/lib/vfs/vfs.h b/lib/vfs/vfs.h index ee78ff5..260e8f3 100644 --- a/lib/vfs/vfs.h +++ b/lib/vfs/vfs.h @@ -68,7 +68,7 @@ #endif #ifdef EREMOTEIO -#define E_REMOTE EREMOTEIO /* if other side of ftp/fish reports error */ +#define E_REMOTE EREMOTEIO /* if other side of ftp/shell reports error */ #else #define E_REMOTE ENETUNREACH /* :-( there's no EREMOTEIO on some systems */ #endif @@ -133,7 +133,7 @@ typedef struct vfs_class { const char *name; /* "FIles over SHell" */ vfs_flags_t flags; - const char *prefix; /* "fish:" */ + const char *prefix; /* "shell:" */ int verrno; /* can't use errno because glibc2 might define errno as function */ gboolean flush; /* if set to TRUE, invalidate directory cache */ FILE *logfile; diff --git a/lib/vfs/xdirentry.h b/lib/vfs/xdirentry.h index e1244cb..9424658 100644 --- a/lib/vfs/xdirentry.h +++ b/lib/vfs/xdirentry.h @@ -109,7 +109,7 @@ typedef struct } vfs_file_handler_t; /* - * One of our subclasses (tar, cpio, fish, ftpfs) with data and methods. + * One of our subclasses (tar, cpio, shell, ftpfs) with data and methods. * Extends vfs_class. */ struct vfs_s_subclass diff --git a/lib/widget/Makefile.in b/lib/widget/Makefile.in index 9353dec..85b2493 100644 --- a/lib/widget/Makefile.in +++ b/lib/widget/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/lib/widget/background.c b/lib/widget/background.c index 1965dee..afea825 100644 --- a/lib/widget/background.c +++ b/lib/widget/background.c @@ -1,7 +1,7 @@ /* Widgets for the Midnight Commander - Copyright (C) 2020-2023 + Copyright (C) 2020-2024 The Free Software Foundation, Inc. Authors: diff --git a/lib/widget/button.c b/lib/widget/button.c index 9f0bfa5..2cdaafc 100644 --- a/lib/widget/button.c +++ b/lib/widget/button.c @@ -1,7 +1,7 @@ /* Widgets for the Midnight Commander - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Authors: diff --git a/lib/widget/buttonbar.c b/lib/widget/buttonbar.c index 4522000..24e4f75 100644 --- a/lib/widget/buttonbar.c +++ b/lib/widget/buttonbar.c @@ -1,7 +1,7 @@ /* Widgets for the Midnight Commander - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Authors: diff --git a/lib/widget/check.c b/lib/widget/check.c index 63c55e3..b77573e 100644 --- a/lib/widget/check.c +++ b/lib/widget/check.c @@ -1,7 +1,7 @@ /* Widgets for the Midnight Commander - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Authors: diff --git a/lib/widget/dialog-switch.c b/lib/widget/dialog-switch.c index 959cbf9..74aedff 100644 --- a/lib/widget/dialog-switch.c +++ b/lib/widget/dialog-switch.c @@ -3,7 +3,7 @@ Original idea and code: Oleg "Olegarch" Konovalov <olegarch@linuxinside.com> - Copyright (C) 2009-2023 + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by: diff --git a/lib/widget/dialog.c b/lib/widget/dialog.c index 3ab2191..2596857 100644 --- a/lib/widget/dialog.c +++ b/lib/widget/dialog.c @@ -1,7 +1,7 @@ /* Dialog box features module for the Midnight Commander - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. This file is part of the Midnight Commander. @@ -83,7 +83,7 @@ dlg_default_get_colors (const Widget * w) /* --------------------------------------------------------------------------------------------- */ /** - * Read histories from the ${XDG_CACHE_HOME}/mc/history file + * Read histories from the ${XDG_DATA_HOME}/mc/history file */ static void dlg_read_history (WDialog * h) @@ -122,6 +122,16 @@ refresh_cmd (void) /* --------------------------------------------------------------------------------------------- */ +static void +dlg_help (const WDialog * h) +{ + ev_help_t event_data = { NULL, h->help_ctx }; + + mc_event_raise (MCEVENT_GROUP_CORE, "help", &event_data); +} + +/* --------------------------------------------------------------------------------------------- */ + static cb_ret_t dlg_execute_cmd (WDialog * h, long command) { @@ -152,10 +162,7 @@ dlg_execute_cmd (WDialog * h, long command) break; case CK_Help: - { - ev_help_t event_data = { NULL, h->help_ctx }; - mc_event_raise (MCEVENT_GROUP_CORE, "help", &event_data); - } + dlg_help (h); break; case CK_Suspend: @@ -571,7 +578,7 @@ dlg_run (WDialog * h) /* --------------------------------------------------------------------------------------------- */ /** - * Write history to the ${XDG_CACHE_HOME}/mc/history file + * Write history to the ${XDG_DATA_HOME}/mc/history file */ void dlg_save_history (WDialog * h) diff --git a/lib/widget/frame.c b/lib/widget/frame.c index 31127ab..127649e 100644 --- a/lib/widget/frame.c +++ b/lib/widget/frame.c @@ -1,7 +1,7 @@ /* Widgets for the Midnight Commander - Copyright (C) 2020-2023 + Copyright (C) 2020-2024 The Free Software Foundation, Inc. Authors: diff --git a/lib/widget/gauge.c b/lib/widget/gauge.c index 5eebb11..14b5fa8 100644 --- a/lib/widget/gauge.c +++ b/lib/widget/gauge.c @@ -1,7 +1,7 @@ /* Widgets for the Midnight Commander - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Authors: diff --git a/lib/widget/group.c b/lib/widget/group.c index eb6ba1e..f1a170c 100644 --- a/lib/widget/group.c +++ b/lib/widget/group.c @@ -1,7 +1,7 @@ /* Widget group features module for the Midnight Commander - Copyright (C) 2020-2023 + Copyright (C) 2020-2024 The Free Software Foundation, Inc. Written by: diff --git a/lib/widget/groupbox.c b/lib/widget/groupbox.c index 49cf7b0..4f6a021 100644 --- a/lib/widget/groupbox.c +++ b/lib/widget/groupbox.c @@ -1,7 +1,7 @@ /* Widgets for the Midnight Commander - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Authors: diff --git a/lib/widget/history.c b/lib/widget/history.c index 8197db8..7076d13 100644 --- a/lib/widget/history.c +++ b/lib/widget/history.c @@ -1,7 +1,7 @@ /* Widgets for the Midnight Commander - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Authors: diff --git a/lib/widget/hline.c b/lib/widget/hline.c index 73e261a..0f77a84 100644 --- a/lib/widget/hline.c +++ b/lib/widget/hline.c @@ -1,7 +1,7 @@ /* Widgets for the Midnight Commander - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Authors: diff --git a/lib/widget/input.c b/lib/widget/input.c index 3a67b49..a7ad7f5 100644 --- a/lib/widget/input.c +++ b/lib/widget/input.c @@ -1,7 +1,7 @@ /* Widgets for the Midnight Commander - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Authors: diff --git a/lib/widget/input_complete.c b/lib/widget/input_complete.c index 94a4c3b..bc44115 100644 --- a/lib/widget/input_complete.c +++ b/lib/widget/input_complete.c @@ -2,7 +2,7 @@ Input line filename/username/hostname/variable/command completion. (Let mc type for you...) - Copyright (C) 1995-2023 + Copyright (C) 1995-2024 Free Software Foundation, Inc. Written by: @@ -98,7 +98,6 @@ static char **hosts = NULL; static char **hosts_p = NULL; static int hosts_alloclen = 0; -static int complete_height, complete_width; static WInput *input; static int min_end; static int start = 0; @@ -1275,11 +1274,9 @@ complete_engine (WInput * in, int what_to_do) input = in; min_end = end; - complete_height = h; - complete_width = w; complete_dlg = - dlg_create (TRUE, y, x, complete_height, complete_width, WPOS_KEEP_DEFAULT, TRUE, + dlg_create (TRUE, y, x, h, w, WPOS_KEEP_DEFAULT, TRUE, dialog_colors, complete_callback, NULL, "[Completion]", NULL); complete_list = listbox_new (1, 1, h - 2, w - 2, FALSE, NULL); group_add_widget (GROUP (complete_dlg), complete_list); diff --git a/lib/widget/label.c b/lib/widget/label.c index 5a04a0f..4cde190 100644 --- a/lib/widget/label.c +++ b/lib/widget/label.c @@ -1,7 +1,7 @@ /* Widgets for the Midnight Commander - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Authors: diff --git a/lib/widget/listbox-window.c b/lib/widget/listbox-window.c index 47d7f8b..7cad872 100644 --- a/lib/widget/listbox-window.c +++ b/lib/widget/listbox-window.c @@ -1,7 +1,7 @@ /* Widget based utility functions. - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Authors: diff --git a/lib/widget/listbox.c b/lib/widget/listbox.c index 9f25487..76f07ad 100644 --- a/lib/widget/listbox.c +++ b/lib/widget/listbox.c @@ -1,7 +1,7 @@ /* Widgets for the Midnight Commander - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Authors: diff --git a/lib/widget/menu.c b/lib/widget/menu.c index 4a30c02..b27c4c3 100644 --- a/lib/widget/menu.c +++ b/lib/widget/menu.c @@ -1,7 +1,7 @@ /* Pulldown menu code - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Written by: @@ -530,6 +530,24 @@ menubar_try_exec_menu (WMenuBar * menubar, int hotkey) /* --------------------------------------------------------------------------------------------- */ +static void +menubar_help (const WMenuBar * menubar) +{ + ev_help_t event_data; + + event_data.filename = NULL; + + if (menubar->is_dropped) + event_data.node = MENU (g_list_nth_data (menubar->menu, menubar->current))->help_node; + else + event_data.node = "[Menu Bar]"; + + mc_event_raise (MCEVENT_GROUP_CORE, "help", &event_data); + menubar_draw (menubar); +} + +/* --------------------------------------------------------------------------------------------- */ + static cb_ret_t menubar_execute_cmd (WMenuBar * menubar, long command) { @@ -538,18 +556,7 @@ menubar_execute_cmd (WMenuBar * menubar, long command) switch (command) { case CK_Help: - { - ev_help_t event_data = { NULL, NULL }; - - if (menubar->is_dropped) - event_data.node = - MENU (g_list_nth_data (menubar->menu, menubar->current))->help_node; - else - event_data.node = "[Menu Bar]"; - - mc_event_raise (MCEVENT_GROUP_CORE, "help", &event_data); - menubar_draw (menubar); - } + menubar_help (menubar); break; case CK_Left: diff --git a/lib/widget/mouse.c b/lib/widget/mouse.c index 15ad5f5..2183903 100644 --- a/lib/widget/mouse.c +++ b/lib/widget/mouse.c @@ -1,7 +1,7 @@ /* Widgets for the Midnight Commander - Copyright (C) 2016-2023 + Copyright (C) 2016-2024 Free Software Foundation, Inc. Authors: diff --git a/lib/widget/quick.c b/lib/widget/quick.c index 35f5d68..3a6d165 100644 --- a/lib/widget/quick.c +++ b/lib/widget/quick.c @@ -1,7 +1,7 @@ /* Widget based utility functions. - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Authors: diff --git a/lib/widget/radio.c b/lib/widget/radio.c index 8fb52d8..94463f6 100644 --- a/lib/widget/radio.c +++ b/lib/widget/radio.c @@ -1,7 +1,7 @@ /* Widgets for the Midnight Commander - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Authors: diff --git a/lib/widget/rect.c b/lib/widget/rect.c index 34ae8b0..8c2d464 100644 --- a/lib/widget/rect.c +++ b/lib/widget/rect.c @@ -1,6 +1,6 @@ /* Rectangular class for Midnight Commander widgets - Copyright (C) 2020-2023 + Copyright (C) 2020-2024 The Free Software Foundation, Inc. Written by: diff --git a/lib/widget/widget-common.c b/lib/widget/widget-common.c index 821b7b3..459de10 100644 --- a/lib/widget/widget-common.c +++ b/lib/widget/widget-common.c @@ -1,7 +1,7 @@ /* Widgets for the Midnight Commander - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Authors: diff --git a/lib/widget/wtools.c b/lib/widget/wtools.c index a4af4b5..d1df8da 100644 --- a/lib/widget/wtools.c +++ b/lib/widget/wtools.c @@ -1,7 +1,7 @@ /* Widget based utility functions. - Copyright (C) 1994-2023 + Copyright (C) 1994-2024 Free Software Foundation, Inc. Authors: |