summaryrefslogtreecommitdiff
path: root/Userland/Utilities/pidof.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Utilities/pidof.cpp')
-rw-r--r--Userland/Utilities/pidof.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Utilities/pidof.cpp b/Userland/Utilities/pidof.cpp
index eb576681c5..648754fb94 100644
--- a/Userland/Utilities/pidof.cpp
+++ b/Userland/Utilities/pidof.cpp
@@ -45,8 +45,8 @@ ErrorOr<int> serenity_main(Main::Arguments args)
TRY(Core::System::unveil(nullptr, nullptr));
bool single_shot = false;
- char const* omit_pid_value = nullptr;
- char const* process_name = nullptr;
+ StringView omit_pid_value;
+ StringView process_name;
Core::ArgsParser args_parser;
args_parser.add_option(single_shot, "Only return one pid", nullptr, 's');
@@ -56,11 +56,11 @@ ErrorOr<int> serenity_main(Main::Arguments args)
args_parser.parse(args);
pid_t pid_to_omit = 0;
- if (omit_pid_value) {
- if (!strcmp(omit_pid_value, "%PPID")) {
+ if (!omit_pid_value.is_empty()) {
+ if (omit_pid_value == "%PPID"sv) {
pid_to_omit = getppid();
} else {
- auto number = StringView { omit_pid_value, strlen(omit_pid_value) }.to_uint();
+ auto number = omit_pid_value.to_uint();
if (!number.has_value()) {
warnln("Invalid value for -o");
args_parser.print_usage(stderr, args.strings[0]);
@@ -69,5 +69,5 @@ ErrorOr<int> serenity_main(Main::Arguments args)
pid_to_omit = number.value();
}
}
- return pid_of(process_name, single_shot, omit_pid_value != nullptr, pid_to_omit);
+ return pid_of(process_name, single_shot, !omit_pid_value.is_empty(), pid_to_omit);
}