home *** CD-ROM | disk | FTP | other *** search
- /*
- * low level support routines
- *
- * This program is the CONFIDENTIAL and PROPRIETARY property
- * of FairCom(R) Corporation. Any unauthorized use, reproduction or
- * transfer of this program is strictly prohibited.
- *
- * Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 FairCom Corporation
- * (Subject to limited distribution and
- * restricted disclosure only.)
- * *** ALL RIGHTS RESERVED ***
- *
- * 4006 West Broadway
- * Columbia, MO 65203
- *
- *
- * c-tree(R) Version 4.3
- * Release C
- * February 7, 1989 17:30
- *
- */
-
- #include "ctstdr.h" /* standard i/o header */
- #undef EXTERN
- #define EXTERN /* */
- #include "ctoptn.h" /* c-tree configuration options */
- #include "cterrc.h" /* c-tree error codes */
- #include "ctstrc.h" /* c-tree data structures */
- #include "ctgvar.h" /* c-tree global variables */
-
- RNDFILE mbopen(ctnum,opmode)
- PFAST CTFILE *ctnum;
- COUNT opmode; /* EXCLUSIVE or SHARED */
- {
- RNDFILE retval;
-
- COUNT vtclose();
-
- if (!(opmode & PERMANENT) && ct_numvfil >= MAXVFIL)
- vtclose();
-
- if ((retval = open(ctnum->flname,BUPDATE)) < 0)
- if (vtclose() == YES)
- retval = open(ctnum->flname,BUPDATE);
-
- if (!(opmode & PERMANENT) && retval >= 0)
- ct_numvfil++;
-
- return(retval);
- }
-
- /* ------------------------------------------------------------ */
-
- RNDFILE mbcrat(ctnum)
- PFAST CTFILE *ctnum;
- {
- RNDFILE retval;
-
- COUNT vtclose();
-
- if (!(ctnum->flmode & PERMANENT) && ct_numvfil >= MAXVFIL)
- vtclose();
-
- if ((retval = creat(ctnum->flname,BCREATE)) < 0)
- if (vtclose() == YES)
- retval = creat(ctnum->flname,BCREATE);
-
- if (!(ctnum->flmode & PERMANENT) && retval >= 0)
- ct_numvfil++;
-
- return(retval);
- }
-
- COUNT mbsave(ctnum)
- PFAST CTFILE *ctnum;
-
- {
- COUNT uerr(),mbclos();
- RNDFILE mbopen();
-
- if (mbclos(ctnum,ctnum->flmode))
- return(uerr(FSAV_ERR));
- else if ((ctnum->fd = mbopen(ctnum,ctnum->flmode)) < 0)
- return(uerr(FSAV_ERR));
- else
- return(NO_ERROR);
- }
-
- VOID flushdos(datno)
- COUNT datno;
- {
- /* no action */
- }
-
- #ifndef CTSERVER
-
- /* --------------------------------------------------------------------
- LOCK index node
- */
-
- COUNT LOCK(node,knum) /* node == 0 => header */
- LONG node;
- PFAST KEYFILE *knum;
- {
-
- #ifdef FPUTFGET
- knum -= knum->kmem; /* adjust for member # */
- if (!(knum->flmode & NONEXCLUSIVE))
- return(NO_ERROR);
-
- /* then execute a LOCKing procedure */
- ???????????????
- /* if lock is successful, increment lock count used by vtclose */
- knum->lokcnt++;
- return(NO_ERROR);
- #else
- return(NO_ERROR);
- #endif
-
- }
-
- /* --------------------------------------------------------------------
- UNLOCK index file node
- */
-
- COUNT UNLOCK(node,knum)
- LONG node;
- PFAST KEYFILE *knum;
- {
-
- #ifdef FPUTFGET
- knum -= knum->kmem; /* adjust for member # */
- if (!(knum->flmode & NONEXCLUSIVE))
- return(NO_ERROR);
-
- if (knum->lokcnt)
- knum->lokcnt--;
- /* UNLOCK node */
- ??????????????/
- return(NO_ERROR);
- #else
- return(NO_ERROR);
- #endif
-
- }
-
-
- /* --------------------------------------------------------------------
- LOCK data record
- */
-
- COUNT DLOCK(recbyt,dnum)
- POINTER recbyt;
- PFAST DATFILE *dnum;
- {
- COUNT uerr();
-
- #ifdef FPUTFGET
-
- if (!(dnum->flmode & NONEXCLUSIVE))
- return(NO_ERROR);
-
- /* execute a LOCKing procedure: if lock fails,
- * return uerr(DLOK_ERR) else return NO_ERROR;
- * Be sure that lock length is at least one byte.
- */
-
- ?????????????
-
- /* if successful, increment lokcnt */
- dnum->lokcnt++;
- return(NO_ERROR);
- #else
-
- return(NO_ERROR);
-
- #endif
-
- }
-
-
- COUNT RLOCK(recbyt,dnum)
- POINTER recbyt;
- PFAST DATFILE *dnum;
- {
- return(NO_ERROR);
- }
-
- /* --------------------------------------------------------------------
- UNLOCK data record
- */
-
- COUNT UDLOCK(recbyt,dnum)
- POINTER recbyt;
- PFAST DATFILE *dnum;
- {
-
- #ifdef FPUTFGET
- if (!(dnum->flmode & NONEXCLUSIVE))
- return(NO_ERROR);
-
- if (dnum->lokcnt)
- dnum->lokcnt--;
-
- /* UNLOCK record */
- ????????????
-
- return(NO_ERROR);
- #else
- return(NO_ERROR);
- #endif
-
- }
-
- #endif
-
- /* end of ctclib.c */
-