DataMuseum.dk

Presents historical artifacts from the history of:

Commodore CBM-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Commodore CBM-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦8afbbfc4f⟧ TextFile

    Length: 482 (0x1e2)
    Types: TextFile
    Notes: UNIX file
    Names: »_fpseek.c«

Derivation

└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
    └─⟦f4b8d8c84⟧ UNIX V7 Filesystem
        └─ ⟦this⟧ »libc/stdio/_fpseek.c« 

TextFile

/*
 * 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), 1) == -1L)
		return (EOF);
	fp->_dp = fp->_cp;
	fp->_cc = 0;
	return (0);
}