suffix_fnc.c

changeset 30
d642fdb6745e
parent 20
43725438ac50
equal deleted inserted replaced
29:fa625066ae52 30:d642fdb6745e
5 * Author: Mike 5 * Author: Mike
6 */ 6 */
7 7
8 #include "suffix_fnc.h" 8 #include "suffix_fnc.h"
9 9
10 bool testSuffix(char* filename, settings_t* settings) { 10 bool testSuffix(char* filename, string_list_t* list) {
11 bool ret = false; 11 bool ret = false;
12 int tokenlen, fnamelen = strlen(filename); 12 int tokenlen, fnamelen = strlen(filename);
13 for (int t = 0 ; t < settings->suffixList->count ; t++) { 13 for (int t = 0 ; t < list->count ; t++) {
14 tokenlen = strlen(settings->suffixList->items[t]); 14 tokenlen = strlen(list->items[t]);
15 if (fnamelen >= tokenlen && tokenlen > 0) { 15 if (fnamelen >= tokenlen && tokenlen > 0) {
16 if (strncmp(filename+fnamelen-tokenlen, 16 if (strncmp(filename+fnamelen-tokenlen,
17 settings->suffixList->items[t], tokenlen) == 0) { 17 list->items[t], tokenlen) == 0) {
18 ret = true; 18 ret = true;
19 break; 19 break;
20 } 20 }
21 } 21 }
22 } 22 }
23 return ret ^ !settings->includeSuffixes; 23 return ret;
24 } 24 }
25 25

mercurial