Re: Using urlview for FTP?

2001-01-31 Thread G.Embery

On Tue, Jan 30, 2001 at 11:59:03AM -0500, Dan Boger wrote:
 On Tue, Jan 30, 2001 at 08:47:20AM -0800, Ben Reser wrote:
  Not possible right now.  urlview only knows how to use one program.  You can
  use the COMMAND option in the .urlview file to change from netscape to another
  program but you can set one for ftp and one for http...
 
 unless you write a wrapper script, put it as your COMMAND, and have it
 check if it's an ftp url, or a https? url, or whatever...
 

Here's what i do.

1. in my ~/.muttrc i have 
macro index F9 |urlview\n 'extract web URLs and goto'
macro pager F9 |urlview\n 'extract web URLs and goto'

2. in my ~/.urlview i have
COMMAND choose_web_vwr.sh '%s'

3. the script choose_web_vwr.sh asks the user whether to use
   netscape, lynx, wget etc. with appropriate defaults depending
   on file extension and whether http is found etc..   See
   attachment for the script.


-- 
Disclaimer:  These are my opinions, not those of my employer
Gerald K. Embery ;  e-mail: [EMAIL PROTECTED]
Bureau of Meteorology Research Centre,  
Melbourne, Australia ;   http://www.bom.gov.au/  bmrc/medr/gke.html


#!/bin/ksh
# choose whether to use netscape/lynx/...

while test $# -gt 0
do
if `RunningX`
then
reply='x'
case $1 in
# piccy files to be viewed with Netscape
 *.jpg|*.jpeg|*.gif|*.png)
openin='N'
opentype='openFile'
;;
# files to be downloaded (probably)
 *.gz|*.tgz|*.tar|*.bz2|*.Z|*.rpm|*.deb)
openin='g'
opentype='openURL'
;;
 http://*)
openin='n'
opentype='openURL'
;;
 www.*)
openin='n'
opentype='openURL'
;;
 ftp://*)
openin='n'
opentype='openURL'
;;
 ftp.*)
openin='n'
opentype='openURL'
;;
 /tmp/*)
openin='k'
opentype='openFile'
;;
 /scratch*/*)
openin='k'
opentype='openFile'
;;
 *.html)
openin='n'
opentype='openFile'
;;
 *.htm)
openin='n'
opentype='openFile'
;;
 *)
openin='n'
opentype='openFile'
;;
esac

#set -vx
filename=$1 

   # if a file, do we need to fill out with pathname? 
if test "${opentype}" = 'openFile' 
then
case $1 in
 /*)
   # full path provided ... good.
if test -f $1
then
filename=${1}
fi
;;
 *)
   # not full path name,
   # can we fill in with current working directory ?
if test -f `pwd`/$1
then
filename=`pwd`/${1}
else
echo "File not found - searching in FINDPATH for possibles"
   # check all our paths  
tempfile=/scratch0/ch.$$
fncd $1  $tempfile
vim -c "echo 'remove those you were NOT after'" $tempfile
filename=`cat $tempfile`
rm $tempfile
fi
;;
esac
fi
#set +vx

if test "${openin}" = 'n'
then
echo -n "Netscape/Lynx/W3m/linKs (n,l,w,k)[$openin]:"
elif test "${openin}" = 'N'
then
   # here a (direct) file has been given only suitable for Netscape.
set -vx
(netscape -iconic -noraise -remote "${opentype}($filename)" || netscape 
-install -iconic "$filename") 
set +vx
shift
if test $# -gt 0
then
sleep 20   # this is to allow netscape time between several images 
fi
continue
else
echo -n "Netscape/Lynx/W3m/linKs/wGet/Text (n,l,w,k,g,t)[$openin]:"
fi
while [[ x$reply != x  $reply != [nlLwWkKgtq] ]]
do
read reply
if test x"${reply}" != xq   #  q for quit
then
if test x"${reply}" = x
then
reply=$openin
fi
if test "${reply}" = 'n'
then
set -vx
(netscape -iconic -noraise -remote "${opentype}($filename)" || 
netscape -install -iconic "$filename") 
set +vx
elif test "${reply}" = 'L'
then
set -vx
/libraries0/bmrc/bin/color_xterm -title "Lynx $filename" -geometry 
100x30 -e /libraries0/bmrc/bin/lynx $filename 
set +vx
elif test "${reply}" = 'l'
then
set -vx
/libraries0/bmrc/bin/lynx $filename 
  

Using urlview for FTP?

2001-01-30 Thread Conor Daly

Just noticed, that my urlview launched mozilla to view the below ftp type
URLs.  Does anyone know how to have urlview launch wget for FTP and
mozilla for HTTP?  man urlview says nothing.  Maybe I need a binding in
mutt insteadi?

ftp://updates.redhat.com/6.2/i386/bind-8.2.3-0.6.x.i386.rpm
ftp://updates.redhat.com/6.2/i386/bind-utils-8.2.3-0.6.x.i386.rpm

-- 
Conor Daly [EMAIL PROTECTED]

Domestic Sysadmin :-)
-
faenor.cod.ie
  1:16pm  up 98 days, 19:44,  0 users,  load average: 0.02, 0.13, 0.08

Hobbiton.cod.ie
  1:12pm  up 4 days,  3:01,  2 users,  load average: 0.06, 0.03, 0.00



Re: Using urlview for FTP?

2001-01-30 Thread Jeff Howie

On Tue, Jan 30, 2001 at 01:13:41PM +, Conor Daly wrote:
 Just noticed, that my urlview launched mozilla to view the below ftp type
 URLs.  Does anyone know how to have urlview launch wget for FTP and
 mozilla for HTTP?  man urlview says nothing.  Maybe I need a binding in
 mutt insteadi?

Just edit the COMMAND line in your ~/.urlview file to something like
this:
 
COMMAND wget '%s'

-- 
thks.jeff



Re: Using urlview for FTP?

2001-01-30 Thread Ben Reser

Not possible right now.  urlview only knows how to use one program.  You can
use the COMMAND option in the .urlview file to change from netscape to another
program but you can set one for ftp and one for http...

On Tue, Jan 30, 2001 at 01:13:41PM +, Conor Daly wrote:
 Just noticed, that my urlview launched mozilla to view the below ftp type
 URLs.  Does anyone know how to have urlview launch wget for FTP and
 mozilla for HTTP?  man urlview says nothing.  Maybe I need a binding in
 mutt insteadi?
 
 ftp://updates.redhat.com/6.2/i386/bind-8.2.3-0.6.x.i386.rpm
 ftp://updates.redhat.com/6.2/i386/bind-utils-8.2.3-0.6.x.i386.rpm

-- 
Ben Reser [EMAIL PROTECTED]
http://ben.reser.org

Pool is a game of racism for it is the white ball eliminating all the
other races off the green felt earth.



Re: Using urlview for FTP?

2001-01-30 Thread Dan Boger

On Tue, Jan 30, 2001 at 08:47:20AM -0800, Ben Reser wrote:
 Not possible right now.  urlview only knows how to use one program.  You can
 use the COMMAND option in the .urlview file to change from netscape to another
 program but you can set one for ftp and one for http...

unless you write a wrapper script, put it as your COMMAND, and have it
check if it's an ftp url, or a https? url, or whatever...

-- 
Dan Boger
System Administrator
Brainbench linux MVP
http://www.brainbench.com




Re: Using urlview for FTP?

2001-01-30 Thread Conor Daly

On Tue, Jan 30, 2001 at 10:00:10AM -0600 or so it is rumoured hereabouts, 
Jeff Howie thought:
 On Tue, Jan 30, 2001 at 01:13:41PM +, Conor Daly wrote:
  Just noticed, that my urlview launched mozilla to view the below ftp type
  URLs.  Does anyone know how to have urlview launch wget for FTP and
  mozilla for HTTP?  man urlview says nothing.  Maybe I need a binding in
  mutt insteadi?
 
 Just edit the COMMAND line in your ~/.urlview file to something like
 this:
  
 COMMAND wget '%s'
 
 -- 
 thks.jeff
But will that not call wget for HTTP URLs also?
-- 
Conor Daly [EMAIL PROTECTED]

Domestic Sysadmin :-)
-
faenor.cod.ie
  4:09pm  up 98 days, 22:38,  0 users,  load average: 0.00, 0.06, 0.08

Hobbiton.cod.ie
  4:06pm  up 4 days,  5:55,  1 user,  load average: 0.06, 0.03, 0.00



Re: Using urlview for FTP?

2001-01-30 Thread Jeff Howie

On Tue, Jan 30, 2001 at 04:06:27PM +, Conor Daly wrote:
 On Tue, Jan 30, 2001 at 10:00:10AM -0600 or so it is rumoured hereabouts, 
 Jeff Howie thought:
 On Tue, Jan 30, 2001 at 01:13:41PM +, Conor Daly wrote:
 Just noticed, that my urlview launched mozilla to view the below ftp type
 URLs.  Does anyone know how to have urlview launch wget for FTP and
 mozilla for HTTP?  man urlview says nothing.  Maybe I need a binding in
 mutt insteadi?
 
 Just edit the COMMAND line in your ~/.urlview file to something like
 this:
  
 COMMAND wget '%s'

 But will that not call wget for HTTP URLs also?

Yes, it would. My mistake. See the other replies posted for more
informed advice. :

-- 
thks.jeff



Re: Using urlview for FTP?

2001-01-30 Thread Conor Daly

On Tue, Jan 30, 2001 at 11:59:03AM -0500 or so it is rumoured hereabouts, 
Dan Boger thought:
 On Tue, Jan 30, 2001 at 08:47:20AM -0800, Ben Reser wrote:
  Not possible right now.  urlview only knows how to use one program.  You can
  use the COMMAND option in the .urlview file to change from netscape to another
  program but you can set one for ftp and one for http...
 
 unless you write a wrapper script, put it as your COMMAND, and have it
 check if it's an ftp url, or a https? url, or whatever...
 
I was thinking of something like that until Dave Ewart mentioned how
urlview 1.9 (comes with RH7) has a url_handler.sh script that handles
different url types nicely.  Just need to install a decent imap server and
start muttering from a client instead of rsh'ing to the server.

Thanks
-- 
Conor Daly [EMAIL PROTECTED]

Domestic Sysadmin :-)
-
faenor.cod.ie
  7:43pm  up 99 days,  2:11,  0 users,  load average: 0.08, 0.02, 0.01

Hobbiton.cod.ie
  7:39pm  up 4 days,  9:28,  2 users,  load average: 0.08, 0.14, 0.09