The returned length includes the replaced marker even when byte is NUL. */
| 578 | |
| 579 | /* The returned length includes the replaced marker even when byte is NUL. */ |
| 580 | static int dm_control_source(char *source, size_t capacity, size_t which, unsigned byte) { |
| 581 | int n = snprintf(source, capacity, |
| 582 | "%s/// <see cref=\"global::Good.Target\"/>\n" |
| 583 | "public class Tail { }\nnamespace . { public class Hidden { } }\n", |
| 584 | dm_control_cases[which].text); |
| 585 | if (n <= 0 || (size_t)n >= capacity) { |
| 586 | return -1; |
| 587 | } |
| 588 | char *mark = strchr(source, '~'); |
| 589 | if (!mark) { |
| 590 | return -1; |
| 591 | } |
| 592 | *mark = (char)byte; |
| 593 | return n; |
| 594 | } |
| 595 | |
| 596 | static bool dm_control_write(const char *path, const char *source, size_t length) { |
| 597 | FILE *file = cbm_fopen(path, "wb"); |