Commit Graph

91 Commits

Author SHA1 Message Date
Mooffie
7be9334e45 Fix quotes handling.
Note: considering that this feature hasn't worked, we may consider removing it
entirely or partially (e.g., escaping) in order to simplify the code, as nobody
has grown used to it. It seems, based on the "hex mode" mentioned in the manual
page, that in the past there was no "normal" search in hex mode, and quoted
strings were the only easy way to look for text. This is no longer the case
nowadays.

Note: the characters in the quoted string are copied out as-is to the regexp.
No regexp-quoting is currently done. We may want to revisit this issue when we
work on ticket #3695.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
64e6ccef7f Handle invalid characters.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
cc8fcdcfc0 Fix trailing whitespace problem.
sscanf() returns EOF when it reaches the end of the string. Our code
erroneously interprets this as if a number was read. The fix: we test for an
explicit '1'.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
b25af93874 Report errors to the user.
Instead of silently accepting invalid patterns, we notify the user of errors.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:26 +03:00
Mooffie
3332d1ebe4 Ticket #3694: fix hex pattern parsing.
Add test for mc_search__hex_translate_to_regex().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:54:43 +03:00
Mooffie
306b30ed30 Ticket #3687: store the 'hotlist' file in data dir, not config dir.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:48:02 +03:00
Andrew Borodin
2356acc26d NULL-ize some variables to make unit tests happy.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
2151edaff2 Get rid of global variables mc_main_config and mc_panels_config.
Use mc_global.main_config and mc_global.panels_congig instead.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andreas Mohr
eef076cef6 cppcheck: Cleanup Passing NULL after the last typed argument warning
Cleanup Passing NULL after the last typed argument warning.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andrew Borodin
c4258d453b Clarify AM_CPPFLAGS.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-03-04 09:23:36 +03:00
Andrew Borodin
c49d7f76b0 tests/lib/serialize.c: fix error codes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-02-02 10:08:08 +03:00
Andrew Borodin
98e66fe406 Ticket #3491: fix case insensitive search in non-unicode locales.
In non-unicode locales, search for non-latin symbols in any acharset was
case sensitive only.  This bug was introduced in
1a1496fc0d.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-02-02 09:37:15 +03:00
Andrew Borodin
471ea781ca Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-01-01 11:48:10 +03:00
Andreas Mohr
697e406eb8 Robust sizeof() usage at function parameter and use memcpy destination sizeof...
...for more resilient to errors.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-01-01 11:48:09 +03:00
Andreas Mohr
5007d309bc Fix -Wconversion warning for mc_search_new().
mc_search_new() parameter orignial_len use once only.
Factor out into own function mc_search_new_len().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-01-01 11:48:07 +03:00
Slava Zanko
bf1ff69fb8 Code refactoring
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2015-11-10 13:29:45 +03:00
Alexander Kriegisch
09ed02ea85 Minor code changes.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2015-11-10 11:55:38 +03:00
Andrew Borodin
d9ad3d2e32 Clarify __attribute ((format (printf))) usage.
Thanks Andreas Mohr <and@gmx.li> for the original patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-11-05 14:33:20 +03:00
Andrew Borodin
2789e6e390 Ticket #3431: add missing default cases.
Introduce -Wswitch-default check.

Some minor cosmetics.

Thanks Andreas Mohr <and at gmx dot li> for original patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-03 19:43:50 +03:00
Slava Zanko
517cc5cfe4 Fixes in tests
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2015-05-03 19:43:49 +03:00
Andreas Mohr
8a2f9e253d Ticket #3430: introduce -Wundef check to catch macro typos.
Use always defined MC_HOMEDIR_XDG macro.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-03 19:43:48 +03:00
Egmont Koblinger
1a1496fc0d Ticket #3416: viewer case insensitive search doesn't find accents.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2015-03-19 11:16:24 +03:00
Andrew Borodin
573136ac64 tests/lib/search/Makefile.am: fix name of variable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-02-26 09:41:09 +03:00
Andrew Borodin
454479549c Update copyright years. 2015-02-26 09:12:08 +03:00
Boris Savelev
933fd255d0 Ticket #2743: File selection by patterns uses bytes instead of (unicode) characters.
Using the "?" pattern in the file selection dialog brought up with '+',
mc uses the file name length in bytes instead of characters.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2015-02-25 12:59:57 +03:00
Boris Savelev
6ca737d230 The patch does not intend to fix all Bash patterns (I believe mc never claimed to support all kinds of them), but it fixes some issues.
Namely, backslash-escaped metacharacter like {}*? will remain in the pattern (with the current code it is just stripped). Second, comma will be transformed to | only inside a group.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2015-02-24 14:58:51 +03:00
Slava Zanko
0eca32a852 Ticket #2309: "Shell patterns" broken beyond repair.
Fix tests execution. Add new test which covers current functionality of glob2regexp.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2015-02-23 16:31:37 +03:00
Andrew Borodin
47b02f4c23 Add test for mc_search_glob_prepare_replace_str(). 2015-01-14 09:50:50 +03:00
Andrew Borodin
60334cfce8 tests/lib/vfs: update copyright notice.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-02-28 13:33:17 +04:00
Andrew Borodin
e5203cb023 Fix name of FSF in all *.c files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-02-28 13:33:17 +04:00
Andrew Borodin
f0da49345a Collapse list of copyright years to ranges. Add 2014 year.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-02-10 16:27:03 +04:00
Slava Zanko
4449cfb3c5 Add tests for check that symlinks in cwd are handled correctly.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-12-27 19:07:58 +04:00
Slava Zanko
a57d45d590 Ticket #3098: vfs_path_from_str_flags() doesn't support VPF_STRIP_HOME
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-11-08 16:57:42 +03:00
Andrew Borodin
f5f177e711 Fix indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-11-06 16:38:52 +04:00
Andrew Borodin
61dc030772 More tests for canonicalize_pathname().
(custom_canonicalize_pathname): fix wrong condition. Remove redundant
break.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-10-04 09:14:08 +04:00
Andrew Borodin
ccf82ada12 Add functions to transform string to unsigned integer:
* (xstrtoumax): from gnulib.
 * (parse_integer): from coreutils (dd.c).

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-07-05 09:09:03 +04:00
Slava Zanko
d2eac2f5af Code reorganization and fixes around the vfs_path_as_str() function
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-06-28 09:21:16 +04:00
Andrew Borodin
3662b84ba1 (vfs_get_encoding): optimization and enhancement:
* get rid of extra memory duplication;
  * support of recursive search of correct encoding;
  * add tests.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-03 14:21:02 +03:00
Slava Zanko
2640b21bb9 Remove vfs_path_to_str() function for avoid often memory allocations.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-06-03 14:21:01 +03:00
Slava Zanko
79ee80c201 Code refactoring in tests.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-03-09 16:04:19 +04:00
Slava Zanko
1bd438923d Code refactoring in tests.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-03-09 16:04:19 +04:00
Slava Zanko
063d5a134f Code refactoring in tests.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-03-09 16:04:18 +04:00
Slava Zanko
c984447f8e Rename vfs_path_cmp() to vfs_path_equals()
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-03-09 16:04:18 +04:00
Andrew Borodin
8454f12f8f Ticket #2954: fix typo: occured -> occurred.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-03-09 16:04:18 +04:00
Slava Zanko
61fb6e33b3 Code refactoring in tests.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-03-09 16:04:18 +04:00
Slava Zanko
0e3550594f Create tests/mctest.h with useful inline macros
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-03-09 16:04:18 +04:00
Slava Zanko
5f99213a5e Ticket #2944: Prepare for release mc-4.8.8
Code indentation in tests.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-03-09 16:04:17 +04:00
Slava Zanko
808988b1f1 Add lib/strutil/replace:str_replace_all() function.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-02-16 17:40:37 +03:00
Slava Zanko
c2f030f2e8 Add new functions:
* int my_systeml (int flags, const char *shell, ...);
 * int my_systemv (const char *command, char *const argv[]);

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-02-16 17:39:33 +03:00
Slava Zanko
254aa70ac8 Add tests for lib/utilunix.c:my_system() function
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-02-16 17:39:32 +03:00