File: dump.c

package info (click to toggle)
rblcheck 20020316-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 516 kB
  • ctags: 38
  • sloc: ansic: 400; makefile: 135; sh: 39; awk: 27; perl: 12
file content (46 lines) | stat: -rw-r--r-- 965 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
** dump.c
**
** This little utility pulls in a DNS query, and dumps it, suitable for
** a hexdumper. :-) Just a little tool I find handy in a pinch.
**
** $Id: dump.c,v 1.6 2000/04/21 15:22:57 logic Exp $
**
** $Log: dump.c,v $
** Revision 1.6  2000/04/21 15:22:57  logic
** Update to current cvs tree.
**
** Revision 1.1  1998/01/27 02:10:34  emarshal
** Added dump.c, a quick utility for dumping an RR (sort of);
** suitable for hexdumping.
**
*/

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
#include <netdb.h>
#include <getopt.h>

int main( int argc, char * argv[] )
{
	int i;
	char domain[] = "2.0.0.127.rbl.maps.vix.com";
	u_char buf[ PACKETSZ ];

	/* Here we go... */
	res_init();
	res_query( domain, C_IN, T_TXT, buf, PACKETSZ );

	/* Was there a problem? */
	if( h_errno != 0 )
		return 0;

	for( i = 0; i < PACKETSZ; i++ )
		putc( buf[ i ], stdout );

	return 0;
}