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

Function open

Common/Uncompress.cpp:189–212  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

187 * uncompresses it.
188 */
189int open(const char *path, int flags, mode_t mode)
190{
191 static open_t real_open;
192 if (real_open == NULL)
193 real_open = (open_t)dlsym(RTLD_NEXT, "open");
194 if (real_open == NULL) {
195 fprintf(stderr, "error: dlsym open: %s\n", dlerror());
196 exit(EXIT_FAILURE);
197 }
198
199 // open a web address
200 if (wgetExec(path) != NULL)
201 return uncompress(path);
202
203 // to check if the file exists, we need to attempt to open it
204 int filedesc = real_open(path, flags, mode);
205 if (mode != ios_base::in || filedesc < 0
206 || zcatExec(path) == NULL)
207 return filedesc;
208 else {
209 close(filedesc);
210 return uncompress(path);
211 }
212}
213
214} // extern "C"
215

Callers

nothing calls this directly

Calls 3

wgetExecFunction · 0.85
uncompressFunction · 0.85
zcatExecFunction · 0.85

Tested by

no test coverage detected