Commit Graph

15335 Commits

Author SHA1 Message Date
Andrew Borodin
debabe561a "file" utility: use -b option if available.
* configure.ac: test if "file" utility has -b option.
  * (regex_check_type): don't compare file names if "file -b" is used.
Reduce variable scope. Rename variable.

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

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

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-26 19:57:37 +03:00
Andrew Borodin
6c45208744 Fix indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 20:12:46 +03:00
Andrew Borodin
6f2833a422 Merge branch '4357_cleanup'
* 4357_cleanup: (39 commits)
  Update po/*.po files.
  src/filemanager/dir.c: minor sort optimization.
  lib/util.h: fix typo.
  (edit_sort_cmd): clarify hint for Sort command.
  (query_default_callback): clarify widget position.
  (mc_config_get_string): use mc_config_get_string_raw()
  (ftpfs_setup_active): clarify handling of getnameinfo() errors.
  (ftpfs_initconn): clarify errno setup.
  ftpfs.c: variable ftpfs_errno is assigned but never used.
  (ftpfs_dir_load): fix building of remote path.
  (vfs_s_subclass::dir_load): constify argument.
  Minor refactoring of path canonicalization.
  (mc_chdir): clarufy setup of errno.
  (vfs_path_get_by_index): set errno, update description.
  Fix ENOTSUP usage.
  mceditor: minor refactoring of file load.
  (edit_init): change argument for coordinates.
  (edit_add_window): change argument for coordinates.
  (widget_adjust_position): change argument for coordinates.
  (group_init): change argument for coordinates.
  ...
2022-06-05 19:50:03 +03:00
Andrew Borodin
a0ac476983 Update po/*.po files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 19:49:32 +03:00
Andrew Borodin
1b93bae611 src/filemanager/dir.c: minor sort optimization.
Get rid of sort condition double check.

Condition

    ad == bd || panels_options.mix_all_files

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

Now this condition is checked in sort_xxx() only.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin
f5399c6d4d lib/util.h: fix typo.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin
c7af7f0bbd (edit_sort_cmd): clarify hint for Sort command.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin
101714e39b (query_default_callback): clarify widget position.
If dialog should be placed too high (in the upper half of the screen
closer to the screen top), show it centered.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin
4008d3b96c (mc_config_get_string): use mc_config_get_string_raw()
...to get rid of code duplcation.

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

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

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

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin
ebb328353e (vfs_s_subclass::dir_load): constify argument.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:44 +03:00
Andrew Borodin
db8bc2fbff Minor refactoring of path canonicalization.
(canon_path_flags_t): rename from CANON_PATH_FLAGS, add
CANON_PATH_NOCHANGE value, clarify comments.
(canonicalize_pathname_custom): rename from custom_canonicalize_pathname,
update description.
(canonicalize_pathname): add description.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:17:59 +03:00
Andrew Borodin
4ceb5c5105 (mc_chdir): clarufy setup of errno. 2022-06-05 12:00:26 +03:00
Andrew Borodin
bae8fe0af0 (vfs_path_get_by_index): set errno, update description.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:00:25 +03:00
Andrew Borodin
666586e41a Fix ENOTSUP usage.
Remove E_NOTSUPP define. Use ENOTSUP directly where required.

(vfs_clone_file): use ENOTSUP instead of EOPNOTSUPP.
(mc_open): likewize. Fix sign.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:59:32 +03:00
Andrew Borodin
5f746eea0c mceditor: minor refactoring of file load.
(edit_load_file_from_filename): make public, use it as main function to
load file and create editor window.

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

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

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

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

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

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:55:03 +03:00
Andrew Borodin
2759d080cf Viewer: use WRect to hold position and size of various areas.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:52:14 +03:00
Andrew Borodin
aac258e44e (rect_grow): new API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:50:19 +03:00
Andrew Borodin
5fae2313f3 Widget: use WRect to hold position and size.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:49:20 +03:00
Andrew Borodin
ed65694caa quick_dlg: use WRect to hold dialog position and size.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:37:04 +03:00
Andrew Borodin
3978dee37c (widget_set_size_rect): reimplement
...to pass given WRect object directly to widget callback withowt
constuction/deconstuction of intermediate WRect object.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:32:47 +03:00
Andrew Borodin
b265b388aa (input_push_history): join checks.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:29:21 +03:00
Andrew Borodin
6aeeb7ffb1 (push history): refactoring.
Rename to input_push_history().

Use input's buffer.

Don't duplicate an empty string, use current one.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:29:21 +03:00
Andrew Borodin
6639c4f070 (delete_region): use move_buffer_backward().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:29:21 +03:00
Andrew Borodin
84ec30d05a lib/widget/input.c: reorder routines.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:29:21 +03:00
Andrew Borodin
bf0dd8efb1 WInput: use GString for buffer.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:28:51 +03:00
Andrew Borodin
f91d894f9b (input_get_text): new API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:26:37 +03:00
Andrew Borodin
f4a3112d5e (input_is_empty): refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:23:37 +03:00
Andrew Borodin
50f08e2194 (find_parameters): duplicate path when that is really needed.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:23:37 +03:00
Andrew Borodin
88754d040f mcviewer: reimplement coordinate cache using GPtrArray.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:23:37 +03:00
Adam Sampson
7435010d29 Ticket #4358: tests/lib/strutil/filevercmp.c: variable redeclaration.
(filevercmp_test5): rename variables. START_TEST macro uses the variable
name _i, so GCC complains about redefining it with a different type
here.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:23:37 +03:00
Andrew Borodin
12d976eb6f src/viewer/coord_cache.c: clean up and minor refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:23:15 +03:00
Andrew Borodin
6f048314b1 (mcview_handle_key): fix variable name.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:22:46 +03:00
Andrew Borodin
03ae9ff24a Ticket #4357: code clean up before 4.8.29 release.
(set_prompt_string): use mc_g_string_dup().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 11:21:22 +03:00
Andrew Borodin
0e583d756e Merge branch '4374_version_sort_fix2'
* 4374_version_sort_fix2:
  Ticket #4374: fix file sort by version.
2022-06-04 20:58:08 +03:00
Andrew Borodin
dc67246c27 Ticket #4374: fix file sort by version.
filevercmp: don't treat entire filename as suffix.

Sync with gnulib 1ba2b66ea45f9bc43cdc0f6f93efa59157d2b2ba.

(file_prefixlen): When stripping (\.[A-Za-z~][A-Za-z0-9~]*)*$ suffixes,
do not strip the entire file name.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-04 09:01:43 +03:00
Andrew Borodin
34d3726b79 Merge branch '4374_version_sort_fix'
* 4374_version_sort_fix:
  Ticket #4374: fix file sort by version.
2022-05-29 12:14:41 +03:00
Andrew Borodin
db109be8a2 Ticket #4374: fix file sort by version.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-05-23 20:56:31 +03:00
Andrew Borodin
2480f06b30 Merge branch '3670_ftp_reconnect'
* 3670_ftp_reconnect:
  Ticket #3670: ftp: reconnect if server terminated connection.
2022-05-22 11:36:37 +03:00
Andrew Borodin
81d57da867 Ticket #3670: ftp: reconnect if server terminated connection.
(ftpfs_init_data_socket): handle return value of
getpeername()/getsockname() and try to reconnect to FTP server
for 10 attempts in case of error.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-05-22 11:33:24 +03:00
Andrew Borodin
aba8102088 Merge branch '4372_fish_resize'
* 4372_fish_resize:
  Ticket #4372: fish commands don't work after window resize.
2022-05-22 11:29:15 +03:00