2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.1 1994-09-26 16:08:00 quinn
8 * Most of the functionality in place.
13 * Read and write the blocktype header.
19 int is_rb_write(isam_blocktype *ib, is_type_header *hd)
21 int pt = 0, ct = 0, towrite;
23 while ((towrite = sizeof(*hd) - pt) > 0)
25 if (towrite > bf_blocksize(ib->bf))
26 towrite = bf_blocksize(ib->bf);
27 if (bf_write(ib->bf, ct, 0, towrite, (char *)hd + pt) < 0)
29 pt += bf_blocksize(ib->bf);
35 int is_rb_read(isam_blocktype *ib, is_type_header *hd)
37 int pt = 0, ct = 0, rs, toread;
39 while ((toread = sizeof(*hd) - pt) > 0)
41 if (toread > bf_blocksize(ib->bf))
42 toread = bf_blocksize(ib->bf);
43 if ((rs = bf_read(ib->bf, ct, 0, toread, (char*)hd + pt)) <= 0)
45 pt += bf_blocksize(ib->bf);