Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/stand/efiboot Fix for disappearing counters on graphics ...



details:   https://anonhg.NetBSD.org/src/rev/2a577626b0ad
branches:  trunk
changeset: 1006716:2a577626b0ad
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Jan 25 10:09:46 2020 +0000

description:
Fix for disappearing counters on graphics consoles

diffstat:

 sys/stand/efiboot/prompt.c |  26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diffs (60 lines):

diff -r 5b9863d8e227 -r 2a577626b0ad sys/stand/efiboot/prompt.c
--- a/sys/stand/efiboot/prompt.c        Sat Jan 25 08:13:39 2020 +0000
+++ b/sys/stand/efiboot/prompt.c        Sat Jan 25 10:09:46 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: prompt.c,v 1.5 2019/09/29 00:52:26 jakllsch Exp $      */
+/*     $NetBSD: prompt.c,v 1.6 2020/01/25 10:09:46 jmcneill Exp $      */
 
 /*
  * Copyright (c) 1996, 1997
@@ -75,23 +75,27 @@
 {
        int i = timeout * POLL_FREQ;
        int last_secs = -1, secs;
+       int last_len = -1, n;
+       char buf[32];
        char c = 0;
 
        for (;;) {
                if (tell) {
-                       char buf[32];
                        int len;
 
                        secs = (i + POLL_FREQ - 1) / POLL_FREQ;
                        if (secs != last_secs) {
-                               len = snprintf(buf, sizeof(buf), "%d seconds. ", (i + POLL_FREQ - 1) / POLL_FREQ);
-                               if (len > 0 && len < sizeof(buf)) {
+                               if (last_len != -1) {
                                        char *p = buf;
-                                       printf("%s", buf);
-                                       while (*p)
+                                       for (n = 0; n < last_len; n++)
                                                *p++ = '\b';
+                                       *p = '\0';
                                        printf("%s", buf);
                                }
+                               len = snprintf(buf, sizeof(buf), "%d seconds. ", (i + POLL_FREQ - 1) / POLL_FREQ);
+                               if (len > 0 && len < sizeof(buf))
+                                       printf("%s", buf);
+                               last_len = len;
                                last_secs = secs;
                        }
                }
@@ -109,8 +113,16 @@
        }
 
 out:
-       if (tell)
+       if (tell) {
+               if (last_len != -1) {
+                       char *p = buf;
+                       for (n = 0; n < last_len; n++)
+                               *p++ = '\b';
+                       *p = '\0';
+                       printf("%s", buf);
+               }
                printf("0 seconds.     \n");
+       }
 
        return c;
 }



Home | Main Index | Thread Index | Old Index