git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4820 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1998-04-26 14:35:43 +00:00
parent d05f5a436e
commit 131d80ad77

View File

@@ -81,17 +81,6 @@ string_to_type(const char *name)
return -1; return -1;
} }
#if 0
static char *
type_to_string(int type)
{
struct stot *p = stot;
for(p = stot; p->name; p++)
if(type == p->type)
return p->name;
return NULL;
}
#endif
void void
dns_free_data(struct dns_reply *r) dns_free_data(struct dns_reply *r)
@@ -294,6 +283,15 @@ dns_free_data(struct dns_reply *r)
#endif #endif
#ifdef TEST #ifdef TEST
static char *
type_to_string(int type)
{
struct stot *p = stot;
for(p = stot; p->name; p++)
if(type == p->type)
return p->name;
return NULL;
}
int int
main(int argc, char **argv) main(int argc, char **argv)
@@ -309,23 +307,23 @@ main(int argc, char **argv)
printf("%s %s %d ", rr->domain, type_to_string(rr->type), rr->ttl); printf("%s %s %d ", rr->domain, type_to_string(rr->type), rr->ttl);
switch(rr->type){ switch(rr->type){
case T_NS: case T_NS:
printf("%s\n", (char*)rr->data); printf("%s\n", (char*)rr->u.data);
break; break;
case T_A: case T_A:
printf("%d.%d.%d.%d\n", printf("%d.%d.%d.%d\n",
((unsigned char*)rr->data)[0], ((unsigned char*)rr->u.data)[0],
((unsigned char*)rr->data)[1], ((unsigned char*)rr->u.data)[1],
((unsigned char*)rr->data)[2], ((unsigned char*)rr->u.data)[2],
((unsigned char*)rr->data)[3]); ((unsigned char*)rr->u.data)[3]);
break; break;
case T_MX: case T_MX:
case T_AFSDB:{ case T_AFSDB:{
struct mx_record *mx = (struct mx_record*)rr->data; struct mx_record *mx = (struct mx_record*)rr->u.data;
printf("%d %s\n", mx->preference, mx->domain); printf("%d %s\n", mx->preference, mx->domain);
break; break;
} }
case T_SRV:{ case T_SRV:{
struct srv_record *srv = (struct srv_record*)rr->data; struct srv_record *srv = (struct srv_record*)rr->u.data;
printf("%d %d %d %s\n", srv->priority, srv->weight, printf("%d %d %d %s\n", srv->priority, srv->weight,
srv->port, srv->target); srv->port, srv->target);
break; break;