Fixed "no capture" build. Hopefully.
authorvolpol <volpol@packet-gain.de>
Thu, 20 Aug 2020 09:51:01 +0000 (11:51 +0200)
committervolpol <volpol@packet-gain.de>
Wed, 9 Sep 2020 18:24:08 +0000 (20:24 +0200)
config.h
curly.c
itemq.c

index 11ccb4d2960f0cbd5c524470446a8720f7d142b4..67fa755bbf28170f0b4cfefaa5c933401d04ef17 100644 (file)
--- 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 43256701c7e7f9f5b56da641d4694e95c82af926..9537f77c08c79ebafbe22fa2ca98c74b1a551efc 100644 (file)
--- 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 652b2433ba398c9bae9010d187af7eee85ccaf46..080ee8927f58b297d3ff56434e68f0df5125c965 100644 (file)
--- 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