diff --git a/app.cpp b/app.cpp index f0f0d1d..51331ce 100644 --- a/app.cpp +++ b/app.cpp @@ -1,4 +1,4 @@ -#include +#include #include "core.cpp" int main(int argc, char **argv) { @@ -7,9 +7,15 @@ int main(int argc, char **argv) { Arena *arena = arenaAlloc(Megabytes(64)); list args = getArgs(arena, argc, argv); - { - log("teststr: %S :teststrend", strlit("teststring hahaha")); - }; + log(strSplit(arena, strlit("-"), strlit("hallo-world"))); + + while (true) { + size_t arenaPos = arena->head; + string line = PushString(arena, 128); + fgets(line.str, (int)line.length, stdin); + log(strSplit(arena, strlit("-"), line)); + arenaFreeFrom(arena, arenaPos); + } return statusCode; } diff --git a/core.cpp b/core.cpp index 03c8707..efa4328 100644 --- a/core.cpp +++ b/core.cpp @@ -222,7 +222,7 @@ list strSplit(Arena *arena, string splitStr, string inputStr) { size_t start = 0; void *beginning = (char *)arena->memory + arena->head; while (c < inputStr.length - splitStr.length) { - if (strEql(strSlice(inputStr, c, splitStr.length), splitStr)) { + if (strEql(strSlice(inputStr, c, c + splitStr.length), splitStr)) { string *splitString = PushStruct(arena, string); splitString->str = inputStr.str + start; splitString->length = c - start;