home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-4.ZIP / GSAMP / GSAMP.ZIP / EXAMP35.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-09  |  1.3 KB  |  46 lines

  1. /*
  2.  *  EXAMP35.C
  3.  *
  4.  *  The Greenleaf Comm Library
  5.  *
  6.  *  Copyright (C) 1989 Greenleaf Software Inc.  All Rights Reserved.
  7.  *
  8.  *  This example sends data to something, and continues until
  9.  *  it notices a line status error.  It the prints out the changed
  10.  *  status of all four incoming modem lines.
  11.  *
  12.  */
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include "asiports.h"
  16. #include "ibmkeys.h"
  17. #include "gf.h"
  18.  
  19. void main( void );
  20.  
  21. void main()
  22. {
  23.     int status;
  24.  
  25.     status = asiopen( COM1, ASOUT | BINARY | NORMALRX, 100, 100,
  26.                       1200L, P_NONE, 1, 8, OFF, ON);
  27.     if ( status < ASSUCCESS ) {
  28.         printf( "Failed to open the port.  Status = %d\n", status );
  29.         exit( 1 );
  30.     }
  31.     for ( ; ; ) {
  32.         asiputs( COM1, "Lots of test data\n", -1 );
  33.         if ( islinerr( COM1 ) || gfkbhit() )
  34.             break;
  35.    }
  36.    printf( "The line status error flag has been set.\n");
  37.    printf( "Parity error flag: %s\n",
  38.            isparityerr( COM1, CUMULATIVE ) ? "ON" : "OFF" );
  39.    printf( "Frame error flag: %s\n",
  40.            isframerr( COM1, CUMULATIVE ) ? "ON" : "OFF" );
  41.    printf( "Break flag: %s\n",
  42.            isbreak( COM1, CUMULATIVE ) ? "ON" : "OFF" );
  43.    printf( "Overrun flag: %s\n",
  44.            isoverrun( COM1, CUMULATIVE ) ? "ON" : "OFF" );
  45. }
  46.