/* -*-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);
}
/* -*-c-*-
*
- * $Id: name.h,v 1.2 1997/08/04 10:24:24 mdw Exp $
+ * $Id: name.h,v 1.3 1997/08/20 16:18:05 mdw Exp $
*
* Looking up of names in symbol tables
*
/*----- Revision history --------------------------------------------------*
*
* $Log: name.h,v $
+ * Revision 1.3 1997/08/20 16:18:05 mdw
+ * Replace `name_reinit' by `name_end' for more sensible restart.
+ *
* Revision 1.2 1997/08/04 10:24:24 mdw
* Sources placed under CVS control.
*
extern void name_init(void);
-/* --- @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.
*/
-extern void name_reinit(void);
+extern void name_end(void);
/* --- @name_find@ --- *
*
/* -*-c-*-
*
- * $Id: netg.h,v 1.1 1997/08/07 09:45:00 mdw Exp $
+ * $Id: netg.h,v 1.2 1997/08/20 16:19:24 mdw Exp $
*
* A local database of netgroups
*
/*----- Revision history --------------------------------------------------*
*
* $Log: netg.h,v $
+ * Revision 1.2 1997/08/20 16:19:24 mdw
+ * Replace `name_reinit' by `name_end' for more sensible restart.
+ *
* Revision 1.1 1997/08/07 09:45:00 mdw
* New source file added to maintain a netgroups database.
*
extern void netg_init(void);
-/* --- @netg_reinit@ --- *
+/* --- @netg_end@ --- *
*
* Arguments: ---
*
* Returns: ---
*
- * Use: Forces a re-read of the netgroups file.
+ * Use: Empties the netgroups database.
*/
-extern void netg_reinit(void);
+extern void netg_end(void);
/*----- That's all, folks -------------------------------------------------*/