Userland: Fix double line spacing in grep

This commit is contained in:
Sahan Fernando 2021-06-14 23:36:53 +10:00 committed by Andreas Kling
parent 3194177dce
commit 7ee73b3721
Notes: sideshowbarker 2024-07-18 12:14:57 +09:00

View file

@ -177,6 +177,8 @@ int main(int argc, char** argv)
ScopeGuard free_line = [line] { free(line); };
while ((nread = getline(&line, &line_len, stdin)) != -1) {
VERIFY(nread > 0);
if (line[nread - 1] == '\n')
--nread;
StringView line_view(line, nread);
bool is_binary = line_view.contains(0);