summaryrefslogtreecommitdiff
path: root/Userland/Utilities/cut.cpp
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2023-02-21 15:14:41 +0330
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2023-02-28 15:52:24 +0330
commitdb886fe18bad881c1e1064780937c75e92e52b5f (patch)
tree40c8bdaed6f64580483ecc7d7b09bc29db6d7366 /Userland/Utilities/cut.cpp
parentb2b851b3615c1dbd8e344c8f7bcee7a833c67bee (diff)
downloadserenity-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/cut.cpp')
-rw-r--r--Userland/Utilities/cut.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Utilities/cut.cpp b/Userland/Utilities/cut.cpp
index c0c52b3d89..12c2c9323b 100644
--- a/Userland/Utilities/cut.cpp
+++ b/Userland/Utilities/cut.cpp
@@ -169,19 +169,19 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (selected_options_count == 0) {
warnln("cut: you must specify a list of bytes, or fields");
- args_parser.print_usage(stderr, arguments.strings[0].characters_without_null_termination());
+ args_parser.print_usage(stderr, arguments.strings[0]);
return 1;
}
if (selected_options_count > 1) {
warnln("cut: you must specify only one of bytes, or fields");
- args_parser.print_usage(stderr, arguments.strings[0].characters_without_null_termination());
+ args_parser.print_usage(stderr, arguments.strings[0]);
return 1;
}
if (delimiter.length() != 1) {
warnln("cut: the delimiter must be a single character");
- args_parser.print_usage(stderr, arguments.strings[0].characters_without_null_termination());
+ args_parser.print_usage(stderr, arguments.strings[0]);
return 1;
}
@@ -200,7 +200,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto expansion_successful = expand_list(ranges_list, ranges_vector);
if (!expansion_successful) {
- args_parser.print_usage(stderr, arguments.strings[0].characters_without_null_termination());
+ args_parser.print_usage(stderr, arguments.strings[0]);
return 1;
}