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

  1. /*
  2.  *  EXAMP70.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 upload a file using XMODEM 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.     char filename[81];
  28.  
  29.     status = asiopen( COM1, ASINOUT | BINARY | NORMALRX, 1050, 1050,
  30.                       2400L, P_NONE, 1, 8, ON, ON);
  31.     if ( status < ASSUCCESS ) {
  32.         printf( "Failed to open the port.  Status = %d\n", status );
  33.         exit( 1 );
  34.     }
  35.     for ( ; ; ) {
  36.         if ( gfkbhit() ) {
  37.             c = getkey();
  38.             if ( c == ESC )
  39.                 exit( 0 );
  40.             else if ( c == F1 ) {
  41.                 printf( "\nWhat file would you like to upload? " );
  42.                 scanf( "%80s", filename );
  43.                 XmodemChecksumSend( COM1, filename, message_guy, NULL, 3 );
  44.             }
  45.             else
  46.                 asiputc( COM1, c );
  47.         }
  48.         c = asigetc( COM1 );
  49.         if ( c >= ASSUCCESS )
  50.             putc( c, stdout );
  51.    }
  52. }
  53.  
  54. void message_guy( char *message )
  55. {
  56.     printf( "%s\n", message );
  57. }
  58.  
  59.