Commit Graph

5823 Commits

Author SHA1 Message Date
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
Andrew Borodin
b9085cc1c8 (tar_fill_stat): add omitted breaks.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:45:56 +03:00
Andrew Borodin
28ca14d73a Aggressive use of whitespace() and whiteness() macros.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
e0c02c9c77 WCheck, WRadio: send MSG_MOTIFY without parameter.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Fabian Homborg
4e74d7d255 Fish shell integration: ignore mc's prompt in history.
Fish does something equivalent to bash's "HISTCONTROL=ignoreboth" by default,
so simply prefixing a command with a space will let it be ignored.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andreas Mohr
238d3ac53c Cleanup comma compiler warnings.
Found by Clang 3.9.0.

Signed-off-by: Andreas Mohr <and@gmx.li>
2017-01-22 18:44:22 +03:00
Andrew Borodin
04c1eb6160 (sftpfs_open_file): GCC zero initialization bug workaround.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andreas Mohr
8f304f558d Cleanup maybe-uninitialized compiler warnings.
Found by GCC 6.2.0.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
d078ae4713 option_auto_syntax: change type to gboolean.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
cd3a5ee373 src/setup.c: minor refactoring of main options load.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
8b14798cc4 setup: split integer and boolean options.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
c4550374b2 Change type from int to gboolean for variables controlled by checkboxes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
5e2f4a8069 WCheck: change type of 'state' from int to gboolean.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Jiri Tyr
4310b066e2 Ticket #3750: Adding support for RPM transaction scripts.
Adding support for PRETRANS, PRETRANSPROG, POSTTRANS and
POSTTRANSPROG RPM tags which allow the relevant scripts to be visible
in the INFO/SCRIPTS vfs directory.

Signed-off-by: Jiri Tyr <jiri.tyr@gmail.com>
Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-16 17:01:31 +02:00
Mooffie
97bc2af3b2 extfs: rpm: make it testable.
The way we make this helper testable is a bit different than with other
helpers:

While in other helpers we make it possible to override just one or two
variables, here we make it possible to inject a code snippet into it. This is a
more powerful approach which lets us override even functions, as will be shown
in a following patch.

(As for relocating the "AllTAGS=..." line: all non-declarative code needs to be
moved past our new injection point, or else this code won't be affected by the
injection. BTW, the "$1" on that line isn't used; a vestige from old days.)

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-16 13:58:07 +02:00
Mooffie
65ebc83f88 Ticket #3751: extfs: rpm: introduce the $RPM_QUERY_FMT variable.
This minor refactoring will enable us to make this helper testable.

Instead of doing:

    $RPM -qp --qf a b c

we are now doing:

    $RPM_QUERY_FMT a b c

In a future patch we'll then be able to point $RPM_QUERY_FMT to some mock
program.

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-16 13:58:07 +02:00
Mooffie
05661eda1d Ticket #3757: cannot show more than one column in user defined listing mode.
In user-defined listing mode, the format string lets us specify how many
columns to display. E.g., for 3 columns:

    "half 3 type name | size | perm"

However, parse_panel_size() reads this digit only when `panel->list_type ==
list_brief`. We remove this check.

Incidentally, the assignment there to `panel->brief_cols` isn't needed. In
list_brief mode, `panel->brief_cols` is already set.

We also fix a related problem in the mouse handler: it erroneously assumes
`panel->list_cols > 1` happens only in list_brief mode.

(These bugs were introduced in commit fb474bc1c157.)

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-16 00:23:03 +02:00
Andrew Borodin
aae43d362f (vfs_adjust_stat): new VFS API, currently used to calculate st_blocks.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Andrew Borodin
bf40acf420 Clarify usage of st_rdev. Use it if HAVE_STRUCT_STAT_ST_RDEV is defined.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Andrew Borodin
d1c2c2d47e ftpfs: define st_blksize as equal to 64K.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Andrew Borodin
21fd0c3fec fishfs: define st_blksize as equal to 64K.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Andrew Borodin
560ca526bd tarfs: define st_blksize as equal to 8K.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Andrew Borodin
110f4eae60 sftpfs: (sftpfs_fix_filename): refactoring: return length of result.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Andrew Borodin
ffe49251f7 sftpfs: minor optimization.
* (sftpfs_opendir): get rid of extra calculation of file name length.
  * (sftpfs_open_file): likewise.
  * (sftpfs_readlink): likewise.
  * (sftpfs_symlink): likewise.
  * (sftpfs_rename): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Andrew Borodin
95556224a6 sftpfs: define st_blksize and st_blocks.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Mooffie
8b65c36d3f Ticket #3747: extfs: hp48: make the code more readable.
Whitespace tweaking here. There's no change in the code itself except for
using '%c' in the first printf too, to make it like the second printf.

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2017-01-01 17:29:59 +04:00
Mooffie
501a3122ff Ticket #3747: extfs: hp48: fix float truncation.
Some printf implementations can't process with %d anything other than integers.

We solve this by re-using the awk snippet for this purpose. This makes
hp48_retsize() unecessary. And hp48_retdir() too.

(The "case" statement was left unindented to, hopefully, not affect diff's
output much. This aesthetic issue will be fixed in a following patch.)

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2017-01-01 17:29:59 +04:00
Mooffie
4557ee3c7a extfs: hp48: make it testable. 2016-12-25 10:06:23 +04:00
Mooffie
c91476ac4a Ticket #3729: extfs: hp48: fix date format.
Use "MM-DD-YYYY hh:mm" instead of "Mon DD YYYY hh:mm".

Note: we assign to $NOW at the top-level, not inside hp48_parser(), because the
communication is slow and we don't want each recursive call to hp48_parser() to
potentially print a different time.
2016-12-25 10:06:23 +04:00
Mooffie
019ab5c012 extfs: hp48: misc fixes.
Two bugs fixed:

* "printf -rw-r--r--" made printf complain about invalid option (although
  changing it to "printf -- -rw-r--r-" is possible, we don't know how portble
  this is).

* Quotes around $INPUT defeat the purpose of the function calls (botched in
  commit 61b4642af4).
2016-12-25 10:06:23 +04:00
Mooffie
4d04aa40b0 extfs: hp48: documentation: explain the reply to the DIRECTORY command.
It was not at all easy to find a sample reply on the internet (the one found
was in a screenshot actually), so we record it here.
2016-12-25 10:06:23 +04:00
Mooffie
22846550d3 extfs: uarc: make it testable. 2016-12-25 10:06:23 +04:00
Mooffie
61eb5cca37 Ticket #3729: extfs: uarc: fix date format.
Use "MM-DD-YYYY hh:mm" instead of "Mon DD YYYY hh:mm".
2016-12-25 10:06:23 +04:00
Mooffie
057ba6d73a extfs: uace: make it testable. 2016-12-25 10:06:22 +04:00
Mooffie
5225a1d21b extfs: uace: documentation: clarify versions issue. 2016-12-25 10:06:22 +04:00
Mooffie
08a8621fc5 extfs: uace: print the correct file size.
As a comment in that file notes: 3'rd column is the compressed size, 4'th
column is the actual size.
2016-12-25 10:06:22 +04:00
Mooffie
105501ba9c Ticket #3729: extfs: uace: fix date format.
Use "MM-DD-YYYY hh:mm" instead of "Mon DD YYYY hh:mm".
2016-12-25 10:06:22 +04:00
Andrey Gursky
0075944f1e FISH VFS: generate timestamps with nanosecond precision for touch.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-25 08:46:10 +03:00
Andrew Borodin
53a1d52ed9 (fish_utime): avoid buffer overflow: allocate buffer for command dynamically.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-25 08:46:10 +03:00
Andrey Gursky
4c418047b2 Ticket #3575: preserve timestamps with nanosecond precisions during file copy
MC truncates timestamps during file copy and drops sub-second precision.

Make use of utimensat(), introduced in Linux kernel 2.6.22 (and since
2.6.26 compatible with POSIX-1.2008).

Signed-off-by: Andrey Gursky <andrey.gursky@e-mail.ua>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-25 08:46:10 +03:00
Mooffie
fad265c5bd Ticket #3744: extfs: u7z: make it testable. 2016-12-24 09:58:53 +04:00
Mooffie
f84c14bbce Ticket #2707: extfs: u7z: print() cleanup.
AWK's print() already writes OFS between expressions.
2016-12-24 09:45:59 +04:00
Mooffie
052bdec1ee Ticket #2707: extfs: u7z: sed portability.
'\s' is not portable.
2016-12-24 09:45:59 +04:00
Mooffie
5c3e999845 Ticket #2707: extfs: u7z: handle missing size.
The uncompressed size may be missing in 7z's output (gods know why). We use the
compressed size in this case.
2016-12-24 09:45:58 +04:00
Mooffie
02051d6090 Ticket #2707: extfs: u7z: make the code more readable. 2016-12-24 09:45:58 +04:00
Yury V. Zaytsev
66ae617b77 extfs: fix whitespace soup in u7z helper
Signed-off-by: Yury V. Zaytsev <yury.zaytsev@moneymeets.com>
2016-12-24 09:45:58 +04:00
Yury V. Zaytsev
6938f1a52d Ticket #2707: extfs u7z helper - fix listing 7z archives w/o datetime info
7z archives can have entries without datetime info (7z a -mtm- ...). Currently,
u7z helper skips these entries. Fix this by detecting them and obtaining
archive file datetime using stat command with fallback to ls -lan.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Yury V. Zaytsev <yury.zaytsev@moneymeets.com>
2016-12-24 09:45:58 +04:00
Mooffie
b8f7018725 extfs: urar: don't invoke 'rar' when running under the tester.
We want to prevent messages printed to STDERR when running the tester on
systems where rar is not installed.

(Yes, we could compress this new code to just one line, but...)

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-20 09:37:22 +03:00
Mooffie
f2c8479a50 extfs: lslR: make it testable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-16 10:14:41 +03:00
Mooffie
c88517b055 extfs: urar: make it testable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-16 10:14:41 +03:00
Mooffie
88f3aeef24 extfs: uzip: make it testable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-16 10:14:41 +03:00
Mooffie
66b43a6670 extfs: uzoo: make it testable.
Note how easy it is to make the helpers testable. MC_TEST_EXTFS_LIST_CMD is
explained in README.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-14 13:15:58 +03:00
Mooffie
12812968c0 extfs: fix documentation of allowed date formats.
We also improve the documentation of vfs_parse_filedate(), which does the
actual work.

Note that in the user-facing documentation (extfs/helpers/README) there are
two things we prefer *not* to mention about vfs_parse_filedate's ability:

* Accepting the format "MM-DD-YY hh:mm[:ss]", as this two-digit year is
  more likely to confuse readers of such dates.

* Accepting '/', instead of '-', as the separator in MM-DD-YYYY. (Considering
  that some scripts do use '/', maybe we should mention it?)

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-13 13:14:43 +03:00
Andrey Tataranovich
752a7e4454 Ticket #3693: fix listing of zoo archive entries.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-13 13:14:43 +03:00
Andrew Borodin
8550044635 Ticket #3731: add new MSG_CHANGED_FOCUS message.
This message is sent to widgets'owner when widget's focus state is
changed.

Find file dialog: fix initial draw of ignore directories input line.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-10 18:31:03 +03:00
Mooffie
5f73bd0ff3 Ticket #3735: mcedit: show backwards-search error messages.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 10:14:37 +03:00
Andrew Borodin
0701bca6e3 Ticket #3710: don't parse "window-state-char" and "window-close-char" as colors.
The bug: in skin files, the "[editor]" section's "window-state-char" and
"window-close-char" (whose values, as the name implies, are single
characters) are parsed as color fg+bg+attr, and an ncurses/slang
colorpair is allocated for each.

The bug fix: move "window-state-char" and "window-close-char" keys from
"[editor]" section to "[widget-editor]" one.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 10:01:57 +03:00
Andrew Borodin
496abc0e1f Rename mc_config_get_profile_root() to mc_get_profile_root()
...and move it out from lib/mcconfig.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:37:50 +03:00
Mooffie
239a8d0117 Ticket #3684: replace $MC_HOME with $MC_PROFILE_ROOT, a better "profile" mechanism.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-29 11:10:19 +03:00
Mooffie
b4d5ed514d Ticket #3716: various checkboxes not responding.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-24 10:23:53 +03:00
Mooffie
e68f105e0e Ticket #3718: Options/Layout/Equal split gets reverted.
WRadio sends MSG_NOTIFY with MSG_KEY as parameter to it's owner
when selected item is changed.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-24 09:41:07 +03:00
Boruch Baum
98f0c3faba src/filemanager/mountlist.c: clarify comments.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
9a39e35dc3 Use g_assert() instead of assert(3).
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
9e226f130f Clarify startup.
If mc isn't run as file manager, don't resolve the "other_dir" panel
option.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
bea83a1189 (panel_callback) [MSG_FOCUS]: don't redraw panel here.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
c1cf7e81b9 (setup_panels): fix location of right panel.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
c0cc0546d1 (edit_move_block_to_left): reduce variable scope.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andreas Mohr
c5efd8a1e1 (edit_move_block_to_left): cleanup -Wunsafe-loop-optimizations.
edit.c: In function 'edit_move_block_to_left':
edit.c:1652:13: warning: cannot optimize possibly infinite loops [-Wunsafe-loop-optimizations]
             for (i = 1; i <= del_tab_width; i++)
             ^~~

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Andreas Mohr
3b1183571a (quit_cmd_internal): cleanup -Wformat-signedness warning.
midnight.c: In function 'quit_cmd_internal':
midnight.c:1027:31: error: format '%zd' expects argument of type 'signed size_t', but argument 4 has type 'size_t {aka long unsigned int}' [-Werror=format=]
                               "You have %zd opened screens. Quit anyway?", n), n);
                               ^
midnight.c:1026:31: error: format '%zd' expects argument of type 'signed size_t', but argument 4 has type 'size_t {aka long unsigned int}' [-Werror=format=]
                     ngettext ("You have %zd opened screen. Quit anyway?",
                               ^

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Andreas Mohr
2b265834ab (info_show_info): cleanup -Wformat-signedness warning.
info.c: In function 'info_show_info':
info.c:193:29: error: format '%X' expects argument of type 'unsigned int', but argument 2 has type 'int' [-Werror=format=]
             tty_printf (" (%Xh)", myfs_stats.type);
                             ^

info.c:239:51: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'long unsigned int' [-Werror=format=]
             tty_printf (ngettext (" (%ld block)", " (%ld blocks)",
                                                   ^
info.c:239:35: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'long unsigned int' [-Werror=format=]
             tty_printf (ngettext (" (%ld block)", " (%ld blocks)",
                                   ^

info.c:259:23: error: format '%X' expects argument of type 'unsigned int', but argument 2 has type 'int' [-Werror=format=]
         tty_printf (_("Location:   %Xh:%Xh"), (int) st.st_dev, (int) st.st_ino);
                       ^
info.c:259:21: note: in expansion of macro '_'
         tty_printf (_("Location:   %Xh:%Xh"), (int) st.st_dev, (int) st.st_ino);
                     ^
info.c:259:23: error: format '%X' expects argument of type 'unsigned int', but argument 3 has type 'int' [-Werror=format=]
         tty_printf (_("Location:   %Xh:%Xh"), (int) st.st_dev, (int) st.st_ino);
                       ^
info.c:259:21: note: in expansion of macro '_'
         tty_printf (_("Location:   %Xh:%Xh"), (int) st.st_dev, (int) st.st_ino);
                     ^

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Andreas Mohr
0bac703a59 (ftpfs_chmod): cleanup -Wformat-signedness warning.
ftpfs.c: In function 'ftpfs_chmod':
ftpfs.c:2029:52: error: format '%o' expects argument of type 'unsigned int', but argument 4 has type 'int' [-Werror=format=]
     g_snprintf (buf, sizeof (buf), "SITE CHMOD %4.4o /%%s", (int) (mode & 07777));
                                                    ^

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Andreas Mohr
f3bcc33f91 src/filemanager/find.c: cleanup -Wformat-signedness warning.
find.c: In function 'found_num_update':
find.c:373:44: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'long unsigned int' [-Werror=format=]
     g_snprintf (buffer, sizeof (buffer), _("Found: %ld"), matches);
                                            ^

find.c: In function 'do_search':
find.c:1306:51: error: format '%zd' expects argument of type 'signed size_t', but argument 4 has type 'size_t {aka long unsigned int}' [-Werror=format=]
                                                   "Finished (ignored %zd directories)",
                                                   ^
find.c:1305:51: error: format '%zd' expects argument of type 'signed size_t', but argument 4 has type 'size_t {aka long unsigned int}' [-Werror=format=]
                                         ngettext ("Finished (ignored %zd directory)",
                                                   ^

file.c:2526:41: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka long unsigned int}' [-Werror=format=]
     label_set_textv (dsm->count_size, _("Directories: %zd, total size: %s"),
                                         ^

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:48 +03:00
Andreas Mohr
feb2581991 (dirsize_status_update_cb): cleanup -Wformat-signedness warning.
file.c:2526:41: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka long unsigned int}' [-Werror=format=]
     label_set_textv (dsm->count_size, _("Directories: %zd, total size: %s"),
                                         ^

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:08:32 +03:00
Andreas Mohr
9ee93df098 src/editor/editdraw.c: cleanup -Wformat-signedness warning.
editdraw.c:127:62: error: format '%d' expects argument of type 'int', but argument 4 has type 'unsigned int' [-Werror=format=]
                 g_snprintf (byte_str, sizeof (byte_str), "%04d 0x%03X",
                                                              ^

editdraw.c:326:30: error: format '%d' expects argument of type 'int', but argument 2 has type 'unsigned int' [-Werror=format=]
             tty_printf ("[%05d 0x%04X]", cur_utf, cur_utf);
                              ^

editdraw.c:334:30: error: format '%d' expects argument of type 'int', but argument 2 has type 'unsigned int' [-Werror=format=]
             tty_printf ("[%05d 0x%04X]", (unsigned int) cur_byte, (unsigned int) cur_byte);
                              ^

editdraw.c:554:20: warning: conversion to 'unsigned int' from 'long int' may alter its value [-Wconversion]
         cur_line = edit->start_line + row;
                    ^~~~

editdraw.c:557:59: error: format '%i' expects argument of type 'int', but argument 4 has type 'unsigned int' [-Werror=format=]
             g_snprintf (line_stat, sizeof (line_stat), "%7i ", cur_line + 1);
                                                           ^

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:08:32 +03:00
Andreas Mohr
a76afeec89 Ticket #3693: code cleanup before 4.8.19 release.
(init_subshell_child): cleanup -Wformat-signedness warning.

common.c:330:26: error: format '%d' expects argument of type 'int', but argument 3 has type 'unsigned int' [-Werror=format=]
         fprintf (stderr, __FILE__ ": unimplemented subshell type %d\r\n", mc_global.shell->type);
                          ^~~~~~~~

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:08:32 +03:00
Mooffie
38b96be737 Ticket #3720: make viewer show search error messages.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 11:01:19 +03:00
Andrew Borodin
59bfd83744 (skin_dlg_callback): add forgotten return.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-13 17:28:54 +03:00
Andrew Borodin
d314609bb8 Ticket #3723: fix positioning of skin selector dialog.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-13 15:28:45 +03:00
Egmont Koblinger
9a63063cb6 Ticket #3715: fix file list resorting on double click on panel header line.
Apply 0-based y coordinates to be consistent with the MSG_MOUSE_DRAG
branch.

This bug was introduced in 54456a678f.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-13 12:26:49 +03:00
Andrew Borodin
83504f2bb5 Revert "(size_trunc_len): align to properly use either IEC or SI prefixes with the unit B (byte)."
This reverts commit bae814d0d4.
2016-11-08 13:19:37 +03:00
Andrew Borodin
e3d457eb3d Revert "Ticket #3666: (size_trunc_len): fix segfault because of small buffer usage."
This reverts commit 3024f309c2.
2016-11-08 13:19:29 +03:00
Michael Osipov
3024f309c2 Ticket #3666: (size_trunc_len): fix segfault because of small buffer usage.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-06 18:30:41 +03:00
Michael Osipov
bae814d0d4 (size_trunc_len): align to properly use either IEC or SI prefixes with the unit B (byte).
Additionally always put a space between number and unit which is
required by the norms.

It is important to note that really small buffers have to be bigger than it
appears because they store bytes and non-Latin scripts need more than one byte
with UTF-8 to encode them, e.g., the string "1023 МиБ" in Russian requires
11 bytes + null terminator.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-10-26 13:33:12 +03:00
Michael Osipov
b3867a6e15 Ticket #3666: Improper use of IEC and SI prefixes for size in size_trunc().
size_trunc() has been aligned to properly use either IEC or SI prefixes with
the unit B (byte). Additionally always put a space between number and unit
which is required by the norms.

Obsolete gettext message ids have been removed and some cleaned up for
duplicate words or leading spaces.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-10-26 13:33:12 +03:00
Yury V. Zaytsev
755447b96e Fix typo in source code comments (s/TEMR/TERM/)
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2016-10-08 16:40:38 +02:00
Roman Mikhayloff
224f53518e Ticket #3698: fix mcedit codejump (etags filenames parsing)
This got broken in the following commit for mc-4.8.16:

    a5ebb7d619

As `g_strlcpy` got replaced with `g_strndup`, the meaning of the last
argument has changed: it is no longer the destination size in bytes, but
the maximum number of bytes to copy, and so it had to be decremented by
one accordingly, hence the bug.

Signed-off-by: Roman Mikhayloff <rimf@inbox.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2016-10-08 11:15:22 +02:00
Andrew Borodin
ef5f1fa3eb Ticket #3672: allow rebind TAB key to change panel.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-10-03 15:21:57 +03:00
Andrew Borodin
36cc88b5f2 Reimplement widget focus/selection.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
d200893347 (dlg_select_widget): rename to widget_select.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
35451978f6 Rename WDialog APIs:
dlg_one_up -> dlg_select_prev_widget
dlg_one_down -> dlg_select_next_widget

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
47f9b77194 WMenuBar: remove WMenuBar::is_active. Use WST_FOCUSED instead.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
240350db95 Refactoring of widget drawing to avoid multiple widget redraw.
Send MSG_DRAW message immediately after MSG_FOCUS/MSG_UNFOCUS.
Thus, the MSG_DRAW message handler is the only place where widget
should be drawn. Widget should not draw itself in other message
handlers.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
aae31dbe43 WView: remove WView::active. Use WST_FOCUSED instead.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Andrew Borodin
ac35ab0401 WTree: remove WTree:active. Use WST_FOCUSED instead.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Andrew Borodin
c37f9b770a WST_FOCUSED: add new state and handle it.
Notify widget's owner that widget gets or loses focus.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Andrew Borodin
c90b806728 Don't focus widget that doesn't have the WOP_SELECTABLE option.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Andrew Borodin
5ac1c5a3e0 Ticket #2919: refactoring of focus/unfocus of widgets.
Initial step: add WOP_SELECTABLE option and set it up explicitly for
widgets that can be selected.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Andrew Borodin
0e22eae836 src/vfs/fish/fish.c: apply coding guidelines.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:11:01 +03:00
Andrew Borodin
f408e9a755 More use link_isdir().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:11:01 +03:00
Andrew Borodin
6127e5aea6 Get rid of #define const_cast(). 2016-09-11 11:11:01 +03:00
Andrew Borodin
01428beb2a (ftpfs_open_data_connection): fix enable/disable interrupt key.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:11:01 +03:00