3 // Copyright (C) 2007 Daniel Hokka Zakrisson
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; version 2 of the License.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #include <lib_internal/util.h>
27 #include <lib_internal/matchlist.h>
29 int wrapper_exit_code = 255;
33 struct MatchList list;
34 static const char *files[] = {
41 MatchList_init(&list, "/", sizeof(files) / sizeof(*files));
42 MatchList_appendFiles(&list, 0, files, sizeof(files) / sizeof(*files), true);
44 #define DO_TEST(x) switch (MatchList_compare(&list, x)) { \
45 case stINCLUDE: result |= 1 << test; break; \
46 case stEXCLUDE: result |= 2 << test; break; \
47 case stSKIP: result |= 4 << test; break; \
56 DO_TEST("/usr/lib/a");
58 MatchList_destroy(&list);
63 char buf[(sizeof(result) * 8) / 3 + 2], *ptr;
65 WRITE_MSG(1, "result = ");
66 buf[sizeof(buf) - 1] = '\0';
67 for (i = 0, ptr = buf + sizeof(buf) - 2; i < (sizeof(result) * 8); i += 3, ptr--)
68 *ptr = '0' + ((result & (7 << i)) >> i);