46#ifdef ADNS_REGRESS_TEST
47# include "hredirect.h"
118 if (
printf(
"usage: adnsresfilter [<options ...>]\n"
119 " adnsresfilter -h|--help | --version\n"
120 "options: -t<milliseconds>|--timeout <milliseconds>\n"
121 " -w|--wait (always wait for queries to time out or fail)\n"
122 " -b|--brackets (require [...] around IP addresses)\n"
123 " -a|--address (always include [address] in output)\n"
124 " -u|--unchecked (do not forward map for checking)\n"
125 " --config <text> (use this instead of resolv.conf)\n"
126 " --debug (turn on adns resolver debugging)\n"
127 "Timeout is the maximum amount to delay any particular bit of output for.\n"
128 "Lookups will go on in the background. Default timeout = 1000 (ms).\n")
149 if (*ep)
usageerr(
"invalid timeout");
157 if (
arg[0] !=
'-')
usageerr(
"no non-option arguments are allowed");
184 while ((
c= *++
arg)) {
241 while (
entry->textlen) {
252 if (!
entry->textlen) {
277 entry->textlen= newlen;
322 if (!searchfound)
sysfail(
"tsearch");
323 foundthing= *searchfound;
329 rrt,0,foundthing,&foundthing->
qu);
337 entry->addr= foundthing;
351 char readbuf[512], *
p;
354 while ((
r=
read(0,readbuf,
sizeof(readbuf))) <= 0) {
359 for (
p=readbuf;
r>0;
r--,
p++) {
367 }
else if (
cbyte>=0 && inbyte<3 && c>=
'0' &&
c<=
'9' &&
372 }
else if (
cbyte>=0 && cbyte<3 && inbyte>0 &&
c==
'.') {
413 fd_set readfds, writefds, exceptfds;
429 if (
entry->addr->ans) {
430 if (
entry->addr->ans->nrrs)
455 r=
select(maxfd,&readfds,&writefds,&exceptfds,tv);
int strcmp(const char *String1, const char *String2)
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
ADNS_API void adns_finish(adns_state ads)
ADNS_API void adns_beforeselect(adns_state ads, int *maxfd, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval **tv_mod, struct timeval *tv_buf, const struct timeval *now)
ADNS_API int adns_check(adns_state ads, adns_query *query_io, adns_answer **answer_r, void **context_r)
ADNS_API int adns_init(adns_state *newstate_r, adns_initflags flags, FILE *diagfile)
ADNS_API void adns_afterselect(adns_state ads, int maxfd, const fd_set *readfds, const fd_set *writefds, const fd_set *exceptfds, const struct timeval *now)
ADNS_API int adns_submit_reverse(adns_state ads, const struct sockaddr *addr, adns_rrtype type, adns_queryflags flags, void *context, adns_query *query_r)
ADNS_API int adns_init_strcfg(adns_state *newstate_r, adns_initflags flags, FILE *diagfile, const char *configtext)
#define gettimeofday(tv, tz)
#define ADNS_CAPTURE_ERRNO
static void startaddr(void)
static adns_initflags initflags
static void procaddr(void)
struct outqueuenode * tail
static void queueoutchar(int c)
static void * xmalloc(size_t sz)
static void writestdout(struct outqueuenode *entry)
static void usageerr(const char *why) NONRETURNING
static void outputerr(void)
static struct treething * newthing
static int nonblock(int fd, int isnonblock)
static const char * config_text
static struct timeval printbefore
static int comparer(const void *a, const void *b)
static void parseargs(const char *const *argv)
static void replacetextwithname(struct outqueuenode *entry)
static char addrtextbuf[14]
static void settimeout(const char *arg)
static void queueoutstr(const char *str, int len)
static void sysfail(const char *what) NONRETURNING
static void startup(void)
static unsigned char bytes[4]
static void readstdin(void)
static struct sockaddr_in sa
static void adnsfail(const char *what, int e) NONRETURNING
void quitnow(int exitstatus)
static void checkadnsqueries(void)
static int peroutqueuenode
static struct @4219 outqueue
struct outqueuenode * head
static void restartbuf(void)
#define timercmp(tvp, uvp, cmp)
#define VERSION_PRINT_QUIT(program)
INT WSAAPI select(IN INT s, IN OUT LPFD_SET readfds, IN OUT LPFD_SET writefds, IN OUT LPFD_SET exceptfds, IN CONST struct timeval *timeout)
GLdouble GLdouble GLdouble r
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
_Check_return_ _CRTIMP int __cdecl isalnum(_In_ int _C)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_opt_ _CRTIMP int __cdecl fflush(_Inout_opt_ FILE *_File)
#define memcpy(s1, s2, n)
#define sprintf(buf, format,...)
const char * strerror(int err)
#define LIST_UNLINK(list, node)
#define LIST_LINK_TAIL(list, node)
struct timeval printbefore
struct outqueuenode * next
struct outqueuenode * back
static void timevaladd(struct timeval *tv_io, long ms)
#define FD_ISSET(fd, set)