mirror of
https://github.com/usatiuk/ficus.git
synced 2025-10-28 16:17:51 +01:00
init: hacky ls for now
This commit is contained in:
@@ -9,8 +9,9 @@
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void ls() {
|
||||
DIR *rfd = opendir("/");
|
||||
void ls(char *dname) {
|
||||
while (dname[0] == ' ' && dname[0] != '\0') dname++;
|
||||
DIR *rfd = opendir(dname);
|
||||
struct dirent *cur = readdir(rfd);
|
||||
while (cur) {
|
||||
printf("%s\n", cur->d_name);
|
||||
@@ -37,8 +38,8 @@ int main() {
|
||||
printf("\n> ");
|
||||
char line[30];
|
||||
scanf(" %24[^\n]", line);
|
||||
if (strcmp(line, "ls") == 0) {
|
||||
ls();
|
||||
if (strncmp(line, "ls", 2) == 0) {
|
||||
ls(line + 2);
|
||||
} else if (strcmp(line, "mem") == 0) {
|
||||
print_mem();
|
||||
} else if (strcmp(line, "tasks") == 0) {
|
||||
|
||||
Reference in New Issue
Block a user