diff options
| author | Charles.Forsyth <devnull@localhost> | 2008-01-16 17:23:17 +0000 |
|---|---|---|
| committer | Charles.Forsyth <devnull@localhost> | 2008-01-16 17:23:17 +0000 |
| commit | 9cb225d99b1042bd7281c24ac4d1d8ea4b7f7665 (patch) | |
| tree | 11cad5d52a0d31071c361c4f83393d1ccb94f411 | |
| parent | 8af5e81463b3762fcbd3297e6246c53cf8846ded (diff) | |
20080116-1729
| -rw-r--r-- | appl/cmd/sed.b | 7 | ||||
| -rw-r--r-- | dis/sed.dis | bin | 13113 -> 13134 bytes |
2 files changed, 5 insertions, 2 deletions
diff --git a/appl/cmd/sed.b b/appl/cmd/sed.b index 30bfbd22..59c7c7b7 100644 --- a/appl/cmd/sed.b +++ b/appl/cmd/sed.b @@ -558,7 +558,7 @@ trans(ch: int) : string '\\' => return "\\\\"; * => - return sys->sprint("\\u%4x", ch); + return sys->sprint("\\u%.4ux", ch); } } @@ -789,6 +789,7 @@ substitute(c: ref Sedcom.S, s: string) : (bool, string) sflag = true; start := 0; + # Beware of infinite loops: 's/$/i/g', 's/a/aa/g', 's/^/a/g' do { se := (start, len s); if ((m := regex->executese(c.re, s, se, true, true)) == nil) @@ -816,7 +817,9 @@ substitute(c: ref Sedcom.S, s: string) : (bool, string) } } s = s[0:l] + rep + s[r:]; - start++; + start = l + len rep; + if(r == l) + start++; } while (c.gfl); return (true, s); } diff --git a/dis/sed.dis b/dis/sed.dis Binary files differindex 744a7be4..6e42daba 100644 --- a/dis/sed.dis +++ b/dis/sed.dis |
