| 1361 | ****************************************************************************/ |
| 1362 | |
| 1363 | static void process_default(FILE *stream, struct default_s *defp) |
| 1364 | { |
| 1365 | enum token_type_e tokid; |
| 1366 | char *token; |
| 1367 | int ndx; |
| 1368 | |
| 1369 | /* Check if we have space for another default value */ |
| 1370 | |
| 1371 | ndx = defp->d_nitems; |
| 1372 | if (ndx >= MAX_DEFAULTS) |
| 1373 | { |
| 1374 | error("Too many default values\n"); |
| 1375 | exit(ERROR_TOO_MANY_DEFAULTS); |
| 1376 | } |
| 1377 | |
| 1378 | /* Get the next token which will be the value of the default */ |
| 1379 | |
| 1380 | token = get_token(); |
| 1381 | if (!token) |
| 1382 | { |
| 1383 | error("Missing default value\n"); |
| 1384 | exit(ERROR_MISSING_DEFAULT_VALUE); |
| 1385 | } |
| 1386 | |
| 1387 | defp->d_item[ndx].d_default = strdup(token); |
| 1388 | defp->d_item[ndx].d_dependency = NULL; |
| 1389 | |
| 1390 | /* Check if the default value is followed by "depends on" */ |
| 1391 | |
| 1392 | token = get_token(); |
| 1393 | if (token) |
| 1394 | { |
| 1395 | /* Yes.. something follows the default value. */ |
| 1396 | |
| 1397 | tokid = tokenize(token); |
| 1398 | if (tokid != TOKEN_IF) |
| 1399 | { |
| 1400 | error("Unrecognized garbage after default value\n"); |
| 1401 | exit(ERROR_GARBAGE_AFTER_DEFAULT); |
| 1402 | } |
| 1403 | |
| 1404 | /* The rest of the line is the dependency */ |
| 1405 | |
| 1406 | defp->d_item[ndx].d_dependency = strdup(g_lnptr); |
| 1407 | } |
| 1408 | |
| 1409 | /* Update the number of defaults we have encountered in this block */ |
| 1410 | |
| 1411 | defp->d_nitems++; |
| 1412 | } |
| 1413 | |
| 1414 | /**************************************************************************** |
| 1415 | * Name: print_default |