diff options
author | Ralf Donau <ruelle@volleyballschlaeger.de> | 2021-09-04 22:31:29 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-05 00:15:26 +0200 |
commit | 4f0e2f25840118d3c03b365fe88856e69f4ca9b1 (patch) | |
tree | 3a4af85b8caf3a97f87a8f163fe93104b9412981 /Userland/Utilities/sort.cpp | |
parent | 7d8e036e265fd854dd323d810ad31847aaaae034 (diff) | |
download | serenity-4f0e2f25840118d3c03b365fe88856e69f4ca9b1.zip |
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.
Diffstat (limited to 'Userland/Utilities/sort.cpp')
-rw-r--r-- | Userland/Utilities/sort.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Userland/Utilities/sort.cpp b/Userland/Utilities/sort.cpp index 0608db036c..505da349c4 100644 --- a/Userland/Utilities/sort.cpp +++ b/Userland/Utilities/sort.cpp @@ -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; |