home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / CBASE101.ZIP / BLKIO112.ZIP / BEXIT.C < prev    next >
Text File  |  1990-06-20  |  1KB  |  48 lines

  1. /*    Copyright (c) 1989 Citadel    */
  2. /*       All Rights Reserved        */
  3.  
  4. /* #ident    "@(#)bexit.c    1.4 - 90/06/20" */
  5.  
  6. /* ansi headers */
  7. #include <errno.h>
  8. /*#include <stdlib.h>*/
  9.  
  10. /* local headers */
  11. #include "blkio_.h"
  12.  
  13. /*man---------------------------------------------------------------------------
  14. NAME
  15.      bexit - block file exit
  16.  
  17. SYNOPSIS
  18.      #include <blkio.h>
  19.  
  20.      void bexit(status)
  21.      int status;
  22.  
  23. DESCRIPTION
  24.      The bexit function is for use with the blkio library in place of
  25.      exit.  It closes all open block files, which writes the contents
  26.      of the buffers to the files, then calls exit.
  27.  
  28. SEE ALSO
  29.      bclose.
  30.  
  31. ------------------------------------------------------------------------------*/
  32. void bexit(status)
  33. int status;
  34. {
  35.     BLKFILE *bp = NULL;
  36.  
  37.     /* close all open block files */
  38.     for (bp = biob; bp < (biob + BOPEN_MAX); ++bp) {
  39.         if (bp->flags & BIOOPEN) {
  40.             if (bclose(bp) == -1) {
  41.                 BEPRINT;
  42.             }
  43.         }
  44.     }
  45.  
  46.     exit(status);
  47. }
  48.