Forward reference */
| 2252 | static void process_kconfigfile(const char *kconfigdir, |
| 2253 | const char *kconfigname); /* Forward reference */ |
| 2254 | static char *parse_kconfigfile(FILE *stream, const char *kconfigdir, |
| 2255 | const char *kconfigname) |
| 2256 | { |
| 2257 | enum token_type_e tokid; |
| 2258 | char *token = NULL; |
| 2259 | |
| 2260 | /* Process each line in the Kconfig file */ |
| 2261 | |
| 2262 | while (kconfig_line(stream) != NULL) |
| 2263 | { |
| 2264 | /* Process the first token on the Kconfig file line */ |
| 2265 | |
| 2266 | token = get_token(); |
| 2267 | while (token != NULL) |
| 2268 | { |
| 2269 | tokid = tokenize(token); |
| 2270 | |
| 2271 | switch (tokid) |
| 2272 | { |
| 2273 | case TOKEN_SOURCE: |
| 2274 | { |
| 2275 | /* Get the relative path from the Kconfig file line */ |
| 2276 | |
| 2277 | char *source = get_token(); |
| 2278 | |
| 2279 | /* Remove optional quoting */ |
| 2280 | |
| 2281 | source = dequote(source); |
| 2282 | if (source) |
| 2283 | { |
| 2284 | char *configname = basename(source); |
| 2285 | char *subdir = dirname(source); |
| 2286 | char *dirpath; |
| 2287 | |
| 2288 | /* Check for an absolute path */ |
| 2289 | |
| 2290 | if (source[0] == '/') |
| 2291 | { |
| 2292 | dirpath = strdup(subdir); |
| 2293 | } |
| 2294 | else |
| 2295 | { |
| 2296 | /* Check if the directory path contains $APPSDIR */ |
| 2297 | |
| 2298 | char *appsdir = strstr(subdir, "$APPSDIR"); |
| 2299 | if (appsdir) |
| 2300 | { |
| 2301 | char *tmp = appsdir + strlen("$APPSDIR"); |
| 2302 | |
| 2303 | *appsdir = '\0'; |
| 2304 | asprintf(&dirpath, "%s/%s%s%s", |
| 2305 | g_kconfigroot, subdir, |
| 2306 | g_appsdir, tmp); |
| 2307 | } |
| 2308 | else |
| 2309 | { |
| 2310 | asprintf(&dirpath, "%s/%s", |
| 2311 | g_kconfigroot, subdir); |
no test coverage detected