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

Function write_pattern_file

src/mcp/mcp.c:5081–5090  ·  view source on GitHub ↗

Write pattern to a temp file for grep -f. Returns true on success. */

Source from the content-addressed store, hash-verified

5079
5080/* Write pattern to a temp file for grep -f. Returns true on success. */
5081static bool write_pattern_file(char *tmpfile, int tmpfile_sz, const char *pattern) {
5082 snprintf(tmpfile, tmpfile_sz, "%s/cbm_search_%d.pat", cbm_tmpdir(), (int)getpid());
5083 FILE *tf = fopen(tmpfile, "w");
5084 if (!tf) {
5085 return false;
5086 }
5087 (void)fprintf(tf, "%s\n", pattern);
5088 (void)fclose(tf);
5089 return true;
5090}
5091
5092/* Compile a path filter regex. Returns true if compiled successfully. */
5093static bool compile_path_filter(const char *filter, cbm_regex_t *re) {

Callers 1

handle_search_codeFunction · 0.85

Calls 1

cbm_tmpdirFunction · 0.85

Tested by

no test coverage detected