Commit Graph

6042 Commits

Author SHA1 Message Date
Andrew Borodin
d4cbed25cc (parse_ls_line): get rid of extra string duplication.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:02:12 +03:00
Andrew Borodin
804186bbd8 Add ftp long file list parser from lftp and modify it for MC VFS.
Based on lftp 62093f21348be405fdefbd10d4655a224f326153.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:02:12 +03:00
Andrew Borodin
9c7437bf48 etags: get rid of limitation of window width.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-13 20:35:56 +03:00
Andrew Borodin
451e1585a7 etags: get rid of limitation of definition length.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-13 20:35:56 +03:00
Andrew Borodin
ce05476057 etags: get rid of limitation of list length.
(etags_set_definition_hash): return GPtraArray.
(editcmd_dialog_select_definition_show): take GPtraArray.
(edit_get_match_keyword_cmd): sync with modified functions.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-13 20:35:56 +03:00
Andrew Borodin
f82d30e3e0 etags: fix memory leaks.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-13 20:35:56 +03:00
Andrew Borodin
68c9db0c17 (etags_hash_t): remove unused filename_len member.
Cleanup unused includes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-13 20:35:56 +03:00
Andrew Borodin
4a3cf4c6af Ticket #4132: clarify width of 'Find declaration' dialog.
Initial changeset:
src/editor/etags.[ch]: fix coding style.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-13 20:35:56 +03:00
Andrew Borodin
76847e08fd Ticket #4203: support custom .zshrc.
Custom .zshrc file is  ~/.local/share/mc/.zshrc.

If ZDOTDIR environment variable is not set, set it to ~/.local/share/mc
if a .zshrc is found there. It is the only way to point zsh to an other
rc file than the default.

Thanks Sebastian Gniazdowski <sgniazdowski@gmail.com> for the original
patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-13 20:17:31 +03:00
Sebastian Gniazdowski
360e9bec33 Ticket # 4207: (editcmd_dialog_select_definition_show): fix "Find declaration" disrupting file's path.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-28 16:50:39 +03:00
Andrew Borodin
1ed638d66c Ticket #4180: fix zip handling.
After 8857423e4e zip archives opened with
an error:

    file -L -z archive.zip: Bad system call

This caused by using /usr/bin/file with -z option, because seccomp (a
security sandbox) doesn't allow it..

Solution: use -S option together with -z one.

The file command accepts the -S option since 5.33.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-28 16:39:21 +03:00
Andrew Borodin
285eb5c186 Ticket #3682: drop automatic migration of configuration
...from ~/.mc to XDG-base.

Now MC ignores ~/.mc directory and uses XDG-based only.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-22 21:16:52 +03:00
Paul Sokolovsky
1d1dba440d Ticket #2020: filemanager/find.c: implement "Follow symlinks" option.
Add "Follow symlinks" checkbox. Default state is off (following
current hardcoded behavior).

Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-22 21:09:17 +03:00
Andrew Borodin
ba6b42802f Ticket #4154: support unrar v6.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-13 16:52:07 +03:00
Andrew Borodin
2420b7180b editor: completing from all open files.
Thanks Sebastian Gniazdowski <sgniazdowski@gmail.com> for the original
patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-07 20:37:36 +03:00
Andrew Borodin
3b476adcae editor: word completion: refactoring.
(edit_collect_completion_from_one_buffer): new function. Main loop of
completion searching is here now.

(edit_collect_completions): use edit_collect_completion_from_one_buffer().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-07 20:37:36 +03:00
Andrew Borodin
29720d04ab editor: word completion: refactoring.
(edit_collect_completions): return GQueue. Use GQueue inside.
Do not return an empty queue, create it if needed only.

(edit_complete_word_cmd): Use GQueue inside. Ged rid of limitation
of completions count. Rename variable.

(editcmd_dialog_completion_show): take GQueue. Rename and reorder
arguments.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-07 20:37:13 +03:00
Andrew Borodin
feca634073 Ticket #4160: mceditor: complete words from all open files.
Initial step: refactoring.

(edit_collect_completions_get_current_word): return GString. Get rid of
allocate and free an empty string, create string if needed instead.
Reduce variable scope.

(edit_collect_completions): related changes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-07 20:33:20 +03:00
Sebastian Gniazdowski
8177cdd0f1 Ticket #4171: fix usermenu and macro system() calls disrupting terminal.
(execute_menu_command): prepare terminal to run system() and restore
after.

(user_menu_cmd): fix comment.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-01-26 13:52:13 +03:00
Andrew Borodin
653961523c Ticket #4182: fix command line update.
(setup_cmdline): don't update command line if it's invisible.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-01-24 14:26:31 +03:00
Andrew Borodin
a88a626e76 Fix segfault on switch to subshell in mcedit/mcview/mcdiffview.
(do_update_prompt): fix NULL dereference. In case of running mc
as standalone editor/viewer/diffviewer, the subshell_prompt variable
is NULL.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-01-18 21:27:26 +03:00
Andrew Borodin
fd65a1654d (edit_store_macro_cmd): restore lost 'else'.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-01-05 08:27:42 +03:00
Andrew Borodin
5a45ed1583 Fix segfault on adding current path to hotlist.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-01-03 08:15:56 +03:00
Andrew Borodin
01ca2756e1 (tree_store_load_from): remove extra parenthesis.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andrew Borodin
1c8400d6ef (tree_store_load_from): fix copy-into-fixed-size-buffer warning.
Found by Coverity.
Coverity id #32616.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andrew Borodin
a17dd53c29 (create_panel): remove extra test of midnight_dlg.
midnight_dlg is never NULL in create_panel().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andreas Mohr
3cd408407d (edit_scroll_screen_over_cursor): fix copy-paste error.
Found by Coverity.
Coverity id #32566.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andreas Mohr
3114240921 (pipe_mail): fix unchecked return value warning.
If function failed, fail early.

Found by Coverity.
Coverity id #32538.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andreas Mohr
dfb81a3dae (edit_read_syntax_file): fix logically dead code.
Statement cannot be true at this state.

Found by Coverity.
Coverity id #32572.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andreas Mohr
68b803e5c4 (edit_suggest_current_word): the NULL check is unnecessary...
...because the pointer can't be NULL.

Found by Coverity.
Coverity id #313667.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andreas Mohr
ae244077af (edit_get_match_keyword_cmd): fix possible NULL dereference.
Found by Coverity.
Coverity id #32609.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andreas Mohr
a68f2d1202 (mcview_growbuf_read_until): the NULL check is unnecessary...
...because the pointer can't be NULL.

Found by Coverity.
Coverity id #110819.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andreas Mohr
f57e69ad29 (cpio_read_bin_head): fix unintended sign extension.
If c_filesizes[0] is greater than 0x7fff implicit sign extension will happen on bit shift.

Found by Coverity.
Coverity id #32611.
Coverity id #32612.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andrew Borodin
d37dbcca4c Move cd_to() to separate file.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andrew Borodin
344af14029 Refactoring: rename functions
_do_panel_cd -> panel_do_cd_int
do_panel_cd -> panel_do_cd
do_cd -> panel_cd
do_cd_command -> cd_to

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andrew Borodin
e3519f8966 (do_cd_command): refactoring: get path only
...instead of command "cd path".

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andrew Borodin
6f96cad1ca (examine_cd): return GString.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andrew Borodin
38fee964bc (copy_file_file): minor refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andreas Mohr
5f482396f6 (handle_console_linux): fix resource leak.
Handle open failure properly.

Found by Coverity.

Coverity id #32608.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andrew Borodin
35911c08e1 (do_background): fix yet another resource leak.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andreas Mohr
88b6c3e930 (do_background): fix resource leak.
Found by Coverity.

Coverity id #32606.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andreas Mohr
e7a4f0932d (search_content): fix uninitialized scalar variable.
Found by Coverity.

Coverity id #32628.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andreas Mohr
0281ba51b7 (tar_read_header): fix uninitialized scalar variable.
Found by Coverity.

Coverity id #32634.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andreas Mohr
7916e8e097 src/vfs/fish/fish.c: fix uninitialized scalar variable.
Found by Coverity.

Coverity id #32630.
Coverity id #164548.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andreas Mohr
a37a4eba73 src/vfs/extfs/extfs.c: fix uninitialized scalar variable.
Found by Coverity.

Coverity id #32627.
Coverity id #313665.
Covertiy id #313669.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andreas Mohr
57f5ab7c23 Add break before empty default in switch.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andrew Borodin
3d4d6dbb41 (advanced_chown_refresh): constify atgument.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andrew Borodin
819e0908f6 src/filemanager/ext.c: minor refactoring.
(exec_get_export_variables): return GString.
(exec_make_shell_string): likewise.
(exec_extension): exec_get_export_variables() and
exec_make_shell_string() retur GString now.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:46 +03:00
Andreas Mohr
a13c0a5e42 (hotlist_run_cmd): fix fallthrough annotation warning.
fallthrough annotation does not directly precede switch label.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:46 +03:00
Andrew Borodin
a358c8037d src/filemanager/mountlist.c: recognize more file system types as remote.
Sync with gnulib dd1fc46be12d671c1a9d9dc5a6fa8c766e99aa2f.

Sync "remote" file systems from stat.c in coreutils.
Note we only consider file systems that do not use host:resource
mount source.  I.e. those that don't generally use a colon when
mounting, as that case is already considered.  Searching for
"<fstype> /etc/fstab" was informative for identifying these.
The full list of "remote" file systems in coreutils is currently:
  acfs afs ceph cifs coda fhgfs fuseblk fusectl
  gfs gfs2 gpfs ibrix k-afs lustre novell nfs nfsd
  ocfs2 panfs prl_fs smb smb2 snfs vboxsf vmhgfs vxfs
Note also we do not include virtual machine file systems,
as even though they're remote to the current kernel,
they are generally not distributed to separate hosts.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:46 +03:00