1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 #include <stdio.h>
26 #include <dos.h>
27 #include <ws.h>
28 #include <alloc.h>
29 #include <ws_error.h>
30 #include <ws_msg.h>
31 #include <ws_fgb.h>
32 #include <cat.h>
33 #include <wsmincap.h>
34
35 extern struct allocstr *lcaptr;
36 extern struct fgbstr *lcbfptr,
37 *lcblptr;
38 extern char mysystem;
39 extern local_cat l_CAT[];
40 extern remote_cat r_CAT[];
41
42 send_i_mess (p_message,p_message_len,p_data,p_data_len)
43
44 struct input_msg *p_message;
45 int p_message_len;
46 char *p_data;
47 int p_data_len;
48 {
49 char *flags;
50 char header[6];
51 char *data_ptrs[2];
52 int data_lens[2];
53 int major;
54 int error;
55 int total_len;
56 int i;
57 char *c1;
58 char *c2;
59 struct fgbstr *bufp;
60 struct fgbstr *lcbp1;
61
62 char *wsalloc();
63
64
65
66
67
68 major = (int) (p_message -> major) - MIN_CAPABILITY_NUMBER;
69 if ((major < 0) || (major > NUMBER_OF_CAT_ENTRIES))
70 { if (p_message -> major != WSMAJCAP)
71 return (WSINVNUM);
72 flags = NULL;
73 }
74 else if (p_message -> system == mysystem)
75 { if (!l_CAT[major].mcb_ptr)
76 return (WSINVNUM);
77 flags = &(l_CAT[major].flags);
78 }
79 else
80 { if (!r_CAT[major].major_capability)
81 return (WSINVNUM);
82 flags = &(r_CAT[major].flags);
83 }
84
85
86
87 if (flags)
88 { if ((*flags & (SUSPENDED_BIT | RESET_BIT))
89 && (p_message -> minor != TERMINATE_APPLICATION)
90 && (p_message -> minor != RESUME_APPLICATION)
91 && (p_message -> minor != SUSPEND_APPLICATION)
92 && (p_message -> minor != RESET_APPLICATION)
93 && (p_message -> minor != FAIL_CAPABILITY))
94 {
95 return (WSSUSPND);
96 }
97 }
98
99
100
101 if (p_message -> system == mysystem) {
102 total_len = p_message_len + p_data_len;
103 bufp = (struct fgbstr *)wsalloc (lcaptr,total_len+sizeof(struct fgbstr));
104
105
106
107 if (bufp != NULL) {
108 c1 = (char *) p_message;
109 c2 = &bufp -> fgb_char[0];
110 for (i = 0;i < p_message_len;i++) {
111 *c2++ = *c1++;
112 }
113 c1 = p_data;
114 for (i = 0;i < p_data_len;i++) {
115 *c2++ = *c1++;
116 }
117 bufp -> fgb_length = total_len;
118
119
120
121 bufp -> fgb_next = NULL;
122 if (lcbfptr == NULL) {
123 lcbfptr = bufp;
124 lcblptr = bufp;
125 }
126 else {
127 lcbp1 = lcblptr;
128 lcbp1 -> fgb_next = bufp;
129 lcblptr = bufp;
130 }
131 return(0);
132 }
133 return(WSBUFOVR);
134 }
135
136
137
138 else {
139 data_ptrs[0] = (char *) p_message;
140 data_lens[0] = p_message_len;
141 data_ptrs[1] = p_data;
142 data_lens[1] = p_data_len;
143
144
145 while (snddat (BG, 2 ,&data_ptrs,&data_lens) == 1);
146
147
148
149
150
151 if (error == -1)
152 return (WSBUFOVR);
153 return(0);
154 }
155 }
156 ^Z