suffix_fnc.c

Thu, 20 Oct 2011 17:29:23 +0200

author
Mike Becker <universe@uap-core.de>
date
Thu, 20 Oct 2011 17:29:23 +0200
changeset 22
4508da679ffb
parent 20
43725438ac50
child 30
d642fdb6745e
permissions
-rw-r--r--

completed binary file heuristics

/*
 * 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