Files
Digital-Research-Source-Code/CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/FPUTC.C
Sepp J Morris 31738079c4 Upload
Digital Research
2020-11-06 18:50:37 +01:00

33 lines
1001 B
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*****************************************************************************
*
* f p u t c F u n c t i o n
* ---------------------------
* Copyright 1982 by Digital Research Inc. All rights reserved.
*
* "fputc" does the inserting of a char into a stream buffer,
* calling _flsbuf when the buffer fills up.
* Returns the character put, or FAILURE (-1) if any errors.
*
* Calling sequence:
* ret=fputc(ch,s)
* Where:
* ch = the char to put
* s -> the stream (FILE *)
* ret= ch or FAILURE
*
*****************************************************************************/
#include "stdio.h"
WORD fputc(ch,sp) /* CLEAR FUNCTION ***********/
REG BYTE ch; /* char to put */
REG FILE *sp; /* stream to put it to */
{ /****************************/
if( --(sp->_cnt) >= 0 ) /* if there's room in buf */
return(((WORD)(*sp->_ptr++ = ch)) & 0377);/* put it! */
else return(_flsbuf(ch,sp)); /* o.w. flush & put */
/****************************/
}