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-06-06,Westcott), approve(87-07-13,MCR7580),
11      audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
12      Created.
13   2) change(86-10-21,ASmith), approve(87-07-13,MCR7580),
14      audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
15      Changed format to connect to a name rather than
16      a number and to supply args to the connect.
17   3) change(86-10-29,Flegel), approve(87-07-13,MCR7580),
18      audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
19      Reduced to generate a message to the internal
20      MOWSE function to handle connect request.
21                                                    END HISTORY COMMENTS */
22 
23 /* : PROCEDURE FUNCTION (conrqst)
24 
25 Send a REQUEST_CONNECT minor capability to the application specified.  If the
26 application does not exist, it will be created through an execom with the
27 name provided and the args specified.  The REQUEST_CONNECT message will then
28 be generated if the name became active (CAT).
29 */
30 
31 #include <dos.h>
32 #include <cat.h>
33 #include <stdio.h>
34 #include <ws_func.h>
35 #include <wsmincap.h>
36 #include <ws_error.h>
37 #include <ws_dcls.h>
38 
39 #define HEADER_LENGTH 4
40 
41 conrqst(p_cap_name,p_args,p_system,p_mcb_ptr)
42 
43 char p_cap_name[];                     /* Name of capability to connect ot */
44 char p_args[];                         /* Argument string */
45 int  p_system;                         /* System of capability to connect to */
46 mcb  *p_mcb_ptr;                       /* MCB of caller */
47 {
48 int  system;
49 int  length;
50 struct i_connect_request xparam;
51 
52 /* : Check system value */
53 
54    if (p_system == WSLOCAL)
55       system = WSIBMPC;
56    else if (p_system == WSREMOTE)
57       system = WSMULTICS;
58    else
59       return(WSINVSYS);
60 
61 /* : Check mcb_ptr */
62 
63    if (p_mcb_ptr == NULL)
64       return(WSINVMCB);
65 
66 /*  : set up parameters to be passed to user interrupt handler */
67 
68    xparam.system        = system;
69    xparam.source_system = p_mcb_ptr->system_id;
70    xparam.source_major  = p_mcb_ptr->major_capability;
71    sprintf (xparam.connect_command, "%.32s %s", p_cap_name, p_args);
72    length = strlen (xparam.connect_command) + HEADER_LENGTH;
73 
74 /* : generate user interrupt */
75 
76    return (call_mowse_int (I$CONNECT,&xparam,length));
77 }
78 ^Z