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-10-10,Flegel), 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
16 
17 Perform the autoload of all specified capabilities, capabilities are specified
18 for autoload through the /L option to the MOWSE command.  These are destined
19 to be executed when MOWSE has entered packet mode.
20 */
21 
22 /* : NOTES
23 
24 The capabilities specified must be in the PC PATH search list.
25 */
26 
27 #include <stdio.h>
28 #include <ws.h>
29 #include <ws_auto.h>
30 #include <ws_dcls.h>
31 
32 #define CHAR_SHIFT   8
33 
34 AUTO   load_list[AUTO_LIMIT];          /* List of capabilities to be loaded */
35 int    load_list_pending;              /* Indicates load list is not empty */
36 
37 int autoload ()
38 {
39 int    i;
40 int    error;
41 struct putbg_struc error_msg;          /* Error message struct for reporting */
42 
43    error_msg.type = WSINFO;
44    error_msg.sender_major =(int)(((int)WSIBMPC << CHAR_SHIFT) | (int)WSMAJCAP);
45 
46    for (i = 0; (i < AUTO_LIMIT) && (load_list[i].flags & AUTO_ON); i++)
47    {  set_dta();                       /* use Mowse's DTA */
48       set_trap();                      /* use MOWSE's trap rotuines */
49       error = system(load_list[i].name);
50       rst_trap();
51       rst_dta();
52 
53       if (error)
54          sprintf (error_msg.bgmsg, "autoload: %s failed.\n", load_list[i].name);
55       else
56          sprintf (error_msg.bgmsg, "autoload: %s attempted.\n", load_list[i].name);
57 
58 /* : Send a background message to indicate what has happened */
59 
60       error_msg.length = strlen (error_msg.bgmsg);
61       i_putbgm (&error_msg);
62    }
63 }