Module Name:    src
Committed By:   bouyer
Date:           Sat Nov 28 15:40:47 UTC 2009

Modified Files:
        src/sys/arch/i386/stand/lib [netbsd-5]: pcio.c

Log Message:
Pull up following revision(s) (requested by mbalmer in ticket #1143):
        sys/arch/i386/stand/lib/pcio.c: revision 1.26
Have the boot countdown on i386 display "starting in N seconds." instead
of "starting in N" and eliminate a use of sprintf.  Note that on
some rare machines it can be that the BIOS does not provide the delay
function.  On such machines the countdown will almost immediately count down
to zero display "starting in 0 seconds."; apparently the net4801 is such a
machine.
Feedback, ideas, and inspiration from tron, ok tron/tonnerre


To generate a diff of this commit:
cvs rdiff -u -r1.23.8.1 -r1.23.8.2 src/sys/arch/i386/stand/lib/pcio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/stand/lib/pcio.c
diff -u src/sys/arch/i386/stand/lib/pcio.c:1.23.8.1 src/sys/arch/i386/stand/lib/pcio.c:1.23.8.2
--- src/sys/arch/i386/stand/lib/pcio.c:1.23.8.1	Sat Sep 26 18:25:46 2009
+++ src/sys/arch/i386/stand/lib/pcio.c	Sat Nov 28 15:40:47 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcio.c,v 1.23.8.1 2009/09/26 18:25:46 snj Exp $	 */
+/*	$NetBSD: pcio.c,v 1.23.8.2 2009/11/28 15:40:47 bouyer Exp $	 */
 
 /*
  * Copyright (c) 1996, 1997
@@ -331,15 +331,19 @@
 
 	for (;;) {
 		if (tell && (i % POLL_FREQ) == 0) {
-			char numbuf[20];
-			int len, j;
+			char numbuf[32];
+			int len;
 
-			sprintf(numbuf, "%d ", i/POLL_FREQ);
-			len = strlen(numbuf);
-			for (j = 0; j < len; j++)
-				numbuf[len + j] = '\b';
-			numbuf[len + j] = '\0';
-			printf(numbuf);
+			len = snprintf(numbuf, sizeof(numbuf), "%d seconds. ",
+			    i/POLL_FREQ);
+			if (len > 0 && len < sizeof(numbuf)) {
+				char *p = numbuf;
+
+				printf("%s", numbuf);
+				while (*p)
+					*p++ = '\b';
+				printf("%s", numbuf);
+			}
 		}
 		if (iskey(1)) {
 			/* flush input buffer */
@@ -357,7 +361,7 @@
 
 out:
 	if (tell)
-		printf("0 \n");
+		printf("0 seconds.     \n");
 
 	return c;
 }

Reply via email to