suffix_fnc.c

Thu, 01 Dec 2011 17:06:27 +0100

author
Mike Becker <universe@uap-core.de>
date
Thu, 01 Dec 2011 17:06:27 +0100
changeset 26
853a1181884b
parent 20
43725438ac50
child 30
d642fdb6745e
permissions
-rw-r--r--

Merge with 3963e8800a1268be93d938c709e2d4be4d0b2d39

/*
 * suffix_fnc.c
 *
 *  Created on: 15.09.2011
 *      Author: Mike
 */

#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;
}

mercurial