X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=options.c;h=0783173a1293131c90d733ddef1effa28e07528d;hb=0cd708a881cb4c6f398381b43be3521a36ca8bd4;hp=7d18f552f075cfcfa5f8c1c2083d472951bd410d;hpb=ef379a20d142cb95ba08c7887c8e3245269b3fdd;p=pkg%2Fabook.git diff --git a/options.c b/options.c index 7d18f55..0783173 100644 --- a/options.c +++ b/options.c @@ -15,7 +15,9 @@ #include #include "options.h" #include "abook.h" +#include "gettext.h" #include "misc.h" +#include "xmalloc.h" #ifndef FALSE # define FALSE 0 @@ -99,7 +101,7 @@ set_str(enum str_opts opt, char *value) if(str_opts[opt]) free(str_opts[opt]); - str_opts[opt] = strdup(value); + str_opts[opt] = xstrdup(value); } int @@ -187,10 +189,8 @@ opt_line_remove_comments(char *p) for(; *p; p++) { switch(*p) { case '\"': - if(!escape) { + if(!escape) in_quote = !in_quote; - escape = FALSE; - } break; case '\\': escape = TRUE; @@ -237,7 +237,7 @@ opt_set_set_option(char *var, char *p, struct option *opt) if(p[len - 1] == '\"' && *p == '\"') { if(len < 3) - return "invalid value"; + return _("invalid value"); p[len - 1] = 0; p++; } @@ -256,7 +256,7 @@ opt_set_set_option(char *var, char *p, struct option *opt) !strcasecmp(p, "off")) set_bool(opt -> data, FALSE); else - return "invalid value"; + return _("invalid value"); break; default: assert(0); @@ -275,7 +275,7 @@ opt_parse_set(buffer *b) if((p = strchr(b -> ptr, '='))) *p++ = 0; else - return "invalid value assignment"; + return _("invalid value assignment"); strtrim(b -> ptr); @@ -283,7 +283,7 @@ opt_parse_set(buffer *b) if(!strcmp(abook_vars[i].option, b -> ptr)) return opt_set_set_option(b -> ptr, p, &abook_vars[i]); - return "unknown option"; + return _("unknown option"); } #include "database.h" /* needed for change_custom_field_name */ @@ -308,7 +308,7 @@ opt_parse_customfield(buffer *b) find_token_start(b); if(change_custom_field_name(b->ptr, n) == -1) - return "invalid custom field number"; + return _("invalid custom field number"); return NULL; } @@ -355,11 +355,11 @@ opt_parse_line(char *line, int n, char *fn) break; } - fprintf(stderr, "%s: parse error at line %d: ", fn, n); + fprintf(stderr, _("%s: parse error at line %d: "), fn, n); if(err) fprintf(stderr, "%s\n", err); else - fprintf(stderr, "unknown token %s\n", token); + fprintf(stderr, _("unknown token %s\n"), token); return TRUE; }