- find_token_start(b);
- if((p = strchr(b -> ptr, '=')))
- *p++ = 0;
- else
- return "invalid value assignment";
-
- strtrim(b -> ptr);
-
- for(i = 0;abook_vars[i].option; i++)
- if(!strcmp(abook_vars[i].option, b -> ptr))
- return opt_set_set_option(b -> ptr, p, &abook_vars[i]);
-
- return "unknown option";
+ assert(var);
+ assert(p);
+
+ for(i = 0; abook_vars[i].option; i++)
+ if(!strcmp(abook_vars[i].option, var))
+ return opt_set_set_option(p, &abook_vars[i]);
+
+ return _("unknown option");
+}
+
+static int
+check_options()
+{
+ char *str;
+ int err = 0;
+
+ str = opt_get_str(STR_PRESERVE_FIELDS);
+ if(strcasecmp(str, "all") && strcasecmp(str, "none") &&
+ strcasecmp(str, "standard")) {
+ fprintf(stderr, _("valid values for the 'preserve_fields' "
+ "option are 'all', 'standard' "
+ "(default), and 'none'\n"));
+ restore_default(&abook_vars[STR_PRESERVE_FIELDS]);
+ err++;
+ }
+ str = opt_get_str(STR_ADDRESS_STYLE);
+ if(strcasecmp(str, "eu") && strcasecmp(str, "uk") &&
+ strcasecmp(str, "us")) {
+ fprintf(stderr, _("valid values for the 'address_style' "
+ "option are 'eu' (default), 'uk', "
+ "and 'us'\n"));
+ restore_default(&abook_vars[STR_ADDRESS_STYLE]);
+ err++;
+ }
+
+ return err;