/* This will set bpp to the buffer header of the last page of the big pair. It will return the pageno of the overflow page following the last page of the pair; 0 if there isn't any (i.e. big pair is the last key in the bucket)  */
u_int16_t __find_last_page(HTAB *hashp, BUFHEAD **bpp)
/* This will set bpp to the buffer header of the last page of the big pair. It will return the pageno of the overflow page following the last page of the pair; 0 if there isn't any (i.e. big pair is the last key in the bucket)  */
u_int16_t __find_last_page(HTAB *hashp, BUFHEAD **bpp)
{
	BUFHEAD *bufp;
	u_int16_t *bp, pageno;
	int n;
	bufp = *bpp;
	bp = (u_int16_t *)bufp->page;
	for (;;) {
		n = bp[0];
		if (bp[2] == FULL_KEY_DATA &&
		    ((n == 2) || (bp[n] == OVFLPAGE) || (FREESPACE(bp))))
			break;
		pageno = bp[n - 1];
		bufp = __get_buf(hashp, pageno, bufp, 0);
		if (!bufp)
			return (0);
		bp = (u_int16_t *)bufp->page;
	}
	*bpp = bufp;
	if (bp[0] > 2)
		return (bp[3]);
	else
		return (0);
}