home *** CD-ROM | disk | FTP | other *** search
- /*
- * EXAMP10.C
- *
- * The Greenleaf Comm Library
- *
- * Copyright (C) 1989 Greenleaf Software Inc. All Rights Reserved.
- *
- * This example program demonstrates some of the Hayes Modem Functions.
- * It dials the Greenleaf BBS, and hangs up as soon as it gets through.
- * The program hangs up by exiting, which should drop DTR. Your modem may
- * not hang up if it has not been configured to do so.
- *
- */
- #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;
- char input_line[81];
- int ticks;
-
- 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 );
- HMSetUpAbortKey( ESC );
- HMReset(COM1);
- HMSetDialingMethod( COM1, TOUCH_TONE );
- HMDial( COM1, "250-3778");
- ticks = TICKS_PER_SECOND*15;
- while ( ticks > 0 ) {
- ticks = HMInputLine( COM1, ticks, input_line, 81 );
- if (strcmp( input_line, "CONNECT" ) == 0 ) {
- printf( "Connection successfully made!\n" );
- exit( 0 );
- }
- }
- printf( "Failed to connect!\n");
- exit( 1 );
- }
-
- void my_putc( char c )
- {
- putc( c, stdout );
- }
-