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-07-06,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 
15 
16 /* : PROCEDURE FUNCTION (getbgmes)
17 
18 Retrieves a background message from the MOWSE background message queue.
19 A background message is one which is sent to the foreground application by
20 a background application.  There are two types of background messages, those
21 that do require a response (WSINFO), and those that require a response
22 (WSQUERY) from the foreground application.
23 */
24 
25 #include <dos.h>
26 #include <ws.h>
27 #include <ws_dcls.h>
28 #include <ws_func.h>
29 
30 getbgmes (p_string, p_type, p_sender_major)
31 
32 char *p_string;                        /* Message */
33 int *p_type;                           /* Type of message */
34 int *p_sender_major;                   /* Sender of message */
35 {
36 int code;
37 int i;
38 char *c1;
39 char *c2;
40 struct gbgmsg_struc gbgmsgs;
41 
42 /* : call user_interrupt to get data returning on any errors */
43 
44    gbgmsgs.bg_type = 0;  /* ask for any background message, except status */
45    code = call_mowse_int (I$GETBGMES,&gbgmsgs,sizeof(gbgmsgs));
46    if (code)
47       return (code);
48 
49 /* : copy the message into the caller's buffer and
50      set the last position in buffer to null. */
51 
52    c1 = &gbgmsgs.bgmsg[0];
53    c2 = p_string;
54    for (i= 0; i<gbgmsgs.length; i++)
55       *c2++ = *c1++;
56 
57    *c2 = '\0';
58 
59 /* : return the message type and sender major to the caller */
60 
61    *p_type = gbgmsgs.bg_type;
62    *p_sender_major = gbgmsgs.sender_major;
63 
64    return(0);
65 }
66 ^Z