| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: shield.c,v 1.11 2009/05/24 22:55:03 dholland Exp $ */ | | 1 | /* $NetBSD: shield.c,v 1.12 2009/05/25 00:43:34 dholland Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1980, 1993 | | 4 | * Copyright (c) 1980, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -24,27 +24,27 @@ | | | @@ -24,27 +24,27 @@ |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
29 | * SUCH DAMAGE. | | 29 | * SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> | | 32 | #include <sys/cdefs.h> |
33 | #ifndef lint | | 33 | #ifndef lint |
34 | #if 0 | | 34 | #if 0 |
35 | static char sccsid[] = "@(#)shield.c 8.1 (Berkeley) 5/31/93"; | | 35 | static char sccsid[] = "@(#)shield.c 8.1 (Berkeley) 5/31/93"; |
36 | #else | | 36 | #else |
37 | __RCSID("$NetBSD: shield.c,v 1.11 2009/05/24 22:55:03 dholland Exp $"); | | 37 | __RCSID("$NetBSD: shield.c,v 1.12 2009/05/25 00:43:34 dholland Exp $"); |
38 | #endif | | 38 | #endif |
39 | #endif /* not lint */ | | 39 | #endif /* not lint */ |
40 | | | 40 | |
41 | #include <stdio.h> | | 41 | #include <stdio.h> |
42 | #include "trek.h" | | 42 | #include "trek.h" |
43 | #include "getpar.h" | | 43 | #include "getpar.h" |
44 | | | 44 | |
45 | /* | | 45 | /* |
46 | ** SHIELD AND CLOAKING DEVICE CONTROL | | 46 | ** SHIELD AND CLOAKING DEVICE CONTROL |
47 | ** | | 47 | ** |
48 | ** 'f' is one for auto shield up (in case of Condition RED), | | 48 | ** 'f' is one for auto shield up (in case of Condition RED), |
49 | ** zero for shield control, and negative one for cloaking | | 49 | ** zero for shield control, and negative one for cloaking |
50 | ** device control. | | 50 | ** device control. |
| @@ -101,30 +101,32 @@ shield(int f) | | | @@ -101,30 +101,32 @@ shield(int f) |
101 | if (f <= 0) | | 101 | if (f <= 0) |
102 | out(ind); | | 102 | out(ind); |
103 | return; | | 103 | return; |
104 | } | | 104 | } |
105 | if (Ship.cond == DOCKED) { | | 105 | if (Ship.cond == DOCKED) { |
106 | printf("%s %s down while docked\n", device, dev2); | | 106 | printf("%s %s down while docked\n", device, dev2); |
107 | return; | | 107 | return; |
108 | } | | 108 | } |
109 | if (f <= 0 && !testnl()) { | | 109 | if (f <= 0 && !testnl()) { |
110 | r = getcodpar("Up or down", Udtab); | | 110 | r = getcodpar("Up or down", Udtab); |
111 | i = (long) r->value; | | 111 | i = (long) r->value; |
112 | } else { | | 112 | } else { |
113 | if (*stat) | | 113 | if (*stat) |
114 | (void)sprintf(s, "%s %s up. Do you want %s down", | | 114 | (void)snprintf(s, sizeof(s), |
| | | 115 | "%s %s up. Do you want %s down", |
115 | device, dev2, dev3); | | 116 | device, dev2, dev3); |
116 | else | | 117 | else |
117 | (void)sprintf(s, "%s %s down. Do you want %s up", | | 118 | (void)snprintf(s, sizeof(s), |
| | | 119 | "%s %s down. Do you want %s up", |
118 | device, dev2, dev3); | | 120 | device, dev2, dev3); |
119 | if (!getynpar(s)) | | 121 | if (!getynpar(s)) |
120 | return; | | 122 | return; |
121 | i = !*stat; | | 123 | i = !*stat; |
122 | } | | 124 | } |
123 | if (*stat == i) { | | 125 | if (*stat == i) { |
124 | printf("%s already ", device); | | 126 | printf("%s already ", device); |
125 | if (i) | | 127 | if (i) |
126 | printf("up\n"); | | 128 | printf("up\n"); |
127 | else | | 129 | else |
128 | printf("down\n"); | | 130 | printf("down\n"); |
129 | return; | | 131 | return; |
130 | } | | 132 | } |