ladybird/Userland/pwd.cpp
Andreas Kling ec1d16b307 Add a "pwd" utility to userland.
It's implemented as a separate process. How cute is that.
Tasks now have a current working directory. Spawned tasks inherit their
parent task's working directory.
Currently everyone just uses "/" as there's no way to chdir().
2018-10-24 14:28:22 +02:00

16 lines
268 B
C++

#include <LibC/unistd.h>
#include <LibC/stdio.h>
int main(int c, char** v)
{
char buffer[1024];
char* ptr = getcwd(buffer, sizeof(buffer));
if (!ptr) {
printf("getcwd() failed\n");
return 1;
}
printf("%s\n", ptr);
return 0;
}