home *** CD-ROM | disk | FTP | other *** search
- /*
- * EXAMP35.C
- *
- * The Greenleaf Comm Library
- *
- * Copyright (C) 1989 Greenleaf Software Inc. All Rights Reserved.
- *
- * This example sends data to something, and continues until
- * it notices a line status error. It the prints out the changed
- * status of all four incoming modem lines.
- *
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include "asiports.h"
- #include "ibmkeys.h"
- #include "gf.h"
-
- void main( void );
-
- void main()
- {
- int status;
-
- status = asiopen( COM1, ASOUT | BINARY | NORMALRX, 100, 100,
- 1200L, P_NONE, 1, 8, OFF, ON);
- if ( status < ASSUCCESS ) {
- printf( "Failed to open the port. Status = %d\n", status );
- exit( 1 );
- }
- for ( ; ; ) {
- asiputs( COM1, "Lots of test data\n", -1 );
- if ( islinerr( COM1 ) || gfkbhit() )
- break;
- }
- printf( "The line status error flag has been set.\n");
- printf( "Parity error flag: %s\n",
- isparityerr( COM1, CUMULATIVE ) ? "ON" : "OFF" );
- printf( "Frame error flag: %s\n",
- isframerr( COM1, CUMULATIVE ) ? "ON" : "OFF" );
- printf( "Break flag: %s\n",
- isbreak( COM1, CUMULATIVE ) ? "ON" : "OFF" );
- printf( "Overrun flag: %s\n",
- isoverrun( COM1, CUMULATIVE ) ? "ON" : "OFF" );
- }