… | |
… | |
60 | result = malloc(sizeof(*result)); |
60 | result = malloc(sizeof(*result)); |
61 | *result = default_config; |
61 | *result = default_config; |
62 | return result; |
62 | return result; |
63 | } |
63 | } |
64 | |
64 | |
|
|
65 | void psiconv_config_free(psiconv_config config) |
|
|
66 | { |
|
|
67 | free(config); |
|
|
68 | } |
|
|
69 | |
65 | void psiconv_config_parse_statement(const char *filename, |
70 | void psiconv_config_parse_statement(const char *filename, |
66 | int linenr, |
71 | int linenr, |
67 | const char *var, int value, |
72 | const char *var, int value, |
68 | psiconv_config *config) |
73 | psiconv_config *config) |
69 | { |
74 | { |
70 | int charnr; |
75 | int charnr; |
71 | |
76 | |
72 | if (!(strcasecmp(var,"verbosity"))) { |
77 | if (!(strcasecmp(var,"verbosity"))) { |
73 | if ((value >= 1) && (value <= 4)) |
78 | if ((value >= 1) && (value <= 5)) |
74 | (*config)->verbosity = value; |
79 | (*config)->verbosity = value; |
75 | else |
80 | else |
76 | psiconv_error(*config,0,0,"Configuration file %s, line %d: " |
81 | psiconv_error(*config,0,0,"Configuration file %s, line %d: " |
77 | "Verbosity should be between 1 and 5",filename,linenr); |
82 | "Verbosity should be between 1 and 5",filename,linenr); |
78 | } else if (!(strcasecmp(var,"color"))) { |
83 | } else if (!(strcasecmp(var,"color"))) { |
… | |
… | |
108 | } else if (!(strcasecmp(var,"characterset"))) { |
113 | } else if (!(strcasecmp(var,"characterset"))) { |
109 | if ((value >= 0) && (value <= 1)) |
114 | if ((value >= 0) && (value <= 1)) |
110 | psiconv_unicode_select_characterset(*config,value); |
115 | psiconv_unicode_select_characterset(*config,value); |
111 | else |
116 | else |
112 | psiconv_error(*config,0,0,"Configuration file %s, line %d: " |
117 | psiconv_error(*config,0,0,"Configuration file %s, line %d: " |
113 | "CharacterSet should be between 0 and 0", |
118 | "CharacterSet should be between 0 and 1", |
114 | filename,linenr); |
119 | filename,linenr); |
115 | } else if (!(strcasecmp(var,"unknownunicodechar"))) { |
120 | } else if (!(strcasecmp(var,"unknownunicodechar"))) { |
116 | if ((value >= 1) && (value < 0x10000)) |
121 | if ((value >= 1) && (value < 0x10000)) |
117 | (*config)->unknown_unicode_char = value; |
122 | (*config)->unknown_unicode_char = value; |
118 | else |
123 | else |
… | |
… | |
352 | } |
357 | } |
353 | |
358 | |
354 | psiconv_config_parse_file(filename,config); |
359 | psiconv_config_parse_file(filename,config); |
355 | free(filename); |
360 | free(filename); |
356 | } |
361 | } |
|
|
362 | free(path); |
357 | } |
363 | } |