home *** CD-ROM | disk | FTP | other *** search
- /*
- * YMG.C
- *
- * Contains: YmodemSend()
- *
- * 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 YmodemSend( int port,
- * char *file_name_list,
- * void ( *message_routine )( char * ),
- * void ( *idle_routine )( XFER * ),
- * 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.
- *
- * char *file_name_list: This is a pointer to a string containing
- * a list of file names. The file names
- * can be separated by spaces, commas,
- * or semicolons. The driver will do its
- * best to send them one at a time.
- *
- * 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 YMODEM file send.
- * YMODEM batch allows for multiple files to be sent during a single session,
- * and that is handled here by allowing multiple files to be specified
- * in the file_name parameter. The file names can be separated by single
- * commas, semicolons, or spaces.
- *
- * 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 YmodemSend( int port,
- char *file_name_list,
- 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 = file_name_list;
- 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;
- xmodem.x.xmodem.crc_mode = TRUE;
- _YmodemSend( &xmodem );
- return( xmodem.return_status );
- }
-
-
-