ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

fanftest.c
Go to the documentation of this file.
00001 /*
00002  * fanftest.c
00003  * - a small test program from Tony Finch
00004  */
00005 /*
00006  *  This file is
00007  *   Copyright (C) 1999 Tony Finch <dot@dotat.at>
00008  *   Copyright (C) 1999-2000 Ian Jackson <ian@davenant.greenend.org.uk>
00009  *
00010  *  It is part of adns, which is
00011  *    Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
00012  *    Copyright (C) 1999-2000 Tony Finch <dot@dotat.at>
00013  *
00014  *  This program is free software; you can redistribute it and/or modify
00015  *  it under the terms of the GNU General Public License as published by
00016  *  the Free Software Foundation; either version 2, or (at your option)
00017  *  any later version.
00018  *
00019  *  This program is distributed in the hope that it will be useful,
00020  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022  *  GNU General Public License for more details.
00023  *
00024  *  You should have received a copy of the GNU General Public License
00025  *  along with this program; if not, write to the Free Software Foundation,
00026  *  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00027  *
00028  * This version was originally supplied by Tony Finch, but has been
00029  * modified by Ian Jackson as it was incorporated into adns.
00030  */
00031 
00032 #ifdef ADNS_JGAA_WIN32
00033 # include "adns_win32.h"
00034 #else
00035 # include <sys/types.h>
00036 # include <sys/time.h>
00037 # include <string.h>
00038 # include <stdlib.h>
00039 # include <stdio.h>
00040 # include <errno.h>
00041 #endif
00042 
00043 #include "config.h"
00044 #include "adns.h"
00045 
00046 static const char *progname;
00047 
00048 static void aargh(const char *msg) {
00049   fprintf(stderr, "%s: %s: %s (%d)\n", progname, msg,
00050       strerror(errno) ? strerror(errno) : "Unknown error", errno);
00051   exit(1);
00052 }
00053 
00054 int main(int argc, char *argv[]) {
00055   adns_state adns;
00056   adns_query query;
00057   adns_answer *answer;
00058 
00059   progname= strrchr(*argv, '/');
00060   if (progname)
00061     progname++;
00062   else
00063     progname= *argv;
00064 
00065   if (argc != 2) {
00066     fprintf(stderr, "usage: %s <domain>\n", progname);
00067     exit(1);
00068   }
00069 
00070   errno= adns_init(&adns, adns_if_debug, 0);
00071   if (errno) aargh("adns_init");
00072 
00073   errno= adns_submit(adns, argv[1], adns_r_ptr,
00074              adns_qf_quoteok_cname|adns_qf_cname_loose,
00075              NULL, &query);
00076   if (errno) aargh("adns_submit");
00077 
00078   errno= adns_wait(adns, &query, &answer, NULL);
00079   if (errno) aargh("adns_init");
00080 
00081   printf("%s\n", answer->status == adns_s_ok ? *answer->rrs.str : "dunno");
00082 
00083   adns_finish(adns);
00084 
00085   return 0;
00086 }

Generated on Fri May 25 2012 04:31:58 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.