annotate parser-cfg.c @ 18084:6a56ae7837b1

Document sinesupress audio filter, thanks to the help of Michael Niedermayer and Jan Knutar.
author gpoirier
date Thu, 13 Apr 2006 21:25:37 +0000
parents 63909962d3fc
children 1a14fde7680d
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;
17471
63909962d3fc Profiles support.
albeu
parents: 13946
diff changeset
40 m_profile_t* profile = NULL;
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
41
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
42 #ifdef MP_DEBUG
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
43 assert(config != NULL);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
44 // assert(conf_list != NULL);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
45 #endif
13946
e632b43f0598 Reduce excessive verbosity.
diego
parents: 10595
diff changeset
46 mp_msg(MSGT_CFGPARSER,MSGL_V,"Reading config file %s", conffile);
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
47
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
48 if (recursion_depth > MAX_RECURSION_DEPTH) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
49 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
50 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
51 goto out;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
52 } else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
53
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
54 config->mode = M_CONFIG_FILE;
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 if ((line = (char *) malloc(MAX_LINE_LEN + 1)) == NULL) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
57 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
58 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
59 goto out;
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
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
62 if ((fp = fopen(conffile, "r")) == NULL) {
13946
e632b43f0598 Reduce excessive verbosity.
diego
parents: 10595
diff changeset
63 mp_msg(MSGT_CFGPARSER,MSGL_V,": %s\n", strerror(errno));
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
64 free(line);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
65 ret = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
66 goto out;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
67 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
68 mp_msg(MSGT_CFGPARSER,MSGL_INFO,"\n");
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 while (fgets(line, MAX_LINE_LEN, fp)) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
71 if (errors >= 16) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
72 mp_msg(MSGT_CFGPARSER,MSGL_FATAL,"too many errors\n");
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
73 goto out;
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
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
76 line_num++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
77 line_pos = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
78
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
79 /* skip whitespaces */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
80 while (isspace(line[line_pos]))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
81 ++line_pos;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
82
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
83 /* EOL / comment */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
84 if (line[line_pos] == '\0' || line[line_pos] == '#')
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
85 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
86
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
87 /* read option. */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
88 for (opt_pos = 0; isprint(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] != '#' &&
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
91 line[line_pos] != '='; /* NOTHING */) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
92 opt[opt_pos++] = line[line_pos++];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
93 if (opt_pos >= MAX_OPT_LEN) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
94 PRINT_LINENUM;
9578
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
95 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
96 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
97 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
98 goto nextline;
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 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
101 if (opt_pos == 0) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
102 PRINT_LINENUM;
9578
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
103 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
104 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
105 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
106 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
107 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
108 opt[opt_pos] = '\0';
17471
63909962d3fc Profiles support.
albeu
parents: 13946
diff changeset
109
63909962d3fc Profiles support.
albeu
parents: 13946
diff changeset
110 /* Profile declaration */
63909962d3fc Profiles support.
albeu
parents: 13946
diff changeset
111 if(opt_pos > 2 && opt[0] == '[' && opt[opt_pos-1] == ']') {
63909962d3fc Profiles support.
albeu
parents: 13946
diff changeset
112 opt[opt_pos-1] = '\0';
63909962d3fc Profiles support.
albeu
parents: 13946
diff changeset
113 if(strcmp(opt+1,"default"))
63909962d3fc Profiles support.
albeu
parents: 13946
diff changeset
114 profile = m_config_add_profile(config,opt+1);
63909962d3fc Profiles support.
albeu
parents: 13946
diff changeset
115 else
63909962d3fc Profiles support.
albeu
parents: 13946
diff changeset
116 profile = NULL;
63909962d3fc Profiles support.
albeu
parents: 13946
diff changeset
117 continue;
63909962d3fc Profiles support.
albeu
parents: 13946
diff changeset
118 }
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
119
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
120 #ifdef MP_DEBUG
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
121 PRINT_LINENUM;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
122 mp_msg(MSGT_CFGPARSER,MSGL_V,"option: %s\n", opt);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
123 #endif
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
124
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
125 /* skip whitespaces */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
126 while (isspace(line[line_pos]))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
127 ++line_pos;
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 /* check '=' */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
130 if (line[line_pos++] != '=') {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
131 PRINT_LINENUM;
10245
a660de2556c2 1000l! crashing on broken config files finally fixed!
rfelker
parents: 9813
diff changeset
132 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
133 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
134 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
135 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
136 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
137
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
138 /* whitespaces... */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
139 while (isspace(line[line_pos]))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
140 ++line_pos;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
141
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
142 /* read the parameter */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
143 if (line[line_pos] == '"' || line[line_pos] == '\'') {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
144 c = line[line_pos];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
145 ++line_pos;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
146 for (param_pos = 0; line[line_pos] != c; /* NOTHING */) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
147 param[param_pos++] = line[line_pos++];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
148 if (param_pos >= MAX_PARAM_LEN) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
149 PRINT_LINENUM;
10245
a660de2556c2 1000l! crashing on broken config files finally fixed!
rfelker
parents: 9813
diff changeset
150 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
151 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
152 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
153 goto nextline;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
154 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
155 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
156 line_pos++; /* skip the closing " or ' */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
157 } else {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
158 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
159 && line[line_pos] != '#'; /* NOTHING */) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
160 param[param_pos++] = line[line_pos++];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
161 if (param_pos >= MAX_PARAM_LEN) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
162 PRINT_LINENUM;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
163 mp_msg(MSGT_CFGPARSER,MSGL_ERR,"too long parameter\n");
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
164 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
165 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
166 goto nextline;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
167 }
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 param[param_pos] = '\0';
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 /* did we read a parameter? */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
173 if (param_pos == 0) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
174 PRINT_LINENUM;
10245
a660de2556c2 1000l! crashing on broken config files finally fixed!
rfelker
parents: 9813
diff changeset
175 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
176 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
177 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
178 continue;
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
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
181 #ifdef MP_DEBUG
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
182 PRINT_LINENUM;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
183 mp_msg(MSGT_CFGPARSER,MSGL_V,"parameter: %s\n", param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
184 #endif
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 /* now, check if we have some more chars on the line */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
187 /* whitespace... */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
188 while (isspace(line[line_pos]))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
189 ++line_pos;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
190
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
191 /* EOL / comment */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
192 if (line[line_pos] != '\0' && line[line_pos] != '#') {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
193 PRINT_LINENUM;
9578
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
194 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
195 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
196 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
197
17471
63909962d3fc Profiles support.
albeu
parents: 13946
diff changeset
198 if(profile) {
63909962d3fc Profiles support.
albeu
parents: 13946
diff changeset
199 if(!strcmp(opt,"profile-desc"))
63909962d3fc Profiles support.
albeu
parents: 13946
diff changeset
200 m_profile_set_desc(profile,param), tmp = 1;
63909962d3fc Profiles support.
albeu
parents: 13946
diff changeset
201 else
63909962d3fc Profiles support.
albeu
parents: 13946
diff changeset
202 tmp = m_config_set_profile_option(config,profile,
63909962d3fc Profiles support.
albeu
parents: 13946
diff changeset
203 opt,param);
63909962d3fc Profiles support.
albeu
parents: 13946
diff changeset
204 } else
63909962d3fc Profiles support.
albeu
parents: 13946
diff changeset
205 tmp = m_config_set_option(config, opt, param);
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
206 if (tmp < 0) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
207 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
208 if(tmp == M_OPT_UNKNOWN) {
9578
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
209 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
210 continue;
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
211 }
0c5454233dcf Better error messages (with line number now) and make unknow option
albeu
parents: 8164
diff changeset
212 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
213 ret = -1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
214 errors++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
215 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
216 /* break */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
217 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
218 nextline:
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
219 ;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
220 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
221
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
222 free(line);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
223 fclose(fp);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
224 out:
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
225 config->mode = prev_mode;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
226 --recursion_depth;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
227 return ret;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
228 }