From 21bd87bb0723f122c4dbe859a34fe3e13dd73acb Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 6 Jul 2023 10:32:43 +0300 Subject: [PATCH] Userspace: Shell now has 'env' for printing environment --- userspace/Shell/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/userspace/Shell/main.cpp b/userspace/Shell/main.cpp index 2fb3da89..469ef158 100644 --- a/userspace/Shell/main.cpp +++ b/userspace/Shell/main.cpp @@ -15,6 +15,8 @@ struct termios old_termios, new_termios; +extern char** environ; + BAN::Optional parse_dollar(BAN::StringView command, size_t& i) { ASSERT(command[i] == '$'); @@ -178,6 +180,12 @@ int execute_command(BAN::Vector& args) ERROR_RETURN("setenv"); } } + else if (args.front() == "env"sv) + { + char** current = environ; + while (*current) + printf("%s\n", *current++); + } else if (args.front() == "cd"sv) { if (args.size() > 2)