1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:07:45 +00:00

Utilities: Modernize output and comparison in the sort utility

Use the comparison operator of AK/String instead of strcmp(3) and
replace fput* by outln.
This commit is contained in:
Ralf Donau 2021-09-04 22:31:29 +02:00 committed by Andreas Kling
parent 7d8e036e26
commit 4f0e2f2584

View file

@ -37,13 +37,10 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
lines.append({ buffer, AK::ShouldChomp::Chomp }); lines.append({ buffer, AK::ShouldChomp::Chomp });
} }
quick_sort(lines, [](auto& a, auto& b) { quick_sort(lines);
return strcmp(a.characters(), b.characters()) < 0;
});
for (auto& line : lines) { for (auto& line : lines) {
fputs(line.characters(), stdout); outln("{}", line);
fputc('\n', stdout);
} }
return 0; return 0;