Date: Sat, 24 Jun 2006 20:47:39 +0400 (MSD) From: Stanislav Sedov <ssedov@mbsd.msk.ru> To: FreeBSD-gnats-submit@FreeBSD.org Cc: fjoe@FreeBSD.org Subject: ports/99428: [PATCH] Case insensetive search in mc doesn't work Message-ID: <200606241647.k5OGldhr044449@fonon.realnet> Resent-Message-ID: <200606241650.k5OGoCen075396@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 99428 >Category: ports >Synopsis: [PATCH] Case insensetive search in mc doesn't work >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jun 24 16:50:12 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Stanislav Sedov >Release: FreeBSD 7.0-CURRENT i386 >Organization: MBSD labs, Inc. >Environment: System: FreeBSD fonon.realnet 7.0-CURRENT FreeBSD 7.0-CURRENT #7: Sun Jun 18 20:51:36 MSD 2006 root@fonon.realnet:/work/src/fbsd-cur/src/sys/i386/compile/FONON i386 >Description: Midnight commander ignores case sensetivity flag when performing search, thus case insensetive search doesn't work. This patch fixes this. The following files were added: files/patch-src-cmd.c files/patch-src-dir.c files/patch-src-ext.c files/patch-src-find.c files/patch-src-user.c files/patch-src-util.c files/patch-src-util.h Maintainier was CC'ed. >How-To-Repeat: >Fix: --- mc.diff begins here --- diff -ruN mc.orig/files/patch-src-cmd.c mc/files/patch-src-cmd.c --- mc.orig/files/patch-src-cmd.c Thu Jan 1 03:00:00 1970 +++ mc/files/patch-src-cmd.c Sat Jun 24 20:07:24 2006 @@ -0,0 +1,11 @@ +--- src/cmd.c.orig Sat Jun 24 19:44:21 2006 ++++ src/cmd.c Sat Jun 24 19:45:46 2006 +@@ -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 -ruN mc.orig/files/patch-src-dir.c mc/files/patch-src-dir.c --- mc.orig/files/patch-src-dir.c Thu Jan 1 03:00:00 1970 +++ mc/files/patch-src-dir.c Sat Jun 24 20:04:53 2006 @@ -0,0 +1,11 @@ +--- src/dir.c.orig Sat Jun 24 19:51:05 2006 ++++ src/dir.c Sat Jun 24 19:51:31 2006 +@@ -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 -ruN mc.orig/files/patch-src-ext.c mc/files/patch-src-ext.c --- mc.orig/files/patch-src-ext.c Thu Jan 1 03:00:00 1970 +++ mc/files/patch-src-ext.c Sat Jun 24 20:04:53 2006 @@ -0,0 +1,25 @@ +--- src/ext.c.orig Sat Jun 24 19:52:00 2006 ++++ src/ext.c Sat Jun 24 19:52:21 2006 +@@ -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 -ruN mc.orig/files/patch-src-find.c mc/files/patch-src-find.c --- mc.orig/files/patch-src-find.c Thu Jan 1 03:00:00 1970 +++ mc/files/patch-src-find.c Sat Jun 24 20:38:07 2006 @@ -0,0 +1,29 @@ +--- src/find.c.orig Sat Jun 24 20:36:41 2006 ++++ src/find.c Sat Jun 24 20:37:58 2006 +@@ -575,6 +575,7 @@ + struct stat tmp_stat; + static int pos; + static int subdirs_left = 0; ++ int cflags = 0; + + if (!h) { /* someone forces me to close dirp */ + if (dirp) { +@@ -586,6 +587,9 @@ + dp = 0; + return 1; + } ++ ++ if (case_sensitive == 0) ++ cflags |= REG_ICASE; + do_search_begin: + while (!dp){ + +@@ -662,7 +666,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, cflags)){ + if (content_pattern) { + if (search_content (h, directory, dp->d_name)) { + return 1; diff -ruN mc.orig/files/patch-src-subshell.c mc/files/patch-src-subshell.c --- mc.orig/files/patch-src-subshell.c Sat Jun 24 19:25:35 2006 +++ mc/files/patch-src-subshell.c Thu Jan 1 03:00:00 1970 @@ -1,11 +0,0 @@ ---- src/subshell.c.orig Wed Jun 14 15:45:12 2006 -+++ src/subshell.c Wed Jun 14 15:45:39 2006 -@@ -395,6 +395,8 @@ - subshell_type = ZSH; - else if (strstr (shell, "/tcsh")) - subshell_type = TCSH; -+ else if (strstr (shell, "/csh")) -+ subshell_type = TCSH; - else if (strstr (shell, "/bash") || getenv ("BASH")) - subshell_type = BASH; - else { diff -ruN mc.orig/files/patch-src-user.c mc/files/patch-src-user.c --- mc.orig/files/patch-src-user.c Thu Jan 1 03:00:00 1970 +++ mc/files/patch-src-user.c Sat Jun 24 20:04:53 2006 @@ -0,0 +1,24 @@ +--- src/user.c.orig Sat Jun 24 19:54:48 2006 ++++ src/user.c Sat Jun 24 19:55:10 2006 +@@ -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 -ruN mc.orig/files/patch-src-util.c mc/files/patch-src-util.c --- mc.orig/files/patch-src-util.c Thu Jan 1 03:00:00 1970 +++ mc/files/patch-src-util.c Sat Jun 24 20:04:53 2006 @@ -0,0 +1,34 @@ +--- src/util.c.orig Sat Jun 24 19:55:21 2006 ++++ src/util.c Sat Jun 24 19:57:49 2006 +@@ -563,25 +563,28 @@ + return g_strdup (pattern); + } + +-int regexp_match (const char *pattern, const char *string, int match_type) ++int regexp_match (const char *pattern, const char *string, int match_type, int cflags) + { + static regex_t r; + static char *old_pattern = NULL; + static int old_type; ++ static int old_cflags; + int rval; + char *my_pattern; + +- if (!old_pattern || STRCOMP (old_pattern, pattern) || old_type != match_type){ ++ if (!old_pattern || STRCOMP (old_pattern, pattern) || ++ old_type != match_type || cflags != old_cflags){ + if (old_pattern){ + regfree (&r); + g_free (old_pattern); + old_pattern = NULL; + } + my_pattern = convert_pattern (pattern, match_type, 0); +- if (regcomp (&r, my_pattern, REG_EXTENDED|REG_NOSUB|MC_ARCH_FLAGS)) { ++ if (regcomp (&r, my_pattern, REG_EXTENDED|REG_NOSUB|MC_ARCH_FLAGS|cflags)) { + g_free (my_pattern); + return -1; + } ++ old_cflags = cflags; + old_pattern = my_pattern; + old_type = match_type; + } diff -ruN mc.orig/files/patch-src-util.h mc/files/patch-src-util.h --- mc.orig/files/patch-src-util.h Thu Jan 1 03:00:00 1970 +++ mc/files/patch-src-util.h Sat Jun 24 20:04:53 2006 @@ -0,0 +1,11 @@ +--- src/util.h.orig Sat Jun 24 19:57:50 2006 ++++ src/util.h Sat Jun 24 19:58:03 2006 +@@ -116,7 +116,7 @@ + + extern int easy_patterns; + char *convert_pattern (const char *pattern, int match_type, int do_group); +-int regexp_match (const char *pattern, const char *string, int match_type); ++int regexp_match (const char *pattern, const char *string, int match_type, int cflags); + + /* Error pipes */ + void open_error_pipe (void); --- mc.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606241647.k5OGldhr044449>