#!/bin/sh # Copyright for the Uniform Repository Service (c) 1997, # by Gerald Banon. All rights reserved. # Version 1.1 # get- # PATH_INFO = /home/banon/URLib::/dpi.inpe.br/banon/1995/08.08.00.00 pid=$$ col=../../../../.. serv=dpi.inpe.br/banon/1995/08.08.00.00 web=hermes.dpi.inpe.br na=$# a1=$1 a2=$2 case $na in 0) rp4=`echo $PATH_INFO | awk -F/ '{ print $NF }'` rest=`echo $PATH_INFO | sed 's!/'$rp4'$!!'` rp3=`echo $rest | awk -F/ '{ print $NF }'` rest=`echo $rest | sed 's!/'$rp3'$!!'` rp2=`echo $rest | awk -F/ '{ print $NF }'` rest=`echo $rest | sed 's!/'$rp2'$!!'` rp1=`echo $rest | awk -F/ '{ print $NF }'` hp=`echo $rest | sed 's!/'$rp1'$!!'` rp=$rp1/$rp2/$rp3/$rp4 ;; # call with argument is used with from *) hp=`echo $a1` rp=`echo $a2` ;; esac cd $hp/col/$serv/not_sent # level 0 from not_sent ll=`cat .setenv/library_location` # ll tf=`cat $col/$rp/.reserved/header | sed -n '4p'` # tf (targetfile) url=$ll/col/$rp/doc/$tf url2=$ll/abs/$rp/$tf mkdir .t$pid ls -d $hp/col/$rp >.t$pid/ax 2>.t$pid/bx if test -s .t$pid/ax then # the repository exists in this local collection # > ax=`echo x | telnet $web 80 2>.t$pid/bx` if test -n "`echo $ax | grep Connected`" then # connection accepted link=$web/cgi/get2?$url else # connection refused if test -n "`echo $tf | egrep '\.rtf$'`" then # use of abs cgi script link=$url2 else link=$url fi fi cat <<% Location: http://$link % # < else # the repository don't exist in this local collection cat <<% Location: http://$web/cgi/get-/$rp % fi rm -r .t$pid