diff --git a/fs/vfs.c b/fs/vfs.c index 67fab90..8bec11c 100644 --- a/fs/vfs.c +++ b/fs/vfs.c @@ -53,6 +53,7 @@ int read(int fd, void *buf, size_t count) int open(const char *pathname, int flags) { + char *strtok_last = NULL; return 0; } diff --git a/lib/string.c b/lib/string.c index 63eca35..f074fdd 100644 --- a/lib/string.c +++ b/lib/string.c @@ -122,21 +122,20 @@ char *strchr(const char *s, int c) char *strtok(char *str, const char *delim, char **llast) { - char *last = *llast; if (str) - last = str; + (*llast) = str; - if (!last) + if (!(*llast)) return NULL; - char *ret = last; - while (*last) { - if (strchr(delim, *last)) { - *last = 0; - last++; + char *ret = (*llast); + while (*(*llast)) { + if (strchr(delim, *(*llast))) { + *(*llast) = 0; + (*llast)++; return ret; } - last++; + (*llast)++; } return ret;