Commit Graph

15965 Commits

Author SHA1 Message Date
Andrew Borodin
2e3e3a3775 Merge branch '4459_sed'
* 4459_sed:
  Replaced unportable 'inplace' sed command
  Use configure detected or user specified sed in build system
  Ticket #4459: usage of 'sed' in build system/makefiles is not portable.
2023-05-20 20:06:54 +03:00
Evgeny Grin
68e6d960f8 Replaced unportable 'inplace' sed command
'-i' sed option is not portable, not specified by POSIX and does not
work on same platforms.
Replaced with simple and obvious workarounds.

Closes MidnightCommander/mc#184.

Signed-off-by: Karlson2k (Evgeny Grin) <k2k@narod.ru>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-05-20 19:57:23 +03:00
Evgeny Grin
f45d02ba2a Use configure detected or user specified sed in build system
Sometimes system default sed is not the best option.
With this modification user may easily override sed used by build system
without editing any file.

Signed-off-by: Karlson2k (Evgeny Grin) <k2k@narod.ru>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-05-20 19:56:53 +03:00
Evgeny Grin
054a051b42 Ticket #4459: usage of 'sed' in build system/makefiles is not portable.
configure: add explicit sed detection

Actually SED variable is set automatically by LT_INIT currently.
Having explicit check should help avoiding problems if/when LT_INIT
changed.

Signed-off-by: Karlson2k (Evgeny Grin) <k2k@narod.ru>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-05-20 19:56:32 +03:00
Andrew Borodin
e5911c1ef5 Merge branch '1952_tar'
* 1952_tar:
  tar: add support of extended headers.
  struct vfs_s_inode: add the 'user_data' member.
  tar: prepare to support the POSIX extended headers.
  tar: refactoring of archive reading.
  (tar_read_header): move entry/inode creation to new function tar_insert_entry().
  tar: use separate structure to store various file info.
  (tar_read_header): minor optimization.
  (tar_read_header): rename variable.
  (tar_find_next_block): rename from tar_get_next_block.
  src/vfs/tar/tar.c: remove period from error messages.
  (tar_read_header): rename variables.
  (tar_get_next_block): use file descriptor from archive descriptor.
  (tar_open_archive_int): return status of tar archive open
  src/vfs/tar/tar.c: clarify support of OLDGNU format.
  (tar_decode_header): do not decode size here.
  Ticket #1952: tar: support long file names in archive.
2023-05-20 19:45:28 +03:00
Andrew Borodin
8d1427d183 tar: add support of extended headers.
Most of the code is taken from GNU tar.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-05-01 13:07:29 +03:00
Andrew Borodin
290a57b474 struct vfs_s_inode: add the 'user_data' member.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-05-01 13:04:41 +03:00
Andrew Borodin
ffe6412c30 tar: prepare to support the POSIX extended headers.
Move required stuff to tar-internal.{ch} files.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-05-01 13:04:29 +03:00
Andrew Borodin
8223f82857 tar: refactoring of archive reading.
Make it close to GNU tar imlementation.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-05-01 13:02:57 +03:00
Andrew Borodin
4158824d70 (tar_read_header): move entry/inode creation to new function tar_insert_entry(). 2023-05-01 13:02:57 +03:00
Andrew Borodin
c35dfc3363 tar: use separate structure to store various file info.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-05-01 13:02:57 +03:00
Andrew Borodin
d4d0fe6019 (tar_read_header): minor optimization.
Calculate length of file and link name if that is really needed.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-05-01 13:02:42 +03:00
Andrew Borodin
d4ded63724 (tar_read_header): rename variable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-04-23 20:51:57 +03:00
Andrew Borodin
07a0aa352d (tar_find_next_block): rename from tar_get_next_block.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-04-23 20:51:57 +03:00
Andrew Borodin
3ed39fb883 src/vfs/tar/tar.c: remove period from error messages.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-04-23 20:51:56 +03:00
Andrew Borodin
3a9524979c (tar_read_header): rename variables.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-04-23 20:51:56 +03:00
Andrew Borodin
96ebde8d68 (tar_get_next_block): use file descriptor from archive descriptor.
(tar_skip_n_records): likewise.
(tar_read_header): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-04-23 20:51:56 +03:00
Andrew Borodin
74c16acf6a (tar_open_archive_int): return status of tar archive open
... instead of file descriptor.

(tar_open_archive): remove variable stored file descriptor. Use file
descriptor from archive descriptor.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-04-23 20:51:56 +03:00
Andrew Borodin
35e548b054 src/vfs/tar/tar.c: clarify support of OLDGNU format.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-04-23 20:51:56 +03:00
Andrew Borodin
d647914bfb (tar_decode_header): do not decode size here.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-04-23 20:51:56 +03:00
Andrew Borodin
78a25f7800 Ticket #1952: tar: support long file names in archive.
Initial changeset: tar.c: update code to be close to GNU tar.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-04-23 20:49:41 +03:00
Andrew Borodin
86a9e0be2c Merge branch '4450_pcre2'
* 4450_pcre2:
  Ticket #4450: support PCRE2 in the search engine.
2023-04-02 20:53:23 +03:00
Andrew Borodin
49624e473b Ticket #4450: support PCRE2 in the search engine.
* m4.include/ax_path_lib_pcre.m4: replace by recent version from GNU
Autoconf Archive.
  * m4.include/ax_check_pcre2.m4: get grom GNU Autoconf Archive.
  * m4.include/mc-check-search-type.m4: support both PCRE versions.
  * */*/Makefile.am: remove @CHECK_CFLAGS@ and @PCRE_LIBS@ ads they are
added via AX_PATH_LIB_PCRE and AX_CHECK_PCRE2.
  * lib/search.h, lib/search/: add support of PCRE2. Thanks broly <gagan@hotmail.com>
for the initial patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-25 10:07:41 +03:00
Andrew Borodin
be3822cafa Merge branch '4426_cleanup'
* 4426_cleanup: (38 commits)
  Update po/*.po files.
  (edit_find_editor): rename from find_editor.
  Listbox window: rename functions.
  (buttonbar_find): rename from find_buttonbar.
  Menu: rename functions.
  (advanced_chown_cmd): use intermediate variables to make text more readable.
  Use mc_fgetflags() and mc_fsetflags() where needed.
  VFS: mc_fgetflags, mc_fsetflags: new APIs.
  Minor optimization of chown/chmod/chattr operations.
  (operate_single_file): clarify creation of file operation UI.
  (dlg_default_destroy): send MSG_DESTROY to the dialog itself
  Collect all editor options to structure.
  Add EDIT and CONST_EDIT macros.
  usermenu: clarify compilation w/o internal editor.
  src/editor/spell.c: add missed #include.
  Update template for .c files.
  (do_search): remove intermediate variable.
  (do_search): get rid of string duplication.
  Change WDialog::data from void* to union{void*, int}
  Don't create an empty string in WLabel objects.
  ...
2023-03-19 20:40:09 +03:00
Andrew Borodin
acedeff17a Update po/*.po files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:39:51 +03:00
Andrew Borodin
a286f042d4 (edit_find_editor): rename from find_editor.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin
c157b048e5 Listbox window: rename functions.
create_listbox_window -> listbox_window_new
create_listbox_window_centered -> listbox_window_new_centered
run_listbox -> listbox_run
run_listbox_with_data -> listbox_run_with_data

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin
d9383ba8b3 (buttonbar_find): rename from find_buttonbar.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin
fd2d5b49ac Menu: rename functions.
menu_entry_create -> menu_entry_new
menu_separator_create -> menu_separator_new
create_menu -> menu_new
destroy_menu -> menu_free
find_menubar -> menubar_find

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin
a242e8b91f (advanced_chown_cmd): use intermediate variables to make text more readable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin
79c8a351ba Use mc_fgetflags() and mc_fsetflags() where needed.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin
2a6580127a VFS: mc_fgetflags, mc_fsetflags: new APIs.
(mc_fgetflags): fgetflags(3) VFS wrapper.
(mc_fsetflags): fsetflags(3) VFS wrapper.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin
50f4717f45 Minor optimization of chown/chmod/chattr operations.
(try_chmod): create filename when required.
(try_chown): likewise.
(try_advanced_chown): likewise.
(try_chattr): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin
6329771fc0 (operate_single_file): clarify creation of file operation UI.
Create UI to show confirmation dialog in case of foreground operation
regardless of ENABLE_BACKGROUND.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin
47da3a764a (dlg_default_destroy): send MSG_DESTROY to the dialog itself
...to avoid various memory leaks.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin
8a951746b3 Collect all editor options to structure.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin
d2b9454f4b Add EDIT and CONST_EDIT macros.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin
683122482b usermenu: clarify compilation w/o internal editor.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andreas Mohr
de1edb72f8 src/editor/spell.c: add missed #include.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin
7257f794d2 Update template for .c files.
Add section for forward declarations of local functions. This section is
located before file scope variables because functions can be used in
strucutres (see find.c for example):

/*** forward declarations (file scope functions) *************************************************/

/* button callbacks */
static int start_stop (WButton * button, int action);
static int find_do_view_file (WButton * button, int action);
static int find_do_edit_file (WButton * button, int action);

/*** file scope variables ************************************************************************/

static struct
{
    ...
    bcback_fn callback;
} fbuts[] =
{
    ...
    { B_STOP, NORMAL_BUTTON, N_("S&uspend"), 0, 0, NULL, start_stop },
    ...
    { B_VIEW, NORMAL_BUTTON, N_("&View - F3"), 0, 0, NULL, find_do_view_file },
    { B_VIEW, NORMAL_BUTTON, N_("&Edit - F4"), 0, 0, NULL, find_do_edit_file }
};

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin
e1ff8d94e4 (do_search): remove intermediate variable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin
c7f9329dcb (do_search): get rid of string duplication.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin
584fb9815c Change WDialog::data from void* to union{void*, int}
...to use data of type other than pointer w/o extra type cast.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin
c5466cd494 Don't create an empty string in WLabel objects.
* (simple_status_msg_init_cb): pass NULL instead of "" to label_new()
    to get rid of an empty string duplication.
  * (advanced_chown_dlg_create): likewise.
  * (chown_dlg_create): likewise.
  * (dirsize_status_init_cb): likewise.
  * (file_op_context_create_ui): likewise.
  * (setup_gui): likewise.
  * (init_hotlist): likewise.
  * (init_learn): likewise.
  * (file_progress_show_source): pass NULL instead of "" to
    label_set_text() to get rid of an empty string duplication.
  * (file_progress_show_target): likewise.
  * (create_file_manager): pass NULL instead of 0 to label_new().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin
e472f23c13 Don't NULLify objects by returned value of g_ptr_array_free().
g_ptr_array_free(obj, ...) returns a pointer (including NULL) to
obj->pdata, not to obj.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrei Stepanov
08a89a87aa doc/man/ru/mc.1.in: fix typos.
Closes MidnightCommander/mc#179.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin
000c1f18e6 src/vfs/tar/tar.c: reorder routines.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin
ea93350506 (tar_decode_header): use offsetof().
Sync with GNU tar b8feb2b14247d76200fd53607d3613c82b6e5b81.

Access header->buffer + offsetof (struct posix_header, magic), instead
of header->header.magic, when reading or writing the OLDGNU_MAGIC
pattern. The code violates the C standard without this change, and GCC
warns about this if fortify checking is enabled. It's not a bug on
traditional (i.e., non-debugging) platforms, but it does violate the C
standard so it should be fixed. Problem originally reported by John
Emil Karlson in
<http://lists.gnu.org/archive/html/bug-tar/2010-04/msg00023.html>.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin
4a17f02b21 (tar_skip_n_records): change type of n to off_t.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00
Andrew Borodin
4ae197e788 (tar_checksum): sync with GNU tar b5db9788306d45cd9432fda71236f07b8a214212.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:23 +03:00