summaryrefslogtreecommitdiff
path: root/ares_gethostbyaddr.c
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2008-12-09 01:02:28 +0000
committerDan Fandrich <dan@coneharvesters.com>2008-12-09 01:02:28 +0000
commitdaa44aa9b14569df51d2d62e54afd9fec3d63a91 (patch)
treec6fcc8a0e7f95140e99e7ce54ab68949c6af4d19 /ares_gethostbyaddr.c
parentffbe1c55180396c7eecef6f89b8744040f8c0bf6 (diff)
downloadc-ares-daa44aa9b14569df51d2d62e54afd9fec3d63a91.tar.gz
c-ares-daa44aa9b14569df51d2d62e54afd9fec3d63a91.tar.bz2
c-ares-daa44aa9b14569df51d2d62e54afd9fec3d63a91.zip
C89 compilers (like Minix' ACK) only need to handle 31 functions arguments
so split a long sprintf into two calls to get below that number.
Diffstat (limited to 'ares_gethostbyaddr.c')
-rw-r--r--ares_gethostbyaddr.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ares_gethostbyaddr.c b/ares_gethostbyaddr.c
index 30b3cb0..76f5870 100644
--- a/ares_gethostbyaddr.c
+++ b/ares_gethostbyaddr.c
@@ -266,13 +266,16 @@ static void ptr_rr_name(char *name, struct ares_addr *addr)
else
{
unsigned char *bytes = (unsigned char *)&addr->addrV6.s6_addr;
+ /* There are too many arguments to do this in one line using
+ * minimally C89-compliant compilers */
sprintf(name,
- "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x."
- "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.ip6.arpa",
+ "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.",
bytes[15]&0xf, bytes[15] >> 4, bytes[14]&0xf, bytes[14] >> 4,
bytes[13]&0xf, bytes[13] >> 4, bytes[12]&0xf, bytes[12] >> 4,
bytes[11]&0xf, bytes[11] >> 4, bytes[10]&0xf, bytes[10] >> 4,
- bytes[9]&0xf, bytes[9] >> 4, bytes[8]&0xf, bytes[8] >> 4,
+ bytes[9]&0xf, bytes[9] >> 4, bytes[8]&0xf, bytes[8] >> 4);
+ sprintf(name+strlen(name),
+ "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.ip6.arpa",
bytes[7]&0xf, bytes[7] >> 4, bytes[6]&0xf, bytes[6] >> 4,
bytes[5]&0xf, bytes[5] >> 4, bytes[4]&0xf, bytes[4] >> 4,
bytes[3]&0xf, bytes[3] >> 4, bytes[2]&0xf, bytes[2] >> 4,