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

  1. /* asibstat.c
  2. *
  3. * The Greenleaf Comm Library
  4. *
  5. * Copyright (C) 1985-1990 Greenleaf Software Inc.  All Rights Reserved.
  6. *
  7. *  unsigned asibstat(port)
  8. *  int port;            -Port 0..MAX_PORT-1
  9. *
  10. * DESCRIPTION
  11. *  This function returns the current value of the chst_bits (port
  12. *  status bits) in the PORT_TABLE structure for the specified
  13. *  port.
  14. *
  15. * SIDE EFFECTS
  16. *  none
  17. *
  18. * RETURNS
  19. *
  20. *  8 bits buffer status - See manual for details.
  21. *
  22. * Because it is not possible to differentiate between an error and the
  23. * status bits returned in the high order byte of the return value it is
  24. * necessary to return any errors in the global variable _aserror.
  25. *
  26. *       _aserror =
  27. *
  28. *       Value           Meaning
  29. *     -------          --------
  30. *       ASSUCCESS       Success (no error)
  31. *       ASINVPORT       Requested port is out of range
  32. *       ASNOTSETUP      Requested port not setup with asifirst()
  33. *
  34. * MODIFICATIONS
  35. *
  36. *  11-02-85     ""
  37. *               Modified for release 2.0
  38. *  12-30-85     Replaced literals with CONSTANTS from asiports.h
  39. *
  40. */
  41. #include <stdio.h>
  42. #include "gf.h"
  43. #include "asiports.h"
  44.  
  45. unsigned GF_CONV asibstat(port)
  46. int port;
  47. {
  48.  
  49.         struct PORT_TABLE * GF_CONV _aschkcnl(),*p;
  50.         unsigned retval=0;
  51.  
  52.         if((p=_aschkcnl(port))==NULL)
  53.                 return(0);
  54.         if(p->chst_bits.alert)
  55.                 retval|=ALERT;
  56.         if(p->chst_bits.rxempty)
  57.                 retval|=RXEMPTY;
  58.         if(p->chst_bits.rxfull)
  59.                 retval|=RXFULL;
  60.         if(p->chst_bits.rxovflow)
  61.                 retval|=RXOVFLOW;
  62.         if(p->chst_bits.txempty)
  63.                 retval|=TXEMPTY;
  64.         if(p->chst_bits.txfull)
  65.                 retval|=TXFULL;
  66.         if(p->chst_bits.linerr)
  67.                 retval|=LINERR;
  68.         if(p->chst_bits.modchg)
  69.                 retval|=MODCHG;
  70.         return(retval);
  71. }
  72.  
  73.