X-Git-Url: http://www.dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fdirplex%2Fconf.c;h=359bf0c3359a76110c9766d863b4bd68cb60ec04;hb=7bf1ad5a2195774e6a69a3612a07321afeef60a8;hp=84c035d204957e10e4d8650d3042760783c376c4;hpb=edcd094e7e9c1f018f0664f78cf7d6c625e1f476;p=ashd.git diff --git a/src/dirplex/conf.c b/src/dirplex/conf.c index 84c035d..359bf0c 100644 --- a/src/dirplex/conf.c +++ b/src/dirplex/conf.c @@ -150,6 +150,10 @@ static struct pattern *parsepattern(struct cfstate *s) if((s->argc > 1) && !strcmp(s->argv[1], "directory")) pat->type = PT_DIR; + else if((s->argc > 1) && !strcmp(s->argv[1], "notfound")) + pat->type = PT_NOTFOUND; + else + pat->type = PT_FILE; sl = s->lno; while(1) { getcfline(s); @@ -251,9 +255,7 @@ struct config *readconfig(char *file) cf->patterns = pat; } else if(!strcmp(s->argv[0], "index-file")) { freeca(cf->index); - cf->index = NULL; - if(s->argc > 1) - cf->index = cadup(s->argv + 1); + cf->index = cadup(s->argv + 1); } else if(!strcmp(s->argv[0], "capture")) { if(s->argc < 2) { flog(LOG_WARNING, "%s:%i: missing argument to capture declaration", s->file, s->lno); @@ -262,6 +264,9 @@ struct config *readconfig(char *file) if(cf->capture != NULL) free(cf->capture); cf->capture = sstrdup(s->argv[1]); + cf->caproot = 0; + if((s->argc > 2) && strchr(s->argv[2], 'D')) + cf->caproot = 1; } else if(!strcmp(s->argv[0], "eof")) { break; } else { @@ -371,7 +376,7 @@ struct child *findchild(char *file, char *name, struct config **cf) return(NULL); } -struct pattern *findmatch(char *file, int trydefault, int dir) +struct pattern *findmatch(char *file, int trydefault, int type) { int i, o, c; char *bn, *ln; @@ -396,9 +401,7 @@ struct pattern *findmatch(char *file, int trydefault, int dir) ln = file; /* This should only happen in the base directory. */ } for(pat = cfs[c]->patterns; pat != NULL; pat = pat->next) { - if(!dir && (pat->type == PT_DIR)) - continue; - if(dir && (pat->type != PT_DIR)) + if(pat->type != type) continue; for(i = 0; (rule = pat->rules[i]) != NULL; i++) { if(rule->type == PAT_BASENAME) { @@ -429,7 +432,7 @@ struct pattern *findmatch(char *file, int trydefault, int dir) } } if(!trydefault) - return(findmatch(file, 1, dir)); + return(findmatch(file, 1, type)); return(NULL); }