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

  1. /* asipeekc.c
  2. *
  3. * The Greenleaf Comm Library
  4. *
  5. * Copyright (C) 1985-1990 Greenleaf Software Inc.  All Rights Reserved.
  6. *
  7. *  int asipeekc(port)
  8. *  int port;            - Port 0..MAX_PORT
  9. *
  10. * DESCRIPTION
  11. *  this function peeks at the next character in the communications queue
  12. *  without removing it from the queue.
  13. *
  14. * SIDE EFFECTS
  15. *  none.
  16. *
  17. * RETURNS
  18. *
  19. *       Value           Meaning
  20. *       ------          -------
  21. *       0 thru 255      Return value equals character received
  22. *       ASINVPORT       Requested port is out of range
  23. *       ASNOTSETUP      Requested port not setup with asifirst()
  24. *       ASBUFREMPTY     Requested port's buffer is empty
  25. *
  26. * MODIFICATIONS
  27. *
  28. *  11-01-85     ""
  29. *               Modified for release 2.0
  30. */
  31. #include <stdio.h>
  32. #include "gf.h"
  33. #include "asiports.h"
  34.  
  35. int GF_CONV asipeek(port)
  36. int port;
  37. {
  38.         struct PORT_TABLE *p;
  39.  
  40.         if((p=_aschkcnl(port))==NULL)
  41.                 return(_aserror);
  42.         if(p->chst_bits.rxempty==1)
  43.                 return(ASBUFREMPTY);
  44.         return(_asipekc(p)&0xff);
  45.  
  46. }
  47.  
  48.