From ff03e05897ac6f739749504fb3d80459b112a679 Mon Sep 17 00:00:00 2001 From: volpol Date: Thu, 20 Aug 2020 11:51:01 +0200 Subject: [PATCH] Fixed "no capture" build. Hopefully. --- config.h | 7 +++---- curly.c | 4 ++++ itemq.c | 10 ++++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/config.h b/config.h index 11ccb4d..67fa755 100644 --- a/config.h +++ b/config.h @@ -1,9 +1,8 @@ #define USE_TCP #define USE_MEMFILE -#define USE_CAPTURE -#if defined (__WIN32__) - #define SIGNAL_CAPTURE (0) -#else + +#if !defined (__WIN32__) + #define USE_CAPTURE #define SIGNAL_CAPTURE SIGUSR1 #endif diff --git a/curly.c b/curly.c index 4325670..9537f77 100644 --- a/curly.c +++ b/curly.c @@ -82,6 +82,8 @@ int curly_start_capture(void){ return (NULL != capf) ? 0 : -1; } +#else +void curly_set_cap_base(const char *s){ (void)s; } #endif #ifdef USE_TCP @@ -127,7 +129,9 @@ size_t fetch_send(void *ptr, size_t size, size_t nmemb, void *stream) { if (flag_conn) { sent = send(conn, ptr, bytesize, MSG_NOSIGNAL); +#ifdef USE_CAPTURE if (capf) fwrite(ptr, size, nmemb, capf); +#endif if (sent <= 0) { DPRINT("Pious Teardown!\n"); #if defined (__WIN32__) diff --git a/itemq.c b/itemq.c index 652b243..080ee89 100644 --- a/itemq.c +++ b/itemq.c @@ -404,7 +404,11 @@ static void cap_isr(void){ #endif void parse_config (int argc, char *argv[]){ +#ifdef USE_CAPTURE const char *ostr = "r:c:di:a:u:"; +#else + const char *ostr = "r:di:a:u:"; +#endif int opt; while ( -1 != ( opt = getopt( argc, argv, ostr ) ) ){ @@ -412,9 +416,11 @@ void parse_config (int argc, char *argv[]){ case 'r': config.refresh_interval = atoi(optarg); break; +#ifdef USE_CAPTURE case 'c': config.cap_base = optarg; break; +#endif case 'd': config.disable_bwhint = 1; break; @@ -436,7 +442,9 @@ void parse_config (int argc, char *argv[]){ printf ("Max BW: %d\n", config.maxbw); printf ("Use BW hint: %s\n", config.disable_bwhint ? "no" : "yes"); printf ("Refresh: %d\n", config.refresh_interval); +#ifdef USE_CAPTURE printf ("Capture basename: %s\n", config.cap_base); +#endif printf ("Master URL: %s\n",config.master_url); } @@ -450,7 +458,9 @@ int main(int argc, char *argv[]) { parse_config (argc, argv); strcpy(url, config.master_url); +#ifdef USE_CAPTURE curly_set_cap_base(config.cap_base); +#endif refresh_interval = config.refresh_interval; //may be override by m3u if 0 -- 2.30.2