summaryrefslogtreecommitdiffstats
path: root/cfgparser.c
diff options
context:
space:
mode:
authorszabii <szabii@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-06-09 17:30:40 +0000
committerszabii <szabii@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-06-09 17:30:40 +0000
commit39f05c8c2a9815c55345668d0d2b0f2adf29ac85 (patch)
tree972c3b53dc55ca053dbba838c71ad5ccf13328cb /cfgparser.c
parent3f2f7efcbd1dd31a210fc5e6d4cd243ff1051e75 (diff)
downloadmpv-39f05c8c2a9815c55345668d0d2b0f2adf29ac85.tar.bz2
mpv-39f05c8c2a9815c55345668d0d2b0f2adf29ac85.tar.xz
: No such... fix
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1076 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'cfgparser.c')
-rw-r--r--cfgparser.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/cfgparser.c b/cfgparser.c
index 912fc775da..ea07e0c18c 100644
--- a/cfgparser.c
+++ b/cfgparser.c
@@ -253,7 +253,7 @@ int parse_config_file(struct config *conf, char *conffile)
return -1;
}
- if (verbose) printf("Reading config file: %s", conffile);
+// printf("Reading config file: %s", conffile);
if (init_conf(conf, CONFIG_FILE) == -1) {
ret = -1;
@@ -267,13 +267,12 @@ int parse_config_file(struct config *conf, char *conffile)
}
if ((fp = fopen(conffile, "r")) == NULL) {
- if (!verbose) printf("Reading config file: %s", conffile);
- printf(": %s\n", strerror(errno));
+// printf(": %s\n", strerror(errno));
free(line);
ret = 0;
goto out;
}
- if (verbose) printf("\n");
+// printf("\n");
while (fgets(line, MAX_LINE_LEN, fp)) {
line_num++;
@@ -418,8 +417,13 @@ int parse_command_line(struct config *conf, int argc, char **argv, char **envp,
for (i = 1; i < argc; i++) {
opt = argv[i];
- if (*opt != '-')
- goto not_an_option;
+ if (*opt != '-') {
+ if (found_filename) {
+ printf("invalid option:\n");
+ goto err_out;
+ }
+ goto filename;
+ }
/* remove trailing '-' */
opt++;
@@ -428,28 +432,26 @@ int parse_command_line(struct config *conf, int argc, char **argv, char **envp,
switch (tmp) {
case ERR_NOT_AN_OPTION:
-not_an_option:
/* opt is not an option -> treat it as a filename */
if (found_filename) {
/* we already have a filename */
goto err_out;
- } else {
- found_filename = 1;
- *filename = argv[i];
- continue; /* next option */
}
+filename:
+ found_filename = 1;
+ *filename = argv[i];
break;
case ERR_MISSING_PARAM:
case ERR_OUT_OF_RANGE:
case ERR_FUNC_ERR:
goto err_out;
/* break; */
+ default:
+ i += tmp;
}
-
- i += tmp; /* we already processed the params (if there was any) */
}
return found_filename;
err_out:
- printf("parse_command_line: %s\n", argv[i]);
+ printf("command line: %s\n", argv[i]);
return -1;
}