annotate parser-cfg.c @ 12615:84e078fd64b4

uniform VOBsub spelling
author diego
date Mon, 21 Jun 2004 12:47:41 +0000
parents 522afd56703c
children e632b43f0598
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1 #include "config.h"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
2
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
3 #include <stdio.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
4 #include <stdlib.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
5 #include <string.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
6 #include <errno.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
7 #include <ctype.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
8
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
9 #ifdef MP_DEBUG
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
10 #include <assert.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
11 #endif
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
12
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
13 #include "mp_msg.h"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
14 #include "m_option.h"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
15 #include "m_config.h"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
16
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
17 #define MAX_RECURSION_DEPTH 8
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
18
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
19 static int recursion_depth = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
20
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
21 int m_config_parse_config_file(m_config_t* config, char *conffile)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
22 {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
23 #define PRINT_LINENUM mp_msg(MSGT_CFGPARSER,MSGL_V,"%s(%d): ", conffile, line_num)
9813
b0141de527df longer option buffers, needed for tv options
henry
parents: 9578
diff changeset
24 #define MAX_LINE_LEN 10000
b0141de527df longer option buffers, needed for tv options
henry
parents: 9578
diff changeset
25 #define MAX_OPT_LEN 1000
b0141de527df longer option buffers, needed for tv options
henry
parents: 9578
diff changeset
26 #define MAX_PARAM_LEN 1000
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
27 FILE *fp;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
28 char *line;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
29 char opt[MAX_OPT_LEN + 1];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
30 char param[MAX_PARAM_LEN + 1];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
31 char c; /* for the "" and '' check */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
32 int tmp;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
33 int line_num = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
34 int line_pos; /* line pos */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
35 int opt_pos; /* opt pos */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
36 int param_pos; /* param pos */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
37 int ret = 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
38 int errors = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
39 int prev_mode = config->mode;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
40
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
41 #ifdef MP_DEBUG
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
42 assert(config != NULL);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
43 // assert(conf_list != NULL);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
44 #endif
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
45 mp_msg(MSGT_CFGPARSER,MSGL_INFO,"Reading config file %s", conffile);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
46
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
47 if (recursion_depth > MAX_RECURSION_DEPTH) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
48 mp_msg(MSGT_CFGPARSER,MSGL_ERR,": too deep 'include'. check your configfiles\n");
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
49 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
50 goto out;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
51 } else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
52
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
53 config->mode = M_CONFIG_FILE;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
54
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
55 if ((line = (char *) malloc(MAX_LINE_LEN + 1)) == NULL) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
56 mp_msg(MSGT_CFGPARSER,MSGL_FATAL,"\ncan't get memory for 'line': %s", strerror(errno));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
57 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
58 goto out;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
59 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
60
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
61 if ((fp = fopen(conffile, "r")) == NULL) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
62 mp_msg(MSGT_CFGPARSER,MSGL_ERR,": %s\n", strerror(errno));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
63 free(line);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
64 ret = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
65 goto out;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
66 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
67 mp_msg(MSGT_CFGPARSER,MSGL_INFO,"\n");
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
68
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
69 while (fgets(line, MAX_LINE_LEN, fp)) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
70 if (errors >= 16) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
71 mp_msg(MSGT_CFGPARSER,MSGL_FATAL,"too many errors\n");
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
72 goto out;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
73 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
74
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
75 line_num++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
76 line_pos = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
77
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
78 /* skip whitespaces */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
79 while (isspace(line[line_pos]))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
80 ++line_pos;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
81
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
82 /* EOL / comment */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
83 if (line[line_pos] == '\0' || line[line_pos] == '#')
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
84 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
85
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
86 /* read option. */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
87 for (opt_pos = 0; isprint(line[line_pos]) &&
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
88 line[line_pos] != ' ' &&
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
89 line[line_pos] != '#' &&
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
90 line[line_pos] != '='; /* NOTHING */) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
91 opt[opt_pos++] = line[line_pos++];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
92 if (opt_pos >= MAX_OPT_LEN) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
93 PRINT_LINENUM;
9578
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
94 mp_msg(MSGT_CFGPARSER,MSGL_ERR,"too long option at line %d\n",line_num);
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
95 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
96 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
97 goto nextline;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
98 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
99 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
100 if (opt_pos == 0) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
101 PRINT_LINENUM;
9578
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
102 mp_msg(MSGT_CFGPARSER,MSGL_ERR,"parse error at line %d\n",line_num);
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
103 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
104 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
105 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
106 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
107 opt[opt_pos] = '\0';
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
108
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
109 #ifdef MP_DEBUG
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
110 PRINT_LINENUM;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
111 mp_msg(MSGT_CFGPARSER,MSGL_V,"option: %s\n", opt);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
112 #endif
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
113
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
114 /* skip whitespaces */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
115 while (isspace(line[line_pos]))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
116 ++line_pos;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
117
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
118 /* check '=' */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
119 if (line[line_pos++] != '=') {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
120 PRINT_LINENUM;
10245
a660de2556c2 1000l! crashing on broken config files finally fixed!
rfelker
parents: 9813
diff changeset
121 mp_msg(MSGT_CFGPARSER,MSGL_ERR,"Option %s needs a parameter at line %d\n",opt,line_num);
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
122 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
123 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
124 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
125 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
126
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
127 /* whitespaces... */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
128 while (isspace(line[line_pos]))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
129 ++line_pos;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
130
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
131 /* read the parameter */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
132 if (line[line_pos] == '"' || line[line_pos] == '\'') {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
133 c = line[line_pos];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
134 ++line_pos;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
135 for (param_pos = 0; line[line_pos] != c; /* NOTHING */) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
136 param[param_pos++] = line[line_pos++];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
137 if (param_pos >= MAX_PARAM_LEN) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
138 PRINT_LINENUM;
10245
a660de2556c2 1000l! crashing on broken config files finally fixed!
rfelker
parents: 9813
diff changeset
139 mp_msg(MSGT_CFGPARSER,MSGL_ERR,"Option %s has a too long parameter at line %d\n",opt,line_num);
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
140 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
141 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
142 goto nextline;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
143 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
144 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
145 line_pos++; /* skip the closing " or ' */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
146 } else {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
147 for (param_pos = 0; isprint(line[line_pos]) && !isspace(line[line_pos])
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
148 && line[line_pos] != '#'; /* NOTHING */) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
149 param[param_pos++] = line[line_pos++];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
150 if (param_pos >= MAX_PARAM_LEN) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
151 PRINT_LINENUM;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
152 mp_msg(MSGT_CFGPARSER,MSGL_ERR,"too long parameter\n");
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
153 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
154 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
155 goto nextline;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
156 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
157 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
158 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
159 param[param_pos] = '\0';
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
160
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
161 /* did we read a parameter? */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
162 if (param_pos == 0) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
163 PRINT_LINENUM;
10245
a660de2556c2 1000l! crashing on broken config files finally fixed!
rfelker
parents: 9813
diff changeset
164 mp_msg(MSGT_CFGPARSER,MSGL_ERR,"Option %s needs a parameter at line %d\n",opt,line_num);
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
165 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
166 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
167 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
168 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
169
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
170 #ifdef MP_DEBUG
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
171 PRINT_LINENUM;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
172 mp_msg(MSGT_CFGPARSER,MSGL_V,"parameter: %s\n", param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
173 #endif
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
174
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
175 /* now, check if we have some more chars on the line */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
176 /* whitespace... */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
177 while (isspace(line[line_pos]))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
178 ++line_pos;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
179
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
180 /* EOL / comment */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
181 if (line[line_pos] != '\0' && line[line_pos] != '#') {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
182 PRINT_LINENUM;
9578
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
183 mp_msg(MSGT_CFGPARSER,MSGL_WARN,"extra characters on line %d: %s\n",line_num, line+line_pos);
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
184 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
185 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
186
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
187 tmp = m_config_set_option(config, opt, param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
188 if (tmp < 0) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
189 PRINT_LINENUM;
10595
522afd56703c 100l to albeu for his english grammar, and 10l to me becouse I noticed that lately (my backward compatibilty macro uses M_OPT_UNKNOWN)
alex
parents: 10594
diff changeset
190 if(tmp == M_OPT_UNKNOWN) {
9578
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
191 mp_msg(MSGT_CFGPARSER,MSGL_WARN,"Warning unknown option %s at line %d\n", opt,line_num);
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
192 continue;
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
193 }
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
194 mp_msg(MSGT_CFGPARSER,MSGL_ERR,"Error parsing option %s=%s at line %d\n",opt,param,line_num);
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
195 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
196 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
197 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
198 /* break */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
199 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
200 nextline:
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
201 ;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
202 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
203
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
204 free(line);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
205 fclose(fp);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
206 out:
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
207 config->mode = prev_mode;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
208 --recursion_depth;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
209 return ret;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
210 }