1: # include "../ingres.h" 2: # include "../aux.h" 3: # include "../symbol.h" 4: # include "../access.h" 5: # include "../batch.h" 6: 7: 8: wrbatch(cp, count) 9: char *cp; 10: int count; 11: { 12: register char *c; 13: register int size, cnt; 14: 15: cnt = count; 16: c = cp; 17: # ifdef xATR1 18: if (tTf(89, 8)) 19: printf("wrbatch:%d (%d)\n", cnt, Batch_cnt); 20: # endif 21: 22: while (cnt) 23: { 24: Batch_dirty = TRUE; /* mark this buffer as dirty */ 25: if (cnt + Batch_cnt > BATCHSIZE) 26: size = BATCHSIZE - Batch_cnt; 27: else 28: size = cnt; 29: bmove(c, &Batchbuf.bbuf[Batch_cnt], size); 30: c += size; 31: Batch_cnt += size; 32: cnt -= size; 33: if (Batch_cnt == BATCHSIZE) 34: flushbatch(); 35: } 36: } 37: 38: 39: flushbatch() 40: { 41: register int i; 42: if (Batch_cnt) 43: { 44: # ifdef xATR1 45: if (tTf(89, 9)) 46: printf("flushing %d\n", Batch_cnt + IDSIZE); 47: # endif 48: if ((i = write(Batch_fp, &Batchbuf, Batch_cnt + IDSIZE)) != Batch_cnt + IDSIZE) 49: syserr("flushbatch:can't write %d", i); 50: Batch_cnt = 0; 51: } 52: }