Skip to content

Commit ab35e20

Browse files
author
Diederik de Groot
committed
Fixes based on review by @liweitianux
1 parent 4bfcb39 commit ab35e20

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

sys/boot/common/console.c

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2323
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2424
* SUCH DAMAGE.
25+
*
26+
* $FreeBSD: src/sys/boot/common/console.c,v 1.6 2003/08/25 23:30:41 obrien Exp $
2527
*/
2628

2729
#include <sys/cdefs.h>
@@ -109,24 +111,29 @@ getchar(void)
109111
int rv;
110112

111113
/* 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++) {
114116
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)) {
117119
return(rv);
120+
}
121+
}
122+
}
118123
}
119124

120125
int
121126
ischar(void)
122127
{
123128
int cons;
124129

125-
for (cons = 0; consoles[cons] != NULL; cons++)
130+
for (cons = 0; consoles[cons] != NULL; cons++) {
126131
if ((consoles[cons]->c_flags & (C_PRESENTIN | C_ACTIVEIN)) ==
127132
(C_PRESENTIN | C_ACTIVEIN) &&
128-
(consoles[cons]->c_ready() != 0))
133+
(consoles[cons]->c_ready() != 0)) {
129134
return(1);
135+
}
136+
}
130137
return(0);
131138
}
132139

@@ -139,10 +146,12 @@ putchar(int c)
139146
if (c == '\n')
140147
putchar('\r');
141148

142-
for (cons = 0; consoles[cons] != NULL; cons++)
149+
for (cons = 0; consoles[cons] != NULL; cons++) {
143150
if ((consoles[cons]->c_flags & (C_PRESENTOUT | C_ACTIVEOUT)) ==
144-
(C_PRESENTOUT | C_ACTIVEOUT))
151+
(C_PRESENTOUT | C_ACTIVEOUT)) {
145152
consoles[cons]->c_out(c);
153+
}
154+
}
146155
}
147156

148157
/*
@@ -153,9 +162,11 @@ cons_find(const char *name)
153162
{
154163
int cons;
155164

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)) {
158167
return (cons);
168+
}
169+
}
159170
return (-1);
160171
}
161172

@@ -214,8 +225,9 @@ cons_check(const char *string)
214225

215226
if (found == 0 || failed != 0) {
216227
printf("Available consoles:\n");
217-
for (cons = 0; consoles[cons] != NULL; cons++)
228+
for (cons = 0; consoles[cons] != NULL; cons++) {
218229
printf(" %s\n", consoles[cons]->c_name);
230+
}
219231
}
220232

221233
return (found);

sys/boot/pc32/libi386/comconsole.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ sleep(int timeout) {
192192
if (ntime >= when)
193193
break;
194194
otime = ntime;
195+
}
195196
}
196197

197198
static int

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy