mirror of
https://git.openafs.org/openafs.git
synced 2025-01-20 07:51:00 +00:00
kdb-enhancement-20040820
FIXES 6355 - It resolves all IP addresses to names unless the "-numeric" parameter is used. This is the same behavior as "fs listcells [-numeric]" - If the "-numeric" parameter is used, IP address will be printed in dotted decimal form instead of a 8 digit hex string. - A new parameter "-long" allows to print all information for all entries in the log. This is the same info you get for entry XYZ when called with "-key XYZ" only you get this for _all_ keys. The output is slow if not also called together with "-numeric
This commit is contained in:
parent
59cc46ef7e
commit
e82bc52231
@ -50,7 +50,31 @@ cmdproc(register struct cmd_syndesc *as, afs_int32 arock)
|
||||
printf("Printing all entries found in %s\n", dbmfile);
|
||||
for (key = dbm_firstkey(kdb); key.dptr;
|
||||
key = afs_dbm_nextkey(kdb, key), cnt++) {
|
||||
printf("\t%s\n", key.dptr);
|
||||
if (as->parms[2].items) {
|
||||
data = dbm_fetch(kdb, key);
|
||||
if (!data.dptr) {
|
||||
fprintf(stderr, "%s: no entry exists\n", ti->data);
|
||||
continue;
|
||||
}
|
||||
if (data.dsize != sizeof(kalog_elt)) {
|
||||
fprintf(stderr, "%s: data came out corrupt\n", ti->data);
|
||||
continue;
|
||||
}
|
||||
memcpy(&rdata, data.dptr, sizeof(kalog_elt));
|
||||
if (! as->parms[3].items) {
|
||||
char *hostName;
|
||||
hostName = hostutil_GetNameByINet(rdata.host);
|
||||
printf("%s: last operation from host %s at %s", key.dptr,
|
||||
hostName, ctime(&rdata.last_use));
|
||||
} else {
|
||||
char *hostIP;
|
||||
hostIP = afs_inet_ntoa(rdata.host);
|
||||
printf("%s: last operation from host %s at %s", key.dptr,
|
||||
hostIP, ctime(&rdata.last_use));
|
||||
}
|
||||
} else {
|
||||
printf("\t%s\n", key.dptr);
|
||||
}
|
||||
}
|
||||
printf("%d entries were found\n", cnt);
|
||||
} else {
|
||||
@ -91,6 +115,8 @@ main(int argc, char **argv)
|
||||
cmd_AddParm(ts, "-dbmfile", CMD_SINGLE, CMD_OPTIONAL, dbmfile_help);
|
||||
cmd_AddParm(ts, "-key", CMD_SINGLE, CMD_OPTIONAL,
|
||||
"extract entries that match specified key");
|
||||
cmd_AddParm(ts, "-long", CMD_FLAG, CMD_OPTIONAL, "print long info for each entry");
|
||||
cmd_AddParm(ts, "-numeric", CMD_FLAG, CMD_OPTIONAL, "addresses only");
|
||||
code = cmd_Dispatch(argc, argv);
|
||||
return code;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user