annotate parser-cfg.c @ 9859:16a7d1f4da38

Rewritten, to use new libmpeg2 0.3.1 API based on work by Fabian Franz <FabianFranz@gmx.de>
author arpi
date Sun, 06 Apr 2003 16:43:46 +0000
parents b0141de527df
children a660de2556c2
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
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
2 #include "config.h"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
3
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
4 #ifdef NEW_CONFIG
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
5
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
6 #include <stdio.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
7 #include <stdlib.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
8 #include <string.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
9 #include <errno.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
10 #include <ctype.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
11
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
12 #ifdef MP_DEBUG
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
13 #include <assert.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
14 #endif
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
15
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
16 #include "mp_msg.h"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
17 #include "m_option.h"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
18 #include "m_config.h"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
19
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
20 #define MAX_RECURSION_DEPTH 8
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
21
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
22 static int recursion_depth = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
23
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
24 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
25 {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
26 #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
27 #define MAX_LINE_LEN 10000
b0141de527df longer option buffers, needed for tv options
henry
parents: 9578
diff changeset
28 #define MAX_OPT_LEN 1000
b0141de527df longer option buffers, needed for tv options
henry
parents: 9578
diff changeset
29 #define MAX_PARAM_LEN 1000
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
30 FILE *fp;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
31 char *line;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
32 char opt[MAX_OPT_LEN + 1];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
33 char param[MAX_PARAM_LEN + 1];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
34 char c; /* for the "" and '' check */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
35 int tmp;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
36 int line_num = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
37 int line_pos; /* line pos */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
38 int opt_pos; /* opt pos */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
39 int param_pos; /* param pos */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
40 int ret = 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
41 int errors = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
42 int prev_mode = config->mode;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
43
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
44 #ifdef MP_DEBUG
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
45 assert(config != NULL);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
46 // assert(conf_list != NULL);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
47 #endif
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
48 mp_msg(MSGT_CFGPARSER,MSGL_INFO,"Reading config file %s", conffile);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
49
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
50 if (recursion_depth > MAX_RECURSION_DEPTH) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
51 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
52 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
53 goto out;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
54 } else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
55
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
56 config->mode = M_CONFIG_FILE;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
57
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
58 if ((line = (char *) malloc(MAX_LINE_LEN + 1)) == NULL) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
59 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
60 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
61 goto out;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
62 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
63
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
64 if ((fp = fopen(conffile, "r")) == NULL) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
65 mp_msg(MSGT_CFGPARSER,MSGL_ERR,": %s\n", strerror(errno));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
66 free(line);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
67 ret = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
68 goto out;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
69 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
70 mp_msg(MSGT_CFGPARSER,MSGL_INFO,"\n");
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
71
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
72 while (fgets(line, MAX_LINE_LEN, fp)) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
73 if (errors >= 16) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
74 mp_msg(MSGT_CFGPARSER,MSGL_FATAL,"too many errors\n");
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
75 goto out;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
76 }
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 line_num++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
79 line_pos = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
80
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
81 /* skip whitespaces */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
82 while (isspace(line[line_pos]))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
83 ++line_pos;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
84
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
85 /* EOL / comment */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
86 if (line[line_pos] == '\0' || line[line_pos] == '#')
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
87 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
88
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
89 /* read option. */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
90 for (opt_pos = 0; isprint(line[line_pos]) &&
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
91 line[line_pos] != ' ' &&
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
92 line[line_pos] != '#' &&
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
93 line[line_pos] != '='; /* NOTHING */) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
94 opt[opt_pos++] = line[line_pos++];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
95 if (opt_pos >= MAX_OPT_LEN) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
96 PRINT_LINENUM;
9578
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
97 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
98 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
99 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
100 goto nextline;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
101 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
102 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
103 if (opt_pos == 0) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
104 PRINT_LINENUM;
9578
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
105 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
106 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
107 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
108 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
109 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
110 opt[opt_pos] = '\0';
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
111
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
112 #ifdef MP_DEBUG
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
113 PRINT_LINENUM;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
114 mp_msg(MSGT_CFGPARSER,MSGL_V,"option: %s\n", opt);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
115 #endif
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
116
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
117 /* skip whitespaces */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
118 while (isspace(line[line_pos]))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
119 ++line_pos;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
120
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
121 /* check '=' */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
122 if (line[line_pos++] != '=') {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
123 PRINT_LINENUM;
9578
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
124 mp_msg(MSGT_CFGPARSER,MSGL_ERR,"Option %s need a parameter at line %d\n",line_num);
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
125 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
126 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
127 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
128 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
129
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
130 /* whitespaces... */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
131 while (isspace(line[line_pos]))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
132 ++line_pos;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
133
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
134 /* read the parameter */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
135 if (line[line_pos] == '"' || line[line_pos] == '\'') {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
136 c = line[line_pos];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
137 ++line_pos;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
138 for (param_pos = 0; line[line_pos] != c; /* NOTHING */) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
139 param[param_pos++] = line[line_pos++];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
140 if (param_pos >= MAX_PARAM_LEN) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
141 PRINT_LINENUM;
9578
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
142 mp_msg(MSGT_CFGPARSER,MSGL_ERR,"Option %s have 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
143 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
144 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
145 goto nextline;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
146 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
147 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
148 line_pos++; /* skip the closing " or ' */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
149 } else {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
150 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
151 && line[line_pos] != '#'; /* NOTHING */) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
152 param[param_pos++] = line[line_pos++];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
153 if (param_pos >= MAX_PARAM_LEN) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
154 PRINT_LINENUM;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
155 mp_msg(MSGT_CFGPARSER,MSGL_ERR,"too long parameter\n");
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
156 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
157 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
158 goto nextline;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
159 }
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 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
162 param[param_pos] = '\0';
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
163
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
164 /* did we read a parameter? */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
165 if (param_pos == 0) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
166 PRINT_LINENUM;
9578
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
167 mp_msg(MSGT_CFGPARSER,MSGL_ERR,"Option %s need a parameter at line %d\n",opt,line_num);
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
168 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
169 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
170 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
171 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
172
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
173 #ifdef MP_DEBUG
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
174 PRINT_LINENUM;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
175 mp_msg(MSGT_CFGPARSER,MSGL_V,"parameter: %s\n", param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
176 #endif
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
177
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
178 /* now, check if we have some more chars on the line */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
179 /* whitespace... */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
180 while (isspace(line[line_pos]))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
181 ++line_pos;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
182
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
183 /* EOL / comment */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
184 if (line[line_pos] != '\0' && line[line_pos] != '#') {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
185 PRINT_LINENUM;
9578
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
186 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
187 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
188 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
189
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
190 tmp = m_config_set_option(config, opt, param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
191 if (tmp < 0) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
192 PRINT_LINENUM;
9578
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
193 if(tmp == M_OPT_UNKNOW) {
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
194 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
195 continue;
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
196 }
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
197 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
198 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
199 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
200 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
201 /* break */
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 nextline:
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
204 ;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
205 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
206
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
207 free(line);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
208 fclose(fp);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
209 out:
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
210 config->mode = prev_mode;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
211 --recursion_depth;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
212 return ret;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
213 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
214
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
215 #endif