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.
9 #include "bb_archive.h"
11 /* Find a string in a shell pattern list */
12 const llist_t* FAST_FUNC find_list_entry(const llist_t *list, const char *filename)
15 if (fnmatch(list->data, filename, 0) == 0) {
23 /* Same, but compares only path components present in pattern
24 * (extra trailing path components in filename are assumed to match)
26 const llist_t* FAST_FUNC find_list_entry2(const llist_t *list, const char *filename)
29 int pattern_slash_cnt;
35 pattern_slash_cnt = 0;
37 if (*c++ == '/') pattern_slash_cnt++;
40 /* paranoia is better than buffer overflows */
41 while (*c && d != buf + sizeof(buf)-1) {
42 if (*c == '/' && --pattern_slash_cnt < 0)
47 if (fnmatch(list->data, buf, 0) == 0) {