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 <afsconfig.h>
11 #include <afs/param.h>
20 pr_TimeToString(time_t clock)
23 static char buffer[32];
24 static int this_year = 0;
27 return "time-not-set ";
31 this_year = tm->tm_year;
33 tm = localtime(&clock);
34 if (tm->tm_year != this_year)
35 strftime(buffer, 32, "%m/%d/%Y %H:%M:%S", tm);
37 strftime(buffer, 32, "%m/%d %H:%M:%S", tm);
41 #define host(a) (hostOrder ? (a) : ntohl(a))
44 PrintEntries(FILE *f, int hostOrder, int indent, struct prentry *e, int n)
50 for (i = 0; i < n; i++) {
51 if (e->entries[i] == 0)
55 fprintf(f, "%*sids ", indent, "");
56 else if (newline == 0)
57 fprintf(f, "%*s", indent + 4, "");
59 if (host(e->entries[i]) == PRBADID)
62 fprintf(f, "%6d", host(e->entries[i]));
75 pr_PrintEntry(FILE *f, int hostOrder, afs_int32 ea, struct prentry *e, int indent)
80 fprintf(f, "cellid == %d\n", host(e->cellid));
81 for (i = 0; i < sizeof(e->reserved) / sizeof(e->reserved[0]); i++)
83 fprintf(f, "reserved field [%d] not zero: %d\n", i,
84 host(e->reserved[i]));
86 fprintf(f, "%*s", indent, "");
87 fprintf(f, "Entry at %d: flags 0x%x, id %di, next %d.\n", ea,
88 host(e->flags), host(e->id), host(e->next));
89 fprintf(f, "%*s", indent, "");
90 fprintf(f, "c:%s ", pr_TimeToString(host(e->createTime)));
91 fprintf(f, "a:%s ", pr_TimeToString(host(e->addTime)));
92 fprintf(f, "r:%s ", pr_TimeToString(host(e->removeTime)));
93 fprintf(f, "n:%s\n", pr_TimeToString(host(e->changeTime)));
94 if (host(e->flags) & PRCONT)
95 PrintEntries(f, hostOrder, indent, e, COSIZE);
96 else { /* regular entry */
97 PrintEntries(f, hostOrder, indent, e, PRSIZE);
98 fprintf(f, "%*s", indent, "");
99 fprintf(f, "hash (id %d name %d). Owner %di, creator %di\n",
100 host(e->nextID), host(e->nextName), host(e->owner),
102 fprintf(f, "%*s", indent, "");
103 #if defined(SUPERGROUPS)
104 fprintf(f, "quota groups %d, foreign users %d. Mem: %d, cntsg: %d\n",
105 host(e->ngroups), host(e->nusers), host(e->count),
108 fprintf(f, "quota groups %d, foreign users %d. Mem: %d, inst: %d\n",
109 host(e->ngroups), host(e->nusers), host(e->count),
112 fprintf(f, "%*s", indent, "");
113 #if defined(SUPERGROUPS)
114 fprintf(f, "Owned chain %d, next owned %d, nextsg %d, sg (%d %d).\n",
115 host(e->owned), host(e->nextOwned), host(e->parent),
116 host(e->sibling), host(e->child));
118 fprintf(f, "Owned chain %d, next owned %d, inst ptrs(%d %d %d).\n",
119 host(e->owned), host(e->nextOwned), host(e->parent),
120 host(e->sibling), host(e->child));
122 fprintf(f, "%*s", indent, "");
123 if (strlen(e->name) >= PR_MAXNAMELEN)
124 fprintf(f, "NAME TOO LONG: ");
125 fprintf(f, "Name is '%.*s'\n", PR_MAXNAMELEN, e->name);