Module Name: src
Committed By: martin
Date: Sun Jan 5 09:32:10 UTC 2020
Modified Files:
src/sbin/dmesg [netbsd-9]: dmesg.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.43.2.1 src/sbin/dmesg/dmesg.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/dmesg/dmesg.c
diff -u src/sbin/dmesg/dmesg.c:1.43 src/sbin/dmesg/dmesg.c:1.43.2.1
--- src/sbin/dmesg/dmesg.c:1.43 Tue Jun 4 11:59:05 2019
+++ src/sbin/dmesg/dmesg.c Sun Jan 5 09:32:10 2020
@@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19
#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 @@ main(int argc, char *argv[])
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 @@ main(int argc, char *argv[])
*/
#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 @@ main(int argc, char *argv[])
ADDC(ch);
ADDC('\0');
tstamp = 0;
+ postts = true;
sec = fsec = 0;
switch (sscanf(tbuf, "[%jd.%ld]", &sec, &fsec)){
case EOF:
@@ -375,8 +377,14 @@ main(int argc, char *argv[])
continue;
#endif
case ' ':
- if (!tstamp)
+#ifndef SMALL
+ if (!tstamp && postts) {
+ postts = false;
+#else
+ if (!tstamp) {
+#endif
continue;
+ }
/*FALLTHROUGH*/
default:
#ifndef SMALL