Slurp a file path into a heap, NUL-terminated string. Caller frees. */
| 812 | |
| 813 | /* Slurp a file path into a heap, NUL-terminated string. Caller frees. */ |
| 814 | static char *cli_slurp_file(const char *path) { |
| 815 | FILE *f = fopen(path, "rb"); |
| 816 | if (!f) { |
| 817 | return NULL; |
| 818 | } |
| 819 | char *s = cli_slurp_stream(f); |
| 820 | (void)fclose(f); |
| 821 | return s; |
| 822 | } |
| 823 | |
| 824 | /* True if the first non-whitespace byte of s is '{' (raw-JSON detection). */ |
| 825 | static bool cli_first_nonspace_is_brace(const char *s) { |
no test coverage detected