Source-Changes-HG archive

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

[src/netbsd-9]: src/sbin/dmesg Pull up following revision(s) (requested by ts...



details:   https://anonhg.NetBSD.org/src/rev/b37336ea84d4
branches:  netbsd-9
changeset: 466927:b37336ea84d4
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Jan 05 09:32:10 2020 +0000

description:
Pull up following revision(s) (requested by tsutsui in ticket #601):

        sbin/dmesg/dmesg.c: revision 1.44
        sbin/dmesg/dmesg.c: revision 1.45

Fix dmesg(8) to preserve leading whitespaces of kernel messages.
Closes PR/54729.

Make recent change build for SMALL builds as well as normal ones.

diffstat:

 sbin/dmesg/dmesg.c |  16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diffs (59 lines):

diff -r 3a067153a9cc -r b37336ea84d4 sbin/dmesg/dmesg.c
--- a/sbin/dmesg/dmesg.c        Sun Jan 05 09:30:04 2020 +0000
+++ b/sbin/dmesg/dmesg.c        Sun Jan 05 09:32:10 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dmesg.c,v 1.43 2019/06/04 11:59:05 kre Exp $   */
+/*     $NetBSD: dmesg.c,v 1.43.2.1 2020/01/05 09:32:10 martin Exp $    */
 /*-
  * Copyright (c) 1991, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)dmesg.c    8.1 (Berkeley) 6/5/93";
 #else
-__RCSID("$NetBSD: dmesg.c,v 1.43 2019/06/04 11:59:05 kre Exp $");
+__RCSID("$NetBSD: dmesg.c,v 1.43.2.1 2020/01/05 09:32:10 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -157,7 +157,7 @@
        long nsec, fsec;
        int scale;
        int deltas, quiet, humantime;
-       bool frac;
+       bool frac, postts;
 
        static const int bmib[] = { CTL_KERN, KERN_BOOTTIME };
        size = sizeof(boottime);
@@ -262,6 +262,7 @@
         */
 #ifndef SMALL
        frac = false;
+       postts = false;
        scale = 0;
 #endif
        for (tstamp = 0, newl = 1, log = i = 0, p = bufdata + cur.msg_bufx;
@@ -310,6 +311,7 @@
                                ADDC(ch);
                                ADDC('\0');
                                tstamp = 0;
+                               postts = true;
                                sec = fsec = 0;
                                switch (sscanf(tbuf, "[%jd.%ld]", &sec, &fsec)){
                                case EOF:
@@ -375,8 +377,14 @@
                                continue;
 #endif
                        case ' ':
-                               if (!tstamp)
+#ifndef SMALL
+                               if (!tstamp && postts) {
+                                       postts = false;
+#else
+                               if (!tstamp) {
+#endif
                                        continue;
+                               }
                                /*FALLTHROUGH*/
                        default:
 #ifndef SMALL



Home | Main Index | Thread Index | Old Index