Dolda2000 GitWeb
/
ashd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dirplex: Added directory-locality to matches.
[ashd.git]
/
src
/
dirplex
/
conf.c
diff --git
a/src/dirplex/conf.c
b/src/dirplex/conf.c
index
e83d847
..
8494050
100644
(file)
--- a/
src/dirplex/conf.c
+++ b/
src/dirplex/conf.c
@@
-164,6
+164,8
@@
static struct pattern *parsepattern(struct cfstate *s)
newrule(pat)->type = PAT_ALL;
} else if(!strcmp(s->argv[0], "default")) {
newrule(pat)->type = PAT_DEFAULT;
newrule(pat)->type = PAT_ALL;
} else if(!strcmp(s->argv[0], "default")) {
newrule(pat)->type = PAT_DEFAULT;
+ } else if(!strcmp(s->argv[0], "local")) {
+ newrule(pat)->type = PAT_LOCAL;
} else if(!strcmp(s->argv[0], "handler")) {
if(s->argc < 2) {
flog(LOG_WARNING, "%s:%i: missing child name for `handler' directive", s->file, s->lno);
} else if(!strcmp(s->argv[0], "handler")) {
if(s->argc < 2) {
flog(LOG_WARNING, "%s:%i: missing child name for `handler' directive", s->file, s->lno);
@@
-363,6
+365,7
@@
struct pattern *findmatch(char *file, int trydefault, int dir)
struct config **cfs;
struct pattern *pat;
struct rule *rule;
struct config **cfs;
struct pattern *pat;
struct rule *rule;
+ size_t pl;
if((bn = strrchr(file, '/')) != NULL)
bn++;
if((bn = strrchr(file, '/')) != NULL)
bn++;
@@
-394,6
+397,12
@@
struct pattern *findmatch(char *file, int trydefault, int dir)
} else if(rule->type == PAT_DEFAULT) {
if(!trydefault)
break;
} else if(rule->type == PAT_DEFAULT) {
if(!trydefault)
break;
+ } else if(rule->type == PAT_LOCAL) {
+ if(cfs[c]->path == NULL)
+ break;
+ pl = strlen(cfs[c]->path);
+ if(!((strlen(file) > pl) && !strncmp(file, cfs[c]->path, pl) && (file[pl] == '/') && !strchr(file + pl + 1, '/')))
+ break;
}
}
if(!rule)
}
}
if(!rule)