home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c185 / 2.ddi / OWLSRC.EXE / CSCAPE / SOURCE / BFAUX.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-06  |  1.5 KB  |  74 lines

  1. /*
  2.     bfaux.c    
  3.  
  4.     % extra block file functions
  5.  
  6.     OWL 1.1
  7.     Copyright (c) 1989, by Oakland Group, Inc.
  8.     ALL RIGHTS RESERVED.
  9.  
  10.     Revision History:
  11.     -----------------
  12.      8/09/89 jdc    changed oslist_GetSym to oslist_Get
  13.      8/19/89 jdc    fixed bfile_FindEnd
  14. */
  15.  
  16. #include "oakhead.h"
  17. #include "jadecl.h"
  18.  
  19. #include "symldecl.h"
  20. #include "bfdecl.h"
  21.  
  22. boolean bfile_FindEnd(bfile, name, type)
  23.     bfile_type    bfile;
  24.     char        *name;
  25.     int            type;
  26. /* 
  27.     sets the current file block chain for appending.
  28.     if the chain doesn't exist then it is created.
  29.     "type" is a label for possible reference use and is ignored by bfile code
  30.  
  31.     returns:  TRUE or FALSE
  32. */
  33. {
  34.     char headbuf[BHEAD_LEN + 1];
  35.     
  36.     if (!bfile_Find(bfile, name, type)) {
  37.         return(FALSE);
  38.     }
  39.     bfile->new_find = FALSE;
  40.  
  41.     headbuf[(int)BHEAD_LEN] = '\0';
  42.  
  43.     while (bfile->curnext_block != BFILE_NOMORE) {
  44.         /* go to next block */
  45.         bfile->current_block = bfile->curnext_block;
  46.     }
  47.  
  48.     bfrseek(bfile);
  49.     fread(headbuf, 1, (int)BHEAD_LEN, bfile->stream);
  50.     sscanf(headbuf, "%5d%5d\n", &(bfile->curblock_size), &(bfile->curnext_block));
  51.  
  52.     if (ferror(bfile->stream)) return(FALSE);
  53.  
  54.     return(TRUE);
  55. }
  56.  
  57. /* -------------------------------------------------------------------------- */
  58.  
  59. void bfile_Del(bfile, name)
  60.     bfile_type bfile;
  61.     char *name;
  62. {
  63.     int *data, h;
  64.  
  65.     if (bfile != NULL && (h = bfile_FindDir(bfile, name)) != OSLIST_BADNAME) {
  66.  
  67.         data = bfile_GetDirData(bfile_GetDirName(bfile, h));
  68.         bfile_PutFreeB(bfile, data[0]);
  69.         oslist_DelSym(bfile->dir, h);
  70.  
  71.         bfile_WriteDir(bfile);
  72.     }
  73. }
  74.