/* -*-c-*-
*
- * $Id: name.c,v 1.3 1997/08/07 09:49:39 mdw Exp $
+ * $Id: name.c,v 1.4 1997/08/20 16:17:59 mdw Exp $
*
* Looking up of names in symbol tables
*
/*----- Revision history --------------------------------------------------*
*
* $Log: name.c,v $
+ * Revision 1.4 1997/08/20 16:17:59 mdw
+ * Replace `name_reinit' by `name_end' for more sensible restart.
+ *
* Revision 1.3 1997/08/07 09:49:39 mdw
* Extensive modifications to handle netgroups. Also sanitise user and group
* names before adding them to the symbol table.
name *n;
int u = pw->pw_uid;
- /* --- Make the name into something nice --- */
-
/* --- First, add the user to the table --- */
if (name__sanitise(pw->pw_name, buf, sizeof(buf)) &&
}
}
-/* --- @name_reinit@ --- *
+/* --- @name_end@ --- *
*
* Arguments: ---
*
* Returns: ---
*
- * Use: Reinitialises the names table. It's cleared and then
- * initialised with the current user and group ids as for
- * @name_init@ above.
+ * Use: Closes down the name database, so that it can be
+ * reinitialised.
*/
-void name_reinit(void)
+void name_end(void)
{
/* --- Empty the symbol table --- */
/* --- Destroy and recreate the table --- */
sym_destroyTable(&name__table);
- name_init();
}
/* --- @name_find@ --- *
void name_dump(void)
{
+#ifdef TRACING
sym_iter i;
name *n;
trace(TRACE_DEBUG, "name: dumping `%s'", n->base.name);
class_dump(n->c);
}
+#endif
}
/*----- Test driver -------------------------------------------------------*/
int main(void)
{
ego("name-test");
- traceon(stdout, TRACE_ALL);
+ /* traceon(stdout, TRACE_ALL); */
userdb_init();
userdb_local();
userdb_yp();
netg_init();
name_init();
- name_dump();
+ printf("loaded (%lu)\n", track_memused());
+ getchar();
+ for (;;) {
+ name_end();
+ netg_end();
+ userdb_end();
+ printf("cleared (%lu)\n", track_memused());
+ track_memlist();
+ userdb_init();
+ userdb_local();
+ userdb_yp();
+ netg_init();
+ name_init();
+ printf("reloaded (%lu)\n", track_memused());
+ getchar();
+ }
return (0);
}