home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-1.ZIP / GCOMM / GETB.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-14  |  1.6 KB  |  49 lines

  1. /* getb.c
  2. *
  3. * The Greenleaf Comm Library
  4. *
  5. * Copyright (C) 1985-1990 Greenleaf Software Inc.  All Rights Reserved.
  6. *
  7. *  unsigned asigetb( port, buffer, length)
  8. *  int port;            - Port 0..MAX_PORT-1
  9. *  char *buffer;        - Points to buffer that is to receive characters
  10. *  unsigned length;     - Maximum number of characters that can be received
  11. *
  12. * DESCRIPTION
  13. *
  14. * This routine reads in up to length characters into the buffer supplied by
  15. * the user.  All the work for this guy is done in the asigetb_timed()
  16. * routine, which is called with a timeout parameter of 0.  This makes
  17. * this routine a prime candidate for being turned into a macro.
  18. *
  19. * SIDE EFFECTS
  20. *  none
  21. *
  22. * RETURNS
  23. *  returns the number of characters SUCCESSFULLY transferred.  The global
  24. *  variable _aserror can be examined to determine if an error was detected.
  25. *  _aserror == 0 if no errors were detected.  If the receive queue becomes
  26. *  empty before the entire user buffer is filled _aserror will be set to
  27. *  ASBUFREMPTY.
  28. *
  29. *       Value           Meaning
  30. *     -------          --------
  31. *       ASSUCCESS       port initialized (no error)
  32. *       ASINVPORT       Requested port is out of range
  33. *       ASNOTSETUP      Requested port not setup with asifirst()
  34. *       ASBUFREMPTY     Receive buffer went empty before length characters
  35. *                       were transferred.
  36. *
  37. * MODIFICATIONS
  38. *  10-25-85     ""
  39. *               Modified for release 2.0
  40. */
  41. #include <stdio.h>
  42. #include "gf.h"
  43. #include "asiports.h"
  44.  
  45. unsigned GF_CONV asigetb( int port, char *buffer, unsigned int length )
  46. {
  47.     return( asigetb_timed( port, buffer, length, 0 ) );
  48. }
  49.