CVSROOT:        /cvs
Module name:    src
Changes by:     t...@cvs.openbsd.org    2020/08/30 06:16:04

Modified files:
        usr.bin/make   : varmodifiers.c 

Log message:
Fix :S with anchors and replacement

gnezdo noticed that :S/old_string/new_string/ variable modifiers such
as :S/^sth/&/ and :S/sth$/&/ with an anchor in the old_string and an &
in the new_string don't work as documented (and expected) since they
replace & with old_string including the anchors.

This is because get_spatternarg() deals with skipping the anchors in
pattern->lhs only after having replaced any '&' in the buffer that will
eventually become new_string with pattern->lhs. Fix this by moving the
logic of skipping the anchors from get_spatternarg() into
common_get_patternarg() so it is done before & is handled.

ok millert

Reply via email to