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

⟦c077f3687⟧ TextFile

    Length: 342 (0x156)
    Types: TextFile
    Notes: UNIX file
    Names: »ftell.c«

Derivation

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

TextFile

/*
 * Standard I/O Library
 * Tell logical (vs physical) file position
 * in units compatible with fseek
 */

#include <stdio.h>

long
ftell(fp)
register FILE	*fp;
{
	extern	long	lseek();
	long	offset;

	if ((offset=lseek(fileno(fp), 0L, 1)) == -1L)
		return (-1L);
	else if (fp->_bp!=NULL)
		offset += fp->_cp - fp->_dp;
	return (offset);
}