diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 2021-07-29 06:37:39 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2021-07-29 06:40:57 +0000 |
commit | 272144ab410901f8b74db2ec97e09d64983d4b31 (patch) | |
tree | 85102f2b2e9bcd8e54fa975eea6dd006283adf63 | |
parent | 7f8f79a5c444a565a32b0c6578b07f8d496f6c49 (diff) | |
download | src-272144ab410901f8b74db2ec97e09d64983d4b31.tar.gz src-272144ab410901f8b74db2ec97e09d64983d4b31.zip |
hexdump: Flush stdout after '*' (repeat) lines.
The canonical annoying example being: hexdump < /dev/zero | less
-rw-r--r-- | usr.bin/hexdump/display.c | 8 |
1 files 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; |