mirror of
https://github.com/usatiuk/ficus.git
synced 2025-10-28 16:17:51 +01:00
Compare commits
2 Commits
a4ff116382
...
03d74e2756
| Author | SHA1 | Date | |
|---|---|---|---|
| 03d74e2756 | |||
| fdd5e44092 |
@@ -12,6 +12,10 @@
|
||||
void ls(char *dname) {
|
||||
while (dname[0] == ' ' && dname[0] != '\0') dname++;
|
||||
DIR *rfd = opendir(dname);
|
||||
if (rfd == NULL) {
|
||||
printf("Unknown directory: %s\n", dname);
|
||||
return;
|
||||
}
|
||||
struct dirent *cur = readdir(rfd);
|
||||
while (cur) {
|
||||
printf("%s\n", cur->d_name);
|
||||
@@ -45,9 +49,11 @@ int main() {
|
||||
} else if (strcmp(line, "tasks") == 0) {
|
||||
print_tasks();
|
||||
} else {
|
||||
if (fork() == 0)
|
||||
if (fork() == 0) {
|
||||
execve(line, 0, 0);
|
||||
else
|
||||
printf("Failed to start: %s\n", line);
|
||||
return 0;
|
||||
} else
|
||||
wait(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user