1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #include <dos.h>
24 #include <alloc.h>
25 #include <cat.h>
26 #include <ws_dcls.h>
27 #include <ws_error.h>
28 #include <ws_msg.h>
29 #include <ws_fgb.h>
30 #include <wsmincap.h>
31
32 #define NULL 0
33
34 extern struct fgbstr *bgbfptr;
35 extern struct fgbstr *bgblptr;
36 extern struct fgbstr *sgbfptr;
37 extern struct fgbstr *sgblptr;
38 extern struct allocstr *bgaptr;
39 extern int bgcount;
40
41 i_getbgm (p_param)
42
43 struct gbgmsg_struc *p_param;
44 {
45 int i;
46 char *s1;
47 char *d1;
48 struct fgbstr *bgbp;
49 struct query_msg *qrp;
50
51
52
53
54
55 if (p_param -> bg_type == STATUS_REPLY) {
56 if (sgbfptr == NULL) {
57 sgblptr = NULL;
58 return (WSNOMESS);
59 }
60
61 bgbp = sgbfptr;
62 sgbfptr = bgbp -> fgb_next;
63 if (sgbfptr == NULL)
64 sgblptr = NULL;
65 }
66
67
68
69
70
71 else {
72 if (bgbfptr == NULL) {
73 bgcount = 0;
74 bgblptr = NULL;
75 return (WSNOMESS);
76 }
77
78 bgbp = bgbfptr;
79 bgbfptr = bgbp -> fgb_next;
80 --bgcount;
81 if (bgbfptr == NULL) {
82 bgcount = 0;
83 bgblptr = NULL;
84 }
85 }
86
87
88
89 p_param -> length = bgbp -> fgb_length - 2;
90 qrp = (struct query_msg *) &bgbp -> fgb_minor;
91 d1 = &p_param -> bgmsg[0];
92 s1 = &qrp -> msg_data[0];
93 for(i = 0; i < p_param -> length; i++)
94 *d1++ = *s1++;
95
96
97
98 c_pack (qrp -> source_system, qrp -> source_major, &p_param -> sender_major);
99 p_param -> bg_type = (int) bgbp -> fgb_minor;
100
101
102
103 wsfree(bgaptr,bgbp);
104
105 return(0);
106 }
107 ^Z