54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf#pragma ident "%Z%%M% %I% %E% SMI"
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf/* Copyright (c) 2004-2005, Novell, Inc.
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * All rights reserved.
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * Redistribution and use in source and binary forms, with or without
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * modification, are permitted provided that the following conditions are met:
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * * Redistributions of source code must retain the above copyright notice,
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * this list of conditions and the following disclaimer.
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * * Redistributions in binary form must reproduce the above copyright
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * notice, this list of conditions and the following disclaimer in the
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * documentation and/or other materials provided with the distribution.
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * * The copyright holder's name is not used to endorse or promote products
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * derived from this software without specific prior written permission.
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * POSSIBILITY OF SUCH DAMAGE.
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * Miscellaneous functions for managing the string and integer lists
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * Counts the number of entries in the given array of strings
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * Counts the number of entries in the given array of integers
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * Frees the entries in a given list and not the list pointer
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * Tokenize the given string based on the delimiter provided
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * and return the result as a list
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf if ((buffer == NULL) || (list == NULL) || (delimiter == NULL)) {
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf for (count = 1; ((token != NULL) && (count < MAX_LIST_ENTRIES));
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf const void *m1;
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf const void *m2;
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * Modifies the destination list to contain or not to contain the
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * entries present in the source list, depending on the mode
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * (ADD or DELETE).
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf const char **sourcelist;
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf if ((destlist == NULL) || (*destlist == NULL) || (sourcelist == NULL))
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf /* We need to add every entry present in the source list to
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * the destination list */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf /* Traverse throught the end of destlist for appending */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf ; /* NULL statement */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf /* Count the number of entries in the source list */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf ; /* NULL statement */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf /* Reset the slist pointer to the start of source list */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf /* Now append the source list to the existing destlist */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf /* Leave the last entry for list terminator(=NULL) */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf /* We need to delete every entry present in the source list
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * from the destination list */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf /* DN is case insensitive string */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf /* Advance the rest of the entries by one */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * Modifies the destination list to contain or not to contain the
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * entries present in the source list, depending on the mode
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * (ADD or DELETE). where the list is array of integers.
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf /* We need to add every entry present in the source list to the
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * destination list */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf /* Traverse throught the end of destlist for appending */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf for (dlist = destlist, dcount = 0; *dlist != END_OF_LIST;
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf ; /* NULL statement */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf /* Count the number of entries in the source list */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf for (slist = sourcelist, scount = 0; *slist != END_OF_LIST;
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf ; /* NULL statement */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf /* Reset the slist pointer to the start of source list */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf /* Now append the source list to the existing destlist */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf /* Leave the last entry for list terminator(=NULL) */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf /* We need to delete every entry present in the source list from
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf * the destination list */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf for (slist = sourcelist; *slist != END_OF_LIST; slist++) {
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf for (dlist = destlist; *dlist != END_OF_LIST; dlist++) {
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf /* Advance the rest of the entries by one */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf for (tmplist = dlist; *tmplist != END_OF_LIST; tmplist++) {
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf /* count the number of entries */
54925bf60766fbb4f1f2d7c843721406a7b7a3fbwillf for (dlist = destlist, tcount = 0; *dlist != END_OF_LIST; dlist++) {