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

Arpi of Ize arpi at mplayerhq.hu
Mon Mar 17 01:56:25 CET 2003


Update of /cvsroot/mplayer/0_90
In directory mail:/var/tmp.root/cvs-serv29793

Modified Files:
	parser-cfg.c 
Log Message:
backport: better error messages


Index: parser-cfg.c
===================================================================
RCS file: /cvsroot/mplayer/0_90/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	17 Mar 2003 00:56:23 -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