|
Revision 2608, 1.8 kB
(checked in by ensc, 1 year ago)
|
whitespace-cleanup
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
#ifdef HAVE_CONFIG_H |
|---|
| 20 |
# include <config.h> |
|---|
| 21 |
#endif |
|---|
| 22 |
|
|---|
| 23 |
#include "matchlist.h" |
|---|
| 24 |
#include <fnmatch.h> |
|---|
| 25 |
#include <assert.h> |
|---|
| 26 |
|
|---|
| 27 |
static int |
|---|
| 28 |
fnmatchWrap(char const *a, char const *b) |
|---|
| 29 |
{ |
|---|
| 30 |
return fnmatch(a, b, 0); |
|---|
| 31 |
} |
|---|
| 32 |
|
|---|
| 33 |
static MatchItemCompareFunc |
|---|
| 34 |
determineCompareFunc(char const UNUSED *fname) |
|---|
| 35 |
{ |
|---|
| 36 |
return fnmatchWrap; |
|---|
| 37 |
} |
|---|
| 38 |
|
|---|
| 39 |
void |
|---|
| 40 |
MatchList_appendFiles(struct MatchList *list, size_t idx, |
|---|
| 41 |
char const **files, size_t count, |
|---|
| 42 |
bool auto_type) |
|---|
| 43 |
{ |
|---|
| 44 |
struct MatchItem *ptr = list->data + idx; |
|---|
| 45 |
size_t i; |
|---|
| 46 |
|
|---|
| 47 |
assert(idx+count <= list->count); |
|---|
| 48 |
|
|---|
| 49 |
if (auto_type) { |
|---|
| 50 |
for (i=0; i<count; ++i) { |
|---|
| 51 |
char const *file = files[i]; |
|---|
| 52 |
switch (file[0]) { |
|---|
| 53 |
case '+' : ptr->type = stINCLUDE; ++file; break; |
|---|
| 54 |
case '~' : ptr->type = stSKIP; ++file; break; |
|---|
| 55 |
case '-' : ++file; |
|---|
| 56 |
default : ptr->type = stEXCLUDE; break; |
|---|
| 57 |
} |
|---|
| 58 |
ptr->cmp = determineCompareFunc(file); |
|---|
| 59 |
ptr->name = file; |
|---|
| 60 |
++ptr; |
|---|
| 61 |
} |
|---|
| 62 |
} |
|---|
| 63 |
else { |
|---|
| 64 |
for (i=0; i<count; ++i) { |
|---|
| 65 |
ptr->type = stEXCLUDE; |
|---|
| 66 |
ptr->name = files[i]; |
|---|
| 67 |
ptr->cmp = 0; |
|---|
| 68 |
++ptr; |
|---|
| 69 |
} |
|---|
| 70 |
} |
|---|
| 71 |
} |
|---|