hoby, I saw right away a way to make your udf shorter than mine.
anyway, will not crack it before posting my code, thus:
code:
Function MOAN($a, $n, $m)
dim $i,$s,$,$!,$z

for each $! in split($a+"."+$n+"."+$m,".")
$=256
do $=$/2
if 0<=0+$!-$
$z=$z+"1"
$!=-$+$!
else $z=$z+"0"
endif
until 1=$
next
$i=left($z,32)
$s=substr($z,33,32)

if 2<len($m)
$m=instr(right($z,32),0)-1
endif
select

case 0=$m
for $=instrrev($s,1) to 31
if moan($a,$n,$)
$m=$m+" /"+$
endif
next
$=substr($m,2)

case 0=$n
$s=0
for $!=1 to $m
if 2>$s $s=256 $n=$n+$+"." $=0 endif
$s=$s/2
if 1=substr($i,$!,1)
$=$+$s
endif
next
$=iif($m>30,"",substr($n+$,3))

case 0=$a
$!=0,128,192,224,240,248,252,254,255
$=$!
$n=split($n,".")
for $s=0 to 3
$i=-8*$s+$m
$i=iif($i>8,8,$i)
$[$s]=255+$n[$s]-iif($i,$![$i],0)
next
for $s=$n[0] to $[0]
for $!=$n[1] to $[1]
for $m=$n[2] to $[2]
for $i=1+$n[3] to $[3]-1
$a=$a+" "+$s+"."+$!+"."+$m+"."+$i
next
next
next
next
$=substr($a,2)

case 1
$=iif(left($i,$m)=left($s,$m) & $i=>$s ,1,0) ;and instr(right($i,32-$m),0),1,0) ; x.x.x.255 proper ip?
endselect
$moan=iif(instr($," "),split($),$)

EndFunction

this comes to 807.
added one stroke to remove a problem with special subnet-masks.
it probably still has one...
at least I feel like it does [Wink]
_________________________
!

download KiXnet