dc166-patch/runtime/c166l/fputc.c
2026-08-26 17:05:24 +03:00

17 lines
408 B
C

#include "dc166_stdio.h"
int fputc(int character, FILE *stream)
{
unsigned char byte = (unsigned char)character;
if ((stream->_flag & (_IOWR | _IOSTRG)) == (_IOWR | _IOSTRG)) {
if (--stream->_cnt < 0)
return EOF;
*stream->_ptr++ = (char)byte;
return (int)byte;
}
if (--stream->_cnt < 0)
return _flsbuf((int)byte, stream);
*stream->_ptr++ = (char)byte;
return (int)byte;
}