]> git.pld-linux.org Git - packages/db1.git/blame - db1.patch
- adapterized, pl translations
[packages/db1.git] / db1.patch
CommitLineData
c008b72c
JR
1--- db.1.85/btree/bt_delete.c.jj Thu Jul 28 16:30:03 1994
2+++ db.1.85/btree/bt_delete.c Wed Apr 19 17:56:12 2000
3@@ -154,7 +154,7 @@ __bt_stkacq(t, hp, c)
4 pgno_t pgno;
5 recno_t nextpg, prevpg;
6 int exact, level;
7-
8+
9 /*
10 * Find the first occurrence of the key in the tree. Toss the
11 * currently locked page so we don't hit an already-locked page.
12@@ -270,7 +270,7 @@ __bt_stkacq(t, hp, c)
13 if ((h = mpool_get(t->bt_mp, prevpg, 0)) == NULL)
14 return (1);
15 }
16-
17+
18
19 ret: mpool_put(t->bt_mp, h, 0);
20 return ((*hp = mpool_get(t->bt_mp, c->pg.pgno, 0)) == NULL);
21@@ -402,7 +402,7 @@ __bt_pdelete(t, h)
22 /* Get the parent page. */
23 if ((pg = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL)
24 return (RET_ERROR);
25-
26+
27 index = parent->index;
28 bi = GETBINTERNAL(pg, index);
29
30@@ -418,7 +418,7 @@ __bt_pdelete(t, h)
31 * root page. If it's the rootpage, turn it back into an empty
32 * leaf page.
33 */
34- if (NEXTINDEX(pg) == 1)
35+ if (NEXTINDEX(pg) == 1) {
36 if (pg->pgno == P_ROOT) {
37 pg->lower = BTDATAOFF;
38 pg->upper = t->bt_psize;
39@@ -428,7 +428,7 @@ __bt_pdelete(t, h)
40 return (RET_ERROR);
41 continue;
42 }
43- else {
44+ } else {
45 /* Pack remaining key items at the end of the page. */
46 nksize = NBINTERNAL(bi->ksize);
47 from = (char *)pg + pg->upper;
48@@ -571,7 +571,7 @@ __bt_curdel(t, key, h, index)
49 key = &c->key;
50 }
51 /* Check previous key, if not at the beginning of the page. */
52- if (index > 0) {
53+ if (index > 0) {
54 e.page = h;
55 e.index = index - 1;
56 if (__bt_cmp(t, key, &e) == 0) {
57--- db.1.85/btree/bt_open.c.jj Thu Aug 18 15:30:42 1994
58+++ db.1.85/btree/bt_open.c Wed Apr 19 17:56:12 2000
59@@ -125,7 +125,7 @@ __bt_open(fname, flags, mode, openinfo,
60 */
61 if (b.psize &&
62 (b.psize < MINPSIZE || b.psize > MAX_PAGE_OFFSET + 1 ||
63- b.psize & sizeof(indx_t) - 1))
64+ b.psize & (sizeof(indx_t) - 1)))
65 goto einval;
66
67 /* Minimum number of keys per page; absolute minimum is 2. */
68@@ -200,7 +200,7 @@ __bt_open(fname, flags, mode, openinfo,
69 default:
70 goto einval;
71 }
72-
73+
74 if ((t->bt_fd = open(fname, flags, mode)) < 0)
75 goto err;
76
77@@ -245,7 +245,7 @@ __bt_open(fname, flags, mode, openinfo,
78 if (m.magic != BTREEMAGIC || m.version != BTREEVERSION)
79 goto eftype;
80 if (m.psize < MINPSIZE || m.psize > MAX_PAGE_OFFSET + 1 ||
81- m.psize & sizeof(indx_t) - 1)
82+ m.psize & (sizeof(indx_t) - 1))
83 goto eftype;
84 if (m.flags & ~SAVEMETA)
85 goto eftype;
86@@ -259,7 +259,9 @@ __bt_open(fname, flags, mode, openinfo,
87 * Don't overflow the page offset type.
88 */
89 if (b.psize == 0) {
90+#ifdef _STATBUF_ST_BLKSIZE
91 b.psize = sb.st_blksize;
92+#endif
93 if (b.psize < MINPSIZE)
94 b.psize = MINPSIZE;
95 if (b.psize > MAX_PAGE_OFFSET + 1)
96@@ -278,8 +280,8 @@ __bt_open(fname, flags, mode, openinfo,
97 t->bt_psize = b.psize;
98
99 /* Set the cache size; must be a multiple of the page size. */
100- if (b.cachesize && b.cachesize & b.psize - 1)
101- b.cachesize += (~b.cachesize & b.psize - 1) + 1;
102+ if (b.cachesize && b.cachesize & (b.psize - 1))
103+ b.cachesize += (~b.cachesize & (b.psize - 1)) + 1;
104 if (b.cachesize < b.psize * MINCACHE)
105 b.cachesize = b.psize * MINCACHE;
106
107@@ -388,18 +390,30 @@ tmp()
108 {
109 sigset_t set, oset;
110 int fd;
111- char *envtmp;
112- char path[MAXPATHLEN];
113+ const char *envtmp;
114+ char *path;
115+ static const char fmt[] = "%s/bt.XXXXXX";
116+ size_t n;
117
118 envtmp = getenv("TMPDIR");
119- (void)snprintf(path,
120- sizeof(path), "%s/bt.XXXXXX", envtmp ? envtmp : "/tmp");
121+ if (!envtmp)
122+ envtmp = "/tmp";
123+ n = strlen (envtmp) + sizeof fmt;
124+#ifdef __GNUC__
125+ path = __builtin_alloca(n);
126+#else
127+ path = malloc(n);
128+#endif
129+ (void)snprintf(path, n, fmt, envtmp ? envtmp : "/tmp");
130
131 (void)sigfillset(&set);
132 (void)sigprocmask(SIG_BLOCK, &set, &oset);
133 if ((fd = mkstemp(path)) != -1)
134 (void)unlink(path);
135 (void)sigprocmask(SIG_SETMASK, &oset, NULL);
136+#ifndef __GNUC__
137+ free(path);
138+#endif
139 return(fd);
140 }
141
142--- db.1.85/btree/bt_page.c.jj Thu Jul 14 03:29:02 1994
143+++ db.1.85/btree/bt_page.c Wed Apr 19 17:56:12 2000
144@@ -65,6 +65,7 @@ __bt_free(t, h)
145 h->prevpg = P_INVALID;
146 h->nextpg = t->bt_free;
147 t->bt_free = h->pgno;
148+ F_SET(t, B_METADIRTY);
149
150 /* Make sure the page gets written back. */
151 return (mpool_put(t->bt_mp, h, MPOOL_DIRTY));
152@@ -92,6 +93,7 @@ __bt_new(t, npg)
153 (h = mpool_get(t->bt_mp, t->bt_free, 0)) != NULL) {
154 *npg = t->bt_free;
155 t->bt_free = h->nextpg;
156+ F_SET(t, B_METADIRTY);
157 return (h);
158 }
159 return (mpool_new(t->bt_mp, npg));
160--- db.1.85/btree/bt_put.c.jj Tue Jul 26 20:56:14 1994
161+++ db.1.85/btree/bt_put.c Wed Apr 19 17:56:12 2000
162@@ -201,7 +201,7 @@ delete: if (__bt_dleaf(t, key, h, index
163 * into the offset array, shift the pointers up.
164 */
165 nbytes = NBLEAFDBT(key->size, data->size);
166- if (h->upper - h->lower < nbytes + sizeof(indx_t)) {
167+ if ((u_int32_t) (h->upper - h->lower) < nbytes + sizeof(indx_t)) {
168 if ((status = __bt_split(t, h, key,
169 data, dflags, nbytes, index)) != RET_SUCCESS)
170 return (status);
171@@ -223,7 +223,7 @@ delete: if (__bt_dleaf(t, key, h, index
172 t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index >= index)
173 ++t->bt_cursor.pg.index;
174
175- if (t->bt_order == NOT)
176+ if (t->bt_order == NOT) {
177 if (h->nextpg == P_INVALID) {
178 if (index == NEXTINDEX(h) - 1) {
179 t->bt_order = FORWARD;
180@@ -237,6 +237,7 @@ delete: if (__bt_dleaf(t, key, h, index
181 t->bt_last.pgno = h->pgno;
182 }
183 }
184+ }
185
186 mpool_put(t->bt_mp, h, MPOOL_DIRTY);
187
188@@ -284,7 +285,7 @@ bt_fast(t, key, data, exactp)
189 * have to search to get split stack.
190 */
191 nbytes = NBLEAFDBT(key->size, data->size);
192- if (h->upper - h->lower < nbytes + sizeof(indx_t))
193+ if ((u_int32_t) (h->upper - h->lower) < nbytes + sizeof(indx_t))
194 goto miss;
195
196 if (t->bt_order == FORWARD) {
197--- db.1.85/btree/bt_seq.c.jj Tue Jul 26 18:57:24 1994
198+++ db.1.85/btree/bt_seq.c Wed Apr 19 17:56:12 2000
199@@ -92,7 +92,7 @@ __bt_seq(dbp, key, data, flags)
200 }
201
202 /*
203- * If scan unitialized as yet, or starting at a specific record, set
204+ * If scan uninitialized as yet, or starting at a specific record, set
205 * the scan to a specific key. Both __bt_seqset and __bt_seqadv pin
206 * the page the cursor references if they're successful.
207 */
208@@ -358,13 +358,13 @@ __bt_first(t, key, erval, exactp)
209 * page) and return it.
210 */
211 if ((ep = __bt_search(t, key, exactp)) == NULL)
212- return (NULL);
213+ return (RET_SPECIAL);
214 if (*exactp) {
215 if (F_ISSET(t, B_NODUPS)) {
216 *erval = *ep;
217 return (RET_SUCCESS);
218 }
219-
220+
221 /*
222 * Walk backwards, as long as the entry matches and there are
223 * keys left in the tree. Save a copy of each match in case
224--- db.1.85/btree/bt_split.c.jj Tue Jul 26 20:22:02 1994
225+++ db.1.85/btree/bt_split.c Wed Apr 19 17:56:12 2000
226@@ -215,7 +215,8 @@ __bt_split(t, sp, key, data, flags, ilen
227 }
228
229 /* Split the parent page if necessary or shift the indices. */
230- if (h->upper - h->lower < nbytes + sizeof(indx_t)) {
231+ if ((u_int32_t) (h->upper - h->lower)
232+ < nbytes + sizeof(indx_t)) {
233 sp = h;
234 h = h->pgno == P_ROOT ?
235 bt_root(t, h, &l, &r, &skip, nbytes) :
236@@ -673,7 +674,8 @@ bt_psplit(t, h, l, r, pskip, ilen)
237 * where we decide to try and copy too much onto the left page.
238 * Make sure that doesn't happen.
239 */
240- if (skip <= off && used + nbytes >= full) {
241+ if ((skip <= off && used + nbytes + sizeof(indx_t) >= full)
242+ || nxt == top - 1) {
243 --off;
244 break;
245 }
246@@ -686,7 +688,7 @@ bt_psplit(t, h, l, r, pskip, ilen)
247 memmove((char *)l + l->upper, src, nbytes);
248 }
249
250- used += nbytes;
251+ used += nbytes + sizeof(indx_t);
252 if (used >= half) {
253 if (!isbigkey || bigkeycnt == 3)
254 break;
255--- db.1.85/btree/bt_utils.c.jj Wed Jul 20 17:06:53 1994
256+++ db.1.85/btree/bt_utils.c Wed Apr 19 17:56:12 2000
257@@ -76,7 +76,7 @@ __bt_ret(t, e, key, rkey, data, rdata, c
258 bl = GETBLEAF(e->page, e->index);
259
260 /*
261- * We must copy big keys/data to make them contigous. Otherwise,
262+ * We must copy big keys/data to make them contiguous. Otherwise,
263 * leave the page pinned and don't copy unless the user specified
264 * concurrent access.
265 */
266--- db.1.85/btree/btree.h.jj Thu Aug 18 15:30:43 1994
267+++ db.1.85/btree/btree.h Wed Apr 19 17:58:46 2000
268@@ -43,6 +43,14 @@
269
270 #include <mpool.h>
271
272+#define mpool_open __mpool_open
273+#define mpool_filter __mpool_filter
274+#define mpool_new __mpool_new
275+#define mpool_get __mpool_get
276+#define mpool_put __mpool_put
277+#define mpool_sync __mpool_sync
278+#define mpool_close __mpool_close
279+
280 #define DEFMINKEYPAGE (2) /* Minimum keys per page */
281 #define MINCACHE (5) /* Minimum cached pages */
282 #define MINPSIZE (512) /* Minimum page size */
283@@ -161,7 +169,7 @@ typedef struct _rinternal {
284 #define NRINTERNAL \
285 LALIGN(sizeof(recno_t) + sizeof(pgno_t))
286
287-/* Copy a RINTERAL entry to the page. */
288+/* Copy a RINTERNAL entry to the page. */
289 #define WR_RINTERNAL(p, nrecs, pgno) { \
290 *(recno_t *)p = nrecs; \
291 p += sizeof(recno_t); \
292--- db.1.85/hash/extern.h.jj Thu Jun 16 22:30:14 1994
293+++ db.1.85/hash/extern.h Wed Apr 19 17:56:12 2000
294@@ -52,7 +52,7 @@ void __free_ovflpage __P((HTAB *, BUFHE
295 BUFHEAD *__get_buf __P((HTAB *, u_int32_t, BUFHEAD *, int));
296 int __get_page __P((HTAB *, char *, u_int32_t, int, int, int));
297 int __ibitmap __P((HTAB *, int, int, int));
298-u_int32_t __log2 __P((u_int32_t));
299+u_int32_t __hash_log2 __P((u_int32_t));
300 int __put_page __P((HTAB *, char *, u_int32_t, int, int));
301 void __reclaim_buf __P((HTAB *, BUFHEAD *));
302 int __split_page __P((HTAB *, u_int32_t, u_int32_t));
303--- db.1.85/hash/hash.c.jj Fri Jun 24 17:12:29 1994
304+++ db.1.85/hash/hash.c Wed Apr 19 17:56:12 2000
305@@ -157,7 +157,8 @@ __hash_open(file, flags, mode, info, dfl
306 if (hashp->VERSION != HASHVERSION &&
307 hashp->VERSION != OLDHASHVERSION)
308 RETURN_ERROR(EFTYPE, error1);
309- if (hashp->hash(CHARKEY, sizeof(CHARKEY)) != hashp->H_CHARKEY)
310+ if (hashp->hash(CHARKEY, sizeof(CHARKEY))
311+ != (u_int32_t) hashp->H_CHARKEY)
312 RETURN_ERROR(EFTYPE, error1);
313 /*
314 * Figure out how many segments we need. Max_Bucket is the
315@@ -189,7 +190,7 @@ __hash_open(file, flags, mode, info, dfl
316 __buf_init(hashp, DEF_BUFSIZE);
317
318 hashp->new_file = new_table;
319- hashp->save_file = file && (hashp->flags & O_RDWR);
320+ hashp->save_file = file && (hashp->flags & O_ACCMODE) != O_RDONLY;
321 hashp->cbucket = -1;
322 if (!(dbp = (DB *)malloc(sizeof(DB)))) {
323 save_errno = errno;
324@@ -281,7 +282,9 @@ init_hash(hashp, file, info)
325 const char *file;
326 HASHINFO *info;
327 {
328+#ifdef _STATBUF_ST_BLKSIZE
329 struct stat statbuf;
330+#endif
331 int nelem;
332
333 nelem = 1;
334@@ -298,17 +301,19 @@ init_hash(hashp, file, info)
335 memset(hashp->BITMAPS, 0, sizeof (hashp->BITMAPS));
336
337 /* Fix bucket size to be optimal for file system */
338+#ifdef _STATBUF_ST_BLKSIZE
339 if (file != NULL) {
340 if (stat(file, &statbuf))
341 return (NULL);
342 hashp->BSIZE = statbuf.st_blksize;
343- hashp->BSHIFT = __log2(hashp->BSIZE);
344+ hashp->BSHIFT = __hash_log2(hashp->BSIZE);
345 }
346+#endif
347
348 if (info) {
349 if (info->bsize) {
350 /* Round pagesize up to power of 2 */
351- hashp->BSHIFT = __log2(info->bsize);
352+ hashp->BSHIFT = __hash_log2(info->bsize);
353 hashp->BSIZE = 1 << hashp->BSHIFT;
354 if (hashp->BSIZE > MAX_BSIZE) {
355 errno = EINVAL;
356@@ -357,7 +362,7 @@ init_htab(hashp, nelem)
357 */
358 nelem = (nelem - 1) / hashp->FFACTOR + 1;
359
360- l2 = __log2(MAX(nelem, 2));
361+ l2 = __hash_log2(MAX(nelem, 2));
362 nbuckets = 1 << l2;
363
364 hashp->SPARES[l2] = l2 + 1;
365@@ -375,7 +380,7 @@ init_htab(hashp, nelem)
366 hashp->BSHIFT) + 1;
367
368 nsegs = (nbuckets - 1) / hashp->SGSIZE + 1;
369- nsegs = 1 << __log2(nsegs);
370+ nsegs = 1 << __hash_log2(nsegs);
371
372 if (nsegs > hashp->DSIZE)
373 hashp->DSIZE = nsegs;
374@@ -505,7 +510,7 @@ flush_meta(hashp)
375 else
376 if (wsize != sizeof(HASHHDR)) {
377 errno = EFTYPE;
378- hashp->errno = errno;
379+ hashp->errnum = errno;
380 return (-1);
381 }
382 for (i = 0; i < NCACHED; i++)
383@@ -536,7 +541,7 @@ hash_get(dbp, key, data, flag)
384
385 hashp = (HTAB *)dbp->internal;
386 if (flag) {
387- hashp->errno = errno = EINVAL;
388+ hashp->errnum = errno = EINVAL;
389 return (ERROR);
390 }
391 return (hash_access(hashp, HASH_GET, (DBT *)key, data));
392@@ -553,11 +558,11 @@ hash_put(dbp, key, data, flag)
393
394 hashp = (HTAB *)dbp->internal;
395 if (flag && flag != R_NOOVERWRITE) {
396- hashp->errno = errno = EINVAL;
397+ hashp->errnum = errno = EINVAL;
398 return (ERROR);
399 }
400 if ((hashp->flags & O_ACCMODE) == O_RDONLY) {
401- hashp->errno = errno = EPERM;
402+ hashp->errnum = errno = EPERM;
403 return (ERROR);
404 }
405 return (hash_access(hashp, flag == R_NOOVERWRITE ?
406@@ -574,11 +579,11 @@ hash_delete(dbp, key, flag)
407
408 hashp = (HTAB *)dbp->internal;
409 if (flag && flag != R_CURSOR) {
410- hashp->errno = errno = EINVAL;
411+ hashp->errnum = errno = EINVAL;
412 return (ERROR);
413 }
414 if ((hashp->flags & O_ACCMODE) == O_RDONLY) {
415- hashp->errno = errno = EPERM;
416+ hashp->errnum = errno = EPERM;
417 return (ERROR);
418 }
419 return (hash_access(hashp, HASH_DELETE, (DBT *)key, NULL));
420@@ -729,7 +734,7 @@ hash_seq(dbp, key, data, flag)
421
422 hashp = (HTAB *)dbp->internal;
423 if (flag && flag != R_FIRST && flag != R_NEXT) {
424- hashp->errno = errno = EINVAL;
425+ hashp->errnum = errno = EINVAL;
426 return (ERROR);
427 }
428 #ifdef HASH_STATISTICS
429@@ -744,7 +749,7 @@ hash_seq(dbp, key, data, flag)
430 for (bp = NULL; !bp || !bp[0]; ) {
431 if (!(bufp = hashp->cpage)) {
432 for (bucket = hashp->cbucket;
433- bucket <= hashp->MAX_BUCKET;
434+ bucket <= (u_int32_t) hashp->MAX_BUCKET;
435 bucket++, hashp->cndx = 1) {
436 bufp = __get_buf(hashp, bucket, NULL, 0);
437 if (!bufp)
438@@ -842,13 +847,13 @@ __expand_table(hashp)
439 * * increases), we need to copy the current contents of the spare
440 * split bucket to the next bucket.
441 */
442- spare_ndx = __log2(hashp->MAX_BUCKET + 1);
443+ spare_ndx = __hash_log2(hashp->MAX_BUCKET + 1);
444 if (spare_ndx > hashp->OVFL_POINT) {
445 hashp->SPARES[spare_ndx] = hashp->SPARES[hashp->OVFL_POINT];
446 hashp->OVFL_POINT = spare_ndx;
447 }
448
449- if (new_bucket > hashp->HIGH_MASK) {
450+ if (new_bucket > (u_int32_t) hashp->HIGH_MASK) {
451 /* Starting a new doubling */
452 hashp->LOW_MASK = hashp->HIGH_MASK;
453 hashp->HIGH_MASK = new_bucket | hashp->LOW_MASK;
454@@ -868,7 +873,7 @@ hash_realloc(p_ptr, oldsize, newsize)
455 {
456 register void *p;
457
458- if (p = malloc(newsize)) {
459+ if ((p = malloc(newsize))) {
460 memmove(p, *p_ptr, oldsize);
461 memset((char *)p + oldsize, 0, newsize - oldsize);
462 free(*p_ptr);
463--- db.1.85/hash/hash.h.jj Fri Jun 24 17:12:29 1994
464+++ db.1.85/hash/hash.h Wed Apr 19 17:56:12 2000
465@@ -71,28 +71,28 @@ typedef struct hashhdr { /* Disk reside
466 int dsize; /* Directory Size */
467 int ssize; /* Segment Size */
468 int sshift; /* Segment shift */
469- int ovfl_point; /* Where overflow pages are being
470+ int ovfl_point; /* Where overflow pages are being
471 * allocated */
472 int last_freed; /* Last overflow page freed */
473 int max_bucket; /* ID of Maximum bucket in use */
474 int high_mask; /* Mask to modulo into entire table */
475- int low_mask; /* Mask to modulo into lower half of
476+ int low_mask; /* Mask to modulo into lower half of
477 * table */
478 int ffactor; /* Fill factor */
479 int nkeys; /* Number of keys in hash table */
480 int hdrpages; /* Size of table header */
481 int h_charkey; /* value of hash(CHARKEY) */
482-#define NCACHED 32 /* number of bit maps and spare
483+#define NCACHED 32 /* number of bit maps and spare
484 * points */
485 int spares[NCACHED];/* spare pages for overflow */
486- u_int16_t bitmaps[NCACHED]; /* address of overflow page
487+ u_int16_t bitmaps[NCACHED]; /* address of overflow page
488 * bitmaps */
489 } HASHHDR;
490
491 typedef struct htab { /* Memory resident data structure */
492 HASHHDR hdr; /* Header */
493 int nsegs; /* Number of allocated segments */
494- int exsegs; /* Number of extra allocated
495+ int exsegs; /* Number of extra allocated
496 * segments */
497 u_int32_t /* Hash function */
498 (*hash)__P((const void *, size_t));
499@@ -103,16 +103,16 @@ typedef struct htab { /* Memory reside
500 BUFHEAD *cpage; /* Current page */
501 int cbucket; /* Current bucket */
502 int cndx; /* Index of next item on cpage */
503- int errno; /* Error Number -- for DBM
504- * compatability */
505- int new_file; /* Indicates if fd is backing store
506+ int errnum; /* Error Number -- for DBM
507+ * compatibility */
508+ int new_file; /* Indicates if fd is backing store
509 * or no */
510- int save_file; /* Indicates whether we need to flush
511+ int save_file; /* Indicates whether we need to flush
512 * file at
513 * exit */
514 u_int32_t *mapp[NCACHED]; /* Pointers to page maps */
515 int nmaps; /* Initial number of bitmaps */
516- int nbufs; /* Number of buffers left to
517+ int nbufs; /* Number of buffers left to
518 * allocate */
519 BUFHEAD bufhead; /* Header of buffer lru list */
520 SEGMENT *dir; /* Hash Bucket directory */
521@@ -170,7 +170,7 @@ typedef struct htab { /* Memory reside
522 #define OADDR_OF(S,O) ((u_int32_t)((u_int32_t)(S) << SPLITSHIFT) + (O))
523
524 #define BUCKET_TO_PAGE(B) \
525- (B) + hashp->HDRPAGES + ((B) ? hashp->SPARES[__log2((B)+1)-1] : 0)
526+ (B) + hashp->HDRPAGES + ((B) ? hashp->SPARES[__hash_log2((B)+1)-1] : 0)
527 #define OADDR_TO_PAGE(B) \
528 BUCKET_TO_PAGE ( (1 << SPLITNUM((B))) -1 ) + OPAGENUM((B));
529
530@@ -194,7 +194,7 @@ typedef struct htab { /* Memory reside
531 * so it starts on this page and continues on the next.
532 * The format of the page is:
533 * KEY_OFF PARTIAL_KEY OVFL_PAGENO OVFLPAGE
534- *
535+ *
536 * KEY_OFF -- offset of the beginning of the key
537 * PARTIAL_KEY -- 1
538 * OVFL_PAGENO - page number of the next overflow page
539@@ -229,7 +229,7 @@ typedef struct htab { /* Memory reside
540 * OVFL_PAGENO - page number of the next overflow page
541 * OVFLPAGE -- 0
542 *
543- * FULL_KEY_DATA
544+ * FULL_KEY_DATA
545 * This must be the first key/data pair on the page.
546 * There are two cases:
547 *
548--- db.1.85/hash/hash_bigkey.c.jj Fri Jun 24 17:12:30 1994
549+++ db.1.85/hash/hash_bigkey.c Wed Apr 19 17:56:12 2000
550@@ -121,7 +121,7 @@ __big_insert(hashp, bufp, key, val)
551 if (!bufp)
552 return (-1);
553 n = p[0];
554- if (!key_size)
555+ if (!key_size) {
556 if (FREESPACE(p)) {
557 move_bytes = MIN(FREESPACE(p), val_size);
558 off = OFFSET(p) - move_bytes;
559@@ -134,6 +134,7 @@ __big_insert(hashp, bufp, key, val)
560 OFFSET(p) = off;
561 } else
562 p[n - 2] = FULL_KEY;
563+ }
564 p = (u_int16_t *)bufp->page;
565 cp = bufp->page;
566 bufp->flags |= BUF_MOD;
567@@ -147,7 +148,7 @@ __big_insert(hashp, bufp, key, val)
568 * Here's the hack to make sure that if the data ends on the
569 * same page as the key ends, FREESPACE is at least one.
570 */
571- if (space == val_size && val_size == val->size)
572+ if ((int) space == val_size && (size_t) val_size == val->size)
573 move_bytes--;
574 off = OFFSET(p) - move_bytes;
575 memmove(cp + off, val_data, move_bytes);
576@@ -249,7 +250,7 @@ __big_delete(hashp, bufp)
577 bufp->flags |= BUF_MOD;
578 if (rbufp)
579 __free_ovflpage(hashp, rbufp);
580- if (last_bfp != rbufp)
581+ if (last_bfp && last_bfp != rbufp)
582 __free_ovflpage(hashp, last_bfp);
583
584 hashp->NKEYS--;
585@@ -431,7 +432,7 @@ __big_return(hashp, bufp, ndx, val, set_
586 }
587
588 val->size = collect_data(hashp, bufp, (int)len, set_current);
589- if (val->size == -1)
590+ if (val->size == (size_t) -1)
591 return (-1);
592 if (save_p->addr != save_addr) {
593 /* We are pretty short on buffers. */
594@@ -510,7 +511,7 @@ __big_keydata(hashp, bufp, key, val, set
595 int set;
596 {
597 key->size = collect_key(hashp, bufp, 0, val, set);
598- if (key->size == -1)
599+ if (key->size == (size_t) -1)
600 return (-1);
601 key->data = (u_char *)hashp->tmp_key;
602 return (0);
603@@ -590,7 +591,7 @@ __big_split(hashp, op, np, big_keyp, add
604 return (-1);
605 change = (__call_hash(hashp, key.data, key.size) != obucket);
606
607- if (ret->next_addr = __find_last_page(hashp, &big_keyp)) {
608+ if ((ret->next_addr = __find_last_page(hashp, &big_keyp))) {
609 if (!(ret->nextp =
610 __get_buf(hashp, ret->next_addr, big_keyp, 0)))
611 return (-1);;
612--- db.1.85/hash/hash_log2.c.jj Tue May 31 22:56:53 1994
613+++ db.1.85/hash/hash_log2.c Wed Apr 19 17:56:12 2000
614@@ -42,8 +42,10 @@ static char sccsid[] = "@(#)hash_log2.c
615
616 #include <db.h>
617
618+u_int32_t __hash_log2 __P((u_int32_t));
619+
620 u_int32_t
621-__log2(num)
622+__hash_log2(num)
623 u_int32_t num;
624 {
625 register u_int32_t i, limit;
626--- db.1.85/hash/ndbm.c.jj Thu Jul 21 20:02:40 1994
627+++ db.1.85/hash/ndbm.c Wed Apr 19 17:56:12 2000
628@@ -47,6 +47,7 @@ static char sccsid[] = "@(#)ndbm.c 8.4 (
629
630 #include <stdio.h>
631 #include <string.h>
632+#include <stdlib.h>
633
634 #include <ndbm.h>
635 #include "hash.h"
636@@ -61,8 +62,16 @@ dbm_open(file, flags, mode)
637 const char *file;
638 int flags, mode;
639 {
640+ DBM *db;
641 HASHINFO info;
642- char path[MAXPATHLEN];
643+ const size_t len = strlen(file) + sizeof (DBM_SUFFIX);
644+#ifdef __GNUC__
645+ char path[len];
646+#else
647+ char *path = malloc(len);
648+ if (path == NULL)
649+ return NULL;
650+#endif
651
652 info.bsize = 4096;
653 info.ffactor = 40;
654@@ -72,7 +81,11 @@ dbm_open(file, flags, mode)
655 info.lorder = 0;
656 (void)strcpy(path, file);
657 (void)strcat(path, DBM_SUFFIX);
658- return ((DBM *)__hash_open(path, flags, mode, &info, 0));
659+ db = (DBM *)__hash_open(path, flags, mode, &info, 0);
660+#ifndef __GNUC__
661+ free(path);
662+#endif
663+ return db;
664 }
665
666 extern void
667@@ -180,7 +193,7 @@ dbm_error(db)
668 HTAB *hp;
669
670 hp = (HTAB *)db->internal;
671- return (hp->errno);
672+ return (hp->errnum);
673 }
674
675 extern int
676@@ -190,7 +203,7 @@ dbm_clearerr(db)
677 HTAB *hp;
678
679 hp = (HTAB *)db->internal;
680- hp->errno = 0;
681+ hp->errnum = 0;
682 return (0);
683 }
684
685--- db.1.85/recno/rec_close.c.jj Thu Aug 18 17:23:29 1994
686+++ db.1.85/recno/rec_close.c Wed Apr 19 17:56:12 2000
687@@ -79,13 +79,14 @@ __rec_close(dbp)
688 if (F_ISSET(t, R_MEMMAPPED) && munmap(t->bt_smap, t->bt_msize))
689 status = RET_ERROR;
690
691- if (!F_ISSET(t, R_INMEM))
692+ if (!F_ISSET(t, R_INMEM)) {
693 if (F_ISSET(t, R_CLOSEFP)) {
694 if (fclose(t->bt_rfp))
695 status = RET_ERROR;
696 } else
697 if (close(t->bt_rfd))
698 status = RET_ERROR;
699+ }
700
701 if (__bt_close(dbp) == RET_ERROR)
702 status = RET_ERROR;
703@@ -150,7 +151,7 @@ __rec_sync(dbp, flags)
704 */
705 status = (dbp->seq)(dbp, &key, &data, R_FIRST);
706 while (status == RET_SUCCESS) {
707- if (write(t->bt_rfd, data.data, data.size) != data.size)
708+ if ((size_t) write(t->bt_rfd, data.data, data.size) != data.size)
709 return (RET_ERROR);
710 status = (dbp->seq)(dbp, &key, &data, R_NEXT);
711 }
712@@ -162,7 +163,7 @@ __rec_sync(dbp, flags)
713 while (status == RET_SUCCESS) {
714 iov[0].iov_base = data.data;
715 iov[0].iov_len = data.size;
716- if (writev(t->bt_rfd, iov, 2) != data.size + 1)
717+ if ((size_t) writev(t->bt_rfd, iov, 2) != data.size + 1)
718 return (RET_ERROR);
719 status = (dbp->seq)(dbp, &key, &data, R_NEXT);
720 }
721--- db.1.85/recno/rec_put.c.jj Thu Aug 18 17:24:16 1994
722+++ db.1.85/recno/rec_put.c Wed Apr 19 17:56:12 2000
723@@ -170,7 +170,7 @@ einval: errno = EINVAL;
724
725 if (flags == R_SETCURSOR)
726 t->bt_cursor.rcursor = nrec;
727-
728+
729 F_SET(t, R_MODIFIED);
730 return (__rec_ret(t, NULL, nrec, key, NULL));
731 }
732@@ -256,7 +256,7 @@ __rec_iput(t, nrec, data, flags)
733 * the offset array, shift the pointers up.
734 */
735 nbytes = NRLEAFDBT(data->size);
736- if (h->upper - h->lower < nbytes + sizeof(indx_t)) {
737+ if ((u_int32_t) (h->upper - h->lower) < nbytes + sizeof(indx_t)) {
738 status = __bt_split(t, h, NULL, data, dflags, nbytes, index);
739 if (status == RET_SUCCESS)
740 ++t->bt_nrecs;
741--- db.1.85/recno/rec_seq.c.jj Thu Jul 14 03:35:40 1994
742+++ db.1.85/recno/rec_seq.c Wed Apr 19 17:56:12 2000
743@@ -31,7 +31,7 @@
744 * SUCH DAMAGE.
745 */
746
747-#ifndef lint
748+#if defined(LIBC_SCCS) && !defined(lint)
749 static char sccsid[] = "@(#)rec_seq.c 8.3 (Berkeley) 7/14/94";
750 #endif /* not lint */
751
752--- db.1.85/recno/rec_utils.c.jj Sat Jul 16 16:55:08 1994
753+++ db.1.85/recno/rec_utils.c Wed Apr 19 17:56:12 2000
754@@ -90,7 +90,7 @@ dataonly:
755 return (RET_SUCCESS);
756
757 /*
758- * We must copy big keys/data to make them contigous. Otherwise,
759+ * We must copy big keys/data to make them contiguous. Otherwise,
760 * leave the page pinned and don't copy unless the user specified
761 * concurrent access.
762 */
763--- db.1.85/mpool/mpool.c.jj Tue Jul 26 21:19:35 1994
764+++ db.1.85/mpool/mpool.c Wed Apr 19 18:06:21 2000
765@@ -50,6 +50,14 @@ static char sccsid[] = "@(#)mpool.c 8.5
766 #define __MPOOLINTERFACE_PRIVATE
767 #include <mpool.h>
768
769+#define mpool_open __mpool_open
770+#define mpool_filter __mpool_filter
771+#define mpool_new __mpool_new
772+#define mpool_get __mpool_get
773+#define mpool_put __mpool_put
774+#define mpool_sync __mpool_sync
775+#define mpool_close __mpool_close
776+
777 static BKT *mpool_bkt __P((MPOOL *));
778 static BKT *mpool_look __P((MPOOL *, pgno_t));
779 static int mpool_write __P((MPOOL *, BKT *));
780@@ -109,7 +117,7 @@ mpool_filter(mp, pgin, pgout, pgcookie)
781 mp->pgout = pgout;
782 mp->pgcookie = pgcookie;
783 }
784-
785+
786 /*
787 * mpool_new --
788 * Get a new page of memory.
789@@ -205,7 +213,8 @@ mpool_get(mp, pgno, flags)
790 off = mp->pagesize * pgno;
791 if (lseek(mp->fd, off, SEEK_SET) != off)
792 return (NULL);
793- if ((nr = read(mp->fd, bp->page, mp->pagesize)) != mp->pagesize) {
794+ if ((u_long) (nr = read(mp->fd, bp->page, mp->pagesize))
795+ != mp->pagesize) {
796 if (nr >= 0)
797 errno = EFTYPE;
798 return (NULL);
799@@ -300,6 +309,23 @@ mpool_sync(mp)
800 return (fsync(mp->fd) ? RET_ERROR : RET_SUCCESS);
801 }
802
803+#undef mpool_open
804+#undef mpool_filter
805+#undef mpool_new
806+#undef mpool_get
807+#undef mpool_put
808+#undef mpool_close
809+#undef mpool_sync
810+#define weak_alias(original, alias) \
811+ asm (".weak " #alias "\n" #alias " = " #original);
812+weak_alias (__mpool_open, mpool_open)
813+weak_alias (__mpool_filter, mpool_filter)
814+weak_alias (__mpool_new, mpool_new)
815+weak_alias (__mpool_get, mpool_get)
816+weak_alias (__mpool_put, mpool_put)
817+weak_alias (__mpool_close, mpool_close)
818+weak_alias (__mpool_sync, mpool_sync)
819+
820 /*
821 * mpool_bkt
822 * Get a page from the cache (or create one).
823@@ -380,7 +406,7 @@ mpool_write(mp, bp)
824 off = mp->pagesize * bp->pgno;
825 if (lseek(mp->fd, off, SEEK_SET) != off)
826 return (RET_ERROR);
827- if (write(mp->fd, bp->page, mp->pagesize) != mp->pagesize)
828+ if ((u_long) write(mp->fd, bp->page, mp->pagesize) != mp->pagesize)
829 return (RET_ERROR);
830
831 bp->flags &= ~MPOOL_DIRTY;
832@@ -436,7 +462,7 @@ mpool_stat(mp)
833 mp->pagealloc, mp->pageflush);
834 if (mp->cachehit + mp->cachemiss)
835 (void)fprintf(stderr,
836- "%.0f%% cache hit rate (%lu hits, %lu misses)\n",
837+ "%.0f%% cache hit rate (%lu hits, %lu misses)\n",
838 ((double)mp->cachehit / (mp->cachehit + mp->cachemiss))
839 * 100, mp->cachehit, mp->cachemiss);
840 (void)fprintf(stderr, "%lu page reads, %lu page writes\n",
841@@ -456,7 +482,7 @@ mpool_stat(mp)
842 cnt = 0;
843 } else
844 sep = ", ";
845-
846+
847 }
848 (void)fprintf(stderr, "\n");
849 }
850--- db.1.85/db/db.c.jj Tue Feb 22 00:07:47 1994
851+++ db.1.85/db/db.c Wed Apr 19 18:06:46 2000
852@@ -44,6 +44,8 @@ static char sccsid[] = "@(#)db.c 8.4 (Be
853
854 #include <db.h>
855
856+#define dbopen __dbopen
857+
858 DB *
859 dbopen(fname, flags, mode, type, openinfo)
860 const char *fname;
861@@ -72,9 +74,13 @@ dbopen(fname, flags, mode, type, openinf
862 errno = EINVAL;
863 return (NULL);
864 }
865+#undef dbopen
866+#define weak_alias(original, alias) \
867+ asm (".weak " #alias "\n" #alias " = " #original);
868+weak_alias (__dbopen, dbopen)
869
870 static int
871-__dberr()
872+__dberr __P((void))
873 {
874 return (RET_ERROR);
875 }
876@@ -90,10 +96,14 @@ __dbpanic(dbp)
877 DB *dbp;
878 {
879 /* The only thing that can succeed is a close. */
880- dbp->del = (int (*)())__dberr;
881- dbp->fd = (int (*)())__dberr;
882- dbp->get = (int (*)())__dberr;
883- dbp->put = (int (*)())__dberr;
884- dbp->seq = (int (*)())__dberr;
885- dbp->sync = (int (*)())__dberr;
886+ dbp->del = (int (*)__P((const struct __db *,
887+ const DBT *, u_int))) __dberr;
888+ dbp->get = (int (*)__P((const struct __db *,
889+ const DBT *, DBT *, u_int))) __dberr;
890+ dbp->put = (int (*)__P((const struct __db *,
891+ DBT *, const DBT *, u_int))) __dberr;
892+ dbp->seq = (int (*)__P((const struct __db *,
893+ DBT *, DBT *, u_int))) __dberr;
894+ dbp->sync = (int (*)__P((const struct __db *, u_int))) __dberr;
895+ dbp->fd = (int (*)__P((const struct __db *))) __dberr;
896 }
897--- db.1.85/PORT/include/ndbm.h.jj Thu Jun 3 05:32:29 1993
898+++ db.1.85/PORT/include/ndbm.h Wed Apr 19 17:56:12 2000
899@@ -36,8 +36,8 @@
900 * @(#)ndbm.h 8.1 (Berkeley) 6/2/93
901 */
902
903-#ifndef _NDBM_H_
904-#define _NDBM_H_
905+#ifndef _NDBM_H
906+#define _NDBM_H 1
907
908 #include <db.h>
909
910@@ -72,6 +72,8 @@ datum dbm_nextkey __P((DBM *));
911 DBM *dbm_open __P((const char *, int, int));
912 int dbm_store __P((DBM *, datum, datum, int));
913 int dbm_dirfno __P((DBM *));
914+int dbm_error __P((DBM *));
915+int dbm_clearerr __P((DBM *));
916 __END_DECLS
917
918-#endif /* !_NDBM_H_ */
919+#endif /* ndbm.h */
920--- db.1.85/PORT/linux/include/compat.h.jj Tue Jun 21 00:13:19 1994
921+++ db.1.85/PORT/linux/include/compat.h Wed Apr 19 17:56:12 2000
922@@ -1,155 +1,9 @@
923-/*-
924- * Copyright (c) 1991, 1993
925- * The Regents of the University of California. All rights reserved.
926- *
927- * Redistribution and use in source and binary forms, with or without
928- * modification, are permitted provided that the following conditions
929- * are met:
930- * 1. Redistributions of source code must retain the above copyright
931- * notice, this list of conditions and the following disclaimer.
932- * 2. Redistributions in binary form must reproduce the above copyright
933- * notice, this list of conditions and the following disclaimer in the
934- * documentation and/or other materials provided with the distribution.
935- * 3. All advertising materials mentioning features or use of this software
936- * must display the following acknowledgement:
937- * This product includes software developed by the University of
938- * California, Berkeley and its contributors.
939- * 4. Neither the name of the University nor the names of its contributors
940- * may be used to endorse or promote products derived from this software
941- * without specific prior written permission.
942- *
943- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
944- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
945- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
946- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
947- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
948- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
949- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
950- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
951- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
952- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
953- * SUCH DAMAGE.
954- *
955- * @(#)compat.h 8.13 (Berkeley) 2/21/94
956- */
957-
958-#ifndef _COMPAT_H_
959-#define _COMPAT_H_
960+/* Values for building 4.4 BSD db routines in the GNU C library. */
961
962-#include <sys/types.h>
963+#ifndef _compat_h_
964+#define _compat_h_
965
966-/*
967- * If your system doesn't typedef u_long, u_short, or u_char, change
968- * the 0 to a 1.
969- */
970-#if 0
971-typedef unsigned char u_char; /* 4.[34]BSD names. */
972-typedef unsigned int u_int;
973-typedef unsigned long u_long;
974-typedef unsigned short u_short;
975-#endif
976-
977-/* If your system doesn't typedef size_t, change the 0 to a 1. */
978-#if 0
979-typedef unsigned int size_t; /* POSIX, 4.[34]BSD names. */
980-#endif
981-
982-/* If your system doesn't typedef ssize_t, change the 0 to a 1. */
983-#if 0
984-typedef int ssize_t; /* POSIX names. */
985-#endif
986-
987-/*
988- * If your system doesn't have the POSIX type for a signal mask,
989- * change the 0 to a 1.
990- */
991-#if 0 /* POSIX 1003.1 signal mask type. */
992-typedef unsigned int sigset_t;
993-#endif
994-
995-/*
996- * If your system's vsprintf returns a char *, not an int,
997- * change the 0 to a 1.
998- */
999-#if 0
1000-#define VSPRINTF_CHARSTAR
1001-#endif
1002-
1003-/*
1004- * If you don't have POSIX 1003.1 signals, the signal code surrounding the
1005- * temporary file creation is intended to block all of the possible signals
1006- * long enough to create the file and unlink it. All of this stuff is
1007- * intended to use old-style BSD calls to fake POSIX 1003.1 calls.
1008- */
1009-#ifdef NO_POSIX_SIGNALS
1010-#define sigemptyset(set) (*(set) = 0)
1011-#define sigfillset(set) (*(set) = ~(sigset_t)0, 0)
1012-#define sigaddset(set,signo) (*(set) |= sigmask(signo), 0)
1013-#define sigdelset(set,signo) (*(set) &= ~sigmask(signo), 0)
1014-#define sigismember(set,signo) ((*(set) & sigmask(signo)) != 0)
1015-
1016-#define SIG_BLOCK 1
1017-#define SIG_UNBLOCK 2
1018-#define SIG_SETMASK 3
1019-
1020-static int __sigtemp; /* For the use of sigprocmask */
1021-
1022-/* Repeated test of oset != NULL is to avoid "*0". */
1023-#define sigprocmask(how, set, oset) \
1024- ((__sigtemp = \
1025- (((how) == SIG_BLOCK) ? \
1026- sigblock(0) | *(set) : \
1027- (((how) == SIG_UNBLOCK) ? \
1028- sigblock(0) & ~(*(set)) : \
1029- ((how) == SIG_SETMASK ? \
1030- *(set) : sigblock(0))))), \
1031- ((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) : \
1032- sigsetmask(__sigtemp)), 0)
1033-#endif
1034-
1035-/*
1036- * If your system doesn't have an include file with the appropriate
1037- * byte order set, make sure you specify the correct one.
1038- */
1039-#ifndef BYTE_ORDER
1040-#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
1041-#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
1042-#define BYTE_ORDER LITTLE_ENDIAN /* Set for your system. */
1043-#endif
1044-
1045-#if defined(SYSV) || defined(SYSTEM5)
1046-#define index(a, b) strchr(a, b)
1047-#define rindex(a, b) strrchr(a, b)
1048-#define bzero(a, b) memset(a, 0, b)
1049-#define bcmp(a, b, n) memcmp(a, b, n)
1050-#define bcopy(a, b, n) memmove(b, a, n)
1051-#endif
1052-
1053-#if defined(BSD) || defined(BSD4_3)
1054-#define strchr(a, b) index(a, b)
1055-#define strrchr(a, b) rindex(a, b)
1056-#define memcmp(a, b, n) bcmp(a, b, n)
1057-#define memmove(a, b, n) bcopy(b, a, n)
1058-#endif
1059-
1060-/*
1061- * 32-bit machine. The db routines are theoretically independent of
1062- * the size of u_shorts and u_longs, but I don't know that anyone has
1063- * ever actually tried it. At a minimum, change the following #define's
1064- * if you are trying to compile on a different type of system.
1065- */
1066-#ifndef USHRT_MAX
1067-#define USHRT_MAX 0xFFFF
1068-#define ULONG_MAX 0xFFFFFFFF
1069-#endif
1070-
1071-#ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */
1072-#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
1073-#endif
1074-
1075-#ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 RE limit. */
1076-#define _POSIX2_RE_DUP_MAX 255
1077-#endif
1078+#include <fcntl.h>
1079
1080 /*
1081 * If you can't provide lock values in the open(2) call. Note, this
1082@@ -163,41 +17,26 @@ static int __sigtemp; /* For the use of
1083 #define O_SHLOCK 0
1084 #endif
1085
1086+#include <errno.h>
1087+
1088 #ifndef EFTYPE
1089 #define EFTYPE EINVAL /* POSIX 1003.1 format errno. */
1090 #endif
1091
1092-#ifndef WCOREDUMP /* 4.4BSD extension */
1093-#define WCOREDUMP(a) 0
1094-#endif
1095-
1096-#ifndef STDERR_FILENO
1097-#define STDIN_FILENO 0 /* ANSI C #defines */
1098-#define STDOUT_FILENO 1
1099-#define STDERR_FILENO 2
1100-#endif
1101-
1102-#ifndef SEEK_END
1103-#define SEEK_SET 0 /* POSIX 1003.1 seek values */
1104-#define SEEK_CUR 1
1105-#define SEEK_END 2
1106-#endif
1107+#include <unistd.h>
1108+#include <limits.h>
1109
1110 #ifndef _POSIX_VDISABLE /* POSIX 1003.1 disabling char. */
1111 #define _POSIX_VDISABLE 0 /* Some systems used 0. */
1112 #endif
1113
1114+#include <termios.h>
1115+
1116 #ifndef TCSASOFT /* 4.4BSD extension. */
1117 #define TCSASOFT 0
1118 #endif
1119
1120-#ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 values. */
1121-#define _POSIX2_RE_DUP_MAX 255
1122-#endif
1123-
1124-#ifndef NULL /* ANSI C #defines NULL everywhere. */
1125-#define NULL 0
1126-#endif
1127+#include <sys/param.h>
1128
1129 #ifndef MAX /* Usually found in <sys/param.h>. */
1130 #define MAX(_a,_b) ((_a)<(_b)?(_b):(_a))
1131@@ -206,26 +45,5 @@ static int __sigtemp; /* For the use of
1132 #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b))
1133 #endif
1134
1135-/* Default file permissions. */
1136-#ifndef DEFFILEMODE /* 4.4BSD extension. */
1137-#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
1138-#endif
1139-
1140-#ifndef S_ISDIR /* POSIX 1003.1 file type tests. */
1141-#define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */
1142-#define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */
1143-#define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */
1144-#define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */
1145-#define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */
1146-#endif
1147-#ifndef S_ISLNK /* BSD POSIX 1003.1 extensions */
1148-#define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */
1149-#define S_ISSOCK(m) ((m & 0170000) == 0140000) /* socket */
1150-#endif
1151-
1152-/* The type of a va_list. */
1153-#ifndef _BSD_VA_LIST_ /* 4.4BSD #define. */
1154-#define _BSD_VA_LIST_ char *
1155-#endif
1156
1157-#endif /* !_COMPAT_H_ */
1158+#endif /* compat.h */
1159--- db.1.85/PORT/linux/Makefile.jj Thu Jul 14 03:43:16 1994
1160+++ db.1.85/PORT/linux/Makefile Thu Apr 20 08:54:43 2000
1161@@ -1,8 +1,16 @@
1162 # @(#)Makefile 8.9 (Berkeley) 7/14/94
1163
1164 LIBDB= libdb.a
1165+ARCH=$(shell uname -m)
1166+ifeq ($(ARCH),alpha)
1167+SOVER=2.1
1168+else
1169+SOVER=2
1170+endif
1171+LIBDBSO=libdb.so.$(SOVER)
1172+PROG= db_dump185
1173 OBJ1= hash.o hash_bigkey.o hash_buf.o hash_func.o hash_log2.o hash_page.o \
1174- hsearch.o ndbm.o
1175+ ndbm.o
1176 OBJ2= bt_close.o bt_conv.o bt_debug.o bt_delete.o bt_get.o bt_open.o \
1177 bt_overflow.o bt_page.o bt_put.o bt_search.o bt_seq.o bt_split.o \
1178 bt_utils.o
1179@@ -10,93 +18,49 @@ OBJ3= db.o
1180 OBJ4= mpool.o
1181 OBJ5= rec_close.o rec_delete.o rec_get.o rec_open.o rec_put.o rec_search.o \
1182 rec_seq.o rec_utils.o
1183+MISC=
1184+OBJS= $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) $(OBJ5) $(MISC)
1185+SHOBJS= $(patsubst %.o,%.os,$(OBJS))
1186
1187-MISC= snprintf.o
1188+all: $(LIBDB) $(LIBDBSO) $(PROG)
1189
1190-${LIBDB}: ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC}
1191+$(LIBDB): $(OBJS)
1192 rm -f $@
1193- ar cq $@ \
1194- `lorder ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} | tsort`
1195+ ar cq $@ $(OBJS)
1196 ranlib $@
1197
1198-clean:
1199- rm -f ${LIBDB} ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC}
1200+$(LIBDBSO): $(SHOBJS)
1201+ $(CC) -Wl,-O1 -Wl,--version-script=libdb.map -Wl,-soname=$(LIBDBSO) -shared -o $@ $^
1202+ ln -sf $@ libdb.so
1203
1204-OORG= -O
1205-CL= ${CC} -c -D__DBINTERFACE_PRIVATE ${OORG} -I. -Iinclude
1206+$(PROG): db_dump185.o $(LIBDBSO)
1207+ $(CC) -o $@ db_dump185.o -L. -ldb
1208
1209-hash.o: ../../hash/hash.c
1210- ${CL} -I../../hash ../../hash/hash.c
1211-hash_bigkey.o: ../../hash/hash_bigkey.c
1212- ${CL} -I../../hash ../../hash/hash_bigkey.c
1213-hash_buf.o: ../../hash/hash_buf.c
1214- ${CL} -I../../hash ../../hash/hash_buf.c
1215-hash_func.o: ../../hash/hash_func.c
1216- ${CL} -I../../hash ../../hash/hash_func.c
1217-hash_log2.o: ../../hash/hash_log2.c
1218- ${CL} -I../../hash ../../hash/hash_log2.c
1219-hash_page.o: ../../hash/hash_page.c
1220- ${CL} -I../../hash ../../hash/hash_page.c
1221-hsearch.o: ../../hash/hsearch.c
1222- ${CL} -I../../hash ../../hash/hsearch.c
1223-ndbm.o: ../../hash/ndbm.c
1224- ${CL} -I../../hash ../../hash/ndbm.c
1225-
1226-bt_close.o: ../../btree/bt_close.c
1227- ${CL} -I../../btree ../../btree/bt_close.c
1228-bt_conv.o: ../../btree/bt_conv.c
1229- ${CL} -I../../btree ../../btree/bt_conv.c
1230-bt_debug.o: ../../btree/bt_debug.c
1231- ${CL} -I../../btree ../../btree/bt_debug.c
1232-bt_delete.o: ../../btree/bt_delete.c
1233- ${CL} -I../../btree ../../btree/bt_delete.c
1234-bt_get.o: ../../btree/bt_get.c
1235- ${CL} -I../../btree ../../btree/bt_get.c
1236-bt_open.o: ../../btree/bt_open.c
1237- ${CL} -I../../btree ../../btree/bt_open.c
1238-bt_overflow.o: ../../btree/bt_overflow.c
1239- ${CL} -I../../btree ../../btree/bt_overflow.c
1240-bt_page.o: ../../btree/bt_page.c
1241- ${CL} -I../../btree ../../btree/bt_page.c
1242-bt_put.o: ../../btree/bt_put.c
1243- ${CL} -I../../btree ../../btree/bt_put.c
1244-bt_search.o: ../../btree/bt_search.c
1245- ${CL} -I../../btree ../../btree/bt_search.c
1246-bt_seq.o: ../../btree/bt_seq.c
1247- ${CL} -I../../btree ../../btree/bt_seq.c
1248-bt_split.o: ../../btree/bt_split.c
1249- ${CL} -I../../btree ../../btree/bt_split.c
1250-bt_stack.o: ../../btree/bt_stack.c
1251- ${CL} -I../../btree ../../btree/bt_stack.c
1252-bt_utils.o: ../../btree/bt_utils.c
1253- ${CL} -I../../btree ../../btree/bt_utils.c
1254+clean:
1255+ rm -f $(LIBDB) $(LIBDBSO) $(OBJS) $(SHOBJS)
1256
1257-db.o: ../../db/db.c
1258- ${CL} ../../db/db.c
1259+OORG= -O2
1260+CL= $(CC) -c -D__DBINTERFACE_PRIVATE $(OORG) -I. -Iinclude
1261
1262+db_dump185.o: db_dump185.c
1263+ $(CL) -o $@ $<
1264+%.o: ../../hash/%.c
1265+ $(CL) -I../../hash -o $@ $<
1266+%.os: ../../hash/%.c
1267+ $(CL) -I../../hash -fpic -o $@ $<
1268+%.o: ../../btree/%.c
1269+ $(CL) -I../../btree -o $@ $<
1270+%.os: ../../btree/%.c
1271+ $(CL) -I../../btree -fpic -o $@ $<
1272+db.o: ../../db/db.c
1273+ $(CL) -o $@ $<
1274+db.os: ../../db/db.c
1275+ $(CL) -fpic -o $@ $<
1276 mpool.o: ../../mpool/mpool.c
1277- ${CL} -I../../mpool ../../mpool/mpool.c
1278-
1279-rec_close.o: ../../recno/rec_close.c
1280- ${CL} -I../../recno ../../recno/rec_close.c
1281-rec_delete.o: ../../recno/rec_delete.c
1282- ${CL} -I../../recno ../../recno/rec_delete.c
1283-rec_get.o: ../../recno/rec_get.c
1284- ${CL} -I../../recno ../../recno/rec_get.c
1285-rec_open.o: ../../recno/rec_open.c
1286- ${CL} -I../../recno ../../recno/rec_open.c
1287-rec_put.o: ../../recno/rec_put.c
1288- ${CL} -I../../recno ../../recno/rec_put.c
1289-rec_search.o: ../../recno/rec_search.c
1290- ${CL} -I../../recno ../../recno/rec_search.c
1291-rec_seq.o: ../../recno/rec_seq.c
1292- ${CL} -I../../recno ../../recno/rec_seq.c
1293-rec_utils.o: ../../recno/rec_utils.c
1294- ${CL} -I../../recno ../../recno/rec_utils.c
1295-
1296-memmove.o:
1297- ${CC} -DMEMMOVE -c -O -I. -Iinclude clib/memmove.c
1298-mktemp.o:
1299- ${CC} -c -O -I. -Iinclude clib/mktemp.c
1300-snprintf.o:
1301- ${CC} -c -O -I. -Iinclude clib/snprintf.c
1302+ $(CL) -o $@ $<
1303+mpool.os: ../../mpool/mpool.c
1304+ $(CL) -fpic -o $@ $<
1305+%.o: ../../recno/%.c
1306+ $(CL) -I../../recno -o $@ $<
1307+%.os: ../../recno/%.c
1308+ $(CL) -I../../recno -fpic -o $@ $<
1309--- db.1.85/PORT/linux/libdb.map.jj Wed Apr 19 17:56:12 2000
1310+++ db.1.85/PORT/linux/libdb.map Wed Apr 19 17:56:12 2000
1311@@ -0,0 +1,11 @@
1312+GLIBC_2.0 {
1313+ global:
1314+ # the real DB entry point.
1315+ dbopen; __dbopen;
1316+
1317+ # The compatibility functions.
1318+ dbm_clearerr; dbm_close; dbm_delete; dbm_dirfno; dbm_error;
1319+ dbm_fetch; dbm_firstkey; dbm_nextkey; dbm_open; dbm_store;
1320+ local:
1321+ *;
1322+};
1323--- db.1.85/PORT/linux/db_dump185.c.jj Thu Apr 20 08:49:24 2000
1324+++ db.1.85/PORT/linux/db_dump185.c Thu Apr 20 08:50:25 2000
1325@@ -0,0 +1,350 @@
1326+/*-
1327+ * See the file LICENSE for redistribution information.
1328+ *
1329+ * Copyright (c) 1996, 1997, 1998
1330+ * Sleepycat Software. All rights reserved.
1331+ */
1332+
1333+#ifndef lint
1334+static const char copyright[] =
1335+"@(#) Copyright (c) 1996, 1997, 1998\n\
1336+ Sleepycat Software Inc. All rights reserved.\n";
1337+static const char sccsid[] = "@(#)db_dump185.c 10.10 (Sleepycat) 4/10/98";
1338+#endif
1339+
1340+#ifndef NO_SYSTEM_INCLUDES
1341+#include <sys/types.h>
1342+
1343+#include <ctype.h>
1344+#include <errno.h>
1345+#include <fcntl.h>
1346+#include <stdlib.h>
1347+#include <stdio.h>
1348+#include <string.h>
1349+#include <unistd.h>
1350+#endif
1351+
1352+#include "db.h"
1353+
1354+/* Hash Table Information */
1355+typedef struct hashhdr185 { /* Disk resident portion */
1356+ int magic; /* Magic NO for hash tables */
1357+ int version; /* Version ID */
1358+ u_int32_t lorder; /* Byte Order */
1359+ int bsize; /* Bucket/Page Size */
1360+ int bshift; /* Bucket shift */
1361+ int dsize; /* Directory Size */
1362+ int ssize; /* Segment Size */
1363+ int sshift; /* Segment shift */
1364+ int ovfl_point; /* Where overflow pages are being
1365+ * allocated */
1366+ int last_freed; /* Last overflow page freed */
1367+ int max_bucket; /* ID of Maximum bucket in use */
1368+ int high_mask; /* Mask to modulo into entire table */
1369+ int low_mask; /* Mask to modulo into lower half of
1370+ * table */
1371+ int ffactor; /* Fill factor */
1372+ int nkeys; /* Number of keys in hash table */
1373+} HASHHDR185;
1374+typedef struct htab185 { /* Memory resident data structure */
1375+ HASHHDR185 hdr; /* Header */
1376+} HTAB185;
1377+
1378+/* Hash Table Information */
1379+typedef struct hashhdr186 { /* Disk resident portion */
1380+ int32_t magic; /* Magic NO for hash tables */
1381+ int32_t version; /* Version ID */
1382+ int32_t lorder; /* Byte Order */
1383+ int32_t bsize; /* Bucket/Page Size */
1384+ int32_t bshift; /* Bucket shift */
1385+ int32_t ovfl_point; /* Where overflow pages are being allocated */
1386+ int32_t last_freed; /* Last overflow page freed */
1387+ int32_t max_bucket; /* ID of Maximum bucket in use */
1388+ int32_t high_mask; /* Mask to modulo into entire table */
1389+ int32_t low_mask; /* Mask to modulo into lower half of table */
1390+ int32_t ffactor; /* Fill factor */
1391+ int32_t nkeys; /* Number of keys in hash table */
1392+ int32_t hdrpages; /* Size of table header */
1393+ int32_t h_charkey; /* value of hash(CHARKEY) */
1394+#define NCACHED 32 /* number of bit maps and spare points */
1395+ int32_t spares[NCACHED];/* spare pages for overflow */
1396+ u_int16_t bitmaps[NCACHED]; /* address of overflow page bitmaps */
1397+} HASHHDR186;
1398+typedef struct htab186 { /* Memory resident data structure */
1399+ HASHHDR186 hdr; /* Header */
1400+} HTAB186;
1401+
1402+typedef struct _epgno {
1403+ u_int32_t pgno; /* the page number */
1404+ u_int16_t index; /* the index on the page */
1405+} EPGNO;
1406+
1407+typedef struct _epg {
1408+ void *page; /* the (pinned) page */
1409+ u_int16_t index; /* the index on the page */
1410+} EPG;
1411+
1412+typedef struct _cursor {
1413+ EPGNO pg; /* B: Saved tree reference. */
1414+ DBT key; /* B: Saved key, or key.data == NULL. */
1415+ u_int32_t rcursor; /* R: recno cursor (1-based) */
1416+
1417+#define CURS_ACQUIRE 0x01 /* B: Cursor needs to be reacquired. */
1418+#define CURS_AFTER 0x02 /* B: Unreturned cursor after key. */
1419+#define CURS_BEFORE 0x04 /* B: Unreturned cursor before key. */
1420+#define CURS_INIT 0x08 /* RB: Cursor initialized. */
1421+ u_int8_t flags;
1422+} CURSOR;
1423+
1424+/* The in-memory btree/recno data structure. */
1425+typedef struct _btree {
1426+ void *bt_mp; /* memory pool cookie */
1427+
1428+ void *bt_dbp; /* pointer to enclosing DB */
1429+
1430+ EPG bt_cur; /* current (pinned) page */
1431+ void *bt_pinned; /* page pinned across calls */
1432+
1433+ CURSOR bt_cursor; /* cursor */
1434+
1435+ EPGNO bt_stack[50]; /* stack of parent pages */
1436+ EPGNO *bt_sp; /* current stack pointer */
1437+
1438+ DBT bt_rkey; /* returned key */
1439+ DBT bt_rdata; /* returned data */
1440+
1441+ int bt_fd; /* tree file descriptor */
1442+
1443+ u_int32_t bt_free; /* next free page */
1444+ u_int32_t bt_psize; /* page size */
1445+ u_int16_t bt_ovflsize; /* cut-off for key/data overflow */
1446+ int bt_lorder; /* byte order */
1447+ /* sorted order */
1448+ enum { NOT, BACK, FORWARD } bt_order;
1449+ EPGNO bt_last; /* last insert */
1450+
1451+ /* B: key comparison function */
1452+ int (*bt_cmp) __P((const DBT *, const DBT *));
1453+ /* B: prefix comparison function */
1454+ size_t (*bt_pfx) __P((const DBT *, const DBT *));
1455+ /* R: recno input function */
1456+ int (*bt_irec) __P((struct _btree *, u_int32_t));
1457+
1458+ FILE *bt_rfp; /* R: record FILE pointer */
1459+ int bt_rfd; /* R: record file descriptor */
1460+
1461+ void *bt_cmap; /* R: current point in mapped space */
1462+ void *bt_smap; /* R: start of mapped space */
1463+ void *bt_emap; /* R: end of mapped space */
1464+ size_t bt_msize; /* R: size of mapped region. */
1465+
1466+ u_int32_t bt_nrecs; /* R: number of records */
1467+ size_t bt_reclen; /* R: fixed record length */
1468+ u_char bt_bval; /* R: delimiting byte/pad character */
1469+
1470+/*
1471+ * NB:
1472+ * B_NODUPS and R_RECNO are stored on disk, and may not be changed.
1473+ */
1474+#define B_INMEM 0x00001 /* in-memory tree */
1475+#define B_METADIRTY 0x00002 /* need to write metadata */
1476+#define B_MODIFIED 0x00004 /* tree modified */
1477+#define B_NEEDSWAP 0x00008 /* if byte order requires swapping */
1478+#define B_RDONLY 0x00010 /* read-only tree */
1479+
1480+#define B_NODUPS 0x00020 /* no duplicate keys permitted */
1481+#define R_RECNO 0x00080 /* record oriented tree */
1482+
1483+#define R_CLOSEFP 0x00040 /* opened a file pointer */
1484+#define R_EOF 0x00100 /* end of input file reached. */
1485+#define R_FIXLEN 0x00200 /* fixed length records */
1486+#define R_MEMMAPPED 0x00400 /* memory mapped file. */
1487+#define R_INMEM 0x00800 /* in-memory file */
1488+#define R_MODIFIED 0x01000 /* modified file */
1489+#define R_RDONLY 0x02000 /* read-only file */
1490+
1491+#define B_DB_LOCK 0x04000 /* DB_LOCK specified. */
1492+#define B_DB_SHMEM 0x08000 /* DB_SHMEM specified. */
1493+#define B_DB_TXN 0x10000 /* DB_TXN specified. */
1494+ u_int32_t flags;
1495+} BTREE;
1496+
1497+void db_btree __P((DB *, int));
1498+void db_hash __P((DB *, int));
1499+void dbt_dump __P((DBT *));
1500+void dbt_print __P((DBT *));
1501+int main __P((int, char *[]));
1502+void usage __P((void));
1503+
1504+const char
1505+ *progname = "db_dump185"; /* Program name. */
1506+
1507+int
1508+main(argc, argv)
1509+ int argc;
1510+ char *argv[];
1511+{
1512+ extern char *optarg;
1513+ extern int optind;
1514+ DB *dbp;
1515+ DBT key, data;
1516+ int ch, pflag, rval;
1517+
1518+ pflag = 0;
1519+ while ((ch = getopt(argc, argv, "f:p")) != EOF)
1520+ switch (ch) {
1521+ case 'f':
1522+ if (freopen(optarg, "w", stdout) == NULL)
1523+ err(1, "%s", optarg);
1524+ break;
1525+ case 'p':
1526+ pflag = 1;
1527+ break;
1528+ case '?':
1529+ default:
1530+ usage();
1531+ }
1532+ argc -= optind;
1533+ argv += optind;
1534+
1535+ if (argc != 1)
1536+ usage();
1537+
1538+ if ((dbp = dbopen(argv[0], O_RDONLY, 0, DB_BTREE, NULL)) == NULL) {
1539+ if ((dbp = dbopen(argv[0], O_RDONLY, 0, DB_HASH, NULL)) == NULL)
1540+ err(1, "%s", argv[0]);
1541+ db_hash(dbp, pflag);
1542+ } else
1543+ db_btree(dbp, pflag);
1544+
1545+ /*
1546+ * !!!
1547+ * DB 1.85 DBTs are a subset of DB 2.0 DBTs, so we just use the
1548+ * new dump/print routines.
1549+ */
1550+ if (pflag)
1551+ while (!(rval = dbp->seq(dbp, &key, &data, R_NEXT))) {
1552+ dbt_print(&key);
1553+ dbt_print(&data);
1554+ }
1555+ else
1556+ while (!(rval = dbp->seq(dbp, &key, &data, R_NEXT))) {
1557+ dbt_dump(&key);
1558+ dbt_dump(&data);
1559+ }
1560+
1561+ if (rval == -1)
1562+ err(1, "seq");
1563+ return (0);
1564+}
1565+
1566+/*
1567+ * db_hash --
1568+ * Dump out hash header information.
1569+ */
1570+void
1571+db_hash(dbp, pflag)
1572+ DB *dbp;
1573+ int pflag;
1574+{
1575+ HTAB185 *hash185p;
1576+ HTAB186 *hash186p;
1577+
1578+ printf("format=%s\n", pflag ? "print" : "bytevalue");
1579+ printf("type=hash\n");
1580+
1581+ /* DB 1.85 was version 2, DB 1.86 was version 3. */
1582+ hash185p = dbp->internal;
1583+ if (hash185p->hdr.version > 2) {
1584+ hash186p = dbp->internal;
1585+ printf("h_ffactor=%lu\n", (u_long)hash186p->hdr.ffactor);
1586+ if (hash186p->hdr.lorder != 0)
1587+ printf("db_lorder=%lu\n", (u_long)hash186p->hdr.lorder);
1588+ printf("db_pagesize=%lu\n", (u_long)hash186p->hdr.bsize);
1589+ } else {
1590+ printf("h_ffactor=%lu\n", (u_long)hash185p->hdr.ffactor);
1591+ if (hash185p->hdr.lorder != 0)
1592+ printf("db_lorder=%lu\n", (u_long)hash185p->hdr.lorder);
1593+ printf("db_pagesize=%lu\n", (u_long)hash185p->hdr.bsize);
1594+ }
1595+ printf("HEADER=END\n");
1596+}
1597+
1598+/*
1599+ * db_btree --
1600+ * Dump out btree header information.
1601+ */
1602+void
1603+db_btree(dbp, pflag)
1604+ DB *dbp;
1605+ int pflag;
1606+{
1607+ BTREE *btp;
1608+
1609+ btp = dbp->internal;
1610+
1611+ printf("format=%s\n", pflag ? "print" : "bytevalue");
1612+ printf("type=btree\n");
1613+#ifdef NOT_AVAILABLE_IN_185
1614+ printf("bt_minkey=%lu\n", (u_long)XXX);
1615+ printf("bt_maxkey=%lu\n", (u_long)XXX);
1616+#endif
1617+ if (btp->bt_lorder != 0)
1618+ printf("db_lorder=%lu\n", (u_long)btp->bt_lorder);
1619+ printf("db_pagesize=%lu\n", (u_long)btp->bt_psize);
1620+ if (!(btp->flags & B_NODUPS))
1621+ printf("duplicates=1\n");
1622+ printf("HEADER=END\n");
1623+}
1624+
1625+static char hex[] = "0123456789abcdef";
1626+
1627+/*
1628+ * dbt_dump --
1629+ * Write out a key or data item using byte values.
1630+ */
1631+void
1632+dbt_dump(dbtp)
1633+ DBT *dbtp;
1634+{
1635+ size_t len;
1636+ u_int8_t *p;
1637+
1638+ for (len = dbtp->size, p = dbtp->data; len--; ++p)
1639+ (void)printf("%c%c",
1640+ hex[(*p & 0xf0) >> 4], hex[*p & 0x0f]);
1641+ printf("\n");
1642+}
1643+
1644+/*
1645+ * dbt_print --
1646+ * Write out a key or data item using printable characters.
1647+ */
1648+void
1649+dbt_print(dbtp)
1650+ DBT *dbtp;
1651+{
1652+ size_t len;
1653+ u_int8_t *p;
1654+
1655+ for (len = dbtp->size, p = dbtp->data; len--; ++p)
1656+ if (isprint(*p)) {
1657+ if (*p == '\\')
1658+ (void)printf("\\");
1659+ (void)printf("%c", *p);
1660+ } else
1661+ (void)printf("\\%c%c",
1662+ hex[(*p & 0xf0) >> 4], hex[*p & 0x0f]);
1663+ printf("\n");
1664+}
1665+
1666+/*
1667+ * usage --
1668+ * Display the usage message.
1669+ */
1670+void
1671+usage()
1672+{
1673+ (void)fprintf(stderr, "usage: db_dump185 [-p] [-f file] db_file\n");
1674+ exit(1);
1675+}
1676--- db.1.85/include/mpool.h.jj Thu Jul 14 03:33:26 1994
1677+++ db.1.85/include/mpool.h Wed Apr 19 17:56:12 2000
1678@@ -33,6 +33,9 @@
1679 * @(#)mpool.h 8.2 (Berkeley) 7/14/94
1680 */
1681
1682+#ifndef _MPOOL_H
1683+#define _MPOOL_H 1
1684+
1685 #include <sys/queue.h>
1686
1687 /*
1688@@ -67,9 +70,9 @@ typedef struct MPOOL {
1689 u_long pagesize; /* file page size */
1690 int fd; /* file descriptor */
1691 /* page in conversion routine */
1692- void (*pgin) __P((void *, pgno_t, void *));
1693+ void (*pgin) __PMT((void *, pgno_t, void *));
1694 /* page out conversion routine */
1695- void (*pgout) __P((void *, pgno_t, void *));
1696+ void (*pgout) __PMT((void *, pgno_t, void *));
1697 void *pgcookie; /* cookie for page in/out routines */
1698 #ifdef STATISTICS
1699 u_long cachehit;
1700@@ -85,15 +88,25 @@ typedef struct MPOOL {
1701 } MPOOL;
1702
1703 __BEGIN_DECLS
1704+MPOOL *__mpool_open __P((void *, int, pgno_t, pgno_t));
1705 MPOOL *mpool_open __P((void *, int, pgno_t, pgno_t));
1706+void __mpool_filter __P((MPOOL *, void (*)(void *, pgno_t, void *),
1707+ void (*)(void *, pgno_t, void *), void *));
1708 void mpool_filter __P((MPOOL *, void (*)(void *, pgno_t, void *),
1709 void (*)(void *, pgno_t, void *), void *));
1710+void *__mpool_new __P((MPOOL *, pgno_t *));
1711 void *mpool_new __P((MPOOL *, pgno_t *));
1712+void *__mpool_get __P((MPOOL *, pgno_t, u_int));
1713 void *mpool_get __P((MPOOL *, pgno_t, u_int));
1714+int __mpool_put __P((MPOOL *, void *, u_int));
1715 int mpool_put __P((MPOOL *, void *, u_int));
1716+int __mpool_sync __P((MPOOL *));
1717 int mpool_sync __P((MPOOL *));
1718+int __mpool_close __P((MPOOL *));
1719 int mpool_close __P((MPOOL *));
1720 #ifdef STATISTICS
1721 void mpool_stat __P((MPOOL *));
1722 #endif
1723 __END_DECLS
1724+
1725+#endif /* mpool.h */
1726--- db.1.85/include/db.h.jj Tue Jun 21 21:59:28 1994
1727+++ db.1.85/include/db.h Wed Apr 19 17:56:12 2000
1728@@ -33,8 +33,8 @@
1729 * @(#)db.h 8.7 (Berkeley) 6/16/94
1730 */
1731
1732-#ifndef _DB_H_
1733-#define _DB_H_
1734+#ifndef _DB_H
1735+#define _DB_H 1
1736
1737 #include <sys/types.h>
1738 #include <sys/cdefs.h>
1739@@ -117,14 +117,14 @@ typedef enum { DB_BTREE, DB_HASH, DB_REC
1740 /* Access method description structure. */
1741 typedef struct __db {
1742 DBTYPE type; /* Underlying db type. */
1743- int (*close) __P((struct __db *));
1744- int (*del) __P((const struct __db *, const DBT *, u_int));
1745- int (*get) __P((const struct __db *, const DBT *, DBT *, u_int));
1746- int (*put) __P((const struct __db *, DBT *, const DBT *, u_int));
1747- int (*seq) __P((const struct __db *, DBT *, DBT *, u_int));
1748- int (*sync) __P((const struct __db *, u_int));
1749+ int (*close) __PMT((struct __db *));
1750+ int (*del) __PMT((const struct __db *, const DBT *, u_int));
1751+ int (*get) __PMT((const struct __db *, const DBT *, DBT *, u_int));
1752+ int (*put) __PMT((const struct __db *, DBT *, const DBT *, u_int));
1753+ int (*seq) __PMT((const struct __db *, DBT *, DBT *, u_int));
1754+ int (*sync) __PMT((const struct __db *, u_int));
1755 void *internal; /* Access method private. */
1756- int (*fd) __P((const struct __db *));
1757+ int (*fd) __PMT((const struct __db *));
1758 } DB;
1759
1760 #define BTREEMAGIC 0x053162
1761@@ -139,9 +139,9 @@ typedef struct {
1762 int minkeypage; /* minimum keys per page */
1763 u_int psize; /* page size */
1764 int (*compare) /* comparison function */
1765- __P((const DBT *, const DBT *));
1766+ __PMT((const DBT *, const DBT *));
1767 size_t (*prefix) /* prefix function */
1768- __P((const DBT *, const DBT *));
1769+ __PMT((const DBT *, const DBT *));
1770 int lorder; /* byte order */
1771 } BTREEINFO;
1772
1773@@ -155,7 +155,7 @@ typedef struct {
1774 u_int nelem; /* number of elements */
1775 u_int cachesize; /* bytes to cache */
1776 u_int32_t /* hash function */
1777- (*hash) __P((const void *, size_t));
1778+ (*hash) __PMT((const void *, size_t));
1779 int lorder; /* byte order */
1780 } HASHINFO;
1781
1782@@ -224,6 +224,7 @@ typedef struct {
1783 #endif
1784
1785 __BEGIN_DECLS
1786+DB *__dbopen __P((const char *, int, int, DBTYPE, const void *));
1787 DB *dbopen __P((const char *, int, int, DBTYPE, const void *));
1788
1789 #ifdef __DBINTERFACE_PRIVATE
1790@@ -233,4 +234,5 @@ DB *__rec_open __P((const char *, int, i
1791 void __dbpanic __P((DB *dbp));
1792 #endif
1793 __END_DECLS
1794-#endif /* !_DB_H_ */
1795+
1796+#endif /* db.h */
This page took 0.272727 seconds and 4 git commands to generate.