1: #include "old.h"
2:
3: bookm()
4: {
5: int i, buf[2];
6:
7: if(!bookp) return(0);
8: lseek(bookf, (long)(unsigned)bookp, 0);
9:
10: i = 0;
11: loop:
12: read(bookf, buf, 4);
13: *buf = booki(*buf);
14: if(*buf >= 0) {
15: if(!i)
16: i = *buf;
17: goto loop;
18: }
19: if(abmove = i)
20: return(1);
21: return(0);
22: }
23:
24: makmov(m)
25: {
26: int buf[2];
27:
28: out1(m);
29: mantom? bmove(m): wmove(m);
30: increm();
31: if(!bookp) return;
32: lseek(bookf, (long)(unsigned)bookp, 0);
33:
34: loop:
35: read(bookf, buf, 4);
36: *buf = booki(*buf);
37: if(m == *buf || *buf == 0) {
38: bookp = buf[1] & ~1;
39: goto l1;
40: }
41: if(*buf < 0) {
42: bookp = 0;
43: goto l1;
44: }
45: goto loop;
46:
47: l1:
48: if(!bookp) {
49: putchar('\n');
50: return;
51: }
52: }
53:
54: booki(m)
55: {
56: union {
57: int l;
58: char m[2];
59: } i, j;
60:
61: j.l = m;
62:
63: i.m[0] = j.m[1];
64: i.m[1] = j.m[0];
65:
66: return(i.l);
67: }
Defined functions
booki
defined in line
54; used 2 times
bookm
defined in line
3; used 1 times