Am Dienstag, 30. Mai 2006 18:12 schrieb Nabil Sayegh:
> I often search very large filesystems for a file and in many cases there
> are huge directories, that I would like to skip while searching.
[...]
Apparently there exists a variable "find_ignore_dirs" in the Misc section, but
it seems like it only matches absolute paths:
if (find_ignore_dirs){
int found;
char *temp_dir = g_strconcat (":", tmp, ":", (char *)
NULL);
found = strstr (find_ignore_dirs, temp_dir) != 0;
g_free (temp_dir);
if (found)
g_free (tmp);
else
break;
} else
break;
I attached a patch that changes find_ignore_dirs to be a regex instead of a
colon delimited string. That way one may specify any pattern needed including
absolute paths.
I used mc-4.6.1-2 from debian for the patch.
rgds
--
Nabil Sayegh
diff -uriwbB mc-4.6.1/src/find.c mc-4.6.1-find_ignore_dirs_regex/src/find.c
--- mc-4.6.1/src/find.c 2005-05-27 16:19:18.000000000 +0200
+++ mc-4.6.1-find_ignore_dirs_regex/src/find.c 2006-05-30 20:56:02.000000000 +0200
@@ -608,10 +608,7 @@
}
if (find_ignore_dirs){
int found;
- char *temp_dir = g_strconcat (":", tmp, ":", (char *) NULL);
-
- found = strstr (find_ignore_dirs, temp_dir) != 0;
- g_free (temp_dir);
+ found = regexp_match (find_ignore_dirs, tmp, match_regex);
if (found)
g_free (tmp);
else
@@ -627,7 +624,7 @@
char buffer [BUF_SMALL];
g_snprintf (buffer, sizeof (buffer), _("Searching %s"),
- name_trunc (directory, FIND2_X_USE));
+ directory);
status_update (buffer);
}
/* mc_stat should not be called after mc_opendir
diff -uriwbB mc-4.6.1/src/setup.c mc-4.6.1-find_ignore_dirs_regex/src/setup.c
--- mc-4.6.1/src/setup.c 2005-05-27 16:19:18.000000000 +0200
+++ mc-4.6.1-find_ignore_dirs_regex/src/setup.c 2006-05-30 20:55:13.000000000 +0200
@@ -523,7 +523,7 @@
load_string ("Misc", "find_ignore_dirs", "", setup_color_string,
sizeof (setup_color_string));
if (setup_color_string [0])
- find_ignore_dirs = g_strconcat (":", setup_color_string, ":", (char *) NULL);
+ find_ignore_dirs = g_strconcat ("", setup_color_string, "", (char *) NULL);
/* The default color and the terminal dependent color */
load_string ("Colors", "base_color", "", setup_color_string,
_______________________________________________
Mc mailing list
http://mail.gnome.org/mailman/listinfo/mc