146177Sbostic /*- 2*50986Sbostic * Copyright (c) 1991 The Regents of the University of California. 346177Sbostic * All rights reserved. 446177Sbostic * 546177Sbostic * This code is derived from software contributed to Berkeley by 646177Sbostic * Margo Seltzer. 746177Sbostic * 8*50986Sbostic * %sccs.include.redist.c% 946177Sbostic */ 1046177Sbostic 1146177Sbostic #ifndef lint 1246177Sbostic char copyright[] = 13*50986Sbostic "@(#) Copyright (c) 1991 The Regents of the University of California.\n\ 1446177Sbostic All rights reserved.\n"; 1546177Sbostic #endif /* not lint */ 1646177Sbostic 1746177Sbostic #ifndef lint 18*50986Sbostic static char sccsid[] = "@(#)tseq.c 5.3 (Berkeley) 09/04/91"; 1946177Sbostic #endif /* not lint */ 2046177Sbostic 2146177Sbostic #include <sys/types.h> 22*50986Sbostic #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]; 3246177Sbostic main(argc, argv) 3346177Sbostic char **argv; 3446177Sbostic { 3546177Sbostic DBT item, key, res; 3646177Sbostic DB *dbp; 3746177Sbostic FILE *fp; 3846177Sbostic int stat; 3946177Sbostic 4046177Sbostic if (!(dbp = hash_open( "hashtest", O_RDONLY, 0400, 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