/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley
* under license from the Regents of the University of
* California.
*/
#include "mt.h"
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
void dbm_access(long);
void delitem(char *, int);
void chkblk(char *);
int getbit(void);
int setbit(void);
int
{
dbrdonly = 0;
/*
* file.pag does not fit into pagbuf.
* fails with ENAMETOOLONG.
*/
return (-1);
}
if (pagf < 0) {
dbrdonly = 1;
}
/*
* We know this won't overflow so it is safe to ignore the
* return value; we use strl* to prevent false hits in
* code sweeps.
*/
if (dirf < 0) {
dbrdonly = 1;
}
return (-1);
return (0);
}
/* Avoid using cached data for subsequent accesses. */
int
dbmflush(void)
{
oldb1 = -1;
oldb2 = -1;
return (0);
}
/* Clean up after ourself. */
int
dbmclose(void)
{
bitno = 0;
maxbno = 0;
blkno = 0;
hmask = 0;
oldb1 = -1;
oldb2 = -1;
return (0);
}
long
{
long hash;
if (getbit() == 0)
break;
}
return (blkno);
}
{
int i;
for (i = 0; ; i += 2) {
return (item);
}
(void) printf("items not in pairs\n");
return (item);
}
}
}
int
{
int i;
if (dbrdonly)
return (-1);
for (i = 0; ; i += 2) {
return (-1);
break;
}
}
return (0);
}
int
{
int i;
if (dbrdonly)
return (-1);
loop:
for (i = 0; ; i += 2) {
break;
break;
}
}
if (i < 0)
goto split;
goto split;
}
return (0);
(void) printf("entry too big\n");
return (-1);
}
for (i = 0; ; ) {
break;
(void) printf("split not paired\n");
break;
}
continue;
}
i += 2;
}
return (-1);
}
return (-1);
}
if (setbit() < 0) {
return (-1);
}
goto loop;
}
firstkey(void)
{
return (firsthash(0L));
}
{
int i;
long hash;
int f;
#ifdef lint
#endif /* lint */
f = 1;
for (i = 0; ; i += 2) {
break;
continue;
f = 0;
}
}
if (f == 0)
return (bitem);
if (hash == 0)
return (item);
}
{
int i;
loop:
for (i = 2; ; i += 2) {
break;
}
return (bitem);
if (hash == 0)
return (item);
goto loop;
}
void
{
if (getbit() == 0)
break;
}
if (readsize < 0)
readsize = 0;
}
}
}
int
getbit(void)
{
long bn;
long b, i, n;
return (0);
if (b != oldb2) {
if (readsize < 0)
readsize = 0;
}
oldb2 = b;
}
if (dirbuf[i] & (1<<n))
return (1);
return (0);
}
int
setbit(void)
{
long bn;
long i, n, b;
if (dbrdonly)
return (-1);
(void) getbit();
}
dirbuf[i] |= 1<<n;
return (-1);
return (0);
}
{
short *sp;
int t;
/* LINTED pointer cast */
if (n < 0 || n >= sp[0])
goto null;
t = PBLKSIZ;
if (n > 0)
return (item);
null:
return (item);
}
int
{
int n;
if (n == 0)
return (0);
do {
} while (--n);
return (0);
}
/*
* ken's
* {
* 055, 043, 036, 054, 063, 014, 004, 005,
* 010, 064, 077, 000, 035, 027, 025, 071,
* };
*/
= { 61, 57, 53, 49, 45, 41, 37, 33,
29, 25, 21, 17, 13, 9, 5, 1,
};
= {
06100151277L, 06106161736L, 06452611562L, 05001724107L,
02614772546L, 04120731531L, 04665262210L, 07347467531L,
06735253126L, 06042345173L, 03072226605L, 01464164730L,
03247435524L, 07652510057L, 01546775256L, 05714532133L,
06173260402L, 07517101630L, 02431460343L, 01743245566L,
00261675137L, 02433103631L, 03421772437L, 04447707466L,
04435620103L, 03757017115L, 03641531772L, 06767633246L,
02673230344L, 00260612216L, 04133454451L, 00615531516L,
06137717526L, 02574116560L, 02304023373L, 07061702261L,
05153031405L, 05322056705L, 07401116734L, 06552375715L,
06165233473L, 05311063631L, 01212221723L, 01052267235L,
06000615237L, 01075222665L, 06330216006L, 04402355630L,
01451177262L, 02000133436L, 06025467062L, 07121076461L,
03123433522L, 01010635225L, 01716177066L, 05161746527L,
01736635071L, 06243505026L, 03637211610L, 01756474365L,
04723077174L, 03642763134L, 05750130273L, 03655541561L,
};
long
{
long bit;
for (; ; ) {
bit >>= 1;
if (bit == 0)
return (0L);
}
}
long
{
int i, j, f;
long hashl;
int hashi;
hashl = 0;
hashi = 0;
f = dptr[i];
for (j = 0; j < BYTESIZ; j += 4) {
f >>= 4;
}
}
return (hashl);
}
void
{
short *sp;
/* LINTED pointer cast */
if (n < 0 || n >= sp[0])
goto bad;
if (n > 0)
i1--;
i2--;
}
sp[0]--;
return;
bad:
(void) printf("bad delitem\n");
abort();
}
int
{
short *sp;
/* LINTED pointer cast */
if (sp[0] > 0)
return (-1);
i1++;
}
sp[0]++;
return (sp[0]-1);
}
void
{
short *sp;
int t, i;
/* LINTED pointer cast */
t = PBLKSIZ;
for (i = 0; i < sp[0]; i++) {
if (sp[i+1] > t)
goto bad;
t = sp[i+1];
}
if (t < (sp[0]+1) * sizeof (short))
goto bad;
return;
bad:
(void) printf("bad block\n");
abort();
/* NOTREACHED */
}