home *** CD-ROM | disk | FTP | other *** search
- /*
- * EXAMP53.C
- *
- * The Greenleaf Comm Library
- *
- * Copyright (C) 1989 Greenleaf Software Inc. All Rights Reserved.
- *
- * This example program demonstrates the use of the HMGoOnline()
- * function. It dials a number and returns to command state,
- * then waits for the user to hit F1 to return to on-line status.
- *
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include "asiports.h"
- #include "ibmkeys.h"
- #include "gf.h"
-
- void my_putc( char c );
- void main( void );
-
- void main()
- {
- int status;
- int c;
-
- 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 );
- }
-
- HMWaitForOK( TICKS_PER_SECOND, NULL );
- HMSetUpEchoRoutine( my_putc );
-
- HMReset( COM1 );
-
- HMDial( COM1, "250-3778;" );
-
- for ( ; ; ) {
- if ( gfkbhit() ) {
- c = getkey();
- if ( c == ESC )
- exit( 0 );
- else if ( c == F1 )
- HMGoOnline( COM1 );
- else
- asiputc( COM1, c );
- }
- c = asigetc( COM1 );
- if ( c >= ASSUCCESS )
- putc( c, stdout );
- }
- }
-
- void my_putc( char c )
- {
- putc( c, stdout );
- }