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 / ASIXRST.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-14  |  1.3 KB  |  52 lines

  1. /* asixrst.c
  2. *
  3. * The Greenleaf Comm Library
  4. *
  5. * Copyright (C) 1985-1990 Greenleaf Software Inc.  All Rights Reserved.
  6. *
  7. *  unsigned asixrst( port )
  8. *  int port;            - Port 0..MAX_PORT-1
  9. *
  10. * DESCRIPTION
  11. *
  12. * Read and return the contents of rx_accum (count of receive characters)
  13. * resetting the variable to 0.
  14. *
  15. * Because it is not possible to differentiate between an error and the
  16. * status bits returned in the high order byte of the return value it is
  17. * necessary to return any errors in the global global variable _aserror.
  18. *
  19. *       _aserror =
  20. *
  21. *       Value           Meaning
  22. *     -------          --------
  23. *       ASSUCCESS       Successful (no error)
  24. *       ASINVPORT       Requested port is out of range
  25. *       ASNOTSETUP      Requested port not setup with asifirst()
  26. *
  27. * RETURNS:      Receiver Count 0..65535
  28. *
  29. * SIDE EFFECTS
  30. *  rx_accum for the port is reset to 0
  31. *
  32. * MODIFICATIONS
  33. *  11-09-85     ""
  34. *               Modified for release 2.0
  35. */
  36. #include <stdio.h>
  37. #include "gf.h"
  38. #include "asiports.h"
  39.  
  40. unsigned GF_CONV asixrst(port)
  41. int port;
  42. {
  43.         struct PORT_TABLE *p;
  44.         unsigned receivecount;
  45.  
  46.         if((p=_aschkcnl(port))==NULL)
  47.                 return(0);
  48.         receivecount=p->rx_accum;
  49.         p->rx_accum=0;
  50.         return(receivecount);
  51. }
  52.