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

  1. /*
  2.  *  EXAMP77.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 sends a
  9.  *  single file using Xmodem-1K-G.
  10.  *
  11.  */
  12. #include <stdio.h>
  13. #include <stdlib.h>
  14. #include "asiports.h"
  15. #include "xfer.h"
  16. #include "ibmkeys.h"
  17. #include "gf.h"
  18.  
  19. void message_guy( char *message );
  20. void main( void );
  21.  
  22. void main()
  23. {
  24.     int c;
  25.     int status;
  26.  
  27.     status = asiopen( COM1, ASINOUT | BINARY | NORMALRX, 1050, 1050,
  28.                       2400L, P_NONE, 1, 8, ON, ON);
  29.     if ( status < ASSUCCESS ) {
  30.         printf( "Failed to open the port.  Status = %d\n", status );
  31.         exit( 1 );
  32.     }
  33.     for ( ; ; ) {
  34.         if ( gfkbhit() ) {
  35.             c = getkey();
  36.             if ( c == ESC )
  37.                 exit( 0 );
  38.             else if ( c == F1 )
  39.                 Xmodem1KGCRCSend( COM1, "EXAMP76.C",message_guy, NULL, 3 );
  40.             else
  41.                 asiputc( COM1, c );
  42.         }
  43.         c = asigetc( COM1 );
  44.         if ( c >= ASSUCCESS )
  45.             putc( c, stdout );
  46.    }
  47. }
  48.  
  49. void message_guy( char *message )
  50. {
  51.     printf( "%s\n", message );
  52. }
  53.  
  54.