1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:17:35 +00:00

Implement sys$chdir() and teach sh+ls to cd around and browse different dirs.

This commit is contained in:
Andreas Kling 2018-10-26 14:24:11 +02:00
parent ac738b03d6
commit 2749e7f1c2
16 changed files with 147 additions and 33 deletions

View file

@ -4,14 +4,14 @@
int main(int c, char** v)
{
DIR* dirp = opendir("/");
DIR* dirp = opendir(".");
if (!dirp) {
printf("opendir failed :(\n");
return 1;
}
char pathbuf[256];
while (auto* de = readdir(dirp)) {
sprintf(pathbuf, "/%s", de->d_name);
sprintf(pathbuf, "%s", de->d_name);
stat st;
int rc = lstat(pathbuf, &st);
if (rc == -1) {