Commit Graph

468 Commits

Author SHA1 Message Date
Yury V. Zaytsev
93b539444b Ticket #4584: re-implement mocking via weak symbols instead of symbol duplication
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-19 08:56:40 +02:00
Yury V. Zaytsev
d11faea07d doc: fix typos in comments
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-10-05 18:55:01 +02:00
Andrew Borodin
c5379ab36e lib/vfs/path.h: fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:07:14 +03:00
Andrew Borodin
d3c26320d4 lib/vfs/direntry.c: fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:07:14 +03:00
Andrew Borodin
de9551be13 lib/vfs/vfs.c: fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-10-05 15:07:14 +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
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
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
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
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
eb1375b65d vfs: implement support for all known stat formats and centralize handling
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-07-28 10:00:52 +02:00
Yury V. Zaytsev
c8e8f01faf utilvfs: concentrate timesbuf handling in one place
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-07-28 10:00:52 +02:00
Yury V. Zaytsev
77e5913c02 utilvfs: abstract mc_timesbuf_t handling with own mc_timespec_t type
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-07-28 10:00:52 +02:00
Yury V. Zaytsev
191108766f Ticket #4542: fix support of timestamps with nanosecond precision on macOS
utilvfs: isolate utime / utimensat calls in a helper function

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-07-28 10:00:52 +02:00
Yury V. Zaytsev
ab7ed3cf2c maint: fix typo in variable name (parse_ls_vga.c)
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-06-03 20:44:09 +02:00
Yury V. Zaytsev
bda4e480d2 maint: fix typos in the code
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2024-06-03 16:18:04 +02:00
Andrew Borodin
6718b3ec26 Indentation using GNU indent-2.2.13.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:13 +03:00
Andrew Borodin
5a67afc812 (vfs_path_build_url_params_str): minor refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:13 +03:00
Andrew Borodin
9e039f66d1 (vfs_path_from_str_uri_parser): fix coding style.
(vfs_path_to_str_flags): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:13 +03:00
Andrew Borodin
46ea5e2a99 Clarify handling of "#enc:".
* (vfs_canon): treate "#enc:" as a regular part of path in case of
    --disable-charset.
  * (realpath_test): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:34 +03:00
Andrew Borodin
8e55057fa3 (vfs_path_from_str_uri_parser): fixups.
Handle potential NULL argument.
Clarify detection of absolute path: handle a case when path starts
with #enc:.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:34 +03:00
Andrew Borodin
ab3e3339bb vfs_dirent: add new member d_len to get rid of d_name length calculation.
* (vfs_dirent_assign): set d_len up.
  * (mc_readdir): sync with new vfs_dirent: use d_len member.
  * (filename_completion_function): likewise.
  * (handle_dirent): likewise.
  * (find_ignore_dir_search): add 2nd argument to use length of
    directory name if it's known.
  * (do_search): sync with modified vfs_dirent and find_ignore_dir_search().
  * (NLENGTH): remove.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:41:34 +03:00
Andrew Borodin
2fda4c6670 Ticket #4535: change name of temporary drirectory.
* (mc_tmpdir): use g_mkdtemp() to create temporary directory.
  Make it name unique to avoid conflicts with other software such as
  Distrobox container.
  * (main): temporary directory has unique name from now. Remove it at exit.
2024-05-13 21:48:35 +03:00
Andrew Borodin
fe42478b97 Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-01-01 09:46:17 +03:00
Andrew Borodin
1821e0e2f8 (vfs_path_build_url_params_str): return NULL instead of an empty string.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:13 +03:00
Andrew Borodin
6ca4ab4b4e Rename FISH VFS to SHELL one. 2023-10-15 16:04:39 +03:00
Andrew Borodin
978ce6d0dd Use vfs_path_get_last_path_vfs() where it is resonable. 2023-08-04 21:04:55 +03:00
Andrew Borodin
883f7af560 (mc_fstat): define via MC_HANDLEOP macro.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-08-04 21:04:55 +03:00
Andrew Borodin
2124ffa498 (mc_stat, mc_lstat): define via macro.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-08-04 21:04:55 +03:00
Andrew Borodin
30e64b5f4c lib/vfs/utilvfs.c: clean up, fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-08-04 21:04:54 +03:00
Andrew Borodin
b4cf765748 (vfs_url_split): replace the 'while' loop with strchr().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-08-04 21:04:54 +03:00
Andrew Borodin
8455ff8dfd (vfs_path_to_str_flags): create recode_buffer only when required.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-08-04 21:04:11 +03:00
Andrew Borodin
3616877462 (vfs_get_cwd): rename from _vfs_get_cwd(), simplify.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-08-04 21:04:11 +03:00
Andrew Borodin
52572d5b80 (vfs_path_new): add argument to create relative path object.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-08-04 21:04:11 +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
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
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
Kian-Meng Ang
5001232704 Fix various typos in the source code (closes MidnightCommander/mc#177).
Found via `codespell -S
po,doc,./misc/syntax,./src/vfs/extfs/helpers/README.it -L
parm,rouge,sav,ect,vie,te,dum,clen,wee,dynamc,childs,ths,fo,nin,unx,nd,iif,iterm,ser,makrs,wil`

Co-authored-by: Yury V. Zaytsev <yury@shurup.com>
Signed-off-by: Kian-Meng Ang <kianmeng@cpan.org>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2023-01-28 21:38:05 +03:00
Andrew Borodin
57c61b7681 Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin
6e8e55ed05 (vfs_s_open): reuse variable for directory name and file name.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin
fad7029502 lib/vfs/vfs.h: move comment to proper place.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin
6a83438163 (vfs_s_retrieve_file): use symbolic name for array size.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin
5a40f24658 (vfs_path_build_url_params_str): return GString.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin
ab897e4ca6 (vfs_path_element_build_pretty_path_str): return GString.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:04 +03:00
Andrew Borodin
b69168cfb5 Ticket #4420: fail to build with only SFTP network VFS enabled.
* m4.include/mc-vfs.m4: use $enable_vfs_sftp to test functions
    required for network VFSes. Define ENABLE_VFS_NET preprocessor
    macro here...
  * lib/vfs/vfs.h: ...not here.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-12-30 08:08:47 +03:00
Andrew Borodin
5db6715a5f VFS: don't use vfs_s_inode::data_offset for file name normalization.
Use new member vfs_s_entry::leading_spaces for that.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-10 21:07:40 +03:00
Andrew Borodin
52fd6215b0 Ticket #4357: code clean up before 4.8.29 release.
(vfs_s_open): minor optimization.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-10-10 21:07:40 +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