Commit Graph

15997 Commits

Author SHA1 Message Date
Andrew Borodin
92bb95998e src/filemanager/filenot.c: remove useless code.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:07:13 +03:00
Andrew Borodin
d2aa6486dd (mc_tmpdir): reduce variable scope.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:07:12 +03:00
Andrew Borodin
d6a93efb2b (create_sequence): reduce variable scope, trivial refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:05:58 +03:00
Andrew Borodin
0780ef2970 Refactoring of file and directory delete routines.
* (file_progress_show_deleting): take 'vfs_path_t *' instead of 'char *'.
  * (try_erase_dir): likewise.
  * (erase_file): sync with new file_progress_show_deleting().
  * (recursive_erase): sync with new file_progress_show_deleting() and
    try_erase_dir().
  * (erase_dir_iff_empty): likewise.
  * (erase_dir): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:05:58 +03:00
Andrew Borodin
6cb97d18f1 src/strutil/xstrtol.c: sync with gnulib.
Sync with gnulib 64ddc975e72cb55d2b2d755c25603bd70312aa5e:
  This patch alters xstrtoumax behavior slightly, in areas are not
  likely to affect any real callers, by making xstrtoumax behave more
  like the system strtol. In particular, it lets xstrtoumax support
  bases other than those required by POSIX, if the underlying
  implementation does; this removes the need for an g_assert().

  * lib/strutil/strtol.c: Do not include stdio.h.
  (xstrtoumax): Use same parameter names as POSIX, to make it
  easier for outsiders to follow. Do not require the base to be 0-36,
  as the underlying implementation is allowed to support other bases.

Sync with gnulib 16b33e6649425fcdce095f262da98b539d2f7448.

  * (xstrtoumax): Don't update *endptr if strtol doesn't.
  Also, if the underlying strtol gives an unusual error number and
  sets *endpnr = nptr, assume that's an error not a missing number.

Sync with gnulib bd1e981434c98751b1106a1744e77a27317b52b3
  * (xstrtoumax): Stop worrying about hypothetical implementations that
  are causing more confusion than the code is worth. Instead, go back
  more to old way of doing things.  None of this matters for practical
  applications.

Add commemt.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:05:58 +03:00
Andrew Borodin
4e9f4b97cb (user_menu_cmd): port to GPtrArray.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:05:58 +03:00
Andrew Borodin
bb4e152c59 (extract_line): optionally return the lengh of the line.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:05:58 +03:00
Andrew Borodin
bb5b35be9e (user_menu_cmd): refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:05:58 +03:00
Andrew Borodin
5288f994c4 (user_file_menu_cmd): move to src/usermenu.h and make inline.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:05:58 +03:00
Andrew Borodin
2db4f47bdd (tr_utf8_search_{first,last}): minor refactoring.
Reduce variable scope.
Call strlen(search) before loop.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:05:58 +03:00
Andrew Borodin
87f46330d5 (str_utf8_make_make_term_form): call strlen() one time.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:05:58 +03:00
Andrew Borodin
cb4c49f143 strutils: don't call strlen() in MIN() macro.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:05:58 +03:00
Andrew Borodin
bc79d61b2d (str_verscmp): glibification.
Use g_ascii_isdigit() instead of isdigit().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:05:58 +03:00
Andrew Borodin
b5f465a3d8 (filevercmp): make inline.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:05:58 +03:00
Andrew Borodin
f47688a781 lib/vfs/interface.c: add missed INDENT-ON, indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:05:58 +03:00
Andrew Borodin
3da5412999 maint/utils/update-years.sh: add tests/src/vfs/extfs/helpers-list/test_all.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:05:58 +03:00
Andrew Borodin
1ecda3f616 doc/NEWS: indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:05:58 +03:00
Dmitry Atamanov
8fc494fa63 Ticket #4572: code cleanup before 4.8.33 release
Add shtml to mc.ext.ini (closes MidnightCommander/mc#205)

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-05 15:05:58 +03:00
Yury V. Zaytsev
a24d45ffab Merge branch '3972_fix_illumos'
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-05 11:49:38 +02:00
Yury V. Zaytsev
8f723b8a7f charset: reimplement is_supported_encoding to use iconv instead of mc built-in charset table
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-05 11:49:26 +02:00
Andrew Borodin
f4ef5c64a4 (edit_draw_this_line): fix printable character recognition in 8-bit locales when displaying UTF-8
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-05 11:49:26 +02:00
Yury V. Zaytsev
c079a09612 tests: edit_complete_word_cmd - fix -Winvalid-source-encoding to make it easier to debug
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-05 11:49:26 +02:00
Andrew Borodin
35c103fa97 (str_crt_conv_from): handle INVALID_CONV.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-05 11:49:26 +02:00
Andrew Borodin
3526dfcf34 (str_nconvert_to_display, str_nconvert_to_input): handle invalid conversion.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-05 11:49:26 +02:00
Yury V. Zaytsev
1e0e6b5e1e charset: rename IBM866 to CP866 for iconv and adjust charset names for codeset
```
linux $ iconv -l | grep 866
866//
866NAV//
CP866//
CP866NAV//
CSIBM866//
IBM866//
IBM866NAV//

solaris $ iconv -l | grep 866
    CP866 (CP866, CP-866, CP_866, 866),
    IBM-866,

macos % iconv -l | grep 866
CP866 866 CSIBM866 IBM866 MSCP866

musl/src/locale/codepages.h: "cp866\0"
```

On glibc-based systems, codeset will be set to charmap name, on most other systems it seems to be taken from locale name.

## Linux

```
zaytsev@fedora:~$ locale -a | grep ru
ru_RU
ru_RU.cp866
ru_RU.ibm866
ru_RU.iso88595
ru_RU.koi8r
ru_RU.utf8
russian
ru_UA
ru_UA.koi8u
ru_UA.utf8

zaytsev@fedora:~/src$ LC_ALL=ru_RU.cp866 LANG=ru_RU.cp866 ./a.out
IBM866

zaytsev@fedora:~/src$ LC_ALL=ru_RU.koi8r LANG=ru_RU.koi8r ./a.out
KOI8-R

zaytsev@fedora:~/src$ LC_ALL=ru_RU.iso88595 LANG=ru_RU.iso88595 ./a.out
ISO-8859-5
```

## macOS

```
ru_RU.ISO8859-5
ru_RU.CP866
ru_RU.CP1251
ru_RU.UTF-8
ru_RU.KOI8-R
ru_RU

zaytsev@Yurys-MBP mc % LANG=ru_RU.CP866 LC_ALL=ru_RU.CP866 ./a.out
CP866

zaytsev@Yurys-MBP mc % LANG=ru_RU.ISO8859-5 LC_ALL=ru_RU.ISO8859-5 ./a.out
ISO8859-5
```

## FreeBSD

```
ru_RU.CP1251
ru_RU.CP866
ru_RU.ISO8859-5
ru_RU.KOI8-R
ru_RU.UTF-8

zaytsev@cfarm240:~ $ LANG=ru_RU.ISO8859-5 LC_ALL=ru_RU.ISO8859-5 ./a.out
ISO8859-5

zaytsev@cfarm240:~ $ LANG=ru_RU.CP866 LC_ALL=ru_RU.CP866 ./a.out
CP866
```

## Solaris

```
ru
ru.UTF-8
ru.koi8-r
ru_RU
ru_RU.ANSI1251
ru_RU.ISO8859-5
ru_RU.KOI8-R
ru_RU.UTF-8

zaytsev@gcc-solaris10:~/src$ LANG=ru_RU.ISO8859-5 LC_ALL=ru_RU.ISO8859-5 ./a.o>
ISO8859-5

zaytsev@gcc-solaris10:~/src$ LANG=ru.koi8-r LC_ALL=ru.koi8-r ./a.out
KOI8-R
```

## AIX

```
zaytsev@gcc111:[/home/zaytsev]locale -a
C
POSIX
en_US.8859-15
en_US.IBM-858
en_US.ISO8859-1
en_US

-bash-5.1$ LANG=en_US.ISO8859-1 LC_ALL=en_US.ISO8859-1 ./a.out
ISO8859-1
```

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-05 11:49:26 +02:00
Yury V. Zaytsev
f34e2ae715 tests: use UTF-8 to prevent creation of invalid converters
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-05 11:49:26 +02:00
Yury V. Zaytsev
319598df41 tests: path_len - fix assertions, now test should fail
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-05 11:49:26 +02:00
Yury V. Zaytsev
07e24c0289 lib/path: clarify conditions for creating converters
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-05 11:49:26 +02:00
Yury V. Zaytsev
ffd6fd11f7 ydiff: fix -Wdiscarded-qualifiers warning
```
../../../src/diffviewer/ydiff.c:613:17: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  613 |         next_ch = g_utf8_next_char (str);
```

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-05 11:49:26 +02:00
Yury V. Zaytsev
faea164957 buildsys: add warning for non-GNU gettext and fix shellcheck issues
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-05 11:49:26 +02:00
Yury V. Zaytsev
f84099512e extfs helpers: remove usage of local, instead use subshell to isolate variables
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-05 11:49:26 +02:00
Yury V. Zaytsev
8978b7f1d6 Ticket #3972: fix test harness on Illumos by resolving shellcheck warnings
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-05 11:49:26 +02:00
Marco Ciampa
6dd05af26c Updated Italian translation 2024-09-27 09:31:00 +02:00
Yury V. Zaytsev
449917f5a4 Merge branch '4588_vim_keymap'
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-09-25 08:57:23 +02:00
Kirill Rekhov
f425b90402 Ticket #4588: add vim keymap
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-09-23 14:00:47 +02:00
Yury V. Zaytsev
9e06a50eb8 Merge branch '4479_console_players'
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-09-18 18:28:43 +02:00
Yury V. Zaytsev
50976cec62 shell: replace which with command -v for speed and POSIX compatibility
https://stackoverflow.com/a/677212/5132088

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-09-11 08:45:25 +02:00
Yury V. Zaytsev
572312bd88 Ticket #4479: prioritize console players for audio/video and images
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-09-10 10:00:28 +02:00
Yury V. Zaytsev
84af354d2a Merge branch '4583_mc_ext_ini_fix'
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-09-05 17:58:36 +02:00
Andrey Semashev
92f56dc679 Ticket #4583: Fix a typo for apt view command line.
Fixes MidnightCommander/mc#206.

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-09-05 10:57:05 +02:00
Yury V. Zaytsev
7a3a763f0e Merge branch '4575_mc-wrapper-2'
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-09-03 07:40:01 +02:00
Yury V. Zaytsev
d081bc68aa main: remove O_EXCL for wd-file since creation is now managed by wrapper
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-09-03 07:39:25 +02:00
Yury V. Zaytsev
a3ce493ae2 vfs: fix tempdir path building to account for trailing slash on macOS
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-09-03 07:39:25 +02:00
Yury V. Zaytsev
e2d96fa802 Ticket #4575: adjust mc-wrapper to fit changes in #4535.
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-09-01 12:19:16 +02:00
Andrew Borodin
242c413d80 Merge branch '4580_mcedit_segfault'
* 4580_mcedit_segfault:
  Ticket #4580: mceditor: segfault on new file creation.
2024-08-29 21:52:45 +03:00
Gabriel Vlasiu
66bfefbf1a Ticket #4580: mceditor: segfault on new file creation.
(edit_init): fix NULL dereference.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-08-29 21:04:40 +03:00
Yury V. Zaytsev
876555035a Ticket #4576: fix visual glitches by avoiding g_module_close on NULL while loading libaspell
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-08-25 17:35:54 +02:00
Yury V. Zaytsev
ac4305dde4 Update translations from Transifex
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-08-23 19:22:35 +02:00
Andrew Borodin
5e64cc637f (file_op_context_create_ui): apply callback to the "Abort" button
...to keep the file progress dialog visible.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-08-20 22:01:52 +03:00
Yury V. Zaytsev
ad96349c91 x11: fix -Wdeprecated-declarations for g_module_build_path
```
x11conn.c:140:5: warning: 'g_module_build_path' is deprecated [-Wdeprecated-declarations]
  140 |     x11_module_fname = g_module_build_path (NULL, "X11");
      |     ^~~~~~~~~~~~~~~~
```

Reported-by: David Martín <dhmartina@yahoo.es>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-08-15 21:09:08 +02:00