gather all non-default cond_xyz options into one OPTIONS=cond_foo,!cond_bar entry spread across multiple lines with backslash+newline if needed; conditions with their default settings (cond_blind, !cond_glowhands, &c) are excluded */
| 9553 | conditions with their default settings (cond_blind, !cond_glowhands, &c) |
| 9554 | are excluded */ |
| 9555 | staticfn void |
| 9556 | all_options_conds(strbuf_t *sbuf) |
| 9557 | { |
| 9558 | char buf[BUFSZ], nextcond[BUFSZ]; |
| 9559 | int idx = 0; |
| 9560 | boolean gotone = FALSE; |
| 9561 | |
| 9562 | buf[0] = '\0'; |
| 9563 | while (opt_next_cond(idx, nextcond)) { |
| 9564 | /* 75: room for about 5 conditions, with enough space for player |
| 9565 | to edit resulting file manually and insert '!' in front of them */ |
| 9566 | if (idx == 0) { |
| 9567 | Strcpy(buf, "OPTIONS="); |
| 9568 | } else if (Strlen(buf) + 1 + Strlen(nextcond) >= 75) { |
| 9569 | /* finish off previous line */ |
| 9570 | Strcat(buf, ",\\\n"); /* comma and backslash+newline */ |
| 9571 | strbuf_append(sbuf, buf); |
| 9572 | /* indent continuation line */ |
| 9573 | Sprintf(buf, "%8s", " "); /* 8: strlen("OPTIONS=") */ |
| 9574 | } else if (nextcond[0] && gotone) { |
| 9575 | Strcat(buf, ","); |
| 9576 | } |
| 9577 | if (nextcond[0]) { |
| 9578 | gotone = TRUE; |
| 9579 | Strcat(buf, nextcond); |
| 9580 | } |
| 9581 | ++idx; |
| 9582 | } |
| 9583 | /* finish off final line; value might be empty if one or more cond_xyz |
| 9584 | options were changed in such a manner that they're all back to their |
| 9585 | default values--which will produce "OPTIONS=" with nothing after the |
| 9586 | equals sign; only add to the output when there is more present */ |
| 9587 | if (strcmp(buf, "OPTIONS=")) { |
| 9588 | Strcat(buf, "\n"); |
| 9589 | strbuf_append(sbuf, buf); |
| 9590 | } |
| 9591 | } |
| 9592 | |
| 9593 | /* append menucolor lines to strbuf */ |
| 9594 | staticfn void |
no test coverage detected