29 |
|
int argc; |
30 |
|
char *argv[]; |
31 |
|
{ |
32 |
< |
int rdy, inp, res = 0; |
32 |
> |
int rdy, inp, res = 0, pause = 0; |
33 |
|
|
34 |
|
progname = argv[0]; |
35 |
|
if (argc != 2) |
39 |
|
/* enter main loop */ |
40 |
|
do { |
41 |
|
rdy = disp_wait(); |
42 |
< |
while (rdy & DEV_READY) { |
43 |
< |
inp = dev_input(); /* take residual action here */ |
42 |
> |
if (rdy & DEV_READY) { /* get user input */ |
43 |
> |
inp = dev_input(); |
44 |
|
if (inp & DEV_NEWVIEW) |
45 |
|
new_view(&odev.v); |
46 |
|
if (inp & DEV_SHUTDOWN) |
47 |
|
serv_request(DR_SHUTDOWN, 0, NULL); |
48 |
|
if (inp & DEV_WAIT) |
49 |
< |
serv_request(DR_ATTEN, 0, NULL); |
50 |
< |
else |
51 |
< |
rdy &= ~DEV_READY; |
52 |
< |
} |
53 |
< |
if (rdy & SERV_READY) { |
54 |
< |
res = serv_result(); /* processes result, also */ |
55 |
< |
if (res == DS_ACKNOW) |
49 |
> |
pause = 1; |
50 |
> |
if (inp & DEV_RESUME) { |
51 |
|
serv_request(DR_NOOP, 0, NULL); |
52 |
+ |
pause = 0; |
53 |
+ |
} |
54 |
+ |
} |
55 |
+ |
if (rdy & SERV_READY) { /* get server result */ |
56 |
+ |
res = serv_result(); |
57 |
+ |
if (pause && res != DS_SHUTDOWN) { |
58 |
+ |
serv_request(DR_ATTEN, 0, NULL); |
59 |
+ |
while ((res = serv_result()) != DS_ACKNOW && |
60 |
+ |
res != DS_SHUTDOWN) |
61 |
+ |
; |
62 |
+ |
} |
63 |
|
} |
64 |
|
} while (res != DS_SHUTDOWN); |
65 |
|
/* all done */ |