mirror of
https://github.com/drasko/codezero.git
synced 2026-01-15 04:13:16 +01:00
Towards working mkdir.
This commit is contained in:
@@ -113,14 +113,12 @@ int lsdir(char *path)
|
||||
if ((fd = open(path, O_RDONLY)) < 0) {
|
||||
perror("OPEN");
|
||||
return 0;
|
||||
} else
|
||||
printf("OPEN OK.\n");
|
||||
}
|
||||
|
||||
if ((bytes = os_readdir(fd, dents, sizeof(struct dirent) * DENTS_TOTAL)) < 0) {
|
||||
printf("%s: GETDENTS failed.\n", __TASKNAME__);
|
||||
perror("GETDENTS\n");
|
||||
return 0;
|
||||
} else {
|
||||
printf("GETDENTS OK.\n");
|
||||
print_dirents(path, dents, bytes);
|
||||
}
|
||||
|
||||
@@ -135,6 +133,13 @@ int dirtest(void)
|
||||
printf("\nlsdir root directory:\n");
|
||||
lsdir("/");
|
||||
|
||||
printf("\nCreating directories: usr, etc, tmp, var, home, opt, bin, boot, lib, dev\n");
|
||||
if (mkdir("/usr", 0) < 0)
|
||||
perror("MKDIR");
|
||||
|
||||
printf("\nlsdir root directory:\n");
|
||||
lsdir("/");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user