Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint/lint1 lint: make stdout unbuffered in debug mode



details:   https://anonhg.NetBSD.org/src/rev/cb66bacbc6be
branches:  trunk
changeset: 984333:cb66bacbc6be
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jul 03 20:43:35 2021 +0000

description:
lint: make stdout unbuffered in debug mode

Some debug log messages are on stdout, others on stderr.  Make sure that
they occur in the correct order, even when the output is redirected.

diffstat:

 usr.bin/xlint/lint1/main1.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 887d1b586980 -r cb66bacbc6be usr.bin/xlint/lint1/main1.c
--- a/usr.bin/xlint/lint1/main1.c       Sat Jul 03 20:40:17 2021 +0000
+++ b/usr.bin/xlint/lint1/main1.c       Sat Jul 03 20:43:35 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main1.c,v 1.46 2021/06/27 18:48:45 rillig Exp $        */
+/*     $NetBSD: main1.c,v 1.47 2021/07/03 20:43:35 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: main1.c,v 1.46 2021/06/27 18:48:45 rillig Exp $");
+__RCSID("$NetBSD: main1.c,v 1.47 2021/07/03 20:43:35 rillig Exp $");
 #endif
 
 #include <sys/types.h>
@@ -254,6 +254,8 @@
        /* initialize output */
        outopen(argv[1]);
 
+       if (dflag)
+               setvbuf(stdout, NULL, _IONBF, 0);
 #ifdef YYDEBUG
        if (yflag)
                yydebug = 1;



Home | Main Index | Thread Index | Old Index