1255722Semaste/*- 2255722Semaste * Copyright (c) 1991, 1993 3255722Semaste * The Regents of the University of California. All rights reserved. 4255722Semaste * 5255722Semaste * This code is derived from software contributed to Berkeley by 6255722Semaste * Margo Seltzer. 7255722Semaste * 8255722Semaste * Redistribution and use in source and binary forms, with or without 9255722Semaste * modification, are permitted provided that the following conditions 10255722Semaste * are met: 11255722Semaste * 1. Redistributions of source code must retain the above copyright 12255722Semaste * notice, this list of conditions and the following disclaimer. 13255722Semaste * 2. Redistributions in binary form must reproduce the above copyright 14269024Semaste * notice, this list of conditions and the following disclaimer in the 15255722Semaste * documentation and/or other materials provided with the distribution. 16255722Semaste * 4. Neither the name of the University nor the names of its contributors 17255722Semaste * may be used to endorse or promote products derived from this software 18255722Semaste * without specific prior written permission. 19255722Semaste * 20269024Semaste * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21255722Semaste * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22255722Semaste * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23255722Semaste * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24255722Semaste * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25255722Semaste * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26255722Semaste * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27255722Semaste * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28255722Semaste * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29255722Semaste * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30255722Semaste * SUCH DAMAGE. 31255722Semaste */ 32255722Semaste 33255722Semaste#ifndef lint 34255722Semastestatic char copyright[] = 35255722Semaste"@(#) Copyright (c) 1991, 1993\n\ 36255722Semaste The Regents of the University of California. All rights reserved.\n"; 37255722Semaste#endif /* not lint */ 38255722Semaste 39255722Semaste#if defined(LIBC_SCCS) && !defined(lint) 40255722Semastestatic char sccsid[] = "@(#)tseq.c 8.1 (Berkeley) 6/4/93"; 41255722Semaste#endif /* LIBC_SCCS and not lint */ 42255722Semaste#include <sys/cdefs.h> 43255722Semaste__FBSDID("$FreeBSD$"); 44255722Semaste 45255722Semaste#include <sys/types.h> 46255722Semaste#include <sys/file.h> 47255722Semaste#include <stdio.h> 48255722Semaste#include <db.h> 49255722Semaste 50255722Semaste#define INITIAL 25000 51255722Semaste#define MAXWORDS 25000 /* # of elements in search table */ 52255722Semaste 53255722Semaste 54255722Semastechar wp[8192]; 55255722Semastechar cp[8192]; 56269024Semastemain(argc, argv) 57255722Semastechar **argv; 58255722Semaste{ 59255722Semaste DBT item, key, res; 60255722Semaste DB *dbp; 61255722Semaste FILE *fp; 62255722Semaste int stat; 63255722Semaste 64255722Semaste if (!(dbp = dbopen( "hashtest", O_RDONLY, 0400, DB_HASH, NULL))) { 65255722Semaste /* create table */ 66255722Semaste fprintf(stderr, "cannot open: hash table\n" ); 67255722Semaste exit(1); 68255722Semaste } 69255722Semaste 70255722Semaste/* 71255722Semaste* put info in structure, and structure in the item 72255722Semaste*/ 73255722Semaste for ( stat = (dbp->seq) (dbp, &res, &item, 1 ); 74255722Semaste stat == 0; 75255722Semaste stat = (dbp->seq) (dbp, &res, &item, 0 ) ) { 76255722Semaste 77255722Semaste bcopy ( res.data, wp, res.size ); 78255722Semaste wp[res.size] = 0; 79255722Semaste bcopy ( item.data, cp, item.size ); 80255722Semaste cp[item.size] = 0; 81263508Sdim 82255722Semaste printf ( "%s %s\n", wp, cp ); 83255722Semaste } 84255722Semaste (dbp->close)(dbp); 85255722Semaste exit(0); 86255722Semaste} 87255722Semaste