release: bump the release to 3.14
[module-init-tools.git] / config_filter.c
blobcf3c3dfdde95aeeeae2a1a323022a2b7aafde758
1 /* config_filter.c: handle hidden or non-configuration files in config dirs.
3 These functions are called whenever we will parse configuration files to
4 ensure we are not picking up backups, SCM meta data, package artifacts.
5 Eventually all config files will have to follow a convention so these
6 lists of possible exceptions should not have to grow by very much.
7 */
9 #include <string.h>
11 #include "util.h"
12 #include "config_filter.h"
14 int config_filter(const char *name)
16 const char *const *p;
18 static const char *const skip_prefix[] = {
19 ".",
20 "~",
21 "CVS",
22 NULL
25 static const char *const skip_suffix[] = {
26 ".rpmsave",
27 ".rpmorig",
28 ".rpmnew",
29 ".dpkg-old",
30 ".dpkg-dist",
31 ".dpkg-new",
32 ".dpkg-bak",
33 ".bak",
34 ".orig",
35 ".rej",
36 ".YaST2save",
37 ".-",
38 "~",
39 ",v",
40 NULL
43 for (p = skip_prefix; *p; p++) {
44 if (strstarts(name, *p))
45 return 0;
48 for (p = skip_suffix; *p; p++) {
49 if (strlen(name) >= strlen(*p) &&
50 streq(*p, strchr(name, 0) - strlen(*p)))
51 return 0;
54 return 1;