home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-4.ZIP / GSAMP / GSAMP.ZIP / EXAMP61.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-09  |  1.3 KB  |  58 lines

  1. /*
  2.  *  EXAMP61.C
  3.  *
  4.  *  The Greenleaf Comm Library
  5.  *
  6.  *  Copyright (C) 1989 Greenleaf Software Inc.  All Rights Reserved.
  7.  *
  8.  *  This example program demonstrates the use of the
  9.  *  HMSetCarrierDisconnectTime() function.  One good use of this would be
  10.  *  to prevent a Call Waiting beep from causing a disconnect.
  11.  *
  12.  */
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include <string.h>
  16. #include "asiports.h"
  17. #include "ibmkeys.h"
  18. #include "gf.h"
  19.  
  20. void my_putc( char c );
  21. void main( void );
  22.  
  23. void main()
  24. {
  25.     int status;
  26.     int c;
  27.  
  28.     status = asiopen( COM1, ASINOUT | BINARY | NORMALRX, 100, 100,
  29.                       1200L, P_NONE, 1, 8, ON, ON);
  30.     if ( status < ASSUCCESS ) {
  31.         printf( "Failed to open the port.  Status = %d\n", status );
  32.         exit( 1 );
  33.     }
  34.  
  35.     HMWaitForOK( TICKS_PER_SECOND, NULL );
  36.     HMSetUpEchoRoutine( my_putc );
  37.     HMSetCarrierDisconnectTime( COM1, 25 );
  38.     HMDial( COM1, "250-3778" );
  39.     for ( ; ; ) {
  40.         if ( gfkbhit() ) {
  41.             c = getkey();
  42.             if ( c == ESC )
  43.                 exit( 0 );
  44.             else
  45.                 asiputc( COM1, c );
  46.         }
  47.         c = asigetc( COM1 );
  48.         if ( c >= ASSUCCESS )
  49.             putc( c, stdout );
  50.    }
  51. }
  52.  
  53. void my_putc( char c )
  54. {
  55.     putc( c, stdout );
  56. }
  57.  
  58.