diff --git a/userspace/programs/CMakeLists.txt b/userspace/programs/CMakeLists.txt index 1a76d688..8808641a 100644 --- a/userspace/programs/CMakeLists.txt +++ b/userspace/programs/CMakeLists.txt @@ -31,6 +31,7 @@ set(USERSPACE_PROGRAMS nslookup poweroff ProgramLauncher + pwd resolver rm Shell diff --git a/userspace/programs/pwd/CMakeLists.txt b/userspace/programs/pwd/CMakeLists.txt new file mode 100644 index 00000000..2818d88b --- /dev/null +++ b/userspace/programs/pwd/CMakeLists.txt @@ -0,0 +1,8 @@ +set(SOURCES + main.cpp +) + +add_executable(pwd ${SOURCES}) +banan_link_library(pwd libc) + +install(TARGETS pwd OPTIONAL) diff --git a/userspace/programs/pwd/main.cpp b/userspace/programs/pwd/main.cpp new file mode 100644 index 00000000..76b45f06 --- /dev/null +++ b/userspace/programs/pwd/main.cpp @@ -0,0 +1,15 @@ +#include +#include +#include + +int main() +{ + char buffer[PATH_MAX]; + if (getcwd(buffer, PATH_MAX) == nullptr) + { + perror("getcwd"); + return 1; + } + + printf("%s\n", buffer); +}