Simple file IO with the ioctl syscall

This commit is contained in:
2025-09-05 19:56:27 +02:00
parent f42c4b7e44
commit fb5e88a175
16 changed files with 299 additions and 6 deletions

41
kernel/path/path.c Normal file
View File

@ -0,0 +1,41 @@
#include "path.h"
void path_parse(const char *in, char *mp, char *path) {
if (in == 0 || *in == 0) {
mp[0] = 0;
path[0] = 0;
return;
}
int i = 0, j = 0, colonfound = 0;
while (in[i]) {
if (in[i] == ':') {
if (colonfound) {
mp[0] = 0;
path[0] = 0;
return;
}
colonfound = 1;
mp[i] = 0;
i++;
continue;
}
if (!colonfound) {
mp[i] = in[i];
} else {
path[j++] = in[i];
}
i++;
}
if (!colonfound) {
mp[i] = 0;
path[0] = 0;
} else {
path[j] = 0;
}
}

6
kernel/path/path.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef PATH_PATH_H_
#define PATH_PATH_H_
void path_parse(const char *in, char *mp, char *path);
#endif // PATH_PATH_H_