On Sat, 21 Aug 1999, Brian Salter-Duke wrote:
> On Fri, Aug 20, 1999 at 01:52:57PM -0400, Pete Toscano wrote:
> > 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"!
agreed.
> > 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 think i noticed a small problem with the script and patch. line 77
of the script looks extraneous. i took your fixes (less the extra
ncftpget) and made a unified (just my preference -- easier for me to read
and doesn't look like reply quoting to mutt =;) patch against the clean
url_handler.sh script. patch is attached.
if i just misunderstood the purpose of that 2nd ncftpget in that block,
please let me know.
> 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?
sounds reasonable.
pete
--
Pete Toscano h:[EMAIL PROTECTED] w:[EMAIL PROTECTED]
GPG fingerprint: AE5C 18E4 D069 76D3 9B9C D226 D86A 522F 446C 767A
--- url_handler.sh.orig Mon Aug 23 11:32:10 1999
+++ url_handler.sh Mon Aug 23 11:31:58 1999
@@ -6,31 +6,50 @@
# Created by: Michael Elkins <[EMAIL PROTECTED]> on March 10, 1997
# Modified by: Liviu Daia <[EMAIL PROTECTED]>
# Last Edited: May 26, 1997
+# Modified by: Brian Salter-Duke <[EMAIL PROTECTED]>
+# Last edited: 19 June, 1999
+# Modified by: Pete Toscano <[EMAIL PROTECTED]>
+# Last edited: 20 Aug, 1999
#
url=$1
method=`echo $1 | sed 's;\(^[^:]*\):.*;\1;'`
+# Start with http://.., ftp://.. and mailto:xxx@..
case $method in
ftp)
- target=`echo $url | sed 's;^.*://\([^/]*\)/*\(.*\);\1:/\2;'`
- if [ -x /usr/bin/ncftp ]; then
- 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
- ftp $target
+ if [ -x /usr/bin/ncftpget -o -x /usr/local/bin/ncftpget ]; then
+ ncftpget $url
+ else
+ ftp `echo $url | sed 's;^.*://\([^/]*\)/*.*;\1;'`
+ fi
fi
;;
http)
+ # Will use netscape if running XWindow and netscape available,
+ # otherwise lynx.
if test x$DISPLAY = x; then
lynx $url
else
- netscape -remote "openURL($url)" || netscape $url
+ netscape -remote "openURL($url)" || netscape $url || lynx $url
fi
;;
mailto)
- if [ -x /usr/bin/mutt ]; then
+ # 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;'`
@@ -38,14 +57,23 @@
;;
*)
+ # Now for url's that start www... or ftp.... or xxxx@..
method=`echo $url | sed 's;\(^...\).*;\1;'`
case $method in
ftp)
- target=`echo $url | sed 's;^\([^/]*\)/*\(.*\);\1:/\2;'`
- if [ -x /usr/bin/ncftp ]; then
- ncftp $target
+ 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
- ftp $target
+ if [ -x /usr/bin/ncftpget -o -x /usr/local/bin/ncftpget ]; then
+ ncftpget "ftp://"$url
+ else
+ ftp `echo "ftp://"$url | sed
+'s;^.*://\([^/]*\)/*.*;\1;'`
+ fi
fi
;;
@@ -54,12 +82,16 @@
if test x$DISPLAY = x; then
lynx $target
else
- netscape -remote "openURL($target)" || netscape $target
+ netscape -remote "openURL($target)" || netscape $target || lynx
+$target
fi
;;
*)
- mutt $url
+ if [ -x /usr/bin/mutt -o -x /usr/local/bin/mutt ]; then
+ mutt $url
+ else
+ mail $url
+ fi
;;
esac
;;
PGP signature