From 30b9acd08724b50b85de8c799a00fbfb8020468f Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Fri, 7 Nov 2014 13:12:48 +0100 Subject: [PATCH] miniupnpc-async: reduce output when not compiled with -DDEBUG --- miniupnpc-async/miniupnpc-async.c | 4 ++-- miniupnpc-async/testasync.c | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/miniupnpc-async/miniupnpc-async.c b/miniupnpc-async/miniupnpc-async.c index f641208..c3e70c3 100644 --- a/miniupnpc-async/miniupnpc-async.c +++ b/miniupnpc-async/miniupnpc-async.c @@ -1,4 +1,4 @@ -/* $Id: miniupnpc-async.c,v 1.18 2014/11/07 11:25:52 nanard Exp $ */ +/* $Id: miniupnpc-async.c,v 1.19 2014/11/07 12:05:40 nanard Exp $ */ /* miniupnpc-async * Copyright (c) 2008-2014, Thomas BERNARD * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ @@ -490,7 +490,7 @@ static int upnpc_parse_headers(upnpc_t * p) } else if(p->http_response[i + 1] == '\r' || p->http_response[i + 1] == '\n') { if(colon > linestart && valuestart > colon) { - printf("header='%.*s', value='%.*s'\n", + debug_printf("header='%.*s', value='%.*s'\n", colon-linestart, p->http_response+linestart, i+1-valuestart, p->http_response+valuestart); if(0==strncasecmp(p->http_response+linestart, "content-length", colon-linestart)) { diff --git a/miniupnpc-async/testasync.c b/miniupnpc-async/testasync.c index 2c899a4..7300e9a 100644 --- a/miniupnpc-async/testasync.c +++ b/miniupnpc-async/testasync.c @@ -1,4 +1,4 @@ -/* $Id: testasync.c,v 1.13 2014/11/07 11:25:52 nanard Exp $ */ +/* $Id: testasync.c,v 1.14 2014/11/07 12:07:38 nanard Exp $ */ /* miniupnpc-async * Copyright (c) 2008-2014, Thomas BERNARD * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ @@ -61,13 +61,19 @@ int main(int argc, char * * argv) timeout.tv_sec = 0; timeout.tv_usec = 0; #endif +#if DEBUG printf("select(%d, ...);\n", nfds+1); +#endif /* DEBUG */ if(select(nfds+1, &readfds, &writefds, NULL, NULL/*&timeout*/) < 0) { perror("select"); return 1; } r = upnpc_process(&upnp); +#if DEBUG printf("upnpc_process returned %d\n", r); +#endif /* DEBUG */ + if(r < 0) + break; if(upnp.state == EReady) { char * p; printf("Process UPnP IGD Method results : HTTP %d\n", upnp.http_response_code);