Created
June 21, 2019 15:09
-
-
Save tsutsui/30e9d90bcb508e47c3b8f56c38909536 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Makefile b/Makefile | |
index ac1828f..9563b29 100644 | |
--- a/Makefile | |
+++ b/Makefile | |
@@ -1,8 +1,10 @@ | |
TARGET = nanotodon | |
OBJS_TARGET = nanotodon.o | |
+SRCS = nanotodon.c | |
-CFLAGS = -g | |
-LDFLAGS = | |
+CFLAGS = -g -O2 | |
+CFLAGS+= -I/usr/pkg/include -I/usr/pkg/include/ncursesw | |
+LDFLAGS = -L/usr/pkg/lib -Wl,-R/usr/pkg/lib | |
LIBS = -lc -lm -lcurl -ljson-c -lncursesw -lpthread | |
include Makefile.in | |
diff --git a/Makefile.in b/Makefile.in | |
index db3c8f3..ed7dffa 100644 | |
--- a/Makefile.in | |
+++ b/Makefile.in | |
@@ -7,23 +7,24 @@ CP = cp | |
# default | |
-default : | |
- $(MAKE) $(TARGET) | |
+default : $(TARGET) | |
# rules | |
$(TARGET) : $(OBJS_TARGET) Makefile Makefile.in | |
$(GCC) $(OBJS_TARGET) $(LDFLAGS) $(LIBS) -o $(TARGET) | |
+$(OBJS_TARGET): $(SRCS) | |
+ | |
# normal rules | |
-%.o : %.c Makefile Makefile.in | |
- $(GCC) -c $(CFLAGS) -o $*.o $*.c | |
+.c.o : Makefile Makefile.in | |
+ $(GCC) -c $(CFLAGS) -o $@ $< | |
-%.o : %.cpp Makefile Makefile.in | |
- $(GPP) -c $(CFLAGS) -o $*.o $*.cpp | |
+.cpp.o : Makefile Makefile.in | |
+ $(GPP) -c $(CFLAGS) -o $@ $< | |
# commands | |
clean : | |
- -$(RM) *.o | |
+ -$(RM) -f *.o $(TARGET) | |
diff --git a/nanotodon.c b/nanotodon.c | |
index 25f15ec..7965ff6 100644 | |
--- a/nanotodon.c | |
+++ b/nanotodon.c | |
@@ -7,6 +7,8 @@ | |
#include <locale.h> // setlocale | |
#include <ncurses.h> | |
//#include <ncursesw/curses.h> | |
+#include <pthread.h> | |
+#include <json-c/json_object.h> | |
char *streaming_json = NULL; | |
@@ -14,6 +16,8 @@ char *streaming_json = NULL; | |
void (*streaming_recieved_handler)(void); | |
void (*stream_event_handler)(struct json_object *); | |
+void do_htl(void); | |
+void stream_event_update(struct json_object *); | |
WINDOW *scr; | |
WINDOW *pad; | |
@@ -177,7 +181,7 @@ void stream_event_update(struct json_object *jobj_from_string) | |
wattroff(scr, COLOR_PAIR(2)); | |
waddstr(scr, "\n"); | |
- char *src = json_object_get_string(content); | |
+ const char *src = json_object_get_string(content); | |
/*waddstr(scr, src); | |
waddstr(scr, "\n");*/ | |
@@ -586,7 +590,7 @@ size_t htl_callback(void* ptr, size_t size, size_t nmemb, void* data) { | |
return realsize; | |
} | |
-void do_htl() | |
+void do_htl(void) | |
{ | |
CURLcode ret; | |
CURL *hnd; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment