Matches if and only if no *match* stanza without a *default*
rule has matched.
+*local*::
+
+ Valid only in `.htrc` files, *local* matches if an only if the
+ file under consideration resides in the same directory as the
+ containing `.htrc` file.
+
In addition to the rules, a *match* stanza must contain exactly one
follow-up line specifying the action to take if it matches. The
following actions are recognized:
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);
struct config **cfs;
struct pattern *pat;
struct rule *rule;
+ size_t pl;
if((bn = strrchr(file, '/')) != NULL)
bn++;
} 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)