mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Fix for issue:
When copying to directory with a name containing special symbol "*" the copy command didn't do it in a right way. Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
dbbd8a7cdc
commit
ec0dd74248
@ -612,12 +612,21 @@ overwrite_query_dialog (file_op_context_t * ctx, enum OperationMode mode)
|
||||
static gboolean
|
||||
is_wildcarded (const char *p)
|
||||
{
|
||||
int escaped = 0;
|
||||
for (; *p; p++)
|
||||
{
|
||||
if (*p == '*')
|
||||
if (*p == '\\')
|
||||
{
|
||||
if (p[1] >= '1' && p[1] <= '9' && !escaped)
|
||||
return TRUE;
|
||||
if (*p == '\\' && p[1] >= '1' && p[1] <= '9')
|
||||
escaped = !escaped;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*p == '*' && !escaped)
|
||||
return TRUE;
|
||||
escaped = 0;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -65,48 +65,48 @@ static const struct test_is_wildcarded_ds
|
||||
gboolean expected_result;
|
||||
} test_is_wildcarded_ds[] =
|
||||
{
|
||||
{
|
||||
{ /* 0 */
|
||||
"blabla",
|
||||
FALSE
|
||||
},
|
||||
{
|
||||
{ /* 1 */
|
||||
"bla?bla",
|
||||
FALSE
|
||||
},
|
||||
{
|
||||
{ /* 2 */
|
||||
"bla*bla",
|
||||
TRUE
|
||||
},
|
||||
{
|
||||
{ /* 3 */
|
||||
"bla\\*bla",
|
||||
TRUE
|
||||
FALSE
|
||||
},
|
||||
|
||||
{
|
||||
{ /* 4 */
|
||||
"bla\\\\*bla",
|
||||
TRUE
|
||||
},
|
||||
{
|
||||
{ /* 5 */
|
||||
"bla\\1bla",
|
||||
TRUE
|
||||
},
|
||||
{
|
||||
{ /* 6 */
|
||||
"bla\\\\1bla",
|
||||
TRUE
|
||||
FALSE
|
||||
},
|
||||
{
|
||||
{ /* 7 */
|
||||
"bla\\\t\\\\1bla",
|
||||
TRUE
|
||||
FALSE
|
||||
},
|
||||
{
|
||||
{ /* 8 */
|
||||
"bla\\\t\\\\\\1bla",
|
||||
TRUE
|
||||
},
|
||||
{
|
||||
{ /* 9 */
|
||||
"bla\\9bla",
|
||||
TRUE
|
||||
},
|
||||
{
|
||||
{ /* 10 */
|
||||
"blabla\\",
|
||||
FALSE
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user