ares_strsplit.h 1.6 KB

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