home *** CD-ROM | disk | FTP | other *** search
/ ftp.uv.es / 2014.11.ftp.uv.es.tar / ftp.uv.es / pub / unix / freeWAIS-0.202.tar.gz / freeWAIS-0.202.tar / freeWAIS-0.202 / bin / waisretrieve < prev    next >
Text File  |  1993-10-05  |  2KB  |  75 lines

  1. #!/bin/sh
  2. # WIDE AREA INFORMATION SERVER SOFTWARE:
  3. #   No guarantees or restrictions.  See the readme file for the full standard
  4. #   disclaimer.    
  5. #
  6. # A shell script to retrieve a document from the docid.
  7. #
  8. # Author: jonathan@think.com
  9. # Date: Sun Feb 16 1992
  10. #
  11. # Change log:
  12. # $Log:    waisretrieve,v $
  13. # Revision 1.3  92/04/28  15:39:21  jonathan
  14. # Added DEBUG option
  15. # Revision 1.2  92/02/16  18:36:12  jonathan
  16. # Modified usage (and test)
  17. # Revision 1.1  92/02/16  18:30:11  jonathan
  18. # Initial revision
  19. #
  20.  
  21. if (test $# -ne 1)
  22. then
  23.  echo "usage: $0 DOC_SPEC"
  24.  echo "  where DOC_SPEC is docid:database[@host[:port]][%type]"
  25.  echo "        docid and database are server specific,"
  26.  echo "        host and port are optional."
  27.  exit 1
  28. fi
  29.  
  30. tdir=/tmp
  31. qfile=$tdir/wr$$.q
  32. sfile=wr$$.src
  33. db=`echo $1 | awk -F: '{print $2}' | awk -F@ '{print $1}'`
  34. host=`echo $1 | awk -F: '{print $2}' | awk -F@ '{print $2}'`
  35. id=`echo $1 | awk -F: '{print $1}'`
  36. tcpport=`echo $1 | awk -F: '{print $3}' | awk -F% '{print $1}'`
  37. type=`echo $1 | awk -F% '{print $2}'`
  38. if (test -n "$tcpport")
  39. then
  40.  port=$tcpport
  41. else
  42.  port=210
  43. fi
  44.  
  45. cat >$tdir/$sfile <<EoF
  46. (:source
  47.  :version 3
  48.  :database-name "$db"
  49.  :ip-name "$host"
  50.  :tcp-port $port
  51. )
  52. EoF
  53.  
  54. cat >$qfile <<EoF
  55. (:question :version 2 
  56.   :result-documents 
  57.   ( (:document-id
  58.      :document
  59.      (:document
  60.        :doc-id
  61.        (:doc-id :original-database `stringtoany $db` 
  62.         :original-local-id `stringtoany "$id"` )
  63.        :number-of-bytes -1
  64.        :type "$type"
  65.        :source
  66.        (:source-id :filename "$sfile") ) ) ) ) 
  67. EoF
  68.  
  69. waisq -f $qfile -s $tdir/ -v 1
  70.  
  71. $DEBUG rm $qfile $tdir/$sfile
  72.