From owner-p4-projects@FreeBSD.ORG Sat Dec 16 14:46:44 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 90BA016A47C; Sat, 16 Dec 2006 14:46:44 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6B42C16A40F for ; Sat, 16 Dec 2006 14:46:44 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5F45743CAF for ; Sat, 16 Dec 2006 14:46:43 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id kBGEkhxh091287 for ; Sat, 16 Dec 2006 14:46:43 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id kBGEkhpU091284 for perforce@freebsd.org; Sat, 16 Dec 2006 14:46:43 GMT (envelope-from jhb@freebsd.org) Date: Sat, 16 Dec 2006 14:46:43 GMT Message-Id: <200612161446.kBGEkhpU091284@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 111795 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Dec 2006 14:46:44 -0000 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++;