Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/openrc:master commit in: src/test/, net/, man/, init.d/, sh/, support/openvpn/
Date: Sat, 19 Nov 2011 08:11:27
Message-Id: ef1ff1b4f29762d1caf83dc2b65ccfc7cb96e140.vapier@gentoo
1 commit: ef1ff1b4f29762d1caf83dc2b65ccfc7cb96e140
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Fri Nov 11 02:46:08 2011 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Sat Nov 19 07:25:36 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=ef1ff1b4
7
8 make shell math operations style more succulent
9
10 Convert the style:
11 var=$((${var} + 1))
12 to:
13 : $(( var += 1 ))
14
15 The latter is easier to read imo.
16
17 Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
18
19 ---
20 init.d/consolefont.in | 2 +-
21 init.d/hwclock.in | 4 ++--
22 init.d/keymaps.in | 2 +-
23 init.d/mixer.in | 4 ++--
24 init.d/modules.in | 2 +-
25 init.d/moused.in | 2 +-
26 init.d/net.lo.in | 22 +++++++++++-----------
27 init.d/network.in | 2 +-
28 init.d/numlock.in | 2 +-
29 init.d/rc-enabled.in | 4 ++--
30 init.d/termencoding.in | 2 +-
31 init.d/urandom.in | 2 +-
32 man/runscript.8 | 2 +-
33 net/apipa.sh | 8 ++++----
34 net/arping.sh | 2 +-
35 net/clip.sh | 2 +-
36 net/ifconfig.sh.BSD.in | 4 ++--
37 net/ifconfig.sh.Linux.in | 26 +++++++++++++-------------
38 net/ifplugd.sh | 2 +-
39 net/ip6to4.sh | 4 ++--
40 net/iproute2.sh | 6 +++---
41 net/iwconfig.sh.BSD.in | 32 ++++++++++++++++----------------
42 net/iwconfig.sh.Linux.in | 30 +++++++++++++++---------------
43 net/netplugd.sh | 2 +-
44 net/pppd.sh | 2 +-
45 net/tuntap.sh | 2 +-
46 net/wpa_supplicant.sh | 2 +-
47 sh/functions.sh.in | 4 ++--
48 sh/rc-mount.sh | 2 +-
49 sh/runtests.sh | 6 +++---
50 src/test/runtests.sh | 6 +++---
51 support/openvpn/up.sh | 2 +-
52 32 files changed, 98 insertions(+), 98 deletions(-)
53
54 diff --git a/init.d/consolefont.in b/init.d/consolefont.in
55 index cd0c8de..f83b003 100644
56 --- a/init.d/consolefont.in
57 +++ b/init.d/consolefont.in
58 @@ -49,7 +49,7 @@ start()
59 retval=1
60 break
61 fi
62 - x=$(($x + 1))
63 + : $(( x += 1 ))
64 done
65 eend $retval
66
67
68 diff --git a/init.d/hwclock.in b/init.d/hwclock.in
69 index b79ff7c..cfb25ae 100644
70 --- a/init.d/hwclock.in
71 +++ b/init.d/hwclock.in
72 @@ -85,7 +85,7 @@ start()
73
74 if [ -e /etc/adjtime ] && yesno $clock_adjfile; then
75 _hwclock --adjust $utc_cmd
76 - retval=$(($retval + $?))
77 + : $(( retval += $? ))
78 fi
79
80 # If setting UTC, don't bother to run hwclock when first booting
81 @@ -99,7 +99,7 @@ start()
82 else
83 _hwclock --systz $utc_cmd $clock_args
84 fi
85 - retval=$(($retval + $?))
86 + : $(( retval += $? ))
87 fi
88
89 eend $retval "Failed to set the system clock"
90
91 diff --git a/init.d/keymaps.in b/init.d/keymaps.in
92 index a7bb085..1b96f49 100644
93 --- a/init.d/keymaps.in
94 +++ b/init.d/keymaps.in
95 @@ -47,7 +47,7 @@ start()
96 n=1
97 while [ $n -le $ttyn ]; do
98 kbd_mode $kmode -C $ttydev$n
99 - n=$(($n + 1))
100 + : $(( n += 1 ))
101 done
102 eend 0
103
104
105 diff --git a/init.d/mixer.in b/init.d/mixer.in
106 index bb42886..a08aea1 100644
107 --- a/init.d/mixer.in
108 +++ b/init.d/mixer.in
109 @@ -21,7 +21,7 @@ restore()
110 mixer -f "$mixer" \
111 $(cat "/var/db/${mixer#/dev/}-state") >/dev/null
112 veend $?
113 - : $((retval += $?))
114 + : $(( retval += $? ))
115 fi
116 done
117 }
118 @@ -40,7 +40,7 @@ stop()
119 vebegin "$mixer"
120 mixer -f "$mixer" -s >/var/db/"${mixer#/dev/}"-state
121 veend $?
122 - : $((retval += $?))
123 + : $(( retval += $? ))
124 done
125 eoutdent
126 eend $retval
127
128 diff --git a/init.d/modules.in b/init.d/modules.in
129 index e673763..72f14e7 100644
130 --- a/init.d/modules.in
131 +++ b/init.d/modules.in
132 @@ -57,7 +57,7 @@ start()
133 [ -z "$args" ] && eval args=\$module_${aa}_args
134 [ -z "$args" ] && eval args=\$module_${xx}_args
135 eval modprobe -q "$mpargs" "$x" "$args"
136 - eend $? "Failed to load $x" && cnt=$(($cnt + 1))
137 + eend $? "Failed to load $x" && : $(( cnt += 1 ))
138 done
139 einfo "Autoloaded $cnt module(s)"
140 }
141
142 diff --git a/init.d/moused.in b/init.d/moused.in
143 index a41005f..cdcf36a 100644
144 --- a/init.d/moused.in
145 +++ b/init.d/moused.in
146 @@ -54,7 +54,7 @@ start()
147 local ttyv=
148 for ttyv in /dev/ttyv*; do
149 vidcontrol < "$ttyv" -m on
150 - : $((retval+= $?))
151 + : $(( retval += $? ))
152 done
153 fi
154
155
156 diff --git a/init.d/net.lo.in b/init.d/net.lo.in
157 index 66e1945..d647f31 100644
158 --- a/init.d/net.lo.in
159 +++ b/init.d/net.lo.in
160 @@ -115,7 +115,7 @@ _wait_for_carrier()
161 eend 0
162 return 0
163 fi
164 - timeout=$((${timeout} - 1))
165 + : $(( timeout -= 1 ))
166 [ "${efunc}" = "einfon" ] && printf "."
167 done
168
169 @@ -144,9 +144,9 @@ _netmask2cidr()
170 local i= len=
171 local IFS=.
172 for i in $1; do
173 - while [ ${i} != "0" ]; do
174 - len=$((${len} + ${i} % 2))
175 - i=$((${i} >> 1))
176 + while [ i -ne 0 ]; do
177 + : $(( len += i % 2 ))
178 + : $(( i >>= 1 ))
179 done
180 done
181
182 @@ -277,7 +277,7 @@ _gen_module_list()
183 echo "module_${i}_program_start='${PROGRAM_START}'" >> "${MODULESLIST}"
184 echo "module_${i}_program_stop='${PROGRAM_STOP}'" >> "${MODULESLIST}"
185 echo "module_${i}_provide='${PROVIDE}'" >> "${MODULESLIST}"
186 - i=$((${i} + 1))
187 + : $(( i += 1 ))
188 done
189 echo "module_${i}=" >> "${MODULESLIST}"
190 )
191 @@ -304,7 +304,7 @@ _load_modules()
192
193 local i=-1 x= mod= f= provides=
194 while true; do
195 - i=$((${i} + 1))
196 + : $(( i += 1 ))
197 eval mod=\$module_${i}
198 [ -z "${mod}" ] && break
199 [ -e "${MODULESDIR}/${mod}.sh" ] || continue
200 @@ -438,7 +438,7 @@ _load_config()
201 # so modules can influence it
202 for cmd; do
203 eval config_${config_index}="'${cmd}'"
204 - config_index=$((${config_index} + 1))
205 + : $(( config_index += 1 ))
206 done
207 # Terminate the list
208 eval config_${config_index}=
209 @@ -446,7 +446,7 @@ _load_config()
210 config_index=0
211 for cmd in ${fallback}; do
212 eval fallback_${config_index}="'${cmd}'"
213 - config_index=$((${config_index} + 1))
214 + : $(( config_index += 1 ))
215 done
216 # Terminate the list
217 eval fallback_${config_index}=
218 @@ -541,7 +541,7 @@ start()
219 if [ -n "${our_metric}" ]; then
220 metric=${our_metric}
221 elif [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ]; then
222 - metric=$((${metric} + $(_ifindex)))
223 + : $(( metric += $(_ifindex) ))
224 fi
225
226 while true; do
227 @@ -581,11 +581,11 @@ start()
228 eindent
229 eval config_${config_index}=\$config
230 unset fallback_${config_index}
231 - config_index=$((${config_index} - 1))
232 + : $(( config_index -= 1 ))
233 fi
234 fi
235 eoutdent
236 - config_index=$((${config_index} + 1))
237 + : $(( config_index += 1 ))
238 done
239
240 if ! ${oneworked}; then
241
242 diff --git a/init.d/network.in b/init.d/network.in
243 index c934129..1c70785 100644
244 --- a/init.d/network.in
245 +++ b/init.d/network.in
246 @@ -287,7 +287,7 @@ start()
247 tentative || break
248 [ $r = 5 ] && vebegin "Waiting for tentative addresses"
249 sleep 1
250 - r=$(($r - 1))
251 + : $(( r -= 1 ))
252 done
253 if [ $r != 5 ]; then
254 [ $r != 0 ]
255
256 diff --git a/init.d/numlock.in b/init.d/numlock.in
257 index c5b894a..3cb8bee 100644
258 --- a/init.d/numlock.in
259 +++ b/init.d/numlock.in
260 @@ -21,7 +21,7 @@ _setleds()
261
262 while [ $i -le $ttyn ]; do
263 setleds -D "$1"num < $dev$i || retval=1
264 - i=$(($i + 1))
265 + : $(( i += 1 ))
266 done
267
268 return $retval
269
270 diff --git a/init.d/rc-enabled.in b/init.d/rc-enabled.in
271 index aff2a40..9ba73b0 100644
272 --- a/init.d/rc-enabled.in
273 +++ b/init.d/rc-enabled.in
274 @@ -33,7 +33,7 @@ start()
275
276 # Good to go!
277 "$svc" start && started="$started $svc"
278 - : $((retval += $?))
279 + : $(( retval += $? ))
280 done
281 service_set_value started "$started"
282 eend $retval "Some local rc services failed to start"
283 @@ -46,7 +46,7 @@ stop()
284 local svc= retval=0
285 for svc in $(rcorder $(service_get_value started) 2>/dev/null | sort -r); do
286 "$svc" stop
287 - : $((retval += $?))
288 + : $(( retval += $? ))
289 done
290 eend $retval "Some local rc services failed to stop"
291 return 0
292
293 diff --git a/init.d/termencoding.in b/init.d/termencoding.in
294 index 68e49b7..edba715 100644
295 --- a/init.d/termencoding.in
296 +++ b/init.d/termencoding.in
297 @@ -31,7 +31,7 @@ start()
298 n=1
299 while [ ${n} -le "$ttyn" ]; do
300 printf "\033%s" "$termencoding" >$ttydev$n
301 - n=$(($n + 1))
302 + : $(( n += 1 ))
303 done
304
305 # Save the encoding for use immediately at boot
306
307 diff --git a/init.d/urandom.in b/init.d/urandom.in
308 index 8233f82..7fe5e59 100644
309 --- a/init.d/urandom.in
310 +++ b/init.d/urandom.in
311 @@ -16,7 +16,7 @@ save_seed()
312 local psz=1
313
314 if [ -e /proc/sys/kernel/random/poolsize ]; then
315 - psz=$(($(cat /proc/sys/kernel/random/poolsize) / 4096))
316 + : $(( psz = $(cat /proc/sys/kernel/random/poolsize) / 4096 ))
317 fi
318
319 ( # sub shell to prevent umask pollution
320
321 diff --git a/man/runscript.8 b/man/runscript.8
322 index b28bec2..64da26c 100644
323 --- a/man/runscript.8
324 +++ b/man/runscript.8
325 @@ -449,7 +449,7 @@ eat()
326 veinfo "Eating `basename ${food}`"
327 ${command} --eat ${food}
328 retval=$?
329 - : $((${result} += ${retval}))
330 + : $(( result += retval ))
331 [ ${retval} = 0 ] && ate="${ate} `basename ${food}`"
332 done
333
334
335 diff --git a/net/apipa.sh b/net/apipa.sh
336 index 3163104..ae61233 100644
337 --- a/net/apipa.sh
338 +++ b/net/apipa.sh
339 @@ -26,20 +26,20 @@ apipa_start()
340 eindent
341
342 while [ ${i} -lt 64516 ]; do
343 - i1=$((($(_random) % 255) + 1))
344 - i2=$((($(_random) % 255) + 1))
345 + : $(( i1 = (_random % 255) + 1 ))
346 + : $(( i2 = (_random % 255) + 1 ))
347
348 addr="169.254.${i1}.${i2}"
349 vebegin "${addr}/16"
350 if ! arping_address "${addr}"; then
351 eval config_${config_index}="\"${addr}/16 broadcast 169.254.255.255\""
352 - config_index=$((${config_index} - 1))
353 + : $(( config_index -= 1 ))
354 veend 0
355 eoutdent
356 return 0
357 fi
358
359 - i=$((${i} + 1))
360 + : $(( i += 1 ))
361 done
362
363 eerror "No free address found!"
364
365 diff --git a/net/arping.sh b/net/arping.sh
366 index b77d70c..83360d7 100644
367 --- a/net/arping.sh
368 +++ b/net/arping.sh
369 @@ -34,7 +34,7 @@ arping_address()
370 while [ ${w} -gt 0 -a -z "${foundmac}" ]; do
371 foundmac="$(arping2 ${opts} -r -c 1 -i "${IFACE}" "${ip}" 2>/dev/null | \
372 sed -e 'y/abcdef/ABCDEF/')"
373 - w=$((${w} - 1))
374 + : $(( w -= 1 ))
375 done
376 else
377 [ -z "$(_get_inet_address)" ] && opts="${opts} -D"
378
379 diff --git a/net/clip.sh b/net/clip.sh
380 index 35efa3f..2fc290f 100644
381 --- a/net/clip.sh
382 +++ b/net/clip.sh
383 @@ -148,7 +148,7 @@ clip_post_start()
384
385 local nleftretries=10 emsg= ecode=
386 while [ ${nleftretries} -gt 0 ]; do
387 - nleftretries=$((${nleftretries} - 1))
388 + : $(( nleftretries -= 1 ))
389 emsg="$(atmarp -s "${peerip}" "${ifvpivci}" "$@" 2>&1)"
390 ecode=$? && break
391 sleep 2
392
393 diff --git a/net/ifconfig.sh.BSD.in b/net/ifconfig.sh.BSD.in
394 index c0c75f0..15c8fb8 100644
395 --- a/net/ifconfig.sh.BSD.in
396 +++ b/net/ifconfig.sh.BSD.in
397 @@ -38,7 +38,7 @@ _ifindex()
398 echo "${x#/dev/net}"
399 return 0
400 fi
401 - i=$((${i} + 1))
402 + : $(( i += 1 ))
403 done
404 ;;
405 default)
406 @@ -47,7 +47,7 @@ _ifindex()
407 echo "${i}"
408 return 0
409 fi
410 - i=$((${i} + 1))
411 + : $(( i += 1 ))
412 done
413 ;;
414 esac
415
416 diff --git a/net/ifconfig.sh.Linux.in b/net/ifconfig.sh.Linux.in
417 index a5540c0..dcbd628 100644
418 --- a/net/ifconfig.sh.Linux.in
419 +++ b/net/ifconfig.sh.Linux.in
420 @@ -26,7 +26,7 @@ _ifindex()
421 {
422 local line= i=-2
423 while read line; do
424 - i=$((${i} + 1))
425 + : $(( i += 1 ))
426 [ ${i} -lt 1 ] && continue
427 case "${line}" in
428 "${IFACE}:"*) echo "${i}"; return 0;;
429 @@ -34,7 +34,7 @@ _ifindex()
430 done < /proc/net/dev
431
432 # Return the next available index
433 - i=$((${i} + 1))
434 + : $(( i += 1 ))
435 echo "${i}"
436 return 1
437 }
438 @@ -96,7 +96,7 @@ _get_inet_addresses()
439 _exists || break
440 local addr="$(_get_inet_address)"
441 [ -n "${addr}" ] && addrs="${addrs}${addrs:+ }${addr}"
442 - i=$((${i} + 1))
443 + : $(( i += 1 ))
444 done
445 echo "${addrs}"
446 }
447 @@ -106,26 +106,26 @@ _cidr2netmask()
448 local cidr="$1" netmask="" done=0 i=0 sum=0 cur=128
449 local octets= frac=
450
451 - local octets=$((${cidr} / 8))
452 - local frac=$((${cidr} % 8))
453 + local octets=$(( cidr / 8 ))
454 + local frac=$(( cidr % 8 ))
455 while [ ${octets} -gt 0 ]; do
456 netmask="${netmask}.255"
457 - octets=$((${octets} - 1))
458 - done=$((${done} + 1))
459 + : $(( octets -= 1 ))
460 + : $(( done += 1 ))
461 done
462
463 if [ ${done} -lt 4 ]; then
464 while [ ${i} -lt ${frac} ]; do
465 - sum=$((${sum} + ${cur}))
466 - cur=$((${cur} / 2))
467 - i=$((${i} + 1))
468 + : $(( sum += cur ))
469 + : $(( cur /= 2 ))
470 + : $(( i += 1 ))
471 done
472 netmask="${netmask}.${sum}"
473 - done=$((${done} + 1))
474 + : $(( done += 1 ))
475
476 while [ ${done} -lt 4 ]; do
477 netmask="${netmask}.0"
478 - done=$((${done} + 1))
479 + : $(( done += 1 ))
480 done
481 fi
482
483 @@ -150,7 +150,7 @@ _add_address()
484 # Get the last alias made for the interface and add 1 to it
485 i=$(ifconfig | sed '1!G;h;$!d' | grep -m 1 -o "^${iface}:[0-9]*" \
486 | sed -n -e 's/'"${iface}"'://p')
487 - i=$((${i:-0} + 1))
488 + : $(( i = ${i:-0} + 1 ))
489 iface="${iface}:${i}"
490 fi
491
492
493 diff --git a/net/ifplugd.sh b/net/ifplugd.sh
494 index d048b61..0bcde2f 100644
495 --- a/net/ifplugd.sh
496 +++ b/net/ifplugd.sh
497 @@ -72,7 +72,7 @@ ifplugd_pre_start()
498 fi
499 sleep 1
500 [ ${timeout} -eq 0 ] && continue
501 - i=$((${i} + 1))
502 + : $(( i += 1 ))
503 [ ${i} -ge ${timeout} ] && break
504 done
505
506
507 diff --git a/net/ip6to4.sh b/net/ip6to4.sh
508 index 0e94293..4564450 100644
509 --- a/net/ip6to4.sh
510 +++ b/net/ip6to4.sh
511 @@ -51,7 +51,7 @@ ip6to4_start()
512 case "${ip}" in
513 172.${i}.*) break;;
514 esac
515 - i=$((${i} + 1))
516 + : $(( i += 1 ))
517 done
518 [ ${i} -lt 32 ] && continue
519 ;;
520 @@ -90,7 +90,7 @@ ip6to4_start()
521
522 # Now apply our config
523 eval config_${config_index}=\'"${new}"\'
524 - config_index=$((${config_index} - 1))
525 + : $(( config_index -= 1 ))
526
527 # Add a route for us, ensuring we don't delete anything else
528 local routes="$(_get_array "routes_${IFVAR}")
529
530 diff --git a/net/iproute2.sh b/net/iproute2.sh
531 index 660d514..91282ea 100644
532 --- a/net/iproute2.sh
533 +++ b/net/iproute2.sh
534 @@ -36,7 +36,7 @@ _ifindex()
535 {
536 local line= i=-2
537 while read line; do
538 - i=$((${i} + 1))
539 + : $(( i += 1 ))
540 [ ${i} -lt 1 ] && continue
541 case "${line}" in
542 "${IFACE}:"*) echo "${i}"; return 0;;
543 @@ -44,7 +44,7 @@ _ifindex()
544 done < /proc/net/dev
545
546 # Return the next available index
547 - i=$((${i} + 1))
548 + : $(( i += 1 ))
549 echo "${i}"
550 return 1
551 }
552 @@ -290,7 +290,7 @@ iproute2_post_start()
553 while [ $n -ge 0 ]; do
554 _iproute2_ipv6_tentative || break
555 sleep 1
556 - n=$(($n - 1))
557 + : $(( n -= 1 ))
558 done
559 [ $n -ge 0 ]
560 eend $?
561
562 diff --git a/net/iwconfig.sh.BSD.in b/net/iwconfig.sh.BSD.in
563 index 850d70b..3acaf66 100644
564 --- a/net/iwconfig.sh.BSD.in
565 +++ b/net/iwconfig.sh.BSD.in
566 @@ -218,7 +218,7 @@ iwconfig_associate()
567 sleep 1
568
569 [ ${timeout} -eq 0 ] && continue
570 - i=$((${i} + 1))
571 + : $(( i += 1 ))
572 [ ${i} -ge ${timeout} ] && { eend 1; return 1; }
573 done
574
575 @@ -252,13 +252,13 @@ iwconfig_scan()
576 scan="$(LC_ALL=C ifconfig -v "${IFACE}" list scan 2>/dev/null | sed -e "1 d" -e "s/$/'/g" -e "s/^/'/g")"
577 while [ ${i} -lt 3 -a -z "${scan}" ] ; do
578 scan="${scan}${scan:+ }$(LC_ALL=C ifconfig -v "${IFACE}" scan 2>/dev/null | sed -e "1 d" -e "s/$/'/g" -e "s/^/'/g")"
579 - i=$((${i} + 1))
580 + : $(( i += 1 ))
581 done
582
583 APS=-1
584 eval set -- ${scan}
585 for line in "$@" ; do
586 - APS=$((${APS} + 1))
587 + : $(( APS += 1 ))
588 set -- ${line}
589 while true ; do
590 case "$1" in
591 @@ -276,7 +276,7 @@ iwconfig_scan()
592 # Add 1000 for managed nodes as we prefer them to adhoc
593 set -- $*
594 case "$1" in
595 - *E*) eval QUAL_${APS}=$((${quality} + 1000)) ;;
596 + *E*) eval QUAL_${APS}=$(( quality + 1000 )) ;;
597 *) eval QUAL_${APS}=\$quality ;;
598 esac
599 done
600 @@ -290,7 +290,7 @@ iwconfig_scan()
601 # Sort based on quality
602 local i=0 k=1 a= b= x= t=
603 while [ ${i} -lt ${APS} ] ; do
604 - k=$((${i} + 1))
605 + : $(( k = i + 1 ))
606 while [ ${k} -le ${APS} ] ; do
607 eval a=\$QUALITY_${i}
608 [ -z "${a}" ] && break
609 @@ -302,15 +302,15 @@ iwconfig_scan()
610 eval ${x}_${k}=\$t
611 done
612 fi
613 - k=$((${k} + 1))
614 + : $(( k += 1 ))
615 done
616 - i=$((${i} + 1))
617 + : $(( i += 1 ))
618 done
619
620 # Strip any duplicates
621 local i=0 k=1 a= b=
622 while [ ${i} -lt ${APS} ] ; do
623 - k=$((${i} + 1))
624 + : $(( k = i + 1 ))
625 while [ ${k} -le ${APS} ] ; do
626 eval a=\$MAC_${i}
627 eval b=\$MAC_${k}
628 @@ -327,9 +327,9 @@ iwconfig_scan()
629 unset MAC_${k} SSID_${k} CHAN_${k} QUALITY_${k} CAPS_${k}
630 fi
631 fi
632 - k=$((${k} + 1))
633 + : $(( k += 1 ))
634 done
635 - i=$((${i} + 1))
636 + : $(( i += 1 ))
637 done
638
639 local i=0 e= m= s=
640 @@ -337,7 +337,7 @@ iwconfig_scan()
641 while [ ${i} -le ${APS} ] ; do
642 eval x=\$MAC_${i}
643 if [ -z "${x}" ] ; then
644 - i=$((${i} + 1))
645 + : $(( i += 1 ))
646 continue
647 fi
648
649 @@ -374,7 +374,7 @@ iwconfig_scan()
650 unset SSID_${i} MAC_${i} CHAN_${i} QUALITY_${i} CAPS_${i}
651 fi
652 done
653 - i=$((${i} + 1))
654 + : $(( i += 1 ))
655 done
656 eoutdent
657 return 0
658 @@ -396,7 +396,7 @@ iwconfig_force_preferred()
659 found_AP=true
660 break
661 fi
662 - i=$((${i} + 1))
663 + : $(( i += 1 ))
664 done
665 if ! ${found_AP} ; then
666 SSID=${ssid}
667 @@ -428,7 +428,7 @@ iwconfig_connect_preferred()
668 iwconfig_associate "${mac}" \
669 "${chan}" "${caps}" && return 0
670 fi
671 - i=$((${i} + 1))
672 + : $(( i += 1 ))
673 done
674 done
675
676 @@ -442,7 +442,7 @@ iwconfig_connect_not_preferred()
677 while [ ${i} -le ${APS} ] ; do
678 eval e=\$SSID_${i}
679 if [ -z "${e}" ] ; then
680 - i=$((${i} + 1))
681 + : $(( i += 1 ))
682 continue
683 fi
684
685 @@ -465,7 +465,7 @@ iwconfig_connect_not_preferred()
686 iwconfig_associate "${mac}" \
687 "${chan}" "${caps}" && return 0
688 fi
689 - i=$((${i} + 1))
690 + : $(( i += 1 ))
691 done
692
693 return 1
694
695 diff --git a/net/iwconfig.sh.Linux.in b/net/iwconfig.sh.Linux.in
696 index 199678f..293bc1f 100644
697 --- a/net/iwconfig.sh.Linux.in
698 +++ b/net/iwconfig.sh.Linux.in
699 @@ -39,7 +39,7 @@ _get_ssid()
700 return 0
701 fi
702 sleep 1
703 - i=$((${i} - 1))
704 + : $(( i -= 1 ))
705 done
706
707 return 1
708 @@ -229,7 +229,7 @@ iwconfig_wait_for_association()
709
710 sleep 1
711 [ ${timeout} -eq 0 ] && continue
712 - i=$((${i} + 1))
713 + : $(( i += 1 ))
714 [ ${i} -ge ${timeout} ] && return 1
715 done
716 return 1
717 @@ -347,7 +347,7 @@ iwconfig_scan()
718 ;;
719 esac
720 fi
721 - i=$((${i} + 1))
722 + : $(( i += 1 ))
723 done
724
725 if [ -z "${scan}" ]; then
726 @@ -377,7 +377,7 @@ iwconfig_scan()
727 for line; do
728 case "${line}" in
729 *Address:*)
730 - APS=$((${APS} + 1))
731 + : $(( APS += 1 ))
732 eval MAC_${APS}="\""$(echo "${line#*: }" | tr '[:lower:]' '[:upper:]')"\""
733 eval QUALITY_${APS}=0
734 ;;
735 @@ -427,7 +427,7 @@ iwconfig_scan()
736 # Sort based on quality
737 local i=0 k=1 a= b= x= t=
738 while [ ${i} -lt ${APS} ]; do
739 - k=$((${i} + 1))
740 + : $(( k = i + 1 ))
741 while [ ${k} -le ${APS} ]; do
742 eval a=\$QUALITY_${i}
743 [ -z "${a}" ] && break
744 @@ -439,15 +439,15 @@ iwconfig_scan()
745 eval ${x}_${k}=\$t
746 done
747 fi
748 - k=$((${k} + 1))
749 + : $(( k += 1 ))
750 done
751 - i=$((${i} + 1))
752 + : $(( i += 1 ))
753 done
754
755 # Strip any duplicates
756 local i=0 k=1 a= b=
757 while [ ${i} -lt ${APS} ]; do
758 - k=$((${i} + 1))
759 + : $(( k = i + 1 ))
760 while [ ${k} -le ${APS} ]; do
761 eval a=\$MAC_${i}
762 eval b=\$MAC_${k}
763 @@ -459,9 +459,9 @@ iwconfig_scan()
764 [ -n "${a}" -a -n "${b}" ] && [ "${a}" -lt "${b}" ] && u=${i}
765 unset MAC_${u} SSID_${u} MODE_${u} CHAN_${u} QUALITY_${u} ENC_${u}
766 fi
767 - k=$((${k} + 1))
768 + : $(( k += 1 ))
769 done
770 - i=$((${i} + 1))
771 + : $(( i += 1 ))
772 done
773
774 local i=0 e= m= s=
775 @@ -469,7 +469,7 @@ iwconfig_scan()
776 while [ ${i} -le ${APS} ]; do
777 eval x=\$MAC_${i}
778 if [ -z "${x}" ]; then
779 - i=$((${i} + 1))
780 + : $(( i += 1 ))
781 continue
782 fi
783
784 @@ -506,7 +506,7 @@ iwconfig_scan()
785 unset SSID_${i} MAC_${i} ${MODE}_${i} CHAN_${i} QUALITY_${i} ENC_${i}
786 fi
787 done
788 - i=$((${i} + 1))
789 + : $(( i += 1 ))
790 done
791 eoutdent
792 }
793 @@ -526,7 +526,7 @@ iwconfig_force_preferred()
794 found_AP=true
795 break
796 fi
797 - i=$((${i} + 1))
798 + : $(( i += 1 ))
799 done
800 if ! ${found_AP}; then
801 SSID=${ssid}
802 @@ -559,7 +559,7 @@ iwconfig_connect_preferred()
803 iwconfig_associate "${mode}" "${mac}" "${enc}" "${freq}" \
804 "${chan}" && return 0
805 fi
806 - i=$((${i} + 1))
807 + : $(( i += 1 ))
808 done
809 done
810
811 @@ -593,7 +593,7 @@ iwconfig_connect_not_preferred()
812 "${chan}" && return 0
813 fi
814 fi
815 - i=$((${i} + 1))
816 + : $(( i += 1 ))
817 done
818
819 return 1
820
821 diff --git a/net/netplugd.sh b/net/netplugd.sh
822 index f7df7a3..f43a5e6 100644
823 --- a/net/netplugd.sh
824 +++ b/net/netplugd.sh
825 @@ -74,7 +74,7 @@ netplugd_pre_start()
826 fi
827 sleep 1
828 [ ${timeout} -eq 0 ] && continue
829 - i=$((${i} + 1))
830 + : $(( i += 1 ))
831 [ ${i} -ge ${timeout} ] && break
832 done
833
834
835 diff --git a/net/pppd.sh b/net/pppd.sh
836 index 1f9d302..97bd3ee 100644
837 --- a/net/pppd.sh
838 +++ b/net/pppd.sh
839 @@ -96,7 +96,7 @@ pppd_pre_start()
840 if ! ${hasdefaultmetric}; then
841 local m=
842 eval m=\$metric_${IFVAR}
843 - [ -z "${m}" ] && m=$((${metric} + $(_ifindex)))
844 + [ -z "${m}" ] && : $(( m = metric + $(_ifindex) ))
845 opts="${opts} defaultmetric ${m}"
846 fi
847 if [ -n "${mtu}" ]; then
848
849 diff --git a/net/tuntap.sh b/net/tuntap.sh
850 index 884e0ab..ac505ab 100644
851 --- a/net/tuntap.sh
852 +++ b/net/tuntap.sh
853 @@ -30,7 +30,7 @@ tuntap_pre_start()
854 local timeout=10
855 while [ ! -e /dev/net/tun -a ${timeout} -gt 0 ]; do
856 sleep 1
857 - timeout=$((${timeout} - 1))
858 + : $(( timeout -= 1 ))
859 done
860 if [ ! -e /dev/net/tun ]; then
861 eerror "TUN/TAP support present but /dev/net/tun is not"
862
863 diff --git a/net/wpa_supplicant.sh b/net/wpa_supplicant.sh
864 index 91de49e..53b0256 100644
865 --- a/net/wpa_supplicant.sh
866 +++ b/net/wpa_supplicant.sh
867 @@ -34,7 +34,7 @@ _get_ssid()
868 return 0
869 fi
870 sleep 1
871 - timeout=$((timeout - 1))
872 + : $(( timeout -= 1 ))
873 done
874
875 return 1
876
877 diff --git a/sh/functions.sh.in b/sh/functions.sh.in
878 index 1d1b0cd..b00ec68 100644
879 --- a/sh/functions.sh.in
880 +++ b/sh/functions.sh.in
881 @@ -8,14 +8,14 @@ RC_GOT_FUNCTIONS="yes"
882
883 eindent()
884 {
885 - EINFO_INDENT=$((${EINFO_INDENT:-0} + 2))
886 + : $(( EINFO_INDENT = ${EINFO_INDENT:-0} + 2 ))
887 [ "$EINFO_INDENT" -gt 40 ] && EINFO_INDENT=40
888 export EINFO_INDENT
889 }
890
891 eoutdent()
892 {
893 - EINFO_INDENT=$((${EINFO_INDENT:-0} - 2))
894 + : $(( EINFO_INDENT = ${EINFO_INDENT:-0} - 2 ))
895 [ "$EINFO_INDENT" -lt 0 ] && EINFO_INDENT=0
896 return 0
897 }
898
899 diff --git a/sh/rc-mount.sh b/sh/rc-mount.sh
900 index b3c9bf6..2bb1450 100644
901 --- a/sh/rc-mount.sh
902 +++ b/sh/rc-mount.sh
903 @@ -59,7 +59,7 @@ do_unmount()
904 eend 1
905 else
906 local sig="TERM"
907 - retry=$(($retry - 1))
908 + : $(( retry -= 1 ))
909 [ $retry = 1 ] && sig="KILL"
910 fuser $f_kill$sig -k $f_opts \
911 "$mnt" >/dev/null 2>&1
912
913 diff --git a/sh/runtests.sh b/sh/runtests.sh
914 index 7f7e7bd..f083ff4 100755
915 --- a/sh/runtests.sh
916 +++ b/sh/runtests.sh
917 @@ -9,17 +9,17 @@ tret=0
918 ebegin "Testing yesno()"
919 for f in yes YES Yes true TRUE True 1 ; do
920 if ! yesno $f; then
921 - tret=$(($tret + 1))
922 + : $(( tret += 1 ))
923 echo "!$f!"
924 fi
925 done
926 for f in no NO No false FALSE False 0 ; do
927 if yesno $f; then
928 - tret=$(($tret + 1))
929 + : $(( tret += 1 ))
930 echo "!$f!"
931 fi
932 done
933 eend $tret
934 -ret=$(($ret + $tret))
935 +: $(( ret += $tret ))
936
937 exit $ret
938
939 diff --git a/src/test/runtests.sh b/src/test/runtests.sh
940 index 4731bd7..a4b3f18 100755
941 --- a/src/test/runtests.sh
942 +++ b/src/test/runtests.sh
943 @@ -15,7 +15,7 @@ checkit() {
944 echo "$@" | tr ' ' '\n' > ${base}.out
945 diff -u ${base}.list ${base}.out
946 eend $?
947 - ret=$(($ret + $?))
948 + : $(( ret += $? ))
949 }
950
951 ret=0
952 @@ -65,7 +65,7 @@ readelf -Wr $(grep -l '#include[[:space:]]"librc\.h"' ${librc_srcdir}/*.c | sed
953 syms=$(diff -u librc.funcs.hidden.list librc.funcs.hidden.out | sed -n '/^+[^+]/s:^+::p')
954 [ -z "${syms}" ]
955 eend $? "Missing hidden defs:"$'\n'"${syms}"
956 -ret=$(($ret + $?))
957 +: $(( ret += $? ))
958
959 ebegin "Checking trailing whitespace in code"
960 # XXX: Should we check man pages too ?
961 @@ -118,7 +118,7 @@ for u in units/*; do
962 ebegin "$(basename "${u}")"
963 ./"${u}"
964 eend $?
965 - ret=$(($ret + $?))
966 + : $(( ret += $? ))
967 done
968
969 exit ${ret}
970
971 diff --git a/support/openvpn/up.sh b/support/openvpn/up.sh
972 index 1456932..c52ea04 100755
973 --- a/support/openvpn/up.sh
974 +++ b/support/openvpn/up.sh
975 @@ -34,7 +34,7 @@ while true; do
976 elif [ "${opt}" != "${opt#dhcp-option DNS *}" ]; then
977 NS="${NS}nameserver ${opt#dhcp-option DNS *}\n"
978 fi
979 - i=$((${i} + 1))
980 + : $(( i += 1 ))
981 done
982
983 if [ -n "${NS}" ]; then