chiark
/
gitweb
/
~mdw
/
profile
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e10a95a
)
dot/xinitrc: Use $(( ... )) consistently for arithmetic evaluation.
author
Mark Wooding
<mdw@distorted.org.uk>
Sat, 23 Apr 2016 11:41:39 +0000
(12:41 +0100)
committer
Mark Wooding
<mdw@distorted.org.uk>
Sat, 23 Apr 2016 11:41:39 +0000
(12:41 +0100)
dot/xinitrc
patch
|
blob
|
blame
|
history
diff --git
a/dot/xinitrc
b/dot/xinitrc
index 9bf7a85d09346eb523c06d376ec4c479be545df8..7f6d4158fc42af59ae49d3e347ef176c6e355702 100755
(executable)
--- a/
dot/xinitrc
+++ b/
dot/xinitrc
@@
-275,14
+275,14
@@
declare -i panelwd=64 xbound=$(( XWIDTH - panelwd ))
declare -i lim=XSCR0_WIDTH
if (( lim > xbound )); then lim=xbound; fi
declare -i lim=XSCR0_WIDTH
if (( lim > xbound )); then lim=xbound; fi
-declare -i ecols=
"(lim - t_wd - e_hextra)/e_colwd"
+declare -i ecols=
$(( (lim - t_wd - e_hextra)/e_colwd ))
if (( ecols < 2 && lim > 2*e_colwd + e_hextra )); then ecols=2
elif (( ecols < 1 )); then ecols=1
fi
declare -i \
if (( ecols < 2 && lim > 2*e_colwd + e_hextra )); then ecols=2
elif (( ecols < 1 )); then ecols=1
fi
declare -i \
- emacsx=
"ecols*e_colchars + e_cextra"
\
- emacsy=
"(XHEIGHT - e_vextra)/e_lineht"
+ emacsx=
$(( ecols*e_colchars + e_cextra ))
\
+ emacsy=
$(( (XHEIGHT - e_vextra)/e_lineht ))
start-emacs () {
GDK_NATIVE_WINDOWS=1 run bgclients noip \
start-emacs () {
GDK_NATIVE_WINDOWS=1 run bgclients noip \
@@
-302,9
+302,10
@@
start-emacs () {
start-xterms () {
## Initialize some parameters.
start-xterms () {
## Initialize some parameters.
- declare -i x=
"ecols*e_colwd + e_hextra + XSCR0_X"
xb=xbound
+ declare -i x=
$(( ecols*e_colwd + e_hextra + XSCR0_X ))
xb=xbound
declare -i n=0 pgx=0 l h y ht scr=0 ll=lim
declare -i n=0 pgx=0 l h y ht scr=0 ll=lim
- declare -i hstd="35*t_lineht + t_vextra" hmin="25*t_lineht + t_vextra"
+ declare -i hstd=$(( 35*t_lineht + t_vextra ))
+ declare -i hmin=$(( 25*t_lineht + t_vextra ))
declare -i scrx scry scrwd scrht
eval "scrx=\$XSCR${scr}_X scry=\$XSCR${scr}_Y
declare -i scrx scry scrwd scrht
eval "scrx=\$XSCR${scr}_X scry=\$XSCR${scr}_Y
@@
-314,7
+315,7
@@
start-xterms () {
while :; do
## Start a new iteration.
while :; do
## Start a new iteration.
- if ((
x + t_wd > ll
)); then
+ if ((
x + t_wd > ll
)); then
scr=$(( scr + 1 ))
if (( scr >= XNSCR )); then
if (( n >= 3 )); then break; fi
scr=$(( scr + 1 ))
if (( scr >= XNSCR )); then
if (( n >= 3 )); then break; fi
@@
-330,21
+331,21
@@
start-xterms () {
## Make large xterms.
y=scry ht=scrht
## Make large xterms.
y=scry ht=scrht
- while ((
ht - hstd >= hmin
)); do
+ while ((
ht - hstd >= hmin
)); do
run bgclients $term $geom 80x35+$x+$y
run bgclients $term $geom 80x35+$x+$y
- y=
"y + hstd" ht="ht - hstd" n="n + 1"
+ y=
$(( y + hstd )) ht=$(( ht - hstd )) n=$(( n + 1 ))
done
## Fill the remaining space.
done
## Fill the remaining space.
- if ((
ht >= 2 * hmin)); then h="ht - hmin"
; else h=ht; fi
- l=
"(h - t_vextra)/t_lineht" h="l * t_lineht + t_vextra"
+ if ((
ht >= 2*hmin )); then h=$(( ht - hmin ))
; else h=ht; fi
+ l=
$(( (h - t_vextra)/t_lineht )) h=$(( l*t_lineht + t_vextra ))
run bgclients $term $geom 80x$l+$x+$y
run bgclients $term $geom 80x$l+$x+$y
- y=
"y + h" ht="ht - h" n="n + 1"
+ y=
$(( y + h )) ht=$(( ht - h )) n=$(( n + 1 ))
if ((ht >= hmin)); then
run bgclients $term $geom 80x25+$x+$y
if ((ht >= hmin)); then
run bgclients $term $geom 80x25+$x+$y
- n=
"n + 1"
+ n=
$(( n + 1 ))
fi
fi
- x=
"x + t_wd"
+ x=
$(( x + t_wd ))
done
}
done
}