1: /* $Header$ */
   2: 
   3: /*
   4:  * Author: Peter J. Nicklin
   5:  */
   6: 
   7: /*
   8:  * closepdb() closes a database Returns 0 normally, 1 if database error.
   9:  */
  10: #include <stdio.h>
  11: #include "path.h"
  12: #include "pdb.h"
  13: #include "system.h"
  14: 
  15: closepdb(pdbp)
  16:     PDB *pdbp;          /* database description pointer	*/
  17: {
  18:     int errpdb();           /* print database error message */
  19:     int errstat = 0;        /* database error status */
  20: 
  21:     fclose(pdbp->fp);
  22:     if ((pdbp->flag&_PACCESS) == (_PREAD|_PWRITE))
  23:         {
  24:         fclose(pdbp->tfp);
  25:         if ((pdbp->flag&_PERR) == 0 && (pdbp->flag&_PUPDATE) != 0)
  26:             {
  27:             RENAME(pdbp->tpath, pdbp->path);
  28:             }
  29:         else    {
  30:             unlink(pdbp->tpath);
  31:             }
  32:         }
  33:     else if ((pdbp->flag&(_PWRITE|_PAPPEND)) != 0)
  34:         unlink(pdbp->tpath);
  35:     if ((pdbp->flag&_PERR) != 0)
  36:         {
  37:         errpdb(pdbp);
  38:         errstat = 1;
  39:         }
  40:     free((char *) pdbp);
  41:     return(errstat);
  42: }

Defined functions

closepdb defined in line 15; never used
Last modified: 1985-07-03
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 386
Valid CSS Valid XHTML 1.0 Strict