diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-07-16 13:58:09 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-07-16 13:58:09 +0300 |
commit | 3a16bc5620b4c664248bc5b5c586ddd0103f7050 (patch) | |
tree | ac32d299f907f5288cfffc10dceab87b1b682d8b | |
parent | 4549c2d6d9f7533541eb9ee4f4cf3190b94565f7 (diff) | |
download | wydawca-3a16bc5620b4c664248bc5b5c586ddd0103f7050.tar.gz wydawca-3a16bc5620b4c664248bc5b5c586ddd0103f7050.tar.bz2 |
Bugfix
* src/config.c: Case-insensitive comparison for syslog facility
and priority names.
-rw-r--r-- | src/config.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/config.c b/src/config.c index 6342f2f..692dbd5 100644 --- a/src/config.c +++ b/src/config.c @@ -26,7 +26,12 @@ struct keyword { +enum { + CASE_SENSITIVE, + CASE_INSENSITIVE +}; + static int -keyword_to_tok(const char *str, struct keyword *kw, int *pres) +keyword_to_tok(const char *str, struct keyword *kw, int ci, int *pres) { for (; kw->name; kw++) - if (strcmp(kw->name, str) == 0) { + if ((ci ? strcasecmp : strcmp)(kw->name, str) == 0) { *pres = kw->tok; @@ -82,3 +87,3 @@ wy_strtofac(const char *str) int res; - if (keyword_to_tok(str, kwfac, &res)) + if (keyword_to_tok(str, kwfac, CASE_INSENSITIVE, &res)) return -1; @@ -91,3 +96,3 @@ wy_strtopri(const char *str) int res; - if (keyword_to_tok(str, kwpri, &res)) + if (keyword_to_tok(str, kwpri, CASE_INSENSITIVE, &res)) return -1; @@ -236,3 +241,3 @@ string_to_wy_event(grecs_locus_t *locus, const char *val, int res; - if (keyword_to_tok(val, event_tab, &res)) { + if (keyword_to_tok(val, event_tab, CASE_SENSITIVE, &res)) { grecs_error(locus, 0, @@ -388,3 +393,3 @@ parse_single_statmask(grecs_locus_t *locus, const grecs_value_t *val, - if (keyword_to_tok(arg, stat_tab, &x)) { + if (keyword_to_tok(arg, stat_tab, CASE_SENSITIVE, &x)) { grecs_error(&val->locus, 0, _("unknown statistics type: %s"), @@ -615,3 +620,3 @@ get_backup_version(grecs_locus_t *locus, const char *ctx, const char *version) return numbered_existing_backups; - else if (keyword_to_tok(version, backup_tab, &d)) { + else if (keyword_to_tok(version, backup_tab, CASE_SENSITIVE, &d)) { if (ctx) @@ -892,3 +897,3 @@ string_to_dictionary_id(grecs_locus_t *locus, - if (keyword_to_tok(str, id_tab, &res)) { + if (keyword_to_tok(str, id_tab, CASE_SENSITIVE, &res)) { grecs_error(locus, 0, _("unknown dictionary ID: %s"), str); |