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:
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 });
|
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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue