PR toolchain/54269
Make a SMALL dmesg even smaller. When compiled -DSMALL, dmesg does nothing at all with the kernel timestamps (it processes no options to be told what would be the user's desire) so make it truly do (almost) nothing, rather than some botched partial processing of them. The "almost" is that a SMALL dmesg will now ignore spaces at the beginning of each new message line ... those are (vanishingly) unlikely to occur, as the kernel puts the timestamp (which starts with '[' there) - fixing this would have meant even more #ifdef's as the code that ignores that leading space is the only remaining thing that (in a SMALL) dmesg looks at the value of the "tstamp" variable, and if we don't keep some use of it, gcc complains... These changes affect only SMALL dmesg (as installed on boot floppies, etc) and have no intended effect on the version that's installed on a normal (full size) running system.
This commit is contained in:
parent
ae89e82305
commit
43729d11af
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dmesg.c,v 1.41 2018/10/30 19:40:36 kre Exp $ */
|
||||
/* $NetBSD: dmesg.c,v 1.42 2019/06/04 11:37:39 kre Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
|
@ -38,7 +38,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)dmesg.c 8.1 (Berkeley) 6/5/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: dmesg.c,v 1.41 2018/10/30 19:40:36 kre Exp $");
|
||||
__RCSID("$NetBSD: dmesg.c,v 1.42 2019/06/04 11:37:39 kre Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -291,27 +291,25 @@ main(int argc, char *argv[])
|
|||
#endif
|
||||
|
||||
switch (ch) {
|
||||
case '[':
|
||||
#ifndef SMALL
|
||||
case '[':
|
||||
frac = false;
|
||||
scale = 0;
|
||||
#endif
|
||||
ADDC(ch);
|
||||
continue;
|
||||
#endif
|
||||
case '<':
|
||||
log = 1;
|
||||
continue;
|
||||
case '>':
|
||||
log = 0;
|
||||
continue;
|
||||
case ']':
|
||||
#ifndef SMALL
|
||||
case ']':
|
||||
frac = false;
|
||||
#endif
|
||||
ADDC(ch);
|
||||
ADDC('\0');
|
||||
tstamp = 0;
|
||||
#ifndef SMALL
|
||||
sec = fsec = 0;
|
||||
switch (sscanf(tbuf, "[%jd.%ld]", &sec, &fsec)){
|
||||
case EOF:
|
||||
|
@ -374,21 +372,21 @@ main(int argc, char *argv[])
|
|||
}
|
||||
if (!quiet || deltas)
|
||||
printf("] ");
|
||||
#endif
|
||||
continue;
|
||||
#endif
|
||||
case ' ':
|
||||
if (!tstamp)
|
||||
continue;
|
||||
/*FALLTHROUGH*/
|
||||
default:
|
||||
#ifndef SMALL
|
||||
if (tstamp) {
|
||||
ADDC(ch);
|
||||
#ifndef SMALL
|
||||
if (ch == '.')
|
||||
frac = true;
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (log)
|
||||
continue;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue