git: 272144ab4109 - main - hexdump: Flush stdout after '*' (repeat) lines.

Poul-Henning Kamp phk at FreeBSD.org
Thu Jul 29 06:41:28 UTC 2021


The branch main has been updated by phk:

URL: https://cgit.FreeBSD.org/src/commit/?id=272144ab410901f8b74db2ec97e09d64983d4b31

commit 272144ab410901f8b74db2ec97e09d64983d4b31
Author:     Poul-Henning Kamp <phk at FreeBSD.org>
AuthorDate: 2021-07-29 06:37:39 +0000
Commit:     Poul-Henning Kamp <phk at FreeBSD.org>
CommitDate: 2021-07-29 06:40:57 +0000

    hexdump: Flush stdout after '*' (repeat) lines.
    
    The canonical annoying example being:   hexdump < /dev/zero | less
---
 usr.bin/hexdump/display.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/usr.bin/hexdump/display.c b/usr.bin/hexdump/display.c
index 697443693d8e..5e5b30b73fd0 100644
--- a/usr.bin/hexdump/display.c
+++ b/usr.bin/hexdump/display.c
@@ -274,8 +274,10 @@ get(void)
 			if (vflag != ALL && 
 			    valid_save && 
 			    bcmp(curp, savp, nread) == 0) {
-				if (vflag != DUP)
+				if (vflag != DUP) {
 					(void)printf("*\n");
+					(void)fflush(stdout);
+				}
 				return((u_char *)NULL);
 			}
 			bzero((char *)curp + nread, need);
@@ -305,8 +307,10 @@ get(void)
 					vflag = WAIT;
 				return(curp);
 			}
-			if (vflag == WAIT)
+			if (vflag == WAIT) {
 				(void)printf("*\n");
+				(void)fflush(stdout);
+			}
 			vflag = DUP;
 			address += blocksize;
 			need = blocksize;


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