[Mplayer-cvslog] CVS: main parser-cfg.c,1.1,1.2

Alban Bedel CVS albeu at mplayerhq.hu
Thu Mar 13 15:10:04 CET 2003


Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv30303

Modified Files:
	parser-cfg.c 
Log Message:
Better error messages (with line number now) and make unknow option
non-fatal for ppl wich compile many different versions


Index: parser-cfg.c
===================================================================
RCS file: /cvsroot/mplayer/main/parser-cfg.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- parser-cfg.c	12 Nov 2002 01:56:21 -0000	1.1
+++ parser-cfg.c	13 Mar 2003 14:09:49 -0000	1.2
@@ -94,7 +94,7 @@
 			opt[opt_pos++] = line[line_pos++];
 			if (opt_pos >= MAX_OPT_LEN) {
 				PRINT_LINENUM;
-				mp_msg(MSGT_CFGPARSER,MSGL_ERR,"too long option\n");
+				mp_msg(MSGT_CFGPARSER,MSGL_ERR,"too long option at line %d\n",line_num);
 				errors++;
 				ret = -1;
 				goto nextline;
@@ -102,7 +102,7 @@
 		}
 		if (opt_pos == 0) {
 			PRINT_LINENUM;
-			mp_msg(MSGT_CFGPARSER,MSGL_ERR,"parse error\n");
+			mp_msg(MSGT_CFGPARSER,MSGL_ERR,"parse error at line %d\n",line_num);
 			ret = -1;
 			errors++;
 			continue;
@@ -121,7 +121,7 @@
 		/* check '=' */
 		if (line[line_pos++] != '=') {
 			PRINT_LINENUM;
-			mp_msg(MSGT_CFGPARSER,MSGL_ERR,"option without parameter\n");
+			mp_msg(MSGT_CFGPARSER,MSGL_ERR,"Option %s need a parameter at line %d\n",line_num);
 			ret = -1;
 			errors++;
 			continue;
@@ -139,7 +139,7 @@
 				param[param_pos++] = line[line_pos++];
 				if (param_pos >= MAX_PARAM_LEN) {
 					PRINT_LINENUM;
-					mp_msg(MSGT_CFGPARSER,MSGL_ERR,"too long parameter\n");
+					mp_msg(MSGT_CFGPARSER,MSGL_ERR,"Option %s have a too long parameter at line %d\n",opt,line_num);
 					ret = -1;
 					errors++;
 					goto nextline;
@@ -164,7 +164,7 @@
 		/* did we read a parameter? */
 		if (param_pos == 0) {
 			PRINT_LINENUM;
-			mp_msg(MSGT_CFGPARSER,MSGL_ERR,"option without parameter\n");
+			mp_msg(MSGT_CFGPARSER,MSGL_ERR,"Option %s need a parameter at line %d\n",opt,line_num);
 			ret = -1;
 			errors++;
 			continue;
@@ -183,14 +183,18 @@
 		/* EOL / comment */
 		if (line[line_pos] != '\0' && line[line_pos] != '#') {
 			PRINT_LINENUM;
-			mp_msg(MSGT_CFGPARSER,MSGL_WARN,"extra characters on line: %s\n", line+line_pos);
+			mp_msg(MSGT_CFGPARSER,MSGL_WARN,"extra characters on line %d: %s\n",line_num, line+line_pos);
 			ret = -1;
 		}
 
 		tmp = m_config_set_option(config, opt, param);
 		if (tmp < 0) {
 			PRINT_LINENUM;
-			mp_msg(MSGT_CFGPARSER,MSGL_INFO,"%s\n", opt);
+			if(tmp == M_OPT_UNKNOW) {
+				mp_msg(MSGT_CFGPARSER,MSGL_WARN,"Warning unknown option %s at line %d\n", opt,line_num);
+				continue;
+			}
+			mp_msg(MSGT_CFGPARSER,MSGL_ERR,"Error parsing option %s=%s at line %d\n",opt,param,line_num);
 			ret = -1;
 			errors++;
 			continue;



More information about the MPlayer-cvslog mailing list