1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include "dos.h"
25 #include "stdio.h"
26 #include "ws.h"
27 #include "alloc.h"
28 #include "cat.h"
29 #include "ws_fgb.h"
30 #include "ws_buf.h"
31 #include "ws_msg.h"
32 #include "wsmincap.h"
33 #include "ws_error.h"
34
35 extern struct fgbstr *fgbfptr;
36 extern struct fgbstr *fgblptr;
37 extern struct fgbstr *bgbfptr;
38 extern struct fgbstr *bgblptr;
39 extern struct fgbstr *sgbfptr;
40 extern struct fgbstr *sgblptr;
41 extern struct allocstr *fgaptr;
42 extern struct allocstr *bgaptr;
43 extern int bgcount;
44
45 rcvfgdat (p_fg_buff_ptr)
46 struct bstruc *p_fg_buff_ptr;
47 {
48 int i;
49 int length;
50 struct fgbstr *bufp;
51 char *p1;
52 char *f1;
53
54
55 int rcvmsg();
56 char *wsalloc();
57
58
59
60 if (p_fg_buff_ptr -> bin == p_fg_buff_ptr -> bout)
61 return (0);
62
63
64 length = p_fg_buff_ptr -> bin - p_fg_buff_ptr -> bout;
65 if (length < 0)
66 length += p_fg_buff_ptr ->bsize;
67
68 if (length >WSMINBUF)
69 length = WSMINBUF;
70
71 if ((p_fg_buff_ptr -> bminor == BG_MESSAGE)
72 || (p_fg_buff_ptr -> bminor == BG_QUERY)
73 || (p_fg_buff_ptr -> bminor == STATUS_REPLY))
74 {
75 bufp = (struct fgbstr *) wsalloc (bgaptr,length + sizeof(struct fgbstr));
76 }
77 else
78 bufp = (struct fgbstr *) wsalloc (fgaptr,length + sizeof(struct fgbstr));
79
80
81 if (bufp == NULL)
82 return (0);
83
84
85 p1 = &bufp->fgb_minor;
86 *p1++ = p_fg_buff_ptr -> bminor;
87 f1 = p_fg_buff_ptr -> bout;
88
89 for (i = 0; i < length; i++)
90 { *p1++ = *f1++;
91 if (f1 > p_fg_buff_ptr -> blast)
92 f1 = p_fg_buff_ptr -> bfirst;
93 }
94
95 p_fg_buff_ptr -> bout = f1;
96 bufp->fgb_length = length;
97 bufp->fgb_next = NULL;
98
99
100 if ((p_fg_buff_ptr -> bminor == BG_MESSAGE)
101 || (p_fg_buff_ptr -> bminor == BG_QUERY))
102 { if (bgbfptr == NULL)
103 bgcount = 1;
104 else
105 bgcount++;
106 rcvmsg (bufp, &bgbfptr, &bgblptr);
107 }
108 else if (p_fg_buff_ptr -> bminor == STATUS_REPLY)
109 rcvmsg (bufp, &sgbfptr, &sgblptr);
110
111
112 else
113 rcvmsg (bufp, &fgbfptr, &fgblptr);
114 }
115 ^Z