aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorLeon M. George <leon@georgemail.eu>2022-10-14 14:08:19 +0200
committerChristian Marangi <ansuelsmth@gmail.com>2023-02-07 21:05:57 +0100
commit2903924b576c19ab64490917ec46cb3bee790ad2 (patch)
tree202d5aa1c6fbc4bd9739426aba861765b8a6a3c8 /package
parente4bd3de1be8e3d49f9663a300e8b821ecca4be11 (diff)
downloadupstream-2903924b576c19ab64490917ec46cb3bee790ad2.tar.gz
upstream-2903924b576c19ab64490917ec46cb3bee790ad2.tar.bz2
upstream-2903924b576c19ab64490917ec46cb3bee790ad2.zip
base-files: ipcalc.sh: trim for statement
For gawk compatibility. Signed-off-by: Leon M. George <leon@georgemail.eu>
Diffstat (limited to 'package')
-rwxr-xr-xpackage/base-files/files/bin/ipcalc.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/package/base-files/files/bin/ipcalc.sh b/package/base-files/files/bin/ipcalc.sh
index e818e67803..99269fff06 100755
--- a/package/base-files/files/bin/ipcalc.sh
+++ b/package/base-files/files/bin/ipcalc.sh
@@ -10,14 +10,20 @@ function bitcount(c) {
}
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
}
function int2ip(ip,ret,x) {
ret=and(ip,255)
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
}