# HG changeset patch # User szabii # Date 992214404 0 # Node ID b2a29e1224e4223904c3333e6099a92f58a06a3a # Parent f558888661ca097ff4568c2fddd37f826c1a1b15 some fix diff -r f558888661ca -r b2a29e1224e4 cfgparser.c --- a/cfgparser.c Sun Jun 10 22:25:09 2001 +0000 +++ b/cfgparser.c Sun Jun 10 23:06:44 2001 +0000 @@ -245,11 +245,14 @@ #ifdef DEBUG assert(conffile != NULL); #endif - if (++recursion_depth > MAX_RECURSION_DEPTH) { - printf("too deep 'include'. check your configfiles\n"); - --recursion_depth; - return -1; - } + if (++recursion_depth > 1) + printf("Reading config file: %s", conffile); + + if (recursion_depth > MAX_RECURSION_DEPTH) { + printf(": too deep 'include'. check your configfiles\n"); + ret = -1; + goto out; + } if (init_conf(conf, CONFIG_FILE) == -1) { ret = -1; @@ -263,10 +266,14 @@ } if ((fp = fopen(conffile, "r")) == NULL) { + if (recursion_depth > 1) + printf(": %s\n", strerror(errno)); free(line); ret = 0; goto out; } + if (recursion_depth > 1) + printf("\n"); while (fgets(line, MAX_LINE_LEN, fp)) { line_num++; @@ -409,6 +416,9 @@ if (init_conf(conf, COMMAND_LINE) == -1) return -1; + /* in order to work recursion detection properly in parse_config_file */ + ++recursion_depth; + for (i = 1; i < argc; i++) { opt = argv[i]; if (*opt != '-') { @@ -443,9 +453,11 @@ default: i += tmp; } - } + } + --recursion_depth; return found_filename; err_out: + --recursion_depth; printf("command line: %s\n", argv[i]); return -1; }