update from Han

This commit is contained in:
fluxgen 2003-04-29 13:50:05 +00:00
parent 6b125d1c60
commit 80c1f78cb5

View file

@ -23,7 +23,7 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
# $Id: fbsetbg,v 1.3 2003/04/29 11:26:34 rathnor Exp $ # $Id: fbsetbg,v 1.4 2003/04/29 13:50:05 fluxgen Exp $
# #
# Portability notes: # Portability notes:
@ -49,7 +49,7 @@ WHOAMI=`whoami`
# Functions # Functions
display_usage() { display_usage() {
cat <<EOF cat <<EOF
Usage: fbsetbg [-fct /path/to/wallpaper ] [ -l ] [ -h ] Usage: fbsetbg [ -fcta /path/to/wallpaper ] [ -l ] [ -h ] [ -d ]
EOF EOF
} }
@ -229,8 +229,8 @@ case "${COMMAND_LINE_ARGUMENT}" in
;; ;;
l) l)
if [ -r $lastwallpaper ];then if [ -r $lastwallpaper ];then
option=$(head -n1 $lastwallpaper) option=`head -n1 $lastwallpaper`
wallpaper=$(tail -n1 $lastwallpaper) wallpaper=`tail -n1 $lastwallpaper`
else else
message 'No previous wallpaper recorded.' message 'No previous wallpaper recorded.'
fi fi
@ -238,19 +238,26 @@ case "${COMMAND_LINE_ARGUMENT}" in
h) display_help ; exit 0 ;; h) display_help ; exit 0 ;;
T) display_tips ; exit 0 ;; T) display_tips ; exit 0 ;;
-) echo "fbsetbg doesn't recognize -- gnu-longopts." -) echo "fbsetbg doesn't recognize -- gnu-longopts."
echo "Use fbsetbg -h for a long help message." echo 'Use fbsetbg -h for a long help message.'
display_usage display_usage
exit 1 exit 1
;; ;;
*) if [ ! -r "$1" ]; then
echo "$1 isn't an existing wallpaper or a valid option." >&2
display_usage
exit 1
fi
if [ -z "$1" ];then
message 'No wallpaper to set' >&2
display_usage
exit 1
fi
;;
esac esac
option=${option:=$full} option=${option:=$full}
wallpaper=${wallpaper:=$1} wallpaper=${wallpaper:=$1}
if [ -z "$wallpaper" ];then
message 'No wallpaper to set'
exit 1
fi
if [ ! -r "$wallpaper" ];then if [ ! -r "$wallpaper" ];then
message "Can't find wallpaper $wallpaper" message "Can't find wallpaper $wallpaper"