… | |
… | |
39 | |
39 | |
40 | #ifndef CONFIGURATION_SEARCH_PATH |
40 | #ifndef CONFIGURATION_SEARCH_PATH |
41 | #define CONFIGURATION_SEARCH_PATH PSICONVETCDIR "/psiconv.conf:~/.psiconv.conf" |
41 | #define CONFIGURATION_SEARCH_PATH PSICONVETCDIR "/psiconv.conf:~/.psiconv.conf" |
42 | #endif |
42 | #endif |
43 | static struct psiconv_config_s default_config = |
43 | static struct psiconv_config_s default_config = |
44 | { PSICONV_VERB_WARN, 2, 0,0,0,psiconv_bool_false,NULL,'?' }; |
44 | { PSICONV_VERB_WARN, 2, 0,0,0,psiconv_bool_false,NULL,'?','?',{ 0 },psiconv_bool_false }; |
45 | |
45 | |
46 | static void psiconv_config_parse_statement(const char *filename, |
46 | static void psiconv_config_parse_statement(const char *filename, |
47 | int linenr, |
47 | int linenr, |
48 | const char *var, int value, |
48 | const char *var, int value, |
49 | psiconv_config *config); |
49 | psiconv_config *config); |
… | |
… | |
57 | psiconv_config psiconv_config_default(void) |
57 | psiconv_config psiconv_config_default(void) |
58 | { |
58 | { |
59 | psiconv_config result; |
59 | psiconv_config result; |
60 | result = malloc(sizeof(*result)); |
60 | result = malloc(sizeof(*result)); |
61 | *result = default_config; |
61 | *result = default_config; |
|
|
62 | psiconv_unicode_select_characterset(result,1); |
62 | return result; |
63 | return result; |
63 | } |
64 | } |
64 | |
65 | |
65 | void psiconv_config_free(psiconv_config config) |
66 | void psiconv_config_free(psiconv_config config) |
66 | { |
67 | { |
… | |
… | |
73 | psiconv_config *config) |
74 | psiconv_config *config) |
74 | { |
75 | { |
75 | int charnr; |
76 | int charnr; |
76 | |
77 | |
77 | if (!(strcasecmp(var,"verbosity"))) { |
78 | if (!(strcasecmp(var,"verbosity"))) { |
78 | if ((value >= 1) && (value <= 4)) |
79 | if ((value >= 1) && (value <= 5)) |
79 | (*config)->verbosity = value; |
80 | (*config)->verbosity = value; |
80 | else |
81 | else |
81 | psiconv_error(*config,0,0,"Configuration file %s, line %d: " |
82 | psiconv_error(*config,0,0,"Configuration file %s, line %d: " |
82 | "Verbosity should be between 1 and 5",filename,linenr); |
83 | "Verbosity should be between 1 and 5",filename,linenr); |
83 | } else if (!(strcasecmp(var,"color"))) { |
84 | } else if (!(strcasecmp(var,"color"))) { |
… | |
… | |
113 | } else if (!(strcasecmp(var,"characterset"))) { |
114 | } else if (!(strcasecmp(var,"characterset"))) { |
114 | if ((value >= 0) && (value <= 1)) |
115 | if ((value >= 0) && (value <= 1)) |
115 | psiconv_unicode_select_characterset(*config,value); |
116 | psiconv_unicode_select_characterset(*config,value); |
116 | else |
117 | else |
117 | psiconv_error(*config,0,0,"Configuration file %s, line %d: " |
118 | psiconv_error(*config,0,0,"Configuration file %s, line %d: " |
118 | "CharacterSet should be between 0 and 0", |
119 | "CharacterSet should be between 0 and 1", |
119 | filename,linenr); |
120 | filename,linenr); |
120 | } else if (!(strcasecmp(var,"unknownunicodechar"))) { |
121 | } else if (!(strcasecmp(var,"unknownunicodechar"))) { |
121 | if ((value >= 1) && (value < 0x10000)) |
122 | if ((value >= 1) && (value < 0x10000)) |
122 | (*config)->unknown_unicode_char = value; |
123 | (*config)->unknown_unicode_char = value; |
123 | else |
124 | else |