int altFclose(ALT_FILE *fp) { int closeOK; if (fp->fd < 0) return EOF; altFflush(fp); closeOK = close(fp->fd); fp->fd = -1; return closeOK == 0 ? 0 : EOF; }
int altPutc(char c, ALT_FILE *fp) { *fp->next++ = c; if (fp->next == fp->buffer + fp->bufSize) altFflush(fp); }
int altGetc(ALT_FILE *fp) { if (fp->next == fp->buffer + fp->bufSize) altFflush(fp); return fp->flags & FILE_ATEOF ? EOF : *fp->next++; }