home *** CD-ROM | disk | FTP | other *** search
- /*
- bfaux.c
-
- % extra block file functions
-
- OWL 1.1
- Copyright (c) 1989, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 8/09/89 jdc changed oslist_GetSym to oslist_Get
- 8/19/89 jdc fixed bfile_FindEnd
- */
-
- #include "oakhead.h"
- #include "jadecl.h"
-
- #include "symldecl.h"
- #include "bfdecl.h"
-
- boolean bfile_FindEnd(bfile, name, type)
- bfile_type bfile;
- char *name;
- int type;
- /*
- sets the current file block chain for appending.
- if the chain doesn't exist then it is created.
- "type" is a label for possible reference use and is ignored by bfile code
-
- returns: TRUE or FALSE
- */
- {
- char headbuf[BHEAD_LEN + 1];
-
- if (!bfile_Find(bfile, name, type)) {
- return(FALSE);
- }
- bfile->new_find = FALSE;
-
- headbuf[(int)BHEAD_LEN] = '\0';
-
- while (bfile->curnext_block != BFILE_NOMORE) {
- /* go to next block */
- bfile->current_block = bfile->curnext_block;
- }
-
- bfrseek(bfile);
- fread(headbuf, 1, (int)BHEAD_LEN, bfile->stream);
- sscanf(headbuf, "%5d%5d\n", &(bfile->curblock_size), &(bfile->curnext_block));
-
- if (ferror(bfile->stream)) return(FALSE);
-
- return(TRUE);
- }
-
- /* -------------------------------------------------------------------------- */
-
- void bfile_Del(bfile, name)
- bfile_type bfile;
- char *name;
- {
- int *data, h;
-
- if (bfile != NULL && (h = bfile_FindDir(bfile, name)) != OSLIST_BADNAME) {
-
- data = bfile_GetDirData(bfile_GetDirName(bfile, h));
- bfile_PutFreeB(bfile, data[0]);
- oslist_DelSym(bfile->dir, h);
-
- bfile_WriteDir(bfile);
- }
- }
-