Revert "(operate_single_file): make src and dest file name unescaping"
This reverts commit ef5d346dd9.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
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>
(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>
* (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>
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>
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>
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>
...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>
...whitin same file system.
Initial commit: cleanup: WITH_FULL_PATHS is defined permanently.
Remove it.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
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>
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>
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>
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>
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>
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>
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>
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>
../../../../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>
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>
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>
* (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>
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>
(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>
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>
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>
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>
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>
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>
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>
`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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
* (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>
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>
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>
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.
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).
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
(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>
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>
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>
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>
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>
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>