if ((__set_errno(db_open(file, type, __db_oflags(oflags), mode, NULL, dbinfop, &dbp))) != 0) {
if ((errno = db_open(file, type, __db_oflags(oflags), mode, NULL, dbinfop, &dbp)) != 0) {
__dbopen(file, oflags, mode, type, openinfo)	const char *file;	int oflags, mode;	DBTYPE type;	const void *openinfo;{	const BTREEINFO *bi;	const HASHINFO *hi;	const RECNOINFO *ri;	DB *dbp;	DB185 *db185p;	DB_INFO dbinfo, *dbinfop;	int s_errno;	if ((db185p = (DB185 *)__db_calloc(1, sizeof(DB185))) == NULL)		return (NULL);	dbinfop = NULL;	memset(&dbinfo, 0, sizeof(dbinfo));	/*	 * !!!	 * The DBTYPE enum wasn't initialized in DB 185, so it's off-by-one	 * from DB 2.0.	 */	switch (type) {	case 0:					/* DB_BTREE */		type = DB_BTREE;		if ((bi = openinfo) != NULL) {			dbinfop = &dbinfo;			if (bi->flags & ~R_DUP)				goto einval;			if (bi->flags & R_DUP)				dbinfop->flags |= DB_DUP;			dbinfop->db_cachesize = bi->cachesize;			dbinfop->bt_maxkey = bi->maxkeypage;			dbinfop->bt_minkey = bi->minkeypage;			dbinfop->db_pagesize = bi->psize;			/*			 * !!!			 * Comparisons and prefix calls work because the DBT			 * structures in 1.85 and 2.0 have the same initial			 * fields.			 */			dbinfop->bt_compare = bi->compare;			dbinfop->bt_prefix = bi->prefix;			dbinfop->db_lorder = bi->lorder;		}		break;	case 1:					/* DB_HASH */		type = DB_HASH;		if ((hi = openinfo) != NULL) {			dbinfop = &dbinfo;			dbinfop->db_pagesize = hi->bsize;			dbinfop->h_ffactor = hi->ffactor;			dbinfop->h_nelem = hi->nelem;			dbinfop->db_cachesize = hi->cachesize;			dbinfop->h_hash = hi->hash;			dbinfop->db_lorder = hi->lorder;		}		break;	case 2:					/* DB_RECNO */		type = DB_RECNO;		dbinfop = &dbinfo;		/* DB 1.85 did renumbering by default. */		dbinfop->flags |= DB_RENUMBER;		/*		 * !!!		 * The file name given to DB 1.85 recno is the name of the DB		 * 2.0 backing file.  If the file doesn't exist, create it if		 * the user has the O_CREAT flag set, DB 1.85 did it for you,		 * and DB 2.0 doesn't.		 *		 * !!!		 * Note, the file name in DB 1.85 was a const -- we don't do		 * that in DB 2.0, so do that cast.		 */		if (file != NULL) {			if (oflags & O_CREAT && __db_exists(file, NULL) != 0)				(void)__os_close(__os_open(file, oflags, mode));			dbinfop->re_source = (char *)file;			file = NULL;		}		if ((ri = openinfo) != NULL) {			/*			 * !!!			 * We can't support the bfname field.			 */#define	BFMSG	"DB: DB 1.85's recno bfname field is not supported.\n"			if (ri->bfname != NULL) {				(void)__os_write(2, BFMSG, sizeof(BFMSG) - 1);				goto einval;			}			if (ri->flags & ~(R_FIXEDLEN | R_NOKEY | R_SNAPSHOT))				goto einval;			if (ri->flags & R_FIXEDLEN) {				dbinfop->flags |= DB_FIXEDLEN;				if (ri->bval != 0) {					dbinfop->flags |= DB_PAD;					dbinfop->re_pad = ri->bval;				}			} else				if (ri->bval != 0) {					dbinfop->flags |= DB_DELIMITER;					dbinfop->re_delim = ri->bval;				}			/*			 * !!!			 * We ignore the R_NOKEY flag, but that's okay, it was			 * only an optimization that was never implemented.			 */			if (ri->flags & R_SNAPSHOT)				dbinfop->flags |= DB_SNAPSHOT;			dbinfop->db_cachesize = ri->cachesize;			dbinfop->db_pagesize = ri->psize;			dbinfop->db_lorder = ri->lorder;			dbinfop->re_len = ri->reclen;		}		break;	default:		goto einval;	}	db185p->close = db185_close;	db185p->del = db185_del;	db185p->fd = db185_fd;	db185p->get = db185_get;	db185p->put = db185_put;	db185p->seq = db185_seq;	db185p->sync = db185_sync;	/*	 * !!!	 * Store the returned pointer to the real DB 2.0 structure in the	 * internal pointer.  Ugly, but we're not going for pretty, here.	 */	if ((__set_errno(db_open(file,	    type, __db_oflags(oflags), mode, NULL, dbinfop, &dbp))) != 0) {		__db_free(db185p);		return (NULL);	}	/* Create the cursor used for sequential ops. */	if ((__set_errno(dbp->cursor(dbp, NULL, &((DB185 *)db185p)->dbc)))	    != 0) {		s_errno = errno;		(void)dbp->close(dbp, 0);		__db_free(db185p);		__set_errno(s_errno);		return (NULL);	}	db185p->internal = dbp;	return (db185p);einval:	__db_free(db185p);	__set_errno(EINVAL);	return (NULL);}