From 6f39c7145f19a2644d36bde00a77f7514e1f4545 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 27 Feb 2018 22:53:14 -0800 Subject: *: make buildable for windows w/mingw32 strndup is missing, add trivial implementation signals are missing so fps counter is disabled for now --- src/fps.c | 8 ++++++++ src/settings.c | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/fps.c b/src/fps.c index 99a3f85..57f67a7 100644 --- a/src/fps.c +++ b/src/fps.c @@ -17,6 +17,9 @@ static void sigalrm_handler(int signum) int fps_setup(void) { +#ifdef __WIN32__ + +#else struct itimerval interval = { .it_interval = { .tv_sec = 1, .tv_usec = 0 }, .it_value = { .tv_sec = 1, .tv_usec = 0 }, @@ -29,11 +32,15 @@ int fps_setup(void) return 0; return 1; +#endif } void fps_print(fb_t *fb) { +#ifdef __WIN32__ + +#else unsigned n; if (!print_fps) @@ -43,4 +50,5 @@ void fps_print(fb_t *fb) printf("FPS: %u\n", n); print_fps = 0; +#endif } diff --git a/src/settings.c b/src/settings.c index 7d87811..d8be774 100644 --- a/src/settings.c +++ b/src/settings.c @@ -5,6 +5,24 @@ #include #include "settings.h" +#include "util.h" + +#ifdef __WIN32__ +char * strndup(const char *s, size_t n) +{ + size_t len; + char *buf; + + len = MIN(strlen(s), n); + buf = calloc(len + 1, sizeof(char)); + if (!buf) + return NULL; + + memcpy(buf, s, len); + + return buf; +} +#endif /* Split form of key=value[,key=value...] settings string */ typedef struct settings_t { -- cgit v1.2.3