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 / EXAMP64.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-09  |  1.2 KB  |  55 lines

  1. /*
  2.  *  EXAMP64.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.  You can escape
  9.  *  from it by pressing escape, or download a file using YMODEM by
  10.  *  pressing the F1 key.
  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.                       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.     for ( ; ; ) {
  35.         if ( gfkbhit() ) {
  36.             c = getkey();
  37.             if ( c == ESC )
  38.                 exit( 0 );
  39.             else if ( c == F1 )
  40.                 YmodemReceive( COM1, message_guy, NULL, 3 );
  41.             else
  42.                 asiputc( COM1, c );
  43.         }
  44.         c = asigetc( COM1 );
  45.         if ( c >= ASSUCCESS )
  46.             putc( c, stdout );
  47.    }
  48. }
  49.  
  50. void message_guy( char *message )
  51. {
  52.     printf( "%s\n", message );
  53. }
  54.  
  55.