X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=options.c;h=3b8c338b059c316796ebb2a7a3a38e9b371ed89a;hb=03f9ed0d7defd9030b896b4761849432650d1959;hp=fbbd2a3987574d69c881f6726a1588f38ee696e6;hpb=0dd1d38a222a5e2e95879ab2397a83d4108d3379;p=pkg%2Fabook.git diff --git a/options.c b/options.c index fbbd2a3..3b8c338 100644 --- a/options.c +++ b/options.c @@ -1,6 +1,6 @@ /* - * $Id: options.c,v 1.25 2005/08/13 10:49:25 jheinonen Exp $ + * $Id: options.c,v 1.27.4.1 2006/04/09 18:57:34 jheinonen Exp $ * * by JH * @@ -15,6 +15,7 @@ #include #include "options.h" #include "abook.h" +#include "gettext.h" #include "misc.h" #include "xmalloc.h" @@ -188,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; @@ -227,7 +226,7 @@ find_token_end(buffer *b) } } -static char * +static const char * opt_set_set_option(char *var, char *p, struct option *opt) { int len; @@ -238,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++; } @@ -257,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); @@ -266,7 +265,7 @@ opt_set_set_option(char *var, char *p, struct option *opt) return NULL; } -static char * +static const char * opt_parse_set(buffer *b) { int i; @@ -276,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); @@ -284,12 +283,12 @@ 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 */ -static char * +static const char * opt_parse_customfield(buffer *b) { char *p, num[5]; @@ -309,14 +308,14 @@ 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; } static struct { char *token; - char * (*func) (buffer *line); + const char * (*func) (buffer *line); } opt_parsers[] = { { "set", opt_parse_set }, { "customfield", opt_parse_customfield }, @@ -327,7 +326,7 @@ static bool opt_parse_line(char *line, int n, char *fn) { int i; - char *err = NULL; + const char *err = NULL; char *token; buffer b; @@ -356,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; }