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

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