Commit Graph

6531 Commits

Author SHA1 Message Date
Andrew Borodin 8223f82857 tar: refactoring of archive reading.
Make it close to GNU tar imlementation.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-05-01 13:02:57 +03:00
Andrew Borodin 4158824d70 (tar_read_header): move entry/inode creation to new function tar_insert_entry(). 2023-05-01 13:02:57 +03:00
Andrew Borodin c35dfc3363 tar: use separate structure to store various file info.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-05-01 13:02:57 +03:00
Andrew Borodin d4d0fe6019 (tar_read_header): minor optimization.
Calculate length of file and link name if that is really needed.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-05-01 13:02:42 +03:00
Andrew Borodin d4ded63724 (tar_read_header): rename variable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-04-23 20:51:57 +03:00
Andrew Borodin 07a0aa352d (tar_find_next_block): rename from tar_get_next_block.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-04-23 20:51:57 +03:00
Andrew Borodin 3ed39fb883 src/vfs/tar/tar.c: remove period from error messages.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-04-23 20:51:56 +03:00
Andrew Borodin 3a9524979c (tar_read_header): rename variables.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-04-23 20:51:56 +03:00
Andrew Borodin 96ebde8d68 (tar_get_next_block): use file descriptor from archive descriptor.
(tar_skip_n_records): likewise.
(tar_read_header): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-04-23 20:51:56 +03:00
Andrew Borodin 74c16acf6a (tar_open_archive_int): return status of tar archive open
... instead of file descriptor.

(tar_open_archive): remove variable stored file descriptor. Use file
descriptor from archive descriptor.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-04-23 20:51:56 +03:00
Andrew Borodin 35e548b054 src/vfs/tar/tar.c: clarify support of OLDGNU format.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-04-23 20:51:56 +03:00
Andrew Borodin d647914bfb (tar_decode_header): do not decode size here.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-04-23 20:51:56 +03:00
Andrew Borodin 78a25f7800 Ticket #1952: tar: support long file names in archive.
Initial changeset: tar.c: update code to be close to GNU tar.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-04-23 20:49:41 +03:00
Andrew Borodin 49624e473b Ticket #4450: support PCRE2 in the search engine.
* m4.include/ax_path_lib_pcre.m4: replace by recent version from GNU
Autoconf Archive.
  * m4.include/ax_check_pcre2.m4: get grom GNU Autoconf Archive.
  * m4.include/mc-check-search-type.m4: support both PCRE versions.
  * */*/Makefile.am: remove @CHECK_CFLAGS@ and @PCRE_LIBS@ ads they are
added via AX_PATH_LIB_PCRE and AX_CHECK_PCRE2.
  * lib/search.h, lib/search/: add support of PCRE2. Thanks broly <gagan@hotmail.com>
for the initial patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-25 10:07:41 +03:00
Andrew Borodin a286f042d4 (edit_find_editor): rename from find_editor.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin c157b048e5 Listbox window: rename functions.
create_listbox_window -> listbox_window_new
create_listbox_window_centered -> listbox_window_new_centered
run_listbox -> listbox_run
run_listbox_with_data -> listbox_run_with_data

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin d9383ba8b3 (buttonbar_find): rename from find_buttonbar.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin fd2d5b49ac Menu: rename functions.
menu_entry_create -> menu_entry_new
menu_separator_create -> menu_separator_new
create_menu -> menu_new
destroy_menu -> menu_free
find_menubar -> menubar_find

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin a242e8b91f (advanced_chown_cmd): use intermediate variables to make text more readable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin 79c8a351ba Use mc_fgetflags() and mc_fsetflags() where needed.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin 2a6580127a VFS: mc_fgetflags, mc_fsetflags: new APIs.
(mc_fgetflags): fgetflags(3) VFS wrapper.
(mc_fsetflags): fsetflags(3) VFS wrapper.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin 50f4717f45 Minor optimization of chown/chmod/chattr operations.
(try_chmod): create filename when required.
(try_chown): likewise.
(try_advanced_chown): likewise.
(try_chattr): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin 6329771fc0 (operate_single_file): clarify creation of file operation UI.
Create UI to show confirmation dialog in case of foreground operation
regardless of ENABLE_BACKGROUND.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin 8a951746b3 Collect all editor options to structure.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin d2b9454f4b Add EDIT and CONST_EDIT macros.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin 683122482b usermenu: clarify compilation w/o internal editor.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andreas Mohr de1edb72f8 src/editor/spell.c: add missed #include.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin 7257f794d2 Update template for .c files.
Add section for forward declarations of local functions. This section is
located before file scope variables because functions can be used in
strucutres (see find.c for example):

/*** forward declarations (file scope functions) *************************************************/

/* button callbacks */
static int start_stop (WButton * button, int action);
static int find_do_view_file (WButton * button, int action);
static int find_do_edit_file (WButton * button, int action);

/*** file scope variables ************************************************************************/

static struct
{
    ...
    bcback_fn callback;
} fbuts[] =
{
    ...
    { B_STOP, NORMAL_BUTTON, N_("S&uspend"), 0, 0, NULL, start_stop },
    ...
    { B_VIEW, NORMAL_BUTTON, N_("&View - F3"), 0, 0, NULL, find_do_view_file },
    { B_VIEW, NORMAL_BUTTON, N_("&Edit - F4"), 0, 0, NULL, find_do_edit_file }
};

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin e1ff8d94e4 (do_search): remove intermediate variable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin c7f9329dcb (do_search): get rid of string duplication.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin 584fb9815c Change WDialog::data from void* to union{void*, int}
...to use data of type other than pointer w/o extra type cast.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin c5466cd494 Don't create an empty string in WLabel objects.
* (simple_status_msg_init_cb): pass NULL instead of "" to label_new()
    to get rid of an empty string duplication.
  * (advanced_chown_dlg_create): likewise.
  * (chown_dlg_create): likewise.
  * (dirsize_status_init_cb): likewise.
  * (file_op_context_create_ui): likewise.
  * (setup_gui): likewise.
  * (init_hotlist): likewise.
  * (init_learn): likewise.
  * (file_progress_show_source): pass NULL instead of "" to
    label_set_text() to get rid of an empty string duplication.
  * (file_progress_show_target): likewise.
  * (create_file_manager): pass NULL instead of 0 to label_new().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin e472f23c13 Don't NULLify objects by returned value of g_ptr_array_free().
g_ptr_array_free(obj, ...) returns a pointer (including NULL) to
obj->pdata, not to obj.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin 000c1f18e6 src/vfs/tar/tar.c: reorder routines.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin ea93350506 (tar_decode_header): use offsetof().
Sync with GNU tar b8feb2b14247d76200fd53607d3613c82b6e5b81.

Access header->buffer + offsetof (struct posix_header, magic), instead
of header->header.magic, when reading or writing the OLDGNU_MAGIC
pattern. The code violates the C standard without this change, and GCC
warns about this if fortify checking is enabled. It's not a bug on
traditional (i.e., non-debugging) platforms, but it does violate the C
standard so it should be fixed. Problem originally reported by John
Emil Karlson in
<http://lists.gnu.org/archive/html/bug-tar/2010-04/msg00023.html>.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin 4a17f02b21 (tar_skip_n_records): change type of n to off_t.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin 4ae197e788 (tar_checksum): sync with GNU tar b5db9788306d45cd9432fda71236f07b8a214212.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin c4e20d3176 src/vfs/tar/tar.c: rename header read status and values.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin 8ce58eab7b src/vfs/tar/tar.c: reorder includes; add <sys/stat.h>.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin a15b91b030 src/vfs/tar/tar.c: clean up.
Sync with GNU tar 33b63ebe94b8a2dc2cb8fb907d8b7c16591b05bc.

(struct extra_header): Removed unused structure.
(union block.extra_header): Removed unused member.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin 8fdcbeed74 Move definition of file_entry_t to separate file.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin cf223bec27 Use g_ptr_array_new_with_free_func() where reasonably.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin 273fbd2afe mceditor: editbuffer: use g_ptr_array_new_full() to create text buffers.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin 29f513cf58 File operations: get file operation from the file operation context descriptor.
* (file_mask_dialog): get file operation from the file operation context
descriptor.
  * (do_confirm_copy_move): likewise.
  * (operate_single_file): likewise.
  * (operate_one_file): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin f25895280b (panel_operate): change type of save_cwd and save_dest to vfs_path_t
...to get rid of extra type conversions and memory allocations.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin 3364b5772c Ticket #4426: code clean up before 4.8.30 release.
(panel_do_set_filter): fix indentation.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Michal Sojka d71a9cd43a Ticket #3121: don't clear subshell prompt during its reading.
When using zsh with starship.rs prompt generator, MC sometimes fails
to show the subshell prompt. This is not deterministic. Sometimes the
prompt is shown and sometimes it isn't.

The reason is that the shell prints the prompt in multiple chunks. The
first chunk contains the "real" prompt and the second is an escape
sequence for enabling bracketed paste mode. If both chunks are read by
MC in a single invocation of read_subshell_prompt(), the prompt is
shown correctly. If, however, read_subshell_prompt() reads each chunk
in separate invocations (because the second chunk is not ready during
the first invocation), the prompt is not shown. More precisely, only
the bracketed paste mode escape sequence is shown as a prompt in MC.

This can be demonstrated with the following commands:

    export SHELL=$(which zsh)
    export ZDOTDIR=/tmp/zshdotdir
    export STARSHIP_CONFIG=/tmp/starship-test.toml
    mkdir -p "$ZDOTDIR"
    echo 'eval "$(starship init zsh)"' > "$ZDOTDIR/.zshrc"
    echo 'format = "XXXX: $directory$character"' > "$STARSHIP_CONFIG"
    mc

In my case, the prompt is usualy shown after mc start and it
disappears after changing a directory in mc. In that case, the prompt
is read() in the following two chunks:

- 63 bytes: \xd\x1b[0m\x1b[27m\x1b[24m\x1b[J\xd\xaXXXX: \x1b[1;36mmc/.git\x1b[0m \x1b[1;32m\xe2\x9d\xaf\x1b[0m \x1b[K
- 8 bytes: \x1b[?2004h

To fix the problem, we remove clearing of the prompt string in
read_subshell_prompt(). It is sufficient that the prompt is cleared
when receiving '\n' and in feed_subshell().

Signed-off-by: Michal Sojka <michal.sojka@cvut.cz>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:27:25 +03:00
Andrew Borodin 7e04a57b87 Ticket #4408: incorrect redraw of overlapped file panels.
Revert "(panel_operate): update panel content before screen refresh."

This reverts commit 6623a9014f.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-12 10:14:13 +03:00
Andrew Borodin b4bb352bfa Ticket #4235: fix find file with relative ignore directory.
If start directory of find files matches to the relative ignore
directory, nothing is found.

(do_search): the start directory is the first one in the directory
stack. Do not apply ignore_dir to it.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-05 19:51:50 +03:00
Pavel Roskin 44c299c784 Ticket #4446: mcedit: fix off-by-one error in paragraph formatting code.
The default margin is 72 characters, but the editor would keep 73 character
long lines without breaking them.

The visual length of strings was calculated incorrectly. The way "for" loop
was implemented, the byte length would be incremented before exiting the
loop. That would correspond to a character that doesn't fit the line.

Increment the byte length in a separate statement.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-02-20 21:36:37 +03:00
Andrew Borodin e14ebea59f Ticket #4370: file panelization improvement.
Previously, both file panels share panelization results.
Now each file panel has own panelization buffer.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-02-19 19:00:59 +03:00
Andrew Borodin cce50e5bff Ticket #4432: wrong sort order after swapping panels.
Revert "(swap_panels): swap panel sort modes too."

This reverts commit d07abec4c3.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-02-01 20:55:28 +03:00
Andrew Borodin 3937f97d96 Ticket #4437: (file_frmt_time): fix time format.
Change minutes and seconds delimiter: h:mm.ss -> h:mm:ss.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin 08c2d4e276 (load_extension_file): make one-line long error messages multi-line.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Robert Yang 6123946251 extfs helpers: replace "perl -w" with "use warnings" (closes MidnightCommander/mc#174).
The shebang's max length is usually 128 as defined in
/usr/include/linux/binfmts.h:
  #define BINPRM_BUF_SIZE 128

To get around this, '/usr/bin/env perl' in place of @PERL@ can be used, but
'/usr/bin/env perl -w' doesn't work:

/usr/bin/env: perl -w: No such file or directory

So replace "perl -w" with "use warnings" to make it work.

The man2hlp.in already has "use warnings;", so just removing '-w' is OK.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2023-01-28 21:38:05 +03:00
Andrew Borodin 70599156db (do_find): use dir_list_append() to create file list for panelization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andreas Mohr 606bd02945 (do_find): remove unused variable.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Kian-Meng Ang 5001232704 Fix various typos in the source code (closes MidnightCommander/mc#177).
Found via `codespell -S
po,doc,./misc/syntax,./src/vfs/extfs/helpers/README.it -L
parm,rouge,sav,ect,vie,te,dum,clen,wee,dynamc,childs,ths,fo,nin,unx,nd,iif,iterm,ser,makrs,wil`

Co-authored-by: Yury V. Zaytsev <yury@shurup.com>
Signed-off-by: Kian-Meng Ang <kianmeng@cpan.org>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2023-01-28 21:38:05 +03:00
Andrew Borodin 990200f6d3 (panel_destroy): don't free file list.
That is already done in panel_clean_dir().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin 0b19bda4a1 (search_content): use g_get_monotonic_time() instead of g_get_real_time().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin 58afbbe1ce (extfs_get_plugins): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin 7cd8e513dd (edit_read_syntax_rules): trivial refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin dc7dd7ae03 mcedit (syntax): minor optimization.
Use GString for syntax keywords to calculate keyword length at once
when syntax file is being parsed.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin a01b391029 src/filemanager/panelize.c: use GSList to hold panelize entries.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin da4212c150 External panelize: rename functions:
external_panelize -> external_panelize_cmd
load_panelize -> external_panelize_load
save_panelize -> external_panelize_save
done_panelize -> external_panelize_free
init_panelize -> external_panelize_init
panelize_done -> external_panelize_done

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin 177d1a780c External panelize: refactoring:
*  src/filemanager/panelize.[ch]: keep function related to the external
  panelize command only. Functions related to the panelized mode of file
  panel move to panel.[ch]. Clean up includes.

  * rename functions:
  cd_panelize_cmd -> panel_panelize_cd
  panelize_change_root -> panel_panelize_change_root
  panelize_absolutize_if_needed -> panel_panelize_absolutize_if_needed
  panelize_save_panel -> panel_panelize_save

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin 57c61b7681 Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin c62d651ee3 Replace variable: global_profile_name -> mc_global_t::profile_name.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin e7d081565d (edit_read_syntax_file): rename variable and reduce scope.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin 52ab57dca0 (sftpfs_read_known_hosts): display the unknown host key type in hex.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin 9f6ef611f4 (ftpfs_setup_passive_epsv): join tests.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin e2521d2187 (do_subshell_chdir): trivial refactoring.
Change tests to place short branches before long ones.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin e42012d51e FISH: refactoring.
* fish_super_t::scr_env: change type to GString.
  * (fish_set_env): return GString, rename variable.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin ab897e4ca6 (vfs_path_element_build_pretty_path_str): return GString.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin b3dd7cfe60 (find_parameters): use vfs_path_len().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin f114af83c8 (edit_find_filter): refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin 41ed8c13ee (edit_insert_stream): refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin 7031508550 (command_completion_function): don't call canonicalize_pathname()
...because mc_build_filename() makes that.

(etags_set_definition_hash): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin 328d27ccf1 Ticket #4426: code clean up before 4.8.30 release.
(sftpfs_cb_open): minor optimization.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin e254656c48 Ticket #4434: mc.ext.ini: 'Edit' command from 'Default' section is ingored.
(regex_command_for): execute the required action from the 'Default'
section if this action is not specified in the found section.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-23 20:27:01 +03:00
Andrew Borodin b2ffac752f Ticket #4427: extfs: "Inconsistent archive" error for valid RPM.
(extfs_read_archive): fix condition to display message "Inconsistent archive".

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-15 10:47:19 +03:00
Andrew Borodin 9962abd701 (extfs_read_archive): show error message.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-07 09:27:54 +03:00
Jindrich Novy 69ed5696f2 Ticket #4422: extfs: segfault if archive contains file(s) in the parent directory.
zip archive can contain files outside archive root:

$ unzip -l tmp.zip
Archive:  tmp.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2023-01-04 19:43   a
        0  2023-01-04 19:43   b
        0  2023-01-04 19:43   ../c
        0  2023-01-04 19:43   ../../d
---------                     -------
        0                     4 files

Enter into such archive leads to a segfault.

(extfs_find_entry_int): fix possible NULL dereference. The result of this
fix is an impossibility to enter into such archive.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-07 09:27:24 +03:00
Andrew Borodin 3f882f50e0 Ticket #4413: mcedit: syntax definitions in user location don't work.
Fix location of all user's syntax related stuff. Now it is the
~/.local/share/mc/syntax/ directory.

Don't use the system configuration directory (/etc/mc) as a storage
of syntax definitions.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-12-18 14:20:36 +03:00
Andrew Borodin 1ac5c22517 Ticket #3121: empty subshell/command line prompt.
If subshell is initializing more than 1 second - we have no subshell.

(feed_subshell): change timeout to 10 secons. I belive that is more than
enough time to run subshell.

Thanks Alexandr Zamaraev (aka Tonal) <tonal.promsoft@gmail.com> and
antonio_so <sozonnik@gmail.com> for finding out the cause of the
problem.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-11-26 14:21:55 +03:00
Andrew Borodin a72ede698e Ticket #3220: fix directory comparision in panelized panel.
Directory comparision expects only file names in both panels.
In panelized panel, files named can contain paths:

| boxes.c   | 43220|| 1/boxes.c   | 43220|
| boxes.h   | 1429 || 1/boxes.h   |  1429|
|           |      || boxes.c     | 43220|
|           |      || boxes.h     |  1429|

Even if boxes.c and 1/boxes.c files are the same, they are marked as
different because strings "boxes.c" and "1/boxes.c" are different.

The solution: for panelized panel, ignore path and use file name only
(like output of basename(3)) for comparision.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-11-14 20:59:05 +03:00
Andrew Borodin 30f9309b8a Ticket 4409: continue copy after interrupt.
(copy_file_file): add button "Continue copy" to query dialog "Incomplete
file was retrieved".
(file_ui_op_dlg_callback): callback for copy/move progess dialog.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-15 21:14:35 +03:00
Andrew Borodin 47b116b773 mc_search: refactoring.
(mc_search_t): use GString to keep original search string. Join search string
and charset to structure.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-10 21:07:40 +03:00
Andrew Borodin f778c86e4d Revert "(extfs_open_archive): fix NULL dereferences."
This reverts commit 0df10f488b.

g_strconcat() accepts NULL after non-NULL arguments.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-10 21:07:40 +03:00
Andrew Borodin 116b6a616a (fish_dir_load): move `ls -l` output parser to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-10 21:07:40 +03:00
Ovsyannikov Sergey E 3e7424a95a FTP fixes.
* (parse_ls_line): fix get of file GID.
  * (ftpfs_parse_long_list_MLSD): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-10 21:07:40 +03:00
Ovsyannikov Sergey E 21c45e8a7a Cosmetics: add spaces around slash in statistics messages.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-10 21:07:40 +03:00
Andrew Borodin bb3ace13f1 Enlarge subshell PTY buffer.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-10 21:07:40 +03:00
Andrew Borodin a7833b5b2e (real_warn_same_file): truncate file names if required.
If file name is too long, message window is wider than screen.
Truncate file name to fit it in the screen.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-10 21:07:40 +03:00
Andrew Borodin facf199f65 (fish_free_archive): check socket before close.
Find by Coverity.
Coverity id #313668.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-10 21:07:40 +03:00
Andrew Borodin c441250beb mcviewer: move.c: fix coding style. 2022-10-10 21:07:40 +03:00
Andrew Borodin fba3d47408 mcviewer: internal.h: fix coding style. 2022-10-10 21:07:40 +03:00
Andrew Borodin 72f5211327 (check_dir_is_empty): clarify description.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-09 14:02:19 +03:00
Andrew Borodin d4d6cec52d Ticket #4364: FISH VFS: cannot remove non-empty directory.
Revert "(check_dir_is_empty): minor optimization."

This reverts commit 25e419ba08.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-02 11:13:17 +03:00
Andrew Borodin d9eeec9a5a Port mc.ext to INI format.
Ticket #2773: 'include' keyword (for command class def) have no effect
if it was defined before 'Include' keyword (for command def).

Ticket #3742: update comment in mc.ext.ini.

doc: remove mc.ext.ini format description from manual page.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-09-25 14:55:00 +03:00
Andrew Borodin 1cb66b82bd (regex_command_for): move load of extension file to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-28 11:10:39 +03:00
Andrew Borodin 67ec86b570 Ticket #4141: allow compound (AND) conditions in mc.ext
...to disambiguate overloaded extensions

Initial commit:
  * rename macro for mc.ext file: MC_FILEBIND_FILE -> MC_EXT_FILE.
  * (ext_cmd): fix errorous usage of MC_LIB_EXT macro. Use MC_EXT_FILE
    instead.
  * (regex_command_for): likewise. Use already existing variable
    extension_file, remove variable filebind_filename.
  * MC_LIB_EXT: remove macro.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-28 11:10:39 +03:00
Michael Schuster a1f22e104d Ticket #4401: Segmentation fault in mcviewer.
* (mcview_growbuf_read_until): the previous call to mcview_show_error()
   invalidates sp by freeing view->ds_stdio_pipe. Reintroduce the check
   that was removed in a68f2d1202 but take
   sp's invalidity into account.

 * (mc_pclose): add a NULL pointer check to play safe.

Signed-off-by: Michael Schuster <michael@schuster.ms>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-20 19:33:12 +03:00
Sergei Trofimovich 6b67d231a2 Ticket #4399: configure.ac: introduce PERL_FOR_BUILD
Most of mc uses of PERL is to embed path to the interpreter in VFS
helpers. There we can use path to perl for --host. But
`date-of-man-include.am` is the place where perl is used for --build.

On most systems both paths are expected to be /usr/bin/perl.
But on some systems paths might differ a bit. Most prominent
example is NixOS, where packages get installed into unique prefixes:

$ file /nix/store/...-perl-5.36.0/bin/perl \
       /nix/store/...-perl-powerpc64-unknown-linux-gnu-5.36.0/bin/perl
/nix/store/...-perl-5.36.0/bin/perl:
  ELF 64-bit LSB executable, x86-64, version 1 (SYSV), ...
/nix/store/...-perl-powerpc64-unknown-linux-gnu-5.36.0/bin/perl:
  ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, ...

This allows running both binaries via qemu-user if needed for tests.

The change introduces PERL_FOR_BUILD (similar to autoconf's CC_FOR_BUILD
and friends) to allow passing both PERLs when needed.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-20 08:26:24 +03:00
Andrew Borodin ff26ce85f8 Ticket #4398: crash on quick view of archives.
* (extfs_cmd): make message null-terminated.
  * (sfs_vfmake): likewise.
  * (do_external_panelize): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-14 17:57:08 +03:00
Andrew Borodin 36abab7186 Clarify checks of input line content returned from quick dialog.
If quick dialog is finished with value other than B_CANCEL,
string value of input line isn't NULL.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-04 11:19:16 +03:00
Andrew Borodin 79645187c6 (input_get_ctext): mew API.
Use it instead of direct access to WInput's buffer.

(handle_cmdline_enter): additional minor refactoring.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-04 11:17:29 +03:00
Andrew Borodin 318315399b Ticket #4397: sort in editor without arguments stopped working.
* (input_get_text): never return NULL. If buffer is empty, return an
empty allocated string.
  * (input_push_history): use new input_get_text.
  * (find_parameters): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-04 11:09:42 +03:00
sxmboer2 cca4c46d05 (edit_delete_macro): do not resort macros after deleting one
...because g_array_remove_index() keeps the array sorted.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-07-27 19:22:05 +03:00
sxmboer2 01c3c56140 Ticket #4391: fix infinite loop when deleting an mceditor macro.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-07-27 19:22:05 +03:00
Andrew Borodin 6ea06c9845 Ticket #4381: missing selection of some files.
When files are selected keeping the right mouse button pressed,
some files are not selected.

  * Add new macros for mouse pointer location relative to file list.
  * (mark_if_marking): select/unselect all files between previous
    selected file and new one.
  * (panel_mouse_is_on_item): return clarified value of mouse pointer location.
  * (panel_mouse_callback): modify mouse drag event handling in accordance with
    the mouse pointer location relatively to the file list.

Also fixes ticket #4119: "Cannot scroll panel listing upwards using mouse".

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-07-27 19:10:16 +03:00
Andrew Borodin cd47b158ac Ticket #4373: restore menu accelerator for "Sort order" item.
Menu according for "Sort order" item was changed in
d19b247c6d in order to fix shotrcut
conflict. Restore it back according to user requests.

óhange accelerator for "SFTP link" from S to N.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-07-11 19:44:43 +03:00
Andrew Borodin debabe561a "file" utility: use -b option if available.
* configure.ac: test if "file" utility has -b option.
  * (regex_check_type): don't compare file names if "file -b" is used.
Reduce variable scope. Rename variable.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-26 20:03:47 +03:00
Andrew Borodin 0bb9c04720 Ticket #4377: file type check does not work with special character in filename.
Initial commit: clarify usage of "file" utility.

  * (get_popen_information): compile conditionally depending on USE_FILE_CMD
macro.
  * (get_file_type_local): likewise.
  * (get_file_encoding_local): likewise.
  * (regex_check_type): likewise.
  * (regex_command_for): ignore type method if file utiliti isn't used.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-26 19:57:37 +03:00
Andrew Borodin 1b93bae611 src/filemanager/dir.c: minor sort optimization.
Get rid of sort condition double check.

Condition

    ad == bd || panels_options.mix_all_files

was checked twice: first in sort_xxx(), then in sort_name() called in
sort_xxx().

Now this condition is checked in sort_xxx() only.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin c7af7f0bbd (edit_sort_cmd): clarify hint for Sort command.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin bae55d637a (ftpfs_setup_active): clarify handling of getnameinfo() errors.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin 798f6e87b3 (ftpfs_initconn): clarify errno setup.
Handle errors of bind(), getsockname(), and listen() calls.
Return if one of these functions fails and setup errno to indicate the
cause of the error.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin 03cef1bb6f ftpfs.c: variable ftpfs_errno is assigned but never used.
Use me->verrno directly instead.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin 556cf2274d (ftpfs_dir_load): fix building of remote path.
Call of mc_build_filename(remote_path, ".") is pointless
because the path canonicalization is performed and trailing
"/." is removed.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin ebb328353e (vfs_s_subclass::dir_load): constify argument.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:44 +03:00
Andrew Borodin 5f746eea0c mceditor: minor refactoring of file load.
(edit_load_file_from_filename): make public, use it as main function to
load file and create editor window.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:56:32 +03:00
Andrew Borodin 12543835f9 (edit_init): change argument for coordinates.
Use WRect instead of four values.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:56:31 +03:00
Andrew Borodin 533b2076dd (edit_add_window): change argument for coordinates.
Use WRect instead of four values.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:55:06 +03:00
Andrew Borodin caf41457c6 (widget_adjust_position): change argument for coordinates.
Use WRect instead of four values.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:55:06 +03:00
Andrew Borodin 390d614b5e (group_init): change argument for coordinates.
Use WRect instead of four values.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:55:06 +03:00
Andrew Borodin ccdc909105 (widget_init): change argument for coordinates.
Use WRect instead of four values.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:55:03 +03:00
Andrew Borodin 2759d080cf Viewer: use WRect to hold position and size of various areas.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:52:14 +03:00
Andrew Borodin aac258e44e (rect_grow): new API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:50:19 +03:00
Andrew Borodin 5fae2313f3 Widget: use WRect to hold position and size.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:49:20 +03:00
Andrew Borodin ed65694caa quick_dlg: use WRect to hold dialog position and size.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:37:04 +03:00
Andrew Borodin bf0dd8efb1 WInput: use GString for buffer.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:28:51 +03:00
Andrew Borodin f91d894f9b (input_get_text): new API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:26:37 +03:00
Andrew Borodin 50f08e2194 (find_parameters): duplicate path when that is really needed.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:23:37 +03:00
Andrew Borodin 88754d040f mcviewer: reimplement coordinate cache using GPtrArray.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:23:37 +03:00
Andrew Borodin 12d976eb6f src/viewer/coord_cache.c: clean up and minor refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:23:15 +03:00
Andrew Borodin 6f048314b1 (mcview_handle_key): fix variable name.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:22:46 +03:00
Andrew Borodin 03ae9ff24a Ticket #4357: code clean up before 4.8.29 release.
(set_prompt_string): use mc_g_string_dup().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:21:22 +03:00
Andrew Borodin db109be8a2 Ticket #4374: fix file sort by version.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-05-23 20:56:31 +03:00
Andrew Borodin 81d57da867 Ticket #3670: ftp: reconnect if server terminated connection.
(ftpfs_init_data_socket): handle return value of
getpeername()/getsockname() and try to reconnect to FTP server
for 10 attempts in case of error.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-05-22 11:33:24 +03:00
Eric Roberts 4667618e68 Ticket #4372: fish commands don't work after window resize.
How to reproduce:
  start mc (with fish as your shell);
  resize mc window;
  type any command in the command prompt, for example, "ls";
  result: nothing happens;
  type the same command again;
  it works now, the second time.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-05-14 09:13:59 +03:00
Andrew Borodin a92b6781b8 Load and save filter parameters.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-04-10 17:45:57 +03:00
Andrew Borodin a705b67288 Implement more option for panel filter:
"Files only", "Case sensitive", and "Using shell patterns".

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-04-10 17:45:56 +03:00
Andrew Borodin f20f5cc5cb Rename panel_select_flags_t -> select_flags_t.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-04-10 17:44:26 +03:00
Andrew Borodin 63e870867e Handle CK_Filter command in the file panel level.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-04-10 17:43:44 +03:00
Andrew Borodin 450993fff6 Add macros for select/unselect histories.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-04-10 17:43:44 +03:00
Andrew Borodin 45073a9d29 (panel_select_unselect_files_dialog): show error message if pattern is malformed.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-04-10 17:43:42 +03:00
Andrew Borodin 733f7ce54b Ticket #1373: add more options to "Filter" dialog window.
The main idea is apply same options for file filter as for file
selection and use the same dialog window.

Initial commit: refactoring: move creation of the file selection dialog
to the separate function.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-04-10 17:42:39 +03:00
Andreas Mohr 1bdf814052 (mc_setup_by_args): reduce variable scope into #ifdef to fix coverity finding.
Found by Coverity.
Coverity id #331837

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin 5b4ec9b033 (translate_file): refactoring.
Allocate buffer only if charset converter is created successfully.
g_string_free() returns NULL if second argument is TRUE. Use that to get
rig of 'if' statement.
Reduce variable scope.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin a6c142ed48 (get_random_hint): refactoring.
g_string_free() returns NULL if second argument is TRUE. Use that to get
rig of 'if' statement.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin 4518885f93 (dir_list_load): rename argument: fltr -> filter.
(dir_list_reload): likewise.
(handle_dirent): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin 2101026d4c (show_version): display version of libssh2.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin bb42ed706c (sftpfs_read_known_hosts): clarify displayed value of unknown host key type.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin f0924b954d (file_mask_dialog): refactoring: get rid of goto.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andreas Mohr 2087ede32d (file_mask_dialog): NULLify variables before use in next iteration.
Found by Coverity.
Coverity id #331828
Coverity id #331850

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin 9f53bf5617 Include <stddef.h> where ptrdiff_t is used.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:26 +03:00
Andrew Borodin 2c205c5928 Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:26 +03:00
Andreas Mohr 9489b5edc4 Remove unused macros.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:23 +03:00
Andrew Borodin ca24b1d136 (ftpfs_check_proxy): read mc.no_proxy file once only.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:23 +03:00
Andrew Borodin d07abec4c3 (swap_panels): swap panel sort modes too.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:23 +03:00
Andrew Borodin d8b9589224 Ticket #4326: iso9660: fix isoinfo check.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-01-09 18:17:24 +03:00
Andrew Borodin 529c7d70dd src/editor/editwidget.c: grammar.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin 19591c4475 mceditor: use MB_LEN_MAX constant.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin a147082c73 (string_file_name): use mc_g_string_copy.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin 4e8b00f003 Use g_get_monotonic_time() instead of g_get_real_time().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin 31008bcc8e (learn_key): return NULL if buffer is empty.
(learn_button): simplify tests: seq is never empty here.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin a4adc09509 (file_mask_dialog): indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin eefc7c1275 (copy_file_file_display_progress): rename argument to make it clearer.
(copy_file_file): rename variable to make it clearer.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin e8e3204e61 (copy_file_file): don't call g_get_real_time() twice...
in case of successful copying of file content.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin bb1ab8488b (copy_file_file_display_progress): don't calculate BPS twice.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin 78df2f5b56 (progress_update_one): don't call g_get_real_time() twice at first time.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin 437211791f file operations: use g_get_real_time() instead of gettimeofday().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin d04abc5a76 sftpfs: refactoring.
Merge init.c, vfs_class.c, and vfs_subclass.c to sftpfs.c.
Rename files:
    init.h -> sftpfs.h.
Rename variables:
    sftpfs_class -> vfs_sftpfs_class.
Rename functions:
    sftpfs_cb_is_equal_connection -> sftpfs_archive_same
    sftpfs_cb_init_connection -> sftpfs_new_archive
    sftpfs_cb_open_connection -> sftpfs_open_archive
    sftpfs_cb_close_connection ->  sftpfs_free_archive
to be consistent with other VFSes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin 4fce4fa7c3 sftpfs: trivial optimization.
* (sftpfs_opendir): call sftpfs_fix_filename() before loop.
  * (sftpfs_mkdir): likewise.
  * (sftpfs_rmdir): likewise.
  * (sftpfs_open_file): likewise.
  * (sftpfs_stat_init): likewise.
  * (sftpfs_readlink): likewise.
  * (sftpfs_utime): likewise.
  * (sftpfs_chmod): likewise.
  * (sftpfs_unlink): likewise.
  * (sftpfs_rename): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin 6623a9014f (panel_operate): update panel content before screen refresh.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:33 +03:00
Andrew Borodin 022c3d2f94 Refactoring of file operations.
(copy_cmd, copy_cmd_local, rename_cmd, rename_cmd_local, delete_cmd,
delete_cmd_local): move same code to panel_operate(), make inline.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 14:57:43 +03:00
Andrew Borodin d410af27c0 (start_search): ret rid of extra screen redraw.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 14:57:43 +03:00
Andrew Borodin cac689a81a Get rid of extra update of mini info.
(stop_search): don't update mini info if quick search is incative.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 14:57:43 +03:00
Andrew Borodin d19b247c6d Ticket #4384: fix accelerator conflict in Left/Right menu.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 14:57:43 +03:00
Andrew Borodin a3d323c6b3 Ticket #3887: (handle_console_linux): fix endianness bug.
handle_console_linux() passes the address of action to write() and intends
to send one byte of data (the LSB). On LE this works, but one BE machines
this sends the MSB which is always zero. Fix this by assigning the value
first to a char type, and use that instead.

Thanks Sven Schnelle <svens@stackframe.org> for the original patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 14:49:46 +03:00
Andrew Borodin f1e2f0e93d Ticket #4150: support file/dir macros for standalone mcviewer.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-10-31 09:49:45 +03:00
Andrew Borodin 8b79bfe32d (free_erase_list): test queue before free.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-10-02 11:41:07 +03:00
Andrew Borodin 89d8fa4ac1 Ticket #1: remove SMB suport.
The mc's built-in samba library which is used to access data across
smb links is taken from an old samba version.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-09-26 10:03:49 +03:00
Andrew Borodin c3ba19b422 (sftpfs_chmod): set permissions only, don't touch other attributes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-09-11 20:34:21 +03:00
Andrew Borodin 8e5f8255e1 Ticket #4285: sftp: timestamps are not preserved for uploaded symlink.
* (sftpfs_symlink): don't call sftpfs_fix_filename() for target file
    bacause it breaks symlink: relative symlinks became an absolute one.
  * (sftpfs_utime): set timestamps only, don't touch other attributes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-09-11 20:24:30 +03:00
Andrew Borodin 399f25fe9f Ticket #4281: fish upload: symbolic link along with its target.
fish/utime: use `touch -h` to change the times of the link itself
rather than the file that the link points to. -h implies -c
and thus will not create any new files.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-09-11 09:37:55 +03:00
Andrew Borodin 1b39025049 Ticket #4287: file move across filesystems is slow.
src/filemanager/file.c: reimplement erase_list using GQueue instead of
GSlist to get rid of walk each time through the whole linked list.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-09-05 11:39:42 +03:00
Andrew Borodin e7bbf72544 Ticket #4200: fix FTBFS with ncurses build with --disable-widec.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-08-28 11:46:53 +03:00
Sergey Larin 2234fd8357 Ticket #4269: (edit_close_cmd): fix use-after-free.
The old 'w' pointer became invalid after widget_destroy() call, so we need
to get the new widget directly after find_editor.

Found using PVS-Studio 7.14 with intermodular analysis mode.

Signed-off-by: Sergey Larin <cerg2010cerg2010@mail.ru>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-08-09 21:29:23 +03:00
Andrew Borodin 9235d3c232 SFTPFS: verify server fingerprint (fix CVE-2021-36370).
Use ~/.ssh/known_hosts file to verify server fingerprint
using ssh way:

$ ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ED25519 key fingerprint is SHA256:FzqKTNTroFuNUj1wUzSeV2x/1lpcESnT0ZRCmq5H6o8.
Are you sure you want to continue connecting (yes/no)? no
ssh: Host key verification failed.

$ ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ED25519 key fingerprint is SHA256:FzqKTNTroFuNUj1wUzSeV2x/1lpcESnT0ZRCmq5H6o8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (ED25519) to the list of known hosts.
andrew@localhost's password:

Thanks the Curl project for the used code.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury.zaytsev@moneymeets.com>
2021-07-26 20:34:17 +03:00
Andrew Borodin fdd6706245 (sftpfs_open_connection): handle EAGAIN for libssh2_session_handshake().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-07-26 20:34:17 +03:00
Andrew Borodin b0450a1e18 Ticket #4259: SFTPFS VFS: verify server fingerprint (CVE-2021-36370).
This vulnerability was discovered by AUT-milCERT during an audit of open
source software.

Initial changeset: set minimal version of libssh2 to 1.2.8.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-07-26 20:33:48 +03:00
m_ok 36e48b04bd Ticket #4260: ftpfs: the month of file is always January.
(parse_ls_line): fix test of vfs_parse_month() value.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-07-13 21:32:35 +03:00
Eric Roberts e89713a3d6 Ticket #4198: MC hangs on start randomly with zsh as subshell.
The bug happens because MC tells the shell to perform a "cd" command,
and waits indefinitely for the command to complete. If the shell, for
some reason, cannot complete the "cd" command, MC just freezes
indefinitely.

This patch removes all instances of MC waiting indefinitely for "cd"
commands. Now, if the shell freezes while doing a "cd", MC will timeout
after 1 second, and just set the subshell state to ACTIVE. If the user
tries to run a command, they will get the error "The shell is already
running a command".

Some other stuff where MC waits on the shell if an error occurred is
also simplified.

In feed_subshell(), the timeout time is changed from 10 seconds to
1 second. Ten seconds seemed like far too long to wait.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-07-04 19:06:28 +03:00
Andrew Borodin 0e6721c32b Ticket #4213: workaround to avoid crash on FreeBSD.
Previous fix 443a8106f1
makes the command line inaccessible if mc runs with
disabled subshell (mc -u).

This commit fixes the command line.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-07-03 18:59:38 +03:00
Andrew Borodin 7ef1925a98 (render_edit_text): fix endless loop.
Thanks Sebastian Gniazdowski <sgniazdowski@gmail.com> for the issue.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-27 15:02:49 +03:00
Andrew Borodin eb58d94341 src/filemanager/mountlist.c: recognize fuse.portal as dummy file system.
Sync with gnulib 9a38d499ca16f2f4304992eb1ab0894cd0b478e1.

Add "fuse.portal" as a dummy file system (used in flatpak
implementations).

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:46 +03:00
Andrew Borodin 25e419ba08 (check_dir_is_empty): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin 437994eb80 (do_move_dir_dir): remove unused variable.
Variable calc_total is set but isn't read.

Found by Andreas Mohr <and@gmx.li>.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin 106d95229f (sftpfs_open_file): don't destroy file handler here.
Fix Coverity id #331814.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andreas Mohr 10c27b28a7 (load_group): fix use after free.
Found by Coverity.
Coverity id #331812.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andreas Mohr c15b752fbf (exec_extension): fix memory leak.
Found by Coverity.
Coverity id #331829.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andreas Mohr 4db80f3010 (dir_list_reload): fix resource leak.
Found by Coverity.
Coverity id #331809.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin 5b7b48e1db mcedit: move macros-related stuff to editmacros.[ch].
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin 0df10f488b (extfs_open_archive): fix NULL dereferences.
Fix passing NULL pointer "tmp" to g_strconcat().

Found by Coverity.
Coverity is #331840.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin 2d4008655e (exec_make_shell_string): simplify condition, reduce variable scope.
Fix Coverity id #331832.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin 69b8927ec9 (panel_recursive_cd_to_parent): fix memory leak.
Found by Coverity.
Coverity id #331846.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andreas Mohr 4070d7bee5 (apply_rules_going_right): fix deadcode.DeadStores warning.
syntax.c:523:25: warning: Value stored to 'found_right' is never read [deadcode.DeadStores]
                        found_right = TRUE;
                        ^             ~~~~

Found by Clang-11 analyzer.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andreas Mohr 337da4491d (edit_replace_cmd): fix deadcode.DeadStores warning.
editsearch.c:915:13: warning: Value stored to 'i' is never read [deadcode.DeadStores]
            i = edit->found_len = len;
            ^   ~~~~~~~~~~~~~~~~~~~~~

Found by Clang-11 analyzer.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andreas Mohr 9b752e3a2f (edit_draw_this_line): fix deadcode.DeadStores warning.
editdraw.c:536:5: warning: Value stored to 'color' is never read [deadcode.DeadStores]
    color = edit_get_syntax_color (edit, b - 1);
    ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found by Clang-11 analyzer.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin 22a7ef782d (edit_do_search): search descriptor should not be NULL.
Fix of Coverity id #110818.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin a7b8d00535 (background_attention): don't use bad file descriptor.
Found by Coverity.
Coverity id #32593.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin 830d6c2d48 (editcmd_dialog_raw_key_query): move to editcmd.c.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin b77961a14d mcedit: move all completion-related stuff to editcomplete.[ch].
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin 21eefb3e36 mcedit: move all etags-related stuff to tags.[ch].
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin 3a8f21166b (edit_buffer_find_word_start): rename from edit_find_word_start
...and move to editbuffer.c.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin 9094cdd1d3 mcedit: move content of choosesyntax.c to syntax.c.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin c6bdc7c1dc mcedit: move all spell-related stuff to spell.[ch].
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin 3b34936b9f mcedit: move all search&replace-related stuff to editsearch.[ch]. 2021-06-20 15:14:56 +03:00
Andrew Borodin 9d4eb459da (edit_search_cmd): clarify handling of NULL item of history.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin 7bc1b19676 (edit_search_cmd): get rid of code duplication.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin 21feb38a8d mcedit: refactoring of search.
(edit_search_init): new function: initialization of search handler.
(edit_search_deinit): new function: deinitialization of search handler.
(edit_replace_cmd): use edit_search_init().
(edit_search_cmd): likewise.
(editcmd_dialog_search_show): use edit_search_init() and
edit_search_deinit().
(edit_search_options): move definition from editcmd_dialogs.c to editsearch.c.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin 288fe62987 (mcview_continue_search_cmd): clarify handling of NULL item of history. 2021-06-20 15:14:56 +03:00
Andrew Borodin 6adcd57859 (mcview_continue_search_cmd): get rid of string duplication.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin 1fa327c5a1 (mcview_continue_search_cmd): get rid of code duplication.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin 65ca3da3b2 mcviewer: refactoring of search.
(mcview_search_init): new function: initialization of search handler.
(mcview_search_deinit): new function: deinitialization of search handler.
(mcview_dialog_search): use mcview_search_init() and mcview_search_deinit().
(mcview_continue_search_cmd): use mcview_search_init().
(mcview_dialog_search): use mcview_search_deinit().
(mcview_search_options) move definition from dialogs.c to search.c.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin 37b86b2781 (extfs_open_and_read_archive): fix NULL dereference in mc_plose().
Found by Coverity.
Coverity id #331765.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin 45a4d3f6d4 mcviewer: move content of inlines.h into internal.h.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin 91b7101e06 (DOZ): new macro: difference or zero.
Use DOZ where appropriate.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin d35df9ad60 Use argument names in function declarations.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin 721048161c (extfs_get_plugins): use is_exe().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin de16ae9180 Use G_OPTION_ENTRY_NULL macro.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin f657d92e52 (execute_menu_command): fix memory leak.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Fredrik Fornwall ded5d37ff0 MidnightCommander/#113: replace S_IWRITE with S_IWUSR.
S_IWRITE is an obsolete synonym provided for BSD compatibility.
It can be safely replaced with S_IWUSR.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin 558fb350f8 (tar_fill_stat): fix signedness change.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin 231c84caeb Widget: implement destroy callback.
(dlg_destroy): remove. Use widget_destroy() to destroy any dialog.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin e7fab254f9 Rename variable: midnight_dlg -> filemanager.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin 1e1cbb31d0 src/filemanager/chattr.c: minor refactoring.
(chattrboxes_new): create WChattrBoxes widget entirely.
(chattr_dlg_create): move creation of checkboxes to chattrboxes_new().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin ba890d9a92 (make_symlink): take paths as vfs_path_t objects
...to get rid of extra type conversions.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:56 +03:00
Andrew Borodin 6596185573 (sftpfs_fix_filename): return pointer to GString instead of pointer to char.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:55 +03:00
Andreas Mohr b71f66dbbd Fix const/unconst casts.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:55 +03:00
Andrew Borodin 0718ef89f7 man2hlp: limited support of \(lq, \(rq and \(dq commands.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:55 +03:00
Andrew Borodin c2a17d3a99 (repaint_file): remove mv argument.
mv is always the inversion of isstatus.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:55 +03:00
Andreas Mohr 8d84972533 (extfs_get_archive_name): fix -Wcast-qual warning.
extfs.c:799:24: warning: cast from 'const struct extfs_super_t *' to 'struct vfs_s_super *' drops const qualifier [-Wcast-qual]
        archive_name = VFS_SUPER (archive)->name;
                       ^
../../../lib/vfs/xdirentry.h:39:46: note: expanded from macro 'VFS_SUPER'
#define VFS_SUPER(a) ((struct vfs_s_super *) (a))
                                             ^

Found by Clang-11

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:55 +03:00
Andreas Mohr 108c465176 (overwrite_query_dialog): fix -Wcast-qual warnings.
filegui.c:531:19: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
    s1 = (char *) file_date (ui->src_stat->st_mtime);
                  ^
filegui.c:546:19: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
    s1 = (char *) file_date (ui->dst_stat->st_mtime);
                  ^

Found by Clang-11.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:55 +03:00
Andreas Mohr 34616d6444 src/filemanager/chattr.c: fix -Wcast-qual warnings.
chattr.c:398:34: warning: cast from 'const struct WChattrBoxes *' to 'struct WGroup *' drops const qualifier [-Wcast-qual]
    w = WIDGET (g_list_nth_data (GROUP (cb)->widgets, Id - cb->top));
                                 ^
../../lib/widget/group.h:16:29: note: expanded from macro 'GROUP'
#define GROUP(x) ((WGroup *)(x))
                            ^
chattr.c:515:27: warning: cast from 'const struct WChattrBoxes *' to 'struct WGroup *' drops const qualifier [-Wcast-qual]
    for (i = cb->top, l = GROUP (cb)->widgets; l != NULL; i++, l = g_list_next (l))
                          ^
../../lib/widget/group.h:16:29: note: expanded from macro 'GROUP'
#define GROUP(x) ((WGroup *)(x))
                            ^

Found by Clang-11

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 15:14:55 +03:00
Andrew Borodin 443a8106f1 Ticket #4213: workaround to avoid crash on FreeBSD.
In the read_subshell_prompt() (src/subshell/common.c:1546) the first
call of select() returns 0. Therefore subshell_prompt is NULL.
NULL dereference is the cause of crash.

This commit isn't a real fix but just a workaround.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 14:59:59 +03:00
Andrew Borodin 0cb6e97230 (execute_menu_command): get rid of code duplication.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-05-23 10:49:10 +03:00
Lukasz Krotowski 72d2fb981a Ticket #4242: %view fails to execute on no-exec tmp filesystem.
(execute_menu_command): use indirect execution of %view.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-05-23 10:49:10 +03:00