diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-06-27 13:52:51 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-06-27 14:08:07 +0300 |
commit | abc9addde25c64679ac22bbe29d770791e2be49c (patch) | |
tree | afc7aa27ba17ad3c5f06bcb90328091a3777288a /src/config.c | |
parent | 04fe7a244ed60968542bcd79ecff222d37768def (diff) | |
download | wydawca-abc9addde25c64679ac22bbe29d770791e2be49c.tar.gz wydawca-abc9addde25c64679ac22bbe29d770791e2be49c.tar.bz2 |
Update grecs.
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 76 |
1 files changed, 45 insertions, 31 deletions
diff --git a/src/config.c b/src/config.c index 43be903..11a448e 100644 --- a/src/config.c +++ b/src/config.c @@ -244,7 +244,7 @@ assert_string_arg (grecs_locus_t *locus, } if (!value || value->type != GRECS_TYPE_STRING) { - grecs_error (locus, 0, _("expected scalar value as a tag")); + grecs_error (&value->locus, 0, _("expected scalar value as a tag")); return 1; } return 0; @@ -261,7 +261,7 @@ get_arg (grecs_locus_t *locus, grecs_value_t *value, unsigned n, int type) value = value->v.arg.v[n]; if (value->type != type) { - grecs_error (locus, 0, _("argument %d has wrong type"), n); + grecs_error (&value->locus, 0, _("argument %d has wrong type"), n); return NULL; } return value; @@ -281,7 +281,7 @@ cb_mailer (enum grecs_callback_command cmd, return 1; rc = mu_mailer_create (&mailer, value->v.string); if (rc) - grecs_error (locus, 0, _("cannot create mailer `%s': %s"), + grecs_error (&value->locus, 0, _("cannot create mailer `%s': %s"), value->v.string, mu_strerror (rc)); return rc; } @@ -302,7 +302,7 @@ cb_email_address (enum grecs_callback_command cmd, rc = mu_address_create (&addr, value->v.string); if (rc) { - grecs_error (locus, 0, _("%s: invalid email address: %s"), + grecs_error (&value->locus, 0, _("%s: invalid email address: %s"), value->v.string, mu_strerror (rc)); return rc; } @@ -324,7 +324,8 @@ cb_email_address (enum grecs_callback_command cmd, rc = mu_address_union (&addr, a); else { - grecs_error (locus, 0, _("%s: invalid email address: %s"), + grecs_error (&value->locus, 0, + _("%s: invalid email address: %s"), vp->v.string, mu_strerror (rc)); } mu_address_destroy (&a); @@ -361,7 +362,8 @@ cb_interval (enum grecs_callback_command cmd, /* FIXME 2: Support ISO intervals? */ rc = parse_time_interval (value->v.string, &interval, &endp); if (rc) - grecs_error (locus, 0, _("unrecognized interval format (near `%s')"), + grecs_error (&value->locus, 0, + _("unrecognized interval format (near `%s')"), endp); else *(time_t*) varptr = interval; @@ -383,7 +385,7 @@ cb_absolute_name (enum grecs_callback_command cmd, word = safe_file_name ((char*)value->v.string); if (!word || word[0] != '/') - grecs_error (locus, 0, _("must be an absolute file name")); + grecs_error (&value->locus, 0, _("must be an absolute file name")); else *(char**) varptr = word; return 0; @@ -403,7 +405,7 @@ cb_set_umask (enum grecs_callback_command cmd, return 1; m = strtoul (value->v.string, &p, 8) & 0777; if (*p) - grecs_error (locus, 0, _("invalid umask (near %s)"), p); + grecs_error (&value->locus, 0, _("invalid umask (near %s)"), p); else umask (m); return 0; @@ -436,7 +438,7 @@ parse_single_statmask (grecs_locus_t *locus, const grecs_value_t *val, if (val->type != GRECS_TYPE_STRING) { - grecs_error (locus, 0, _("expected scalar value but found list")); + grecs_error (&val->locus, 0, _("expected scalar value but found list")); return 1; } @@ -457,7 +459,7 @@ parse_single_statmask (grecs_locus_t *locus, const grecs_value_t *val, if (keyword_to_tok (arg, stat_tab, &x)) { - grecs_error (locus, 0, _("unknown statistics type: %s"), arg); + grecs_error (&val->locus, 0, _("unknown statistics type: %s"), arg); return 1; } *pmask = STAT_MASK (x); @@ -558,12 +560,14 @@ cb_sql_host (enum grecs_callback_command cmd, unsigned long n = strtoul (p, &end, 10); if (*end) { - grecs_error (locus, 0, _("invalid port number (near %s)"), end); + grecs_error (&value->locus, 0, + _("invalid port number (near %s)"), end); return 0; } if (n == 0 || n > USHRT_MAX) { - grecs_error (locus, 0, _("port number out of range 1..%d"), + grecs_error (&value->locus, 0, + _("port number out of range 1..%d"), USHRT_MAX); return 0; } @@ -591,7 +595,8 @@ cb_sql (enum grecs_callback_command cmd, case grecs_callback_section_begin: if (!value || value->type != GRECS_TYPE_STRING) { - grecs_error(locus, 0, _("tag must be a string")); + grecs_error(value ? &value->locus : locus, 0, + _("tag must be a string")); return 0; } pconn = grecs_zalloc (sizeof (*pconn)); @@ -643,7 +648,7 @@ cb_syslog_facility (enum grecs_callback_command cmd, return 1; if (mu_string_to_syslog_facility (value->v.string, varptr)) - grecs_error (locus, 0, _("Unknown syslog facility `%s'"), + grecs_error (&value->locus, 0, _("Unknown syslog facility `%s'"), value->v.string); return 0; } @@ -671,14 +676,16 @@ cb_define_message (enum grecs_callback_command cmd, if (value->v.arg.v[0]->type != GRECS_TYPE_STRING) { - grecs_error (locus, 0, _("first argument not a string")); + grecs_error (&value->v.arg.v[0]->locus, 0, + _("first argument not a string")); return 1; } ident = value->v.arg.v[0]->v.string; if (value->v.arg.v[1]->type != GRECS_TYPE_STRING) { - grecs_error (locus, 0, _("second argument not a string")); + grecs_error (&value->v.arg.v[1]->locus, 0, + _("second argument not a string")); return 1; } @@ -746,7 +753,7 @@ cb_backup (enum grecs_callback_command cmd, if (assert_string_arg (locus, cmd, value)) return 1; - *ptype = get_backup_version (locus, NULL, value->v.string); + *ptype = get_backup_version (&value->locus, NULL, value->v.string); return 0; } @@ -783,7 +790,8 @@ cb_archive (enum grecs_callback_command cmd, if (value->type != GRECS_TYPE_STRING) { - grecs_error (locus, 0, _("expected scalar value but found list")); + grecs_error (&value->locus, 0, + _("expected scalar value but found list")); return 1; } @@ -795,7 +803,7 @@ cb_archive (enum grecs_callback_command cmd, arch->type = archive_directory; else { - grecs_error (locus, 0, _("unknown archive type")); + grecs_error (&value->locus, 0, _("unknown archive type")); return 1; } if (cmd == grecs_callback_section_begin) @@ -850,7 +858,7 @@ cb_event (enum grecs_callback_command cmd, if (assert_string_arg (locus, cmd, value)) return 1; - string_to_notification_event (locus, value->v.string, pev); + string_to_notification_event (&value->locus, value->v.string, pev); return 0; } @@ -865,7 +873,7 @@ cb_recipient (enum grecs_callback_command cmd, if (assert_string_arg (locus, cmd, value)) return 1; - string_to_notification_target (locus, value->v.string, tgt); + string_to_notification_target (&value->locus, value->v.string, tgt); return 0; } @@ -947,7 +955,8 @@ cb_dictionary_type (enum grecs_callback_command cmd, return 1; *ptype = string_to_dictionary_type (value->v.string); if (*ptype == dictionary_none) - grecs_error (locus, 0, _("unknown dictionary type: %s"), value->v.string); + grecs_error (&value->locus, 0, + _("unknown dictionary type: %s"), value->v.string); return 0; } @@ -968,7 +977,7 @@ cb_dictionary_params (enum grecs_callback_command cmd, } if (!value || value->type != GRECS_TYPE_LIST) { - grecs_error (locus, 0, _("expected list value")); + grecs_error (value ? &value->locus : locus, 0, _("expected list value")); return 1; } @@ -1047,10 +1056,11 @@ cb_dictionary (enum grecs_callback_command cmd, case grecs_callback_section_begin: if (!value || value->type != GRECS_TYPE_STRING) { - grecs_error(locus, 0, _("tag must be a string")); + grecs_error(value ? &value->locus : locus, 0, + _("tag must be a string")); return 0; } - if (string_to_dictionary_id (locus, value->v.string, &id)) + if (string_to_dictionary_id (&value->locus, value->v.string, &id)) return 1; pmeth = (struct dictionary **) varptr + id; *pmeth = dictionary_new (id, dictionary_builtin); @@ -1103,7 +1113,7 @@ cb_url (enum grecs_callback_command cmd, rc = mu_url_create (&url, value->v.string); if (rc) { - grecs_error (locus, 0, _("cannot create URL `%s': %s"), + grecs_error (&value->locus, 0, _("cannot create URL `%s': %s"), value->v.string, mu_strerror (rc)); return rc; } @@ -1156,7 +1166,8 @@ cb_spool (enum grecs_callback_command cmd, case grecs_callback_section_begin: if (!value || value->type != GRECS_TYPE_STRING) { - grecs_error (locus, 0, _("tag must be a string")); + grecs_error (value ? &value->locus : locus, 0, + _("tag must be a string")); return 1; } spool = grecs_zalloc (sizeof (*spool)); @@ -1242,7 +1253,8 @@ cb_user (enum grecs_callback_command cmd, pw = getpwnam (value->v.string); if (!pw) { - grecs_error (locus, 0, _("no such user: %s"), value->v.string); + grecs_error (&value->locus, 0, + _("no such user: %s"), value->v.string); return 1; } @@ -1265,7 +1277,7 @@ cb_supp_groups (enum grecs_callback_command cmd, } if (!value || value->type != GRECS_TYPE_LIST) { - grecs_error (locus, 0, _("expected list value")); + grecs_error (value ? &value->locus : locus, 0, _("expected list value")); return 1; } @@ -1290,7 +1302,8 @@ cb_supp_groups (enum grecs_callback_command cmd, grp = getgrnam (vp->v.string); if (!grp) { - grecs_error (locus, 0, _("no such group: %s"), value->v.string); + grecs_error (&value->locus, 0, + _("no such group: %s"), value->v.string); break; } wydawca_supp_groups[i] = grp->gr_gid; @@ -1323,7 +1336,8 @@ cb_locking (enum grecs_callback_command cmd, { if (!value || value->type != GRECS_TYPE_STRING) { - grecs_error (locus, 0, _("expected scalar value as a tag")); + grecs_error (value ? &value->locus : locus, 0, + _("expected scalar value as a tag")); return 1; } grecs_string_convert (&enable_locking, grecs_type_bool, value->v.string, |