diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2010-02-26 19:04:15 +0000 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-02-26 19:06:24 +0000 |
commit | a7790532f5b7358c33a6b1834dc2b318de209f31 (patch) | |
tree | 0ceb9e24b3f54cb5c8453fb5a218e2a94a0f1cce /tools/perf/util/string.c | |
parent | 2764fb4244cc1bc08df3667924ca4a972e90ac70 (diff) | |
parent | 60b341b778cc2929df16c0a504c91621b3c6a4ad (diff) | |
download | linux-a7790532f5b7358c33a6b1834dc2b318de209f31.tar.gz linux-a7790532f5b7358c33a6b1834dc2b318de209f31.tar.bz2 linux-a7790532f5b7358c33a6b1834dc2b318de209f31.zip |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
The SmartMedia FTL code depends on new kfifo bits from 2.6.33
Diffstat (limited to 'tools/perf/util/string.c')
-rw-r--r-- | tools/perf/util/string.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c index f24a8cc933d5..5352d7dccc61 100644 --- a/tools/perf/util/string.c +++ b/tools/perf/util/string.c @@ -226,3 +226,28 @@ fail: argv_free(argv); return NULL; } + +/* Glob expression pattern matching */ +bool strglobmatch(const char *str, const char *pat) +{ + while (*str && *pat && *pat != '*') { + if (*pat == '?') { + str++; + pat++; + } else + if (*str++ != *pat++) + return false; + } + /* Check wild card */ + if (*pat == '*') { + while (*pat == '*') + pat++; + if (!*pat) /* Tail wild card matches all */ + return true; + while (*str) + if (strglobmatch(str++, pat)) + return true; + } + return !*str && !*pat; +} + |