(stot): constify
(type_to_string): always declare (dns_lookup_int): correct debug output git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5256 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -55,7 +55,7 @@ RCSID("$Id$");
|
|||||||
#define DECL(X) {#X, T_##X}
|
#define DECL(X) {#X, T_##X}
|
||||||
|
|
||||||
static struct stot{
|
static struct stot{
|
||||||
char *name;
|
const char *name;
|
||||||
int type;
|
int type;
|
||||||
}stot[] = {
|
}stot[] = {
|
||||||
DECL(A),
|
DECL(A),
|
||||||
@@ -81,6 +81,15 @@ string_to_type(const char *name)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const 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;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dns_free_data(struct dns_reply *r)
|
dns_free_data(struct dns_reply *r)
|
||||||
@@ -241,7 +250,7 @@ parse_reply(unsigned char *data, int len)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static struct dns_reply *
|
||||||
dns_lookup_int(const char *domain, int rr_class, int rr_type)
|
dns_lookup_int(const char *domain, int rr_class, int rr_type)
|
||||||
{
|
{
|
||||||
unsigned char reply[1024];
|
unsigned char reply[1024];
|
||||||
@@ -252,12 +261,14 @@ dns_lookup_int(const char *domain, int rr_class, int rr_type)
|
|||||||
if (_resolve_debug) {
|
if (_resolve_debug) {
|
||||||
old_options = _res.options;
|
old_options = _res.options;
|
||||||
_res.options |= RES_DEBUG;
|
_res.options |= RES_DEBUG;
|
||||||
fprintf(stderr, "dns_lookup(%s, %s)\n", domain, type_name);
|
fprintf(stderr, "dns_lookup(%s, %d, %s)\n", domain,
|
||||||
|
rr_class, type_to_string(rr_type));
|
||||||
}
|
}
|
||||||
len = res_search(domain, rr_class, rr_type, reply, sizeof(reply));
|
len = res_search(domain, rr_class, rr_type, reply, sizeof(reply));
|
||||||
if (_resolve_debug) {
|
if (_resolve_debug) {
|
||||||
_res.options = old_options;
|
_res.options = old_options;
|
||||||
fprintf(stderr, "dns_lookup(%s, %s) --> %d\n", domain, type_name, len);
|
fprintf(stderr, "dns_lookup(%s, %d, %s) --> %d\n",
|
||||||
|
domain, rr_class, type_to_string(rr_type), len);
|
||||||
}
|
}
|
||||||
if (len >= 0)
|
if (len >= 0)
|
||||||
r = parse_reply(reply, len);
|
r = parse_reply(reply, len);
|
||||||
@@ -295,16 +306,6 @@ 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)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user