- support shell patterns in copy dialog (#516180)

(http://www.midnight-commander.org/ticket/414)
This commit is contained in:
Jindrich Novy 2009-08-07 10:53:58 +00:00
parent 95f47c2448
commit 78571b53e4
2 changed files with 48 additions and 1 deletions

41
mc-shell-patterns.patch Normal file
View File

@ -0,0 +1,41 @@
diff -d -urpN mc.7/src/search/glob.c mc.8/src/search/glob.c
--- mc.7/src/search/glob.c 2009-06-29 14:06:35.000000000 +0200
+++ mc.8/src/search/glob.c 2009-07-03 12:40:36.000000000 +0200
@@ -141,8 +142,36 @@ mc_search__run_glob (mc_search_t * mc_se
}
/* --------------------------------------------------------------------------------------------- */
+static GString *
+mc_search__translate_replace_glob_to_regex (gchar *str)
+{
+ GString *buff = g_string_new ("");
+ int cnt = '0';
+
+ while (*str) {
+ char c = *str++;
+ switch (c) {
+ case '*':
+ case '?':
+ g_string_append_c (buff, '\\');
+ c = ++cnt;
+ break;
+ /* breaks copying: mc uses "\0" internally, it must not be changed */
+ /*case '\\':*/
+ case '&':
+ g_string_append_c (buff, '\\');
+ break;
+ }
+ g_string_append_c (buff, c);
+ }
+ return buff;
+}
+
GString *
mc_search_glob_prepare_replace_str (mc_search_t * mc_search, GString * replace_str)
{
- return mc_search_regex_prepare_replace_str (mc_search, replace_str);
+ GString *repl = mc_search__translate_replace_glob_to_regex(replace_str->str);
+ GString *res = mc_search_regex_prepare_replace_str (mc_search, repl);
+ g_string_free (repl, TRUE);
+ return res;
}

View File

@ -1,7 +1,7 @@
Summary: User-friendly text console file manager and visual shell
Name: mc
Version: 4.7.0
Release: 0.2.pre1%{?dist}
Release: 0.3.pre1%{?dist}
Epoch: 1
License: GPLv2
Group: System Environment/Shells
@ -16,6 +16,7 @@ Patch1: mc-ipv6.patch
Patch2: mc-prompt.patch
Patch3: mc-exit.patch
Patch4: mc-extensions.patch
Patch5: mc-shell-patterns.patch
%description
Midnight Commander is a visual shell much like a file manager, only
@ -30,6 +31,7 @@ specific files.
%patch2 -p1 -b .prompt
%patch3 -p1 -b .exit
%patch4 -p1 -b .extensions
%patch5 -p1 -b .shell-patterns
%build
export CFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $RPM_OPT_FLAGS"
@ -85,6 +87,10 @@ rm -rf $RPM_BUILD_ROOT
%dir %{_libexecdir}/mc
%changelog
* Fri Aug 7 2009 Jindrich Novy <jnovy@redhat.com> 4.7.0-0.3.pre1
- support shell patterns in copy dialog (#516180)
(http://www.midnight-commander.org/ticket/414)
* Wed Aug 5 2009 Jindrich Novy <jnovy@redhat.com> 4.7.0-0.2.pre1
- update extension binding to be more Fedora-like
- update to upstream IPv6 patch