(inet_ntop_v6): always print at least one digit between colons

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9778 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2001-04-04 23:58:01 +00:00
parent 5344144049
commit ba4b0991de

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999 Kungliga Tekniska H<>gskolan
* Copyright (c) 1999 - 2001 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -92,7 +92,7 @@ inet_ntop_v6 (const void *src, char *dst, size_t size)
return NULL;
}
for (i = 0; i < 8; ++i) {
int non_zerop = 1;
int non_zerop = 0;
if (non_zerop || (ptr[0] >> 4)) {
*dst++ = xdigits[ptr[0] >> 4];
@@ -106,10 +106,7 @@ inet_ntop_v6 (const void *src, char *dst, size_t size)
*dst++ = xdigits[ptr[1] >> 4];
non_zerop = 1;
}
if (non_zerop || (ptr[1] & 0x0F)) {
*dst++ = xdigits[ptr[1] & 0x0F];
non_zerop = 1;
}
*dst++ = xdigits[ptr[1] & 0x0F];
if (i != 7)
*dst++ = ':';
ptr += 2;