Exemple #1
0
static knetFile *kuOpen(const char *filename, const char *mode)
/* Open the given filename with mode which must be "r". */
{
if (!sameOk((char *)mode, "r"))
    errAbort("mode passed to kuOpen must be 'r' not '%s'", mode);
struct udcFile *udcf = udcFileMayOpen((char *)filename, udcCacheDir);
if (udcf == NULL)
    return NULL;
knetFile *kf = NULL;
AllocVar(kf);
kf->udcf = udcf;
verbose(2, "kuOpen: returning %lu\n", (unsigned long)(kf->udcf));
return kf;
}
static void checkWibFile(struct annoStreamWig *self, char *wibFile)
/* If self doesn't have a .wib file name and handle open, or if the new wibFile is
 * not the same as the old one, update self to use new wibFile. */
{
char *realWibFile = hReplaceGbdb(wibFile);
if (self->wibFile == NULL || !sameString(self->wibFile, realWibFile))
    {
    udcFileClose(&self->wibFH);
    freeMem(self->wibFile);
    self->wibFile = cloneString(realWibFile);
    self->wibFH = udcFileMayOpen(self->wibFile, NULL);
    if (self->wibFH == NULL)
        errAbort("annoStreamWig: udc can't open wibFile '%s'", self->wibFile);
    }
freeMem(realWibFile);
}