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

/*
 * Standard I/O Library Internals
 * Align file seek addr with current pointer in buffer
 * by writing out unflushed data or seeking back over unread data
 * ungot char is discarded
 */

#include <stdio.h>

int
_fpseek(fp)
register FILE	*fp;
{
	extern	long	lseek();

	if (fp->_ff&_FUNGOT)
		(*fp->_gt)(fp);
	if (fp->_dp <= fp->_cp)
		return (fflush(fp));
	if (lseek(fileno(fp), (long)(fp->_cp-fp->_dp), SEEK_CUR) == -1L)
		return (EOF);
	fp->_dp = fp->_cp;
	fp->_cc = 0;
	return (0);
}

unix.superglobalmegacorp.com

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