X-Git-Url: https://git.distorted.org.uk/~mdw/become/blobdiff_plain/8e3b89aebcd6d838c7fe0230e355fe133b5b5e12..a340752b9da6b63515d164fd5bb025b2be551a7a:/src/netg.c diff --git a/src/netg.c b/src/netg.c index 79bfa02..c198219 100644 --- a/src/netg.c +++ b/src/netg.c @@ -1,10 +1,10 @@ /* -*-c-*- * - * $Id: netg.c,v 1.2 1997/08/20 16:19:11 mdw Exp $ + * $Id: netg.c,v 1.4 1998/04/23 13:24:49 mdw Exp $ * * A local database of netgroups * - * (c) 1997 EBI + * (c) 1998 EBI */ /*----- Licensing notice --------------------------------------------------* @@ -29,7 +29,13 @@ /*----- Revision history --------------------------------------------------* * * $Log: netg.c,v $ - * Revision 1.2 1997/08/20 16:19:11 mdw + * Revision 1.4 1998/04/23 13:24:49 mdw + * Switch to using the ypstuff interface to YP server. + * + * Revision 1.3 1998/01/12 16:46:17 mdw + * Fix copyright date. + * + * Revision 1.2 1997/08/20 16:19:11 mdw * Patch memory leak. Replace `name_reinit' by `name_end' for more sensible * restart. Don't try to trace when tracing's turned off. * @@ -53,12 +59,6 @@ #include -#ifdef HAVE_YP -# include -# include -# include -#endif - #include #include @@ -75,6 +75,7 @@ #include "sym.h" #include "userdb.h" #include "utils.h" +#include "ypstuff.h" /*----- Type definitions --------------------------------------------------*/ @@ -554,29 +555,23 @@ static void netg__breakCycle(netg__cons *c) void netg_init(void) { - char *ypdom; - /* --- Initialise my symbol table --- */ sym_createTable(&netg__table); /* --- Bind myself unto a YP server --- */ - if (yp_get_default_domain(&ypdom) || - yp_bind(ypdom)) + ypstuff_bind(); + if (!yp_domain) return; /* --- Now try to read all the netgroup entries --- */ { static struct ypall_callback ncb = { netg__foreach, 0 }; - yp_all(ypdom, "netgroup", &ncb); + yp_all(yp_domain, "netgroup", &ncb); } - /* --- Unbind from the server --- */ - - yp_unbind(ypdom); - /* --- Dump the table --- */ IF_TRACING(TRACE_DEBUG, netg__dump(); )