Write pattern to a temp file for grep -f. Returns true on success. */
| 5079 | |
| 5080 | /* Write pattern to a temp file for grep -f. Returns true on success. */ |
| 5081 | static 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. */ |
| 5093 | static bool compile_path_filter(const char *filter, cbm_regex_t *re) { |
no test coverage detected