diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/misc.c | 18 | ||||
-rw-r--r-- | src/core/misc.h | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/core/misc.c b/src/core/misc.c index aaa470f5..2284d3b1 100644 --- a/src/core/misc.c +++ b/src/core/misc.c @@ -181,6 +181,24 @@ int strarray_find(char **array, const char *item) return -1; } + +int strarray_find_glob(char **array, const char *item) +{ + char **tmp; + int index; + + g_return_val_if_fail(array != NULL, -1); + g_return_val_if_fail(item != NULL, -1); + + index = 0; + for (tmp = array; *tmp != NULL; tmp++, index++) { + if (g_pattern_match_simple(*tmp, item)) + return index; + } + + return -1; +} + GSList *gslist_find_string(GSList *list, const char *key) { for (; list != NULL; list = list->next) diff --git a/src/core/misc.h b/src/core/misc.h index 7e78d3b9..dd8bb14c 100644 --- a/src/core/misc.h +++ b/src/core/misc.h @@ -111,6 +111,7 @@ char *replace_chars(char *str, char from, char to); int strarray_length(char **array); /* return index of `item' in `array' or -1 if not found */ int strarray_find(char **array, const char *item); +int strarray_find_glob(char **array, const char *item); /* string -> uoff_t */ uoff_t str_to_uofft(const char *str); |