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