summaryrefslogtreecommitdiff
path: root/resolv/gethnamaddr.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-05-24 20:16:39 +0000
committerRoland McGrath <roland@gnu.org>1996-05-24 20:16:39 +0000
commit613a76ff52a680e71db772306a260b9cb7f95b49 (patch)
tree7c6ff1e04f1cadef4b95c93e295d3df2ad0631d0 /resolv/gethnamaddr.c
parent510ca033d66c47e0dc54550928dece59799a0136 (diff)
Fri May 24 02:31:36 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/speed.c: Add new speed value 460800. Thu May 23 23:09:33 1996 Ulrich Drepper <drepper@cygnus.com> * FAQ: Add answer for 100% source code compatibility to Linux libc by David Mosberger-Tang. Update from bind-4.3.4-T3B. * inet/arpa/inet.h: Add prototypes for inet_pton, inet_ntop, inet_nsap_addr, and inet_nsap_ntoa. * resolv/gethnamaddr.c: Correct compatibility problems (sprintf), remove fourth argument to inet_pton and correct handling of host_addr passing. * resolv/inet_ntop.c: Correct compatibility problems (sprintf). * resolv/inet_pton.c: Remove fourth argument. * resolv/resolv.h: Remove prototypes for inet_nsap_addr and inet_nsap_ntoa. Now on <arpa/inet.h>. * stdlib/gmp-impl.h: Add prototypes for internal functions. Thu May 23 22:49:15 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * Rules (subdir_install): Remove dep on sor-$(subdir). (static-only-routines): Removed variable and associated rules. * sysdeps/unix/sysv/linux/alpha/Makefile (headers): Add sysdeps/alpha/bsd-_setjmp.S, sysdeps/alpha/ffs.S, sysdeps/unix/sysv/linux/alpha/sigsuspend.S, sysdeps/unix/sysv/linux/alpha/start.S,
Diffstat (limited to 'resolv/gethnamaddr.c')
-rw-r--r--resolv/gethnamaddr.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c
index b80595b7d5..18f4764428 100644
--- a/resolv/gethnamaddr.c
+++ b/resolv/gethnamaddr.c
@@ -88,6 +88,12 @@ static char rcsid[] = "$Id$";
# include <../conf/options.h>
#endif
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) sprintf x
+#endif
+
#define MAXALIASES 35
#define MAXADDRS 35
#define MAXADDRBUFSIZE 8192
@@ -475,8 +481,7 @@ gethostbyname2(name, af)
* Fake up a hostent as if we'd actually
* done a lookup.
*/
- if (inet_pton(af, name, host_addr,
- sizeof host_addr) <= 0) {
+ if (inet_pton(af, name, host_addr) <= 0) {
h_errno = HOST_NOT_FOUND;
return (NULL);
}
@@ -487,7 +492,7 @@ gethostbyname2(name, af)
host.h_name = hostbuf;
host.h_aliases = host_aliases;
host_aliases[0] = NULL;
- h_addr_ptrs[0] = (char *)&host_addr;
+ h_addr_ptrs[0] = (char *)host_addr;
h_addr_ptrs[1] = NULL;
host.h_addr_list = h_addr_ptrs;
if (_res.options & RES_USE_INET6)
@@ -617,9 +622,9 @@ gethostbyaddr(addr, len, af)
case AF_INET6:
qp = qbuf;
for (n = IN6ADDRSZ - 1; n >= 0; n--) {
- qp += sprintf(qp, "%x.%x.",
- uaddr[n] & 0xf,
- (uaddr[n] >> 4) & 0xf);
+ qp += SPRINTF((qp, "%x.%x.",
+ uaddr[n] & 0xf,
+ (uaddr[n] >> 4) & 0xf));
}
strcpy(qp, "ip6.int");
break;
@@ -770,12 +775,12 @@ _gethtent()
goto again;
*cp++ = '\0';
if ((_res.options & RES_USE_INET6) &&
- inet_pton(AF_INET6, p, host_addr, sizeof host_addr) > 0) {
+ inet_pton(AF_INET6, p, host_addr) > 0) {
af = AF_INET6;
len = IN6ADDRSZ;
- } else if (inet_pton(AF_INET, p, host_addr, sizeof host_addr) > 0) {
+ } else if (inet_pton(AF_INET, p, host_addr) > 0) {
if (_res.options & RES_USE_INET6) {
- map_v4v6_address((char*)&host_addr, (char*)&host_addr);
+ map_v4v6_address((char*)host_addr, (char*)host_addr);
af = AF_INET6;
len = IN6ADDRSZ;
} else {
@@ -785,7 +790,7 @@ _gethtent()
} else {
goto again;
}
- h_addr_ptrs[0] = (char *)&host_addr;
+ h_addr_ptrs[0] = (char *)host_addr;
h_addr_ptrs[1] = NULL;
host.h_addr_list = h_addr_ptrs;
host.h_length = len;
@@ -859,7 +864,7 @@ struct hostent *
_gethtbyname(name)
const char *name;
{
- extern struct hostent *_gethtbyname2 __P((const char *, int));
+ extern struct hostent *_gethtbyname2();
struct hostent *hp;
if (_res.options & RES_USE_INET6) {