Sylpheed in mailto_prgs list makes obvious why the new implementation with Bash arrays is more powerful. imz@altlinux.ru, November 2001 --- urlview-0.9/url_handler.sh.paths Thu Nov 29 23:43:37 2001 +++ urlview-0.9/url_handler.sh Thu Nov 29 23:50:49 2001 @@ -2,6 +2,8 @@ # Copyright (c) 1998 Martin Schulze # Slightly modified by Luis Francisco Gonzalez +# Path lists implemented with Bash-arrays +# by Ivan Zakharyaschev November 2001 # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -29,15 +31,15 @@ # VT: Launch in the same terminal # The lists of programs to be executed are -https_prgs="/usr/X11R6/bin/netscape:XW /usr/bin/lynx:XT" -http_prgs="/usr/bin/lynx:XT /usr/X11R6/bin/netscape:XW" -mailto_prgs="/usr/bin/mutt:VT /usr/bin/elm:VT /usr/bin/pine:VT /usr/bin/mail:VT" -gopher_prgs="/usr/bin/lynx:XT /usr/bin/gopher:XT" -ftp_prgs="/usr/bin/lynx:XT /usr/bin/ncftp:XT" +https_prgs=(/usr/bin/mozilla:PW /usr/bin/netscape:PW /usr/bin/galeon:PW /usr/bin/skipstone:PW /usr/bin/lynx:XT /usr/bin/links:XT) +http_prgs=("${https_prgs[@]}") +mailto_prgs=(/usr/bin/mutt:VT '/usr/bin/sylpheed --compose:PW' /usr/bin/pine:VT /usr/bin/elm:VT /usr/bin/mailto:VT /bin/mail:VT) +gopher_prgs=(/usr/bin/lynx:XT /usr/bin/gopher:XT) +ftp_prgs=(/usr/bin/gftp:PW /usr/bin/lynx:XT /usr/bin/ncftp:XT /usr/bin/links:XT) # Program used as an xterm (if it doesn't support -T you'll need to change # the command line in getprg) -XTERM=/usr/X11R6/bin/xterm +XTERM=/usr/bin/xvt ########################################################################### @@ -47,11 +49,11 @@ { local ele tag prog - for ele in $* + for ele in "$@" do tag=${ele##*:} prog=${ele%%:*} - if [ -x $prog ]; then + if [ -x ${prog%% *} ]; then case $tag in PW) [ -n "$DISPLAY" ] && echo "P:$prog" && return 0 ;; @@ -87,20 +89,20 @@ case $type in https) - prg=`getprg $https_prgs` + prg=`getprg "${https_prgs[@]}"` ;; http) - prg=`getprg $http_prgs` + prg=`getprg "${http_prgs[@]}"` ;; ftp) - prg=`getprg $ftp_prgs` + prg=`getprg "${ftp_prgs[@]}"` ;; mailto) - prg=`getprg $mailto_prgs` + prg=`getprg "${mailto_prgs[@]}"` url="${url#mailto:}" ;; gopher) - prg=`getprg $gopher_prgs` + prg=`getprg "${gopher_prgs[@]}"` ;; *) echo "Unknown URL type. Please report URL and viewer to"