home *** CD-ROM | disk | FTP | other *** search
- /*
- * YMGR.C
- *
- * Contains: YmodemGReceive()
- *
- * The Greenleaf Comm Library
- *
- * Copyright (C) 1989-90 Greenleaf Software Inc. All Rights Reserved.
- *
- */
-
- #include <stdio.h>
- #include "gf.h"
- #include "asiports.h"
- #include "xfer.h"
- #include "_xfer.h"
-
- /*
- *
- * int YmodemGReceive( int port,
- * void ( *message_routine )( char *message ),
- * void ( *idle_routine )( XFER *status_block ),
- * unsigned int abort_key )
- *
- * ARGUMENTS
- *
- * int port: The port can be any opened COM port.
- * Take note of the fact that XMODEM file
- * transfers must have a totally transparent
- * eight bit connection. This means that
- * The port must be opened with eight bits,
- * and XON/XOFF handshaking must be turned
- * off. In addition, the buffer sizes
- * should be large enough to accomodate the
- * largest XMODEM buffer, which is about
- * 1030 bytes.
- *
- * void ( *message_routine )( char * ):The driver routine calls this message
- * routine to print out major progress
- * messages and error messages. This can
- * be as simple or complicated a routine as
- * the user desires. All the routine needs
- * to be able to do is print out a string.
- * Note that none of the strings have any
- * embedded control characters. If this
- * parameter is a NULL, then no message
- * routine is called.
- *
- * void ( *idle_routine)( XFER * ): This idle routine is called whenever
- * the driver is waiting for buffers to
- * empty out or fill up. It passes a
- * pointer to the current Xfer status
- * block. This information will typically
- * be used to update a status display.
- * See XFER.H for documentation on what
- * the fields in the parameter block mean.
- * ANSITERM.C has an example of a status
- * screen using this information. If this
- * parameter is a NULL, then no idle
- * routine is called.
- *
- * unsigned int abort_key: The driver routine looks at the
- * keyboard frequently to see if the user
- * wants to abort. The calling program
- * defines the acceptable abort key with
- * this parameter.
- *
- * DESCRIPTION
- *
- * This routine calls the driver program to perform a YMODEM file receive.
- * Note that no file name is in the parameter list for this routine, since
- * the file name will be sent from the remote end. Since this is a YMODEM-G
- * transfer, the connection to the remote end must be error free. In
- * addition, the receive must be able to save files as fast as they are
- * sent, since there is no handshaking.
- *
- * SIDE EFFECTS
- *
- * File(s) may have been transfered.
- *
- * RETURNS
- *
- * The routine returns one of the defined XFER_RETURN codes defined
- * in XFER.H.
- *
- * AUTHOR
- * Mark Nelson 28-Aug-1989 20:57:40.92
- *
- * MODIFICATIONS
- *
- */
-
- int GF_CONV YmodemGReceive( int port,
- void ( GF_CDECL *message_routine )( char *message ),
- void ( GF_CDECL *idle_routine )( XFER *status_block ),
- unsigned int abort_key )
- {
- XFER xmodem;
-
- xmodem.port = port;
- xmodem.return_file_name = NULL;
- xmodem.filename = NULL;
- xmodem.file_length = 0L;
- xmodem.message_routine = message_routine;
- xmodem.idle_routine = idle_routine;
- xmodem.abort_key = abort_key;
- xmodem.transfer_type = XFER_TYPE_YMODEM_G;
- xmodem.x.xmodem.crc_mode = TRUE;
- _YmodemReceive( &xmodem );
- return( xmodem.return_status );
- }
-
-
-