miguelfreitas / twister-seeder

twister dns seeder
51 stars 25 forks source link

silentize seeder #3

Open slr opened 9 years ago

slr commented 9 years ago

what if we add -s option whose value goes to extern int bSilent; and some wrapper over vprintf() named writec() instead of printf()?

#include <stdarg.h>

…

void writec(char *fmt, ...) 
{
    if (!bSilent) {
        va_list msg;    // va_list defined in <stdarg.h>

        va_start(msg, fmt);
            vprintf(fmt, msg);
        va_end(msg);
    }
}

I'm far away from C and C++ yet, but I'm thinking I caught this right.

miguelfreitas commented 9 years ago

No objections, go ahead! :-)

slr commented 9 years ago

I looked in the code again and as I see we have printf defined as _myprintf in netbase.cpp:16 and there is a some declaration of that in util.h:97:

bool static inline my_printf(std::string err, ...) {
    return true;
}

can you guide me in next points: