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

  1. /*
  2.  *  EXAMP74.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 Kermit.  This program opens
  10.  *  the port in 7 bit mode, and switches to 8 bits in order to perform
  11.  *  the transfer.  It then switches back to 7 bits.
  12.  *
  13.  */
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include "asiports.h"
  17. #include "xfer.h"
  18. #include "ibmkeys.h"
  19. #include "gf.h"
  20.  
  21. void message_guy( char *message );
  22. void main( void );
  23.  
  24. void main()
  25. {
  26.     int c;
  27.     int status;
  28.  
  29.     status = asiopen( COM1, ASINOUT | BINARY | NORMALRX, 1050, 1050,
  30.                       19200L, P_EVEN, 1, 7, 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.                 asiinit( COM1, 19200L, P_NONE, 1, 8 );
  42.                 KermitSend( COM1, "EXAMP74.C,EXAMP74.OBJ,EXAMP74.EXE",
  43.                             message_guy, NULL, 3 );
  44.                 asiinit( COM1, 19200L, P_EVEN, 1, 7 );
  45.             }
  46.             else
  47.                 asiputc( COM1, c );
  48.         }
  49.         c = asigetc( COM1 );
  50.         if ( c >= ASSUCCESS )
  51.             putc( c, stdout );
  52.    }
  53. }
  54.  
  55. void message_guy( char *message )
  56. {
  57.     printf( "%s\n", message );
  58. }
  59.  
  60.