2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.2 1995-09-04 12:33:47 adam
8 * Various cleanup. YAZ util used instead.
10 * Revision 1.1 1994/09/26 16:08:00 quinn
11 * Most of the functionality in place.
16 * Read and write the blocktype header.
23 int is_rb_write(isam_blocktype *ib, is_type_header *hd)
25 int pt = 0, ct = 0, towrite;
27 while ((towrite = sizeof(*hd) - pt) > 0)
29 if (towrite > bf_blocksize(ib->bf))
30 towrite = bf_blocksize(ib->bf);
31 if (bf_write(ib->bf, ct, 0, towrite, (char *)hd + pt) < 0)
33 pt += bf_blocksize(ib->bf);
39 int is_rb_read(isam_blocktype *ib, is_type_header *hd)
41 int pt = 0, ct = 0, rs, toread;
43 while ((toread = sizeof(*hd) - pt) > 0)
45 if (toread > bf_blocksize(ib->bf))
46 toread = bf_blocksize(ib->bf);
47 if ((rs = bf_read(ib->bf, ct, 0, toread, (char*)hd + pt)) <= 0)
49 pt += bf_blocksize(ib->bf);