print meaningful error message for missing parameter

noticed by Colin Leroy <colin@colino.net>


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9223 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2003-02-02 15:06:56 +00:00
parent 534d1a275c
commit e8b3a3bd4a
1 changed files with 11 additions and 1 deletions

View File

@ -253,6 +253,10 @@ m_config_parse_option(m_config_t *config, char* arg, char* param,int set) {
if(sr == M_OPT_UNKNOW){
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 @@ m_config_set_option(m_config_t *config, char* arg, char* param) {
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;
}