/* Copyright (C) Magna Carta Software, Inc. 1990, 1991. All Rights Reserved C COMMUNICATIONS TOOLKIT CPUTN.C -- Send a character sequence of specified length out of the serial port. */ #if (defined(CCTW) || defined(_WINDOWS)) #include #endif #include #if defined(MSC) #include #endif /* C_PUTN -- Send a sequence of 'num' characters out the designated serial port with character transformation. If interrupt-driven transmission is in effect. characters in 'str' are added to the head of the transmit buffer. This is 'blocking' I/O. Use c_txcount() to get free space in buffer to use non-blocking I/O. Return Value: >=0 -- the number of characters sent; RX_TIMEOUT -- expected echo not received from remote system; */ WORD c_putn(COMM_PORT *p, WORD num, char *s) { WORD i; short ret = 0; /* p->f_txbusy |= TX_WAIT; */ for (i=0; i < num; i++) { ret = c_putc(p, *s++); if (ret) break; } /* p->f_txbusy &= ~TX_WAIT; */ if (p->txstart != NULL) (*p->txstart)(p); return (i); }