mirror of
https://github.com/mpv-player/mpv
synced 2025-03-25 04:38:01 +00:00
Better error messages (with line number now) and make unknow option
non-fatal for ppl wich compile many different versions git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9579 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
2884aed1ce
commit
5c2cc17c3a
18
parser-cfg.c
18
parser-cfg.c
@ -94,7 +94,7 @@ int m_config_parse_config_file(m_config_t* config, char *conffile)
|
||||
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 @@ int m_config_parse_config_file(m_config_t* config, char *conffile)
|
||||
}
|
||||
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 @@ int m_config_parse_config_file(m_config_t* config, char *conffile)
|
||||
/* 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 @@ int m_config_parse_config_file(m_config_t* config, char *conffile)
|
||||
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 @@ int m_config_parse_config_file(m_config_t* config, char *conffile)
|
||||
/* 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 @@ int m_config_parse_config_file(m_config_t* config, char *conffile)
|
||||
/* 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;
|
||||
|
Loading…
Reference in New Issue
Block a user