X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=test%2Fephemeral.c;h=07db7ebd5322acd768db53e83a752126c14e315a;hb=ed210eb557e7fb5edbac89ff43a573ae84a941f9;hp=6921b53904a68a3dd556937cd1a62043ec2ce86f;hpb=6db507deb75ac73c0bae86e830372b532aec834e;p=meshlink diff --git a/test/ephemeral.c b/test/ephemeral.c index 6921b539..07db7ebd 100644 --- a/test/ephemeral.c +++ b/test/ephemeral.c @@ -1,28 +1,16 @@ +#ifdef NDEBUG +#undef NDEBUG +#endif + #include +#include #include #include #include "meshlink.h" +#include "utils.h" -void log_cb(meshlink_handle_t *mesh, meshlink_log_level_t level, const char *text) { - static struct timeval tv0; - struct timeval tv; - - if(tv0.tv_sec == 0) { - gettimeofday(&tv0, NULL); - } - - gettimeofday(&tv, NULL); - fprintf(stderr, "%u.%.03u ", (unsigned int)(tv.tv_sec - tv0.tv_sec), (unsigned int)tv.tv_usec / 1000); - - if(mesh) { - fprintf(stderr, "(%s) ", mesh->name); - } - - fprintf(stderr, "[%d] %s\n", level, text); -} - -int main() { +int main(void) { meshlink_set_log_cb(NULL, MESHLINK_DEBUG, log_cb); // Open two ephemeral meshlink instance. @@ -78,6 +66,4 @@ int main() { meshlink_close(mesh1); meshlink_close(mesh2); - - return 0; }