Improve ipv6addr_terse().

Drop leading zeros in IPv6 address segment.
This commit is contained in:
Mikhail Efremov 2012-12-06 18:19:22 +04:00
parent 831552abc6
commit 393cdf120f

View File

@ -61,7 +61,7 @@ ipv6addr_terse()
::*) echo "$1" | sed -r 's/^::[0:]+:/::/' ;;
*::*) echo "$1" ;;
*) echo "$1" | sed -r 's/(:[0:]+:|^[0:]+:|:[0:]+$)/::/' ;;
esac
esac | sed -r 's/(^|:)(0+)([[:xdigit:]])/\1\3/g'
}
ipv6addr_expand()