rc-scripts/trunk/sysconfig/network-scripts/functions.network
arekm
cvs at pld-linux.org
Wed Oct 19 20:08:25 CEST 2005
Author: arekm
Date: Wed Oct 19 20:08:20 2005
New Revision: 6467
Modified:
rc-scripts/trunk/sysconfig/network-scripts/functions.network
Log:
Working version of calcprefix().
Modified: rc-scripts/trunk/sysconfig/network-scripts/functions.network
==============================================================================
--- rc-scripts/trunk/sysconfig/network-scripts/functions.network (original)
+++ rc-scripts/trunk/sysconfig/network-scripts/functions.network Wed Oct 19 20:08:20 2005
@@ -317,15 +317,14 @@
calcprefix()
{
typeset OISF len olen bad prefix
-OISF=$IFS
-IFS="."
prefix=0
olen=8
bad=0
-for i in $1; do
+for i in 1 2 3 4; do
len=0
- case $i in
+ j=$(echo "$1" | awk -F"." "{ print \$${i} }")
+ case "$j" in
255) len=8 ;;
254) len=7 ;;
252) len=6 ;;
@@ -343,7 +342,6 @@
olen=$len
done
-IFS=$OIFS
if [ "$bad" = "0" ]; then
echo "$prefix"
else
More information about the pld-cvs-commit
mailing list