22
22
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23
23
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24
24
* SUCH DAMAGE.
25
+ *
26
+ * $FreeBSD: src/sys/boot/common/console.c,v 1.6 2003/08/25 23:30:41 obrien Exp $
25
27
*/
26
28
27
29
#include <sys/cdefs.h>
@@ -109,24 +111,29 @@ getchar(void)
109
111
int rv ;
110
112
111
113
/* Loop forever polling all active consoles */
112
- for (;;)
113
- for (cons = 0 ; consoles [cons ] != NULL ; cons ++ )
114
+ for (;;) {
115
+ for (cons = 0 ; consoles [cons ] != NULL ; cons ++ ) {
114
116
if ((consoles [cons ]-> c_flags & (C_PRESENTIN | C_ACTIVEIN )) ==
115
- (C_PRESENTIN | C_ACTIVEIN ) &&
116
- ((rv = consoles [cons ]-> c_in ()) != -1 ))
117
+ (C_PRESENTIN | C_ACTIVEIN ) &&
118
+ ((rv = consoles [cons ]-> c_in ()) != -1 )) {
117
119
return (rv );
120
+ }
121
+ }
122
+ }
118
123
}
119
124
120
125
int
121
126
ischar (void )
122
127
{
123
128
int cons ;
124
129
125
- for (cons = 0 ; consoles [cons ] != NULL ; cons ++ )
130
+ for (cons = 0 ; consoles [cons ] != NULL ; cons ++ ) {
126
131
if ((consoles [cons ]-> c_flags & (C_PRESENTIN | C_ACTIVEIN )) ==
127
132
(C_PRESENTIN | C_ACTIVEIN ) &&
128
- (consoles [cons ]-> c_ready () != 0 ))
133
+ (consoles [cons ]-> c_ready () != 0 )) {
129
134
return (1 );
135
+ }
136
+ }
130
137
return (0 );
131
138
}
132
139
@@ -139,10 +146,12 @@ putchar(int c)
139
146
if (c == '\n' )
140
147
putchar ('\r' );
141
148
142
- for (cons = 0 ; consoles [cons ] != NULL ; cons ++ )
149
+ for (cons = 0 ; consoles [cons ] != NULL ; cons ++ ) {
143
150
if ((consoles [cons ]-> c_flags & (C_PRESENTOUT | C_ACTIVEOUT )) ==
144
- (C_PRESENTOUT | C_ACTIVEOUT ))
151
+ (C_PRESENTOUT | C_ACTIVEOUT )) {
145
152
consoles [cons ]-> c_out (c );
153
+ }
154
+ }
146
155
}
147
156
148
157
/*
@@ -153,9 +162,11 @@ cons_find(const char *name)
153
162
{
154
163
int cons ;
155
164
156
- for (cons = 0 ; consoles [cons ] != NULL ; cons ++ )
157
- if (!strcmp (consoles [cons ]-> c_name , name ))
165
+ for (cons = 0 ; consoles [cons ] != NULL ; cons ++ ) {
166
+ if (!strcmp (consoles [cons ]-> c_name , name )) {
158
167
return (cons );
168
+ }
169
+ }
159
170
return (-1 );
160
171
}
161
172
@@ -214,8 +225,9 @@ cons_check(const char *string)
214
225
215
226
if (found == 0 || failed != 0 ) {
216
227
printf ("Available consoles:\n" );
217
- for (cons = 0 ; consoles [cons ] != NULL ; cons ++ )
228
+ for (cons = 0 ; consoles [cons ] != NULL ; cons ++ ) {
218
229
printf (" %s\n" , consoles [cons ]-> c_name );
230
+ }
219
231
}
220
232
221
233
return (found );
0 commit comments