diff options
author | szabii <szabii@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-06-10 23:06:44 +0000 |
---|---|---|
committer | szabii <szabii@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-06-10 23:06:44 +0000 |
commit | d4239d7b1e2cf6d8880ab43b53a25012a8261012 (patch) | |
tree | e9b90685f6f40273600bea1ae339f1e88cf32066 | |
parent | 8d38446c89f78ab81b00598a6972d295a0897659 (diff) | |
download | mpv-d4239d7b1e2cf6d8880ab43b53a25012a8261012.tar.bz2 mpv-d4239d7b1e2cf6d8880ab43b53a25012a8261012.tar.xz |
some fix
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1090 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | cfgparser.c | 24 |
1 files 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; } |