Commit Graph

5823 Commits

Author SHA1 Message Date
Andrew Borodin
00d3b8a468 Sync with gnulib be9e66b37c948df517ee905b4a9689a50946409c.
mountlist: Remove support for SVR2.

* src/filemanager/mountlist.c: Remove MOUNTED_FREAD case.
* m4.include/gnulib/ls-mntd-fs.m4 (gl_LIST_MOUNTED_FILE_SYSTEMS): Don't
  define MOUNTED_FREAD.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-11-24 14:40:42 +03:00
Andrew Borodin
f992628ae5 (make_symlink): rename variable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-11-24 14:40:42 +03:00
Andrew Borodin
392df60bc1 (do_move_dir_dir): rename variables.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-11-24 14:40:42 +03:00
Andrew Borodin
2fdc186123 (copy_dir_dir): rename variables.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-11-24 14:40:42 +03:00
Andrew Borodin
db716c3c7a dir_list: fix memory leak when list is free'd.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-11-24 14:40:42 +03:00
Andrew Borodin
25a9aa1d45 Sync with gnulib f7a6286e04209da1bc7b1820002b6a5c32638369.
mountlist: Improve support for Solaris in 64-bit mode.

* m4.include/gnulib/ls-mntd-fs.m4 (gl_LIST_MOUNTED_FILE_SYSTEMS): On
  Solaris 8 or newer, define MOUNTED_GETEXTMNTENT instead of
  MOUNTED_GETMNTENT2.
* src/filemanager/mountlist.c: Add code for MOUNTED_GETEXTMNTENT case.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-11-24 14:40:42 +03:00
Andrew Borodin
6d593567d1 Sync with gnulib d1327df1f1c9bae26571e6699800c8d1c4712afb.
mountlist: Add support for Minix.

* m4.include/gnulib/ls-mntd-fs.m4 (gl_LIST_MOUNTED_FILE_SYSTEMS): Don't
  use AC_CHECK_FUNCS to check for 'getmntinfo'.
* src/filemanager/mountlist.c: Update comments.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-11-24 14:40:42 +03:00
Andrew Borodin
849bfb26f8 Sync with gnulib 74c29c68bba3fe7c2f02eb3fc9f7ef196cec1bc6.
mountlist: Modernize platform lists.

* m4.include/gnulib/ls-mntd-fs.m4: Clarify which MOUNTED_* symbol
  applies to which platforms, deemphasizing the obsolete ones.
* src/filemanager/filegui.c: Likewise.
* src/filemanager/mountlist.c: Likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-11-24 14:40:42 +03:00
Andrew Borodin
3b8ee664f2 src/background.c: clean up and fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-11-24 14:40:42 +03:00
Andrew Borodin
6d79aa7d5d (destroy_task_and_return_fd): rename to destroy_task.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-11-24 14:40:42 +03:00
Andrew Borodin
08136039b6 Ticket #3915: code clean up before 4.8.22 release.
(destroy_task_and_return_fd): fix access after free.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-11-24 14:40:42 +03:00
Andrew Borodin
071dbd9076 Ticket #3943: fix crash when switching from subshell.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-11-03 20:49:48 +03:00
Andrzej Pronobis
c5aaeda39c Ticket 3944: support user-defined prompt in the fish subshell.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-10-21 19:53:21 +03:00
Andrew Borodin
5dacf75cef Ticket #3937: fix crash when trying some sftp connections.
(sftpfs_recognize_auth_types): fix dereference of NULL returned by
libssh2_userauth_list().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-10-20 18:51:40 +03:00
Andrew Borodin
2c2e41c167 Handle hard link creation error.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-10-20 18:33:06 +03:00
Andrew Borodin
0f0dbc2b2e (file_error): allow show query dialog w/o Rerty action.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-10-20 18:33:06 +03:00
Andrew Borodin
022f15d9f0 (check_hardlinks): refactoring:
* use is_in_linklist() to search the hard link in cache;
  * reduce variable scopes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-10-20 18:33:06 +03:00
Andrew Borodin
c94cd7620d (is_in_linklist): refactoring: return pointer to found link.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-10-20 18:33:06 +03:00
Andrew Borodin
7c9e3817ce (check_hardlinks): make error message more verbose.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-10-20 18:33:06 +03:00
Andrew Borodin
7e5ee0e512 Ticket #3678: handle hardlink creation errors.
Initial step: (check_hardlinks): refactopring:
  * reorder and rename parameters;
  * check number of hard links here;
  * Do not fill struct with zero. Set up members explicitly instead.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-10-20 18:33:06 +03:00
Andrew Borodin
1fec6e9854 Partially revert "VFS: (vfs_s_subclass): make the derived class from vfs_class."
This reverts commit 5d1284c4a6.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-10 12:47:12 +03:00
Andrew Borodin
c7206191bc Revert "VFS: make VFS-specific super class as derived one from vfs_s_super."
This reverts commit ab033ad318.
2018-09-10 12:47:12 +03:00
Andrew Borodin
c91e3d5edb Revert "VFS: make VFS-specific file handler class the derived one from vfs_file_handler_t."
This reverts commit 2d58e4d624.
2018-09-10 12:47:12 +03:00
Andrew Borodin
b5a768200e src/subshell/common.c: fix #ifdef.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 20:39:12 +03:00
Andrew Borodin
a7ff88d24c (init_subshell): use openpty() to open master/slave devices for subshell.
Thanks Jesse R. Gorzinski <jgorzins@us.ibm.com> for the original patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
88d6157323 (vfs_preallocate): check mc_global.vfs.preallocate_space before call.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
357711da33 (filegui__check_attrs_on_fs): check copymove_persistent_attr before call.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
b684ce2565 Clarify usage of FL_NONE value.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
8cbb9cd1ac extfs: optimization: get rid of extra memory duplication.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
32687c9c4e (file_mask_dialog): don't return an empty string.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
0af1c270e2 (file_mask_dialog): grammar.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
42469e2016 (extfs_get_path): use standard VFS flags. 2018-09-09 19:10:43 +03:00
Andrew Borodin
a91323f7ac (extfs_find_entry): use standard VFS flags.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
01a00e7ce6 extfs: constify some function arguments.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
c29f068457 extfs: refactoring: rename structures...
to unify it with standard VFS ones.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
81945d32ce extfs: refactoring: rename some structure members...
to unify it with standard VFS structures.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
e86ba483c6 extfs: refactoring: struct inode: use struct stat instead of separate members.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
7f9fb38176 extfs: refactoring: use GSList to store archive list.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
2d58e4d624 VFS: make VFS-specific file handler class the derived one from vfs_file_handler_t.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
ab033ad318 VFS: make VFS-specific super class as derived one from vfs_s_super.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
5d1284c4a6 VFS: (vfs_s_subclass): make the derived class from vfs_class.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
86e9d85f21 (extfs_done): fix possible NULL dereference.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew Borodin
b9ea1b2a21 Ticket #3915: code clean up before 4.8.22 release.
(fish_chmod): fix argument type of "%o" format.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:42 +03:00
Jesse R. Gorzinski
4da6ea8db3 (feed_subshell): on IBM i, read(1) can return 0 for a non-closed fd.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 18:57:56 +03:00
Andrew Borodin
877b5a6add Find file: show pattern and content in the results window title.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 18:45:03 +03:00
Andrew Borodin
22e83bad08 src/filemanager/find.c: refactoring: optimize variable usages.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-04 10:36:13 +03:00
Andrew Borodin
953b7e9f23 Ticket #3924: Find file: remember state (empty or not) of Content field.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-04 10:20:44 +03:00
gray_-_wolf
0493a5e90e Ticket #1983: support BTRFS's file clone operation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-03 09:33:32 +03:00
Andrew Borodin
7ac669c654 Ticket: 3908: quiet single file overwrite.
If target file exists, MC overwrites that file without confirmation.

The bug has not been fixed comletely in
7d73ce1cbe.

Yet another test case:

1. Create files:

    mkdir -p test1/1 test2/1
    echo "1" > test1/1/file
    echo "2" > test2/1/file

2. Run `mc test1 test2`.
3. Select directory "1" and press F6.

Result: "file" file is overwritten w/o confirmation.

Expected result: since the "file" file exists the confirmation dialog
must be shown.

The problem is: confirmation dialog requires context UI which was not
created in case of single directory move/rename operation.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-07-28 17:21:24 +03:00
Andrew Borodin
f75430d68c (operate_one_file): remove unescape of source and destination filenames.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-07-01 20:00:36 +03:00
Andrew Borodin
aea06fbc7a Ticket #3923: fix of file name escaping in file operations.
Revert "(operate_single_file): make src and dest file name unescaping"

This reverts commit ef5d346dd9.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-06-30 11:33:49 +03:00
moko
5f603638de Ticket #3917: preserve atime/mtime over sftpfs.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-06-03 14:54:01 +03:00
Yury V. Zaytsev
b44bfee6bf Ticket #3789: remove faulty test in rpm helper to detect CONFLICTS tag
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2018-05-27 15:17:31 +02:00
Andrew Borodin
8f7d44ef7f Ticket #3914: %view not piping command output to internal viewer in user menu.
Revert "(execute_menu_command): fix mcview_viewer() call."
This reverts commit 2043ef74a9.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-05-07 09:07:37 +03:00
Andrew Borodin
34712ec05b Ticket #3913: implement safe file overwrite.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-04-25 11:36:10 +03:00
Andrew Borodin
7d73ce1cbe Ticket: 3908: quiet single file overwrite.
If target file exists, MC overwrites that file without confirmation.
The bug was introduced in #3149.

How to reproduce:
1. Create two files: `touch a aa`.
2. Stay on "aa".
3. Make sure that Options/Confirmation.../Overwrite option is checked on.
4. Press Shift-F6
5. Edit the "to:" value to "a" ("a" file exists) and press Enter.

Actual result:
The "a" file is overwritten w/o confirmation.

Expected result:
Since the "a" file exists the confirmation dialog must be shown.

The problem is: confirmation dialog requires context UI which was not
created in case of single file rename operation.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-04-07 13:13:53 +03:00
Adam Borowski
5eb9bd605e Ticket #3906: ZSTD support.
Signed-off-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-03-19 15:00:23 +03:00
Andrew Borodin
a2a63aa8c1 Ticket #3898: mcedit doesn't save all opened files.
(edit_quit): do not call widget_select() while direct iterating editor
windows because it changes the window position in Z order. Collect
modified files in separate list.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-12 21:11:56 +03:00
Andrew Borodin
c139ba72ae Ticket #3897: mcedit: broken extended key mode.
(edit_dialog_callback): do not reset the extended mode if command
was not handled.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-12 21:10:43 +03:00
Andrew V. Samoilov
de242255dc (edit_do_search): use gboolean. Remove unused computations.
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2018-02-04 11:30:23 +03:00
Andrew V. Samoilov
06eac9f17d (etags_set_definition_hash): make buf stack variable.
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2018-02-04 11:30:23 +03:00
Andrew Borodin
9b74ff8653 str_convert_to_input() never returns NULL.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
454e23d48f (edit_collect_completions): str_convert_to_display() never returns NULL.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
2a973f7a46 Use str_move() where possible.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
8b6f4ef2c2 Use gboolean instead of int in file/dir sort related functions.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
56081caaae (ftpfs_command): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
6d3d6c9b45 FTP: fix some calls of ftpfs_command().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
ec80df187c FISH: optimize creation of FISH commands.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
aafc77c8f9 src/vfs/fish/fish.c: allocate buffer for command dynamically.
Continue 53a1d52ed9.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew V. Samoilov
63d9fc6b0a smbfs: code cleanup
* (sys_select): fix }
  * (sys_open): commented out
  * (sys_random, sys_srandom): remove unused functions

Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2018-02-04 11:30:23 +03:00
Andrew V. Samoilov
f963a74a8e smbfs/helpers: comment out unused code.
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2018-02-04 11:30:23 +03:00
Andrew V. Samoilov
a02c353ab9 smbfs/helpers: Comment/remove unused code. Reduce .data
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2018-02-04 11:30:23 +03:00
Andrew V. Samoilov
6a47e7bce9 (sesssetup_user): make static const char[] instead of pstring.
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2018-02-04 11:30:23 +03:00
Andrew V. Samoilov
b207798426 (events_init): make standard_events const.
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2018-02-04 11:30:23 +03:00
Andrew Borodin
95e1ab3064 vfs: use LS_NOT_LINEAR constant.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
c524d6d49c src/cons.handler.c: fix include.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
e151b0756f src/usermenu.c: cosmetics.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
80a4982d95 Refactor file manager creation.
* (create_panels_and_run_mc): rename to create_file_manager.
  Move call of dlg_run() to do_nc().
  * (create_panels): create file panels only. Move creation of
  other widgets to create_file_manager().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andreas Mohr
00416d5cf3 (my_type_of): remove unreachable code.
Found by Clang 4.0.1.

edit.c:896:16: error: 'return' will never be executed [-Werror,-Wunreachable-code-return]
        return 0x80000000UL;
               ^~~~~~~~~~~~

(whole my_type_of() is suspect)

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andreas Mohr
ac9e4c321a (panel_recursive_cd_to_parent): fix potential null pointer dereference.
Found by GCC 6.4.0.

panel.c: In function 'panel_reload':
panel.c:4188:40: warning: potential null pointer dereference [-Wnull-dereference]
         if (IS_PATH_SEP (panel_cwd_path[0]) && panel_cwd_path[1] == '\0')

../../lib/global.h:132:26: note: in definition of macro 'IS_PATH_SEP'
 #define IS_PATH_SEP(c) ((c) == PATH_SEP)
                          ^

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andreas Mohr
ae3cf817f4 Cleanup implicit-fallthrough warnings.
Found by GCC 7.2.0

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
2043ef74a9 (execute_menu_command): fix mcview_viewer() call.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
7abd640b41 Sync with gnulib 467061a2014d742a27eb8d4498e8d09fb3225d53.
Remove SVR2 support

SVR2 was obsolete by 1986 and is no longer supported by anybody, and its
code was getting in the way of use of this module by Emacs, which has
its own 'read' function anyway.

  * src/filemanager/mountlist.c: remove SVR2-specific code.
  * m4.include/fsusage.m4: do not test for sys/filsys.h or set
  STAT_READ_FILSYS.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
ddd645526a Update copyright years. 2018-02-04 11:30:22 +03:00
Andrew Borodin
074008025b mcviewer: refactor mode flags.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:22 +03:00
Andrew Borodin
73979369d1 Support __attribute__((fallthrough)) if possible.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:22 +03:00
Andrew Borodin
c139b82711 Don't calculate totals for copy and erase operations on single file.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-03 18:26:42 +03:00
Andrew Borodin
b6a65e084d (file_is_symlink_to_dir): new API.
Returns TRUE if file is symbolic link to directory, FALSE otherwise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-03 18:26:42 +03:00
Andrew Borodin
64526def8a (panel_operate): add TODO for rename/move of several directories.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-03 18:26:42 +03:00
Andrew Borodin
3ba4417c18 Don't calculate totals for move operation on single file.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-03 18:26:41 +03:00
Andrew Borodin
7dac8f7bd6 (operate_single_file): don't calculate directory size before rename or move...
...of single directory within same file system.

First try rename the single file/dir. If case of unsuccess, use
copy+delete with directory size calclulation.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin
ef5d346dd9 (operate_single_file): make src and dest file name unescaping
...as it made in operate_one_file.

(build_dest): make dest file name unescaping here.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin
1071c232c7 Refactor preparation of file/dir operation.
(transform_source): rename to build_dest and really build destination
file name here.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin
1337ed1c55 (transform_source): fix memory leak in error case.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin
763e996076 (operate_one_file): refactoring, add extra variables.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin
816b503e3a (operate_single_file): refactoring, add extra variables.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin
07bbfb73e3 (move_dir_dir): refactoring: move erase of copied directories to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin
93c6687cb7 Refactoring: move file remove to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin
9d55d861e2 Refactroing: move same file/dir check to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin
6ea94459d3 Refactoring: move of directory erase to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin
9ff91634f5 (panel_operate): refactoring: move file/dir operation to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin
cd7db69e69 (panel_operate): refactoring: move single file/dir operation to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin
5d98418133 (panel_operate): refactoring: move copy/move confirmation prompt to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin
4aad3c524a (panel_operate): refactoring: move delete confirmation prompt to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin
ead9063880 (panel_operate): refactoring: move check of single entry to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin
edd67ef445 Ticket #3149: don't calculate directory size before rename or move...
...whitin same file system.

Initial commit: cleanup: WITH_FULL_PATHS is defined permanently.
Remove it.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-01-21 20:52:10 +03:00
Andrew Borodin
322d0804c7 (panel_operate_init_totals): fix directory size calculation.
Don't calculate directory size if object is not a directory.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:22:00 +03:00
Andrew Borodin
212207026b (panel_operate_init_totals): change the 'source' argument type...
...to get rid of vfs_path_t -> char * -> vfs_path_t conversion.
2017-12-28 10:22:00 +03:00
Andrew Borodin
f46c483e64 sftpfs: handle file operation errors.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:22:00 +03:00
Andrew Borodin
bcdb78c7a0 (sftpfs_close_file): return actual result of sftp file close operation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:22:00 +03:00
Andrew Borodin
57be6c6c80 (sftpfs_waitsocket): refactor and use it for file and directory operations.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:21:50 +03:00
Andrew Borodin
a3b54e4003 Clarify usage of sftpfs_internal_stat() return value.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
xenogenesi
77a273a0fd sftpfs: refactoring: move initialization of sftp stat operations to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
xenogenesi
bbef777867 sftpfs: refactoring: move initialization of sftp operation to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
Andrew Borodin
a63950710c (sftpfs_waitsocket): handle socket errors.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
xenogenesi
d5f6f317b2 sftpfs: refactoring: move handling of socket errors to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
Andrew Borodin
29b9c1d81d (sftpfs_fstat): use sftpfs_attr_to_stat().
* (sftpfs_attr_to_stat): make public.
  * (sftpfs_blksize): make static.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
xenogenesi
8e8229931e sftpfs: refactoring: move obtaining of stat info from sftp attributes to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
Andrew Borodin
b5cf04bc8d sftpfs: refactoring: move error check to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
xenogenesi
a241f472bf Fix sftp error 31 (proto 4 and 2)
See https://midnight-commander.org/ticket/3406#comment:13
and https://midnight-commander.org/ticket/3406#comment:16.

Both _lstat and _stat need to handle NO_SUCH_FILE while
copying to a remote sftp.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
Andreas Mohr
1866f9169f sftp handle LIBSSH2_FX_PERMISSION_DENIED as EACCES.
When libssh2_sftp_stat_ex(LIBSSH2_SFTP_STAT|LIBSSH2_SFTP_LSTAT) returns with
LIBSSH2_ERROR_SFTP_PROTOCOL (-31) and LIBSSH2_FX_PERMISSION_DENIED (3)
handle this error case like local stat/lstat() returns -EACCES.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
Andreas Mohr
22076e2d8b Ticket #3406: sftpfs: fix -31 SFTP Protocol Error when transferring file via SFTP Link.
Initial commit: extend error message with sftp session error.

When LIBSSH2_ERROR_SFTP_PROTOCOL (-31) occurs extend error message
with sftp last error for better failure tracking.

With #3269 patch further sftp protocol error message now looks like
SFTP Protocol Error 3 (-31).

Currently I have no nice solution for print relevant called libssh2 function too
I don't want pollute _to_gliberror() with contant strings all over.

sftp session error 3 means (file) permission denied.

From libssh2-1.5.0/include/libssh2_sftp.h

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-28 10:18:08 +03:00
Andrew Borodin
8d0c1c305a extfs: rpm: unset hardcoded irrelevant size of RPM scripts.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-24 09:44:24 +03:00
Anatoly Borodin
cf94e56acf Ticket #3865: extfs: rpm: INSTALL is truncated in the viewer
Before the rewrite e7ed071be7, the files
`INSTALL`, `UPGRADE`, and `REBUILD` were just text files with fixed
length of 39 characters. After the rewrite, the corresponding `rpm`
commands (of variable length) have been added.

If one of these files is being opened with the internal viewer, only the
first 39 characters (hardcoded in `mcrpmfs_list()`) are shown, e.g.
`INSTALL` (before the previous commit):

	# Run this script to install this RPM p

The word 'script' was added inconsistently (compare with `UPGRADE` and
`REBUILD`) and can be removed. The `rpm` commands can be also removed:
they may fail to work if there is a whitespace in the path, so they
cannot always be simply copy&pasted; it's is still possible to "run" the
script files with Enter.

Signed-off-by: Anatoly Borodin <anatoly.borodin@gmail.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-24 09:44:24 +03:00
Andrew Borodin
5eb4010b0d achown: add mouse support for permission buttons.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-10 09:19:15 +03:00
Andrew Borodin
aa36eb38ce achown: use Space key to invert current permission flag.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-10 09:19:15 +03:00
Andrew Borodin
fe63828b8b (advanced_chown_callback): button is already focused, don't focus it again.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-10 09:19:15 +03:00
Andrew Borodin
4943e52320 achown: handle some keys in permission button callback.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-10 09:19:15 +03:00
Andrew Borodin
48d85a42b4 achown: add callback for permission buttons
...to change behaviour of WButton objects.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-10 09:19:15 +03:00
Andrew Borodin
4b0edd90cf achown: clarify text positions.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-10 09:19:15 +03:00
Andrew Borodin
e9639ef526 achown: clarify location of user and group listbox window.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-10 09:19:15 +03:00
Andrew Borodin
4232ae211a Ticket #3148: add mouse support in 'Advanced chown' window.
Initial step: apply callback to User and Group buttons
to show user and group list respectively using mouse.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-10 09:19:15 +03:00
Andrew Borodin
24d9a4d4b1 Implement cancel of advanced chown of many files.
Implement error message with follow buttons:
"Ignore" -- ignore current error;
"Ignore all" -- ignore current error, try chmod/chown of other selected
files, and ignore all following errors;
"Retry" -- retry chmod/chown operation;
"Cancel" -- cancel chmod/chown operation immediately.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-10 09:10:23 +03:00
Andrew Borodin
331a0b2cc9 Implement cancel of chown of many files.
Implement error message with follow buttons:
"Ignore" -- ignore current error;
"Ignore all" -- ignore current error, try chown of other selected files,
and ignore all following errors;
"Retry" -- retry chown operation;
"Cancel" -- cancel chown operation immediately.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-10 09:10:23 +03:00
Andrew Borodin
6aafb1189b chmod: some optimization.
Get rid of extra conversion vfs_path_t -> char * -> vfs_path_t.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-10 09:10:22 +03:00
Andrew Borodin
34cbab7c2a Implement cancel of chmod of many files.
What steps will reproduce the problem?
1. Selected many files (12000 in my case).
2. Ctrl+x c (chmod) - changed mode to desired one.
3. MC started to change file modes but failed, it shows error popup
"Cannot chmod ... Operation not permitted (1)" for every file and waits
for a keypress.
MC shows error for every file in a list (12000 times), there is no
chance to cancel the whole operation, only to press any key 12000 times
or to kill MC.

The solution: implement error message with follow buttons:
"Ignore" -- ignore current error;
"Ignore all" -- ignore current error, try chmod of other selected files,
and ignore all following errors;
"Retry" -- retry chmod operation;
"Cancel" -- cancel chmod operation immediately.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-10 09:10:22 +03:00
Andrew Borodin
fd44219178 Ticket #3850: implement cancel of chmod/chown/achown of many files.
Initial step: sync of chmod, chown, achown source code:
some refactoring, renaming, reordering, type accuracy, #include clean up.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-10 09:10:22 +03:00
David Martin
26a2617256 Ticket #3879: i18n of argument type names in --help blocks.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-02 11:24:46 +03:00
Andrew Borodin
d1e4655d05 src/vfs/extfs/helpers/README: fix path to user scripts. 2017-11-17 16:01:30 +03:00
Andrew Borodin
1d2cbee320 Fix 2nd argument of gauge_show() call.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:30 +03:00
Andrew Borodin
3a3a6479d3 (do_link): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:30 +03:00
Andrew Borodin
55bafd40e5 (do_link): fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:30 +03:00
Andrew V. Samoilov
1b47c88ff1 (message): Use "%s" to fix incorrect translation with printf pattern(s)
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2017-11-17 16:01:29 +03:00
Andrew V. Samoilov
23dec99195 (parm_table[]): Make const to relocate 13624 bytes from .data to .text.
(init_globals): fstring is enough for "%d.%d".
(*): Remove nmbd code.

Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2017-11-17 16:01:29 +03:00
Andrew V. Samoilov
62eca8ebde (_interpret_node_status): Remove dead code.
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2017-11-17 16:01:29 +03:00
Andreas Mohr
d2cfb712b0 (mcview_mouse_callback): fix typo.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:29 +03:00
Andreas Mohr
20398ece6e (jobs_fill_listbox): cleanup pointer-compare warning.
Found by GCC 7.1.0.

boxes.c:431:22: error: comparison between pointer and zero character constant [-Werror=pointer-compare]
     if (state_str[0] == '\0')
                      ^~
boxes.c:431:9: note: did you mean to dereference the pointer?
     if (state_str[0] == '\0')
         ^

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:29 +03:00
Andrew Borodin
a4518eed9e (set_panel_filter_to): rename variable and use MC_PTR_FREE macro.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:23 +03:00
Andrew Borodin
8bf7e69134 (set_panel_filter): fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 15:59:44 +03:00
Andrew Borodin
e185cb1e8c (tar_open_archive): initialize variable.
../../../../src/vfs/tar/tar.c: In function 'tar_open_archive':
../../../../src/vfs/tar/tar.c:805:69: error: 'h_size' may be used uninitialized in this function [-Werror=uninitialized]

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 15:59:44 +03:00
Andrew Borodin
b5012c8e9d (tar_read_header): move checksum to separate function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 15:59:44 +03:00
Andrew Borodin
7772f00aab Ticket #3780: code clean up before 4.8.20 release.
Direct include <limits.h> for MB_LEN_MAX.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 15:59:44 +03:00
Andrew Borodin
eb9b1407c8 (ftpfs_correct_url_parameters): clean up always true condition.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-10-29 20:23:04 +03:00
Cristian Rigamonti
3ab6ef7aa7 Ticket #3869: fix of retrieve password from .netrc.
(ftpfs_correct_url_parameters): fix condition.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-10-29 20:23:04 +03:00
Sergey Naumov
fc68bd7aa3 Ticket #3867: mceditor: add %c (cursor offset from BOF) support for macros.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-10-28 18:56:32 +03:00
Andrew Borodin
b11c84dbb7 Document the %f macro related to mcedit. 2017-10-28 18:46:14 +03:00
Andrew Borodin
f89fff139c Fix %f macto in mcedit user menu.
In mcedit user menu the %f macro should match the file name opened in
mcedit not the file name is selected in the panel.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-10-28 18:46:14 +03:00
Andrew Borodin
680678ef72 Ticket #3861: fix %f macro in mcedit user menu.
Initial step: move usermenu.[ch] files from src/filemanager/ directory
to src/ one.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-10-28 18:46:08 +03:00
Andrew Borodin
1221900262 Ticket #3855: mcview: search doesn't ask about starting over
Broken in 178628e67f.

(mcview_do_search): do search in last chunk if data source is the
growing buffer only.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-09-26 12:56:05 +03:00
Yury V. Zaytsev
0fec3ef449 Ticket #3852: subshell - fix broken tcsh 6.20+ cd escaping
Reported-by: Anatoly Borodin <anatoly.borodin@gmail.com>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2017-09-09 11:16:46 +02:00
Yury V. Zaytsev
5ee452eba9 Ticket #3843: mcedit - fix broken encoding into UTF-8 for 8-bit displays
Reported-by: Lőrinczy Zsigmond <lzsiga@freemail.c3.hu>
Reviewed-by: Egmont Koblinger <egmont@gmail.com>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2017-09-09 08:48:21 +02:00
Andrew Borodin
443b92e16a Ticket #3846: fix crash on slow startup...
...because of access to free'd viewer in the idle hooks execution.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-08-07 13:44:22 +03:00
Andrew Borodin
d5b0417cb2 mcview: minor refactoring.
* (mcview_growbuf_read_all_data): new function.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-06-28 08:31:02 +03:00
Andrew Borodin
1453f41a58 mcviewer: fix goto offset.
* (mcview_dialog_goto): do read data from pipe in case of
MC_VIEW_GOTO_OFFSET_DEC and MC_VIEW_GOTO_OFFSET_HEX.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-06-28 08:31:02 +03:00
Andrew Borodin
cc95f6f654 Ticket #3826: mcview: goto doesn't grow file as much as needed.
Goto decimal/hexadecimal offset doesn't grow the file if necessary,
rather stops at an earlier offset.
Goto percent doesn't work either. It's trickier because no matter what
the percent value is, it'd need to read the entire contents.
Goto line number works as expected.

* (mcview_dialog_goto): read all data from pipe in case of
MC_VIEW_GOTO_PERCENT.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-06-28 08:31:02 +03:00
Andrew Borodin
178628e67f Ticket #3819: mcview: search doesn't grow file as much as needed.
(mcview_do_search):
  * In main search loop: don't break in case of MC_SEARCH_E_NOTFOUND
error. Make next iteration until buffer can be grown.
  * Make search in the last data chunk.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-05-27 19:13:47 +03:00
Yury V. Zaytsev
f0414be51d Zero struct stat tv_nsec (if supported) whenever st is filled manually
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2017-05-17 21:18:58 +02:00
Andrey Gursky
243cdc1755 Ticket #3821: initialize struct stat st_[acm]tim.tv_nsec when present
struct stat in libc for Linux kernel contains few fields more since 14+
years [1]. From bits/stat.h:

```
        struct timespec st_atim;		/* Time of last access.  */
        struct timespec st_mtim;		/* Time of last modification.  */
        struct timespec st_ctim;		/* Time of last status change.  */
    # define st_atime st_atim.tv_sec	/* Backward compatibility.  */
    # define st_mtime st_mtim.tv_sec
    # define st_ctime st_ctim.tv_sec
```

The conventional fields became an alias.

POSIX.1-2008 made struct stat st_[acm]tim mandatory [2].

OS takes care to initialize struct stat properly [3]. By not using an OS
syscall or a libc wrapper to fill struct stat, we have to take care of
initializing all fields (or at least those being used later) explicitly.

[1]: https://www.sourceware.org/ml/libc-alpha/2002-12/msg00011.html
[2]: https://www.sourceware.org/ml/libc-alpha/2009-11/msg00102.html
[3]: https://www.sourceware.org/ml/libc-alpha/2002-12/msg00013.html

Fixes: file timestamps not preserved (https://mail.gnome.org/archives/mc-devel/2017-April/msg00000.html)
Reported-By: Nerijus Baliunas <nerijus@users.sourceforge.net>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2017-05-17 21:18:58 +02:00
Egmont Koblinger
27c30e8f5f Ticket #3817: mcview: fix read of filtering data from pipe.
(mcview_eol): grow buffer every time when it really needed.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-05-17 13:22:53 +03:00
Egmont Koblinger
5e238fae95 Ticket #3783: mcview: fix interpretation of invalid utf-8 symbols.
(mcview_get_utf): report invalid utf-8 as negative integer.

The bug was introduced in 4d65a731c2.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-05-07 20:50:27 +03:00
Witold Filipczyk
49898835fd Ticket #2297: show empty directories in incremental tar archives.
How to reproduce:
1. Create two tar files with empty dir:
$ mkdir -p dir/dir1; mkdir dir/dir2; touch dir/dir1/file
$ tar cf normal.tar dir/
$ tar cf incremental.tar -g incremental.snap dir/
2. Press Enter to enter to normal.tar.
Result: normal.tar contains dir/dir2, incremental.tar doesn't.
Expected result: incremental.tar contains dir/dir2.

This patch also fixes Ticket #3709: Wrong directories owner for tar
--numeric-owner -g.

How to reproduce:
As root:
 # mkdir -p TEST/TEST2
 # echo aaa > TEST/TEST2/aaa.txt
 # chown 10000:10000 TEST
 # chown 10001:10001 TEST/TEST2
 # chown 10002:10002 TEST/TEST2/aaa.txt

 # tar --numeric-owner -zcf test1.tar.gz TEST
 # tar --numeric-owner -g test.inc -zcf test2.tar.gz TEST

and now view these tarballs with long view. Directories of test2.tar.gz
have owner root instead of 10000 or 10001, but if you untar them using
tar -xvf directories owners are correct

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-05-04 09:48:22 +03:00
Mooffie
7fba743d77 Ticket #3816: F10 doesn't work in QuickView.
Signed-off-by: Mooffie <mooffie@gmail.com>
2017-04-24 18:36:21 +03:00
Mooffie
2edb0052fd TreeView should mute the command-line.
Because it's a recipe for disaster to mix, for example, DEL for deleting a
directory and BACKSPACE for deleting the previous char.

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-04-24 18:31:38 +03:00
Mooffie
e90eea874d QuickView shouldn't consume all keys.
The QuickView should return MSG_HANDLED, in its MSG_KEY, *only* for keys it has
indeed handled.

We move the "don't pass any chars to command line" responsibility to the main
dialog instead.

(We're reverting commit 8469c13f38 here.)

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-04-24 18:31:38 +03:00
Mooffie
16c9ec0108 Factor out handle_cmdline_enter().
Signed-off-by: Mooffie <mooffie@gmail.com>
2017-04-24 18:31:38 +03:00
Mooffie
12d6ead7fc Ticket #3815: Factor out is_cmdline_mute().
Signed-off-by: Mooffie <mooffie@gmail.com>
2017-04-24 18:31:25 +03:00
Andrew Borodin
ff1510de1f File panel: unification of terminology.
Use 'list(ing) format' instead of 'list(ing) type' and 'list(ing) mode'.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-04-24 16:16:27 +03:00
Andrew Borodin
b56a77e02f Refactoring: handle panel listing mode switch in the panel level
...instead of top level.

Rename and move main/PanelListingSwitch keybind to panel/ListingSwitch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-04-24 16:16:27 +03:00
Andrew Borodin
9612df677a Refactoring: ret rid of set_basic_panel_listing_to().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-04-24 16:16:27 +03:00
Andrew Borodin
34aaab47ba (listing_cmd): reset panel filter.
When change panel mode to listing one, in addition to reset of
panelization, reset panel filter too.

Optimization: get rid of double panel reload.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-04-24 16:16:27 +03:00
Andrew Borodin
edb51c4457 Ticket #3810: keep panelization while switching panel listing mode.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-04-23 11:17:10 +03:00
Mooffie
24de5eb1df Ticket #3813: Filter isn't cleared when entering empty string.
Signed-off-by: Mooffie <mooffie@gmail.com>
2017-04-21 17:25:53 +03:00
Mooffie
d1062fc47c do_panelize_cd() is missing call to panelize_absolutize_if_needed().
Whenever we populate a panelized panel, we have to call
panelize_absolute_if_needed().

Note: do_panelize_cd() implements the "Restore last panelization" command
(see #3767).

Note: We move the `panel->is_panelized = TRUE` line to the bottom for stylistic
reason: to make it parallel to the other places where we have similar code. We
may factor out this common code in the future.

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-04-18 20:09:44 +03:00
Mooffie
92eea68251 Introduce panelize_absolutize_if_needed(), plus documentation.
Instead of imperfectly duplicating code we create a function.

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-04-18 20:09:44 +03:00
Mooffie
bb45f84071 Fix assumptions of "dir.list->len == 0".
`dir.list->len` can't be zero because we're always checking it after a call to
dir_list_init(), which populated the list with "..".

Therefore any code that checks for zero is either superfluous or a bug.

As for the modifications in find.c:

  - The bug caused us not to call panel_clean_dir(), and this caused:
    - Memory leaks resulting from calling dir_list_init() without
      dir_list_clean() first.
    - The "total size" of selected files (for example) wasn't getting cleared.

  - We remove the `if (list->len != 0)` around the
    `current_panel->is_panelized = TRUE; ...` for several reasons:
    - The code isn't called anyway if no files were found.
    - Conceptually, there's no point in distinguishing an empty listing from an
      empty panelized listing.
    - It's the de-facto current behavior (as `list->len != 0` always)

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-04-18 20:09:44 +03:00
Andreas Mohr
c9f058e65b Ticket #2942: External panelize: opening a file with an absolute path fails.
We fix the detection of absolute paths in the panel's list. `list[0]` is "..",
so we need to inspect `list[1]`.

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-04-18 20:09:34 +03:00
Denys Vlasenko
f0d3241ecb Ticket #3805: fix --help option to show correct syntax for editor, viewer and mcdiff
Before the patch: --help shows the same text for all tools, only "mc"
is replaced by tool name. For example, "mcedit --help" says:

        Usage:
          mcedit [OPTION...] [+number] [this_dir] [other_panel_dir]
         +number - Set initial line number for the internal editor

which is wrong: mcedit does not take [this_dir] [other_panel_dir]
syntax, that's mc syntax.

After the patch, each tool has its own syntax string shown.
"Usage:" message for each tool is as follows now:

  mc [OPTION...] [this_dir] [other_panel_dir]

  mcedit [OPTION...] [+lineno] file1[:lineno] [file2[:lineno]...]

  mcview [OPTION...] file

  mcdiff [OPTION...] file1 file2

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-04-15 09:49:29 +03:00
Mooffie
a6cd7c9f45 extfs: rpm: use printf instead of echo, when retrieving fields.
We switch to using 'echo' instead of 'printf', for the reason described in a
previous commit.

This time, however, we don't do this in order to preserve the value of the
DESCRIPTION field (because we retrieve it using some other command). We do this
for two reasons:

* As chance would have it, we have the string '\c' in our DESCRIPTION. It turns
  out that Dash's echo interprets '\c' to mean the end of the data[1], so
  fields stored in $AllTAGS after DESCRIPTION aren't seen by our sed script
  (resulting in the helper not reporting a few file entries).

* We also have '\n' in DESCRIPTION. This would translate, by echo, into
  newline, failing the naive sed script.

[1] See "\c as in SYSV echo - abort all processing..." in the source code of
    Dash: https://github.com/gioele/dash/blob/master/src/bltin/printf.c

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-03-09 01:03:42 +02:00
Mooffie
25aa5db3fd extfs: rpm: wrap variable in quotes.
Our goal is to replace the 'echo' with 'printf' on this line, for the reason
described in the previous commit. But before we do this we need to wrap one
variable in quotes.

This preliminary step does not affect the output of the helper.

As for using "tr \n ' '": this mimics the current behavior (when using no
quotes around the variable, newlines are converted to spaces by the shell; now
that we do have quotes we need to do this conversion ourselves). An alternative
is to tweak the sed script to be smarter, but it turns out it's not a simple
task.

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-03-09 01:03:41 +02:00
Mooffie
95f2f14357 extfs: rpm: use printf instead of echo, to calculate DESCRIPTION length.
Out test input intentionally contains weird characters in the DESCRIPTION field
(see the file 'test.spec'[1]).

It turns out that backslash sequences, as in our DESCRIPTION field, are
processed by the 'echo' command in some shells (i.e., Dash). In other words,
'echo' can't be used to print arbitrary data verbatim. Indeed, the standard
says[2] that "if any of the operands contain a <backslash> character, the
results are implementation-defined". You can see the problem by running:

    $ echo "one \\a two"

under both Bash and Dash: you'll get different results.

The solution: we replace 'echo' with 'printf'.

[1] https://midnight-commander.org/browser/tests/src/vfs/extfs/helpers-list/misc/rpm/test.spec#L34
[2] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-03-09 01:03:41 +02:00
Mooffie
ac23a4807c Pressing <right> and <left> in hotlist dialog doesn't refresh it.
Signed-off-by: Mooffie <mooffie@gmail.com>
2017-02-26 12:38:39 +02:00
Andrew Borodin
f34363f93b (make_symlink): add missing space in error message.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-02-26 08:04:15 +03:00
Mooffie
1f121b7674 Ticket #3754: Help viewer doesn't handle tabs correctly.
Upon seeing a tab, the help viewer effectively pushes the *current* word
forward.

Instead, it should first finish handling the current word (that is, print it on
screen) and only then adjust the column.

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-02-23 19:35:56 +02:00
Mooffie
256c3f1838 Improve comment for dx variable
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Signed-off-by: Mooffie <mooffie@gmail.com>
2017-02-19 21:57:30 +01:00
Egmont Koblinger
fa951f8c5d Ticket #3774: mcedit - fix mouse active area for maximize / close buttons
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Signed-off-by: Egmont Koblinger <egmont@gmail.com>
2017-02-19 19:47:18 +01:00
Mooffie
f6ceb8d16d WEdit shouldn't draw frame over buttonbar.
When dragging a framed WEdit with the mouse, the frame is painted over the
buttonbar. This happens in two cases: when pressing the mouse down, and when
releasing it.

The patch fixes the problem by calling edit_update_screen() in these two cases.
This paints the buttonbar over the frame.

(The problem doesn't occur when moving the frame with the keyboard because
edit_callback(msg==MSG_KEY) calls edit_update_screen() right after handling the
key.)

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-02-19 00:04:38 +02:00
Mooffie
0481b8e790 WEdit shouldn't handle mouse events of overlapping buttonbar.
Signed-off-by: Mooffie <mooffie@gmail.com>
2017-02-19 00:04:38 +02:00
Mooffie
6273b46bb5 (edit_window_list): simplify the listbox selector.
We use the new run_listbox_with_data().

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-29 23:32:13 +02:00
Sergei Trofimovich
bc8eb09256 vfs/tar/tar.c: add makedev() declaration
Noticed as a build failure on gentoo/glibc-2.24 as:

      CCLD     mc
    ./.libs/libinternal.a(tar.o): In function `tar_fill_stat':
    /home/slyfox/dev/git/mc/src/vfs/tar/tar.c:428: undefined reference to `makedev'
    collect2: error: ld returned 1 exit status

The change uses "lib/unixcompat.h" to pull
'makedev()' declaration from proper header.

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
2017-01-22 17:05:39 +00:00
Andrew Borodin
e9fd11bfcd Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 19:12:55 +03:00