| 1386 | static boolean disregarded_config_lines[SIZE(config_line_stmt)]; |
| 1387 | |
| 1388 | boolean |
| 1389 | parse_config_line(char *origbuf) |
| 1390 | { |
| 1391 | #if defined(MICRO) && !defined(NOCWD_ASSUMPTIONS) |
| 1392 | static boolean ramdisk_specified = FALSE; |
| 1393 | #endif |
| 1394 | #ifdef SYSCF |
| 1395 | int src = iflags.parse_config_file_src; |
| 1396 | boolean in_sysconf = (src == set_in_sysconf); |
| 1397 | #endif |
| 1398 | char *bufp, buf[4 * BUFSZ]; |
| 1399 | int i; |
| 1400 | |
| 1401 | while (*origbuf == ' ' || *origbuf == '\t') /* skip leading whitespace */ |
| 1402 | ++origbuf; /* (caller probably already did this) */ |
| 1403 | (void) strncpy(buf, origbuf, sizeof buf - 1); |
| 1404 | buf[sizeof buf - 1] = '\0'; /* strncpy not guaranteed to NUL terminate */ |
| 1405 | /* convert any tab to space, condense consecutive spaces into one, |
| 1406 | remove leading and trailing spaces (exception: if there is nothing |
| 1407 | but spaces, one of them will be kept even though it leads/trails) */ |
| 1408 | mungspaces(buf); |
| 1409 | |
| 1410 | /* find the '=' or ':' */ |
| 1411 | bufp = find_optparam(buf); |
| 1412 | if (!bufp) { |
| 1413 | if (!ignore_statement_errors) |
| 1414 | config_error_add("Not a config statement, missing '='"); |
| 1415 | return FALSE; |
| 1416 | } |
| 1417 | /* skip past '=', then space between it and value, if any */ |
| 1418 | ++bufp; |
| 1419 | if (*bufp == ' ') |
| 1420 | ++bufp; |
| 1421 | |
| 1422 | for (i = 0; i < SIZE(config_line_stmt); i++) { |
| 1423 | #ifdef SYSCF |
| 1424 | if (config_line_stmt[i].syscnf_only && !in_sysconf) |
| 1425 | continue; |
| 1426 | #endif |
| 1427 | if (match_varname(buf, config_line_stmt[i].name, |
| 1428 | config_line_stmt[i].len)) { |
| 1429 | char *parm = config_line_stmt[i].origbuf ? origbuf : bufp; |
| 1430 | |
| 1431 | if (!disregarded_config_lines[i]) |
| 1432 | return config_line_stmt[i].fn(parm); |
| 1433 | } |
| 1434 | } |
| 1435 | |
| 1436 | if (!ignore_errors_on_unmatched) |
| 1437 | config_error_add("Unknown config statement"); |
| 1438 | return FALSE; |
| 1439 | } |
| 1440 | |
| 1441 | #ifdef USER_SOUNDS |
| 1442 | boolean |
nothing calls this directly
no test coverage detected