|
1 /* |
|
2 * suffix_fnc.c |
|
3 * |
|
4 * Created on: 15.09.2011 |
|
5 * Author: beckermi |
|
6 */ |
|
7 |
|
8 #include "suffix_fnc.h" |
|
9 |
|
10 bool testSuffix(char* filename, settings_t* settings) { |
|
11 bool ret = false; |
|
12 int tokenlen, fnamelen = strlen(filename); |
|
13 for (int t = 0 ; t < settings->suffixList->count ; t++) { |
|
14 tokenlen = strlen(settings->suffixList->items[t]); |
|
15 if (fnamelen >= tokenlen && tokenlen > 0) { |
|
16 if (strncmp(filename+fnamelen-tokenlen, |
|
17 settings->suffixList->items[t], tokenlen) == 0) { |
|
18 ret = true; |
|
19 break; |
|
20 } |
|
21 } |
|
22 } |
|
23 return ret ^ !settings->includeSuffixes; |
|
24 } |
|
25 |