mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:47:35 +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:
parent
7d8e036e26
commit
4f0e2f2584
1 changed files with 2 additions and 5 deletions
|
@ -37,13 +37,10 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
|
|||
lines.append({ buffer, AK::ShouldChomp::Chomp });
|
||||
}
|
||||
|
||||
quick_sort(lines, [](auto& a, auto& b) {
|
||||
return strcmp(a.characters(), b.characters()) < 0;
|
||||
});
|
||||
quick_sort(lines);
|
||||
|
||||
for (auto& line : lines) {
|
||||
fputs(line.characters(), stdout);
|
||||
fputc('\n', stdout);
|
||||
outln("{}", line);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue