Simple file IO with the ioctl syscall
This commit is contained in:
41
kernel/path/path.c
Normal file
41
kernel/path/path.c
Normal 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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user