Merge branch 'refs/heads/t/help-a' into pu
[gsu.git] / gui
diff --git a/gui b/gui
index 34f732e..4297564 100644 (file)
--- a/gui
+++ b/gui
@@ -4,7 +4,7 @@
 
 if [[ "$(type -t _gsu_setup)" != "function" ]]; then
        gsu_dir=${gsu_dir:-${BASH_SOURCE[0]%/*}}
-       . $gsu_dir/common || exit 1
+       . "$gsu_dir/common" || exit 1
        _gsu_setup
 fi
 
@@ -20,7 +20,7 @@ _get_geometry()
        fi
        x="${result#* }"
        y="${result%% *}"
-       (($x > 190)) && x=190
+       ((x > 190)) && x=190
        result="$y $x"
 }
 
@@ -85,7 +85,7 @@ gsu_msgbox()
        # Some versions of dialog segfault if the text is too long. Hence we
        # always use a temporary file.
        gsu_make_tempfile 'gsu_msgbox.XXXXXXXXXX'
-       (($ret < 0)) && return
+       ((ret < 0)) && return
        tmp="$result"
        trap "rm -f $tmp" EXIT
        echo "$1" > "$tmp"
@@ -97,7 +97,7 @@ _gsu_menu()
 {
        local header="${1:-root}"
        local items="$2"
-       local i state opts num=0
+       local i opts num=0
 
        _get_geometry
        opts="$result 16"
@@ -132,7 +132,7 @@ _get_subtree()
        #echo "line: $line_num, root: $root, indent level: $level"
        result="$(sed -e "1,${line_num}d;" <<< "$tree" \
                | sed -e "/^$TAB\{1,$level\}$_gsu_node_name_pattern/,\$d" \
-               | sed -e "/^$TAB\{$(($level + 2))\}/d")"
+               | sed -e "/^$TAB\{$((level + 2))\}/d")"
        if (($? != 0)); then
                ret=-$E_GSU_MENU_TREE
                result="sed command for subtree $root failed"
@@ -161,15 +161,15 @@ _browse()
 
        while :; do
                _gsu_menu "$header" "$subtree"
-               (($ret < 0)) && return
+               ((ret < 0)) && return
                [[ -z "$result" ]] && return # menu was cancelled
                if [[ "${result%/}" != "$result" ]]; then
                        old_header="$header"
                        header="$result"
                        _get_subtree "$tree" "$header"
-                       (($ret < 0)) && return
+                       ((ret < 0)) && return
                        _browse "$header" "$tree" "$result"
-                       (($ret < 0)) && return
+                       ((ret < 0)) && return
                        header="$old_header"
                        continue
                fi