• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _SPLITSTR_H_
2 #define _SPLITSTR_H_
3 /*
4  * Synopsis
5  *
6  * const char **splitstr(const char *str, const char *separator, int *argcount)
7  *
8  * Description
9  * This function splits a string (str) into components that are separated by
10  * one or more of the characters in the (separator) string.  An array of
11  * strings is returned, along with argcount being set to the number of strings
12  * found.  Argcount can be NULL.  There will always be a NULL element in the
13  * array after the last valid element.  If an error occurs, NULL will be
14  * returned and argcount will be set to zero.
15  *
16  * To rid yourself of the memory allocated for splitstr(), pass the return
17  * value from splitstr() unmodified to splitstr_free():
18  *
19  * void splitstr_free( const char ** return_from_splitstr );
20  *
21  */
22 const char **
23 splitstr(const char *, const char *, int *);
24 
25 /*
26  * splitster_free( const char ** )
27  *
28  * This takes the return value from splitster() and free()s memory
29  * allocated by splitster.  Assuming: ret=splitster(...), this
30  * requires that ret and *ret returned from splitster() have not
31  * been modified.
32  */
33 void
34 splitstr_free( const char ** );
35 
36 #endif
37