diff options
author | simonb <simonb> | 2005-03-10 13:53:26 (GMT) |
---|---|---|
committer | simonb <simonb> | 2005-03-10 13:53:26 (GMT) |
commit | b7d3dc2fa389706bde066219b11d3b66832cfa9e (patch) | |
tree | bef84fcad42c7788ff3473b9f8a6f51c4e33ed8e /util/fbsetbg | |
parent | aa0a9cd50674fbf55ae05c29ae4cbb873f2c55c0 (diff) | |
download | fluxbox_paul-b7d3dc2fa389706bde066219b11d3b66832cfa9e.zip fluxbox_paul-b7d3dc2fa389706bde066219b11d3b66832cfa9e.tar.bz2 |
fix 'which' program compatibility.
Test the capabilities of the one we find, rather than guessing
based on the system type
Diffstat (limited to 'util/fbsetbg')
-rw-r--r-- | util/fbsetbg | 42 |
1 files changed, 21 insertions, 21 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 | ||