DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

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

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T s

⟦38041e406⟧ TextFile

    Length: 670 (0x29e)
    Types: TextFile
    Names: »seekdir.c«

Derivation

└─⟦060c9c824⟧ Bits:30007080 DKUUG TeX 2/12/89
    └─⟦this⟧ »./DVIware/laser-setters/umd-dvi/libcompat/seekdir.c« 

TextFile

/*
	seekdir -- C library extension routine

	last edit:	21-Jan-1984	D A Gwyn
*/

#include	<dir.h>

extern long	lseek();

#define NULL	0

void
seekdir( dirp, loc )
	register DIR	*dirp;		/* stream from opendir() */
	long		loc;		/* position from telldir() */
	{
	long		base;		/* file location of block */
	long		offset; 	/* offset within block */

	if ( telldir( dirp ) == loc )
		return; 		/* save time */

	offset = loc % DIRBLKSIZ;
	base = loc - offset;

	(void)lseek( dirp->dd_fd, base, 0 );	/* change blocks */
	dirp->dd_loc = dirp->dd_size = 0;

	while ( dirp->dd_loc < offset ) /* skip entries */
		if ( readdir( dirp ) == NULL )
			return; 	/* "can't happen" */
	}