|
|
1.1 root 1: # include <ingres.h>
2: # include <aux.h>
3: # include <symbol.h>
4: # include <access.h>
5: # include <batch.h>
6: # include <sccs.h>
7:
8: SCCSID(@(#)writebatch.c 8.1 12/31/84)
9:
10: /*
11: ** WRBATCH -- write batch file
12: */
13:
14: wrbatch(cp, count)
15: char *cp;
16: int count;
17: {
18: register char *c;
19: register int size, cnt;
20:
21: cnt = count;
22: c = cp;
23: # ifdef xATR1
24: if (tTf(25, 8))
25: printf("wrbatch:%d (%d)\n", cnt, Batch_cnt);
26: # endif
27:
28: while (cnt)
29: {
30: Batch_dirty = TRUE; /* mark this buffer as dirty */
31: if (cnt + Batch_cnt > BATCHSIZE)
32: size = BATCHSIZE - Batch_cnt;
33: else
34: size = cnt;
35: bmove(c, &Batchbuf.bbuf[Batch_cnt], size);
36: c += size;
37: Batch_cnt += size;
38: cnt -= size;
39: if (Batch_cnt == BATCHSIZE)
40: flushbatch();
41: }
42: }
43: /*
44: ** FLUSHBATCH -- flush batch file
45: */
46:
47: flushbatch()
48: {
49: register int i;
50:
51: if (Batch_cnt)
52: {
53: # ifdef xATR1
54: if (tTf(25, 9))
55: printf("flushing %d\n", Batch_cnt + IDSIZE);
56: # endif
57: if ((i = write(Batch_fp, &Batchbuf, Batch_cnt + IDSIZE)) != Batch_cnt + IDSIZE)
58: syserr("flushbatch:can't write %d", i);
59: Batch_cnt = 0;
60: }
61: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.