/*
 * BSD/Unix expansion library for Amiga.
 *
 * seekdir() -- system independent directory code
 */

#include "dir.h"

/*
 * telldir and seekdir don't work quite right. The problem is that you have
 * to save more than a long's worth of stuff to indicate position, and it's
 * socially unacceptable to alloc stuff that you don't free later under
 * AmigaDOS. So we fake it - you get one level of seek, and dat's all.
 * As of now, these things are untested.
 */

#define DIR_SEEK_RETURN		((long) 1)	/* Not 0! */

void
seekdir(my_dir, where)
   DIR *my_dir;
   long where;
{
	if (where == DIR_SEEK_RETURN)
		my_dir->d_info = my_dir->d_seek ;
	else	/* Makes the next readdir fail */
		setmem((char *) my_dir, sizeof(DIR), 0) ;
}
