Date: Sat, 16 Dec 2006 14:46:43 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 111795 for review Message-ID: <200612161446.kBGEkhpU091284@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=111795 Change 111795 by jhb@jhb_zion on 2006/12/16 14:46:07 IFC @111793. Affected files ... .. //depot/projects/smpng/sys/netinet6/in6.c#38 integrate Differences ... ==== //depot/projects/smpng/sys/netinet6/in6.c#38 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/netinet6/in6.c,v 1.66 2006/12/12 12:17:57 bz Exp $ */ +/* $FreeBSD: src/sys/netinet6/in6.c,v 1.67 2006/12/16 14:15:31 bz Exp $ */ /* $KAME: in6.c,v 1.259 2002/01/21 11:37:50 keiichi Exp $ */ /*- @@ -1904,7 +1904,7 @@ char *cp; const u_int16_t *a = (const u_int16_t *)addr; const u_int8_t *d; - int dcolon = 0; + int dcolon = 0, zero = 0; cp = ip6buf; @@ -1932,9 +1932,23 @@ continue; } d = (const u_char *)a; - *cp++ = digits[*d >> 4]; - *cp++ = digits[*d++ & 0xf]; - *cp++ = digits[*d >> 4]; + /* Try to eliminate leading zeros in printout like in :0001. */ + zero = 1; + *cp = digits[*d >> 4]; + if (*cp != '0') { + zero = 0; + cp++; + } + *cp = digits[*d++ & 0xf]; + if (zero == 0 || (*cp != '0')) { + zero = 0; + cp++; + } + *cp = digits[*d >> 4]; + if (zero == 0 || (*cp != '0')) { + zero = 0; + cp++; + } *cp++ = digits[*d & 0xf]; *cp++ = ':'; a++;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200612161446.kBGEkhpU091284>