X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=bfile%2Fbfile.c;h=7b6580952d63a3eaa7e15db1628fb3c1181d3ab5;hb=ae5e5891ad52a6e7c1717afe5954039538f81236;hp=dd10b4fd868cd178c02ebff81005f2259c974b9b;hpb=83f7d8e05b21112744575aece533b2bc62610f2a;p=idzebra-moved-to-github.git diff --git a/bfile/bfile.c b/bfile/bfile.c index dd10b4f..7b65809 100644 --- a/bfile/bfile.c +++ b/bfile/bfile.c @@ -4,7 +4,16 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: bfile.c,v $ - * Revision 1.8 1994-08-23 15:03:34 quinn + * Revision 1.11 1995-09-04 12:33:21 adam + * Various cleanup. YAZ util used instead. + * + * Revision 1.10 1994/08/25 10:15:54 quinn + * Trivial + * + * Revision 1.9 1994/08/24 08:45:48 quinn + * Using mfile. + * + * Revision 1.8 1994/08/23 15:03:34 quinn * *** empty log message *** * * Revision 1.7 1994/08/23 14:25:45 quinn @@ -27,16 +36,18 @@ * */ -#include -#include +#include #include #include #include #include +#include +#include + int bf_close (BFile bf) { - close(bf->fd); + mf_close(bf->mf); xfree(bf); return(0); } @@ -45,23 +56,20 @@ BFile bf_open (const char *name, int block_size, int wflag) { BFile tmp = xmalloc(sizeof(BFile_struct)); - if ((tmp->fd = open(name, wflag ? O_RDWR|O_CREAT : O_RDONLY, 0666)) < 0) + if (!(tmp->mf = mf_open(0, name, block_size, wflag))) { - log(LOG_FATAL|LOG_ERRNO, "open %s", name); + logf (LOG_FATAL, "Mfopen failed for %s", name); return(0); } - tmp->block_size = block_size; return(tmp); } int bf_read (BFile bf, int no, int offset, int num, void *buf) { - lseek(bf->fd, no * bf->block_size + offset, 0); - return(read(bf->fd, buf, num ? num : bf->block_size)); + return mf_read(bf->mf, no, offset, num, buf); } int bf_write (BFile bf, int no, int offset, int num, const void *buf) { - lseek(bf->fd, no * bf->block_size + offset, 0); - return(write(bf->fd, buf, num ? num : bf->block_size)); + return mf_write(bf->mf, no, offset, num, buf); }