mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-23 23:42:43 +00:00
base-files: ipcalc.sh: trim for statement
For gawk compatibility. Signed-off-by: Leon M. George <leon@georgemail.eu>
This commit is contained in:
parent
e4bd3de1be
commit
2903924b57
@ -10,14 +10,20 @@ function bitcount(c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ip2int(ip) {
|
function ip2int(ip) {
|
||||||
for (ret=0,n=split(ip,a,"\."),x=1;x<=n;x++) ret=or(lshift(ret,8),a[x])
|
ret=0
|
||||||
|
n=split(ip,a,"\.")
|
||||||
|
for (x=1;x<=n;x++)
|
||||||
|
ret=or(lshift(ret,8),a[x])
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
function int2ip(ip,ret,x) {
|
function int2ip(ip,ret,x) {
|
||||||
ret=and(ip,255)
|
ret=and(ip,255)
|
||||||
ip=rshift(ip,8)
|
ip=rshift(ip,8)
|
||||||
for(;x<3;ret=and(ip,255)"."ret,ip=rshift(ip,8),x++);
|
for(;x<3;x++) {
|
||||||
|
ret=and(ip,255)"."ret
|
||||||
|
ip=rshift(ip,8)
|
||||||
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user