diff --git a/common.h b/common.h index 6d1eeb0257d9813fd6bf2358f952ca8397958762..8d20ba87b67ce958a19cb17de2faeab9bca15f18 100644 --- a/common.h +++ b/common.h @@ -20,6 +20,14 @@ #include <libubox/blobmsg.h> #include <libubus.h> +extern int debug; + +#define debug_print(...) \ + do \ + { \ + if (debug) \ + fprintf(stderr, __VA_ARGS__); \ + } while (0) /** * Function: print_to_ubus * diff --git a/dongle.c b/dongle.c index 89c3ea8507baa8620bac2f3d62906c7082b49371..b7535475c7ea65b0f9ab825a443102be15a913a6 100644 --- a/dongle.c +++ b/dongle.c @@ -4,6 +4,7 @@ #include "dongle_network.h" struct ubus_context *ctx; +int debug; static struct option long_options[] = { diff --git a/libmobile.h b/libmobile.h index 6809833248c884c01f28f8863ba27b32030864a0..b5c3b4afc5ddc268a7ed16a3ed4f5cca8f49ce7a 100644 --- a/libmobile.h +++ b/libmobile.h @@ -4,16 +4,6 @@ #include <json-c/json.h> #include <string.h> -int debug; -//#define DEBUG 1 //how to define from some sort of config? there is no main? -#define debug_print(...) \ - do \ - { \ - if (debug) \ - fprintf(stderr, __VA_ARGS__); \ - } while (0) - - /*************************************************** * Libmobile - A 4G Dongle library * @@ -269,4 +259,4 @@ struct json_object *mobile_set_pin(char *current_pin, char *new_pin); * NULL on failure. */ struct json_object *mobile_disable_pin(char *pin); -#endif \ No newline at end of file +#endif