diff --git a/userspace/programs/CMakeLists.txt b/userspace/programs/CMakeLists.txt index a66a8a7b..7f1a7b61 100644 --- a/userspace/programs/CMakeLists.txt +++ b/userspace/programs/CMakeLists.txt @@ -8,6 +8,7 @@ set(USERSPACE_PROGRAMS dhcp-client DynamicLoader echo + env getopt http-server id diff --git a/userspace/programs/env/CMakeLists.txt b/userspace/programs/env/CMakeLists.txt new file mode 100644 index 00000000..39f69fa7 --- /dev/null +++ b/userspace/programs/env/CMakeLists.txt @@ -0,0 +1,9 @@ +set(SOURCES + main.cpp +) + +add_executable(env ${SOURCES}) +banan_link_library(env ban) +banan_link_library(env libc) + +install(TARGETS env OPTIONAL) diff --git a/userspace/programs/env/main.cpp b/userspace/programs/env/main.cpp new file mode 100644 index 00000000..0adaf42b --- /dev/null +++ b/userspace/programs/env/main.cpp @@ -0,0 +1,13 @@ +#include + +extern char** environ; + +int main() +{ + if (!environ) + return 0; + char** current = environ; + while (*current) + printf("%s\n", *current++); + return 0; +}