/* ******************************************************************************* * Copyright (c) 1996 Martin Poole * ******************************************************************************* ** ** WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! ** ** Any changes to be made to this file should first be checked with ** mplib1 source control for library integrity. ** ** mplib1 source control can be reached at mplib1@quatermass.co.uk ** * * $Source: /home/cvs/cvsroot/onelan/onelan/src/mplib1/libsrc/cfg_f_001.c,v $ * $Author: mpoole $ * $Date: 2002/10/07 09:37:37 $ * $Revision: 1.2 $ * ******************************************************************************* * * Change History * * $Log: cfg_f_001.c,v $ * Revision 1.2 2002/10/07 09:37:37 mpoole * Initial checkin of mplib1-3.1.0 * * Revision 1.1 2002/10/07 09:36:54 mpoole * Initial checkin of mplib1-3.1.0 * * ******************************************************************************* */ #ident "$Header: /home/cvs/cvsroot/onelan/onelan/src/mplib1/libsrc/cfg_f_001.c,v 1.2 2002/10/07 09:37:37 mpoole Exp $" /* ------------------------------------------------------------------ Include files ------------------------------------------------------------------ */ #include #include #include #include #include #include #include #include /* ------------------------------------------------------------------ defines ------------------------------------------------------------------ */ static char config_list[]="config_items"; static int done_init=0; static struct config_list *def_list=NULL; static dl_List_t current_lists; /* ------------------------------------------------------------------ Code starts here ------------------------------------------------------------------ */ struct config_list * get_config_list( const char *list_name, int create ) { struct config_list *clp; if (!done_init) { done_init = 1; (void)dl_Init_List( ¤t_lists, LN_IGNORECASE ); } if (list_name==NULL) { if (def_list) return(def_list); list_name = config_list; } clp = dl_Find_Item_By_Name( ¤t_lists, list_name ); if (clp==NULL && create) { clp = malloc( sizeof(struct config_list) + Sstrlen(list_name) ); if (clp) { if (list_name==config_list) def_list = clp; Sstrcpy( clp->cl_name, list_name ); clp->cl_flags=0; (void)dl_Init_Node( &clp->cl_Node, clp->cl_name, clp ); (void)dl_Init_List( &clp->cl_Items, LN_IGNORECASE ); (void)dl_Add_Head( ¤t_lists, &clp->cl_Node ); } } return(clp); } dl_List_t * get_config_list_list( void ) { if (!done_init) { done_init = 1; (void)dl_Init_List( ¤t_lists, LN_IGNORECASE ); } return( ¤t_lists ); } /* -- End of File -- */