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

  1. #include "includes.h"
  2.  
  3.  
  4.  
  5.  
  6.  
  7. APIRET EXPENTRY FS_CHGFILEPTR (
  8.     struct sffsi *psffsi,
  9.     struct sffsd *psffsd,    /* not used in retail */
  10.     LONG    offset,
  11.     USHORT    type,
  12.     USHORT    IOflag )    /* not used */
  13. {
  14.   int rc;
  15.  
  16.   UtilEnterRamfs();
  17.   DEBUG_PRINTF3 ("FS_CHGFILEPTR  sfn=%d, offset=%ld, type=%d",
  18.          psffsi->sfi_selfsfn, offset, type);
  19.  
  20. #ifdef DEBUG
  21.   {
  22.     FBLOCK fblkFile;
  23.  
  24.     VMRead (&fblkFile, psffsd->pOpenfile->flatEntry + FIELDOFFSET(DIRENTRY,fblkFile), sizeof(FBLOCK));
  25.     if (fblkFile.fSize != psffsi->sfi_size)
  26.     {
  27.       debugging = TRUE;
  28.       DEBUG_PRINTF2 ("\r\n!!! fblkFile.cbSize = %lu, sfi_size = %lu\r\n",
  29.              fblkFile.fSize, psffsi->sfi_size);
  30.       INT3;
  31.     }
  32.   }
  33. #endif
  34.  
  35.   switch (type)
  36.   {
  37.     case 0: /* relative to beginning of file */
  38.         psffsi->sfi_position = offset;
  39.         break;
  40.  
  41.     case 1: /* relative to current position */
  42.         psffsi->sfi_position += offset;
  43.         break;
  44.  
  45.     case 2: /* relative to end of file */
  46.         psffsi->sfi_position = psffsi->sfi_size + offset;
  47.         break;
  48.   }
  49.  
  50.   rc = NO_ERROR;
  51.  
  52.   DEBUG_PRINTF1 (" => %d\r\n", rc);
  53.   UtilExitRamfs();
  54.   return rc;
  55. }
  56.