MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / lang_read_head

Function lang_read_head

src/discover/language.c:1189–1198  ·  view source on GitHub ↗

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. */

Source from the content-addressed store, hash-verified

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. */
1189static 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. */

Callers 6

cbm_disambiguate_mFunction · 0.85
cbm_disambiguate_frmFunction · 0.85
cbm_disambiguate_resFunction · 0.85
cbm_disambiguate_clsFunction · 0.85
cbm_disambiguate_incFunction · 0.85
cbm_disambiguate_cfcFunction · 0.85

Calls 2

cbm_fopenFunction · 0.85
freadFunction · 0.85

Tested by

no test coverage detected