projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e4bd3de
)
base-files: ipcalc.sh: trim for statement
author
Leon M. George
<leon@georgemail.eu>
Fri, 14 Oct 2022 12:08:19 +0000
(14:08 +0200)
committer
Christian Marangi
<ansuelsmth@gmail.com>
Tue, 7 Feb 2023 20:05:57 +0000
(21:05 +0100)
For gawk compatibility.
Signed-off-by: Leon M. George <leon@georgemail.eu>
package/base-files/files/bin/ipcalc.sh
patch
|
blob
|
history
diff --git
a/package/base-files/files/bin/ipcalc.sh
b/package/base-files/files/bin/ipcalc.sh
index e818e678033266ec1d4be4105e152ff66d53e26d..99269fff066f99176ad5802d7005eb53e6e29fca 100755
(executable)
--- 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
}