MCPcopy Create free account
hub / github.com/BirolLab/abyss / fopen

Function fopen

Common/Uncompress.cpp:133–155  ·  view source on GitHub ↗

If the specified file is compressed, return a pipe that * uncompresses it. */

Source from the content-addressed store, hash-verified

131 * uncompresses it.
132 */
133FILE *fopen(const char *path, const char *mode)
134{
135 static fopen_t real_fopen;
136 if (real_fopen == NULL)
137 real_fopen = (fopen_t)dlsym(RTLD_NEXT, "fopen");
138 if (real_fopen == NULL) {
139 fprintf(stderr, "error: dlsym fopen: %s\n", dlerror());
140 exit(EXIT_FAILURE);
141 }
142
143 // open a web address
144 if (wgetExec(path) != NULL)
145 return funcompress(path);
146
147 // to check if the file exists, we need to attempt to open it
148 FILE* stream = real_fopen(path, mode);
149 if (string(mode) != "r" || !stream || zcatExec(path) == NULL)
150 return stream;
151 else {
152 fclose(stream);
153 return funcompress(path);
154 }
155}
156
157/** If the specified file is compressed, return a pipe that
158 * uncompresses it.

Callers 10

read_scr_matrixFunction · 0.85
read_diag_prob_distFunction · 0.85
read_fastaFunction · 0.85
read_anchorsFunction · 0.85
print_pdist_matrixFunction · 0.85
storeMethod · 0.85
loadMethod · 0.85
FastaWriterMethod · 0.85

Calls 3

wgetExecFunction · 0.85
funcompressFunction · 0.85
zcatExecFunction · 0.85

Tested by

no test coverage detected