44 // read file |
44 // read file |
45 sstr_t l; |
45 sstr_t l; |
46 while((l = cfg_readln(in)).ptr != NULL) { |
46 while((l = cfg_readln(in)).ptr != NULL) { |
47 // put the line to the list |
47 // put the line to the list |
48 ConfigLine *line = OBJ_NEW(parser->mp, ConfigLine); |
48 ConfigLine *line = OBJ_NEW(parser->mp, ConfigLine); |
49 line->line = sstrdub_mp(parser->mp, l); |
49 line->line = sstrdub(l); |
50 line->object = NULL; |
50 line->object = NULL; |
51 line->type = LINE_OTHER; |
51 line->type = LINE_OTHER; |
52 parser->lines = ucx_dlist_append(parser->lines, line); |
52 parser->lines = ucx_dlist_append(parser->lines, line); |
53 |
53 |
54 // check if the line contains something |
54 // check if the line contains something |
274 name.ptr = line.ptr; |
274 name.ptr = line.ptr; |
275 name.length = i; |
275 name.length = i; |
276 |
276 |
277 // create directive object |
277 // create directive object |
278 ConfigDirective *directive = OBJ_NEW(mp, ConfigDirective); |
278 ConfigDirective *directive = OBJ_NEW(mp, ConfigDirective); |
279 directive->directive_type = sstrdub_mp(mp, name); |
279 directive->directive_type = sstrdub(name); |
280 directive->type_num = cfg_get_directive_type_num(name); |
280 directive->type_num = cfg_get_directive_type_num(name); |
281 directive->condition = NULL; // set later by main parsing function |
281 directive->condition = NULL; // set later by main parsing function |
282 directive->param = NULL; |
282 directive->param = NULL; |
283 |
283 |
284 sstr_t param_str; |
284 sstr_t param_str; |
299 /* |
299 /* |
300 * TODO: |
300 * TODO: |
301 * Wenn man sstrdub_mp statt sstrdub nimmt, wird der Inhalt von pname |
301 * Wenn man sstrdub_mp statt sstrdub nimmt, wird der Inhalt von pname |
302 * verunstaltet. Warum? |
302 * verunstaltet. Warum? |
303 */ |
303 */ |
304 param->name = sstrdub_mp(mp, pname); |
304 param->name = sstrdub(pname); |
305 |
305 |
306 if(pvalue.length > 0) { |
306 if(pvalue.length > 0) { |
307 param->value = sstrdub_mp(mp, pvalue); |
307 param->value = sstrdub(pvalue); |
308 } else { |
308 } else { |
309 param->value.ptr = NULL; |
309 param->value.ptr = NULL; |
310 param->value.length = 0; |
310 param->value.length = 0; |
311 } |
311 } |
312 |
312 |