diff options
| author | Lexi Winter <ivy@FreeBSD.org> | 2025-06-16 02:43:15 +0100 |
|---|---|---|
| committer | Lexi Winter <ivy@FreeBSD.org> | 2025-06-16 02:43:15 +0100 |
| commit | 8129d0ef4629f44cd89e3b79e8b66129bb9dc866 (patch) | |
| tree | 271a7698c45d301a6f89f79fb1f2d0cac62f39da /liblfjail/command_map.cc | |
| parent | 737fb60605e8b9c64d6dd9e4c982a4e7ee2ef5d3 (diff) | |
| download | lfjail-8129d0ef4629f44cd89e3b79e8b66129bb9dc866.tar.gz lfjail-8129d0ef4629f44cd89e3b79e8b66129bb9dc866.tar.bz2 | |
updates
Diffstat (limited to 'liblfjail/command_map.cc')
| -rw-r--r-- | liblfjail/command_map.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/liblfjail/command_map.cc b/liblfjail/command_map.cc index 96883a0..82b2fe0 100644 --- a/liblfjail/command_map.cc +++ b/liblfjail/command_map.cc @@ -23,13 +23,13 @@ struct node { node(std::string command); // Run the handler for this node. - int invoke(context const &ctx, int argc, char **argv) const; + auto invoke(context const &ctx, int argc, char **argv) const -> int; // Create a new node under this one, or return it if it already exists. // If path is empty, return this node. - node &create_node(std::string_view path); + auto create_node(std::string_view path) -> node&; - void print_usage(std::string prefix) const; + auto print_usage(std::string prefix) const -> void; private: std::map<std::string_view, node> commands; @@ -50,7 +50,7 @@ auto node::invoke(context const &ctx, int argc, char **argv) const -> int { auto const &child = it->second; // If the child has a handler, invoke it. - if (child.handler) + if (child.handler != nullptr) return child.handler->invoke(ctx, argc, argv); --argc; @@ -84,7 +84,7 @@ auto node::create_node(std::string_view path) -> node& { } void node::print_usage(std::string prefix) const { - if (handler) + if (handler != nullptr) std::print("{}{}\n", prefix, command); for (auto const &it : commands) |
