Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site boulder.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!hao!nbires!boulder!geoff From: geoff@boulder.UUCP (Geoffrey M. Clemm) Newsgroups: net.bugs.4bsd Subject: sed Message-ID: <363@boulder.UUCP> Date: Tue, 14-May-85 12:44:18 EDT Article-I.D.: boulder.363 Posted: Tue May 14 12:44:18 1985 Date-Received: Thu, 16-May-85 06:40:21 EDT Distribution: net Organization: University of Colorado, Boulder Lines: 39 . 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;