home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c004 / 3.ddi / VAX / CTCLIB.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-04-18  |  3.6 KB  |  170 lines

  1. /*
  2.  *      c-tree Low Level I/O Interface
  3.  *
  4.  *    This program is the CONFIDENTIAL and PROPRIETARY property 
  5.  *    of FairCom(R) Corporation. Any unauthorized use, reproduction or
  6.  *    transfer of this program is strictly prohibited.
  7.  *
  8.  *      Copyright (c) 1985, 1986, 1987, 1988, 1989 FairCom Corporation
  9.  *    (Subject to limited distribution and
  10.  *     restricted disclosure only.)
  11.  *    *** ALL RIGHTS RESERVED ***
  12.  *
  13.  *      4006 West Broadway
  14.  *      Columbia, MO 65203
  15.  *
  16.  *
  17.  *      c-tree(R)      Version 4.3
  18.  *                      Release C
  19.  *                      February 7, 1989 17:30
  20.  *
  21.  */
  22.  
  23. #include "ctstdr.h"             /* standard i/o header          */
  24. #undef   EXTERN
  25. #define  EXTERN /* */
  26. #include "ctoptn.h"             /* c-tree configuration options */
  27. #include "cterrc.h"             /* c-tree error codes           */
  28. #include "ctstrc.h"             /* c-tree data structures       */
  29. #include "ctgvar.h"             /* c-tree global variables      */
  30. #include "ctcomm.h"
  31.  
  32. #include <types.h>
  33. #include <file.h>
  34. #define O_BINARY 0
  35. #include <stat.h>
  36.  
  37. COUNT ctseek(),uerr();
  38.  
  39. RNDFILE mbopen(ctnum,opmode)
  40. PFAST CTFILE  *ctnum;
  41. COUNT                opmode;
  42. {
  43.         RNDFILE retval;
  44.  
  45.         COUNT vtclose();
  46.  
  47.         ctnum->sekpos = DRNZERO;
  48.         if (!(opmode & PERMANENT) && ct_numvfil >= MAXVFIL)
  49.                 vtclose();
  50.  
  51.         if ((retval = open(ctnum->flname,O_RDWR)) < 0)
  52.                 if (vtclose() == YES)
  53.                         retval = open(ctnum->flname,O_RDWR);
  54.  
  55.         if (!(opmode & PERMANENT) && retval >= 0)
  56.                 ct_numvfil++;
  57.  
  58.         return(retval);
  59. }
  60.  
  61. /* ------------------------------------------------------------ */
  62.  
  63. RNDFILE mbcrat(ctnum)
  64. PFAST CTFILE  *ctnum;
  65. {
  66.         RNDFILE retval;
  67.  
  68.         COUNT vtclose();
  69.  
  70.         ctnum->sekpos = DRNZERO;
  71.         if (!(ctnum->flmode & PERMANENT) && ct_numvfil >= MAXVFIL)
  72.                 vtclose();
  73.  
  74.         if ((retval = creat(ctnum->flname,BCREATE)) < 0)
  75.                 if (vtclose() == YES)
  76.                         retval = creat(ctnum->flname,BCREATE);
  77.  
  78.         if (!(ctnum->flmode & PERMANENT) && retval >= 0)
  79.                 ct_numvfil++;
  80.  
  81.         return(retval);
  82. }
  83.  
  84. /* ------------------------------------------------------------ */
  85.  
  86. COUNT mbsave( ctnum)
  87. PFAST CTFILE *ctnum;
  88. {
  89.     COUNT   mbclos();
  90.     RNDFILE mbopen();
  91.  
  92.     if (mbclos(ctnum,ctnum->flmode))
  93.         return(uerr(FSAV_ERR));
  94.     else if ((ctnum->fd = mbopen(ctnum,ctnum->flmode)) < 0)
  95.         return(uerr(FSAV_ERR));
  96.     else
  97.         return(NO_ERROR);
  98. }
  99.  
  100. VOID flushdos(datno)
  101. COUNT         datno;
  102. {
  103. }
  104.  
  105. #ifndef CTSERVER
  106.  
  107. /* --------------------------------------------------------------------
  108.    LOCK index node
  109.  */
  110.  
  111. COUNT LOCK(node,knum)    /* node == 0  => header */
  112. LONG       node;
  113. PFAST KEYFILE  *knum;
  114. {
  115.  
  116.     return(NO_ERROR);
  117.  
  118. }
  119.  
  120. /* --------------------------------------------------------------------
  121.    UNLOCK index file node
  122. */
  123.  
  124. COUNT UNLOCK(node,knum)
  125. LONG         node;
  126. PFAST KEYFILE    *knum;
  127. {
  128.  
  129.     return(NO_ERROR);
  130.  
  131. }
  132.  
  133.  
  134. /* --------------------------------------------------------------------
  135.    LOCK data record
  136.  */
  137.  
  138. COUNT DLOCK(recbyt,dnum)        /* recbyt == 0  => header record */
  139. POINTER        recbyt;
  140. PFAST DATFILE      *dnum;
  141. {
  142.  
  143.     return(NO_ERROR);
  144.  
  145. }
  146.  
  147. COUNT RLOCK(recbyt,dnum)
  148. POINTER        recbyt;
  149. PFAST DATFILE      *dnum;
  150. {
  151.     return(NO_ERROR); /* read locks not supported */
  152. }
  153.  
  154. /* --------------------------------------------------------------------
  155.    UNLOCK data record
  156. */
  157.  
  158. COUNT UDLOCK(recbyt,dnum)
  159. POINTER         recbyt;
  160. PFAST DATFILE       *dnum;
  161. {
  162.  
  163.     return(NO_ERROR);
  164.  
  165. }
  166.  
  167. #endif
  168.  
  169. /* end of ctclib.vms */
  170.