comparison src/conf.c @ 114:a80ebfa16cd5

better debugging output (thanks to Paolo)
author meillo@marmaro.de
date Wed, 30 Jun 2010 15:00:59 +0200
parents 71605f542ecc
children 315773f814f7
comparison
equal deleted inserted replaced
113:c93023f58cc7 114:a80ebfa16cd5
97 97
98 while (!feof(fptr)) { 98 while (!feof(fptr)) {
99 fgets(buf, 255, fptr); 99 fgets(buf, 255, fptr);
100 if (buf[0] && (buf[0] != '#') && (buf[0] != '\n')) { 100 if (buf[0] && (buf[0] != '#') && (buf[0] != '\n')) {
101 g_strchomp(buf); 101 g_strchomp(buf);
102 DEBUG(6) fprintf(stderr,"parse_list_file: item = %s\n", buf);
102 list = g_list_append(list, g_strdup(buf)); 103 list = g_list_append(list, g_strdup(buf));
103 } 104 }
104 } 105 }
105 fclose(fptr); 106 fclose(fptr);
106 107
113 { 114 {
114 GList *list = NULL; 115 GList *list = NULL;
115 gchar buf[256]; 116 gchar buf[256];
116 gchar *p, *q; 117 gchar *p, *q;
117 118
118 DEBUG(6) fprintf(stderr, "parsing list %s\n", line); 119 DEBUG(6) fprintf(stderr, "parsing list %s, file?:%d\n", line, read_file);
119 120
120 p = line; 121 p = line;
121 while (*p != '\0') { 122 while (*p != '\0') {
122 q = buf; 123 q = buf;
123 124
130 list = g_list_concat(list, parse_list_file(buf)); 131 list = g_list_concat(list, parse_list_file(buf));
131 else 132 else
132 /* just a normal item */ 133 /* just a normal item */
133 list = g_list_append(list, g_strdup(buf)); 134 list = g_list_append(list, g_strdup(buf));
134 135
135 DEBUG(6) printf("item = %s\n", buf); 136 DEBUG(6) fprintf(stderr, "item = %s\n", buf);
136 137
137 if (*p) 138 if (*p)
138 p++; 139 p++;
139 } 140 }
140 return list; 141 return list;
212 if (*p) { 213 if (*p) {
213 p++; 214 p++;
214 iface->port = atoi(p); 215 iface->port = atoi(p);
215 } else 216 } else
216 iface->port = def_port; 217 iface->port = def_port;
218 DEBUG(6) fprintf(stderr,"rval=%s, address:port=%s:%i\n",line, iface->address, iface->port);
217 219
218 return iface; 220 return iface;
219 } 221 }
220 222
221 #ifdef ENABLE_IDENT /* so far used for that only */ 223 #ifdef ENABLE_IDENT /* so far used for that only */
399 401
400 /* eat comments and empty lines: */ 402 /* eat comments and empty lines: */
401 if (!eat_comments(in)) 403 if (!eat_comments(in))
402 return FALSE; 404 return FALSE;
403 405
404 DEBUG(6) fprintf(stderr, "read_statement() 1\n");
405
406 if (!read_lval(in, lval, lsize)) { 406 if (!read_lval(in, lval, lsize)) {
407 return FALSE; 407 return FALSE;
408 } 408 }
409 409
410 DEBUG(6) fprintf(stderr, "lval = %s\n", lval); 410 DEBUG(6) fprintf(stderr, " lval = %s\n", lval);
411 if ((c = fgetc(in) == '=')) { 411 if ((c = fgetc(in) == '=')) {
412 if (read_rval(in, rval, rsize)) { 412 if (read_rval(in, rval, rsize)) {
413 DEBUG(6) fprintf(stderr, "rval = %s\n", rval); 413 DEBUG(6) fprintf(stderr, " rval = %s\n", rval);
414 return TRUE; 414 return TRUE;
415 } 415 }
416 } else { 416 } else {
417 DEBUG(6) fprintf(stderr," '=' expected after %s, char was '%c'\n", lval, c);
417 fprintf(stderr, "'=' expected after %s, char was '%c'\n", lval, c); 418 fprintf(stderr, "'=' expected after %s, char was '%c'\n", lval, c);
418 } 419 }
419 return FALSE; 420 return FALSE;
420 } 421 }
421 422
435 return FALSE; 436 return FALSE;
436 } 437 }
437 438
438 gchar lval[256], rval[2048]; 439 gchar lval[256], rval[2048];
439 while (read_statement(in, lval, 256, rval, 2048)) { 440 while (read_statement(in, lval, 256, rval, 2048)) {
441 DEBUG(6) fprintf(stderr,"read_conf(): lval=%s\n", lval);
440 if (strcmp(lval, "debug_level") == 0) 442 if (strcmp(lval, "debug_level") == 0)
441 conf.debug_level = atoi(rval); 443 conf.debug_level = atoi(rval);
442 else if (strcmp(lval, "run_as_user") == 0) { 444 else if (strcmp(lval, "run_as_user") == 0) {
443 if (!conf.run_as_user) /* you should not be able to reset that flag */ 445 if (!conf.run_as_user) /* you should not be able to reset that flag */
444 conf.run_as_user = parse_boolean(rval); 446 conf.run_as_user = parse_boolean(rval);