1 /* ***********************************************************
 2    *                                                         *
 3    * Copyright, (C) Honeywell Bull Inc., 1987                *
 4    *                                                         *
 5    * Copyright, (C) Honeywell Information Systems Inc., 1986 *
 6    *                                                         *
 7    *********************************************************** */
 8 
 9 /* HISTORY COMMENTS:
10   1) change(86-04-26,Westcott), approve(87-07-13,MCR7580),
11      audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
12      Created.
13                                                    END HISTORY COMMENTS */
14 /* : PROCEDURE FUNCTION (puttdata)
15 
16 Sends a data string to the Multics user i/o switch over the foreground channel.
17 */
18 
19 #include <dos.h>
20 #include <ws.h>
21 #include <ws_dcls.h>
22 #include <ws_func.h>
23 #include <wsmincap.h>
24 
25 #define LOW_BYTE   0x00FF
26 
27 puttdata (p_min_cap, p_buffer_ptr, p_buffer_len)
28 
29 int  p_min_cap;                        /* Minor capability of foreground data */
30 char *p_buffer_ptr;                    /* Pointer to data to be sent */
31 int p_buffer_len;                      /* Length of data to send */
32 {
33 struct putt_struc ps;
34 int  error_code;
35 int  length;
36 int  i;
37 char *sp;
38 
39 
40 /* : if minor cap is FG_BREAK, then no data and call mowse */
41 
42    if (p_min_cap == FG_BREAK)
43       return (call_mowse_int (I$FOREBREAK, 0, 0));
44 
45 /* : If minor cap is 125-127, then submit a request to turn on the appropriate
46      debug packet switch */
47 
48    if ((p_min_cap & LOW_BYTE) >= 125)
49       return (call_mowse_int (8, &p_min_cap, 2));
50 
51 /* : call user_interrupt to put data */
52 
53    ps.minor_cap = p_min_cap;
54 
55 /* : while (string length > 0) send data in packet size chunks */
56 
57    while (p_buffer_len > 0)
58    {  if (p_buffer_len > WSPAKSIZ)
59          length = WSPAKSIZ;
60       else
61          length = p_buffer_len;
62 
63       sp = &ps.putstr[0];
64       for (i=0; i < length; i++)
65       {  *sp++ = *p_buffer_ptr++;
66       }
67 
68 /* : - send  packet to mowse */
69 
70       ps.putstrl = length;
71       error_code = call_mowse_int (I$PUTTDATA,&ps ,sizeof(ps));
72       p_buffer_len -= length;
73    }
74 
75    return(error_code);
76 }
77 ^Z