home *** CD-ROM | disk | FTP | other *** search
- /* asiputb.c
- *
- * The Greenleaf Comm Library
- *
- * Copyright (C) 1985-1990 Greenleaf Software Inc. All Rights Reserved.
- *
- * unsigned asiputb( port, buf, length)
- * int port; - Port 0..MAX_PORT-1
- * char *buf; - Pointer to buffer
- * unsigned length; - Length of buffer, number of characters.
- *
- * DESCRIPTION
- * Transmit an arbitrary array or user buffer. This function moves the
- * contents of the specified buffer, (i.e. the specified number ("length")
- * of characters) to the Transmitter Buffer. This is done by means of
- * repeated calls to asiputc().
- *
- * SIDE EFFECTS
- * none
- *
- * RETURNS
- * returns the number of characters SUCCESSFULLY transmitted. The global
- * variable _aserror can be examined to determine if an error was detected.
- * _aserror == 0 if no errors were detected. If the transmit queue becomes
- * full before the entire buffer can be transmitted _aserror will be set to
- * ASBUFRFULL.
- *
- * _aserror =
- *
- * Value Meaning
- * ------- --------
- * ASSUCCESS port initialized (no error)
- * ASINVPORT Requested port is out of range
- * ASNOTSETUP Requested port not setup with asifirst()
- * ASBUFRFULL Transmit buffer went full
- * ASINVPAR NULL pointer passed as parameter
- *
- * Also see error returns for asiputc().
- *
- * MODIFICATIONS
- * 10-29-85 ""
- * Modified for release 2.0
- *
- * 03-FEB-1987 13:27:28.03
- * Added test for NULL pointer passed as buffer parameter, if this
- * condition is detected an ASINVPAR error is returned in _aserror.
- * Fixed error propogation problem from asiputc(), the only error
- * that was being recognized was an ASBUFRFULL, modified to return
- * any errors detected by asiputc().
- */
- #include <stdio.h>
- #include "gf.h"
- #include "asiports.h"
-
- unsigned GF_CONV asiputb(port,buffer,length)
- int port;
- unsigned length;
- char *buffer;
- {
- unsigned xmit_count;
-
- if(!buffer) {
- _aserror= ASINVPAR;
- return(0);
- }
- for(xmit_count=0;length;++buffer,++xmit_count,--length)
- if((_aserror=asiputc(port, ((int)*buffer&255) ))!=ASSUCCESS)
- return(xmit_count);
- return(xmit_count);
- }
-
-