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>
17 #include <sys/types.h>
21 #include <netinet/in.h>
34 #ifdef PR_REMEMBER_TIMES
40 pr_TimeToString(time_t clock)
43 static char buffer[32];
44 static int this_year = 0;
47 return "time-not-set ";
51 this_year = tm->tm_year;
53 tm = localtime(&clock);
54 if (tm->tm_year != this_year)
55 strftime(buffer, 32, "%m/%d/%Y %T", tm);
57 strftime(buffer, 32, "%m/%d %T", tm);
62 #define host(a) (hostOrder ? (a) : ntohl(a))
65 PrintEntries(f, hostOrder, indent, e, n)
67 int hostOrder; /* structures in host order */
76 for (i = 0; i < n; i++) {
77 if (e->entries[i] == 0)
81 fprintf(f, "%*sids ", indent, "");
82 else if (newline == 0)
83 fprintf(f, "%*s", indent + 4, "");
85 if (host(e->entries[i]) == PRBADID)
88 fprintf(f, "%6d", host(e->entries[i]));
101 pr_PrintEntry(f, hostOrder, ea, e, indent)
103 int hostOrder; /* structures in host order */
111 fprintf(f, "cellid == %d\n", host(e->cellid));
112 for (i = 0; i < sizeof(e->reserved) / sizeof(e->reserved[0]); i++)
114 fprintf(f, "reserved field [%d] not zero: %d\n", i,
115 host(e->reserved[i]));
117 fprintf(f, "%*s", indent, "");
118 fprintf(f, "Entry at %d: flags 0x%x, id %di, next %d.\n", ea,
119 host(e->flags), host(e->id), host(e->next));
120 #ifdef PR_REMEMBER_TIMES
121 fprintf(f, "%*s", indent, "");
122 fprintf(f, "c:%s ", pr_TimeToString(host(e->createTime)));
123 fprintf(f, "a:%s ", pr_TimeToString(host(e->addTime)));
124 fprintf(f, "r:%s ", pr_TimeToString(host(e->removeTime)));
125 fprintf(f, "n:%s\n", pr_TimeToString(host(e->changeTime)));
127 if (host(e->flags) & PRCONT)
128 PrintEntries(f, hostOrder, indent, e, COSIZE);
129 else { /* regular entry */
130 PrintEntries(f, hostOrder, indent, e, PRSIZE);
131 fprintf(f, "%*s", indent, "");
132 fprintf(f, "hash (id %d name %d). Owner %di, creator %di\n",
133 host(e->nextID), host(e->nextName), host(e->owner),
135 fprintf(f, "%*s", indent, "");
136 #if defined(SUPERGROUPS)
137 fprintf(f, "quota groups %d, foreign users %d. Mem: %d, cntsg: %d\n",
138 host(e->ngroups), host(e->nusers), host(e->count),
141 fprintf(f, "quota groups %d, foreign users %d. Mem: %d, inst: %d\n",
142 host(e->ngroups), host(e->nusers), host(e->count),
145 fprintf(f, "%*s", indent, "");
146 #if defined(SUPERGROUPS)
147 fprintf(f, "Owned chain %d, next owned %d, nextsg %d, sg (%d %d).\n",
148 host(e->owned), host(e->nextOwned), host(e->parent),
149 host(e->sibling), host(e->child));
151 fprintf(f, "Owned chain %d, next owned %d, inst ptrs(%d %d %d).\n",
152 host(e->owned), host(e->nextOwned), host(e->parent),
153 host(e->sibling), host(e->child));
155 fprintf(f, "%*s", indent, "");
156 if (strlen(e->name) >= PR_MAXNAMELEN)
157 fprintf(f, "NAME TOO LONG: ");
158 fprintf(f, "Name is '%.*s'\n", PR_MAXNAMELEN, e->name);