forked from Bananymous/banan-os
Userspace: Shell now has 'env' for printing environment
This commit is contained in:
parent
79450df04c
commit
21bd87bb07
|
@ -15,6 +15,8 @@
|
||||||
|
|
||||||
struct termios old_termios, new_termios;
|
struct termios old_termios, new_termios;
|
||||||
|
|
||||||
|
extern char** environ;
|
||||||
|
|
||||||
BAN::Optional<BAN::String> parse_dollar(BAN::StringView command, size_t& i)
|
BAN::Optional<BAN::String> parse_dollar(BAN::StringView command, size_t& i)
|
||||||
{
|
{
|
||||||
ASSERT(command[i] == '$');
|
ASSERT(command[i] == '$');
|
||||||
|
@ -178,6 +180,12 @@ int execute_command(BAN::Vector<BAN::String>& args)
|
||||||
ERROR_RETURN("setenv");
|
ERROR_RETURN("setenv");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (args.front() == "env"sv)
|
||||||
|
{
|
||||||
|
char** current = environ;
|
||||||
|
while (*current)
|
||||||
|
printf("%s\n", *current++);
|
||||||
|
}
|
||||||
else if (args.front() == "cd"sv)
|
else if (args.front() == "cd"sv)
|
||||||
{
|
{
|
||||||
if (args.size() > 2)
|
if (args.size() > 2)
|
||||||
|
|
Loading…
Reference in New Issue