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-08-28,Smith), approve(87-07-15,MCR7580),
 11      audit(87-07-30,RBarstad), install(87-08-07,MR12.1-1075):
 12      Created.
 13   2) change(86-11-27,Flegel), approve(86-11-27,MCR7580),
 14      audit(87-07-30,RBarstad), install(87-08-07,MR12.1-1075):
 15      Approved.
 16   3) change(86-12-10,Flegel), approve(86-12-10,MCR7580),
 17      audit(87-07-30,RBarstad), install(87-08-07,MR12.1-1075):
 18      Replaced signalling of mowse_fatal_error with a call to fatal_mowse_trap_.
 19                                                    END HISTORY COMMENTS */
 20 /* format: style4,indattr,ifthen,^indcomtxt,thendo,^indproc,^indblkcom,initcol1,declareind8,dclind4,struclvlind3,comcol55 */
 21 execom_:
 22      proc (p_mcb_ptr, p_com_len, p_command, p_cmd_id, p_system,
 23           p_major_cap, p_ecode);
 24 
 25 /* : PROGRAM FUNCTION
 26 
 27 Handles EXECUTE_COMMAND messages sent to internal mowse from some system.
 28 */
 29 
 30 /* : NOTES
 31 */
 32 
 33 
 34 /* INPUT PARAMETERS */
 35 dcl p_mcb_ptr              ptr parameter;             /* mowse mcb pointer */
 36 dcl p_com_len              fixed bin parameter;       /* length of command */
 37 dcl p_command              char (*) parameter;        /* command to be executed */
 38 dcl p_cmd_id               fixed bin parameter;       /* unique command id */
 39 dcl p_system               fixed bin parameter;       /* MOWSE system */
 40 dcl p_major_cap            fixed bin parameter;       /* major capability number (index into CAT tables) */
 41 
 42 
 43 /* OUTPUT PARAMETERS */
 44 dcl p_ecode                fixed bin (35);            /* return code */
 45 
 46 
 47 /* MISC VARIABLES */
 48 dcl return_status          fixed bin;                 /* status to be returned in reply message */
 49 dcl dest_maj               fixed bin;                 /* destination major capability */
 50 
 51 
 52 /* STRUCTURES */
 53 dcl 01 data,
 54        02 cmd_id           fixed bin (17) unal,
 55        02 status           char unal;
 56 
 57 
 58 /* SYSTEM CALLS */
 59 dcl send_msg_              entry (ptr, fixed bin, fixed bin, ptr,
 60                            fixed bin, fixed bin, fixed bin (35));
 61 dcl capability_$pack       entry (fixed bin, fixed bin, fixed bin,
 62                            fixed bin (35));
 63 dcl cu_$cp                 entry (ptr, fixed bin (21), fixed bin (35));
 64 
 65 /* EXTERNAL CALLS */
 66 dcl fatal_mowse_trap_      entry (fixed bin (35));
 67 
 68 /* EXTERNAL CALL SUPPORT */
 69 
 70 /* BUILTINS */
 71 dcl addr                   builtin;
 72 dcl byte                   builtin;
 73 dcl length                 builtin;
 74 
 75 /* CONDITIONS */
 76 dcl cleanup                condition;
 77 
 78 
 79 /*^L*/
 80 /* INITIALIZATION */
 81           p_ecode = 0;
 82 
 83           on cleanup
 84                begin;
 85                data.cmd_id = p_cmd_id;
 86                data.status = byte (STATUS_FAILED);
 87                call send_msg_ (p_mcb_ptr, dest_maj, EXECUTE_COMMAND_REPLY,
 88                     addr (data), 3, BG, p_ecode);
 89                if p_ecode ^= 0 then do;
 90                     call fatal_mowse_trap_ (p_ecode);
 91                     goto ERROR_RETURN;
 92                end;
 93           end;
 94 
 95 /* MAIN */
 96 
 97 /* : Evaluate destination major first in case we blow up */
 98 
 99           call capability_$pack (p_system, p_major_cap, dest_maj, p_ecode);
100           if p_ecode ^= 0 then do;
101                call fatal_mowse_trap_ (p_ecode);
102                return;
103           end;
104 
105 /* : Execute command */
106 
107           call cu_$cp (addr (p_command), length (p_command), p_ecode);
108 
109 /* : if execution fails then
110      - send a EXECUTE_COMMAND_REPLY message with the status = STAUS_FAILED
111      - else send one with STATUS_SUCCESS.*/
112 
113           if p_ecode ^= 0 then
114                return_status = STATUS_FAILED;
115           else
116                return_status = STATUS_SUCCESS;
117 
118           data.cmd_id = p_cmd_id;
119           data.status = byte (return_status);
120 
121           call send_msg_ (p_mcb_ptr, dest_maj, EXECUTE_COMMAND_REPLY,
122                addr (data), 3, BG, p_ecode);
123           if (p_ecode ^= 0) then do;
124                call fatal_mowse_trap_ (p_ecode);
125                return;
126           end;
127 
128           return;
129 
130 ERROR_RETURN:
131           return;
132 
133 %page;
134 /* INCLUDE FILES */
135 %include mowse;
136 %include mowse_messages;
137 
138 /* : END */
139      end;