Compare commits
No commits in common. "3cb478a7d266e2cc556fefcb36cd83323692be19" and "b15de193d572d0b7f8d695573b18580d899c2f61" have entirely different histories.
3cb478a7d2
...
b15de193d5
4
Makefile
4
Makefile
@ -33,13 +33,13 @@ 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
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(PORTLIBS)
|
||||
LIBDIRS :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
|
@ -4,10 +4,7 @@
|
||||
#include <network.h>
|
||||
#include <wiiuse/wpad.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "sandia/sandia.h"
|
||||
#include <jansson.h>
|
||||
|
||||
// Uncomment if this is a development build
|
||||
//#include "debug.h"
|
||||
@ -90,39 +87,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
else lastWasNewline = false;
|
||||
}
|
||||
printf("\n");
|
||||
printf("\n%s\n", res.body);
|
||||
sandia_close(&req);
|
||||
} else {
|
||||
logprint(0, "Network configuration failed :(\n");
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 62ea4d024fda8663463ddc20c13eec5e1c08b2de
|
||||
Subproject commit 9b383cdda825ab4ba2767102b06cbd5dc734dae9
|
Loading…
Reference in New Issue
Block a user