Slurp a file path into a heap, NUL-terminated string. Caller frees. */
| 642 | |
| 643 | /* Slurp a file path into a heap, NUL-terminated string. Caller frees. */ |
| 644 | static char *cli_slurp_file(const char *path) { |
| 645 | FILE *f = fopen(path, "rb"); |
| 646 | if (!f) { |
| 647 | return NULL; |
| 648 | } |
| 649 | char *s = cli_slurp_stream(f); |
| 650 | (void)fclose(f); |
| 651 | return s; |
| 652 | } |
| 653 | |
| 654 | /* True if the first non-whitespace byte of s is '{' (raw-JSON detection). */ |
| 655 | static bool cli_first_nonspace_is_brace(const char *s) { |
no test coverage detected