On Fri, Aug 20, 1999 at 01:52:57PM -0400, Pete Toscano wrote:
>
> i looked through your pages and i think your way of catching and checking
> for the '/' is better, so i took your url_handler.sh, added in the ncftp/
> ncftpget checking, added lynx as a possible http/web viewer for those running
> x, but who don't have netscape loaded, and i removed your "local-isms",
> such as using realmutt instead of mutt. i also made it check /usr/local/bin
> in addition to /usr/bin for ncftp, ncftpget, and mutt.
>
> problems i still see:
>
> . do we want to make the directory vs file detection smarter? searching
> for a '/' at the end seems kind of brain-dead, but can we make it better
> without being a real pita? maybe have it search for the main gtlds, such
> as ".com", ".org", ".edu", ".net", ".gov", and ".mil"? of course, this
> ignores all the two-letter country codes and leads towards a possible
> maintenance nightmare...
I think we should essentially leave it as is, and certainly not go down
the road of looking for ".com", etc. Most of my mail ends in ".au"!
> . my ftp client is very stupid; it only understands hostnames on the
> command line, so i have ftp called only with the hostname is it can't
> find ncftp or ncftpget. is this a safe assumption for other "ftp" clients?
I think so.
> . with my netscape (4.61 for linux),
> "netscape -remote 'openURL(http://www.mutt.org)'"does not work. netscape is
> started up and that's it. i know there's a way to get this working, but i
> haven't been able to find an answer. it'd like to get this working.
I noted the mail where you said this was fixed.
> please let me know if this works for you. do you know who we should submit
> patches for urlview to?
>
I have checked it out fairly well and it seems OK. The version you got off
my page says that it does not handle mail URLs without the mailto, e.g.
[EMAIL PROTECTED] It does handle this with the changes I have made earlier to
my .urlview. I will update everything on my web page.
I will add as attachments, the full url_handler.sh I finished up with
today and a patch which I think works off the original url_handler (or
rather what I know works off what I think is the original url_handler!).
urlview was written by Michael Elkins. Are you suggesting I ask him to
add the change I made to the URL display to warn about adding or removing
a "/" in ftp URLSs?
I would like to see urlview and url_handler in the contrib directory
of mutt. What do the developers think?
Cheers, Brian.
--
Associate Professor Brian Salter-Duke (Brian Duke)
Chemistry, Faculty of Science, IT and Education, Northern Territory University,
Darwin, NT 0909, Australia. Phone 08-89466702. Fax 08-89466847
[EMAIL PROTECTED] http://www.smps.ntu.edu.au/school/compchem.html
url_handler.sh
1c1
< #!/bin/sh
---
> #!/usr/local/bin/bash
8a9,12
> # Modified by: Brian Salter-Duke <[EMAIL PROTECTED]>
> # Last edited: 19 June, 1999
> # Modified by: Pete Toscano <[EMAIL PROTECTED]>
> # Last edited: 20 Aug, 1999
13a18
> # Start with http://.., ftp://.. and mailto:xxx@..
16,17c21,37
< target=`echo $url | sed 's;^.*://\([^/]*\)/*\(.*\);\1:/\2;'`
< ncftp $target
---
> # Use ncftp if URL ends in / and ncftpget if URL does NOT end in /
> # N.B. ncftpget will fail if URL is directory not file.
> # If ncftp is not present in /usr/bin or /usr/local/bin will use ftp.
> temp=`echo $url | sed 's/.$//;'`
> if [ $temp/ = $url ]; then
> if [ -x /usr/bin/ncftp -o -x /usr/local/bin/ncftp ]; then
> ncftp $url
> else
> ftp `echo $url | sed 's;^.*://\([^/]*\)/*.*;\1;'`
> fi
> else
> if [ -x /usr/bin/ncftpget -o -x /usr/local/bin/ncftpget ]; then
> ncftpget $url
> else
> ftp `echo $url | sed 's;^.*://\([^/]*\)/*.*;\1;'`
> fi
> fi
20a41,42
> # Will use netscape if running XWindow and netscape available,
> # otherwise lynx.
24c46
< netscape -remote "openURL($url)" || netscape $url
---
> netscape -remote "openURL($url)" || netscape $url || lynx $url
29c51,56
< mutt `echo $url | sed 's;^[^:]*:\(.*\);\1;'`
---
> # Uses mutt if present (and if not - why not?) otherwise mail.
> if [ -x /usr/bin/mutt -o -x /usr/local/bin/mutt ]; then
> mutt `echo $url | sed 's;^[^:]*:\(.*\);\1;'`
> else
> mail `echo $url | sed 's;^[^:]*:\(.*\);\1;'`
> fi
33,38c60,79
< method=`echo $url | sed 's;\(^...\).*;\1;'`
< case $method in
< ftp)
< target=`echo $url | sed 's;^\([^/]*\)/*\(.*\);\1:/\2;'`
< ncftp $target
< ;;
---
> # Now for url's that start www... or ftp.... or xxxx@..
> method=`echo $url | sed 's;\(^...\).*;\1;'`
> case $method in
> ftp)
> temp=`echo $url | sed 's/.$//;'`
> if [ $temp/ = $url ]; then
> if [ -x /usr/bin/ncftp -o -x /usr/local/bin/ncftp ]; then
> ncftp "ftp://"$url
> else
> ftp `echo "ftp://"$url | sed 's;^.*://\([^/]*\)/*.*;\1;'`
> fi
> else
> if [ -x /usr/bin/ncftpget -o -x /usr/local/bin/ncftpget ]; then
> ncftpget "ftp://"$url
> else
> ftp `echo "ftp://"$url | sed 's;^.*://\([^/]*\)/*.*;\1;'`
> fi
> ncftpget "ftp://"$url
> fi
> ;;
40,47c81,88
< www)
< target="http://"$url
< if test x$DISPLAY = x; then
< lynx $target
< else
< netscape -remote "openURL($target)" || netscape $target
< fi
< ;;
---
> www)
> target="http://"$url
> if test x$DISPLAY = x; then
> lynx $target
> else
> netscape -remote "openURL($target)" || netscape $target || lynx $target
> fi
> ;;
49,53c90,98
< *)
< mutt $url
< ;;
< esac
< ;;
---
> *)
> if [ -x /usr/bin/mutt -o -x /usr/local/bin/mutt ]; then
> mutt $url
> else
> mail $url
> fi
> ;;
> esac
> ;;
54a100
>