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-04,ASmith), 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 /* : PROCEDURE FUNCTION (execom)
16 
17 Performs the execution of a command on either the remote or local systems.
18 */
19 
20 #include <stdio.h>
21 #include <ws.h>
22 #include <ws_mcb.h>
23 #include <ws_error.h>
24 #include <ws_func.h>
25 #include <ws_dcls.h>
26 
27 extern char local_system;
28 
29 execom (p_command, p_ws_system, p_cmd_id, p_mcb_ptr)
30 
31 char *p_command;                       /* Command to execute */
32 int p_ws_system;                       /* System to execute on */
33 unsigned *p_cmd_id;                    /* Command id */
34 mcb *p_mcb_ptr;                        /* Caller's MCB */
35 {
36 struct execom_struc param;
37 
38 
39    if ((p_ws_system != WSLOCAL) && (p_ws_system != WSREMOTE))
40       return(WSINVSYS);
41 
42    if (p_mcb_ptr == NULL)
43       return(WSINVMCB);
44 
45    param.com_len = strlen(p_command);
46    if (param.com_len > WSPAKSIZ)
47       return (WSINVBUF);
48    strcpy(&param.command[0],p_command);
49 
50    if (p_ws_system == WSLOCAL)
51       p_ws_system = local_system;
52    else if (p_ws_system == WSREMOTE)
53       p_ws_system = WSMULTICS;
54 
55    param.system = p_ws_system;
56    param.major = p_mcb_ptr->major_capability;
57 
58    call_mowse_int(I$EXECOM,&param,sizeof(param));
59 
60 /* : Return p_command id and status */
61 
62    *p_cmd_id = param.cmd_id;
63    return(param.status);
64 }
65 ^Z