File:  [MW Coherent from dump] / coherent / b / lib / libc / XSTDIO / _fpseek.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:36 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

/*
 * libc/stdio/_fpseek.c
 * ANSI-compliant C standard i/o library internals.
 * _fpseek()
 * Align file seek address with current pointer in buffer.
 */

#include <stdio.h>

int
_fpseek(fp) register FILE *fp;
{
	register _FILE2 *f2p;

	f2p = fp->_f2p;
	if (fp->_ff2 & _FUNGOT)
		(*f2p->_gt)(fp);	/* Discard ungotten character */
	if (f2p->_dp <= fp->_cp)
		return fflush(fp);	/* Flush buffered output */
	if (lseek(fileno(fp), (long)(fp->_cp-f2p->_dp), SEEK_CUR) == -1L)
		return EOF;		/* Seek back over unread input */
	f2p->_dp = fp->_cp;
	fp->_cc = 0;
	return 0;
}

/* end of libc/stdio/_fpseek.c */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.