implement ? wildcard

master
Daniel Kolesa 2017-06-10 19:03:58 +02:00
parent 009f36ba9f
commit a2f88815bf
1 changed files with 9 additions and 3 deletions

View File

@ -122,12 +122,18 @@ namespace detail {
if (!*wname || (*wname == '*')) {
break;
}
/* ? wildcard matches any character */
if ((*wname == '?') && *fname) {
++wname;
++fname;
continue;
}
if (*fname++ != *wname++) {
return false;
}
}
}
/* skip wildcards; a wildcard matches 0 or more */
/* skip * wildcards; a wildcard matches 0 or more */
if (*wname == '*') {
while (*wname == '*') {
++wname;
@ -199,8 +205,8 @@ namespace detail {
}
return;
}
/* a regular * wildcard */
if (c == '*') {
/* a regular * or ? wildcard */
if ((c == '*') || (c == '?')) {
++beg;
filesystem::directory_iterator it{ip};
for (auto &de: it) {