int gt_file_xread(GtFile *file, void *buf, size_t nbytes) { int rval = -1; if (file) { switch (file->mode) { case GT_FILE_MODE_UNCOMPRESSED: rval = gt_xfread(buf, 1, nbytes, file->fileptr.file); break; case GT_FILE_MODE_GZIP: rval = gt_xgzread(file->fileptr.gzfile, buf, nbytes); break; case GT_FILE_MODE_BZIP2: rval = gt_xbzread(file->fileptr.bzfile, buf, nbytes); break; default: gt_assert(0); } } else rval = gt_xfread(buf, 1, nbytes, stdin); return rval; }
int gt_xbzfgetc(BZFILE *bzfile) { char c; return gt_xbzread(bzfile, &c, 1) ? c : EOF; }