diff -c2 irretrvl.c.original irretrvl.c
*** irretrvl.c.original	Sun May 10 17:43:57 1992
--- irretrvl.c	Tue Dec  1 18:38:35 1992
***************
*** 9,12 ****
--- 9,16 ----
  #endif
  
+ /* Changes by David H Post, Design Research Institute, post@cs.cornell.edu
+  * Fall 1992:  Added code to call SMART to retrieve documents.
+  */
+ 
  /* Change log:
   * $Log:	irretrvl.c,v $
***************
*** 85,88 ****
--- 89,93 ----
  #include "irdirent.h"
  #include <sys/stat.h>
+ #include "irsearch.h"    /* for smart_query */
  
  #ifdef Mach
***************
*** 95,98 ****
--- 100,105 ----
  #endif
  
+ extern char* smart_cmd;   /* defined in server.c, used in getData */
+ 
  /*----------------------------------------------------------------------*/
  
***************
*** 257,261 ****
      freeDocID(docid);
  
!     if(true == check_for_legitimate_file(fileName, dbname, index_directory)){
        file = s_fopen(fileName,"rb"); 
  
--- 264,277 ----
      freeDocID(docid);
  
! /* [dri] Mod to call SMART inserted here -------------------------------*/
! 
!     if (smart_cmd != NULL) {   /* if we are a SMART server */
!       /* retrieve doc, create file for it */
!       smart_query(dbname, fileName, fileName);
!       file = s_fopen(fileName,"rb");
!     } 
! 
!     else if (true == check_for_legitimate_file(fileName, dbname,
! 					       index_directory)) {
        file = s_fopen(fileName,"rb"); 
  
***************
*** 297,302 ****
  	    start, end, fileName, startByte, endByte, dbname);
  
-     s_free(dbname);
- 
      if (endByte > end && end != 0) { 
        waislog(WLOG_HIGH, WLOG_WARNING, 
--- 313,316 ----
***************
*** 342,345 ****
--- 356,365 ----
      if (tmpFileName) unlink( tmpFileName );
  
+ /* [dri] If SMART retrieval, remove document file created above ---------- */
+ 
+     if (smart_cmd != NULL)   /* if we are a SMART server */
+       unlink(fileName);
+ 
+     s_free(dbname);
      return(data);
    }
