1 #ifndef HEADER_CARES_STRSPLIT_H 2 #define HEADER_CARES_STRSPLIT_H 3 4 /* Copyright (C) 2018 by John Schember <john@nachtimwald.com> 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 delem skipping empty elements. 22 * 23 * param in String to split. 24 * param delims 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 * param make_set Have the list be a Set where there are no 29 * duplicate entries. 1 for true, 0 or false. 30 * param num_elm Return parameter of the number of elements 31 * in the result array. 32 * 33 * returns an allocated array of allocated string elements. 34 * 35 */ 36 char **ares_strsplit(const char *in, const char *delms, int make_set, size_t *num_elm); 37 38 /* Frees the result returned from ares_strsplit(). */ 39 void ares_strsplit_free(char **elms, size_t num_elm); 40 41 42 #endif /* HEADER_CARES_STRSPLIT_H */ 43 44