diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2023-02-21 15:14:41 +0330 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2023-02-28 15:52:24 +0330 |
commit | db886fe18bad881c1e1064780937c75e92e52b5f (patch) | |
tree | 40c8bdaed6f64580483ecc7d7b09bc29db6d7366 /Userland/Utilities/top.cpp | |
parent | b2b851b3615c1dbd8e344c8f7bcee7a833c67bee (diff) | |
download | serenity-db886fe18bad881c1e1064780937c75e92e52b5f.zip |
Userland+AK: Stop using getopt() for ArgsParser
This commit moves the implementation of getopt into AK, and converts its
API to understand and use StringView instead of char*.
Everything else is caught in the crossfire of making
Option::accept_value() take a StringView instead of a char const*.
With this, we must now pass a Span<StringView> to ArgsParser::parse(),
applications using LibMain are unaffected, but anything not using that
or taking its own argc/argv has to construct a Vector<StringView> for
this method.
Diffstat (limited to 'Userland/Utilities/top.cpp')
-rw-r--r-- | Userland/Utilities/top.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Userland/Utilities/top.cpp b/Userland/Utilities/top.cpp index ec575d317a..0f759c9c70 100644 --- a/Userland/Utilities/top.cpp +++ b/Userland/Utilities/top.cpp @@ -141,8 +141,7 @@ static void parse_args(Main::Arguments arguments, TopOption& top_option) "sort-by", 's', nullptr, - [&top_option](char const* s) { - StringView sort_by_option { s, strlen(s) }; + [&top_option](StringView sort_by_option) { if (sort_by_option == "pid"sv) top_option.sort_by = TopOption::SortBy::Pid; else if (sort_by_option == "tid"sv) |