home *** CD-ROM | disk | FTP | other *** search
- /*
- * ASCIIS.C
- *
- * Contains: AsciiSend()
- *
- * 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 AsciiSend( int port,
- * char *file_name,
- * void ( *message_routine )( char *message ),
- * void ( *idle_routine )( XFER *status_block ),
- * void ( *echo_routine )( int c ),
- * char strip_lf,
- * int line_delay,
- * unsigned int abort_key )
- *
- * ARGUMENTS
- *
- * int port: This is the com port where the transfer
- * will be performed. It should be open.
- *
- * char *file_name: The file to be opened and uploaded.
- *
- * void ( *message_routine )( char * ):A routine to print character messages
- * sent out by the driver. NULL for no
- * routine present.
- *
- * void ( *idle_routine )( XFER * ): An idle routine. It gets a parameter
- * block pointer, enabling it to print
- * out statistics. NULL for no routine.
- *
- * void ( *echo_routine )( int c ): During ASCII transfers, it is often
- * useful to be able to see what the
- * remote end is printing as it echos
- * characters being sent. This function
- * allows the program to print the
- * echoed characters, one at a time, as
- * they are received.
- *
- * char strip_lf: This flag indicates whether line feed
- * characters should be stripped from
- * the file being sent. A lot of times
- * each line should just be terminated
- * with a CR, not an LF also.
- *
- * int line_delay: This is a count in ticks (not seconds)
- * for how long the sender driver should
- * delay after each line is sent. A 'line'
- * is defined as a string of characters
- * that either ends with a CR, LF or
- * reaches 80 characters.
- *
- * unsigned int abort_key: A user defined abort key. Control X
- * conventionally, but ESC is good too.
- *
- * DESCRIPTION
- *
- * This routine calls the driver routine to perform an ASCII file
- * upload. Note that ASCII uploads have no handshaking. The only option
- * the user has to control the flow is a fixed tick delay after each line
- * is sent. Some pacing is enforced by that fact that the input buffer
- * is continually being read and flushed, this enforces a sort-of
- * handshaking. In addition, if XON/XOFF handshakins is turned on, it will
- * work properly during ASCII transfers.
- *
- * SIDE EFFECTS
- *
- * File may have been transfered.
- *
- * RETURNS
- *
- * This routine returns the xfer status word that was set up
- * by the driver routine. The interpretation of the return values
- * is described in the include file, "XFER.H", which also contains
- * their definitions.
- *
- * AUTHOR
- * Mark Nelson 28-Aug-1989 20:57:40.92
- *
- * MODIFICATIONS
- *
- */
- int GF_CONV AsciiSend( int port,
- char *file_name,
- void ( GF_CDECL *message_routine )( char *message ),
- void ( GF_CDECL *idle_routine )( XFER *status_block ),
- void ( GF_CDECL *echo_routine )( int c ),
- char strip_lf,
- int line_delay,
- unsigned int abort_key )
- {
- XFER ascii;
-
- ascii.port = port;
- ascii.return_file_name = NULL;
- ascii.filename = file_name;
- ascii.file_length = 0L ;
- ascii.message_routine = message_routine;
- ascii.idle_routine = idle_routine;
- ascii.abort_key = abort_key;
- ascii.transfer_type = XFER_TYPE_ASCII;
- ascii.x.ascii.strip_lf = strip_lf;
- ascii.x.ascii.received_character_printer = echo_routine;
- ascii.x.ascii.delay_ticks_per_line = line_delay;
- _AsciiSend( &ascii );
- return( ascii.return_status );
- }
-
-
-