Write raw bytes (may contain embedded NUL) to base/rel. Parent must exist. */
| 2124 | |
| 2125 | /* Write raw bytes (may contain embedded NUL) to base/rel. Parent must exist. */ |
| 2126 | static int write_bytes_file(const char *path, const void *data, size_t n) { |
| 2127 | FILE *f = cbm_fopen(path, "wb"); |
| 2128 | if (!f) { |
| 2129 | return -1; |
| 2130 | } |
| 2131 | size_t w = fwrite(data, 1, n, f); |
| 2132 | fclose(f); |
| 2133 | return w == n ? 0 : -1; |
| 2134 | } |
| 2135 | |
| 2136 | /* Discover a single file with the given first-line content and report the |
| 2137 | * language it was classified as via *out_lang (CBM_LANG_COUNT if unindexed). |
no test coverage detected