summaryrefslogtreecommitdiff
path: root/userland/libc/string/strtok.c
diff options
context:
space:
mode:
Diffstat (limited to 'userland/libc/string/strtok.c')
-rw-r--r--userland/libc/string/strtok.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/userland/libc/string/strtok.c b/userland/libc/string/strtok.c
index 7b8d0e3..a4a9d0f 100644
--- a/userland/libc/string/strtok.c
+++ b/userland/libc/string/strtok.c
@@ -7,18 +7,20 @@ char *strtok(char *restrict s, const char *restrict sep) {
strtok_s = s;
return strtok(NULL, sep);
}
- if(!strtok_s)
- return NULL;
+ if (!strtok_s) {
+ return NULL;
+ }
char *e = strpbrk(strtok_s, sep);
if (!e) {
- char *r = strtok_s;
- strtok_s = NULL;
+ char *r = strtok_s;
+ strtok_s = NULL;
return r;
}
*e = '\0';
e--;
- for (; *sep; sep++)
+ for (; *sep; sep++) {
e++;
+ }
e++;
char *r = strtok_s;
strtok_s = e;