1 /* vi: set sw=4 ts=4: */
3 * Copyright (C) 2002 by Glenn McGrath
5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 #include "bb_archive.h"
12 /* Find a string in a shell pattern list */
13 const llist_t* FAST_FUNC find_list_entry(const llist_t *list, const char *filename)
16 if (fnmatch(list->data, filename, 0) == 0) {
24 /* Same, but compares only path components present in pattern
25 * (extra trailing path components in filename are assumed to match)
27 const llist_t* FAST_FUNC find_list_entry2(const llist_t *list, const char *filename)
30 int pattern_slash_cnt;
36 pattern_slash_cnt = 0;
38 if (*c++ == '/') pattern_slash_cnt++;
41 /* paranoia is better than buffer overflows */
42 while (*c && d != buf + sizeof(buf)-1) {
43 if (*c == '/' && --pattern_slash_cnt < 0)
48 if (fnmatch(list->data, buf, 0) == 0) {