diff --git a/.gitmodules b/.gitmodules index c05a6d4..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "source/sandia"] - path = source/sandia - url = https://git.donut.eu.org/libreshop/sandia-Wii.git diff --git a/Makefile b/Makefile index 8a93863..4992e30 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lwiiuse -lbte -logc -lm -ljansson +LIBS := -lwiiuse -lbte -logc -lm -lsandia -ljansson #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing diff --git a/source/main.c b/source/main.c index 03e1abb..e0e4d67 100644 --- a/source/main.c +++ b/source/main.c @@ -5,8 +5,7 @@ #include #include #include - -#include "sandia/sandia.h" +#include #include "input_macros.h" @@ -90,38 +89,20 @@ int main(int argc, char **argv) { printf("%s.\n", localip); sandia req = sandia_create("libreshop.donut.eu.org", 80); - sandia_response res = sandia_get_request(&req, "/"); - bool lastWasNewline = false; - int resBodyLength = strlen(res.body); - for (int i = 0; i < resBodyLength; i++) { - if (res.body[i] == '\r') continue; + sandia_response res = sandia_get_request(&req, "/", true, true); - if (res.body[i] == '\n') { - if (lastWasNewline) { - int rBL = resBodyLength - i; - char* body = malloc(rBL); - for (int j = 0; j < rBL; j++) { - body[j] = res.body[j + i + 1]; - } - - json_error_t error; - json_t *root = json_loads(body, 0, &error); - if (!root || !json_is_array(root)) { - printf("failed decoding\n"); - } - else { - printf("%s\n", body); - for (int j = 0; j < json_array_size(root); j++) { - json_t *data = json_array_get(root, j); - printf("%s\n", json_string_value(data)); - } - } - - break; - } - else lastWasNewline = true; + json_error_t error; + json_t *root = json_loads(res.body, 0, &error); + + if (!root || !json_is_array(root)) { + printf("failed decoding\n"); + } + else { + printf("%s\n", res.body); + for (int j = 0; j < json_array_size(root); j++) { + json_t *data = json_array_get(root, j); + printf("%s\n", json_string_value(data)); } - else lastWasNewline = false; } printf("\n"); sandia_close(&req); diff --git a/source/sandia b/source/sandia deleted file mode 160000 index 8f4d624..0000000 --- a/source/sandia +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8f4d62429b06bb851f03c21c7796ae69f78541a8