mirror of
https://github.com/sheumann/hush.git
synced 2024-11-05 06:07:00 +00:00
Fix the following testcase by disabling global substitution if the regex
is anchored to the start of line, there can be only one subst. echo "aah" | sed 's/^a/b/g'
This commit is contained in:
parent
c18ce373a2
commit
f36635cec6
@ -43,11 +43,11 @@
|
|||||||
Unsupported features:
|
Unsupported features:
|
||||||
|
|
||||||
- GNU extensions
|
- GNU extensions
|
||||||
- and lots, lots more.
|
- and more.
|
||||||
|
|
||||||
Bugs:
|
Bugs:
|
||||||
|
|
||||||
- Cant subst globally using ^ or $ in regex, eg. "aah" | sed 's/^a/b/g'
|
- lots
|
||||||
|
|
||||||
Reference http://www.opengroup.org/onlinepubs/007904975/utilities/sed.html
|
Reference http://www.opengroup.org/onlinepubs/007904975/utilities/sed.html
|
||||||
*/
|
*/
|
||||||
@ -299,7 +299,9 @@ static int parse_subst_cmd(sed_cmd_t * const sed_cmd, const char *substr)
|
|||||||
while (substr[++idx]) {
|
while (substr[++idx]) {
|
||||||
switch (substr[idx]) {
|
switch (substr[idx]) {
|
||||||
case 'g':
|
case 'g':
|
||||||
|
if (match[0] != '^') {
|
||||||
sed_cmd->sub_g = 1;
|
sed_cmd->sub_g = 1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
/* Hmm, i dont see the I option mentioned in the standard */
|
/* Hmm, i dont see the I option mentioned in the standard */
|
||||||
case 'I':
|
case 'I':
|
||||||
|
Loading…
Reference in New Issue
Block a user