home *** CD-ROM | disk | FTP | other *** search
- /*
- * XMCHKS.C
- *
- * Contains: XmodemChecksumSend()
- *
- * 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 XmodemChecksumSend( int port,
- * char *file_name,
- * 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: The file to be opened and sent. The
- * file will be opened with "wb" access.
- *
- * 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 an XMODEM file send
- * using the traditional additive checksum. This is the most basic
- * XMODEM file transfer routine, and should work universally.
- *
- * SIDE EFFECTS
- *
- * File 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 XmodemChecksumSend( int port,
- char *file_name,
- void ( GF_CDECL *message_routine )( char * ),
- void ( GF_CDECL *idle_routine )( XFER * ),
- unsigned int abort_key )
- {
- XFER xmodem;
-
- xmodem.port = port;
- xmodem.return_file_name = NULL;
- xmodem.filename = file_name;
- xmodem.file_length = 0L;
- xmodem.message_routine = message_routine;
- xmodem.idle_routine = idle_routine;
- xmodem.abort_key = abort_key;
- xmodem.transfer_type = XFER_TYPE_XMODEM;
- xmodem.x.xmodem.crc_mode = FALSE;
- _XmodemSend( &xmodem );
- return( xmodem.return_status );
- }
-
-