mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 17:52:26 -05:00
Utilities: Fix grep match when reading from stdin
When reading from stdin, grep discards the last character, even if that character is not \n. This commit changes grep to no longer discard the last character from a line.
This commit is contained in:
parent
eed0bcaf42
commit
68de9008e7
Notes:
sideshowbarker
2024-07-18 17:40:22 +09:00
Author: https://github.com/r-paiva Commit: https://github.com/SerenityOS/serenity/commit/68de9008e75 Pull-request: https://github.com/SerenityOS/serenity/pull/6738 Issue: https://github.com/SerenityOS/serenity/issues/5907 Reviewed-by: https://github.com/alimpfard ✅ Reviewed-by: https://github.com/linusg
1 changed files with 1 additions and 1 deletions
|
@ -177,7 +177,7 @@ int main(int argc, char** argv)
|
|||
ScopeGuard free_line = [line] { free(line); };
|
||||
while ((nread = getline(&line, &line_len, stdin)) != -1) {
|
||||
VERIFY(nread > 0);
|
||||
StringView line_view(line, nread - 1);
|
||||
StringView line_view(line, nread);
|
||||
bool is_binary = line_view.contains(0);
|
||||
|
||||
if (is_binary && binary_mode == BinaryFileMode::Skip)
|
||||
|
|
Loading…
Add table
Reference in a new issue