diff options
-rw-r--r-- | util/fbsetbg | 42 | ||||
-rwxr-xr-x | util/fluxbox-generate_menu.in | 87 |
2 files changed, 59 insertions, 70 deletions
diff --git a/util/fbsetbg b/util/fbsetbg index 3db53da..a75f461 100644 --- a/util/fbsetbg +++ b/util/fbsetbg | |||
@@ -130,28 +130,28 @@ Common tips to use with $command: | |||
130 | EOF | 130 | EOF |
131 | } | 131 | } |
132 | 132 | ||
133 | # ugly code for solaris compat. | 133 | # some which's have a reliable return code, some don't |
134 | case `uname` in | 134 | # Lets figure out which which we have. |
135 | Linux|*BSD) | 135 | if which this_program_does_not_exist-no_really-aA1zZ9 >/dev/null 2>/dev/null; then |
136 | find_it() { | 136 | # can't rely on return value |
137 | which $1 > /dev/null 2>&1 && shift && $* | 137 | find_it() { |
138 | } | 138 | file=`which $1 2> /dev/null` |
139 | ;; | 139 | if [ -x "$file" ]; then |
140 | *) | 140 | if [ $# -gt 1 ]; then |
141 | find_it() { | 141 | shift |
142 | file=`which $1 2> /dev/null` | 142 | $* |
143 | if [ -x "$file" ]; then | ||
144 | if [ $# -gt 1 ]; then | ||
145 | shift | ||
146 | $* | ||
147 | fi | ||
148 | return 0 | ||
149 | else | ||
150 | return 1 | ||
151 | fi | 143 | fi |
152 | } | 144 | return 0 |
153 | ;; | 145 | else |
154 | esac | 146 | return 1 |
147 | fi | ||
148 | } | ||
149 | else | ||
150 | # can rely on return value | ||
151 | find_it() { | ||
152 | which $1 > /dev/null 2>&1 && shift && $* | ||
153 | } | ||
154 | fi | ||
155 | 155 | ||
156 | message() { | 156 | message() { |
157 | 157 | ||
diff --git a/util/fluxbox-generate_menu.in b/util/fluxbox-generate_menu.in index 5a38247..d77b44b 100755 --- a/util/fluxbox-generate_menu.in +++ b/util/fluxbox-generate_menu.in | |||
@@ -123,59 +123,48 @@ fluxbox-generate_menu was brought to you by: | |||
123 | EOF | 123 | EOF |
124 | } | 124 | } |
125 | 125 | ||
126 | # ugly code for solaris compat. | 126 | # some which's have a reliable return code, some don't |
127 | UNAME=`uname` | 127 | # Lets figure out which which we have. |
128 | # echo "UNAME=$UNAME" | 128 | if which this_program_does_not_exist-no_really-aA1zZ9 >/dev/null 2>/dev/null; then |
129 | case "$UNAME" in | 129 | # can't rely on return value |
130 | Linux|*BSD) | 130 | find_it() { |
131 | find_it() { | 131 | file=`which $1 2> /dev/null` |
132 | which $1 > /dev/null 2>&1 && shift && $* | 132 | if [ -x "$file" ]; then |
133 | } | 133 | if [ $# -gt 1 ]; then |
134 | 134 | shift | |
135 | find_it_options() { | 135 | $* |
136 | which $1 > /dev/null 2>&1 | ||
137 | } | ||
138 | ;; | ||
139 | *) | ||
140 | find_it() { | ||
141 | file=`which $1 2> /dev/null` | ||
142 | if [ -x "$file" ]; then | ||
143 | if [ $# -gt 1 ]; then | ||
144 | shift | ||
145 | $* | ||
146 | fi | ||
147 | return 0 | ||
148 | else | ||
149 | return 1 | ||
150 | fi | 136 | fi |
151 | } | 137 | return 0 |
138 | else | ||
139 | return 1 | ||
140 | fi | ||
141 | } | ||
152 | 142 | ||
153 | find_it_options() { | 143 | find_it_options() { |
154 | file=`which $1 2> /dev/null` | 144 | file=`which $1 2> /dev/null` |
155 | if [ -x "$file" ]; then | 145 | if [ -x "$file" ]; then |
156 | return 0 | 146 | return 0 |
157 | else | 147 | else |
158 | return 1 | 148 | return 1 |
159 | fi | 149 | fi |
160 | } | 150 | } |
161 | 151 | ||
162 | ;; | 152 | else |
163 | esac | 153 | # can rely on return value |
154 | find_it() { | ||
155 | which $1 > /dev/null 2>&1 && shift && $* | ||
156 | } | ||
164 | 157 | ||
165 | case "$UNAME" in | 158 | find_it_options() { |
166 | Linux) | 159 | which $1 > /dev/null 2>&1 |
167 | replaceWithinString(){ | 160 | } |
168 | #echo "replaceWithinString: $1, $2, $3" >&2 | 161 | fi |
169 | #echo ${1//$2/$3} # causes error in BSD even though not used | 162 | |
170 | echo $1 | awk "{ gsub(/$2/, \"$3\"); print }" | 163 | #echo "replaceWithinString: $1, $2, $3" >&2 |
171 | } | 164 | #echo ${1//$2/$3} # causes error in BSD even though not used |
172 | ;; | 165 | replaceWithinString(){ |
173 | *BSD) | 166 | echo $1 | awk "{ gsub(/$2/, \"$3\"); print }" |
174 | replaceWithinString(){ | 167 | } |
175 | echo $1 | awk "{ gsub(/$2/, \"$3\"); print }" | ||
176 | } | ||
177 | ;; | ||
178 | esac | ||
179 | 168 | ||
180 | convertIcon(){ | 169 | convertIcon(){ |
181 | if [ ! -f "$1" ] ; then | 170 | if [ ! -f "$1" ] ; then |