BSD 1 development
[unix-history] / trek / check_out.c
CommitLineData
520d5775
EA
1# include "trek.h"
2
3/*
4** CHECK IF A DEVICE IS OUT
5**
6** The indicated device is checked to see if it is disabled. If
7** it is, an attempt is made to use the starbase device. If both
8** of these fails, it returns non-zero (device is REALLY out),
9** otherwise it returns zero (I can get to it somehow).
10**
11** It prints appropriate messages too.
12*/
13
14check_out(device)
15int device;
16{
17 register int dev;
18
19 dev = device;
20
21 /* check for device ok */
22 if (!damaged(dev))
23 return (0);
24
25 /* report it as being dead */
26 out(dev);
27
28 /* but if we are docked, we can go ahead anyhow */
29 if (Ship.cond != DOCKED)
30 return (1);
31 printf(" Using starbase %s\n", Device[dev].name);
32 return (0);
33}