[Mplayer-cvslog] CVS: main m_config.c,1.4,1.5

Arpi of Ize arpi at mplayerhq.hu
Sun Feb 2 16:07:09 CET 2003


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

Modified Files:
	m_config.c 
Log Message:
print meaningful error message for missing parameter
noticed by Colin Leroy <colin at colino.net>


Index: m_config.c
===================================================================
RCS file: /cvsroot/mplayer/main/m_config.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- m_config.c	11 Jan 2003 17:32:45 -0000	1.4
+++ m_config.c	2 Feb 2003 15:06:56 -0000	1.5
@@ -254,6 +254,10 @@
 	    mp_msg(MSGT_CFGPARSER, MSGL_ERR,"Error: option '%s' has no suboption '%s'\n",co->name,lst[2*i]);
 	    r = M_OPT_INVALID;
 	  } else
+	  if(sr == M_OPT_MISSING_PARAM){
+	    mp_msg(MSGT_CFGPARSER, MSGL_ERR,"Error: suboption '%s' of '%s' must have a parameter!\n",lst[2*i],co->name);
+	    r = M_OPT_INVALID;
+	  } else
 	    r = sr;
 	}
       }
@@ -284,8 +288,14 @@
 
 int
 m_config_check_option(m_config_t *config, char* arg, char* param) {
+  int r;
   mp_msg(MSGT_CFGPARSER, MSGL_DBG2,"Checking %s=%s\n",arg,param);
-  return m_config_parse_option(config,arg,param,0);
+  r=m_config_parse_option(config,arg,param,0);
+  if(r==M_OPT_MISSING_PARAM){
+    mp_msg(MSGT_CFGPARSER, MSGL_ERR,"Error: option '%s' must have a parameter!\n",arg);
+    return M_OPT_INVALID;
+  }
+  return r;
 }
 
 



More information about the MPlayer-cvslog mailing list