home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 6 File / 06-File.zip / ramfs102.zip / src / findclos.c < prev    next >
C/C++ Source or Header  |  2002-09-28  |  1KB  |  66 lines

  1. #include "includes.h"
  2.  
  3.  
  4.  
  5.  
  6.  
  7. APIRET EXPENTRY FS_FINDCLOSE (
  8.     struct fsfsi *pfsfsi,
  9.     struct fsfsd *pfsfsd )
  10. {
  11.   int     rc;
  12.   PVOLUME pVolume;
  13.   PSEARCH pSearch;
  14.   PSEARCH pCurSearch;
  15.   PSEARCH pPrevSearch;
  16.   struct vpfsi *pvpfsi;
  17.   struct vpfsd *pvpfsd;
  18.  
  19.   UtilEnterRamfs();
  20.   DEBUG_PRINTF2 ("FS_FINDCLOSE  %04X:%04X", FP_SEG(pfsfsd), FP_OFF(pfsfsd));
  21.  
  22.   pSearch = pfsfsd->pSearch;
  23.  
  24.   if (pSearch == 0)
  25.   {
  26.     /* no SEARCH has been allocated - e.g. a search without wildcards */
  27.     rc = NO_ERROR;
  28.     goto end;
  29.   }
  30.  
  31.  
  32.   FSH_GETVOLPARM (pfsfsi->fsi_hVPB, &pvpfsi, &pvpfsd);
  33.   pVolume = pvpfsd->pVolume;
  34.  
  35.   DEBUG_PRINTF1 (" '%s'", (char *) pSearch->szPattern);
  36.  
  37.   pPrevSearch = 0;
  38.   pCurSearch = pVolume->pFirstSearch;
  39.   while (pCurSearch != pSearch)
  40.   {
  41. #ifdef DEBUG
  42.     if (pCurSearch == 0)
  43.     {
  44.       debugging = TRUE;
  45.       DEBUG_PRINTF0 ("\r\n!!! SEARCH not found\r\n");
  46.       INT3;
  47.     }
  48. #endif
  49.     pPrevSearch = pCurSearch;
  50.     pCurSearch = pCurSearch->pNextSearch;
  51.   }
  52.  
  53.   if (pPrevSearch != 0)
  54.     pPrevSearch->pNextSearch = pCurSearch->pNextSearch;
  55.   else
  56.     pVolume->pFirstSearch = pCurSearch->pNextSearch;
  57.   NearFree (pSearch);
  58.   rc = NO_ERROR;
  59.  
  60. end:
  61.  
  62.   DEBUG_PRINTF1 (" => %d\r\n", rc);
  63.   UtilExitRamfs();
  64.   return rc;
  65. }
  66.