src/server/config/serverconfig.c

changeset 464
0a29110b94ec
parent 459
f21b4ff81c01
child 490
d218607f5a7e
equal deleted inserted replaced
463:4fd523fff13b 464:0a29110b94ec
225 } 225 }
226 } 226 }
227 */ 227 */
228 228
229 static void config_arg_set_value(CxAllocator *a, ConfigParam *arg, CFGToken token) { 229 static void config_arg_set_value(CxAllocator *a, ConfigParam *arg, CFGToken token) {
230 cxstring nv = cx_strchr(token.content, '='); 230 cxstring nv = (cxstring){NULL,0};
231 WSBool quotes = token.content.ptr[0] == '\"';
232 if(!quotes) {
233 nv = cx_strchr(token.content, '=');
234 }
231 if(!nv.ptr) { 235 if(!nv.ptr) {
236 if(quotes) {
237 // remove quote
238 token.content.ptr++;
239 token.content.length -= 2;
240 }
232 arg->value = cx_strdup_a(a, token.content); 241 arg->value = cx_strdup_a(a, token.content);
233 } else { 242 } else {
234 intptr_t eq = (intptr_t)(nv.ptr - token.content.ptr); 243 intptr_t eq = (intptr_t)(nv.ptr - token.content.ptr);
235 cxstring name = token.content; 244 cxstring name = token.content;
236 name.length = (size_t)eq; 245 name.length = (size_t)eq;
290 int obj_closed = 0; 299 int obj_closed = 0;
291 300
292 int text_start = 0; 301 int text_start = 0;
293 int err = 0; 302 int err = 0;
294 while((token = get_next_token(parser, content, &pos)).type != CFG_NO_TOKEN) { 303 while((token = get_next_token(parser, content, &pos)).type != CFG_NO_TOKEN) {
295 //printf("%s [%.*s]\n", token_type_str(token.type), (int)token.content.length, token.content.ptr); 304 //printf("[%.*s]\n", (int)token.content.length, token.content.ptr); fflush(stdout);
296 305
297 switch(token.type) { 306 switch(token.type) {
298 case CFG_NO_TOKEN: break; 307 case CFG_NO_TOKEN: break;
299 case CFG_TOKEN_COMMENT: { 308 case CFG_TOKEN_COMMENT: {
300 if(current->type == CONFIG_NODE_SPACE) { 309 if(current->type == CONFIG_NODE_SPACE) {

mercurial