Re: [PATCH] find file fixups

2008-12-29 Thread Miguel de Icaza
This patch looks OK to go in.

 
 ___
 Mc-devel mailing list
 http://mail.gnome.org/mailman/listinfo/mc-devel

___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


[PATCH] find file fixups

2008-12-25 Thread Enrico Weigelt


-- 
-
 Enrico Weigelt==   metux IT service - http://www.metux.de/
-
 Please visit the OpenSource QM Taskforce:
http://wiki.metux.de/public/OpenSource_QM_Taskforce
 Patches / Fixes for a lot dozens of packages in dozens of versions:
http://patches.metux.de/
-
#
# This is a patch for the find file stuff, from Gentoo.
# 
# (not completely sure what it *really* does, but it seems to 
# have something to do w/ case sensitivity)
#
# Source:   Gentoo Portage
# Reference:mc-4.6.1
# Submit-By:Enrico Weigelt, metux IT service weig...@metux.de
# Submit-Date:  2008-12-16
# State:new
#
diff -Naur mc-4.6.1.orig/src/cmd.c mc-4.6.1/src/cmd.c
--- mc-4.6.1.orig/src/cmd.c 2005-05-27 16:19:18.0 +0200
+++ mc-4.6.1/src/cmd.c  2006-03-19 12:57:00.0 +0100
@@ -510,7 +510,7 @@
continue;
}
c = regexp_match (reg_exp_t, current_panel-dir.list[i].fname,
- match_file);
+ match_file, 0);
if (c == -1) {
message (1, MSG_ERROR, _(  Malformed regular expression  ));
g_free (reg_exp);
diff -Naur mc-4.6.1.orig/src/dir.c mc-4.6.1/src/dir.c
--- mc-4.6.1.orig/src/dir.c 2005-05-27 16:19:18.0 +0200
+++ mc-4.6.1/src/dir.c  2006-03-19 12:58:56.0 +0100
@@ -405,7 +405,7 @@
*stale_link = 1;
 }
 if (!(S_ISDIR (buf1-st_mode) || *link_to_dir)  filter
-!regexp_match (filter, dp-d_name, match_file))
+!regexp_match (filter, dp-d_name, match_file, 0))
return 0;
 
 /* Need to grow the *list? */
diff -Naur mc-4.6.1.orig/src/ext.c mc-4.6.1/src/ext.c
--- mc-4.6.1.orig/src/ext.c 2005-05-27 16:19:18.0 +0200
+++ mc-4.6.1/src/ext.c  2006-03-19 13:00:43.0 +0100
@@ -394,7 +394,7 @@
 }
 
 if (content_string[0]
-regexp_match (ptr, content_string + content_shift, match_regex)) {
+regexp_match (ptr, content_string + content_shift, match_regex, 0)) {
found = 1;
 }
 
@@ -534,11 +534,11 @@
/* Do not transform shell patterns, you can use shell/ for
 * that
 */
-   if (regexp_match (p, filename, match_regex))
+   if (regexp_match (p, filename, match_regex, 0))
found = 1;
} else if (!strncmp (p, directory/, 10)) {
if (S_ISDIR (mystat.st_mode)
-regexp_match (p + 10, filename, match_regex))
+regexp_match (p + 10, filename, match_regex, 0))
found = 1;
} else if (!strncmp (p, shell/, 6)) {
p += 6;
diff -Naur mc-4.6.1.orig/src/find.c mc-4.6.1/src/find.c
--- mc-4.6.1.orig/src/find.c2005-05-27 16:19:18.0 +0200
+++ mc-4.6.1/src/find.c 2006-03-19 13:04:10.0 +0100
@@ -575,6 +575,7 @@
 struct stat tmp_stat;
 static int pos;
 static int subdirs_left = 0;
+int flags = 0;
 
 if (!h) { /* someone forces me to close dirp */
if (dirp) {
@@ -586,6 +587,10 @@
 dp = 0;
return 1;
 }
+
+if (!(case_sense-state  C_BOOL))
+   flags |= REG_ICASE;
+   
  do_search_begin:
 while (!dp){

@@ -662,7 +667,7 @@
g_free (tmp_name);
 }
 
-if (regexp_match (find_pattern, dp-d_name, match_file)){
+if (regexp_match (find_pattern, dp-d_name, match_file, flags)){
if (content_pattern) {
if (search_content (h, directory, dp-d_name)) {
return 1;
diff -Naur mc-4.6.1.orig/src/user.c mc-4.6.1/src/user.c
--- mc-4.6.1.orig/src/user.c2005-07-01 17:47:07.0 +0200
+++ mc-4.6.1/src/user.c 2006-03-19 13:05:00.0 +0100
@@ -412,18 +412,18 @@
break;
case 'f': /* file name pattern */
p = extract_arg (p, arg, sizeof (arg));
-   *condition = panel  regexp_match (arg, panel-dir.list 
[panel-selected].fname, match_file);
+   *condition = panel  regexp_match (arg, panel-dir.list 
[panel-selected].fname, match_file, 0);
break;
case 'y': /* syntax pattern */
 if (edit_widget  edit_widget-syntax_type) {
p = extract_arg (p, arg, sizeof (arg));
*condition = panel 
-regexp_match (arg, edit_widget-syntax_type, match_normal);
+regexp_match (arg, edit_widget-syntax_type, match_normal, 
0);
}
 break;
case 'd':
p = extract_arg (p, arg, sizeof (arg));
-   *condition = panel  regexp_match (arg, panel-cwd, match_file);
+   *condition = panel  regexp_match (arg, panel-cwd, match_file, 0);
break;
case 't':
p = extract_arg (p, arg, sizeof (arg));
diff