1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
#!/bin/sh
#
# This script is an example of how to call the appropriate viewer based upon
# the URL method
#
# Created by: Michael Elkins <me@cs.hmc.edu> on March 10, 1997
# Modified by: Liviu Daia <daia@stoilow.imar.ro>
# Last Edited: May 26, 1997
#
url=$1
method=`echo $1 | sed 's;\(^[^:]*\):.*;\1;'`
case $method in
ftp)
target=`echo $url | sed 's;^.*://\([^/]*\)/*\(.*\);\1:/\2;'`
ncftp $target
;;
http)
if test x$DISPLAY = x; then
lynx $url
else
netscape -remote "openURL($url)" || netscape $url
fi
;;
mailto)
mutt `echo $url | sed 's;^[^:]*:\(.*\);\1;'`
;;
*)
method=`echo $url | sed 's;\(^...\).*;\1;'`
case $method in
ftp)
target=`echo $url | sed 's;^\([^/]*\)/*\(.*\);\1:/\2;'`
ncftp $target
;;
www)
target="http://"$url
if test x$DISPLAY = x; then
lynx $target
else
netscape -remote "openURL($target)" || netscape $target
fi
;;
*)
mutt $url
;;
esac
;;
esac
|