[Mplayer-cvslog] CVS: main cfgparser.c,1.28,1.29
Alex Beregszaszi
alex at mplayer.dev.hu
Fri Nov 2 01:25:55 CET 2001
Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv16237
Modified Files:
cfgparser.c
Log Message:
fixed arpi's cfgparser bug
Index: cfgparser.c
===================================================================
RCS file: /cvsroot/mplayer/main/cfgparser.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- cfgparser.c 22 Oct 2001 20:22:25 -0000 1.28
+++ cfgparser.c 2 Nov 2001 00:25:28 -0000 1.29
@@ -236,7 +236,7 @@
printf("%s", (char *) config[i].p);
exit(1);
default:
- printf("picsaba\n");
+ printf("Unknown config type specified in conf-mplayer.h!\n");
break;
}
out:
@@ -445,6 +445,7 @@
int f_nr = 0;
int tmp;
char *opt;
+ int no_more_opts = 0;
#ifdef DEBUG
assert(argv != NULL);
@@ -459,33 +460,49 @@
++recursion_depth;
for (i = 1; i < argc; i++) {
+next:
opt = argv[i];
- if (*opt != '-')
- goto filename;
-
- /* remove trailing '-' */
- opt++;
-
- tmp = read_option(opt, argv[i + 1]);
-
- switch (tmp) {
- case ERR_NOT_AN_OPTION:
-filename:
- /* opt is not an option -> treat it as a filename */
- if (!(f = (char **) realloc(f, sizeof(*f) * (f_nr + 2))))
- goto err_out_mem;
-
- f[f_nr++] = argv[i];
- break;
- case ERR_MISSING_PARAM:
- case ERR_OUT_OF_RANGE:
- case ERR_FUNC_ERR:
+ if ((*opt == '-') && (*(opt+1) == '-'))
+ {
+ no_more_opts = 1;
+// printf("no more opts! %d\n",i);
+ i++;
+ goto next;
+ }
+
+ if ((no_more_opts == 0) && (*opt == '-')) /* option */
+ {
+ /* remove trailing '-' */
+ opt++;
+// printf("this_opt = option: %s\n", opt);
+
+ tmp = read_option(opt, argv[i + 1]);
+
+ switch (tmp) {
+ case ERR_NOT_AN_OPTION:
+ case ERR_MISSING_PARAM:
+ case ERR_OUT_OF_RANGE:
+ case ERR_FUNC_ERR:
+ printf("Error %d while parsing option: '%s'!\n",
+ tmp, opt);
goto err_out;
/* break; */
- default:
+ default:
i += tmp;
+ break;
+ }
+ }
+ else /* filename */
+ {
+// printf("this_opt = filename: %s\n", opt);
+ /* opt is not an option -> treat it as a filename */
+ if (!(f = (char **) realloc(f, sizeof(*f) * (f_nr + 2))))
+ goto err_out_mem;
+
+ f[f_nr++] = argv[i];
}
}
+
if (f)
f[f_nr] = NULL;
if (filenames)
More information about the MPlayer-cvslog
mailing list