home *** CD-ROM | disk | FTP | other *** search
- /*
- * EXAMP37.C
- *
- * The Greenleaf Comm Library
- *
- * Copyright (C) 1989 Greenleaf Software Inc. All Rights Reserved.
- *
- * This program demonstrates the used of asimstat(). It monitors
- * the status lines on the modem until the user hits a key.
- *
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include "asiports.h"
- #include "ibmkeys.h"
- #include "gf.h"
-
- void main( void );
-
- void main()
- {
- int status;
- int i;
- int j;
-
- status = asiopen( COM1, ASINOUT | BINARY | NORMALRX, 1000, 1000,
- 1200L, P_NONE, 1, 8, OFF, ON);
- if ( status < ASSUCCESS ) {
- printf( "Failed to open the port. Status = %d\n", status );
- exit( 1 );
- }
- asimrst( COM1 );
- i = 0;
- for ( ; ; ) {
- if ( gfkbhit() )
- break;
- if ( (i++ % 20 ) == 0 )
- printf("\n CTS DSR RI CD\n");
- status = asimstat( COM1, IMMEDIATE );
- for ( j = 0 ; j < 4 ; j++ ) {
- printf( status & 0x10 ? " ON " : " OFF " );
- status >>= 1;
- }
- printf("\n");
- timer( TICKS_PER_SECOND );
- }
- getkey();
- }