1 #ifndef HEADER_CARES_STRSPLIT_H 2 #define HEADER_CARES_STRSPLIT_H 3 4 /* Copyright (C) 2018 by John Schember <[email protected]> 5 * 6 * Permission to use, copy, modify, and distribute this 7 * software and its documentation for any purpose and without 8 * fee is hereby granted, provided that the above copyright 9 * notice appear in all copies and that both that copyright 10 * notice and this permission notice appear in supporting 11 * documentation, and that the name of M.I.T. not be used in 12 * advertising or publicity pertaining to distribution of the 13 * software without specific, written prior permission. 14 * M.I.T. makes no representations about the suitability of 15 * this software for any purpose. It is provided "as is" 16 * without express or implied warranty. 17 */ 18 19 #include "ares_setup.h" 20 21 /* Split a string on delms skipping empty or duplicate elements. 22 * 23 * param in String to split. 24 * param delms String of characters to treat as a delimitor. 25 * Each character in the string is a delimitor so 26 * there can be multiple delimitors to split on. 27 * E.g. ", " will split on all comma's and spaces. 28 * Duplicate entries are removed. 29 * param num_elm Return parameter of the number of elements 30 * in the result array. 31 * 32 * returns an allocated array of allocated string elements. 33 * 34 */ 35 char **ares__strsplit(const char *in, const char *delms, size_t *num_elm); 36 37 /* Frees the result returned from ares__strsplit(). */ 38 void ares__strsplit_free(char **elms, size_t num_elm); 39 40 41 #endif /* HEADER_CARES_STRSPLIT_H */ 42 43