--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/suffix_fnc.c Thu Sep 15 13:29:06 2011 +0200 @@ -0,0 +1,25 @@ +/* + * suffix_fnc.c + * + * Created on: 15.09.2011 + * Author: beckermi + */ + +#include "suffix_fnc.h" + +bool testSuffix(char* filename, settings_t* settings) { + bool ret = false; + int tokenlen, fnamelen = strlen(filename); + for (int t = 0 ; t < settings->suffixList->count ; t++) { + tokenlen = strlen(settings->suffixList->items[t]); + if (fnamelen >= tokenlen && tokenlen > 0) { + if (strncmp(filename+fnamelen-tokenlen, + settings->suffixList->items[t], tokenlen) == 0) { + ret = true; + break; + } + } + } + return ret ^ !settings->includeSuffixes; +} +