The first `cap` bytes of a file, raw. false when the file cannot be opened. * A read error keeps the bytes read before it, as the probes always did. */
| 1187 | /* The first `cap` bytes of a file, raw. false when the file cannot be opened. |
| 1188 | * A read error keeps the bytes read before it, as the probes always did. */ |
| 1189 | static bool lang_read_head(const char *path, unsigned char *buf, size_t cap, size_t *n) { |
| 1190 | *n = 0; |
| 1191 | FILE *f = path ? cbm_fopen(path, "rb") : NULL; |
| 1192 | if (!f) { |
| 1193 | return false; |
| 1194 | } |
| 1195 | *n = fread(buf, SKIP_ONE, cap, f); |
| 1196 | (void)fclose(f); |
| 1197 | return true; |
| 1198 | } |
| 1199 | |
| 1200 | /* `more`: the file has bytes beyond head[0..n). A first line that fills the |
| 1201 | * probe and goes on is cut, and a cut line names no interpreter. */ |
no test coverage detected