130.1.7
by Alan Jenkins
Enforce use of streq |
1 |
#include <string.h> |
2 |
||
3 |
#include "util.h" |
|
67.1.3
by Scott James Remnant
Filter configuration files |
4 |
#include "config_filter.h" |
5 |
||
6 |
int config_filter(const char *name) |
|
7 |
{
|
|
8 |
const char *const *p; |
|
9 |
||
10 |
static const char *const skip_prefix[] = { |
|
11 |
".", |
|
12 |
"~", |
|
101
by Marco d'Itri
ignore the "CVS" directory |
13 |
"CVS", |
67.1.3
by Scott James Remnant
Filter configuration files |
14 |
NULL
|
15 |
};
|
|
16 |
||
17 |
static const char *const skip_suffix[] = { |
|
18 |
".rpmsave", |
|
19 |
".rpmorig", |
|
20 |
".rpmnew", |
|
67.1.4
by Scott James Remnant
Skip dpkg files. |
21 |
".dpkg-old", |
22 |
".dpkg-dist", |
|
23 |
".dpkg-new", |
|
24 |
".dpkg-bak", |
|
67.1.3
by Scott James Remnant
Filter configuration files |
25 |
".bak", |
67.1.5
by Scott James Remnant
Skip patch left-overs and RCS files. |
26 |
".orig", |
27 |
".rej", |
|
67.1.3
by Scott James Remnant
Filter configuration files |
28 |
".YaST2save", |
29 |
".-", |
|
30 |
"~", |
|
67.1.5
by Scott James Remnant
Skip patch left-overs and RCS files. |
31 |
",v", |
67.1.3
by Scott James Remnant
Filter configuration files |
32 |
NULL
|
33 |
};
|
|
34 |
||
35 |
for (p = skip_prefix; *p; p++) { |
|
130.1.9
by Alan Jenkins
Take advantage of strstarts |
36 |
if (strstarts(name, *p)) |
67.1.3
by Scott James Remnant
Filter configuration files |
37 |
return 0; |
38 |
}
|
|
39 |
||
40 |
for (p = skip_suffix; *p; p++) { |
|
41 |
if (strlen(name) >= strlen(*p) && |
|
130.1.7
by Alan Jenkins
Enforce use of streq |
42 |
streq(*p, strchr(name, 0) - strlen(*p))) |
67.1.3
by Scott James Remnant
Filter configuration files |
43 |
return 0; |
44 |
}
|
|
45 |
||
46 |
return 1; |
|
47 |
}
|
|
48 |