home *** CD-ROM | disk | FTP | other *** search
/ Frostbyte's 1980s DOS Shareware Collection / floppyshareware.zip / floppyshareware / DOOG / CBASE09.ZIP / BLKIO10.ZIP / BPUTB.C < prev    next >
Text File  |  1989-08-30  |  1KB  |  49 lines

  1. /*    Copyright (c) 1989 Citadel    */
  2. /*       All Rights Reserved        */
  3.  
  4. /* #ident    "bputb.c    1.1 - 89/07/03" */
  5.  
  6. #include <errno.h>
  7. #include "blkio_.h"
  8.  
  9. /*man---------------------------------------------------------------------------
  10. NAME
  11.      bputb - put a block into a block file
  12.  
  13. SYNOPSIS
  14.      #include <blkio.h>
  15.  
  16.      int bputb(bp, bn, buf)
  17.      BLKFILE *bp;
  18.      bpos_t bn;
  19.      void *buf;
  20.  
  21. DESCRIPTION
  22.      The bputb function writes the block pointed to by buf into block number
  23.      bn of the block file associated with BLKFILE pointer bp.  buf must point
  24.      to a storage area at least as large as the block size for bp.
  25.  
  26.      bputb will fail if one or more of the following is true:
  27.  
  28.      [EINVAL]       bp is not a valid BLKFILE pointer.
  29.      [EINVAL]       bn is less than 1.
  30.      [EINVAL]       buf is the NULL pointer.
  31.      [BEEOF]        There are fewer than bn - 1 blocks in the file.
  32.      [BENOPEN]      bp is not open for writing.
  33.  
  34. SEE ALSO
  35.      bgetb, bputbf, bputh.
  36.  
  37. DIAGNOSTICS
  38.      Upon successful completion, a value of 0 is returned.  Otherwise, a
  39.      value of -1 is returned, and errno set to indicate the error.
  40.  
  41. ------------------------------------------------------------------------------*/
  42. int bputb(bp, bn, buf)
  43. BLKFILE * bp;
  44. bpos_t    bn;
  45. void *    buf;
  46. {
  47.     return bputbf(bp, bn, (size_t)0, buf, bp->blksize);
  48. }
  49.