#!/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.25.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
# rpx=`echo $rp | sed 's/:/%3A/g' | sed 's/\//%2F/g'`
cd $hp/col/$serv/not_sent # level 0 from not_sent
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
# >
ll=`cat .setenv/library_location` # ll
#tf=`cat $col/$rp/.reserved/@ | sed -n '/^ tagfile /p' | \
#sed 's/^ tagfile =[ ]*"//
# s/",[ ]*$//'` # tf (tagfile)
#et=`cat $col/$rp/.reserved/@ | grep '^@' | sed 's/^@//' | \
#sed 's/{.*$//'` # et (entry type)
et=`cat $col/$rp/.reserved/header | sed -n '1p'` # et (entry type)
title=`cat $col/$rp/.reserved/header | sed -n '2p'`
author=`cat $col/$rp/.reserved/header | sed -n '3p'`
tf=`cat $col/$rp/.reserved/header | sed -n '4p'` # tf (targetfile)
url=$ll/col/$rp/doc/$tf
url2=$ll/abs/$rp/$tf
echo $tf | egrep '\.pdf$' >.t$pid/ax
if test -s .t$pid/ax
then
# .pdf document
warning="
The document is in PDF format. Use Adobe Acrobat Reader to display it.
Downloading Acrobat Reader Software"
find $hp/col/$rp/doc -print | egrep '\.pdf$' | sed '1d' >.t$pid/ax
if test -s .t$pid/ax
then
warning="$warning
WARNING: the document contains
links. Use Netscape Navigator to resolve them.
Downloading Netscace Navigator Software"
fi
else
# not a .pdf document
echo $tf | egrep '\.doc$|\.dot$|\.rtf$' >.t$pid/ax
if test -s .t$pid/ax
then
# .doc document
echo $tf | egrep '\.rtf$' >.t$pid/ax
if test -s .t$pid/ax
then
# .rtf target file
warning="
The document is in WORD format."
find $hp/col/$rp/doc -print | \
egrep '\.doc$|\.dot$' | sed '1d' >.t$pid/ax
if test -s .t$pid/ax
then
# contains .doc files
warning=$warning"
WARNING: the document contains links. If you use Netscape Navigator the Microsoft Word Software will be started.
If your version of Word is NOT the English version it may not be able to resolve the links, in place, use the English version of the Word or of the Microsoft Internet Explorer.
Downloading Internet Explorer Software"
fi
else
# not a .rtf target file
find $hp/col/$rp/doc -print | \
egrep '\.doc$|\.dot$|\.rtf$' | sed '1d' >.t$pid/ax
if test -s .t$pid/ax
then
# more than one .doc file
warning="
The document is in WORD format and contains links. Use Microsoft Internet Explorer to resolve them.
Downloading Internet Explorer Software
WARNING: the first click over an hyperlink inside a WORD document will produce an error message.
To get round it, please click the Explorer Back button and click again the hyperlink."
fi
fi
else
# not a .doc document
find $hp/col/$rp/doc -print | egrep '\.pdf$' >.t$pid/ax
if test -s .t$pid/ax
then
# more than one .pdf file
# ex: Faria's Master
warning="
Parts of the document are in PDF format. Use Adobe Acrobat Reader to display them.
Downloading Acrobat Reader Software"
else
warning=""
fi
find $hp/col/$rp/doc -print | \
egrep '\.doc$|\.dot$|\.rtf$' | sed '1d' >.t$pid/ax
if test -s .t$pid/ax
then
warning="$warning
Parts of the document are in WORD format and contains links. Use Microsoft Internet Explorer to resolve them.
Downloading Internet Explorer Software
WARNING: the first click over an hyperlink inside a WORD document will produce an error message.
To get round it, please click the Explorer Back button and click again the hyperlink."
else
warning="$warning"
fi
fi
fi
#ls $col/$rp/.reserved/*.gif >.t$pid/ax 2>.t$pid/bx
#if test -s .t$pid/ax
#then
# icon=../.reserved/`cat .t$pid/ax | sed -n '1p' | \
#awk -F/ '{ print $NF }'`
#else
# icon=$col/$serv/doc/square.gif
#fi
# add a download link
ls $col/$rp/download >.t$pid/ax 2>.t$pid/bx
if test -s .t$pid/ax
then
download="
download"
else
download=""
fi
# add a download link - end
ax=`echo x | telnet $web 80 2>.t$pid/bx`
if test -n "`echo $ax | grep Connected`"
then
# connection accepted
url=`echo $url | sed 's/:/%3A/g' | sed 's/\//%2F/g'`
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
# Advertising
if test -f @advertising.html
then
echo '
' >.t$pid/ad cat @advertising.html >>.t$pid/ad echo '
Warning
The document version you are accessing has been changed
since the last
local collection index update.
The document is under construction.
$rp
(repository)
$et
$title
$author
@
(complete reference)
@@
(current local collection index)
sites
(sites having the above repository)
$download
(click the icon the document)
(no record is made on the click origin)
$warning
After your visit, returning to this page, you can
check
if the document has been changed during the access.
The document you are accessing is version:
$version
$rp
(repository)
$et
$title
$author
@
(complete reference)
@@
(current local collection index)
sites
(sites having the above repository)
$download
(click the icon the document)
(no record is made on the click origin)
$warning
After your visit, returning to this page, you can
check
if the document has been changed during the access.