Implement case insensitive for shell keyword.
shell/i is used now for case-insensitive shell patterns. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
cbcae18836
Коммит
81c3d80f4b
@ -12,6 +12,9 @@
|
|||||||
# i.e. matches all the files *desc . Example: .tar matches *.tar;
|
# i.e. matches all the files *desc . Example: .tar matches *.tar;
|
||||||
# if it doesn't start with a dot, it matches only a file of that name)
|
# if it doesn't start with a dot, it matches only a file of that name)
|
||||||
#
|
#
|
||||||
|
# shell/i (desc is, when starting with a dot, any extension (no wildcars),
|
||||||
|
# The same as shell but with case insensitive.
|
||||||
|
#
|
||||||
# regex (desc is an extended regular expression)
|
# regex (desc is an extended regular expression)
|
||||||
# Please note that we are using the GNU regex library and thus
|
# Please note that we are using the GNU regex library and thus
|
||||||
# \| matches the literal | and | has special meaning (or) and
|
# \| matches the literal | and | has special meaning (or) and
|
||||||
|
@ -880,15 +880,25 @@ regex_command (const vfs_path_t * filename_vpath, const char *action)
|
|||||||
}
|
}
|
||||||
else if (strncmp (p, "shell/", 6) == 0)
|
else if (strncmp (p, "shell/", 6) == 0)
|
||||||
{
|
{
|
||||||
|
gboolean case_insense;
|
||||||
|
int (*cmp_func) (const char *s1, const char *s2, size_t n) = strncmp;
|
||||||
|
|
||||||
p += 6;
|
p += 6;
|
||||||
|
case_insense = (strncmp (p, "i/", 2) == 0);
|
||||||
|
if (case_insense)
|
||||||
|
{
|
||||||
|
p += 2;
|
||||||
|
cmp_func = strncasecmp;
|
||||||
|
}
|
||||||
|
|
||||||
if (*p == '.' && file_len >= (size_t) (q - p))
|
if (*p == '.' && file_len >= (size_t) (q - p))
|
||||||
{
|
{
|
||||||
if (strncmp (p, filename + file_len - (q - p), q - p) == 0)
|
if (cmp_func (p, filename + file_len - (q - p), q - p) == 0)
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((size_t) (q - p) == file_len && strncmp (p, filename, q - p) == 0)
|
if ((size_t) (q - p) == file_len && cmp_func (p, filename, q - p) == 0)
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user