X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=client%2Fadnslogres.c;h=b8e5f52a000b2553d50d1e2b8bcf369dc838ee10;hb=5a0be2445e09e1d0fc6ae995b6c0296bc28e657d;hp=d5f0e369a3354bacf3d13257ccf72a087623e431;hpb=7c4090270e6de67aee4a27b20c184826299bd1bf;p=adns.git diff --git a/client/adnslogres.c b/client/adnslogres.c index d5f0e36..b8e5f52 100644 --- a/client/adnslogres.c +++ b/client/adnslogres.c @@ -42,7 +42,9 @@ static const char * const cvsid = #include #include #include +#include +#include "config.h" #include "adns.h" /* maximum number of concurrent DNS queries */ @@ -57,12 +59,21 @@ static const char * const cvsid = static const char *progname; -#define msg(fmt, args...) fprintf(stderr, "%s: " fmt "\n", progname, ##args) #define guard_null(str) ((str) ? (str) : "") #define sensible_ctype(type,ch) (type((unsigned char)(ch))) /* isfoo() functions from ctype.h can't safely be fed char - blech ! */ +static void msg(const char *fmt, ...) { + va_list al; + + fprintf(stderr, "%s: ", progname); + va_start(al,fmt); + vfprintf(stderr, fmt, al); + va_end(al); + fputc('\n',stderr); +} + static void aargh(const char *cause) { const char *why = strerror(errno); if (!why) why = "Unknown error"; @@ -160,13 +171,14 @@ static void proclog(FILE *inf, FILE *outf, int opts) { if (opts & OPT_DEBUG) msg("%d in queue; checking %.*s", len, head->rest-head->addr, guard_null(head->addr)); - if (eof || len > MAXPENDING) + if (eof || len > MAXPENDING) { if (opts & OPT_POLL) err= adns_wait_poll(adns, &head->query, &answer, NULL); else err= adns_wait(adns, &head->query, &answer, NULL); - else + } else { err= adns_check(adns, &head->query, &answer, NULL); + } if (err != EAGAIN) { printline(outf, head->start, head->addr, head->rest, answer->status == adns_s_ok ? *answer->rrs.str : NULL);