ReactOS  0.4.15-dev-1150-g593bcce
fanftest.c File Reference
#include <sys/types.h>
#include <sys/time.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include "config.h"
#include "adns.h"
Include dependency graph for fanftest.c:

Go to the source code of this file.

Functions

static void aargh (const char *msg)
 
int main (int argc, char *argv[])
 

Variables

static const charprogname
 

Function Documentation

◆ aargh()

static void aargh ( const char msg)
static

Definition at line 48 of file fanftest.c.

48  {
49  fprintf(stderr, "%s: %s: %s (%d)\n", progname, msg,
50  strerror(errno) ? strerror(errno) : "Unknown error", errno);
51  exit(1);
52 }
int errno
const char * strerror(int err)
Definition: compat_str.c:23
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static const char * progname
Definition: fanftest.c:46
#define msg(x)
Definition: auth_time.c:54
FILE * stderr
void exit(int exitcode)
Definition: _exit.c:33

Referenced by main().

◆ main()

int main ( int argc  ,
char argv[] 
)

hosttype.c Copyright (C) 2002 by Brian Palmer brian.nosp@m.p@sg.nosp@m.inet..nosp@m.com

Definition at line 54 of file fanftest.c.

54  {
55  adns_state adns;
57  adns_answer *answer;
58 
59  progname= strrchr(*argv, '/');
60  if (progname)
61  progname++;
62  else
63  progname= *argv;
64 
65  if (argc != 2) {
66  fprintf(stderr, "usage: %s <domain>\n", progname);
67  exit(1);
68  }
69 
70  errno= adns_init(&adns, adns_if_debug, 0);
71  if (errno) aargh("adns_init");
72 
73  errno= adns_submit(adns, argv[1], adns_r_ptr,
75  NULL, &query);
76  if (errno) aargh("adns_submit");
77 
78  errno= adns_wait(adns, &query, &answer, NULL);
79  if (errno) aargh("adns_init");
80 
81  printf("%s\n", answer->status == adns_s_ok ? *answer->rrs.str : "dunno");
82 
83  adns_finish(adns);
84 
85  return 0;
86 }
static int argc
Definition: ServiceArgs.c:12
ADNS_API void adns_finish(adns_state ads)
Definition: setup.c:650
int errno
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
#define argv
Definition: mplay32.c:18
static void aargh(const char *msg)
Definition: fanftest.c:48
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
char ** str
Definition: adns.h:320
adns_status status
Definition: adns.h:311
union adns_answer::@3958 rrs
static const char * progname
Definition: fanftest.c:46
ADNS_API int adns_init(adns_state *newstate_r, adns_initflags flags, FILE *diagfile)
Definition: setup.c:568
ADNS_API int adns_submit(adns_state ads, const char *owner, adns_rrtype type, adns_queryflags flags, void *context, adns_query *query_r)
Definition: query.c:204
FILE * stderr
void exit(int exitcode)
Definition: _exit.c:33
ADNS_API int adns_wait(adns_state ads, adns_query *query_io, adns_answer **answer_r, void **context_r)
Definition: event.c:696
GLenum query
Definition: glext.h:7781
#define printf
Definition: config.h:203

Variable Documentation

◆ progname

const char* progname
static

Definition at line 46 of file fanftest.c.

Referenced by aargh(), and main().