tools/extract-pkg.c
static int match_wildcard(const char *pattern, const char *path)
{
    while (*pattern) {
        const char ch = *pattern++;
        if (ch == '*') {
            int double_star = 0;
            if (*pattern == '*') {
                pattern++;
                double_star = 1;
            }
            while (!match_wildcard(pattern, path)) {
                if (!*path || (!double_star && *path == '/')) {
                    return 0;
                }
                path++;
            }
        } else if (ch == '?') {
            if (!*path || *path == '/') {
                return 0;
            }
            path++;
        } else {
            if (*path != ch) {
                return 0;
            }
            path++;
        }
    }
    return *path == 0;
}
/**
 * match_wildcard:  Return whether the given path matches the given
 * wildcard pattern.
 *
 * [Parameters]
 *     pattern: Wildcard pattern to match against.
 *     path: Pathname to test.
 * [Return value]
 *     True if the path matches the pattern, false if not.
 */
Return whether the given path matches the given
wildcard pattern.

[Parameters]
pattern: Wildcard pattern to match against.
path: Pathname to test.
[Return value]
True if the path matches the pattern, false if not.
Return whether the given path matches the given wildcard pattern . [ Parameters ] pattern : Wildcard pattern to match against . path : Pathname to test . [ Return value ] True if the path matches the pattern false if not .
static int match_wildcard(const char *pattern, const char *path)
{
    while (*pattern) {
        const char ch = *pattern++;
        if (ch == '*') {
            int double_star = 0;
            if (*pattern == '*') {
                pattern++;
                double_star = 1;
            }
            while (!match_wildcard(pattern, path)) {
                if (!*path || (!double_star && *path == '/')) {
                    return 0;
                }
                path++;
            }
        } else if (ch == '?') {
            if (!*path || *path == '/') {
                return 0;
            }
            path++;
        } else {
            if (*path != ch) {
                return 0;
            }
            path++;
        }
    }
    return *path == 0;
}
static int match_wildcard ( const char * pattern , const char * path ) { while ( * pattern ) { const char ch = * pattern ++ ; if ( ch == ' ' ) { int double_star = 0 ; if ( * pattern == ' ' ) { pattern ++ ; double_star = 1 ; } while ( ! match_wildcard ( pattern , path ) ) { if ( ! * path || ( ! double_star && * path == ' ' ) ) { return 0 ; } path ++ ; } } else if ( ch == ' ' ) { if ( ! * path || * path == ' ' ) { return 0 ; } path ++ ; } else { if ( * path != ch ) { return 0 ; } path ++ ; } } return * path == 0 ; }
match_wildcard:  Return whether the given path matches the given
 wildcard pattern.
match_wildcard : Return whether the given path matches the given wildcard pattern .