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

  1. /*
  2.  *  EXAMP73.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 demonstrates
  9.  *  the ability to send multiple files using YMODEM.
  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.                       19200L, 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.                 YmodemSend( COM1, "EXAMP73.C,EXAMP73.OBJ,EXAMP73.EXE",
  40.                             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.