elks-enhanced
public
Read
Owner: themaster
Branch: master
Commits: 6893
Updated: 2026-04-19 00:15
Git CLI clone URL
git clone https://www.xt-emporium.com/git/elks-enhanced.git
Fullscreen desktop URL
Code
Commits
History
Branches
Bug Reports
Discussions
Compare
Settings
elks-enhanced
/
libc
/
stdio
/
fputc.c
File editor
#include <stdio.h> int fputc(int ch, FILE *fp) { register int v; /* If last op was a read ... note fflush may change fp->mode and ret OK */ if ((fp->mode & __MODE_READING) && fflush(fp)) return EOF; v = fp->mode; /* Can't write if there's been an EOF or error then return EOF */ if ((v & (__MODE_WRITE | __MODE_EOF | __MODE_ERR)) != __MODE_WRITE) return EOF; /* In MSDOS translation mode */ #if __MODE_IOTRAN && !O_BINARY if (ch == '\n' && (v & __MODE_IOTRAN) && fputc('\r', fp) == EOF) return EOF; #endif /* Buffer is full */ if (fp->bufpos >= fp->bufend && fflush(fp)) return EOF; /* Right! Do it! */ *(fp->bufpos++) = ch; fp->mode |= __MODE_WRITING; /* Unbuffered or Line buffered and end of line */ if (((ch == '\n' && (v & _IOLBF)) || (v & _IONBF)) && fflush(fp)) return EOF; /* Can the macro handle this by itself ? */ if (v & (__MODE_IOTRAN | _IOLBF | _IONBF)) fp->bufwrite = fp->bufstart; /* Nope */ else fp->bufwrite = fp->bufend; /* Yup */ /* Correct return val */ return (unsigned char) ch; }
Commit message
This repository is read-only for this account.
Repository snapshot
Current branch
master
Visibility
public
Your access
Read
Remote
Configured
File activity
View file history