Module Name: src Committed By: mbalmer Date: Mon Jun 29 09:23:16 UTC 2009
Modified Files: src/sys/arch/i386/stand/lib: pcio.c Log Message: 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.25 -r1.26 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.25 src/sys/arch/i386/stand/lib/pcio.c:1.26 --- src/sys/arch/i386/stand/lib/pcio.c:1.25 Sun Dec 14 18:46:33 2008 +++ src/sys/arch/i386/stand/lib/pcio.c Mon Jun 29 09:23:16 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pcio.c,v 1.25 2008/12/14 18:46:33 christos Exp $ */ +/* $NetBSD: pcio.c,v 1.26 2009/06/29 09:23:16 mbalmer Exp $ */ /* * Copyright (c) 1996, 1997 @@ -323,15 +323,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 */ @@ -349,7 +353,7 @@ out: if (tell) - printf("0 \n"); + printf("0 seconds. \n"); return c; }