sed
Geoffrey M. Clemm
geoff at boulder.UUCP
Wed May 15 02:44:18 AEST 1985
.
Description :
The manual entry for the sed "t" (test) command states that the branch
should be taken if :
"any substitutions have been made since the most recent reading of an
input line or execution of a 't'."
But the substitution flag is not reset when an input line is read.
Repeat By :
Create a file named bug.sed containing the following sed command script :
--------------------------------------------
s/j/"j"/
t found
s/$/ : no j's here !/
b
:found
s/$/ : found a j !/
--------------------------------------------
Then run "sed -f bug.sed". After the first line containing a "j" is
read, all subsequent lines (whether they contain a j or not) will be marked
with "found a j".
Fix :
Reset the sflag to 0 in gline() in sed1.c . A context diff follows :
--- sed1.c Tue May 14 10:15:38 1985
***************
*** 650,653
register char *p1, *p2;
register c;
p1 = addr;
p2 = cbp;
--- 650,654 -----
register char *p1, *p2;
register c;
+ sflag = 0;
p1 = addr;
p2 = cbp;
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list