git: 3db1b221edab - main - Set stdout & stderr unbuffered, so that the "telnet>" prompt also shows up when output is redirected:

Poul-Henning Kamp phk at FreeBSD.org
Tue Dec 29 21:07:37 UTC 2020


The branch main has been updated by phk:

URL: https://cgit.FreeBSD.org/src/commit/?id=3db1b221edab9bada79da4f825347ce1772f5ee8

commit 3db1b221edab9bada79da4f825347ce1772f5ee8
Author:     Poul-Henning Kamp <phk at FreeBSD.org>
AuthorDate: 2020-12-29 21:05:48 +0000
Commit:     Poul-Henning Kamp <phk at FreeBSD.org>
CommitDate: 2020-12-29 21:05:48 +0000

    Set stdout & stderr unbuffered, so that the "telnet>" prompt
    also shows up when output is redirected:
    
            telnet |& tee _log
---
 contrib/telnet/telnet/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/contrib/telnet/telnet/main.c b/contrib/telnet/telnet/main.c
index 8703968efe10..befb3eecee66 100644
--- a/contrib/telnet/telnet/main.c
+++ b/contrib/telnet/telnet/main.c
@@ -121,6 +121,8 @@ main(int argc, char *argv[])
 	extern int forward_flags;
 #endif	/* FORWARD */
 
+	setbuf(stdout, NULL);
+	setbuf(stderr, NULL);
 	tninit();		/* Clear out things */
 
 	TerminalSaveState();


More information about the dev-commits-src-all mailing list