diff options
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/sysctl.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Userland/sysctl.cpp b/Userland/sysctl.cpp index 5eaa76b5eb..c4647ae354 100644 --- a/Userland/sysctl.cpp +++ b/Userland/sysctl.cpp @@ -114,10 +114,16 @@ int main(int argc, char** argv) Core::ArgsParser args_parser; args_parser.add_option(show_all, "Show all variables", nullptr, 'a'); - args_parser.add_positional_argument(var, "Command (var[=value])", "command"); + args_parser.add_positional_argument(var, "Command (var[=value])", "command", Core::ArgsParser::Required::No); args_parser.parse(argc, argv); + if (var == nullptr) { + // Not supplied; assume `-a`. + show_all = true; + } + if (show_all) { + // Ignore `var`, even if it was supplied. Just like the real procps does. return handle_show_all(); } |