2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afs/param.h>
11 #include <afsconfig.h>
16 #include <sys/types.h>
25 #include <afs/afsutil.h>
32 register struct cmd_syndesc *as,
38 register afs_int32 code = 0, cnt = 0;
39 register struct cmd_item *ti;
41 if (as->parms[0].items) {
42 dbmfile = as->parms[0].items->data;
44 kdb = dbm_open(dbmfile, O_RDONLY, KALOG_DB_MODE);
49 if (!(ti = as->parms[1].items)) {
50 printf("Printing all entries found in %s\n", dbmfile);
51 for (key = dbm_firstkey(kdb); key.dptr;
52 key = afs_dbm_nextkey(kdb, key), cnt++) {
53 printf("\t%s\n", key.dptr);
55 printf("%d entries were found\n", cnt);
57 for (; ti; ti = ti->next) {
58 key.dsize = strlen(ti->data) + 1;
60 data = dbm_fetch(kdb, key);
62 fprintf(stderr, "%s: no entry exists\n", ti->data);
65 if (data.dsize != sizeof(kalog_elt)) {
66 fprintf(stderr, "%s: data came out corrupt\n", ti->data);
69 bcopy(data.dptr, &rdata, sizeof(kalog_elt));
70 printf("%s: last operation from host %x at %s", ti->data, rdata.host,
71 ctime(&rdata.last_use));
78 #include "AFS_component_version_number.c"
84 register struct cmd_syndesc *ts;
85 register afs_int32 code;
86 char dbmfile_help[AFSDIR_PATH_MAX];
88 sprintf(dbmfile_help, "dbmfile to use (default %s)", AFSDIR_SERVER_KALOGDB_FILEPATH);
89 dbmfile = AFSDIR_SERVER_KALOGDB_FILEPATH;
90 ts = cmd_CreateSyntax((char *) 0, cmdproc, 0, "Dump contents of dbm database");
91 cmd_AddParm(ts, "-dbmfile", CMD_SINGLE, CMD_OPTIONAL, dbmfile_help);
92 cmd_AddParm(ts, "-key", CMD_SINGLE, CMD_OPTIONAL, "extract entries that match specified key");
93 code = cmd_Dispatch(argc, argv);
98 #include "AFS_component_version_number.c"
102 printf("kdb not supported\n");