home *** CD-ROM | disk | FTP | other *** search
- /*
- * EXAMP26.C
- *
- * The Greenleaf Comm Library
- *
- * Copyright (C) 1989 Greenleaf Software Inc. All Rights Reserved.
- *
- * This example program demonstrates the use of asrts() and asdtr().
- * This is a terminal emulator. Hitting F1 will drop RTS and DTR
- * for two seconds, which should cause most modems to disconnect.
- *
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include "asiports.h"
- #include "ibmkeys.h"
- #include "gf.h"
-
- void main( void );
-
- void main()
- {
- int c;
- int status;
-
- status = asiopen( COM1, ASINOUT | BINARY | NORMALRX, 100, 100,
- 1200L, P_NONE, 1, 8, ON, ON);
- if ( status < ASSUCCESS ) {
- printf( "Failed to open the port. Status = %d\n", status );
- exit( 1 );
- }
- for ( ; ; ) {
- if ( gfkbhit() ) {
- c = getkey();
- if ( c == ESC )
- exit( 0 );
- else if ( c == F1 ) {
- asrts( COM1, OFF );
- asdtr( COM1, OFF );
- timer( TICKS_PER_SECOND * 2 );
- asrts( COM1, ON );
- asdtr( COM1, ON );
- } else
- asiputc( COM1, c );
- }
- c = asigetc( COM1 );
- if ( c >= ASSUCCESS )
- putc( c, stdout );
- }
- }