| Newsgroups |
gmane.editors.sed.user |
| Message-ID |
<[email protected]> |
< I can see "run" acknowledges there might be a `t` that wasn't taken between the last taken `t` and the current one -- i.e. there's an interval "since the last conditional branch was taken" doesn't seem to talk about..
< The distinction makes no difference to sed's behavior -- if a subst took place in that interval, then that `t` was taken, so the doc's correct in every case.
< All the same, I prefer your version. The current one, "taken", clearly says how far back any previous subst has to have been and leaves the reader to work out how recent it has to have been, while "run" clearly says how recent it has to have been.
Thanks. Just to be clear, here is the obscure example (example #7 from the script) where the distinction does make a difference, and so where the docs are not correct, assuming my analysis is correct.
----------- Current definition
Using current T definition - "Branch to label only if there have been no successful substitutions since the last input line was read or conditional branch was taken" - the output would be (NOT observed):
$ echo old | sed "s/old/new/; Tx; l; :x T; d"
new$
- s works
- T "runs", but no effect on flag from just running
- T does not branch (s worked), so flag not reset
- l runs
- T does not branch, just like it didn't the last time
- d runs, so PatSpace not printed
-------------- Corrected (I think) definition
Using corrected T definition - "Branch to label only if there have been no successful substitutions since the last input line was read or conditional branch was run" - the output would be (this IS observed):
$ echo old | sed "s/old/new/; Tx; l; :x T; d"
new$
new
- s works
- T "runs", so flag reset after T done
- T does not branch, because s worked
- l runs
- T branches this time, because flag was reset
- d skipped, PatSpace prints
Since the observed output is consistent with the corrected definition (and consistent with the original description), the docs seem wrong. The same logic (change "taken" to "run") applies to t.
Daniel