146177Sbostic /*-
2*61217Sbostic * Copyright (c) 1991, 1993
3*61217Sbostic * The Regents of the University of California. All rights reserved.
446177Sbostic *
546177Sbostic * This code is derived from software contributed to Berkeley by
646177Sbostic * Margo Seltzer.
746177Sbostic *
850986Sbostic * %sccs.include.redist.c%
946177Sbostic */
1046177Sbostic
1146177Sbostic #ifndef lint
12*61217Sbostic static char copyright[] =
13*61217Sbostic "@(#) Copyright (c) 1991, 1993\n\
14*61217Sbostic The Regents of the University of California. All rights reserved.\n";
1546177Sbostic #endif /* not lint */
1646177Sbostic
1746177Sbostic #ifndef lint
18*61217Sbostic static char sccsid[] = "@(#)tseq.c 8.1 (Berkeley) 06/04/93";
1946177Sbostic #endif /* not lint */
2046177Sbostic
2146177Sbostic #include <sys/types.h>
2250986Sbostic #include <sys/file.h>
2346177Sbostic #include <stdio.h>
2446177Sbostic #include <db.h>
2546177Sbostic
2646177Sbostic #define INITIAL 25000
2746177Sbostic #define MAXWORDS 25000 /* # of elements in search table */
2846177Sbostic
2946177Sbostic
3046177Sbostic char wp[8192];
3146177Sbostic char cp[8192];
main(argc,argv)3246177Sbostic main(argc, argv)
3346177Sbostic char **argv;
3446177Sbostic {
3546177Sbostic DBT item, key, res;
3646177Sbostic DB *dbp;
3746177Sbostic FILE *fp;
3846177Sbostic int stat;
3946177Sbostic
4051080Sbostic if (!(dbp = dbopen( "hashtest", O_RDONLY, 0400, DB_HASH, NULL))) {
4146177Sbostic /* create table */
4246177Sbostic fprintf(stderr, "cannot open: hash table\n" );
4346177Sbostic exit(1);
4446177Sbostic }
4546177Sbostic
4646177Sbostic /*
4746177Sbostic * put info in structure, and structure in the item
4846177Sbostic */
4946177Sbostic for ( stat = (dbp->seq) (dbp, &res, &item, 1 );
5046177Sbostic stat == 0;
5146177Sbostic stat = (dbp->seq) (dbp, &res, &item, 0 ) ) {
5246177Sbostic
5346177Sbostic bcopy ( res.data, wp, res.size );
5446177Sbostic wp[res.size] = 0;
5546177Sbostic bcopy ( item.data, cp, item.size );
5646177Sbostic cp[item.size] = 0;
5746177Sbostic
5846177Sbostic printf ( "%s %s\n", wp, cp );
5946177Sbostic }
6046177Sbostic (dbp->close)(dbp);
6146177Sbostic exit(0);
6246177Sbostic }
63