diff options
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/src/config.c b/src/config.c index 3be3a00..9d78ed3 100644 --- a/src/config.c +++ b/src/config.c @@ -359,8 +359,8 @@ static struct keyword stat_tab[] = { }; static int -parse_single_statmask(grecs_locus_t * locus, const grecs_value_t * val, - unsigned long *pmask, int *invert) +parse_single_statmask(grecs_locus_t *locus, const grecs_value_t *val, + unsigned long *pmask) { const char *arg; int x; @@ -374,12 +374,10 @@ parse_single_statmask(grecs_locus_t * locus, const grecs_value_t * val, arg = val->v.string; if (strcmp(arg, "all") == 0) { - *pmask = WY_STAT_MASK_ALL; - *invert = 1; + *pmask |= WY_STAT_MASK_ALL; return 0; } else if (strcmp(arg, "none") == 0) { - *pmask = WY_STAT_MASK_NONE; - *invert = 0; + *pmask &= ~WY_STAT_MASK_ALL; return 0; } @@ -387,48 +385,37 @@ parse_single_statmask(grecs_locus_t * locus, const grecs_value_t * val, grecs_error(&val->locus, 0, _("unknown statistics type: %s"), arg); return 1; } - *pmask = WY_STAT_MASK(x); + *pmask |= WY_STAT_MASK(x); return 0; } static int -parse_statmask(grecs_locus_t * loc, grecs_value_t * val, - unsigned long *pmask) +parse_statmask(grecs_locus_t *loc, grecs_value_t *val, unsigned long *pmask) { int err = 0; - int invert = 0; - unsigned long mask = 0; + unsigned long mask = *pmask; int i; struct grecs_list_entry *ep; switch (val->type) { case GRECS_TYPE_STRING: - err = parse_single_statmask(loc, val, &mask, &invert); + err = parse_single_statmask(loc, val, &mask); break; case GRECS_TYPE_ARRAY: for (i = 0; i < val->v.arg.c; i++) { - unsigned long x; - if (parse_single_statmask(loc, val->v.arg.v[i], &x, &invert)) + if (parse_single_statmask(loc, val->v.arg.v[i], &mask)) { err = 1; - else if (invert) - mask &= ~x; - else - mask |= x; + } } break; case GRECS_TYPE_LIST: for (ep = val->v.list->head; ep; ep = ep->next) { const grecs_value_t *vp = ep->data; - unsigned long x; - if (parse_single_statmask(loc, vp, &x, &invert)) + if (parse_single_statmask(loc, vp, &mask)) err = 1; - else if (invert) - mask &= ~x; - else - mask |= x; } break; } @@ -1736,4 +1723,11 @@ config_finish(struct grecs_node *tree) err = 0; if (for_each_spool(create_spool_dirs, &err) || err) exit(EX_CONFIG); + + if (file_sweep_time <= 0) { + file_sweep_time = DEFAULT_FILE_SWEEP_TIME; + wy_log(LOG_NOTICE, + _("file-sweep-time too low; reverting to the default %ds"), + file_sweep_time); + } } |