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
commit 2749e7f1c2
Notes: sideshowbarker 2024-07-19 18:38:22 +09:00
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) {