diff options
Diffstat (limited to 'util/fbsetbg')
-rw-r--r-- | util/fbsetbg | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/util/fbsetbg b/util/fbsetbg index 0aa0a31..09bcc77 100644 --- a/util/fbsetbg +++ b/util/fbsetbg | |||
@@ -23,7 +23,7 @@ | |||
23 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | 23 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
24 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 24 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
25 | # | 25 | # |
26 | # $Id: fbsetbg,v 1.3 2003/04/29 11:26:34 rathnor Exp $ | 26 | # $Id: fbsetbg,v 1.4 2003/04/29 13:50:05 fluxgen Exp $ |
27 | 27 | ||
28 | # | 28 | # |
29 | # Portability notes: | 29 | # Portability notes: |
@@ -49,7 +49,7 @@ WHOAMI=`whoami` | |||
49 | # Functions | 49 | # Functions |
50 | display_usage() { | 50 | display_usage() { |
51 | cat <<EOF | 51 | cat <<EOF |
52 | Usage: fbsetbg [-fct /path/to/wallpaper ] [ -l ] [ -h ] | 52 | Usage: fbsetbg [ -fcta /path/to/wallpaper ] [ -l ] [ -h ] [ -d ] |
53 | EOF | 53 | EOF |
54 | } | 54 | } |
55 | 55 | ||
@@ -229,8 +229,8 @@ case "${COMMAND_LINE_ARGUMENT}" in | |||
229 | ;; | 229 | ;; |
230 | l) | 230 | l) |
231 | if [ -r $lastwallpaper ];then | 231 | if [ -r $lastwallpaper ];then |
232 | option=$(head -n1 $lastwallpaper) | 232 | option=`head -n1 $lastwallpaper` |
233 | wallpaper=$(tail -n1 $lastwallpaper) | 233 | wallpaper=`tail -n1 $lastwallpaper` |
234 | else | 234 | else |
235 | message 'No previous wallpaper recorded.' | 235 | message 'No previous wallpaper recorded.' |
236 | fi | 236 | fi |
@@ -238,19 +238,26 @@ case "${COMMAND_LINE_ARGUMENT}" in | |||
238 | h) display_help ; exit 0 ;; | 238 | h) display_help ; exit 0 ;; |
239 | T) display_tips ; exit 0 ;; | 239 | T) display_tips ; exit 0 ;; |
240 | -) echo "fbsetbg doesn't recognize -- gnu-longopts." | 240 | -) echo "fbsetbg doesn't recognize -- gnu-longopts." |
241 | echo "Use fbsetbg -h for a long help message." | 241 | echo 'Use fbsetbg -h for a long help message.' |
242 | display_usage | 242 | display_usage |
243 | exit 1 | 243 | exit 1 |
244 | ;; | 244 | ;; |
245 | *) if [ ! -r "$1" ]; then | ||
246 | echo "$1 isn't an existing wallpaper or a valid option." >&2 | ||
247 | display_usage | ||
248 | exit 1 | ||
249 | fi | ||
250 | if [ -z "$1" ];then | ||
251 | message 'No wallpaper to set' >&2 | ||
252 | display_usage | ||
253 | exit 1 | ||
254 | fi | ||
255 | ;; | ||
245 | esac | 256 | esac |
246 | 257 | ||
247 | option=${option:=$full} | 258 | option=${option:=$full} |
248 | wallpaper=${wallpaper:=$1} | 259 | wallpaper=${wallpaper:=$1} |
249 | 260 | ||
250 | if [ -z "$wallpaper" ];then | ||
251 | message 'No wallpaper to set' | ||
252 | exit 1 | ||
253 | fi | ||
254 | 261 | ||
255 | if [ ! -r "$wallpaper" ];then | 262 | if [ ! -r "$wallpaper" ];then |
256 | message "Can't find wallpaper $wallpaper" | 263 | message "Can't find wallpaper $wallpaper" |