1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 #include <stdio.h>
31 #include <ws_error.h>
32 #include <ws_func.h>
33
34 #define EXTRA_ARG -1
35 #define BAD_ARG -2
36
37 #define TIME_OUT 1
38 #define DISCONNECT_OUT 2
39
40 #define FORCE 0x01
41
42 main (argc, argv)
43
44 int argc;
45 char *argv[];
46 {
47 int code;
48 int i;
49 char flag;
50
51
52
53
54
55 for (i = 1, code = 0, flag = 0; (i < argc) && (!code); i++)
56 { if (argv[i][0] != '/')
57 code = BAD_ARG;
58 else switch (argv[i][1])
59 {
60 case 'F': case 'f':
61 if (argv[i][2])
62 code = BAD_ARG;
63 else
64 flag |= FORCE;
65 break;
66
67 default:
68 code = BAD_ARG;
69 break;
70 }
71 }
72
73
74
75 if (!code)
76 { printf ("EXITMOWS ...");
77 while ((code = call_mowse_int (I$DISCONNECT, &flag, 1)) == WSDISPEN);
78 if (code == DISCONNECT_OUT)
79 code = WSACTIVE;
80 else if (code == TIME_OUT)
81 { flag = FORCE;
82 code = call_mowse_int (I$DISCONNECT, &flag, 1);
83 }
84 }
85
86
87
88
89 switch (code)
90 {
91 case BAD_ARG:
92 printf ("exitmows: bad argument %s.", argv[i-1]);
93 break;
94
95 case EXTRA_ARG:
96 printf ("exitmows: unexpected option %s.", argv[i-1]);
97 break;
98
99 case 0:
100 printf (" MOWSE terminated.");
101 break;
102
103 case WSACTIVE:
104 printf (" MOWSE is not detached on Multics.");
105 break;
106
107 case WSNOTACT:
108 printf (" MOWSE is not resident.");
109 break;
110
111 default:
112 printf (" error %d.", code);
113 break;
114 }
115 }
116 ^Z