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 / EXAMP67.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-12-11  |  1.3 KB  |  56 lines

  1. /*
  2.  *  EXAMP67.C
  3.  *
  4.  *  The Greenleaf Comm Library
  5.  *
  6.  *  Copyright (C) 1989 Greenleaf Software Inc.  All Rights Reserved.
  7.  *
  8.  *  This program is a plain vanilla terminal emulator.  It will receive
  9.  *  a file using Kermit by pressing the F1 key.  You can exit the program
  10.  *  by pressing the ESC key.  This demonstrates the KermitReceive() function.
  11.  *
  12.  */
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include "asiports.h"
  16. #include "xfer.h"
  17. #include "ibmkeys.h"
  18. #include "gf.h"
  19.  
  20. void message_guy( char *message );
  21. void main( void );
  22.  
  23. void main()
  24. {
  25.     int c;
  26.     int status;
  27.  
  28.     status = asiopen( COM1, ASINOUT | BINARY | NORMALRX, 1050, 1050,
  29.                       19200L, 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.     asixon( COM1, 30, 70, XON, XOFF );
  35.     for ( ; ; ) {
  36.         if ( gfkbhit() ) {
  37.             c = getkey();
  38.             if ( c == ESC )
  39.                 exit( 0 );
  40.             else if ( c == F1 )
  41.                 KermitReceive( COM1, message_guy, NULL, 3 );
  42.             else
  43.                 asiputc( COM1, c );
  44.         }
  45.         c = asigetc( COM1 );
  46.         if ( c >= ASSUCCESS )
  47.             putc( c, stdout );
  48.    }
  49. }
  50.  
  51. void message_guy( char *message )
  52. {
  53.     printf( "%s\n", message );
  54. }
  55.  
  56.