suffix_fnc.c

Fri, 16 Sep 2011 10:36:45 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 16 Sep 2011 10:36:45 +0200
changeset 14
ee9333c91dda
parent 10
ecf787666f44
child 20
43725438ac50
permissions
-rw-r--r--

some minor fixes + makefile now injects revisionnumber into cline.h

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

mercurial