(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:
@@ -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).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -92,7 +92,7 @@ inet_ntop_v6 (const void *src, char *dst, size_t size)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
for (i = 0; i < 8; ++i) {
|
for (i = 0; i < 8; ++i) {
|
||||||
int non_zerop = 1;
|
int non_zerop = 0;
|
||||||
|
|
||||||
if (non_zerop || (ptr[0] >> 4)) {
|
if (non_zerop || (ptr[0] >> 4)) {
|
||||||
*dst++ = xdigits[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];
|
*dst++ = xdigits[ptr[1] >> 4];
|
||||||
non_zerop = 1;
|
non_zerop = 1;
|
||||||
}
|
}
|
||||||
if (non_zerop || (ptr[1] & 0x0F)) {
|
|
||||||
*dst++ = xdigits[ptr[1] & 0x0F];
|
*dst++ = xdigits[ptr[1] & 0x0F];
|
||||||
non_zerop = 1;
|
|
||||||
}
|
|
||||||
if (i != 7)
|
if (i != 7)
|
||||||
*dst++ = ':';
|
*dst++ = ':';
|
||||||
ptr += 2;
|
ptr += 2;
|
||||||
|
Reference in New Issue
Block a user