mirror of
https://codeberg.org/landley/toybox.git
synced 2026-01-26 14:13:25 +00:00
Fix sed -z P with test.
This commit is contained in:
parent
5147183a21
commit
f2f35fe829
@ -179,6 +179,7 @@ testcmd '-z' '-z "s/\n/-/g"' "a-b-c" "" "a\nb\nc"
|
||||
testcmd '-z N' '-z N' 'one\0two\0' '' 'one\0two\0'
|
||||
testcmd 'p noeol' '-z p' 'one\0one' '' 'one'
|
||||
testcmd '-z N noeol' '-z N' 'one\0two' '' 'one\0two'
|
||||
testcmd '-z S' "-z 'N;P'" 'one\0one\0two' '' 'one\0two'
|
||||
|
||||
# toybox handling of empty capturing groups broke minjail. Check that we
|
||||
# correctly replace an empty capturing group with the empty string:
|
||||
|
||||
@ -408,7 +408,7 @@ static void sed_line(char **pline, long plen)
|
||||
// Pending append goes out right after N
|
||||
goto done;
|
||||
} else if (c=='p' || c=='P') {
|
||||
char *l = (c=='P') ? strchr(line, '\n') : 0;
|
||||
char *l = (c=='P') ? strchr(line, TT.delim) : 0;
|
||||
|
||||
if (emit(line, l ? l-line : len, eol)) break;
|
||||
} else if (c=='q' || c=='Q') {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user