#!/bin/ksh -p
#pragma ident "@(#)hexIP	1.3 96/11/18 SMI"
#
# Copyright 18 Nov 1996 Sun Microsystems, Inc. All Rights Reserved
#
# Synopsis: hexIP (dotted decimal)ipaddr
#  returns: (hex string)

hexIP() {
	IFS=. ip=$1
	set $ip
	typeset -i16 hex
	typeset -uZ2 tmp
	for i
	do
		hex=$i
		tmp=0${hex#16\#}
		out=$out$tmp
	done
	print $out
}

# Note: to compute (int)hexipaddr
# typeset -i16 i=16#$(hexIP $dotteddecimalipaddr)
