projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add ifdef DEBUG around debugging code, res_init() now returns a value
[unix-history]
/
usr
/
src
/
lib
/
libc
/
net
/
res_mkquery.c
diff --git
a/usr/src/lib/libc/net/res_mkquery.c
b/usr/src/lib/libc/net/res_mkquery.c
index
834eb2f
..
6b40ccd
100644
(file)
--- a/
usr/src/lib/libc/net/res_mkquery.c
+++ b/
usr/src/lib/libc/net/res_mkquery.c
@@
-1,15
+1,18
@@
-/* res_mkquery.c 4.5 85/04/01 */
-
/*
/*
- * Copyright (c) 1985 Regents of the University of California
- * All Rights Reserved
+ * Copyright (c) 1985 Regents of the University of California.
+ * All rights reserved. The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
*/
*/
+#ifndef lint
+static char sccsid[] = "@(#)res_mkquery.c 5.4 (Berkeley) %G%";
+#endif not lint
+
#include <stdio.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <stdio.h>
#include <sys/types.h>
#include <netinet/in.h>
-#include <nameser.h>
-#include <resolv.h>
+#include <
arpa/
nameser.h>
+#include <
arpa/
resolv.h>
/*
* Form all types of queries.
/*
* Form all types of queries.
@@
-32,8
+35,10
@@
res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)
char *dnptrs[10], **dpp, **lastdnptr;
extern char *index();
char *dnptrs[10], **dpp, **lastdnptr;
extern char *index();
+#ifdef DEBUG
if (_res.options & RES_DEBUG)
printf("res_mkquery(%d, %s, %d, %d)\n", op, dname, class, type);
if (_res.options & RES_DEBUG)
printf("res_mkquery(%d, %s, %d, %d)\n", op, dname, class, type);
+#endif
/*
* Initialize header fields.
*/
/*
* Initialize header fields.
*/
@@
-61,7
+66,8
@@
res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)
if ((_res.options & RES_DEFNAMES) && dname[0] != '\0' &&
index(dname, '.') == NULL) {
if (!(_res.options & RES_INIT))
if ((_res.options & RES_DEFNAMES) && dname[0] != '\0' &&
index(dname, '.') == NULL) {
if (!(_res.options & RES_INIT))
- res_init();
+ if (res_init() == -1)
+ return(-1);
if (_res.defdname[0] != '\0')
dname = sprintf(dnbuf, "%s.%s", dname, _res.defdname);
}
if (_res.defdname[0] != '\0')
dname = sprintf(dnbuf, "%s.%s", dname, _res.defdname);
}
@@
-81,7
+87,7
@@
res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)
cp += sizeof(u_short);
putshort(class, cp);
cp += sizeof(u_short);
cp += sizeof(u_short);
putshort(class, cp);
cp += sizeof(u_short);
- hp->qdcount =
HTONS
(1);
+ hp->qdcount =
htons
(1);
if (op == QUERY || data == NULL)
break;
/*
if (op == QUERY || data == NULL)
break;
/*
@@
-100,7
+106,7
@@
res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)
cp += sizeof(u_long);
putshort(0, cp);
cp += sizeof(u_short);
cp += sizeof(u_long);
putshort(0, cp);
cp += sizeof(u_short);
- hp->arcount =
HTONS
(1);
+ hp->arcount =
htons
(1);
break;
case IQUERY:
break;
case IQUERY:
@@
-122,7
+128,7
@@
res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)
bcopy(data, cp, datalen);
cp += datalen;
}
bcopy(data, cp, datalen);
cp += datalen;
}
- hp->ancount =
HTONS
(1);
+ hp->ancount =
htons
(1);
break;
#ifdef notdef
break;
#ifdef notdef