int flags;
u_int32_t flags;
__ham_c_get(cursor, key, data, flags)	DBC *cursor;	DBT *key;	DBT *data;	int flags;{	DB *ldbp;	HTAB *hashp;	HASH_CURSOR *hcp, save_curs;	int get_key, ret, t_ret;	DEBUG_LREAD(cursor->dbp, cursor->txn, "ham_c_get",	    flags == DB_SET || flags == DB_SET_RANGE ? key : NULL,	    NULL, flags);	ldbp = cursor->dbp;	if (F_ISSET(cursor->dbp, DB_AM_THREAD) &&	    (ret = __db_gethandle(cursor->dbp, __ham_hdup, &ldbp)) != 0)		return (ret);	hashp = (HTAB *)(ldbp->internal);	hcp = (HASH_CURSOR *)cursor->internal;	save_curs = *hcp;	if ((ret =	    __db_cgetchk(hashp->dbp, key, data, flags, IS_VALID(hcp))) != 0)		return (ret);	SET_LOCKER(hashp->dbp, cursor->txn);	GET_META(hashp->dbp, hashp);	hashp->hash_accesses++;	hcp->seek_size = 0;	ret = 0;	get_key = 1;	switch (flags) {	case DB_PREV:		if (hcp->bucket != BUCKET_INVALID) {			ret = __ham_item_prev(hashp, hcp, DB_LOCK_READ);			break;		}		/* FALL THROUGH */	case DB_LAST:		ret = __ham_item_last(hashp, hcp, DB_LOCK_READ);		break;	case DB_FIRST:		ret = __ham_item_first(hashp, hcp, DB_LOCK_READ);		break;	case DB_NEXT:		if (hcp->bucket == BUCKET_INVALID)			hcp->bucket = 0;		ret = __ham_item_next(hashp, hcp, DB_LOCK_READ);		break;	case DB_SET:	case DB_SET_RANGE:		ret = __ham_lookup(hashp, hcp, key, 0, DB_LOCK_READ);		get_key = 0;		break;	case DB_CURRENT:		if (F_ISSET(hcp, H_DELETED)) {			ret = DB_KEYEMPTY;			goto out;		}		ret = __ham_item(hashp, hcp, DB_LOCK_READ);		break;	}	/*	 * Must always enter this loop to do error handling and	 * check for big key/data pair.	 */	while (1) {		if (ret != 0 && ret != DB_NOTFOUND)			goto out1;		else if (F_ISSET(hcp, H_OK)) {			/* Get the key. */			if (get_key && (ret = __db_ret(hashp->dbp, hcp->pagep,			    H_KEYINDEX(hcp->bndx), key, &hcp->big_key,			    &hcp->big_keylen)) != 0)				goto out1;			ret = __ham_dup_return(hashp, hcp, data, flags);			break;		} else if (!F_ISSET(hcp, H_NOMORE)) {			abort();			break;		}		/*		 * Ran out of entries in a bucket; change buckets.		 */		switch (flags) {			case DB_LAST:			case DB_PREV:				ret = __ham_item_done(hashp, hcp, 0);				if (hcp->bucket == 0) {					ret = DB_NOTFOUND;					goto out1;				}				hcp->bucket--;				hcp->bndx = NDX_INVALID;				if (ret == 0)					ret = __ham_item_prev(hashp,					    hcp, DB_LOCK_READ);				break;			case DB_FIRST:			case DB_NEXT:				ret = __ham_item_done(hashp, hcp, 0);				hcp->bndx = NDX_INVALID;				hcp->bucket++;				hcp->pgno = PGNO_INVALID;				hcp->pagep = NULL;				if (hcp->bucket > hashp->hdr->max_bucket) {					ret = DB_NOTFOUND;					goto out1;				}				if (ret == 0)					ret = __ham_item_next(hashp,					    hcp, DB_LOCK_READ);				break;			case DB_SET:			case DB_SET_RANGE:				/* Key not found. */				ret = DB_NOTFOUND;				goto out1;		}	}out1:	if ((t_ret = __ham_item_done(hashp, hcp, 0)) != 0 && ret == 0)		t_ret = ret;out:	if (ret)		*hcp = save_curs;	RELEASE_META(hashp->dbp, hashp);	if (F_ISSET(cursor->dbp, DB_AM_THREAD))		__db_puthandle(ldbp);	return (ret);}