changeset 9222:d3da9b617aa8

print meaningful error message for missing parameter noticed by Colin Leroy <colin@colino.net>
author arpi
date Sun, 02 Feb 2003 15:06:56 +0000
parents e9707479087c
children b639f4560740
files m_config.c
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/m_config.c	Sun Feb 02 14:02:32 2003 +0000
+++ b/m_config.c	Sun Feb 02 15:06:56 2003 +0000
@@ -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;
 }