From d4239d7b1e2cf6d8880ab43b53a25012a8261012 Mon Sep 17 00:00:00 2001 From: szabii Date: Sun, 10 Jun 2001 23:06:44 +0000 Subject: some fix git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1090 b3059339-0415-0410-9bf9-f77b7e298cf2 --- cfgparser.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/cfgparser.c b/cfgparser.c index 350bf8efe2..e47f886901 100644 --- a/cfgparser.c +++ b/cfgparser.c @@ -245,11 +245,14 @@ int parse_config_file(struct config *conf, char *conffile) #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 @@ int parse_config_file(struct config *conf, char *conffile) } 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 @@ int parse_command_line(struct config *conf, int argc, char **argv, char **envp, 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 @@ filename: default: i += tmp; } - } + } + --recursion_depth; return found_filename; err_out: + --recursion_depth; printf("command line: %s\n", argv[i]); return -1; } -- cgit v1.2.3