userspace: Implement pwd utility
This commit is contained in:
parent
fc730679ed
commit
acd792d8b4
|
|
@ -31,6 +31,7 @@ set(USERSPACE_PROGRAMS
|
||||||
nslookup
|
nslookup
|
||||||
poweroff
|
poweroff
|
||||||
ProgramLauncher
|
ProgramLauncher
|
||||||
|
pwd
|
||||||
resolver
|
resolver
|
||||||
rm
|
rm
|
||||||
Shell
|
Shell
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
set(SOURCES
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(pwd ${SOURCES})
|
||||||
|
banan_link_library(pwd libc)
|
||||||
|
|
||||||
|
install(TARGETS pwd OPTIONAL)
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
#include <limits.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
char buffer[PATH_MAX];
|
||||||
|
if (getcwd(buffer, PATH_MAX) == nullptr)
|
||||||
|
{
|
||||||
|
perror("getcwd");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%s\n", buffer);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue