minor improvement in fspget, now checking that the uri begins with fsp://

This commit is contained in:
hoaxter 2003-12-11 20:17:49 +00:00
parent 052bae42dc
commit 0f2bbac0f0

View File

@ -55,19 +55,27 @@ alias fcd='set -f;_fcd'
####something like wget emulation####
_fspget() {
FSP_HOST=$(echo $1|awk -F"/" '{print $3}'|awk -F":" '{print $1}')
FSP_DIR=$(dirname $(echo $1|sed -e 's/fsp:\/\/.*:[0-9]*\//\//g'))
fsp_port=$(echo $1|awk -F"/" '{print $3}'|awk -F":" '{print $2}')
if [ -n $fsp_port ]
then
FSP_PORT=$fsp_port
fi
filename=$(basename $(echo $1|sed -e 's/fsp:\/\/.*:[0-9]*\//\//g'))
usage="echo \"Usage: fsp://[host]:[port]/path/to/file\""
echo "Retrieving $filename from $FSP_HOST with FSPd running on port $FSP_PORT"
fver
fget $filename
echo "DONE"
case $1 in
fsp://*)
FSP_HOST=$(echo $1|awk -F"/" '{print $3}'|awk -F":" '{print $1}')
FSP_DIR=$(dirname $(echo $1|sed -e 's/fsp:\/\/.*:[0-9]*\//\//g'))
fsp_port=$(echo $1|awk -F"/" '{print $3}'|awk -F":" '{print $2}')
if [ -n $fsp_port ]
then
FSP_PORT=$fsp_port
fi
filename=$(basename $(echo $1|sed -e 's/fsp:\/\/.*:[0-9]*\//\//g'))
echo "Retrieving $filename from $FSP_HOST with FSPd running on port $FSP_PORT"
fver
fget $filename
echo "DONE"
;;
*)
eval $usage
esac
}
alias fspget='set -f;_fspget'