--- psiconv/trunk/lib/psiconv/configuration.c 2003/12/13 23:26:37 180 +++ psiconv/trunk/lib/psiconv/configuration.c 2004/01/04 15:47:16 181 @@ -20,6 +20,7 @@ #include "config.h" #include "error.h" #include "compat.h" +#include "unicode.h" #include #include @@ -39,7 +40,7 @@ #define CONFIGURATION_SEARCH_PATH "/etc/psiconv.conf:~/.psiconv.conf" #endif static struct psiconv_config_s default_config = - { PSICONV_VERB_WARN, 2, 0,0,0,psiconv_bool_false,NULL }; + { PSICONV_VERB_WARN, 2, 0,0,0,psiconv_bool_false,NULL,'?' }; static void psiconv_config_parse_statement(const char *filename, int linenr, @@ -65,6 +66,8 @@ const char *var, int value, psiconv_config *config) { + int charnr; + if (!(strcasecmp(var,"verbosity"))) { if ((value >= 1) && (value <= 4)) (*config)->verbosity = value; @@ -101,6 +104,38 @@ else psiconv_fatal(*config,0,0,"Configuration file %s, line %d: " "BlueBits should be between 1 and 32 or 0",filename,linenr); + } else if (!(strcasecmp(var,"characterset"))) { + if ((value >= 0) && (value <= 0)) + psiconv_unicode_select_characterset(*config,value); + else + psiconv_fatal(*config,0,0,"Configuration file %s, line %d: " + "CharacterSet should be between 0 and 0", + filename,linenr); + } else if (!(strcasecmp(var,"unknownunicodechar"))) { + if ((value >= 1) && (value < 0x10000)) + (*config)->unknown_unicode_char = value; + else + psiconv_fatal(*config,0,0,"Configuration file %s, line %d: " + "UnknownUnicodeChar should be between 1 and 65535", + filename,linenr); + } else if (!(strcasecmp(var,"unknownepocchar"))) { + if ((value >= 1) && (value < 0x100)) + (*config)->unknown_epoc_char = value; + else + psiconv_fatal(*config,0,0,"Configuration file %s, line %d: " + "UnknownEPOCChar should be between 1 and 255", + filename,linenr); + } else if (sscanf(var,"char%d",&charnr) == strlen(var)) { + if ((charnr < 0) || (charnr > 255)) + psiconv_fatal(*config,0,0,"Configuration file %s, line %d: " + "CharXXX should have XXX between 0 and 255", + filename,linenr); + if ((value >= 1) && (value <= 0x10000)) + (*config)->unicode_table[charnr] = value; + else + psiconv_fatal(*config,0,0,"Configuration file %s, line %d: " + "CharXXX should be between 1 and 65535", + filename,linenr); } else { psiconv_fatal(*config,0,0,"Configuration file %s, line %d: " "Unknown variable %s",filename,linenr,var);