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

Function cx_copy_file

tests/test_complexity.c:199–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199static int cx_copy_file(const char *src, const char *dst) {
200 FILE *in = fopen(src, "rb");
201 if (!in) {
202 return -1;
203 }
204 FILE *out = fopen(dst, "wb");
205 if (!out) {
206 fclose(in);
207 return -1;
208 }
209 char buf[4096];
210 size_t n;
211 while ((n = fread(buf, 1, sizeof(buf), in)) > 0) {
212 fwrite(buf, 1, n, out);
213 }
214 fclose(in);
215 fclose(out);
216 return 0;
217}
218
219/* A fixture entry into `dst`: a file, or a directory with its contents. */
220static int cx_copy_entry(const char *src, const char *dst, bool is_dir) {

Callers 1

cx_copy_entryFunction · 0.85

Calls 3

fopenFunction · 0.85
freadFunction · 0.85
fwriteFunction · 0.85

Tested by

no test coverage detected