From 4d2cefa81e316f915d641b46eada4d5a08c82a7e Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Wed, 25 Feb 2015 12:56:34 +0300 Subject: [PATCH] Add '?' sign as a possible mark of wildcard. Signed-off-by: Slava Zanko --- src/filemanager/filegui.c | 6 +++--- tests/src/filemanager/filegui_is_wildcarded.c | 10 +++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/filemanager/filegui.c b/src/filemanager/filegui.c index b377b4719..26ecbfe83 100644 --- a/src/filemanager/filegui.c +++ b/src/filemanager/filegui.c @@ -612,7 +612,7 @@ overwrite_query_dialog (file_op_context_t * ctx, enum OperationMode mode) static gboolean is_wildcarded (const char *p) { - int escaped = 0; + gboolean escaped = FALSE; for (; *p; p++) { if (*p == '\\') @@ -623,9 +623,9 @@ is_wildcarded (const char *p) } else { - if (*p == '*' && !escaped) + if ((*p == '*' || *p == '?') && !escaped) return TRUE; - escaped = 0; + escaped = FALSE; } } return FALSE; diff --git a/tests/src/filemanager/filegui_is_wildcarded.c b/tests/src/filemanager/filegui_is_wildcarded.c index 202695f78..95c684181 100644 --- a/tests/src/filemanager/filegui_is_wildcarded.c +++ b/tests/src/filemanager/filegui_is_wildcarded.c @@ -71,7 +71,7 @@ static const struct test_is_wildcarded_ds }, { /* 1 */ "bla?bla", - FALSE + TRUE }, { /* 2 */ "bla*bla", @@ -110,6 +110,14 @@ static const struct test_is_wildcarded_ds "blabla\\", FALSE }, + { /* 11 */ + "blab\\?la", + FALSE + }, + { /* 12 */ + "blab\\\\?la", + TRUE + }, }; /* *INDENT-ON* */