Slurp a file path into a heap, NUL-terminated string. Caller frees. */
| 313 | |
| 314 | /* Slurp a file path into a heap, NUL-terminated string. Caller frees. */ |
| 315 | static char *cli_slurp_file(const char *path) { |
| 316 | FILE *f = fopen(path, "rb"); |
| 317 | if (!f) { |
| 318 | return NULL; |
| 319 | } |
| 320 | char *s = cli_slurp_stream(f); |
| 321 | (void)fclose(f); |
| 322 | return s; |
| 323 | } |
| 324 | |
| 325 | /* True if the first non-whitespace byte of s is '{' (raw-JSON detection). */ |
| 326 | static bool cli_first_nonspace_is_brace(const char *s) { |
no test coverage detected