Add -u (unbuffered) option to sed. This may appear creaping featurism, but it is very useful when reformatting streams from foreign operating systems (making the output of make on win32 more readable, and does not hurt the sed source significantly. -Steve Reference: /n/sources/patch/sed-unbuffered Date: Tue Feb 21 14:09:06 CET 2017 Signed-off-by: steve@quintile.net --- /sys/man/1/sed Tue Feb 21 14:05:28 2017 +++ /sys/man/1/sed Tue Feb 21 14:05:26 2017 @@ -10,6 +10,9 @@ .B -g ] [ +.B -u +] +[ .B -e .I script ] @@ -44,6 +47,9 @@ .B -g causes all substitutions to be global, as if suffixed .BR g . +When editing interactive streams unbuffered output may be +selected with +.BR -u . .PP A script consists of editing commands, one per line, of the following form: --- /sys/src/cmd/sed.c Tue Feb 21 14:05:34 2017 +++ /sys/src/cmd/sed.c Tue Feb 21 14:05:30 2017 @@ -140,6 +140,7 @@ int dolflag; /* Set when at true EOF */ int sflag; /* Set when substitution done */ int jflag; /* Set when jump required */ +int uflag; /* unbuffered output */ int delflag; /* Delete current line when set */ long lnum = 0; /* Input line count */ @@ -233,6 +234,9 @@ case 'n': nflag++; continue; + case 'u': + uflag++; + break; default: fprint(2, "sed: Unknown flag: %c\n", ARGC()); continue; @@ -1318,6 +1322,8 @@ while (n--) Bputrune(bp, *buf++); Bputc(bp, '\n'); + if(uflag) + Bflush(bp); } ecmp(Rune *a, Rune *b, int count) {