www.pudn.com > DTMS.rar > READPTR.C


#include	"mail.h"

/* Read a chain ptr field from anywhere in the index file:
 * the free list pointer, a hash table chain ptr, or an
 * index record chain ptr.  */

off_t
_mail_readptr(MAIL *mail, off_t offset)
{
	char	asciiptr[PTR_SZ + 1];

	if (lseek(mail->idxfd, offset, SEEK_SET) == -1)
		err_dump("lseek error to ptr field");
	if (read(mail->idxfd, asciiptr, PTR_SZ) != PTR_SZ)
		err_dump("read error of ptr field");

	asciiptr[PTR_SZ] = 0;		/* null terminate */
	return(atol(asciiptr));
}